我想配置一组SoC引脚作为GPIO输入或输出使用默认值。我们使用am3352 SoC和类似于Beaglebone Black的定制板。
我通过调试日志检查了设备树是否正确解析。
但是当我在内核加载后检查时,我有pinmux的所有GPIO都处于默认状态(即:所有输入都是0,值为0)
我在设备树中设置的方向和默认值不存在。 (复位?)
非常感谢任何线索或帮助。
我决定在设备树中执行此pinmuxing,我的设备树条目如下。
/ *在am33xx.dtsi中,与Beaglebone Black * /
中使用的文件相同gpio0: gpio@44e07000 {
compatible = "ti,omap4-gpio";
ti,hwmods = "gpio1";
gpio-controller;
#gpio-cells = <2>;
interrupt-controller;
#interrupt-cells = <2>;
reg = <0x44e07000 0x1000>;
interrupts = <96>;
};
gpio1: gpio@4804c000 {
compatible = "ti,omap4-gpio";
ti,hwmods = "gpio2";
gpio-controller;
#gpio-cells = <2>;
interrupt-controller;
#interrupt-cells = <2>;
reg = <0x4804c000 0x1000>;
interrupts = <98>;
};
gpio2: gpio@481ac000 {
compatible = "ti,omap4-gpio";
ti,hwmods = "gpio3";
gpio-controller;
#gpio-cells = <2>;
interrupt-controller;
#interrupt-cells = <2>;
reg = <0x481ac000 0x1000>;
interrupts = <32>;
};
gpio3: gpio@481ae000 {
compatible = "ti,omap4-gpio";
ti,hwmods = "gpio4";
gpio-controller;
#gpio-cells = <2>;
interrupt-controller;
#interrupt-cells = <2>;
reg = <0x481ae000 0x1000>;
interrupts = <62>;
};
/ *然后在am335x-boneblack.dts文件中我添加了以下* /
&am33xx_pinmux {
gpio0_pins: gpio0_pins {
pinctrl-single,pins = <
0x144 (PIN_OUTPUT_PULLUP | MUX_MODE7) /* RMII1_REF_CLK as GPIO out */
0x158 (PIN_OUTPUT_PULLDOWN | MUX_MODE7) /* pin conf_spi0_d1 as GPIO out */
0x15c (PIN_OUTPUT_PULLDOWN | MUX_MODE7) /* pin conf_spi0_cs0 as GPIO out */
/*0x160 (PIN_INPUT | MUX_MODE7)*/ /* pin conf_spi0_cs1 as GPIO input */
>;
};
gpio1_pins: gpio1_pins {
pinctrl-single,pins = <
0x050 (PIN_INPUT | MUX_MODE7) /* pin conf_gpmc_a4 as GPIO input */
0x054 (PIN_OUTPUT_PULLUP | MUX_MODE7) /* pin conf_gpmc_a5 as GPIO out */
0x05c (PIN_INPUT | MUX_MODE7) /* pin conf_gpmc_a7 as GPIO input */
0x058 (PIN_OUTPUT_PULLDOWN | MUX_MODE7) /* pin conf_gpmc_a6 as GPIO out */
0x060 (PIN_INPUT | MUX_MODE7) /* pin conf_gpmc_a8 as GPIO input */
0x064 (PIN_INPUT | MUX_MODE7) /* pin conf_gpmc_a9 as GPIO input */
/*0x068 (PIN_OUTPUT_PULLUP | MUX_MODE7)*/ /* pin conf_gpmc_a10 as GPIO out */
0x06c (PIN_INPUT | MUX_MODE7) /* pin conf_gpmc_a11 as GPIO input */
/*0x078 (PIN_OUTPUT_PULLUP | MUX_MODE7)*/ /* pin gpmc_ben1 as GPIO out */
0x080 (PIN_INPUT | MUX_MODE7) /* pin conf_gpmc_csn1 as GPIO input */
0x084 (PIN_INPUT | MUX_MODE7) /* pin conf_gpmc_csn2 as GPIO input */
>;
};
gpio2_pins: gpio2_pins {
pinctrl-single,pins = <
0x088 (PIN_OUTPUT_PULLDOWN | MUX_MODE7) /* pin conf_gpmc_csn3 as GPIO output */
0x08c (PIN_INPUT | MUX_MODE7) /* pin conf_gpmc_csn3 as GPIO input */
0x0a4 (PIN_OUTPUT_PULLUP | MUX_MODE7) /* pin conf_lcd_data1 as GPIO out */
0x0a8 (PIN_OUTPUT_PULLDOWN | MUX_MODE7) /* pin conf_lcd_data2 as GPIO out */
0x0b0 (PIN_INPUT | MUX_MODE7) /* pin conf_lcd_data4 as GPIO input */
0x0b4 (PIN_OUTPUT_PULLDOWN | MUX_MODE7) /* pin conf_lcd_data5 as GPIO out */
0x0b8 (PIN_OUTPUT_PULLDOWN | MUX_MODE7) /* pin conf_lcd_data6 as GPIO out */
0x0bc (PIN_OUTPUT_PULLDOWN | MUX_MODE7) /* pin conf_lcd_data7 as GPIO out */
0x0e8 (PIN_INPUT | MUX_MODE7) /* pin conf_lcd_pclk as GPIO input */
0x0e0 (PIN_INPUT | MUX_MODE7) /* pin conf_lcd_vsync as GPIO input */
>;
};
gpio3_pins: gpio3_pins {
pinctrl-single,pins = <
/*0x1a0 (PIN_OUTPUT_PULLUP | MUX_MODE7)*/ /* pin conf_mcasp0_aclkr as GPIO out */
0x1a4 (PIN_INPUT | MUX_MODE7) /* pin conf_mcasp0_fsr as GPIO input */
0x1a8 (PIN_INPUT | MUX_MODE7) /* pin conf_mcasp0_axr1 as GPIO input */
>;
};
};
&gpio0{
ti,gpio-always-on;
pinctrl-names = "default";
pinctrl-0 = <&gpio0_pins>;
status = "okay";
};
&gpio1{
ti,gpio-always-on;
pinctrl-names = "default";
pinctrl-0 = <&gpio1_pins>;
status = "okay";
};
&gpio2{
ti,gpio-always-on;
pinctrl-names = "default";
pinctrl-0 = <&gpio2_pins>;
status = "okay";
};
&gpio3{
ti,gpio-always-on;
pinctrl-names = "default";
pinctrl-0 = <&gpio3_pins>;
status = "okay";
};
答案 0 :(得分:0)
1 diff --git a/arch/arm/mach-omap2/omap_hwmod_33xx_43xx_ipblock_data.c b/arch/arm/mach-omap2/omap_hwmod_33xx_43xx_ipblock_data.c
2 index cb6f820..48fe676 100644
3 --- a/arch/arm/mach-omap2/omap_hwmod_33xx_43xx_ipblock_data.c
4 +++ b/arch/arm/mach-omap2/omap_hwmod_33xx_43xx_ipblock_data.c
5 @@ -608,7 +608,7 @@ static struct omap_hwmod_class_sysconfig am33xx_gpio_sysc = {
6 .sysc_offs = 0x0010,
7 .syss_offs = 0x0114,
8 .sysc_flags = (SYSC_HAS_AUTOIDLE | SYSC_HAS_ENAWAKEUP |
9 - SYSC_HAS_SIDLEMODE | SYSC_HAS_SOFTRESET |
10 + SYSC_HAS_SIDLEMODE /*|SYSC_HAS_SOFTRESET*/ |
11 SYSS_HAS_RESET_STATUS),
12 .idlemodes = (SIDLE_FORCE | SIDLE_NO | SIDLE_SMART |
13 SIDLE_SMART_WKUP),
答案 1 :(得分:0)
我遇到了类似的问题,当我在引导加载程序中配置gpio时,gpio在内核启动时被重置,并找到了不同的解决方案。
我遇到的解决方案是在设备树中;
&gpio0 {
ti,no-reset-on-init;
};
这阻止了init进程重置gpio模块。我不得不将这个选项添加到我希望保持引导加载程序设置状态的两个gpio模块中。