嵌入式爱好者

M核gpio在A核使用

2023-9-27 16:05| 发布者: Q_Y_X| 查看: 179| 评论: 0

类目: AM6254系列产品  >  linux     文档编号: 1140

测试方法

cat /sys/kernel/debug/gpio    //查看gpio分组
gpiochip2: GPIOs 314-401, parent: platform/601000.gpio, 601000.gpio:
 gpio-330 (                    |led1                ) out lo 
 gpio-331 (                    |led2                ) out lo 
 gpio-332 (                    |led3                ) out lo 
 gpio-333 (                    |led4                ) out lo 
 gpio-336 (                    |fixed-regulator-rgb ) out lo 

gpiochip1: GPIOs 402-488, parent: platform/600000.gpio, 600000.gpio:
 gpio-433 (                    |net-5g-rst          ) out lo ACTIVE LOW
 gpio-437 (                    |phy_rstn            ) out lo 
 gpio-438 (                    |id                  ) in  hi 
 gpio-440 (                    |RT9186              ) out lo 
 gpio-442 (                    |phy_rstn            ) out lo 
 gpio-444 (                    |heartbeat           ) out lo 
 gpio-473 (                    |regulator-6         ) out lo 

gpiochip0: GPIOs 489-511, parent: platform/4201000.gpio, 4201000.gpio:

通过地址可知489-511的gpio为M核的

echo 496 > /sys/class/gpio/export    以mcu_gpio0_7为例,gpio号为489+7=496
echo out > /sys/class/gpio/gpio496/direction    设置输出
echo 0/1 > /sys/class/gpio/gpio496/value    设置电平高低

设备树修改见patch
需要MCU的gpio的节点去调用该引脚服用才可以控制
diff --git a/arch/arm64/boot/dts/ti/OK6254-C.dts b/arch/arm64/boot/dts/ti/OK6254-C.dts
index cf9420ab0..730837b90 100644
--- a/arch/arm64/boot/dts/ti/OK6254-C.dts
+++ b/arch/arm64/boot/dts/ti/OK6254-C.dts
@@ -591,6 +591,12 @@
     };
};
+&mcu_gpio0 {
+pinctrl-names = "default";
+pinctrl-0 =<&mcu_gpio_led_pins_default>;
+status = "okay";
+};
+
&mcu_spi0 {
     pinctrl-names = "default";
     pinctrl-0 = <&mcu_spi0_pins_default>;

已解决

未解决

只是看看

QQ|小黑屋| 飞凌嵌入式 ( 冀ICP备12004394号-1 )

GMT+8, 2024-12-24 03:06

Powered by Discuz! X3.4

© 2001-2013 Comsenz Inc.

返回顶部