您尚未登录。

#2 RK3288/RK3399/RK1108 » rk3506g2 设备树gpio-keys设置不当导致无法boot » 今天 04:12:45

sanddsy
回复: 1

使用如下设备树配置,启动到寻找sd卡分区之后就无法启动。
屏蔽pinctrl部分可以启动,能够加载event,但是无法操作,会报错:root@luckfox:/# echo 44 > /sys/class/gpio/export
bash: echo: write error: Device or resource busy
查看gpio信息如下:
root@luckfox:/# cat /sys/kernel/debug/gpio
gpiochip0: GPIOs 0-31, parent: platform/ff940000.gpio, gpio0:
gpio-0   (                    |sysfs               ) in  hi
gpio-10  (                    |GPIO_Key_Screenlock ) in  lo IRQ ACTIVE LOW
gpio-14  (                    |pwr                 ) out hi ACTIVE LOW
gpio-15  (                    |BTN-A               ) in  lo IRQ ACTIVE LOW
gpio-21  (                    |vdd-cpux            ) out lo

gpiochip1: GPIOs 32-63, parent: platform/ff870000.gpio, gpio1:
gpio-42  (                    |reset               ) out hi ACTIVE LOW
gpio-43  (                    |KEY-VOLUMEDOWN      ) in  lo IRQ ACTIVE LOW
gpio-44  (                    |KEY-VOLUMEUP        ) in  lo IRQ ACTIVE LOW
gpio-45  (                    |BTN-X               ) in  lo IRQ ACTIVE LOW
gpio-46  (                    |BTN-Y               ) in  lo IRQ ACTIVE LOW
gpio-47  (                    |BTN-B               ) in  lo IRQ ACTIVE LOW
gpio-51  (                    |sysfs               ) in  lo
gpio-58  (                    |work-led            ) out lo

gpiochip2: GPIOs 64-95, parent: platform/ff1c0000.gpio, gpio2:
gpio-73  (                    |DPAD-UP             ) in  lo IRQ ACTIVE LOW
gpio-74  (                    |DPAD-LEFT           ) in  lo IRQ ACTIVE LOW
gpio-75  (                    |DPAD-RIGHT          ) in  lo IRQ ACTIVE LOW
gpio-76  (                    |DPAD-DOWN           ) in  lo IRQ ACTIVE LOW
gpio-77  (                    |BTN-SELECT          ) in  lo IRQ ACTIVE LOW
gpio-78  (                    |BTN-MODE            ) in  lo IRQ ACTIVE LOW
gpio-79  (                    |BTN-START           ) in  lo IRQ ACTIVE LOW

gpiochip3: GPIOs 96-127, parent: platform/ff1d0000.gpio, gpio3:
gpio-104 (                    |sysfs               ) in  lo

gpiochip4: GPIOs 128-159, parent: platform/ff1e0000.gpio, gpio4:
root@luckfox:/# piochip0: GPIOs 0-31, parent: platform/ff940000.gpio, gpio0:
o-0   (                    |sysfs               ) in  hi
bash: piochip0:: command not found
gpio-10  (                    |GPIO_Key_Sroot@luckfox:/#  gpio-0   (                    |sysfs               ) in  hi
bash: syntax error near unexpected token `|'
                 root@luckfox:/#  gpio-10  (                    |GPIO_Key_Screenlock ) in  lo IRQ ACTIVE LOW
Lbash: syntax error near unexpected token `|'
OW
root@luckfox:/#  gpio-14  (                    |pwr                 ) out hi ACTIVE LOW
bash: syntax error near unexpected token `|'
        ) root@luckfox:/#  gpio-15  (                    |BTN-A               ) in  lo IRQ ACTIVE LOW
bash: syntax error near unexpected token `|'
     |vdd-cpux   root@luckfox:/#  gpio-21  (                    |vdd-cpux            ) out lo
bash: syntax error near unexpected token `|'

贴出有问题的gpio-keys部分:
gpio_power: gpio-power {
        status = "okay";
        compatible = "gpio-keys";
        pinctrl-names = "default";
        pinctrl-0 = <&pwrbtn>;       
       
        key_screenlock:key-screenlock {
            label = "GPIO_Key_Screenlock";
            linux,code = <KEY_SCREENLOCK>;
            linux,input-type = <1>;
            gpios = <&gpio0 RK_PB2 GPIO_ACTIVE_LOW>;   
            wakeup-source;
            debounce-interval = <100>;
        };
       
        pwr: pwr {
            gpios = <&gpio0 RK_PB6 GPIO_ACTIVE_LOW>;
            label = "Core Power Off";
        };
    };
   
    gpioPad: gpioPad {
        status = "okay";
        compatible = "gpio-keys";
        pinctrl-names = "default";
        pinctrl-0 = <&gpio_pad>;
                   
        button_a:button-a {
            label = "BTN-A";
            linux,code = <BTN_SOUTH>;
            gpios = <&gpio0 RK_PB7 GPIO_ACTIVE_LOW>;
            debounce-interval = <100>;
        };

        button_b:button-b {
            label = "BTN-B";
            linux,code = <BTN_EAST>;
            gpios = <&gpio1 RK_PB7 GPIO_ACTIVE_LOW>;
            debounce-interval = <100>;
        };

        button_x:button-x {
            label = "BTN-X";
            linux,code = <BTN_NORTH>;
            gpios = <&gpio1 RK_PB5 GPIO_ACTIVE_LOW>;
            autorepeat;
            debounce-interval = <100>;
        };

        button_y:button-y {           
            label = "BTN-Y";
            linux,code = <BTN_WEST>;
            gpios = <&gpio1 RK_PB6 GPIO_ACTIVE_LOW>;
            autorepeat;
            debounce-interval = <100>;
        };

        button_up:button-up {           
            label = "DPAD-UP";
            linux,code = <BTN_DPAD_UP>;
            gpios = <&gpio2 RK_PB1 GPIO_ACTIVE_LOW>;
            debounce-interval = <100>;
        };

        button_down:button-down {           
            label = "DPAD-DOWN";
            linux,code = <BTN_DPAD_DOWN>;
            gpios = <&gpio2 RK_PB4 GPIO_ACTIVE_LOW>;
            debounce-interval = <100>;
        };

        button_left:button-left {
            label = "DPAD-LEFT";
            linux,code = <BTN_DPAD_LEFT>;
            gpios = <&gpio2 RK_PB2 GPIO_ACTIVE_LOW>;
            debounce-interval = <100>;
        };

        button_right:button-right {           
            label = "DPAD-RIGHT";
            linux,code = <BTN_DPAD_RIGHT>;
            gpios = <&gpio2 RK_PB3 GPIO_ACTIVE_LOW>;
            debounce-interval = <100>;
        };

        button_select:button-select {           
            label = "BTN-SELECT";
            linux,code = <BTN_SELECT>;
            gpios = <&gpio2 RK_PB5 GPIO_ACTIVE_LOW>;
            debounce-interval = <100>;
        };

        button_start:button-start {           
            label = "BTN-START";
            linux,code = <BTN_START>;
            gpios = <&gpio2 RK_PB7 GPIO_ACTIVE_LOW>;
            debounce-interval = <100>;
        };

        button_memu:button-memu {           
            label = "BTN-MODE";
            linux,code = <BTN_MODE>;
            gpios = <&gpio2 RK_PB6 GPIO_ACTIVE_LOW>;
            debounce-interval = <100>;
        };
    };
   
    gpioVolume:gpioVolume{
        status = "okay";
        compatible = "gpio-keys";
        autorepeat;
        pinctrl-names = "default";
        pinctrl-0 = <&gpio_volume>;

        button_volumeup:button-volumeup {           
            label = "KEY-VOLUMEUP";
            linux,code = <KEY_VOLUMEUP>;
            gpios = <&gpio1 RK_PB4 GPIO_ACTIVE_LOW>;
            debounce-interval = <100>;
        };

        button_volumedown:button-volumedown {           
            label = "KEY-VOLUMEDOWN";
            linux,code = <KEY_VOLUMEDOWN>;
            gpios = <&gpio1 RK_PB3 GPIO_ACTIVE_LOW>;
            debounce-interval = <100>;
        };
    };

&gpio0 {
    gpio-controller;
    //gpio-cells = <2>;
    interrupt-controller;
    //interrupt-cells = <2>;
};

&gpio1 {
    gpio-controller;
    //gpio-cells = <2>;
    interrupt-controller;
    //interrupt-cells = <2>;
};

&gpio2 {
    gpio-controller;
    //gpio-cells = <2>;
    interrupt-controller;
    //interrupt-cells = <2>;
};

&pinctrl {
    powerBtn {
        pwrbtn: pwrbtn {
            rockchip,pin =
                <0 RK_PB2 RK_FUNC_GPIO &pcfg_pull_up>,
                <0 RK_PB6 RK_FUNC_GPIO &pcfg_output_high>;
        };
    };
    gpioPad {
        gpio_pad: gpio-pad {
            rockchip,pin =
                <0 RK_PB7 RK_FUNC_GPIO &pcfg_pull_up>,
                <1 RK_PB7 RK_FUNC_GPIO &pcfg_pull_up>,
                <1 RK_PB5 RK_FUNC_GPIO &pcfg_pull_up>,
                <1 RK_PB6 RK_FUNC_GPIO &pcfg_pull_up>,
                <2 RK_PB1 RK_FUNC_GPIO &pcfg_pull_up>,
                <2 RK_PB4 RK_FUNC_GPIO &pcfg_pull_up>,
                <2 RK_PB2 RK_FUNC_GPIO &pcfg_pull_up>,
                <2 RK_PB3 RK_FUNC_GPIO &pcfg_pull_up>,
                <2 RK_PB5 RK_FUNC_GPIO &pcfg_pull_up>,
                <2 RK_PB7 RK_FUNC_GPIO &pcfg_pull_up>,
                <2 RK_PB6 RK_FUNC_GPIO &pcfg_pull_up>;
        };
    };
    gpioVolume{
        gpio_volume: gpio-volume {
            rockchip,pin =
                <1 RK_PB4 RK_FUNC_GPIO &pcfg_pull_up>,
                <1 RK_PB3 RK_FUNC_GPIO &pcfg_pull_up>;
        };
    };
};

页脚

工信部备案:粤ICP备20025096号 Powered by FluxBB

感谢为中文互联网持续输出优质内容的各位老铁们。 QQ: 516333132, 微信(wechat): whycan_cn (哇酷网/挖坑网/填坑网) service@whycan.cn


太原小智科技有限责任公司 - 东莞哇酷科技有限公司联合开发