Linkit Smart 7688 GPIO pin map on OpenWrt 21.02.0

Hello

I'm trying to upgrade a bunch of devices based on Linkit Smart 7688 with the original installed version Chaos Calmer 15.05.1 to a newest version with Python 3 support.

My main problem has been the GPIO ports, I can't change them, because I need to keep the hardware backwards compatibility.

My first problem is in all the new versions I can't use the GPIO 12 and GPIO 13 because seems they are used by the UART 0. How can I disable the UART 0 or change it to a normal GPIO pins?

My second problem is when I tried with the version 18 and 19.07.8, I got the same GPIO pin map from the version 15 linked to the gpiochip0, gpiochip32 and gpiochip64.

But when I tried version 21.02.0, I got GPIO ports with numbers over 400 linked to the gpiochip416, gpiochip448 and gpiochip480.

I'm trying now to compile OpenWrt from the source code with all the packages that we need, but still I have problems with the GPIO pins. Where is the configuration file to maps the GPIO ports?

Thanks in advance
Jose

Hello joniuz,

Maybe you can disable uartlite (mapped to uart0 pins) in your LINKIT7688.dts:

		uartlite@c00 {
			status = "disabled";
		};

For example, at the top of uart1 and uart2 inside the palmbus statement:

		uartlite@c00 {
			status = "disabled";
		};

		uart1@d00 {
			status = "okay";
		};

		uart2@e00 {
			status = "okay";
		};

Maybe serial order in /dev/ttySx could change, so test and change the console in bootargs to the desired one.

Hope this works!

I had a similar situation where I was using uartlite pins as gpios.

Had the below configuration in my dts. Everything working, I could now use gpio#12 and gpio#13, uart2 (Used as Debug) mapped to ttyS0 and uart1 mapped to ttyS1.

#include "mt7628an.dtsi"

#include <dt-bindings/gpio/gpio.h>
#include <dt-bindings/input/input.h>

/ {
........
........
	chosen {
		bootargs = "console=ttyS0,57600";	/* Changed from ttyS2 since uart2 is configured to appear as ttyS0  in "aliases" node */
	};

	aliases {
		serial0 = &uart2;	/* Force uart2 to appear as ttyS0 */
		serial1 = &uart1;	/* Force uart1 to appear as ttyS1 */
	};
......
......
&state_default {
..............
	uartlite {
		groups = "uart0";
		function = "gpio";
	};
};

....
&uartlite {
	status = "disabled";
};

The above was implemented in openwrt 21.02

Afterwards, if you export gpio 492 and 493 below will be match
gpio#12 -> gpio-492
gpio#13 -> gpio-493

You can view the gpio configuration with:

root@mylinkit:/# cat /sys/kernel/debug/gpio
gpiochip2: GPIOs 416-447, parent: platform/10000600.gpio, 10000600.gpio-bank2:
.....
gpiochip1: GPIOs 448-479, parent: platform/10000600.gpio, 10000600.gpio-bank1:
.....
gpiochip0: GPIOs 480-511, parent: platform/10000600.gpio, 10000600.gpio-bank0:
gpio-492 (                    |sysfs             ) in  hi
gpio-493 (                    |sysfs             ) in  hi

Hope this helps