linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Icenowy Zheng <icenowy@aosc.io>
To: Rob Herring <robh+dt@kernel.org>,
	Maxime Ripard <maxime.ripard@bootlin.com>,
	Chen-Yu Tsai <wens@csie.org>,
	Kishon Vijay Abraham I <kishon@ti.com>
Cc: devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org,
	linux-kernel@vger.kernel.org, linux-sunxi@googlegroups.com,
	Icenowy Zheng <icenowy@aosc.io>
Subject: [PATCH v4 03/10] phy: sun4i-usb: add support for H6 USB2 PHY
Date: Thu,  4 Oct 2018 20:28:48 +0800	[thread overview]
Message-ID: <20181004122855.22981-4-icenowy@aosc.io> (raw)
In-Reply-To: <20181004122855.22981-1-icenowy@aosc.io>

The USB 2.0 PHY on Allwinner H6 SoC is similar to older Allwinner SoCs,
with some USB0 quirk like A83T and PHY index 1/2 missing.

Add support for it.

Signed-off-by: Icenowy Zheng <icenowy@aosc.io>
Reviewed-by: Chen-Yu Tsai <wens@csie.org>
---
No changes in v4.

Changes in v3:
- Added Chen-Yu's Review tag.

 drivers/phy/allwinner/phy-sun4i-usb.c | 19 +++++++++++++++++--
 1 file changed, 17 insertions(+), 2 deletions(-)

diff --git a/drivers/phy/allwinner/phy-sun4i-usb.c b/drivers/phy/allwinner/phy-sun4i-usb.c
index 881078ff73f6..ae16854a770a 100644
--- a/drivers/phy/allwinner/phy-sun4i-usb.c
+++ b/drivers/phy/allwinner/phy-sun4i-usb.c
@@ -115,6 +115,7 @@ enum sun4i_usb_phy_type {
 	sun8i_r40_phy,
 	sun8i_v3s_phy,
 	sun50i_a64_phy,
+	sun50i_h6_phy,
 };
 
 struct sun4i_usb_phy_cfg {
@@ -295,7 +296,8 @@ static int sun4i_usb_phy_init(struct phy *_phy)
 		return ret;
 	}
 
-	if (data->cfg->type == sun8i_a83t_phy) {
+	if (data->cfg->type == sun8i_a83t_phy ||
+	    data->cfg->type == sun50i_h6_phy) {
 		if (phy->index == 0) {
 			val = readl(data->base + data->cfg->phyctl_offset);
 			val |= PHY_CTL_VBUSVLDEXT;
@@ -344,7 +346,8 @@ static int sun4i_usb_phy_exit(struct phy *_phy)
 	struct sun4i_usb_phy_data *data = to_sun4i_usb_phy_data(phy);
 
 	if (phy->index == 0) {
-		if (data->cfg->type == sun8i_a83t_phy) {
+		if (data->cfg->type == sun8i_a83t_phy ||
+		    data->cfg->type == sun50i_h6_phy) {
 			void __iomem *phyctl = data->base +
 				data->cfg->phyctl_offset;
 
@@ -959,6 +962,17 @@ static const struct sun4i_usb_phy_cfg sun50i_a64_cfg = {
 	.phy0_dual_route = true,
 };
 
+static const struct sun4i_usb_phy_cfg sun50i_h6_cfg = {
+	.num_phys = 4,
+	.type = sun50i_h6_phy,
+	.disc_thresh = 3,
+	.phyctl_offset = REG_PHYCTL_A33,
+	.dedicated_clocks = true,
+	.enable_pmu_unk1 = true,
+	.phy0_dual_route = true,
+	.missing_phys = BIT(1) | BIT(2),
+};
+
 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 },
@@ -972,6 +986,7 @@ static const struct of_device_id sun4i_usb_phy_of_match[] = {
 	{ .compatible = "allwinner,sun8i-v3s-usb-phy", .data = &sun8i_v3s_cfg },
 	{ .compatible = "allwinner,sun50i-a64-usb-phy",
 	  .data = &sun50i_a64_cfg},
+	{ .compatible = "allwinner,sun50i-h6-usb-phy", .data = &sun50i_h6_cfg },
 	{ },
 };
 MODULE_DEVICE_TABLE(of, sun4i_usb_phy_of_match);
-- 
2.18.0


  parent reply	other threads:[~2018-10-04 12:30 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-10-04 12:28 [PATCH v4 00/10] Allwinner H6 USB support Icenowy Zheng
2018-10-04 12:28 ` [PATCH v4 01/10] dt-bindings: phy: add binding for Allwinner H6 USB2 PHY Icenowy Zheng
2018-10-05 20:53   ` Rob Herring
2018-10-04 12:28 ` [PATCH v4 02/10] phy: sun4i-usb: add support for missing USB PHY index Icenowy Zheng
2018-10-04 12:28 ` Icenowy Zheng [this message]
2018-11-02  8:41   ` [PATCH v4 03/10] phy: sun4i-usb: add support for H6 USB2 PHY Icenowy Zheng
2018-11-02  8:43     ` Kishon Vijay Abraham I
2018-11-09 14:04       ` Icenowy Zheng
2018-10-04 12:28 ` [PATCH v4 04/10] arm64: allwinner: dts: h6: add USB2-related device nodes Icenowy Zheng
2018-11-14 10:21   ` [linux-sunxi] " Chen-Yu Tsai
2018-11-14 10:30     ` Icenowy Zheng
2018-11-15  2:16       ` Chen-Yu Tsai
2018-11-15  6:28         ` Chen-Yu Tsai
2018-10-04 12:28 ` [PATCH v4 05/10] arm64: allwinner: dts: h6: add USB Vbus regulator Icenowy Zheng
2018-10-04 12:28 ` [PATCH v4 06/10] arm64: allwinner: dts: h6: enable USB2 on Pine H64 Icenowy Zheng
2018-10-04 12:28 ` [PATCH v4 07/10] dt-bindings: phy: add binding for Allwinner USB3 PHY Icenowy Zheng
2018-10-05 20:58   ` Rob Herring
2018-10-14  2:41     ` Icenowy Zheng
2018-10-18 13:58       ` Rob Herring
2018-10-19  5:54         ` [linux-sunxi] " Icenowy Zheng
2018-11-14  5:15         ` Icenowy Zheng
2018-10-04 12:28 ` [PATCH v4 08/10] phy: allwinner: add phy driver for USB3 PHY on Allwinner H6 SoC Icenowy Zheng
2018-11-14  4:57   ` Icenowy Zheng
2018-11-20  5:11     ` Kishon Vijay Abraham I
2018-10-04 12:28 ` [PATCH v4 09/10] arm64: allwinner: dts: h6: add USB3 device nodes Icenowy Zheng
2018-10-04 12:28 ` [PATCH v4 10/10] arm64: allwinner: dts: h6: enable USB3 port on Pine H64 Icenowy Zheng
2018-10-05 10:44 ` [linux-sunxi] [PATCH v4 00/10] Allwinner H6 USB support Chen-Yu Tsai

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=20181004122855.22981-4-icenowy@aosc.io \
    --to=icenowy@aosc.io \
    --cc=devicetree@vger.kernel.org \
    --cc=kishon@ti.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-sunxi@googlegroups.com \
    --cc=maxime.ripard@bootlin.com \
    --cc=robh+dt@kernel.org \
    --cc=wens@csie.org \
    /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;
as well as URLs for NNTP newsgroup(s).