Hi !
I’m trying to control pins which are IC’s reset pins.
LAN7800_1 RSTLAN GPIO4_B4 (pin 265) gpio140
LAN7800_2 RSTLAN GPIO4_C2 (pin 235) gpio146
FT4232 RSTFT4232H_1 GPIO4_B2 (pin 314) gpio138
FT4232 RSTFT4232H_2 GPIO4_B3 (pin 313) gpio139
I used instruction from wiki ( https://wiki.t-firefly.com/en/ROC-RK3568-PC/driver_gpio.html)
So I got this (via $cat /sys/kernel/debug/gpio):
gpiochip4: GPIOs 128-159, parent: platform/fe770000.gpio, gpio4:
gpio-138 ( |sysfs ) out hi
gpio-139 ( |sysfs ) out hi
gpio-140 ( |sysfs ) out hi
gpio-146 ( |sysfs ) out hi
But it doesn’t take any effect. So maybe I need some additional magic 
Could you please help me?
linux: ubuntu, rk3568, image was generated from SDK.
The control method is as described in WIKI. Is the IO level unchanged? And is IO multiplexed?
When GPIO4_D5 pin is not reused by other peripherals, we can export this pin to use
:/ # ls /sys/class/gpio/
export gpiochip128 gpiochip32 gpiochip64 unexport
gpiochip0 gpiochip255 gpiochip500 gpiochip96
:/ # echo 157 > /sys/class/gpio/export
:/ # ls /sys/class/gpio/
export gpiochip0 gpiochip255 gpiochip500 gpiochip96
gpio157 gpiochip128 gpiochip32 gpiochip64 unexport
:/ # ls /sys/class/gpio/gpio157
active_low device direction edge power subsystem uevent value
:/ # cat /sys/class/gpio/gpio157/direction
in
:/ # cat /sys/class/gpio/gpio157/value
0
Actually, yes, I had found that one pin used by i2c bus, I disabled that bus and my pin config cause on pin front.
How can I check that the IO level is unchanged and IO is multiplexed?
valeriy.simakov Posted at 5/8/2022 03:05
Actually, yes, I had found that one pin used by i2c bus, I disabled that bus and my pin config cause …
Check the IO level status through commands or measure the actual value with a multimeter. cat /sys/kernel/debug/gpio
Check if IO is multiplexed, cat /sys/kernel/debug/pinctrl/pinctrl-rockchip-pinctrl/pinmux-pins
时间的蝴蝶 Posted at 5/9/2022 14:28
Check the IO level status through commands or measure the actual value with a multimeter. `cat /sy …
I added my pins to dts and checked:
cat /sys/kernel/debug/gpio:
gpiochip4: GPIOs 128-159, parent: platform/fe770000.gpio, gpio4:
gpio-138 ( |RSTFT4232H_1 ) out hi
gpio-139 ( |RSTFT4232H_2 ) out hi
gpio-140 ( |lan7800_1 ) out hi
gpio-141 ( |RSTUSB2251 ) out hi
gpio-146 ( |lan7800_2 ) out hi
gpio-154 ( |lan_hub ) out hi
cat /sys/kernel/debug/pinctrl/pinctrl-rockchip-pinctrl/pinmux-pins:
pin 138 (gpio4-10): (MUX UNCLAIMED) gpio4:138
pin 139 (gpio4-11): (MUX UNCLAIMED) gpio4:139
pin 140 (gpio4-12): (MUX UNCLAIMED) gpio4:140
pin 141 (gpio4-13): (MUX UNCLAIMED) gpio4:141
pin 146 (gpio4-18): (MUX UNCLAIMED) gpio4:146
pin 154 (gpio4-26): (MUX UNCLAIMED) gpio4:154
But on the board they are 1.2v, only lan7800_2 is 3.4v
I’m new to Linux, maybe I made mistakes…
// New pins:
RSTUSB2251 GPIO4_B5 gpio141
lan_hub GPIO4_D2 gpio154
// My dts modifications:
b[/b]
/ {
…
firefly_leds: leds {
…
lan7800_1_reset: lan7800_1 {
default-state = "on";
gpios = <&gpio4 RK_PB4 GPIO_ACTIVE_HIGH>;
pinctrl-names = "gpio";
pinctrl-1 = <&lan7800_1>;
};
lan7800_2_reset: lan7800_2 {
default-state = "on";
gpios = <&gpio4 RK_PC2 GPIO_ACTIVE_HIGH>;
pinctrl-names = "gpio";
pinctrl-1 = <&lan7800_2>;
};
lan_hub_reset: lan_hub {
default-state = "on";
gpios = <&gpio4 RK_PD2 GPIO_ACTIVE_HIGH>;
pinctrl-names = "gpio";
pinctrl-1 = <&lan_hub>;
};
RSTFT4232H_1_reset: RSTFT4232H_1 {
default-state = "on";
gpios = <&gpio4 RK_PB2 GPIO_ACTIVE_HIGH>;
pinctrl-names = "gpio";
pinctrl-1 = <&RSTFT4232H_1>;
};
RSTFT4232H_2_reset: RSTFT4232H_2 {
default-state = "on";
gpios = <&gpio4 RK_PB3 GPIO_ACTIVE_HIGH>;
pinctrl-names = "gpio";
pinctrl-1 = <&RSTFT4232H_2>;
};
RSTUSB2251_reset: RSTUSB2251 {
default-state = "on";
gpios = <&gpio4 RK_PB5 GPIO_ACTIVE_HIGH>;
pinctrl-names = "gpio";
pinctrl-1 = <&RSTUSB2251>;
};
};
…
};
&pinctrl {
…
leds {
…
lan7800_1: lan7800_1 {
rockchip,pins = <4 RK_PB4 RK_FUNC_GPIO &pcfg_pull_up>;
};
lan7800_2: lan7800_2 {
rockchip,pins = <4 RK_PC2 RK_FUNC_GPIO &pcfg_pull_up>;
};
lan_hub: lan_hub {
rockchip,pins = <4 RK_PD2 RK_FUNC_GPIO &pcfg_pull_up>;
};
RSTFT4232H_1: RSTFT4232H_1 {
rockchip,pins = <4 RK_PB2 RK_FUNC_GPIO &pcfg_pull_up>;
};
RSTFT4232H_2: RSTFT4232H_2 {
rockchip,pins = <4 RK_PB3 RK_FUNC_GPIO &pcfg_pull_up>;
};
RSTUSB2251: RSTUSB2251 {
rockchip,pins = <4 RK_PB5 RK_FUNC_GPIO &pcfg_pull_up>;
};
};
};
rk3568-firefly-roc-pc.zip (1.69 KB)
valeriy.simakov Posted at 5/10/2022 21:49
I added my pins to dts and checked:
cat /sys/kernel/debug/gpio:
It seems that the control of the IO port is normal.
Maybe you should check the effect of the peripheral circuit on the voltage.
时间的蝴蝶 Posted at 5/11/2022 16:16
It seems that the control of the IO port is normal.
Maybe you should check the effect of the peri …
“But on the board they are 1.2v, only lan7800_2 is 3.4v”
Maybe I can adjust the voltage, because it is not the same for different pins? It’s strange 
Your article was so impressive, I’m deeply thankful. Here’s the 1Y0-342 latest exam preparation test that played a part in my promotion and salary increase, and it’s free for you today! Wishing you all the best in your career!