Linkit7688 mt7688_pinmux on OpenWrt 18.06.2

After upgrading my Linkit7688 based board from 15.05.1 to 18.06.2 and removing Libmraa dependency from my application,I was stuck while doing UART communication

I found out that we need to setup gpio pins using mt7688_pinmux for UART to work properly

but it seems this utility is not part of OpenWrt 18.06.2 and if I build and run this utility using sdk for 18.06.2, it gives me following error

root@mylinkit:~/ctusr/scripts# ./mt7688_pinmux
unable to open mmap file

It seems

#define MMAP_PATH			"/dev/mem"

does not exists in latest OpenWrt

Is there a way to replicate the functionality of mt7688_pinmux ?
I appreciate any help.

Serial should already be set up in the DTS. Which pins, input/output, active high/low, and which functions?

(mt7688_pinmux doesn't sound like an OpenWrt script)

I am talking about the following utility

and we are running following script

	mt7688_pinmux set pwm0 gpio
	mt7688_pinmux set pwm1 gpio
	mt7688_pinmux set i2c gpio
	mt7688_pinmux set spi_s gpio
	mt7688_pinmux set spi_cs1 gpio
	mt7688_pinmux set refclk gpio

Anything like that is likely going to be fighting with the kernel and the DTS.

Welcome to the world of obsolete, unmaintained code from OEMs, ODMs, and vendors...

You'll have to carefully compare what is being set there with what is set in the DTS.

GPIOs, when not already reserved for a device (which they should be for a UART), can be managed from user-space with the gpiod-tools as the current way to do so. The "sysfs" approach with export is deprecated, so might as well write against tooling that isn't going to disappear after 2020.

1 Like

I tried to create /dev/mem using the following commands

mknod -m 660 /dev/mem c 1 1
chown root:root /dev/mem


getting errors to access the /dev/mem

edit disregard the above one
compiled the kernel with correct config and now can access /dev/mem/

1 Like

I do want to update the code but time and money constrains do not allow it

1 Like

@umesh I am facing the same issue. Can you please post what is the configuration that you corrected to fix this?

Found the fix for this issue. Posting for future references for anyone facing this issue:

~/openwrt$ make menuconfig

  # Menu config opens:
  1. Goto `Global Build Settings -->`
  2. Select `Kernel build options -->`
  3. Scroll down to the option `/dev/mem/ virtual device support` and enable it.
  4. Save the configuration and exit

~/openwrt$ make V=s

I saw that you successfully made pinmux work. I have been using mt7688 with the module skw_92a, I switched to linkit7688 recently. I have been using the I2S pins as GPIO in skw_92a by modifying DTS file. In the original firmware of the linkit its OK to use I2S as gpio, no problem. However when I want to use openwrt 19, I2S doesn't switch to GPIO mode even though I change DTS file and compile whole SDK from zero. The only thing I didn't change is the bootloader.