U-Boot Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Jagan Teki <jagan@amarulasolutions.com>
To: Kever Yang <kever.yang@rock-chips.com>,
	Simon Glass <sjg@chromium.org>,
	Philipp Tomsich <philipp.tomsich@vrull.eu>
Cc: Jonas Karlman <jonas@kwiboo.se>,
	u-boot@lists.denx.de, linux-amarula@amarulasolutions.com,
	Jagan Teki <jagan@amarulasolutions.com>
Subject: [PATCH v2 5/7] phy: rockchip-inno-usb2: Add USB2 PHY for RK3328
Date: Tue,  6 Jun 2023 22:39:16 +0530	[thread overview]
Message-ID: <20230606170918.45581-6-jagan@amarulasolutions.com> (raw)
In-Reply-To: <20230606170918.45581-1-jagan@amarulasolutions.com>

USB2.0 Host and OTG controllers in RK3328 are using USB2PHY.

Add support for it.

Signed-off-by: Jagan Teki <jagan@amarulasolutions.com>
---
Changes for v2:
- add clkout_ctl

 drivers/phy/rockchip/phy-rockchip-inno-usb2.c | 34 +++++++++++++++++++
 1 file changed, 34 insertions(+)

diff --git a/drivers/phy/rockchip/phy-rockchip-inno-usb2.c b/drivers/phy/rockchip/phy-rockchip-inno-usb2.c
index e43a5ba9b5..d8738f891d 100644
--- a/drivers/phy/rockchip/phy-rockchip-inno-usb2.c
+++ b/drivers/phy/rockchip/phy-rockchip-inno-usb2.c
@@ -345,6 +345,36 @@ bind_fail:
 	return ret;
 }
 
+static const struct rockchip_usb2phy_cfg rk3328_usb2phy_cfgs[] = {
+	{
+		.reg = 0x100,
+		.clkout_ctl	= { 0x108, 4, 4, 1, 0 },
+		.port_cfgs	= {
+			[USB2PHY_PORT_OTG] = {
+				.phy_sus	= { 0x0100, 15, 0, 0, 0x1d1 },
+				.bvalid_det_en	= { 0x0110, 3, 2, 0, 3 },
+				.bvalid_det_st	= { 0x0114, 3, 2, 0, 3 },
+				.bvalid_det_clr = { 0x0118, 3, 2, 0, 3 },
+				.ls_det_en	= { 0x0110, 0, 0, 0, 1 },
+				.ls_det_st	= { 0x0114, 0, 0, 0, 1 },
+				.ls_det_clr	= { 0x0118, 0, 0, 0, 1 },
+				.utmi_avalid	= { 0x0120, 10, 10, 0, 1 },
+				.utmi_bvalid	= { 0x0120, 9, 9, 0, 1 },
+				.utmi_ls	= { 0x0120, 5, 4, 0, 1 },
+			},
+			[USB2PHY_PORT_HOST] = {
+				.phy_sus	= { 0x104, 15, 0, 0, 0x1d1 },
+				.ls_det_en	= { 0x110, 1, 1, 0, 1 },
+				.ls_det_st	= { 0x114, 1, 1, 0, 1 },
+				.ls_det_clr	= { 0x118, 1, 1, 0, 1 },
+				.utmi_ls	= { 0x120, 17, 16, 0, 1 },
+				.utmi_hstdet	= { 0x120, 19, 19, 0, 1 }
+			}
+		},
+	},
+	{ /* sentinel */ }
+};
+
 static const struct rockchip_usb2phy_cfg rk3399_usb2phy_cfgs[] = {
 	{
 		.reg		= 0xe450,
@@ -498,6 +528,10 @@ static const struct rockchip_usb2phy_cfg rk3588_phy_cfgs[] = {
 };
 
 static const struct udevice_id rockchip_usb2phy_ids[] = {
+	{
+		.compatible = "rockchip,rk3328-usb2phy",
+		.data = (ulong)&rk3328_usb2phy_cfgs,
+	},
 	{
 		.compatible = "rockchip,rk3399-usb2phy",
 		.data = (ulong)&rk3399_usb2phy_cfgs,
-- 
2.25.1


  parent reply	other threads:[~2023-06-06 17:10 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-06-06 17:09 [PATCH v2 0/7] rockchip: Fix RK3328 USB support Jagan Teki
2023-06-06 17:09 ` [PATCH v2 1/7] arm64: dts: rockchip: Drop unused rk3328-xhci node Jagan Teki
2023-07-26 10:59   ` Kever Yang
2023-06-06 17:09 ` [PATCH v2 2/7] configs: Drop unused XHCI_DWC3 for RK3328 boards Jagan Teki
2023-07-26 11:00   ` Kever Yang
2023-06-06 17:09 ` [PATCH v2 3/7] usb: dwc3-generic: Restrict single ctrl node for RK3328 Jagan Teki
2023-06-11 14:53   ` Peter Robinson
2023-06-11 16:25     ` Jagan Teki
2023-07-26 11:00   ` Kever Yang
2023-06-06 17:09 ` [PATCH v2 4/7] configs: Enable DWC3 USB 3.0 on RK3328 boards Jagan Teki
2023-07-26 11:01   ` Kever Yang
2023-06-06 17:09 ` Jagan Teki [this message]
2023-06-07  9:12   ` [PATCH v2 5/7] phy: rockchip-inno-usb2: Add USB2 PHY for RK3328 Xavier Drudis Ferran
2023-07-26 11:01   ` Kever Yang
2023-06-06 17:09 ` [PATCH v2 6/7] clk: rockchip: rk3328: Handle usb480m phy clock Jagan Teki
2023-07-26 11:01   ` Kever Yang
2023-06-06 17:09 ` [PATCH v2 7/7] configs: rockchip: Enable USB2PHY for RK3328 boards Jagan Teki
2023-07-26 11:02   ` Kever Yang
2023-06-11 22:31 ` [PATCH v2 0/7] rockchip: Fix RK3328 USB support Peter Robinson
2023-07-13  9:31 ` Jagan Teki

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230606170918.45581-6-jagan@amarulasolutions.com \
    --to=jagan@amarulasolutions.com \
    --cc=jonas@kwiboo.se \
    --cc=kever.yang@rock-chips.com \
    --cc=linux-amarula@amarulasolutions.com \
    --cc=philipp.tomsich@vrull.eu \
    --cc=sjg@chromium.org \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox