From nobody Mon Dec 1 22:03:57 2025 Received: from TWMBX01.aspeed.com (mail.aspeedtech.com [211.20.114.72]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id BB4032236FC; Fri, 28 Nov 2025 00:27:46 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=211.20.114.72 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1764289668; cv=none; b=D3P7vVJgmjgc+bpziEkWtctLPKlp2Z/alTT1U7sigK72g4LEfkWry4nVC0jujNZRPpWq3G1Ks941ygoMknX6S9ddHyXZvU5eEHtsYyK1zQEsknm58q7MTAVnfiseva3dUv2REKh0Vg1OwhRxsacJE6jSeVut7uTulrjg5GFu+k8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1764289668; c=relaxed/simple; bh=XJdF9MCn8Pm6rI4iV4Bh37iuRCq4FiLatSLLzYg37h8=; h=From:Date:Subject:MIME-Version:Content-Type:Message-ID:References: In-Reply-To:To:CC; b=pU0/e/qnPAf4MVHCaKURFKz73rwDNuM0B1iqdmZ20VK3Cag6Qe3J8ARdxHk0DTJR9/oDD592rjHqDihbaZmpZzQGmftpK0F5hg/XXu1Bl5yshnLJ7inhSiiavzOP3qDFvT2HRCWs11YKHxk5liKysRgfeRPx8DJR68uu7tpcZxk= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=aspeedtech.com; spf=pass smtp.mailfrom=aspeedtech.com; arc=none smtp.client-ip=211.20.114.72 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=aspeedtech.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=aspeedtech.com Received: from TWMBX01.aspeed.com (192.168.0.62) by TWMBX01.aspeed.com (192.168.0.62) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1748.10; Fri, 28 Nov 2025 08:27:34 +0800 Received: from [127.0.1.1] (192.168.10.13) by TWMBX01.aspeed.com (192.168.0.62) with Microsoft SMTP Server id 15.2.1748.10 via Frontend Transport; Fri, 28 Nov 2025 08:27:34 +0800 From: Ryan Chen Date: Fri, 28 Nov 2025 08:27:31 +0800 Subject: [PATCH v2 2/2] usb: gadget: aspeed-vhub: Add ast2700 support Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-ID: <20251128-upstream_vhub-v2-2-1fa66a5833c2@aspeedtech.com> References: <20251128-upstream_vhub-v2-0-1fa66a5833c2@aspeedtech.com> In-Reply-To: <20251128-upstream_vhub-v2-0-1fa66a5833c2@aspeedtech.com> To: Greg Kroah-Hartman , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Joel Stanley , Andrew Jeffery , Benjamin Herrenschmidt , Philipp Zabel CC: , , , , , Ryan Chen X-Mailer: b4 0.14.3 X-Developer-Signature: v=1; a=ed25519-sha256; t=1764289654; l=3392; i=ryan_chen@aspeedtech.com; s=20251126; h=from:subject:message-id; bh=XJdF9MCn8Pm6rI4iV4Bh37iuRCq4FiLatSLLzYg37h8=; b=ecy2bG+wRDjEzJOpOxKlviBm2AUu1tXkDbMaZbOZAMJKnr+T61vmMRfng60CdMHf5b11i88JH 5V9Q4kE/96JAiITGpu8kf/ByIdNx4H92oqfH6VEF9Fq8MREdY0/DBMv X-Developer-Key: i=ryan_chen@aspeedtech.com; a=ed25519; pk=Xe73xY6tcnkuRjjbVAB/oU30KdB3FvG4nuJuILj7ZVc= Add support for the AST2700 SOC in the vhub gadget driver. AST2700 uses a 64-bit DMA addressing capability, so select 64-bit DMA mask for compatible. AST2700 vhub also requires an reset line, so hook up the optional reset control and assert/deassert it during probe and remove. Signed-off-by: Ryan Chen --- drivers/usb/gadget/udc/aspeed-vhub/core.c | 30 +++++++++++++++++++++++++++= +++ drivers/usb/gadget/udc/aspeed-vhub/vhub.h | 1 + 2 files changed, 31 insertions(+) diff --git a/drivers/usb/gadget/udc/aspeed-vhub/core.c b/drivers/usb/gadget= /udc/aspeed-vhub/core.c index f2685f89b3e5..19c1849ae665 100644 --- a/drivers/usb/gadget/udc/aspeed-vhub/core.c +++ b/drivers/usb/gadget/udc/aspeed-vhub/core.c @@ -23,6 +23,7 @@ #include #include #include +#include =20 #include "vhub.h" =20 @@ -280,6 +281,8 @@ static void ast_vhub_remove(struct platform_device *pde= v) if (vhub->clk) clk_disable_unprepare(vhub->clk); =20 + reset_control_assert(vhub->rst); + spin_unlock_irqrestore(&vhub->lock, flags); =20 if (vhub->ep0_bufs) @@ -294,6 +297,7 @@ static void ast_vhub_remove(struct platform_device *pde= v) static int ast_vhub_probe(struct platform_device *pdev) { enum usb_device_speed max_speed; + const u64 *dma_mask_ptr; struct ast_vhub *vhub; struct resource *res; int i, rc =3D 0; @@ -348,6 +352,16 @@ static int ast_vhub_probe(struct platform_device *pdev) goto err; } =20 + vhub->rst =3D devm_reset_control_get_optional_shared(&pdev->dev, NULL); + if (IS_ERR(vhub->rst)) { + rc =3D PTR_ERR(vhub->rst); + goto err; + } + + rc =3D reset_control_deassert(vhub->rst); + if (rc) + goto err; + /* Check if we need to limit the HW to USB1 */ max_speed =3D usb_get_maximum_speed(&pdev->dev); if (max_speed !=3D USB_SPEED_UNKNOWN && max_speed < USB_SPEED_HIGH) @@ -370,6 +384,12 @@ static int ast_vhub_probe(struct platform_device *pdev) goto err; } =20 + dma_mask_ptr =3D (u64 *)of_device_get_match_data(&pdev->dev); + if (dma_mask_ptr) { + rc =3D dma_coerce_mask_and_coherent(&pdev->dev, *dma_mask_ptr); + if (rc) + goto err; + } /* * Allocate DMA buffers for all EP0s in one chunk, * one per port and one for the vHub itself @@ -412,15 +432,25 @@ static int ast_vhub_probe(struct platform_device *pde= v) return rc; } =20 +static const u64 dma_mask_32 =3D DMA_BIT_MASK(32); +static const u64 dma_mask_64 =3D DMA_BIT_MASK(64); + static const struct of_device_id ast_vhub_dt_ids[] =3D { { .compatible =3D "aspeed,ast2400-usb-vhub", + .data =3D &dma_mask_32, }, { .compatible =3D "aspeed,ast2500-usb-vhub", + .data =3D &dma_mask_32, }, { .compatible =3D "aspeed,ast2600-usb-vhub", + .data =3D &dma_mask_32, + }, + { + .compatible =3D "aspeed,ast2700-usb-vhub", + .data =3D &dma_mask_64, }, { } }; diff --git a/drivers/usb/gadget/udc/aspeed-vhub/vhub.h b/drivers/usb/gadget= /udc/aspeed-vhub/vhub.h index 6b9dfa6e10eb..aca2050e2db0 100644 --- a/drivers/usb/gadget/udc/aspeed-vhub/vhub.h +++ b/drivers/usb/gadget/udc/aspeed-vhub/vhub.h @@ -388,6 +388,7 @@ struct ast_vhub { spinlock_t lock; struct work_struct wake_work; struct clk *clk; + struct reset_control *rst; =20 /* EP0 DMA buffers allocated in one chunk */ void *ep0_bufs; --=20 2.34.1