git: 9eb30ef4b7a0 - main - riscv: enable Allwinner D1 USB drivers
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Fri, 10 Jan 2025 17:59:45 UTC
The branch main has been updated by mhorne: URL: https://cgit.FreeBSD.org/src/commit/?id=9eb30ef4b7a0ca1ef7bcc871b6391d98b00c259f commit 9eb30ef4b7a0ca1ef7bcc871b6391d98b00c259f Author: Mitchell Horne <mhorne@FreeBSD.org> AuthorDate: 2025-01-10 17:57:36 +0000 Commit: Mitchell Horne <mhorne@FreeBSD.org> CommitDate: 2025-01-10 17:57:36 +0000 riscv: enable Allwinner D1 USB drivers Add the generic USB drivers and FDT glue to the build. Make small tweaks to the aw_usbphy and aw_musb drivers for the Allwinner D1. Reviewed by: manu Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D48126 --- sys/arm/allwinner/aw_usbphy.c | 9 +++++++++ sys/conf/files.riscv | 6 ++++++ sys/dev/usb/controller/musb_otg_allwinner.c | 5 +++-- sys/riscv/allwinner/files.allwinner | 3 +++ sys/riscv/conf/std.allwinner | 3 +++ 5 files changed, 24 insertions(+), 2 deletions(-) diff --git a/sys/arm/allwinner/aw_usbphy.c b/sys/arm/allwinner/aw_usbphy.c index b0ef7d9da0a9..97c3d2207773 100644 --- a/sys/arm/allwinner/aw_usbphy.c +++ b/sys/arm/allwinner/aw_usbphy.c @@ -56,6 +56,7 @@ enum awusbphy_type { AWUSBPHY_TYPE_A64, AWUSBPHY_TYPE_A83T, AWUSBPHY_TYPE_H6, + AWUSBPHY_TYPE_D1, }; struct aw_usbphy_conf { @@ -121,6 +122,13 @@ static const struct aw_usbphy_conf h6_usbphy_conf = { .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 @@ static struct ofw_compat_data compat_data[] = { { "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 index 534fe5013c56..514c955181c3 100644 --- a/sys/conf/files.riscv +++ b/sys/conf/files.riscv @@ -12,6 +12,12 @@ dev/pci/pci_host_generic.c optional pci 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 index 574e8e712713..781b4d7e33fa 100644 --- 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 @@ static struct ofw_compat_data compat_data[] = { { "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 @@ awusbdrd_attach(device_t dev) #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 index f55d883abf57..a87d79dfda2a 100644 --- a/sys/riscv/allwinner/files.allwinner +++ b/sys/riscv/allwinner/files.allwinner @@ -3,6 +3,7 @@ arm/allwinner/aw_gpio.c optional gpio aw_gpio fdt 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 @@ -18,4 +19,6 @@ dev/clk/allwinner/aw_clk_np.c optional aw_ccu fdt 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 index a888e4d5d370..5e7a6c0e0a52 100644 --- a/sys/riscv/conf/std.allwinner +++ b/sys/riscv/conf/std.allwinner @@ -9,7 +9,10 @@ device aw_ccu # Allwinner clock controller device aw_gpio # Allwinner GPIO 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 + files "../allwinner/files.allwinner"