diff --git a/sys/arm/allwinner/aw_usbphy.c b/sys/arm/allwinner/aw_usbphy.c --- a/sys/arm/allwinner/aw_usbphy.c +++ b/sys/arm/allwinner/aw_usbphy.c @@ -56,6 +56,7 @@ AWUSBPHY_TYPE_A64, AWUSBPHY_TYPE_A83T, AWUSBPHY_TYPE_H6, + AWUSBPHY_TYPE_D1, }; struct aw_usbphy_conf { @@ -121,6 +122,13 @@ .phy0_route = true, }; +static const struct aw_usbphy_conf d1_usbphy_conf = { + .num_phys = 2, + .phy_type = AWUSBPHY_TYPE_D1, + .pmu_unk1 = true, + .phy0_route = true, +}; + static struct ofw_compat_data compat_data[] = { { "allwinner,sun4i-a10-usb-phy", (uintptr_t)&a10_usbphy_conf }, { "allwinner,sun5i-a13-usb-phy", (uintptr_t)&a13_usbphy_conf }, @@ -130,6 +138,7 @@ { "allwinner,sun50i-a64-usb-phy", (uintptr_t)&a64_usbphy_conf }, { "allwinner,sun8i-a83t-usb-phy", (uintptr_t)&a83t_usbphy_conf }, { "allwinner,sun50i-h6-usb-phy", (uintptr_t)&h6_usbphy_conf }, + { "allwinner,sun20i-d1-usb-phy", (uintptr_t)&d1_usbphy_conf }, { NULL, 0 } }; diff --git a/sys/conf/files.riscv b/sys/conf/files.riscv --- a/sys/conf/files.riscv +++ b/sys/conf/files.riscv @@ -13,6 +13,12 @@ dev/pci/pci_host_generic_fdt.c optional pci fdt dev/uart/uart_cpu_fdt.c optional uart fdt dev/uart/uart_dev_lowrisc.c optional uart_lowrisc +dev/usb/controller/generic_ehci.c optional ehci +dev/usb/controller/generic_ehci_fdt.c optional ehci fdt +dev/usb/controller/generic_ohci.c optional ohci fdt +dev/usb/controller/generic_usb_if.m optional ohci fdt +dev/usb/controller/generic_xhci.c optional xhci +dev/usb/controller/generic_xhci_fdt.c optional xhci fdt dev/vmm/vmm_dev.c optional vmm dev/vmm/vmm_stat.c optional vmm dev/xilinx/axi_quad_spi.c optional xilinx_spi diff --git a/sys/dev/usb/controller/musb_otg_allwinner.c b/sys/dev/usb/controller/musb_otg_allwinner.c --- a/sys/dev/usb/controller/musb_otg_allwinner.c +++ b/sys/dev/usb/controller/musb_otg_allwinner.c @@ -77,7 +77,7 @@ #if defined(__arm__) #define bs_parent_space(bs) ((bs)->bs_parent) typedef bus_space_tag_t awusb_bs_tag; -#elif defined(__aarch64__) +#elif defined(__aarch64__) || defined(__riscv) #define bs_parent_space(bs) (bs) typedef void * awusb_bs_tag; #endif @@ -89,6 +89,7 @@ { "allwinner,sun6i-a31-musb", AWUSB_OKAY }, { "allwinner,sun8i-a33-musb", AWUSB_OKAY | AWUSB_NO_CONFDATA }, { "allwinner,sun8i-h3-musb", AWUSB_OKAY | AWUSB_NO_CONFDATA }, + { "allwinner,sun20i-d1-musb", AWUSB_OKAY | AWUSB_NO_CONFDATA }, { NULL, 0 } }; @@ -474,7 +475,7 @@ #if defined(__arm__) sc->bs.bs_parent = rman_get_bustag(sc->res[0]); -#elif defined(__aarch64__) +#elif defined(__aarch64__) || defined(__riscv) sc->bs.bs_cookie = rman_get_bustag(sc->res[0]); #endif diff --git a/sys/riscv/allwinner/files.allwinner b/sys/riscv/allwinner/files.allwinner --- a/sys/riscv/allwinner/files.allwinner +++ b/sys/riscv/allwinner/files.allwinner @@ -5,6 +5,7 @@ arm/allwinner/aw_rtc.c optional aw_rtc fdt arm/allwinner/aw_syscon.c optional syscon arm/allwinner/aw_sid.c optional aw_sid nvmem +arm/allwinner/aw_usbphy.c optional ehci aw_usbphy fdt arm/allwinner/aw_wdog.c optional aw_wdog arm/allwinner/if_awg.c optional awg syscon @@ -20,4 +21,6 @@ dev/clk/allwinner/aw_clk_prediv_mux.c optional aw_ccu fdt dev/clk/allwinner/ccu_d1.c optional soc_allwinner_d1 aw_ccu fdt +dev/usb/controller/musb_otg_allwinner.c optional musb fdt + riscv/allwinner/d1_padconf.c optional soc_allwinner_d1 aw_gpio fdt diff --git a/sys/riscv/conf/std.allwinner b/sys/riscv/conf/std.allwinner --- a/sys/riscv/conf/std.allwinner +++ b/sys/riscv/conf/std.allwinner @@ -11,9 +11,12 @@ device aw_mmc # Allwinner SD/MMC controller device aw_rtc # Allwinner Real-time Clock device aw_sid # Allwinner Secure ID EFUSE +device aw_usbphy # Allwinner USB PHY device aw_wdog # Allwinner Watchdog device awg # Allwinner EMAC Gigabit Ethernet +device musb # Mentor Graphics USB OTG controller + # DTBs makeoptions MODULES_EXTRA+="dtb/allwinner"