| 
 
初级会员 
 
	积分187金钱187 注册时间2020-11-11在线时间27 小时 | 
 
5金钱 
| 我的STM32MP1 开发板底板是V1.4版本,所以只看 50.6.1 小节 STUSB1600 设备树编写。 
 上一节Linux 内核自带 HOST 实验 USB鼠标键盘都能用。
 
 然后做Linux 内核自带 USB OTG 实验,跟着操作步骤直接复制的设备树,完成后在OTG接口上插键盘没有反应。
 
 
   
 在使用命令 make dtbs 编译时有个报错,如下
 stm32mp157d-atk.dts:171.3-16: Warning (reg_format): /stusb1600@28:reg: property has invalid length (4 bytes) (#address-cells == 1, #size-cells == 1)
 然后我改成 reg = <0x28 0>; 就不报错了。
 
 
 下面是本实验中添加的设备树节点,大佬们看看我添加的位置对吗?
 stm32mp157d-atk.dts
 
 复制代码
/ {
        vdd_usb: regulator-vdd-usb {
                compatible = "regulator-fixed";
                regulator-name = "vdd_usb";
                regulator-min-microvolt = <3300000>;
                regulator-max-microvolt = <3300000>;
                regulator-always-on;
                regulator-boot-on;
        };
        vin: regulator-vin {
                compatible = "regulator-fixed";
                regulator-name = "vin";
                regulator-min-microvolt = <5000000>;
                regulator-max-microvolt = <5000000>;
                regulator-always-on;
                regulator-boot-on;
        };
        stusb1600@28 {
                compatible = "st,stusb1600";
                reg = <0x28 0>;
                interrupts = <2 IRQ_TYPE_EDGE_FALLING>;
                interrupt-parent = <&gpiog>;
                pinctrl-names = "default";
                pinctrl-0 = <&stusb1600_pins_b>;
                status = "okay";
                vdd-supply = <&vin>;
                connector {
                        compatible = "usb-c-connector";
                        label = "USB-C";
                        power-role = "dual";
                        power-opmode = "default";
                        port {
                                con_usbotg_hs_ep: endpoint {
                                        remote-endpoint = <&usbotg_hs_ep>;
                                };
                        };
                };
        };
};
&usbphyc_port1 {
        phy-supply = <&vdd_usb>;
        st,phy-tuning = <&usb_phy_tuning>;
};
&usbotg_hs {
        phys = <&usbphyc_port1 0>;
        phy-names = "usb2-phy";
        usb-role-switch;
        status = "okay";
        port {
                usbotg_hs_ep: endpoint {
                        remote-endpoint = <&con_usbotg_hs_ep>;
                };
        };
};
&i2c1 {
        pinctrl-names = "default", "sleep";
        pinctrl-0 = <&i2c1_pins_b>;
        pinctrl-1 = <&i2c1_pins_sleep_b>;
        status = "okay";
};
 
 stm32mp15-pinctrl.dtsi
 
 复制代码
&pinctrl {
        stusb1600_pins_b: stusb1600-0 {
                pins {
                        pinmux = <STM32_PINMUX('G', 2, ANALOG)>;
                        bias-pull-up;
                };
        };
};
 
 
 
 | 
 |