RK3588S DTS文件中 fusb302如何进行配置
时间: 2024-03-02 13:52:38 浏览: 370
在RK3588S的DTS文件中,如果要配置fusb302芯片,需要进行以下配置:
1. 声明fusb302节点:
```
&i2c3 {
fusb302: fusb302@22 {
compatible = "fairchild,fusb302";
reg = <0x22>;
};
};
```
2. 配置fusb302节点的属性:
```
&i2c3 {
fusb302: fusb302@22 {
compatible = "fairchild,fusb302";
reg = <0x22>;
interrupt-parent = <&gpio>;
interrupts = <5 IRQ_TYPE_LEVEL_LOW>;
vbus-gpio = <&gpio GPIO_PD0 GPIO_ACTIVE_LOW>;
vconn-gpio = <&gpio GPIO_PD1 GPIO_ACTIVE_LOW>;
reset-gpio = <&gpio GPIO_PD2 GPIO_ACTIVE_LOW>;
irq-gpio = <&gpio GPIO_PD3 GPIO_ACTIVE_LOW>;
alert-gpio = <&gpio GPIO_PD4 GPIO_ACTIVE_LOW>;
};
};
```
这里的属性包括:
- interrupt-parent和interrupts:用于指定fusb302中断的GPIO引脚,以及中断类型。
- vbus-gpio、vconn-gpio、reset-gpio、irq-gpio和alert-gpio:用于指定fusb302的GPIO引脚,以及GPIO的电平状态。
3. 配置fusb302的驱动程序:
```
&i2c3 {
fusb302: fusb302@22 {
compatible = "fairchild,fusb302";
reg = <0x22>;
interrupt-parent = <&gpio>;
interrupts = <5 IRQ_TYPE_LEVEL_LOW>;
vbus-gpio = <&gpio GPIO_PD0 GPIO_ACTIVE_LOW>;
vconn-gpio = <&gpio GPIO_PD1 GPIO_ACTIVE_LOW>;
reset-gpio = <&gpio GPIO_PD2 GPIO_ACTIVE_LOW>;
irq-gpio = <&gpio GPIO_PD3 GPIO_ACTIVE_LOW>;
alert-gpio = <&gpio GPIO_PD4 GPIO_ACTIVE_LOW>;
status = "okay";
};
usb-role-switch {
compatible = "usb-role-switch";
#address-cells = <1>;
#size-cells = <0>;
usb_role_switch {
compatible = "gpio-usb-role-switch";
gpios = <&gpio GPIO_PE3 GPIO_ACTIVE_HIGH>;
vbus-supply = <&vcc_usb>;
debounce = <50>;
};
};
};
```
这里的驱动程序包括:
- status = "okay":用于启用fusb302设备。
- usb-role-switch和gpio-usb-role-switch:用于配置USB角色开关的GPIO引脚,以及vbus电源的供应。
阅读全文