From patchwork Sat Aug 16 08:46:54 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: iuncuim X-Patchwork-Id: 1231 Received: from mail-pl1-f177.google.com (mail-pl1-f177.google.com [209.85.214.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 23F4513AD26 for ; Sat, 16 Aug 2025 08:47:34 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.177 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1755334057; cv=none; b=HE5FQn0GVfecIsJSEPZDD9lmWqyzVRQ7DUrAsV29e5nurgWD/4V6ZznoZTpdgYooLntl+26Ep+APyG/9S/dS7rhIphRFr4n1jeQbBzGxMNKzeOWzX9zipQjeCI524S7MggJl7SGWyYUcFCXoPtbNOHFjSpYbQ/bXRhG5eOETEIg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1755334057; c=relaxed/simple; bh=0sQpcReULpsgaFKEamkaFHveJQyplmueGHJEFMlfkEc=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=svLb0dRzfloDtHifzw92WI+lMg4MIhUsB/4Z6egLURLElyYmZfp9zJ1qVMvgsAmTep1oTrpwWomA/llIALdcrErAP3oz/vVMxJYcim7ruwpc9IG94PZ+/zbgfdR51mEnWsPZGOeMakAlNxhSc2SBmn8ThoC/nLV114/gDdP6JqE= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=ZDD9tUTN; arc=none smtp.client-ip=209.85.214.177 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="ZDD9tUTN" Received: by mail-pl1-f177.google.com with SMTP id d9443c01a7336-2445811e19dso21411745ad.1 for ; Sat, 16 Aug 2025 01:47:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1755334054; x=1755938854; darn=lists.linux.dev; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=3LjpIZbO9mvGi9jWfEQ5hnMKUvryAGp+KhC+W5IHOPY=; b=ZDD9tUTNcBABqQC7w9r06BLKiL5o8GctTKJjKHBT7RfXlmL95OWr/dGfUtUE3YPaZ7 AaBDXbcxWY+pRi1leD0xHWvVHcKmsLtYWUKhjv+Oi5Ashstw6BFKa4uSGpBVlL8WqOxk G05xZ+pzhiJpwAqsOeJkrpJRUGRf4sogRLLWDSey3eSX7OX0jZwGqZavaQxgzPHTWhQY vrWdt5ARB8CqP6mty7JdREeA3xqBTj84fg6i2Ak2hiLJBlgaPkeoeR5hwPH/nNwiIJkA enf+WjBiiFAi1vlU/FioISrTxm9EEWNY7NiJP8XjJYG2MdPxBwXbM0iNCplRGvZ7jM6i pRPg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1755334054; x=1755938854; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=3LjpIZbO9mvGi9jWfEQ5hnMKUvryAGp+KhC+W5IHOPY=; b=sWHB+RJRaee//RKf/yQ/94oYjS4zWCH4/ACuJ9yiYNGG8eVDCBRiup0zSh0L3thtgv u0esQyYOopYyzh/j8A//3KHIHyI9sP1IxNvKOqo3vReRGd1/+2lC668wBMlFd14sAJoZ Kmxl4vvJVqIj4jCsrDnyhoh9+bYn9K+PHgOOZPKgMxRTKBYarOYdCqSPRUKETjPhMKUn NePIyVIoIEDGRPnEajJ0p9zRDxpwViYbPtHjGu2IrUThYhkSrH1o/APYAIXVti7fVVgv HK9gIelHOQUErO4GOAo44jV17X090FgYyoU8hDxBp4BMUuq9kzywJL+PZ5nUP7ALlCII jm+w== X-Forwarded-Encrypted: i=1; AJvYcCV2YQ7DK8ijDDCsd0zLmp+oWtGHk2tDXLZkLdtQEiylOhrXY6F/1QKuXFH4Ch1PQlLEKmKJ5zQeSR0Nkg==@lists.linux.dev X-Gm-Message-State: AOJu0YwvtL0JHqkZ4GSSfYuEsdQiHT9tIyuS9TkV2Nhx00SzcvNg8tzY b0S4Ha7hFCZ2EhaNReK2c4p9G84vVYtZdRhrdlswbQ9qzqHlg1FF+4nt X-Gm-Gg: ASbGncveYLXeW55xCRluep/wNxkYBylP34IiWPneWtvPQvBCdDuT+5C4S7g17f6AyVC GCDLClEM3cSrZwI+7Rl/OsWi2HLOPgw11oxKkpC/zE+F8Rx6Zco2HcAZWtabTj1Zid+Pq2z+VVc xmkYsy5Aw0FxSfbdRTrhJvmKKByBuOCZpFlkkKhYhW6+Ifkf3vTEz3whf7ZEAbYXgZLK71Pi7gl j3Lqq1evZNn7mJ0k+7oaBuPDP8/0N+i9Myrgtox0ypftB6Lv99CMkhLUBN6Jbl6lSMDc25HiZZm GX0kWEbM22UoIpf+4hEtbraONGU8/JD82hCuH7eOdNDAajc6Sc193Ml98Nigw4OtZnYm+vhpsqv upzzQTIW7c2uF5AJqgsHsYg== X-Google-Smtp-Source: AGHT+IFMTkLskiB1Qs3dIHhYx1vm6JoFKQBNN3j/TxriFzjixkZX7mXsyi+PI7KUf9M6UIn/A8Ob4g== X-Received: by 2002:a17:902:cccb:b0:240:84b:a11a with SMTP id d9443c01a7336-2446d6e5a89mr66059665ad.17.1755334054476; Sat, 16 Aug 2025 01:47:34 -0700 (PDT) Received: from junAIR ([212.192.12.80]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-2446d57f12esm31048215ad.157.2025.08.16.01.47.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 16 Aug 2025 01:47:34 -0700 (PDT) From: iuncuim To: Rob Herring , Krzysztof Kozlowski , Conor Dooley , Chen-Yu Tsai , Jernej Skrabec , Samuel Holland , Andre Przywara , Michael Turquette , Stephen Boyd , Vinod Koul , Kishon Vijay Abraham I , Philipp Zabel Cc: devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-phy@lists.infradead.org, linux-clk@vger.kernel.org, linux-sunxi@lists.linux.dev Subject: [PATCH 1/7] clk: sunxi-ng: a523: add missing usb related clocks Date: Sat, 16 Aug 2025 16:46:54 +0800 Message-ID: <20250816084700.569524-2-iuncuim@gmail.com> X-Mailer: git-send-email 2.50.1 In-Reply-To: <20250816084700.569524-1-iuncuim@gmail.com> References: <20250816084700.569524-1-iuncuim@gmail.com> Precedence: bulk X-Mailing-List: linux-sunxi@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Status: O From: Mikhail Kalashnikov Several clocks were omitted when adding the original driver. These clocks are necessary for USB 3.0 to work correctly. I added these declarations according to the driver's BSP code. Signed-off-by: Mikhail Kalashnikov --- drivers/clk/sunxi-ng/ccu-sun55i-a523.c | 32 +++++++++++++++++++++ drivers/clk/sunxi-ng/ccu-sun55i-a523.h | 2 +- include/dt-bindings/clock/sun55i-a523-ccu.h | 4 +++ 3 files changed, 37 insertions(+), 1 deletion(-) diff --git a/drivers/clk/sunxi-ng/ccu-sun55i-a523.c b/drivers/clk/sunxi-ng/ccu-sun55i-a523.c index 1a9a1cb86..7bf41e628 100644 --- a/drivers/clk/sunxi-ng/ccu-sun55i-a523.c +++ b/drivers/clk/sunxi-ng/ccu-sun55i-a523.c @@ -853,6 +853,31 @@ static struct ccu_mux usb_ohci1_clk = { }, }; +static SUNXI_CCU_GATE_DATA(usb2_clk, "usb2", osc24M, 0xa80, BIT(31), 0); + +static const struct clk_parent_data usb3_parents[] = { + { .fw_name = "hosc" }, + { .hw = &pll_periph0_200M_clk.hw }, + { .hw = &pll_periph1_200M_clk.hw }, +}; + +static SUNXI_CCU_M_DATA_WITH_MUX_GATE(usb3_clk, "usb3", usb3_parents, 0xa84, + 0, 5, /* M */ + 24, 3, /* mux */ + BIT(31), /* gate */ + 0); + +static const struct clk_parent_data usb3_suspend_parents[] = { + { .fw_name = "losc" }, +}; + +static SUNXI_CCU_M_DATA_WITH_MUX_GATE(usb3_suspend_clk, "usb3-suspend", + usb3_suspend_parents, 0xa88, + 0, 5, /* M */ + 24, 1, /* mux */ + BIT(31), /* gate */ + 0); + static SUNXI_CCU_GATE_HWS(bus_ohci0_clk, "bus-ohci0", ahb_hws, 0xa8c, BIT(0), 0); static SUNXI_CCU_GATE_HWS(bus_ohci1_clk, "bus-ohci1", ahb_hws, 0xa8c, @@ -1290,6 +1315,9 @@ static struct ccu_common *sun55i_a523_ccu_clks[] = { &bus_ths_clk.common, &usb_ohci0_clk.common, &usb_ohci1_clk.common, + &usb2_clk.common, + &usb3_clk.common, + &usb3_suspend_clk.common, &bus_ohci0_clk.common, &bus_ohci1_clk.common, &bus_ehci0_clk.common, @@ -1422,6 +1450,7 @@ static struct clk_hw_onecell_data sun55i_a523_hw_clks = { [CLK_MBUS_DMA] = &mbus_dma_clk.common.hw, [CLK_MBUS_VE] = &mbus_ve_clk.common.hw, [CLK_MBUS_CE] = &mbus_ce_clk.common.hw, + [CLK_MBUS_USB3] = &mbus_usb3_clk.common.hw, [CLK_MBUS_CSI] = &mbus_csi_clk.common.hw, [CLK_MBUS_ISP] = &mbus_isp_clk.common.hw, [CLK_MBUS_EMAC1] = &mbus_gmac1_clk.common.hw, @@ -1474,6 +1503,9 @@ static struct clk_hw_onecell_data sun55i_a523_hw_clks = { [CLK_BUS_THS] = &bus_ths_clk.common.hw, [CLK_USB_OHCI0] = &usb_ohci0_clk.common.hw, [CLK_USB_OHCI1] = &usb_ohci1_clk.common.hw, + [CLK_USB2] = &usb2_clk.common.hw, + [CLK_USB3] = &usb3_clk.common.hw, + [CLK_USB3_SUSPEND] = &usb3_suspend_clk.common.hw, [CLK_BUS_OHCI0] = &bus_ohci0_clk.common.hw, [CLK_BUS_OHCI1] = &bus_ohci1_clk.common.hw, [CLK_BUS_EHCI0] = &bus_ehci0_clk.common.hw, diff --git a/drivers/clk/sunxi-ng/ccu-sun55i-a523.h b/drivers/clk/sunxi-ng/ccu-sun55i-a523.h index fc8dd42f1..d6916c728 100644 --- a/drivers/clk/sunxi-ng/ccu-sun55i-a523.h +++ b/drivers/clk/sunxi-ng/ccu-sun55i-a523.h @@ -9,6 +9,6 @@ #include #include -#define CLK_NUMBER (CLK_FANOUT2 + 1) +#define CLK_NUMBER (CLK_MBUS_USB3 + 1) #endif /* _CCU_SUN55I_A523_H */ diff --git a/include/dt-bindings/clock/sun55i-a523-ccu.h b/include/dt-bindings/clock/sun55i-a523-ccu.h index c8259ac5a..26b2e9dc8 100644 --- a/include/dt-bindings/clock/sun55i-a523-ccu.h +++ b/include/dt-bindings/clock/sun55i-a523-ccu.h @@ -185,5 +185,9 @@ #define CLK_FANOUT0 176 #define CLK_FANOUT1 177 #define CLK_FANOUT2 178 +#define CLK_USB2 179 +#define CLK_USB3 180 +#define CLK_USB3_SUSPEND 181 +#define CLK_MBUS_USB3 182 #endif /* _DT_BINDINGS_CLK_SUN55I_A523_CCU_H_ */ From patchwork Sat Aug 16 08:46:55 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: iuncuim X-Patchwork-Id: 1230 Received: from mail-pl1-f174.google.com (mail-pl1-f174.google.com [209.85.214.174]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 2A36523AB9F for ; Sat, 16 Aug 2025 08:47:44 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.174 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1755334066; cv=none; b=lRIxhvMPPEYkhWARYR/DCaCs9ZxBNkN2k6c6FTxgbJkqoIw32nuyrxcxgTo1YvwT/N4z80qS2UdrVXausPvfK3byKK8F8wKoI22TNCitHdBLp9FHcPQOOD0tkblZu1wpOaoZZukZStrvKrU8RohLZkdLeCFpABHWX+SoeEf9vH4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1755334066; c=relaxed/simple; bh=feqnGZIaBW0Kxr7JtqcWFeJjTYfwwUCPcXNkynw7PPU=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=oqVu1cmmnK602jZz7IgkyNpcDRJ4jKevd8FGV0TUXGyRl9CcL/+i+n3Gsxq7s6p+PQSd4WYxdqGPy6GFlW0YkSjbkZNOzsYx7x2xLhzI03J4ew6hCQCBUUY76z/xssv0e/v4zT/pIvTQkqaK3mM1YYgEkhr8c0+rAKdWJxyf3j4= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=EOclI8D1; arc=none smtp.client-ip=209.85.214.174 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="EOclI8D1" Received: by mail-pl1-f174.google.com with SMTP id d9443c01a7336-24456f3f669so27104625ad.1 for ; Sat, 16 Aug 2025 01:47:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1755334064; x=1755938864; darn=lists.linux.dev; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=VzugRTjSEEA3vhHWZEvncDTD2t0Cnyv/9flgnww7Mso=; b=EOclI8D1Fjym19jfc8Q1owFDR0EgNk7wMXQbYS3kTWUg07oDPpjEiWosVt+dFQtwgM mOOhf0x0WHst2OthRDheX8STN7PiOHZEfo8cmmPmEvWUhZUEZPeoprh0cPYfyZnSCx0Q vhXfHcVbgQATp3pZiYOI6OkO9uvn+0bwS1V6onYybHFY37CIDv+11bxidXuB7+kzF58n iJiBh/dF9J5JYZJTtMtiavu+tx1iFVSHf22T50+AP5fO9wcaM3Ppij8Yj5QttFymGixT ORzOmlUEoR52sJF+c/2UjlJW7e2hv9+bOECbG6GyYSzNvCHWt51A2IVOexhOGxdiBjUX xDFg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1755334064; x=1755938864; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=VzugRTjSEEA3vhHWZEvncDTD2t0Cnyv/9flgnww7Mso=; b=b9mUp9Es/s5lxsKsTXqGHaf8zjcvrdHEuXqbs+IOlosX0LlCCNpOd3oEw62qzAViyH FKnowHaTfTKZ/7wsmaWeWeKI4d8L+RmLqpLZphTh0D7X1UdVCsHFxMsuWFKbXAWxYiZo OPIcpefps9BzD9lvm8mu4o3Pun10jp79LU0rSZRl+1FdyHHMsc67Puen3ff8Oq0l52XA VGDtMzGMnJymw2wSJdSXOfErtwMxanuCbDbypCbW6LLGyJYL2Ok1pfu5e4hqtfH454uy GYMvIsJ9Vx2PIO+OlUk6F+1Tq5K84zJk1D7VT/zTQ9puEFPnWQQUmVh9Tb5NiW6rdI/F tL4A== X-Forwarded-Encrypted: i=1; AJvYcCV5n56hzRO8hxMF0q0VBrN2usqH26UJf51UvnT12FguJxTPd69LxmgYbzT2gDdnr0reg0k2PP7fxMgp2g==@lists.linux.dev X-Gm-Message-State: AOJu0YziMTr8h2fm9wbUUiSemESLRYa4gzMS82ASh6D19zl09I1qnmFD /0nGrFMgdFxe7Hq0eFHwcds3T0pVKxlZrN2RUT/USB9mW9brtz/7AAua X-Gm-Gg: ASbGncuD8CijGP2urmnHZgZMwDVsww2T4bpqOiONsg742uKk+m9LL2X0aEDBlilcagG st1D7Ls+aFmWu1LQRv1tn86rgiHxIQ9bc0CxLDFVdyV+xpsRWjGvIz7RZ7bmB+08Nuk4ol19nsv 87g19qCgpXTqcx9ZrilCv9i+Qw57MxWzFx5h5DHRrCNTcwX9ElbB21Z7rcjtDyplsOdLoTws1J0 M99/UG7TspMoQdV21Hl8VIo8/zRStvypuZHysqF/Zkt0nVCEKx8WGCuYS9okLoodx9KF2nk1uwx Awvyy/3dI2bUKlZiqSBylov9nX9hrvrATJTZ/rwz6ZxoLdbQ2DmgjdeRr59DYHXr3WwTIKMais5 oc5V/lDbERek= X-Google-Smtp-Source: AGHT+IGC/f9ctRQyGd8OhPgk/EDa/XtCGcODk7HhjJFFgAw+CxRy4DpFueYRqcfy/Uow1U/CzbWKQQ== X-Received: by 2002:a17:902:d4d0:b0:240:6fc0:3421 with SMTP id d9443c01a7336-2446bce444fmr73487325ad.3.1755334064339; Sat, 16 Aug 2025 01:47:44 -0700 (PDT) Received: from junAIR ([212.192.12.80]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-2446d57f12esm31048215ad.157.2025.08.16.01.47.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 16 Aug 2025 01:47:43 -0700 (PDT) From: iuncuim To: Rob Herring , Krzysztof Kozlowski , Conor Dooley , Chen-Yu Tsai , Jernej Skrabec , Samuel Holland , Andre Przywara , Michael Turquette , Stephen Boyd , Vinod Koul , Kishon Vijay Abraham I , Philipp Zabel Cc: devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-phy@lists.infradead.org, linux-clk@vger.kernel.org, linux-sunxi@lists.linux.dev Subject: [PATCH 2/7] arm64: dts: allwinner: a523: add third usb2 phy Date: Sat, 16 Aug 2025 16:46:55 +0800 Message-ID: <20250816084700.569524-3-iuncuim@gmail.com> X-Mailer: git-send-email 2.50.1 In-Reply-To: <20250816084700.569524-1-iuncuim@gmail.com> References: <20250816084700.569524-1-iuncuim@gmail.com> Precedence: bulk X-Mailing-List: linux-sunxi@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Status: O From: Mikhail Kalashnikov It seems that there are actually three usb2 phys in the processor, which makes it incompatible with D1. The third phy is used together with USB3/PCIe combophy with DWC3 controller. In the BSP code, the third PHY requires a separate glue driver, but it seems that it is not needed. According to the BSP code, the third phy does not have a reset line; the only reset is declared in the DWC3 node, but none of this is documented. Since sun4i-usb-phy driver requires a reset, I added RST_BUS_3 here. Signed-off-by: Mikhail Kalashnikov --- .../arm64/boot/dts/allwinner/sun55i-a523.dtsi | 21 ++++++++++++------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/arch/arm64/boot/dts/allwinner/sun55i-a523.dtsi b/arch/arm64/boot/dts/allwinner/sun55i-a523.dtsi index 6b6f2296b..e4ed4fa82 100644 --- a/arch/arm64/boot/dts/allwinner/sun55i-a523.dtsi +++ b/arch/arm64/boot/dts/allwinner/sun55i-a523.dtsi @@ -503,22 +503,27 @@ usb_otg: usb@4100000 { }; usbphy: phy@4100400 { - compatible = "allwinner,sun55i-a523-usb-phy", - "allwinner,sun20i-d1-usb-phy"; + compatible = "allwinner,sun55i-a523-usb-phy"; reg = <0x4100400 0x100>, <0x4101800 0x100>, - <0x4200800 0x100>; + <0x4200800 0x100>, + <0x4e00000 0x100>; reg-names = "phy_ctrl", "pmu0", - "pmu1"; + "pmu1", + "pmu2"; clocks = <&osc24M>, - <&osc24M>; + <&osc24M>, + <&ccu CLK_USB2>; clock-names = "usb0_phy", - "usb1_phy"; + "usb1_phy", + "usb2_phy"; resets = <&ccu RST_USB_PHY0>, - <&ccu RST_USB_PHY1>; + <&ccu RST_USB_PHY1>, + <&ccu RST_BUS_3>; reset-names = "usb0_reset", - "usb1_reset"; + "usb1_reset", + "usb2_reset"; status = "disabled"; #phy-cells = <1>; }; From patchwork Sat Aug 16 08:46:56 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: iuncuim X-Patchwork-Id: 1229 Received: from mail-pg1-f169.google.com (mail-pg1-f169.google.com [209.85.215.169]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 27ECE23B604 for ; Sat, 16 Aug 2025 08:47:54 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.215.169 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1755334076; cv=none; b=l2sS8CpJG9TVizv3pZJTFHOpHW7/kfMrofPBTrcSja0YL0WtlhtfShhkLEsoiMRaT53+whEUegSZduACaegp8wCVZ3Fff8P2cHyvETV3uDyh9H/4Y331126uW23tq3zVyi570nH6IfNMn89wQFu8Sq2BgDAg0CwHeQI070upDQw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1755334076; c=relaxed/simple; bh=YhnsWfnst8CACf6PQAROgdhIAFBdYvfImQU33bmRVoY=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=LtvDT+xZoExTpzvS9XLr2f4xQHJV3rzwh1o8zXf+8QuHKKhNeCwUNZsZxy4a+HkchSMm4Xsx6k7AO2tgAfvvrZr+TYTmaAl54qbJlmvwZbceW/DnPV09gujL7VVWLY0lKCNZ5owSFppEkhcPLboOgaQuSVvn0Jl2WwWDdQu/db4= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=hOMaFOFz; arc=none smtp.client-ip=209.85.215.169 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="hOMaFOFz" Received: by mail-pg1-f169.google.com with SMTP id 41be03b00d2f7-b47174c3b3fso1652631a12.2 for ; Sat, 16 Aug 2025 01:47:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1755334074; x=1755938874; darn=lists.linux.dev; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=50Ntk2ae5CUZ3DU9PEgu24q2kwxt9HUqPcFOtly0Sk4=; b=hOMaFOFzQTY55ujwffIM8paN6nwYxLC5nCiwzKLuTemPDs7CKaaegRTH9J8zfpo2HB 37GIQ6wKY68CGEHUY6yCe0ZLb/srQljiCE4wuP6+FMBSd4yGuqQEjEnI61PZJgvWd9TL iBTTXxi8UHUDve1jUHvbcPm0tggdIpRAFOPvJufZkmvSV+qrb0SbFz6a5VvbURwbD1G/ 4G89jgG7jkGwST29YFHFp40UDqWEt8qq3kUyMijje822pPEy1fAy5PhQ2/ytgWHtZ63D WCPNM6wXhsr/fqhd83qllBx4X7DuF9Eq+l46YsSAE0iHjrn6kDnh339XG1OJNYrBqsnZ DKIg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1755334074; x=1755938874; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=50Ntk2ae5CUZ3DU9PEgu24q2kwxt9HUqPcFOtly0Sk4=; b=Jr7lAOAel/SycF0mkhSZAGHSPNH81YHHgJJ4/fB+3m6aKwHAhI69GjppVzOi3qKDj2 wfHQC6wafWf7JyU+VS/wT0Y5UB+qJDb7pzzCSv4ak3PhZEJ4rMubY1nApil2XYJ3XIBc F66lfzk+g5TtZSIicSVyu7JmLwabzgrIGIgLJwqky7ps35PqR//SZtIs8ipTPSTcxFwu oAedRa4Qw4yEYQdfGcZC9UCTXu5gmlxXWTRFln9JbL53SNL9/UY81dAT+f3u8g60svbs l3XRXSu0VQC51MmPSNcXAvzLBTcmRw3kMj89zj3uLI2iNhFz3l1jENAljY2cRkO+r+up 0AFA== X-Forwarded-Encrypted: i=1; AJvYcCW7tVCv3ObqjJgicmjv79Cf1hFckmDR/BFOEcD6n4gggppDhYS5w7qi+NWnypwxS74o0FJS5bBGja6SMA==@lists.linux.dev X-Gm-Message-State: AOJu0Yw7bV2uQy+rbPWFGCkrdZGSKluht37y0n8CtYvPxWDgPmLwP35i RBaGbRkWTFDnh8ACj7eX2QMsoFPoimEB4YMMuO1W2NHqSDtUCNrSpprL X-Gm-Gg: ASbGncuEPraGzuiDNdmyLNfsCUehvek8ZpblW8KtYb5HO28tchktvK4ufqeW2WGshO/ APIHO1dyhXdojsNDaQMZakq82Bo219uM7/fNT779uE5dnsW6eH+qiiZf3+iLqWgd3pPzAjXXEIm xF9BLC34SqDx5FsH85Qt427qzXSLj83SrkVYvduaWahcXWHBeS/yhw2R3PXC9wgTfWiN2G124cU 112ijAFPPAv/IKr8a0honBhBSuXjW6HRMH2/CvI1XlL23hCl0FUNjYZbH3CQiDnUskhSDTrQhQg ay3fvagN7zAD9G7Uq0vO3vWKIKZtP9kQmFbj6Y1ERSR2LkHjq7Vb6GG9welINxvcRbs2DDMTmBM LExuAMG+rN/Y= X-Google-Smtp-Source: AGHT+IHH2hwegF/f0OgFPR9gVfjZpUsDlbhxI4wzUfEICoM2jQpliSfPj1xZkFqOfFWIa8JxKO9MuQ== X-Received: by 2002:a17:902:c98b:b0:23f:f96d:7579 with SMTP id d9443c01a7336-2447900cf44mr20352345ad.37.1755334074401; Sat, 16 Aug 2025 01:47:54 -0700 (PDT) Received: from junAIR ([212.192.12.80]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-2446d57f12esm31048215ad.157.2025.08.16.01.47.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 16 Aug 2025 01:47:54 -0700 (PDT) From: iuncuim To: Rob Herring , Krzysztof Kozlowski , Conor Dooley , Chen-Yu Tsai , Jernej Skrabec , Samuel Holland , Andre Przywara , Michael Turquette , Stephen Boyd , Vinod Koul , Kishon Vijay Abraham I , Philipp Zabel Cc: devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-phy@lists.infradead.org, linux-clk@vger.kernel.org, linux-sunxi@lists.linux.dev Subject: [PATCH 3/7] phy: sun4i-usb: a523: add support for the USB2 PHY Date: Sat, 16 Aug 2025 16:46:56 +0800 Message-ID: <20250816084700.569524-4-iuncuim@gmail.com> X-Mailer: git-send-email 2.50.1 In-Reply-To: <20250816084700.569524-1-iuncuim@gmail.com> References: <20250816084700.569524-1-iuncuim@gmail.com> Precedence: bulk X-Mailing-List: linux-sunxi@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Status: O From: Mikhail Kalashnikov Previously, USB PHY was compatible with D1 and did not require separatedata options. But now we need to add a third PHY, which makes it incompatible. The third PHY is used together with USB3/PCIe combophy with DWC3 controller. In the BSP code, the third PHY requires a separate glue driver, but it seems that it is not needed. Signed-off-by: Mikhail Kalashnikov --- drivers/phy/allwinner/phy-sun4i-usb.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/drivers/phy/allwinner/phy-sun4i-usb.c b/drivers/phy/allwinner/phy-sun4i-usb.c index 8873aed3a..bb79339f2 100644 --- a/drivers/phy/allwinner/phy-sun4i-usb.c +++ b/drivers/phy/allwinner/phy-sun4i-usb.c @@ -1025,6 +1025,15 @@ static const struct sun4i_usb_phy_cfg sun50i_h616_cfg = { .siddq_in_base = true, }; +static const struct sun4i_usb_phy_cfg sun55i_a523_cfg = { + .num_phys = 3, + .phyctl_offset = REG_PHYCTL_A33, + .dedicated_clocks = true, + .hci_phy_ctl_clear = PHY_CTL_SIDDQ, + .phy0_dual_route = true, + .siddq_in_base = true, +}; + static const struct of_device_id sun4i_usb_phy_of_match[] = { { .compatible = "allwinner,sun4i-a10-usb-phy", .data = &sun4i_a10_cfg }, { .compatible = "allwinner,sun5i-a13-usb-phy", .data = &sun5i_a13_cfg }, @@ -1041,6 +1050,7 @@ static const struct of_device_id sun4i_usb_phy_of_match[] = { .data = &sun50i_a64_cfg}, { .compatible = "allwinner,sun50i-h6-usb-phy", .data = &sun50i_h6_cfg }, { .compatible = "allwinner,sun50i-h616-usb-phy", .data = &sun50i_h616_cfg }, + { .compatible = "allwinner,sun55i-a523-usb-phy", .data = &sun55i_a523_cfg }, { .compatible = "allwinner,suniv-f1c100s-usb-phy", .data = &suniv_f1c100s_cfg }, { }, From patchwork Sat Aug 16 08:46:57 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: iuncuim X-Patchwork-Id: 1228 Received: from mail-pf1-f177.google.com (mail-pf1-f177.google.com [209.85.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 5A34323ABA8 for ; Sat, 16 Aug 2025 08:48:05 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.177 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1755334087; cv=none; b=FZZof4erJbIMrI8EI4S4b9DpuWASl25gu/VCnLDS6VdopXd9Yw3c/t1QyojJYAy3LxsMM3xMKwLNE4C8Pd5SaFsqMhAwbfJGqDQCI0iymhRaGIxs2b3oS7SageVrsD+YfCpZs9iPIFwR2TYO7vRnGw5kWE0fXfCyIsqBrxanG8U= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1755334087; c=relaxed/simple; bh=ay/1SNjHT3U5QFbdxOBUozRcg6LzdjTW2J3whny10pY=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=bYcd6GlfjGfG/amyQigpbd1OFwipuJB8+DbXgeOzid2kvD1UdqxtJMP/subCfS7wFG8yJcziS4557LWmwv6sbOds+RCCE6usr7s5guT3NEAJahsnRscfSyDCvnBBo1KpQ3wZYZCmM/hZ6zL/XI6HSvhJY27DiOxuw77DHtaogHM= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=OwlCzMLu; arc=none smtp.client-ip=209.85.210.177 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="OwlCzMLu" Received: by mail-pf1-f177.google.com with SMTP id d2e1a72fcca58-76e2e88c6a6so2508012b3a.1 for ; Sat, 16 Aug 2025 01:48:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1755334084; x=1755938884; darn=lists.linux.dev; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=b/hSmSXJaHEKANxY7b911Jeuq3Okz1lZH5CE6S4se5Q=; b=OwlCzMLuKO67ZRVOSXElnXw8pAXW4n070OyeV8ZcsHpnYeyVhcIDu1f9NWJIMk2TQD nid06cEK65psKSDq9BPBx7Os5eBR9FhoFxr+8BV/YOTC9J/slYbL/dtWbrnk5LPMWTMN cFDIEMhcQi9Rl3JcRw0EoyWwnmQ79feItPDv4w+3SRqd3tKsbV5Oy57Iibkd+Zj71Tp+ 3CJ7E5no/tkhQcfUS54k0UgZbwwL3W/22uA6/7HhakUsNghcq5rgMu39rWDejyo3kyNq UTIQN5JZ9uPTmTMhEVg0EVQvN6EdKD90032rGGqPqWqUeIGD2oPxRBewJ1JaSyRJvkd/ zRog== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1755334084; x=1755938884; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=b/hSmSXJaHEKANxY7b911Jeuq3Okz1lZH5CE6S4se5Q=; b=MP+XqtjU/KjzEdmTg9HF3HO+2kqx7pRE75a1WERwVCQxuXvAvJyttAZmwsaDg9+z7Y RlEaNTAOaPnN0hx3cDIa0LP98vHtX+5sf0qX2K4nX3PA/+B/AM9S8Yk3FwIVM2uznhp3 XXHbd805p5SKh0zBNyuNxsWPCNmTyBtcobBq8brUKrYJ45yW3gKyeunGOlcAUuLCBQr/ HKzav6h8CRq3PXTFZCFtfE+or+u7RXk/eZSTv3+6t61gGXNed+Ffkl/oPavRtc2z94/t nxgo1y2MDt3z8ytJZDzCioiLBgvT92KVCReomjFdXB66nx7gUtOVeLq2mPmAik7Le1Wo q6gg== X-Forwarded-Encrypted: i=1; AJvYcCXHp7bE4IcF2VKH/B3oYX0iC6+E19/75mFssTL/ZNBQvB2nx/oU5P0CIQhrCJ4/8Wt9CydKtKYijLGxsw==@lists.linux.dev X-Gm-Message-State: AOJu0YyuiHEMzIVEVtcV1fhm8rR3LUv3fjKZ9HAysBEdp2JQ4pHlBH+u 6GPJ6ZDLvFSVNSl8tqNFtlLxwA38flk5jluTcCvCpBpNbFSmqYeSLT8R X-Gm-Gg: ASbGnctN/LUo8laK3b2ZSQtaYSHS0xD+GpPApL4C4LoSu8VM2nUOTsKI4XIs/81Nz5E /TSAv9h/6MOxNadniaD3udlFcZoX/Iuz9oDixUk+RCoU198ZAKWjhc90FQqvx/BdmowHj6O2TD7 yPvYv8VLpfEmxC/Thryci7bEIwFAzVC6q/wuSaJyvvmVrQkWQdo0ity+iJV+ySNSMi4bp3w4V4k VK5MRnDVSXsyCaBXrKC88Tz+i3Brb1rX381DvD11wi3+D834DlcgFu2W3JK4D12qw+p+ca8f+bQ sltKSDZPLqNSLADFCtU61NCeVYdSzSUXOigb7mNcggVdySOljNPDkCDhSqNKmDxUM2oHcj30Z+0 2oaT8JomKc9E= X-Google-Smtp-Source: AGHT+IHtjjsbl1HDfzV38iYeiPC60QdrfguJ+6kBdsjCS0cFJoEczwJE0FyIwHLnuIsHXh3TTN2JKw== X-Received: by 2002:a17:903:22c9:b0:240:725d:c396 with SMTP id d9443c01a7336-24478f72011mr31631775ad.34.1755334084471; Sat, 16 Aug 2025 01:48:04 -0700 (PDT) Received: from junAIR ([212.192.12.80]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-2446d57f12esm31048215ad.157.2025.08.16.01.47.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 16 Aug 2025 01:48:04 -0700 (PDT) From: iuncuim To: Rob Herring , Krzysztof Kozlowski , Conor Dooley , Chen-Yu Tsai , Jernej Skrabec , Samuel Holland , Andre Przywara , Michael Turquette , Stephen Boyd , Vinod Koul , Kishon Vijay Abraham I , Philipp Zabel Cc: devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-phy@lists.infradead.org, linux-clk@vger.kernel.org, linux-sunxi@lists.linux.dev Subject: [PATCH 4/7] phy: allwinner: a523: add USB3/PCIe PHY driver Date: Sat, 16 Aug 2025 16:46:57 +0800 Message-ID: <20250816084700.569524-5-iuncuim@gmail.com> X-Mailer: git-send-email 2.50.1 In-Reply-To: <20250816084700.569524-1-iuncuim@gmail.com> References: <20250816084700.569524-1-iuncuim@gmail.com> Precedence: bulk X-Mailing-List: linux-sunxi@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Status: O From: Mikhail Kalashnikov The A523 family of processors features a combophy for USB 3.0 and PCIe, developed by Innosilicon. Simultaneous operation of both interfaces is not supported by design. Currently, the driver only adds support for USB 3.0. PCIe support is currently unavailable and will be added later. All data on phy configuration is taken from the manufacturer's BSP driver. Signed-off-by: Mikhail Kalashnikov --- drivers/phy/allwinner/Kconfig | 9 + drivers/phy/allwinner/Makefile | 1 + drivers/phy/allwinner/phy-sun55i-usb3-pcie.c | 267 +++++++++++++++++++ 3 files changed, 277 insertions(+) create mode 100644 drivers/phy/allwinner/phy-sun55i-usb3-pcie.c diff --git a/drivers/phy/allwinner/Kconfig b/drivers/phy/allwinner/Kconfig index fb584518b..af2a82e51 100644 --- a/drivers/phy/allwinner/Kconfig +++ b/drivers/phy/allwinner/Kconfig @@ -57,3 +57,12 @@ config PHY_SUN50I_USB3 part of Allwinner H6 SoC. This driver controls each individual USB 2+3 host PHY combo. + +config PHY_SUN55I_USB3_PCIE + tristate "Allwinner A523 Innosilicon USB3/PCIe Combophy Driver" + depends on ARCH_SUNXI || COMPILE_TEST + depends on RESET_CONTROLLER + select GENERIC_PHY + help + Enable this to support the Allwinner PCIe/USB3.0 combo PHY + with Innosilicon IP block founded in A523/A527/H728/T527 SOC diff --git a/drivers/phy/allwinner/Makefile b/drivers/phy/allwinner/Makefile index bd74901a1..5948a27ef 100644 --- a/drivers/phy/allwinner/Makefile +++ b/drivers/phy/allwinner/Makefile @@ -3,3 +3,4 @@ obj-$(CONFIG_PHY_SUN4I_USB) += phy-sun4i-usb.o obj-$(CONFIG_PHY_SUN6I_MIPI_DPHY) += phy-sun6i-mipi-dphy.o obj-$(CONFIG_PHY_SUN9I_USB) += phy-sun9i-usb.o obj-$(CONFIG_PHY_SUN50I_USB3) += phy-sun50i-usb3.o +obj-$(CONFIG_PHY_SUN55I_USB3_PCIE) += phy-sun55i-usb3-pcie.o diff --git a/drivers/phy/allwinner/phy-sun55i-usb3-pcie.c b/drivers/phy/allwinner/phy-sun55i-usb3-pcie.c new file mode 100644 index 000000000..905c54a67 --- /dev/null +++ b/drivers/phy/allwinner/phy-sun55i-usb3-pcie.c @@ -0,0 +1,267 @@ +// SPDX-License-Identifier: GPL-2.0+ +/* + * Driver for Innosilicon USB3.0/PCIe phy found in Allwinner A523 processors. + * Currently, the driver only supports the USB3.0 part. + * + * Copyright (C) 2025 Mikhail Kalashnikov + * Based on phy-sun50i-usb3.c, which is: + * Copyright (C) 2017 Icenowy Zheng + * + */ + +#include +#include +#include +#include +#include +#include +#include +#include + +#define PHY_SYS_VER 0x00 + +#define PHY_USB3_BGR 0x08 +/* Control bits for the USB3 part */ +#define USB3_RESETN BIT(0) +#define USB3_ACLK_EN BIT(17) +#define USB3_HCLK_EN BIT(16) + +#define PHY_CTL 0x10 +/* Control bits for the common part */ +#define PHY_RSTN BIT(0) +/* Bit for selecting internal(0) or external(1) clock */ +#define PHY_CLK_SEL BIT(30) +/* Bit for selecting PCIe(0) or USB3(1) role */ +#define PHY_USE_SEL BIT(31) + +#define PHY_CLK_OFFSET 0x80000 + +struct sun55i_usb3_pcie_phy { + struct device *dev; + struct phy *phy; + void __iomem *regs; + void __iomem *regs_clk; + struct reset_control *reset; + struct clk *clk; +}; + +/* + * These values are derived from the manufacturer's driver code. + * Comments are preserved. + */ +static void sun55i_usb3_phy_open(struct sun55i_usb3_pcie_phy *phy) +{ + u32 val; + + val = readl(phy->regs_clk + 0x1418); + val &= ~(GENMASK(17, 16)); + val |= BIT(25); + writel(val, phy->regs_clk + 0x1418); + + /* reg_rx_eq_bypass[3]=1, rx_ctle_res_cal_bypass */ + val = readl(phy->regs_clk + 0x674); + val |= BIT(3); + writel(val, phy->regs_clk + 0x674); + + /* rx_ctle_res_cal=0xf, 0x4->0xf */ + val = readl(phy->regs_clk + 0x704); + val |= BIT(8) | BIT(9) | BIT(11); + writel(val, phy->regs_clk + 0x704); + + /* CDR_div_fin_gain1 */ + val = readl(phy->regs_clk + 0x400); + val |= BIT(4); + writel(val, phy->regs_clk + 0x400); + + /* CDR_div1_fin_gain1 */ + val = readl(phy->regs_clk + 0x404); + val |= GENMASK(3, 0); + val |= BIT(5); + writel(val, phy->regs_clk + 0x404); + + /* CDR_div3_fin_gain1 */ + val = readl(phy->regs_clk + 0x408); + val |= BIT(5); + writel(val, phy->regs_clk + 0x408); + + val = readl(phy->regs_clk + 0x109c); + val |= BIT(1); + writel(val, phy->regs_clk + 0x109c); + + /* SSC configure */ + /* div_N */ + val = readl(phy->regs_clk + 0x107c); + val &= ~(GENMASK(17, 12)); + val |= BIT(12); + writel(val, phy->regs_clk + 0x107c); + + /* modulation freq div */ + val = readl(phy->regs_clk + 0x1020); + val &= ~(GENMASK(4, 0)); + val |= BIT(1) | BIT(2); + writel(val, phy->regs_clk + 0x1020); + + /* spread[6:0], 400*9=4410ppm ssc */ + val = readl(phy->regs_clk + 0x1034); + val &= ~(GENMASK(22, 16)); + val |= BIT(16) | BIT(19); + writel(val, phy->regs_clk + 0x1034); + + val = readl(phy->regs_clk + 0x101c); + /* don't disable ssc = 0 */ + val &= ~BIT(28); + /* choose downspread */ + val |= BIT(27); + writel(val, phy->regs_clk + 0x101c); +} + +static int sun55i_usb3_pcie_clk_init(struct sun55i_usb3_pcie_phy *phy) +{ + u32 val; + int ret; + + ret = clk_prepare_enable(phy->clk); + if (ret) + return ret; + + ret = reset_control_deassert(phy->reset); + if (ret) { + clk_disable_unprepare(phy->clk); + return ret; + } + + val = readl(phy->regs + PHY_CTL); + val |= PHY_USE_SEL | PHY_RSTN; + val &= ~PHY_CLK_SEL; + writel(val, phy->regs + PHY_CTL); + + val = readl(phy->regs + PHY_USB3_BGR); + val |= USB3_ACLK_EN | USB3_HCLK_EN | USB3_RESETN; + writel(val, phy->regs + PHY_USB3_BGR); + + return 0; +} + +static int sun55i_usb3_pcie_phy_init(struct phy *_phy) +{ + struct sun55i_usb3_pcie_phy *phy = phy_get_drvdata(_phy); + + sun55i_usb3_phy_open(phy); + + return 0; +} + +static int sun55i_usb3_pcie_phy_exit(struct phy *_phy) +{ + struct sun55i_usb3_pcie_phy *phy = phy_get_drvdata(_phy); + + reset_control_assert(phy->reset); + clk_disable_unprepare(phy->clk); + + return 0; +} + +static void sun55i_usb3_pcie_phy_power_set(struct phy *_phy, bool on) +{ + struct sun55i_usb3_pcie_phy *phy = phy_get_drvdata(_phy); + u32 val; + + val = readl(phy->regs_clk + 0x14); + val = on ? (val & ~BIT(26)) : (val | BIT(26)); + writel(val, phy->regs_clk + 0x14); + + val = readl(phy->regs_clk); + val = on ? (val & ~BIT(10)) : (val | BIT(10)); + writel(val, phy->regs_clk); +} + +static int sun55i_usb3_pcie_phy_power_on(struct phy *_phy) +{ + sun55i_usb3_pcie_phy_power_set(_phy, true); + + return 0; +} + +static int sun55i_usb3_pcie_phy_power_off(struct phy *_phy) +{ + sun55i_usb3_pcie_phy_power_set(_phy, false); + + return 0; +} + +static const struct phy_ops sun55i_usb3_pcie_phy_ops = { + .init = sun55i_usb3_pcie_phy_init, + .exit = sun55i_usb3_pcie_phy_exit, + .power_on = sun55i_usb3_pcie_phy_power_on, + .power_off = sun55i_usb3_pcie_phy_power_off, + .owner = THIS_MODULE, +}; + +static int sun55i_usb3_pcie_phy_probe(struct platform_device *pdev) +{ + struct sun55i_usb3_pcie_phy *phy; + struct device *dev = &pdev->dev; + struct phy_provider *phy_provider; + int ret; + + phy = devm_kzalloc(dev, sizeof(*phy), GFP_KERNEL); + if (!phy) + return -ENOMEM; + + phy->dev = dev; + phy->clk = devm_clk_get(dev, NULL); + if (IS_ERR(phy->clk)) { + if (PTR_ERR(phy->clk) != -EPROBE_DEFER) + dev_err(dev, "failed to get phy clock\n"); + return PTR_ERR(phy->clk); + } + + phy->reset = devm_reset_control_get(dev, NULL); + if (IS_ERR(phy->reset)) { + dev_err(dev, "failed to get reset control\n"); + return PTR_ERR(phy->reset); + } + + phy->regs = devm_platform_ioremap_resource(pdev, 0); + if (IS_ERR(phy->regs)) + return PTR_ERR(phy->regs); + + phy->regs_clk = phy->regs + PHY_CLK_OFFSET; + if (IS_ERR(phy->regs_clk)) + return PTR_ERR(phy->regs_clk); + + phy->phy = devm_phy_create(dev, NULL, &sun55i_usb3_pcie_phy_ops); + if (IS_ERR(phy->phy)) { + dev_err(dev, "failed to create PHY\n"); + return PTR_ERR(phy->phy); + } + + phy_set_drvdata(phy->phy, phy); + phy_provider = devm_of_phy_provider_register(dev, of_phy_simple_xlate); + + ret = sun55i_usb3_pcie_clk_init(phy); + if (ret) + return ret; + dev_info(phy->dev, "phy version is: 0x%x\n", readl(phy->regs)); + + return PTR_ERR_OR_ZERO(phy_provider); +} + +static const struct of_device_id sun55i_usb3_pcie_phy_of_match[] = { + { .compatible = "allwinner,sun55i-a523-usb3-pcie-phy" }, + { }, +}; +MODULE_DEVICE_TABLE(of, sun55i_usb3_pcie_phy_of_match); + +static struct platform_driver sun55i_usb3_pcie_phy_driver = { + .probe = sun55i_usb3_pcie_phy_probe, + .driver = { + .of_match_table = sun55i_usb3_pcie_phy_of_match, + .name = "sun55i-usb3-pcie-phy", + } +}; +module_platform_driver(sun55i_usb3_pcie_phy_driver); + +MODULE_DESCRIPTION("Allwinner A523 USB3/PCIe phy driver"); +MODULE_AUTHOR("Mikhail Kalashnikov "); +MODULE_LICENSE("GPL"); From patchwork Sat Aug 16 08:46:58 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: iuncuim X-Patchwork-Id: 1227 Received: from mail-pf1-f181.google.com (mail-pf1-f181.google.com [209.85.210.181]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 9BE55156237 for ; Sat, 16 Aug 2025 08:48:13 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.181 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1755334095; cv=none; b=OWUxG5LcGiUGU3h1luOA4F7fQf97f0vMIUa9e7P86WpI+n6lkmc7xAZjX8HVpukUmAG7mnHYtJ2sq2Kih+CJdqXKc5NHHwMZsa7WhYk1/zAqRqHfnw7xUwPCwjYGZnWO8HhJVVQTqUaRgQolGWZp3SaAFxiAUzYfJ2wiavm7vuY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1755334095; c=relaxed/simple; bh=3uKkcJFOXgYLabgZa+7XV2eGzSf6Ec9xtil3xuV0aXI=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=JIVjPkFfhIHUtg7as5gGljoUtmQ9X7Co3SWoTbfOvlOnJiLPTdC7JcxevyDLA80rHVjNWCgce1ok/QlHulC2IWJq9YTWhyAQbIIcp7oiV/UPzwemoqQbmRRYoIb8OKSHMSXcl41mvtFFM/WqyoTV45Nq481CYD2ruOiQTXRfDsg= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=Z3xY4i/I; arc=none smtp.client-ip=209.85.210.181 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="Z3xY4i/I" Received: by mail-pf1-f181.google.com with SMTP id d2e1a72fcca58-76e1ff326bbso2859529b3a.1 for ; Sat, 16 Aug 2025 01:48:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1755334093; x=1755938893; darn=lists.linux.dev; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=NZaUVKgFL1lunF4nMqIkLNfN3yrPrabF4vqHbgSjhvc=; b=Z3xY4i/IXzmG1dCNkuc5e/KJ1xdcUhG3TbIAkIiIXRoEseIUaPAX1wuNpQRd5p7XYK Rec5OB+0wPE3Ol482agxDqp2mrPAYEGjBDmY0uH6Axk94lnYC9yzsll8tHbmCVGPXeN3 y8LmCuYhADpV9cIbYDdTv3h74N2uWfVRBWqnUfKJ/xZWte6+gOY2ZiqZkXRGiQGj2FSN mCWzDT1iI6j+pd22cmXU8Y/k/w8JfiunJm0blrJbhWXOqdO3dnh5UzAOYrc3yJRALj0b KWDK/+FQ2w9OoF0kNo1iKQimFk7YgM5PStAGVTndl05FlRpfNrT6DHxG2CzdBLJA/686 kRLg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1755334093; x=1755938893; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=NZaUVKgFL1lunF4nMqIkLNfN3yrPrabF4vqHbgSjhvc=; b=YddVIwlrgCku+SXCHbzLRJ6sSwkzx4PA0VacEDonnNanWroog8MkRvHcVRIh+jNYek sznuD08S3CQS/XVGs0LPuo19DQq1FKz0RXuX71mx3T9+46irlpNZAmtmLejIZ3oPyYq6 uz7qI81u0cttKaaH36npfGYLbk+TANdaEkEbwRfNRyVo0yyjRDNV1s9duNYTbtu9+h56 EKuy2MJNM+yHkD8+hbEmnknWe/eXJoBOyvpQgh9evfxjx1BzpslvByRez0oKxa+7MFMg aOhr/kJTj5IcWbbEnUmz28wttrm1NaQhuW5Wfx3Wap7xyiatQjtxfcY79K9rnF3q8GvM FJ5A== X-Forwarded-Encrypted: i=1; AJvYcCVLGSqzItQaaG+X75nJpGWBkVUJVjlAkqy7WWvMGp6TnInZJ+kJbVvLmAd198QeDjW6Ce0X14JChElqlA==@lists.linux.dev X-Gm-Message-State: AOJu0YyU0bFc5G2h+uwruNiG/9neJ7iNlw50qp7fyDi3cDIgB4iHgQkQ iTjmzs4LOBh9oCCeQAlHP1Zl+3IIRu9wmRq3vQHZ28E7j0i4YT2Nmimv X-Gm-Gg: ASbGnctgo9bga9QkOcfgrM7ehQeyy8xEFehD/XYKQ1OJDvDYjbWxVkjZLfHPbDzhdVu ToY5NGzj1Pxz4EkEtalQQfOcxUv6SP0Ul0j/a9o0M4+Lv82J3eJoWGwMJRPlmZYyqbfh7a12eK2 +x3zaA5LJjhLta813uwSSelo9h21qTQdkknS/5iq+ye9Sp7ly65zXOMAxl6x11mzqWiHQrYJujI BW7JHi9VVSbAQiYwbRbrqPC/Aah/RSl9O2avnEC9IROSkqOmijJ47nGzCWFnFkzI1RpfSAJIjni wtKC/LxmeV/TOBbbm4L31ahr1NcE2EqPeO8IRMbhKVCTN61L0ARxyzVL0gHxoryp34WG91gYX5t OHPFb0182vEM= X-Google-Smtp-Source: AGHT+IEeC7TzpwrnZ29EptzNFEC8zZV507GN6tiYHpU7eLNsZcGs71sZYOzt9Mx6896AVTDC5n+jJg== X-Received: by 2002:a17:903:2d2:b0:23f:75d1:3691 with SMTP id d9443c01a7336-2446bdafa24mr79167475ad.15.1755334092874; Sat, 16 Aug 2025 01:48:12 -0700 (PDT) Received: from junAIR ([212.192.12.80]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-2446d57f12esm31048215ad.157.2025.08.16.01.48.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 16 Aug 2025 01:48:12 -0700 (PDT) From: iuncuim To: Rob Herring , Krzysztof Kozlowski , Conor Dooley , Chen-Yu Tsai , Jernej Skrabec , Samuel Holland , Andre Przywara , Michael Turquette , Stephen Boyd , Vinod Koul , Kishon Vijay Abraham I , Philipp Zabel Cc: devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-phy@lists.infradead.org, linux-clk@vger.kernel.org, linux-sunxi@lists.linux.dev Subject: [PATCH 5/7] arm64: dts: allwinner: a523: add USB3.0 phy node Date: Sat, 16 Aug 2025 16:46:58 +0800 Message-ID: <20250816084700.569524-6-iuncuim@gmail.com> X-Mailer: git-send-email 2.50.1 In-Reply-To: <20250816084700.569524-1-iuncuim@gmail.com> References: <20250816084700.569524-1-iuncuim@gmail.com> Precedence: bulk X-Mailing-List: linux-sunxi@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Status: O From: Mikhail Kalashnikov After adding the phy driver, we can also add phy node. In addition to the clk and reset lines, the power domain PD_PCIE is declared in this node according to the bsp dtb. So let's mention it. Currently, phy driver does not support role selection and only works in USB3.0 mode. Signed-off-by: Mikhail Kalashnikov --- arch/arm64/boot/dts/allwinner/sun55i-a523.dtsi | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/arch/arm64/boot/dts/allwinner/sun55i-a523.dtsi b/arch/arm64/boot/dts/allwinner/sun55i-a523.dtsi index e4ed4fa82..233365496 100644 --- a/arch/arm64/boot/dts/allwinner/sun55i-a523.dtsi +++ b/arch/arm64/boot/dts/allwinner/sun55i-a523.dtsi @@ -606,6 +606,16 @@ mdio0: mdio { }; }; + combophy: phy@4f00000 { + compatible = "allwinner,sun55i-a523-usb3-pcie-phy"; + reg = <0x04f00000 0x100000>; + clocks = <&ccu CLK_USB3>; + resets = <&ccu RST_BUS_PCIE_USB3>; + #phy-cells = <0>; + power-domains = <&pck600 PD_PCIE>; + status = "disabled"; + }; + ppu: power-controller@7001400 { compatible = "allwinner,sun55i-a523-ppu"; reg = <0x07001400 0x400>; From patchwork Sat Aug 16 08:46:59 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: iuncuim X-Patchwork-Id: 1226 Received: from mail-pg1-f181.google.com (mail-pg1-f181.google.com [209.85.215.181]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A50B023D29F for ; Sat, 16 Aug 2025 08:48:21 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.215.181 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1755334103; cv=none; b=AR9iigks7o642/lreoknkdTlgwsDbOCZRgXESvTCQIvnKHr0ePmsqk4QI01vQE1kswGP/mc2sHGZbvmNucBWwDKm0QteHBKnxKgFUxf06RpKJGwb4jyeTWDuH5jlnSEmojLcLraGA1i6QjZ1PW3Tz6k6w40brJdO2nx7Sev33OU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1755334103; c=relaxed/simple; bh=ZiFEr88GKO2Hs9RHvAZKyj+tO8dqzvBWzvKcfZTtNF8=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=LkmenMHo1B4KRPHVPRXEvBTDuNY1+o+qHSry18ssfZ/Qr8kXkVqkUYl+XXx8dXvA57ER6E6GF9piSHuWqjRxqw/lqEY6Y8SLdRCzD+izeAbXQfFb+e3wO20ELsg05bHmlvPhXPv1wtXYXWaE7KsCCvsQAKu0F/yD3TON398xgRg= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=nT6uR2vW; arc=none smtp.client-ip=209.85.215.181 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="nT6uR2vW" Received: by mail-pg1-f181.google.com with SMTP id 41be03b00d2f7-b47174beccfso2234747a12.2 for ; Sat, 16 Aug 2025 01:48:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1755334101; x=1755938901; darn=lists.linux.dev; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=zCmauNf7s5FntNtudgCLlOZcs3Emgfa8V1BlciZ5v+A=; b=nT6uR2vW9saEk4wPVkXIapuMNDViHovBnMl1Tw0a5UBdu6c2Gg2vbodHRUQ4cxVw7W AW83de2WaTsPDuyny7NO+OF2EVYXrvQ7xIwi22XtH65tf0L+bPh3kfJ9emXNE8HXMYlE IHDQSTvDRYLSrpodqnHV68oPxobP6VM8WHSNdWfSA/FLuxE8oH0pAimjhmLdpszBVgsi /SesZGQBnU2VscUvL9cZrRSaY0tDLiTXikffwSK+teVydu/7seNX0tzdo+EOjWg1COty 4w8SPzyReVfdJpMh8TOqnJZ9axP2h25/wNEptcTm4fuPcsNWQLe25Vj8mCM+UT9Gb8NW fF6A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1755334101; x=1755938901; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=zCmauNf7s5FntNtudgCLlOZcs3Emgfa8V1BlciZ5v+A=; b=pvR3BtkIjEBL+8+QkeVs1kB9dRPZJaTmidBqdoQCKT2spFnUrIF+ErjXUWF7yP4AmP +4os91NnXpubC3ulXs1vbYxiQP1N4/uj4rA6LFvdc90uIQocY1jCA5HVnKO8x2iCfEy5 6LpWjKvYCJIGgxrRHtCfLP2jncLJSpTESEgnyH66NbKf6vtuioc2hksOgnYI/rSUNDZ0 WOoGVSiYzwPk6fuhf9h6+t72po37V/s0W1y0Ec8m5A1vDGfvRIj6RqvFRPIzFiSH5sEo rtyKpMv9Xd6ZBYbOGA6bn99lHo4Uil6PCbqkUm8bpCf0vppAPpPBahJEUKBk8+oNvXNg ylCA== X-Forwarded-Encrypted: i=1; AJvYcCWtUi2GPXnMcD+eP4H6GvVMqvS6x3jm914lecjkqZG07ZoqECYIF8aOaGRrH7f8pi2tsujxKkjI4Gg+eg==@lists.linux.dev X-Gm-Message-State: AOJu0Yy6Yl7uydTM1tFPZnzOidf06x2TM5osCi3rm01cjpfabk36ROOz 0ugbQ3jRTePImhfJdrxmscB3z7qxdmIehpX9iJ1MxWuQrnPGjJ7lZyQH X-Gm-Gg: ASbGncuMd5U5rs9+TO4MKmZLoL/vkObaMljS5jen1NQeawIzuOJG3FzNk5yauYjsJC0 Jk/2aZT7TRcc0s7WZqF+WYwAkGtIw1cSjymlOa+sTxkbizBFk3zTAf7VcBvxyMEd22pyQBJSHPT BMq8OX8cS03oQcRjblE3Z9XKyFh/d/hP5T36FkWniGR4CInvUp+047wA/f9ZGAqgeEI0yGUCDBX zU3cOJWskSmoR/limb6CAIeHBBXhQHJ0FkXdT5vGkyyQuJTBceB+zsiGb/eYXp+tEJEltheZO0F pVW++GesFWHd7pwbpni0w8KA3STX0IX2cE4es6CJKFBS8WGtoPnPGalobftwDxb/j4wuh8Cz2yy 4/006Lk9ciyw= X-Google-Smtp-Source: AGHT+IGpbFzYzzfHGbiZJhEqwpiiL3XiXv/bsEZ7XwHQ7nIZIbLySNrguZk+IP+kgbrq8QPu+xMORg== X-Received: by 2002:a17:902:dac1:b0:234:d778:13fa with SMTP id d9443c01a7336-2446d866269mr71913515ad.26.1755334100952; Sat, 16 Aug 2025 01:48:20 -0700 (PDT) Received: from junAIR ([212.192.12.80]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-2446d57f12esm31048215ad.157.2025.08.16.01.48.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 16 Aug 2025 01:48:20 -0700 (PDT) From: iuncuim To: Rob Herring , Krzysztof Kozlowski , Conor Dooley , Chen-Yu Tsai , Jernej Skrabec , Samuel Holland , Andre Przywara , Michael Turquette , Stephen Boyd , Vinod Koul , Kishon Vijay Abraham I , Philipp Zabel Cc: devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-phy@lists.infradead.org, linux-clk@vger.kernel.org, linux-sunxi@lists.linux.dev Subject: [PATCH 6/7] arm64: dts: allwinner: a523: add DWC3 USB3.0 node Date: Sat, 16 Aug 2025 16:46:59 +0800 Message-ID: <20250816084700.569524-7-iuncuim@gmail.com> X-Mailer: git-send-email 2.50.1 In-Reply-To: <20250816084700.569524-1-iuncuim@gmail.com> References: <20250816084700.569524-1-iuncuim@gmail.com> Precedence: bulk X-Mailing-List: linux-sunxi@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Status: O From: Mikhail Kalashnikov After adding the phy bindings, we can also add dwc3 node, which uses the previously added usbphy2 and part of usb3 from combophy. All settings declared in dwc3 node are obtained from the x96qproplus' dtb. BSP contains an additional glue driver for dwc3, but it seems that it is not needed. Signed-off-by: Mikhail Kalashnikov --- .../arm64/boot/dts/allwinner/sun55i-a523.dtsi | 21 +++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/arch/arm64/boot/dts/allwinner/sun55i-a523.dtsi b/arch/arm64/boot/dts/allwinner/sun55i-a523.dtsi index 233365496..ec170888a 100644 --- a/arch/arm64/boot/dts/allwinner/sun55i-a523.dtsi +++ b/arch/arm64/boot/dts/allwinner/sun55i-a523.dtsi @@ -606,6 +606,27 @@ mdio0: mdio { }; }; + dwc3: usb@4d00000 { + compatible = "snps,dwc3"; + reg = <0x04d00000 0x100000>; + interrupts = ; + dr_mode = "host"; + clocks = <&ccu CLK_MBUS_USB3>, <&ccu CLK_USB3>, + <&ccu CLK_USB2>, <&ccu CLK_USB3_SUSPEND>; + clock-names = "bus_clk", "ref_clk3", "ref_clk2", "suspend"; + maximum-speed = "super-speed"; + phy_type = "utmi"; + snps,dis_enblslpm_quirk; + snps,dis-u1-entry-quirk; + snps,dis-u2-entry-quirk; + snps,dis_u3_susphy_quirk; + snps,dis_u2_susphy_quirk; + snps,dis_rxdet_inp3_quirk; + phys = <&usbphy 2>, <&combophy>; + phy-names = "usb2-phy", "usb3-phy"; + status = "disabled"; + }; + combophy: phy@4f00000 { compatible = "allwinner,sun55i-a523-usb3-pcie-phy"; reg = <0x04f00000 0x100000>; From patchwork Sat Aug 16 08:47:00 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: iuncuim X-Patchwork-Id: 1225 Received: from mail-pf1-f178.google.com (mail-pf1-f178.google.com [209.85.210.178]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 32D5D23BCEE for ; Sat, 16 Aug 2025 08:48:31 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.178 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1755334112; cv=none; b=PXS9hVmGZnP9siyjF+2r+1tZV/50R7sH56H2G8Hv8lEMMFECaq7j/UCXtKWJZr77NsAELTW1z3ym8X4viitHipWMt3Z74OmZMuBRTU+SNnSSqqAXZPE3YoedsgQLFqS3dWGyyI54BI7ZHuKA6OtxW5ONQU8OQLYBWE7j0VwN02E= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1755334112; c=relaxed/simple; bh=pzJn+y3ubulKFb+XrVV1kazkT/PrWOp3C67NiveIlbM=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=SbzXHyONCc/JMzxhtYJnmoVQAPj+EHrk8tGO0XgK5WzcS3yOfq73Om+mOFXp1QmqyWw4IuEezPYlWQ1zAmjk04AWuL/llNJ/X5fgCJ1fGvMCzrGCisiBks1zNG3bSi6ntwTOvlb0wwRjAGA4XjBbfvolnzWlZyGRLsDS/Um95XY= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=ZxKqsD6U; arc=none smtp.client-ip=209.85.210.178 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="ZxKqsD6U" Received: by mail-pf1-f178.google.com with SMTP id d2e1a72fcca58-76e1fc69f86so2679993b3a.0 for ; Sat, 16 Aug 2025 01:48:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1755334110; x=1755938910; darn=lists.linux.dev; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=EDWOGAR/V8qhS+DEW6fYz84GWwsYflwCKKabdx3FCTA=; b=ZxKqsD6UTUnoXv206rZGG1kNDjt9+Q+Aoo/3xabhgwCe6x5FL/3k1jZzgwWrc11rI6 j1EHM7RfjEgCNcDC+drdbn0d/S2pg8aa4MVBUwuElf1eSuHudqnVoZ1BTwBIS/+sLQ+O YXEE0Xy6rRMXsSVNFe66GTpftXhoWu7Iq/y+zWDJRnX6jJ9cCT+l2Bgbr9JioxwITAYM OcCurOVDzSXp8PU3FLsQiVGLRg7Q/ttx8YGBfEgCJkct0LSNKHPbeif4rMV+z4wiGHU3 o4/1B6om/xsp2F6CSLZGSe+R365oHmD08wDubdIRXrrTZz7+jKQp5sUl0nYumcyJFWch 8fEQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1755334110; x=1755938910; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=EDWOGAR/V8qhS+DEW6fYz84GWwsYflwCKKabdx3FCTA=; b=vslhas+uqkKiDMroLq9SzGJRCjcnwaq4n1BXWeW8A8dJs646m8TFe24af7J0QLP4S7 RfmLEpHrMLM/0ovSfkRcqJ73QSdrlMkCdd6Llgpg4Axohqx3itA26qzI4GALwM/IfqCq wuaWRCe7jf96yMhMa4DkKvofaGjVkY71wg/SoC4XXde2miRQRs3pJDzoSpWcNGIp5AkR IwfyJT8EZ3jjcYUI8xO3HnPCl11ggu499HBWtzw9/RxK74gVsCeZf/+P3TccCvZt0WWF zlVfGTN4DNNFZxv21UgTMMfycBWyx/OTZRmsGraSyoziA9L8VenmpWRf9aQle9HXswBV aD8Q== X-Forwarded-Encrypted: i=1; AJvYcCWQdmsw9JD/2gyC2zurp+C3c9NLY9Ro3QnkYuqscU+uuMMw9w2fLyqHGLDCrYUx7tL502vOiswF4EWVbQ==@lists.linux.dev X-Gm-Message-State: AOJu0YxnLjIrtyhUYxUIoTanQKC5TUKpzSLsRxU0cvSI793SK2fSeIXD DC963h1YeaBdeP1yOeWoeWpeh13LdxzAKF3GBH03X61rF3YPK9qKWXB/ X-Gm-Gg: ASbGnctUiRsfCzsWsaXgBw/Vj45r8iWhZov6kFXaRUcUJ1g1mgxnawS2PlhHYHE24hK 1w7nNYJc0nhHieOHJkQGYXzFqpnsE0IiscT0kPMYpymog/RkSpySVwBe70xo9iYQmS+LjVsdX3b CWs89PspqOovZxJMpqsJ335lOeQuaziE4+iujomxiE3MaFHFGtMUWeSxNXxanCLYOPq0ntFQqXo cKTuZXYcU/JzTVkN6QS3HdVRTLeU+vLxjaUsi33aC7jFDX4pa/FSlVdqli0VyXErp5p7kN8bX1O zgdUAZUzKfMMmR92mbVLFDKd0UHlWYAVpIqynyyixtiX0NLyChmZxi8zpvLcNVmK5P5hX13Qz3m +Ue1q8FdaqTo= X-Google-Smtp-Source: AGHT+IGsQHajlRxkkJKhsBN5q8Xue9SzeHzYvWpvVEasktK/+7UqcjxhnXytQgxkbXL5divXvBb2fw== X-Received: by 2002:a17:902:d50b:b0:242:b138:8110 with SMTP id d9443c01a7336-244598679d7mr146468085ad.24.1755334110487; Sat, 16 Aug 2025 01:48:30 -0700 (PDT) Received: from junAIR ([212.192.12.80]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-2446d57f12esm31048215ad.157.2025.08.16.01.48.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 16 Aug 2025 01:48:30 -0700 (PDT) From: iuncuim To: Rob Herring , Krzysztof Kozlowski , Conor Dooley , Chen-Yu Tsai , Jernej Skrabec , Samuel Holland , Andre Przywara , Michael Turquette , Stephen Boyd , Vinod Koul , Kishon Vijay Abraham I , Philipp Zabel Cc: devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-phy@lists.infradead.org, linux-clk@vger.kernel.org, linux-sunxi@lists.linux.dev Subject: [PATCH 7/7] arm64: dts: allwinner: a523: activate USB3 for all boards Date: Sat, 16 Aug 2025 16:47:00 +0800 Message-ID: <20250816084700.569524-8-iuncuim@gmail.com> X-Mailer: git-send-email 2.50.1 In-Reply-To: <20250816084700.569524-1-iuncuim@gmail.com> References: <20250816084700.569524-1-iuncuim@gmail.com> Precedence: bulk X-Mailing-List: linux-sunxi@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Status: O From: Mikhail Kalashnikov Currently, these devices have a USB 3.0 port. Therefore, we can activate it. Signed-off-by: Mikhail Kalashnikov --- arch/arm64/boot/dts/allwinner/sun55i-a527-cubie-a5e.dts | 8 ++++++++ arch/arm64/boot/dts/allwinner/sun55i-h728-x96qpro+.dts | 8 ++++++++ arch/arm64/boot/dts/allwinner/sun55i-t527-avaota-a1.dts | 8 ++++++++ 3 files changed, 24 insertions(+) diff --git a/arch/arm64/boot/dts/allwinner/sun55i-a527-cubie-a5e.dts b/arch/arm64/boot/dts/allwinner/sun55i-a527-cubie-a5e.dts index 553ad774e..6842f8e8d 100644 --- a/arch/arm64/boot/dts/allwinner/sun55i-a527-cubie-a5e.dts +++ b/arch/arm64/boot/dts/allwinner/sun55i-a527-cubie-a5e.dts @@ -47,6 +47,14 @@ reg_usb_vbus: vbus { }; }; +&combophy { + status = "okay"; +}; + +&dwc3 { + status = "okay"; +}; + &ehci0 { status = "okay"; }; diff --git a/arch/arm64/boot/dts/allwinner/sun55i-h728-x96qpro+.dts b/arch/arm64/boot/dts/allwinner/sun55i-h728-x96qpro+.dts index a96927fbd..19388bc11 100644 --- a/arch/arm64/boot/dts/allwinner/sun55i-h728-x96qpro+.dts +++ b/arch/arm64/boot/dts/allwinner/sun55i-h728-x96qpro+.dts @@ -46,6 +46,14 @@ reg_vcc3v3: vcc3v3 { }; }; +&combophy { + status = "okay"; +}; + +&dwc3 { + status = "okay"; +}; + &ehci0 { status = "okay"; }; diff --git a/arch/arm64/boot/dts/allwinner/sun55i-t527-avaota-a1.dts b/arch/arm64/boot/dts/allwinner/sun55i-t527-avaota-a1.dts index b9eeb6753..6f05cd297 100644 --- a/arch/arm64/boot/dts/allwinner/sun55i-t527-avaota-a1.dts +++ b/arch/arm64/boot/dts/allwinner/sun55i-t527-avaota-a1.dts @@ -57,6 +57,14 @@ reg_usb_vbus: vbus { }; }; +&combophy { + status = "okay"; +}; + +&dwc3 { + status = "okay"; +}; + &ehci0 { status = "okay"; };