1.添加设备树节点:
在.dti文件中添加如下节点:
otg_sram: sram-section@0 {
compatible = "allwinner,suniv-f1c100s-sram-d",
"allwinner,sun4i-a10-sram-d";
reg = <0x0000 0x1000>;
status = "disabled";
};
usb_otg: usb@1c13000 {
compatible = "allwinner,suniv-musb";
reg = <0x01c13000 0x0400>;
clocks = <&ccu CLK_BUS_OTG>;
resets = <&ccu RST_BUS_OTG>;
interrupts = <26>;
interrupt-names = "mc";
phys = <&usbphy 0>;
phy-names = "usb";
extcon = <&usbphy 0>;
allwinner,sram = <&otg_sram 1>;
status = "disabled";
};
usbphy: phy@1c13400 {
compatible = "allwinner,suniv-usb-phy";
reg = <0x01c13400 0x10>;
reg-names = "phy_ctrl";
clocks = <&ccu CLK_USB_PHY0>;
clock-names = "usb0_phy";
resets = <&ccu RST_USB_PHY0>;
reset-names = "usb0_reset";
#phy-cells = <1>;
status = "disabled";
};
然后在dts中开启设备节点:
&otg_sram {
status = "okay";
};
&usb_otg {
dr_mode = "otg";
status = "okay";
};
&usbphy {
usb0_id_det-gpio = <&pio 4 2 GPIO_ACTIVE_HIGH>; /* PE2 */
status = "okay";
};
2.由于linux并没有对F1C100s写驱动,因此我们需要添加其驱动程序,步骤如下:
drivers/phy/allwinner/phy-sun4i-usb.c文件修改如下
大约在100行处添加:
suniv_phy,
大约在862处添加:
static const struct sun4i_usb_phy_cfg suniv_cfg = {
.num_phys = 1,
.type = suniv_phy,
.disc_thresh = 3,
.phyctl_offset = REG_PHYCTL_A10,
.dedicated_clocks = true,
};
大约在985处添加:
{ .compatible = "allwinner,suniv-usb-phy", .data = &suniv_cfg },
drivers/usb/musb/sunxi.c文件修改如下
大约在717行添加如下:
||of_device_is_compatible(np, "allwinner,suniv-musb")
大约在724处添加如下:
||of_device_is_compatible(np, "allwinner,suniv-musb")
大约在817处添加如下:
{ .compatible = "allwinner,suniv-musb", },
修改好后保存所有修改文件
3.选择usb驱动添加到内核:
然后保存退出
4.编译测试:
全部0条评论
快来发表一下你的评论吧 !