F1C100S添加USB驅(qū)動
1.添加設(shè)備樹節(jié)點:
在.dti文件中添加如下節(jié)點:
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中開啟設(shè)備節(jié)點:
&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寫驅(qū)動,因此我們需要添加其驅(qū)動程序,步驟如下:
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驅(qū)動添加到內(nèi)核:
然后保存退出
4.編譯測試:
-
usb
+關(guān)注
關(guān)注
60文章
7945瀏覽量
264623 -
驅(qū)動
+關(guān)注
關(guān)注
12文章
1840瀏覽量
85289 -
Linux
+關(guān)注
關(guān)注
87文章
11304瀏覽量
209476 -
文件
+關(guān)注
關(guān)注
1文章
566瀏覽量
24742 -
設(shè)備樹
+關(guān)注
關(guān)注
0文章
38瀏覽量
3123
發(fā)布評論請先 登錄
相關(guān)推薦
評論