All of lore.kernel.org
 help / color / mirror / Atom feed
From: Chris Brandt <chris.brandt@renesas.com>
To: Rob Herring <robh+dt@kernel.org>,
	Mark Rutland <mark.rutland@arm.com>,
	Geert Uytterhoeven <geert+renesas@glider.be>,
	Michael Turquette <mturquette@baylibre.com>,
	Stephen Boyd <sboyd@kernel.org>,
	Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
Cc: linux-renesas-soc@vger.kernel.org,
	Simon Horman <horms+renesas@verge.net.au>,
	devicetree@vger.kernel.org, linux-clk@vger.kernel.org,
	Chris Brandt <chris.brandt@renesas.com>
Subject: [PATCH 2/3] phy: renesas: rcar-gen3-usb2: Add support for R7S9210
Date: Wed,  7 Nov 2018 12:35:57 -0500	[thread overview]
Message-ID: <20181107173558.54481-3-chris.brandt@renesas.com> (raw)
In-Reply-To: <20181107173558.54481-1-chris.brandt@renesas.com>

The RZ/A2 has the same USB2 host controller as R-Car Gen3 with only some
minor differences.

Signed-off-by: Chris Brandt <chris.brandt@renesas.com>
---
 drivers/phy/renesas/Kconfig              |  2 +-
 drivers/phy/renesas/phy-rcar-gen3-usb2.c | 12 ++++++++++++
 2 files changed, 13 insertions(+), 1 deletion(-)

diff --git a/drivers/phy/renesas/Kconfig b/drivers/phy/renesas/Kconfig
index e340a925bbb1..beebeba31e84 100644
--- a/drivers/phy/renesas/Kconfig
+++ b/drivers/phy/renesas/Kconfig
@@ -19,7 +19,7 @@ config PHY_RCAR_GEN3_PCIE
 config PHY_RCAR_GEN3_USB2
 	tristate "Renesas R-Car generation 3 USB 2.0 PHY driver"
 	depends on ARCH_RENESAS
-	depends on EXTCON
+	depends on EXTCON || ARCH_R7S9210
 	depends on USB_SUPPORT
 	select GENERIC_PHY
 	select USB_COMMON
diff --git a/drivers/phy/renesas/phy-rcar-gen3-usb2.c b/drivers/phy/renesas/phy-rcar-gen3-usb2.c
index d0f412c25981..96ac75ba40ea 100644
--- a/drivers/phy/renesas/phy-rcar-gen3-usb2.c
+++ b/drivers/phy/renesas/phy-rcar-gen3-usb2.c
@@ -34,6 +34,7 @@
 #define USB2_VBCTRL		0x60c
 #define USB2_LINECTRL1		0x610
 #define USB2_ADPCTRL		0x630
+#define USB2_PHYCLK_CTRL	0x644
 
 /* INT_ENABLE */
 #define USB2_INT_ENABLE_UCOM_INTEN	BIT(3)
@@ -88,6 +89,7 @@ struct rcar_gen3_chan {
 	bool extcon_host;
 	bool is_otg_channel;
 	bool uses_otg_pins;
+	bool uses_usb_x1;
 };
 
 /*
@@ -326,6 +328,9 @@ static int rcar_gen3_phy_usb2_init(struct phy *p)
 	struct rcar_gen3_chan *channel = phy_get_drvdata(p);
 	void __iomem *usb2_base = channel->base;
 
+	if (channel->uses_usb_x1)
+		writel(0x00000001, usb2_base + USB2_PHYCLK_CTRL);
+
 	/* Initialize USB2 part */
 	writel(USB2_INT_ENABLE_INIT, usb2_base + USB2_INT_ENABLE);
 	writel(USB2_SPD_RSM_TIMSET_INIT, usb2_base + USB2_SPD_RSM_TIMSET);
@@ -334,6 +339,9 @@ static int rcar_gen3_phy_usb2_init(struct phy *p)
 	/* Initialize otg part */
 	if (channel->is_otg_channel)
 		rcar_gen3_init_otg(channel);
+	else
+		/* No otg, so default to host mode */
+		writel(0x00000000, usb2_base + USB2_COMMCTRL);
 
 	return 0;
 }
@@ -406,6 +414,7 @@ static irqreturn_t rcar_gen3_phy_usb2_irq(int irq, void *_ch)
 }
 
 static const struct of_device_id rcar_gen3_phy_usb2_match_table[] = {
+	{ .compatible = "renesas,usb2-phy-r7s9210" },
 	{ .compatible = "renesas,usb2-phy-r8a7795" },
 	{ .compatible = "renesas,usb2-phy-r8a7796" },
 	{ .compatible = "renesas,usb2-phy-r8a77965" },
@@ -471,6 +480,9 @@ static int rcar_gen3_phy_usb2_probe(struct platform_device *pdev)
 		}
 	}
 
+	if (of_property_read_bool(dev->of_node, "renesas,uses_usb_x1"))
+		channel->uses_usb_x1 = true;
+
 	/*
 	 * devm_phy_create() will call pm_runtime_enable(&phy->dev);
 	 * And then, phy-core will manage runtime pm for this device.
-- 
2.16.1

  parent reply	other threads:[~2018-11-07 17:35 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-11-07 17:35 [PATCH 0/3] usb: renesas: rcar-gen3-usb2: Add support for RZ/A2 Chris Brandt
2018-11-07 17:35 ` [PATCH 1/3] clk: renesas: r7s9210: Add USB clocks Chris Brandt
2018-11-12 15:29   ` Geert Uytterhoeven
2018-11-12 15:29     ` Geert Uytterhoeven
2018-11-07 17:35 ` Chris Brandt [this message]
2018-11-14 10:50   ` [PATCH 2/3] phy: renesas: rcar-gen3-usb2: Add support for R7S9210 Yoshihiro Shimoda
2018-11-14 10:50     ` Yoshihiro Shimoda
2018-11-14 10:50     ` Yoshihiro Shimoda
2018-11-14 11:17     ` Chris Brandt
2018-11-14 11:17       ` Chris Brandt
2018-11-14 12:24       ` Yoshihiro Shimoda
2018-11-14 12:24         ` Yoshihiro Shimoda
2018-11-14 13:02         ` Chris Brandt
2018-11-14 13:02           ` Chris Brandt
2018-11-15  9:19           ` Yoshihiro Shimoda
2018-11-15  9:19             ` Yoshihiro Shimoda
2018-11-15 12:34             ` Chris Brandt
2018-11-15 12:34               ` Chris Brandt
2018-11-19  8:57               ` Yoshihiro Shimoda
2018-11-19  8:57                 ` Yoshihiro Shimoda
2018-11-19 18:45                 ` Chris Brandt
2018-11-19 18:45                   ` Chris Brandt
2018-11-07 17:35 ` [PATCH 3/3] dt-bindings: rcar-gen3-phy-usb2: Add r7s9210 support Chris Brandt
2018-11-14 10:53   ` Yoshihiro Shimoda
2018-11-14 10:53     ` Yoshihiro Shimoda
2018-11-14 10:53     ` Yoshihiro Shimoda
2018-11-14 11:02   ` Geert Uytterhoeven
2018-11-14 11:02     ` Geert Uytterhoeven
2018-11-14 11:29     ` Chris Brandt
2018-11-14 11:29       ` Chris Brandt
2018-11-14 12:05     ` Yoshihiro Shimoda
2018-11-14 12:05       ` Yoshihiro Shimoda

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=20181107173558.54481-3-chris.brandt@renesas.com \
    --to=chris.brandt@renesas.com \
    --cc=devicetree@vger.kernel.org \
    --cc=geert+renesas@glider.be \
    --cc=horms+renesas@verge.net.au \
    --cc=linux-clk@vger.kernel.org \
    --cc=linux-renesas-soc@vger.kernel.org \
    --cc=mark.rutland@arm.com \
    --cc=mturquette@baylibre.com \
    --cc=robh+dt@kernel.org \
    --cc=sboyd@kernel.org \
    --cc=yoshihiro.shimoda.uh@renesas.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.