From nobody Fri Jan 10 17:59:45 2025 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4YV8Ys4mlBz5kFpF; Fri, 10 Jan 2025 17:59:45 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4YV8Ys4DM3z4Cbw; Fri, 10 Jan 2025 17:59:45 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1736531985; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=EDMsC6tNAUoBThvsEXKV2ajGrnsdlFuBb0nTgks5JZM=; b=s/ewZwZzzbkBUXWFIB1AL1kBNM0ImZ7wVjB+EFvspQ/gh3WtWFQ64MxfmL1GMyjdJoIm2q JtHhm6B34NZubiyErB+w0jjU7mVjTXneSD50qjzlHZ2bfp+wJMbRc7Gf0Z6v9k+qcGNPk5 oIVjSz8Hg8jzx5q+j/Q8symRvE2E5qMncdFq3v/6jRgS5I8OmTY+RICOHQLHBSSV87onV8 7jtzhwOFXMkkxLindK+sJSRwlMiSVeYGAq2IOp07HMO7blCHsvqBlPuNCY2GfUDL9NC9oL yZ5wMKbB4YdvShRL9Db8vQpN8S4IKAQ3xPce67G+C8zCsW3DOgqwxjfqkPX0ug== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1736531985; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=EDMsC6tNAUoBThvsEXKV2ajGrnsdlFuBb0nTgks5JZM=; b=oes2fqpKhJoaCLnaGSlmLmV+pTK57/9KUrqplhq90WyZReiFxmR+OtK793IyfKq3nnz/bT 8GZmjBelT7L7WU7KRb41McUKkESJV5GPY4Mm6f0SZJxFwSvYYXFPWyV5m12jGVdRftB2+p PbkdYn5Z5pZdymLcMVxguMZayid0nIREFcWH7p7a1E4p0wuu+HR+eMDFLULZ9evTiqrXqo 7H8LENJm0yPYV9TdnGG7Zy4NU/UgEVD/61Z3OUm/YAVjs2DeeSi3VbrUa2D/Flx5rn88zX H06KSAVUbFR6vBU16kGp7b26DQi12B844Hbe/INimylgyZXuKm0twBi+oartaQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1736531985; a=rsa-sha256; cv=none; b=riXcqXSSKq8knzUC5JoUsjdVV/bkbV4BwUfb34puDosHA/KTqUvGob13C1h8PjjLNPQQ5k d+K+4Biv1S+Ua52dVKsIi5PyEZxAYyR8Oestg8vx6oDDhtBHpeb1i0G7k1izbsUiUvv/Fp g9RZDy5KS8E8ojqK60sdi10Hm1yBKWxMrnjp8j47s7x0cGf/6WUNNhdcJVC6yjW7QZcpMJ /7jaBTn82wmmrM8aaIYw22vO+DMl464U/CtxaiAG0Hunk6ATwNWiyQGzuRPnpTJQWhv+6S /MjKZD6x6wc56i8p6gXzD5eVf05XyGyHq7h0MeeQf6y4p9/N70Zydeml3+Uy5Q== ARC-Authentication-Results: i=1; mx1.freebsd.org; none Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4YV8Ys3R22z6Xx; Fri, 10 Jan 2025 17:59:45 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 50AHxjHI075804; Fri, 10 Jan 2025 17:59:45 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 50AHxjnb075801; Fri, 10 Jan 2025 17:59:45 GMT (envelope-from git) Date: Fri, 10 Jan 2025 17:59:45 GMT Message-Id: <202501101759.50AHxjnb075801@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mitchell Horne Subject: git: 9eb30ef4b7a0 - main - riscv: enable Allwinner D1 USB drivers List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mhorne X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 9eb30ef4b7a0ca1ef7bcc871b6391d98b00c259f Auto-Submitted: auto-generated The branch main has been updated by mhorne: URL: https://cgit.FreeBSD.org/src/commit/?id=9eb30ef4b7a0ca1ef7bcc871b6391d98b00c259f commit 9eb30ef4b7a0ca1ef7bcc871b6391d98b00c259f Author: Mitchell Horne AuthorDate: 2025-01-10 17:57:36 +0000 Commit: Mitchell Horne 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"