我想配置一组soc管脚作为gpio输入或输出使用默认值。我们正在使用AM3352 SOC和类似于Beaglebone Black的定制板。
我检查了调试日志,发现设备树得到了正确的解析。
但是当我在内核加载后检查时,所有带pinmuxed的gpio都处于默认状态(即:所有都是输入,值为0)
我在设备树中设置的方向和默认值不存在。(重置?)
任何线索或帮助都是非常感谢的。
我决定在设备树中做这个PiMuxIn,我的设备树条目如下。
/*在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";
};
最佳答案
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),
关于linux - 设备树中的AM335x GPIO多路复用在内核加载期间重置,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/37700997/