public inbox for devicetree@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH/RFC v2 0/9] Add support for USB2.0 host/peripheral on R-Car H3
@ 2016-02-22  9:57 Yoshihiro Shimoda
  2016-02-22  9:58 ` [PATCH/RFC v2 1/9] phy: rcar-gen3-usb2: remove unnecesary struct rcar_gen3_data Yoshihiro Shimoda
                   ` (8 more replies)
  0 siblings, 9 replies; 11+ messages in thread
From: Yoshihiro Shimoda @ 2016-02-22  9:57 UTC (permalink / raw)
  To: horms, magnus.damm, robh+dt, pawel.moll, mark.rutland,
	ijc+devicetree, galak
  Cc: devicetree, linux-renesas-soc, Yoshihiro Shimoda

This patch set is based on the renesas-drivers.git /
renesas-drivers-2016-02-16-v4.5-rc4 tag
(commit id = a633abe6e6393c60417bd8cb0cf82f3297740198),
and the following patches:

[ renesas_usbhs driver ]
http://git.kernel.org/cgit/linux/kernel/git/balbi/usb.git/commit/?h=testing/next&id=cff0fef33d77bd7e98463029e5d0a4191d9bbb95

[ generic phy driver for R-Car H3 ]
http://thread.gmane.org/gmane.linux.kernel/2120685

This patch set contains patches that are related to generic phy driver.
As I wrote a comment in patch 7, to handle VBUS on/off for USB2.0 host
channel 0, I use a regulator driver instead of extcon/max3355 driver.
This is a reason that I marked this patch set is a RFC because I'm not
sure that this way is acceptable or not.

Also patch 5 should resolve checkpatch.pl warnings, and patch 6 should
have dmas property to use USB-DMAC later.

Changes from v1:
 - Remove PFC for usb2.0 host patch because it contains the renesas-drivers.
 - Change the patch order of the phy driver. (clean up code is in first.)
 - Change the property of "phy-supply" to "vbus-supply".

Yoshihiro Shimoda (9):
  phy: rcar-gen3-usb2: remove unnecesary struct rcar_gen3_data
  phy: rcar-gen3-usb2: Add vbus-supply to handle VBUS on/off
  phy: rcar-gen3-usb2: add extcon support
  arm64: dts: r8a7795: add usb2_phy device nodes
  arm64: dts: r8a7795: add USB2.0 Host (EHCI/OHCI) device nodes
  arm64: dts: r8a7795: add HS-USB device node
  arm64: dts: salvator-x: enable usb2_phy
  arm64: dts: salvator-x: enable USB 2.0 Host channels
  arm64: dts: salvator-x: enable HS-USB

 .../devicetree/bindings/phy/rcar-gen3-phy-usb2.txt |   2 +
 arch/arm64/boot/dts/renesas/r8a7795-salvator-x.dts |  73 +++++++++++++-
 arch/arm64/boot/dts/renesas/r8a7795.dtsi           | 107 +++++++++++++++++++++
 drivers/phy/Kconfig                                |   1 +
 drivers/phy/phy-rcar-gen3-usb2.c                   |  87 +++++++++++++----
 5 files changed, 250 insertions(+), 20 deletions(-)

-- 
1.9.1

^ permalink raw reply	[flat|nested] 11+ messages in thread

* [PATCH/RFC v2 1/9] phy: rcar-gen3-usb2: remove unnecesary struct rcar_gen3_data
  2016-02-22  9:57 [PATCH/RFC v2 0/9] Add support for USB2.0 host/peripheral on R-Car H3 Yoshihiro Shimoda
@ 2016-02-22  9:58 ` Yoshihiro Shimoda
  2016-02-22  9:58 ` [PATCH/RFC v2 2/9] phy: rcar-gen3-usb2: Add vbus-supply to handle VBUS on/off Yoshihiro Shimoda
                   ` (7 subsequent siblings)
  8 siblings, 0 replies; 11+ messages in thread
From: Yoshihiro Shimoda @ 2016-02-22  9:58 UTC (permalink / raw)
  To: horms, magnus.damm, robh+dt, pawel.moll, mark.rutland,
	ijc+devicetree, galak
  Cc: devicetree, linux-renesas-soc, Yoshihiro Shimoda

Since this driver uses the struct rcar_gen3_data in struct rcar_gen3_chan
only, we can remove the rcar_gen3_data.

Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
---
 drivers/phy/phy-rcar-gen3-usb2.c | 33 ++++++++++++++-------------------
 1 file changed, 14 insertions(+), 19 deletions(-)

diff --git a/drivers/phy/phy-rcar-gen3-usb2.c b/drivers/phy/phy-rcar-gen3-usb2.c
index bc4f7dd..2da2148 100644
--- a/drivers/phy/phy-rcar-gen3-usb2.c
+++ b/drivers/phy/phy-rcar-gen3-usb2.c
@@ -74,20 +74,15 @@
 #define USB2_ADPCTRL_IDPULLUP		BIT(5)	/* 1 = ID sampling is enabled */
 #define USB2_ADPCTRL_DRVVBUS		BIT(4)
 
-struct rcar_gen3_data {
-	void __iomem *base;
-	struct clk *clk;
-};
-
 struct rcar_gen3_chan {
-	struct rcar_gen3_data usb2;
+	void __iomem *base;
 	struct phy *phy;
 	bool has_otg;
 };
 
 static void rcar_gen3_set_host_mode(struct rcar_gen3_chan *ch, int host)
 {
-	void __iomem *usb2_base = ch->usb2.base;
+	void __iomem *usb2_base = ch->base;
 	u32 val = readl(usb2_base + USB2_COMMCTRL);
 
 	dev_vdbg(&ch->phy->dev, "%s: %08x, %d\n", __func__, val, host);
@@ -100,7 +95,7 @@ static void rcar_gen3_set_host_mode(struct rcar_gen3_chan *ch, int host)
 
 static void rcar_gen3_set_linectrl(struct rcar_gen3_chan *ch, int dp, int dm)
 {
-	void __iomem *usb2_base = ch->usb2.base;
+	void __iomem *usb2_base = ch->base;
 	u32 val = readl(usb2_base + USB2_LINECTRL1);
 
 	dev_vdbg(&ch->phy->dev, "%s: %08x, %d, %d\n", __func__, val, dp, dm);
@@ -114,7 +109,7 @@ static void rcar_gen3_set_linectrl(struct rcar_gen3_chan *ch, int dp, int dm)
 
 static void rcar_gen3_enable_vbus_ctrl(struct rcar_gen3_chan *ch, int vbus)
 {
-	void __iomem *usb2_base = ch->usb2.base;
+	void __iomem *usb2_base = ch->base;
 	u32 val = readl(usb2_base + USB2_ADPCTRL);
 
 	dev_vdbg(&ch->phy->dev, "%s: %08x, %d\n", __func__, val, vbus);
@@ -141,13 +136,13 @@ static void rcar_gen3_init_for_peri(struct rcar_gen3_chan *ch)
 
 static bool rcar_gen3_check_vbus(struct rcar_gen3_chan *ch)
 {
-	return !!(readl(ch->usb2.base + USB2_ADPCTRL) &
+	return !!(readl(ch->base + USB2_ADPCTRL) &
 		  USB2_ADPCTRL_OTGSESSVLD);
 }
 
 static bool rcar_gen3_check_id(struct rcar_gen3_chan *ch)
 {
-	return !!(readl(ch->usb2.base + USB2_ADPCTRL) & USB2_ADPCTRL_IDDIG);
+	return !!(readl(ch->base + USB2_ADPCTRL) & USB2_ADPCTRL_IDDIG);
 }
 
 static void rcar_gen3_device_recognition(struct rcar_gen3_chan *ch)
@@ -166,7 +161,7 @@ static void rcar_gen3_device_recognition(struct rcar_gen3_chan *ch)
 
 static void rcar_gen3_init_otg(struct rcar_gen3_chan *ch)
 {
-	void __iomem *usb2_base = ch->usb2.base;
+	void __iomem *usb2_base = ch->base;
 	u32 val;
 
 	val = readl(usb2_base + USB2_VBCTRL);
@@ -187,7 +182,7 @@ static void rcar_gen3_init_otg(struct rcar_gen3_chan *ch)
 static int rcar_gen3_phy_usb2_init(struct phy *p)
 {
 	struct rcar_gen3_chan *channel = phy_get_drvdata(p);
-	void __iomem *usb2_base = channel->usb2.base;
+	void __iomem *usb2_base = channel->base;
 
 	/* Initialize USB2 part */
 	writel(USB2_INT_ENABLE_INIT, usb2_base + USB2_INT_ENABLE);
@@ -205,7 +200,7 @@ static int rcar_gen3_phy_usb2_exit(struct phy *p)
 {
 	struct rcar_gen3_chan *channel = phy_get_drvdata(p);
 
-	writel(0, channel->usb2.base + USB2_INT_ENABLE);
+	writel(0, channel->base + USB2_INT_ENABLE);
 
 	return 0;
 }
@@ -213,7 +208,7 @@ static int rcar_gen3_phy_usb2_exit(struct phy *p)
 static int rcar_gen3_phy_usb2_power_on(struct phy *p)
 {
 	struct rcar_gen3_chan *channel = phy_get_drvdata(p);
-	void __iomem *usb2_base = channel->usb2.base;
+	void __iomem *usb2_base = channel->base;
 	u32 val;
 
 	val = readl(usb2_base + USB2_USBCTR);
@@ -235,7 +230,7 @@ static struct phy_ops rcar_gen3_phy_usb2_ops = {
 static irqreturn_t rcar_gen3_phy_usb2_irq(int irq, void *_ch)
 {
 	struct rcar_gen3_chan *ch = _ch;
-	void __iomem *usb2_base = ch->usb2.base;
+	void __iomem *usb2_base = ch->base;
 	u32 status = readl(usb2_base + USB2_OBINTSTA);
 	irqreturn_t ret = IRQ_NONE;
 
@@ -273,9 +268,9 @@ static int rcar_gen3_phy_usb2_probe(struct platform_device *pdev)
 		return -ENOMEM;
 
 	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-	channel->usb2.base = devm_ioremap_resource(dev, res);
-	if (IS_ERR(channel->usb2.base))
-		return PTR_ERR(channel->usb2.base);
+	channel->base = devm_ioremap_resource(dev, res);
+	if (IS_ERR(channel->base))
+		return PTR_ERR(channel->base);
 
 	/* call request_irq for OTG */
 	irq = platform_get_irq(pdev, 0);
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [PATCH/RFC v2 2/9] phy: rcar-gen3-usb2: Add vbus-supply to handle VBUS on/off
  2016-02-22  9:57 [PATCH/RFC v2 0/9] Add support for USB2.0 host/peripheral on R-Car H3 Yoshihiro Shimoda
  2016-02-22  9:58 ` [PATCH/RFC v2 1/9] phy: rcar-gen3-usb2: remove unnecesary struct rcar_gen3_data Yoshihiro Shimoda
@ 2016-02-22  9:58 ` Yoshihiro Shimoda
  2016-02-23 21:39   ` Rob Herring
  2016-02-22  9:58 ` [PATCH/RFC v2 3/9] phy: rcar-gen3-usb2: add extcon support Yoshihiro Shimoda
                   ` (6 subsequent siblings)
  8 siblings, 1 reply; 11+ messages in thread
From: Yoshihiro Shimoda @ 2016-02-22  9:58 UTC (permalink / raw)
  To: horms, magnus.damm, robh+dt, pawel.moll, mark.rutland,
	ijc+devicetree, galak
  Cc: devicetree, linux-renesas-soc, Yoshihiro Shimoda

To handle the VBUS on/off by a regulator driver, this patch adds
regulator APIs calling in the driver and description about vbus-supply
in the rcar-gen3-phy-usb2.txt.

Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
---
 .../devicetree/bindings/phy/rcar-gen3-phy-usb2.txt |  2 ++
 drivers/phy/phy-rcar-gen3-usb2.c                   | 28 ++++++++++++++++++++++
 2 files changed, 30 insertions(+)

diff --git a/Documentation/devicetree/bindings/phy/rcar-gen3-phy-usb2.txt b/Documentation/devicetree/bindings/phy/rcar-gen3-phy-usb2.txt
index eaf7e9b..2ffb856 100644
--- a/Documentation/devicetree/bindings/phy/rcar-gen3-phy-usb2.txt
+++ b/Documentation/devicetree/bindings/phy/rcar-gen3-phy-usb2.txt
@@ -15,6 +15,8 @@ To use a USB channel where USB 2.0 Host and HSUSB (USB 2.0 Peripheral) are
 combined, the device tree node should set interrupt properties to use the
 channel as USB OTG:
 - interrupts: interrupt specifier for the PHY.
+- vbus-supply: Phandle to a regulator that provides power to the VBUS. This
+	       regulator will be managed during the PHY power on/off sequence.
 
 Example (R-Car H3):
 
diff --git a/drivers/phy/phy-rcar-gen3-usb2.c b/drivers/phy/phy-rcar-gen3-usb2.c
index 2da2148..c2bfde8 100644
--- a/drivers/phy/phy-rcar-gen3-usb2.c
+++ b/drivers/phy/phy-rcar-gen3-usb2.c
@@ -19,6 +19,7 @@
 #include <linux/of_address.h>
 #include <linux/phy/phy.h>
 #include <linux/platform_device.h>
+#include <linux/regulator/consumer.h>
 
 /******* USB2.0 Host registers (original offset is +0x200) *******/
 #define USB2_INT_ENABLE		0x000
@@ -77,6 +78,7 @@
 struct rcar_gen3_chan {
 	void __iomem *base;
 	struct phy *phy;
+	struct regulator *vbus;
 	bool has_otg;
 };
 
@@ -210,6 +212,13 @@ static int rcar_gen3_phy_usb2_power_on(struct phy *p)
 	struct rcar_gen3_chan *channel = phy_get_drvdata(p);
 	void __iomem *usb2_base = channel->base;
 	u32 val;
+	int ret;
+
+	if (channel->vbus) {
+		ret = regulator_enable(channel->vbus);
+		if (ret)
+			return ret;
+	}
 
 	val = readl(usb2_base + USB2_USBCTR);
 	val |= USB2_USBCTR_PLL_RST;
@@ -220,10 +229,22 @@ static int rcar_gen3_phy_usb2_power_on(struct phy *p)
 	return 0;
 }
 
+static int rcar_gen3_phy_usb2_power_off(struct phy *p)
+{
+	struct rcar_gen3_chan *channel = phy_get_drvdata(p);
+	int ret = 0;
+
+	if (channel->vbus)
+		ret = regulator_disable(channel->vbus);
+
+	return ret;
+}
+
 static struct phy_ops rcar_gen3_phy_usb2_ops = {
 	.init		= rcar_gen3_phy_usb2_init,
 	.exit		= rcar_gen3_phy_usb2_exit,
 	.power_on	= rcar_gen3_phy_usb2_power_on,
+	.power_off	= rcar_gen3_phy_usb2_power_off,
 	.owner		= THIS_MODULE,
 };
 
@@ -289,6 +310,13 @@ static int rcar_gen3_phy_usb2_probe(struct platform_device *pdev)
 		return PTR_ERR(channel->phy);
 	}
 
+	channel->vbus = devm_regulator_get_optional(dev, "vbus");
+	if (IS_ERR(channel->vbus)) {
+		if (PTR_ERR(channel->vbus) == -EPROBE_DEFER)
+			return PTR_ERR(channel->vbus);
+		channel->vbus = NULL;
+	}
+
 	phy_set_drvdata(channel->phy, channel);
 
 	provider = devm_of_phy_provider_register(dev, of_phy_simple_xlate);
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [PATCH/RFC v2 3/9] phy: rcar-gen3-usb2: add extcon support
  2016-02-22  9:57 [PATCH/RFC v2 0/9] Add support for USB2.0 host/peripheral on R-Car H3 Yoshihiro Shimoda
  2016-02-22  9:58 ` [PATCH/RFC v2 1/9] phy: rcar-gen3-usb2: remove unnecesary struct rcar_gen3_data Yoshihiro Shimoda
  2016-02-22  9:58 ` [PATCH/RFC v2 2/9] phy: rcar-gen3-usb2: Add vbus-supply to handle VBUS on/off Yoshihiro Shimoda
@ 2016-02-22  9:58 ` Yoshihiro Shimoda
  2016-02-22  9:58 ` [PATCH/RFC v2 4/9] arm64: dts: r8a7795: add usb2_phy device nodes Yoshihiro Shimoda
                   ` (5 subsequent siblings)
  8 siblings, 0 replies; 11+ messages in thread
From: Yoshihiro Shimoda @ 2016-02-22  9:58 UTC (permalink / raw)
  To: horms, magnus.damm, robh+dt, pawel.moll, mark.rutland,
	ijc+devicetree, galak
  Cc: devicetree, linux-renesas-soc, Yoshihiro Shimoda

This patch adds extcon support for otg related channel.

Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
---
 drivers/phy/Kconfig              |  1 +
 drivers/phy/phy-rcar-gen3-usb2.c | 26 ++++++++++++++++++++++++++
 2 files changed, 27 insertions(+)

diff --git a/drivers/phy/Kconfig b/drivers/phy/Kconfig
index 0124d17..32c7088 100644
--- a/drivers/phy/Kconfig
+++ b/drivers/phy/Kconfig
@@ -121,6 +121,7 @@ config PHY_RCAR_GEN2
 config PHY_RCAR_GEN3_USB2
 	tristate "Renesas R-Car generation 3 USB 2.0 PHY driver"
 	depends on OF && ARCH_SHMOBILE
+	depends on EXTCON
 	select GENERIC_PHY
 	help
 	  Support for USB 2.0 PHY found on Renesas R-Car generation 3 SoCs.
diff --git a/drivers/phy/phy-rcar-gen3-usb2.c b/drivers/phy/phy-rcar-gen3-usb2.c
index c2bfde8..d4af4dc 100644
--- a/drivers/phy/phy-rcar-gen3-usb2.c
+++ b/drivers/phy/phy-rcar-gen3-usb2.c
@@ -12,6 +12,7 @@
  * published by the Free Software Foundation.
  */
 
+#include <linux/extcon.h>
 #include <linux/interrupt.h>
 #include <linux/io.h>
 #include <linux/module.h>
@@ -77,6 +78,7 @@
 
 struct rcar_gen3_chan {
 	void __iomem *base;
+	struct extcon_dev *extcon;
 	struct phy *phy;
 	struct regulator *vbus;
 	bool has_otg;
@@ -127,6 +129,9 @@ static void rcar_gen3_init_for_host(struct rcar_gen3_chan *ch)
 	rcar_gen3_set_linectrl(ch, 1, 1);
 	rcar_gen3_set_host_mode(ch, 1);
 	rcar_gen3_enable_vbus_ctrl(ch, 1);
+
+	extcon_set_cable_state_(ch->extcon, EXTCON_USB_HOST, true);
+	extcon_set_cable_state_(ch->extcon, EXTCON_USB, false);
 }
 
 static void rcar_gen3_init_for_peri(struct rcar_gen3_chan *ch)
@@ -134,6 +139,9 @@ static void rcar_gen3_init_for_peri(struct rcar_gen3_chan *ch)
 	rcar_gen3_set_linectrl(ch, 0, 1);
 	rcar_gen3_set_host_mode(ch, 0);
 	rcar_gen3_enable_vbus_ctrl(ch, 0);
+
+	extcon_set_cable_state_(ch->extcon, EXTCON_USB_HOST, false);
+	extcon_set_cable_state_(ch->extcon, EXTCON_USB, true);
 }
 
 static bool rcar_gen3_check_vbus(struct rcar_gen3_chan *ch)
@@ -271,6 +279,12 @@ static const struct of_device_id rcar_gen3_phy_usb2_match_table[] = {
 };
 MODULE_DEVICE_TABLE(of, rcar_gen3_phy_usb2_match_table);
 
+static const unsigned int rcar_gen3_phy_cable[] = {
+	EXTCON_USB,
+	EXTCON_USB_HOST,
+	EXTCON_NONE,
+};
+
 static int rcar_gen3_phy_usb2_probe(struct platform_device *pdev)
 {
 	struct device *dev = &pdev->dev;
@@ -296,11 +310,23 @@ static int rcar_gen3_phy_usb2_probe(struct platform_device *pdev)
 	/* call request_irq for OTG */
 	irq = platform_get_irq(pdev, 0);
 	if (irq >= 0) {
+		int ret;
+
 		irq = devm_request_irq(dev, irq, rcar_gen3_phy_usb2_irq,
 				       IRQF_SHARED, dev_name(dev), channel);
 		if (irq < 0)
 			dev_err(dev, "No irq handler (%d)\n", irq);
 		channel->has_otg = true;
+		channel->extcon = devm_extcon_dev_allocate(dev,
+							rcar_gen3_phy_cable);
+		if (IS_ERR(channel->extcon))
+			return PTR_ERR(channel->extcon);
+
+		ret = devm_extcon_dev_register(dev, channel->extcon);
+		if (ret < 0) {
+			dev_err(dev, "Failed to register extcon\n");
+			return ret;
+		}
 	}
 
 	/* devm_phy_create() will call pm_runtime_enable(dev); */
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [PATCH/RFC v2 4/9] arm64: dts: r8a7795: add usb2_phy device nodes
  2016-02-22  9:57 [PATCH/RFC v2 0/9] Add support for USB2.0 host/peripheral on R-Car H3 Yoshihiro Shimoda
                   ` (2 preceding siblings ...)
  2016-02-22  9:58 ` [PATCH/RFC v2 3/9] phy: rcar-gen3-usb2: add extcon support Yoshihiro Shimoda
@ 2016-02-22  9:58 ` Yoshihiro Shimoda
  2016-02-22  9:58 ` [PATCH/RFC v2 5/9] arm64: dts: r8a7795: add USB2.0 Host (EHCI/OHCI) " Yoshihiro Shimoda
                   ` (4 subsequent siblings)
  8 siblings, 0 replies; 11+ messages in thread
From: Yoshihiro Shimoda @ 2016-02-22  9:58 UTC (permalink / raw)
  To: horms, magnus.damm, robh+dt, pawel.moll, mark.rutland,
	ijc+devicetree, galak
  Cc: devicetree, linux-renesas-soc, Yoshihiro Shimoda

Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
---
 arch/arm64/boot/dts/renesas/r8a7795.dtsi | 28 ++++++++++++++++++++++++++++
 1 file changed, 28 insertions(+)

diff --git a/arch/arm64/boot/dts/renesas/r8a7795.dtsi b/arch/arm64/boot/dts/renesas/r8a7795.dtsi
index e77f5fd..2203b8e 100644
--- a/arch/arm64/boot/dts/renesas/r8a7795.dtsi
+++ b/arch/arm64/boot/dts/renesas/r8a7795.dtsi
@@ -1406,5 +1406,33 @@
 				};
 			};
 		};
+
+		usb2_phy0: usb-phy@ee080200 {
+			compatible = "renesas,usb2-phy-r8a7795";
+			reg = <0 0xee080200 0 0x700>;
+			interrupts = <GIC_SPI 108 IRQ_TYPE_LEVEL_HIGH>;
+			clocks = <&cpg CPG_MOD 703>;
+			power-domains = <&cpg>;
+			#phy-cells = <0>;
+			status = "disabled";
+		};
+
+		usb2_phy1: usb-phy@ee0a0200 {
+			compatible = "renesas,usb2-phy-r8a7795";
+			reg = <0 0xee0a0200 0 0x700>;
+			clocks = <&cpg CPG_MOD 702>;
+			power-domains = <&cpg>;
+			#phy-cells = <0>;
+			status = "disabled";
+		};
+
+		usb2_phy2: usb-phy@ee0c0200 {
+			compatible = "renesas,usb2-phy-r8a7795";
+			reg = <0 0xee0c0200 0 0x700>;
+			clocks = <&cpg CPG_MOD 701>;
+			power-domains = <&cpg>;
+			#phy-cells = <0>;
+			status = "disabled";
+		};
 	};
 };
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [PATCH/RFC v2 5/9] arm64: dts: r8a7795: add USB2.0 Host (EHCI/OHCI) device nodes
  2016-02-22  9:57 [PATCH/RFC v2 0/9] Add support for USB2.0 host/peripheral on R-Car H3 Yoshihiro Shimoda
                   ` (3 preceding siblings ...)
  2016-02-22  9:58 ` [PATCH/RFC v2 4/9] arm64: dts: r8a7795: add usb2_phy device nodes Yoshihiro Shimoda
@ 2016-02-22  9:58 ` Yoshihiro Shimoda
  2016-02-22  9:58 ` [PATCH/RFC v2 6/9] arm64: dts: r8a7795: add HS-USB device node Yoshihiro Shimoda
                   ` (3 subsequent siblings)
  8 siblings, 0 replies; 11+ messages in thread
From: Yoshihiro Shimoda @ 2016-02-22  9:58 UTC (permalink / raw)
  To: horms, magnus.damm, robh+dt, pawel.moll, mark.rutland,
	ijc+devicetree, galak
  Cc: devicetree, linux-renesas-soc, Yoshihiro Shimoda

Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
---
 arch/arm64/boot/dts/renesas/r8a7795.dtsi | 66 ++++++++++++++++++++++++++++++++
 1 file changed, 66 insertions(+)

diff --git a/arch/arm64/boot/dts/renesas/r8a7795.dtsi b/arch/arm64/boot/dts/renesas/r8a7795.dtsi
index 2203b8e..75142f3 100644
--- a/arch/arm64/boot/dts/renesas/r8a7795.dtsi
+++ b/arch/arm64/boot/dts/renesas/r8a7795.dtsi
@@ -1434,5 +1434,71 @@
 			#phy-cells = <0>;
 			status = "disabled";
 		};
+
+		ehci0: usb@ee080100 {
+			compatible = "renesas,ehci-r8a7795", "generic-ehci";
+			reg = <0 0xee080100 0 0x100>;
+			interrupts = <GIC_SPI 108 IRQ_TYPE_LEVEL_HIGH>;
+			clocks = <&cpg CPG_MOD 703>;
+			phys = <&usb2_phy0>;
+			phy-names = "usb";
+			power-domains = <&cpg>;
+			status = "disabled";
+		};
+
+		ehci1: usb@ee0a0100 {
+			compatible = "renesas,ehci-r8a7795", "generic-ehci";
+			reg = <0 0xee0a0100 0 0x100>;
+			interrupts = <GIC_SPI 112 IRQ_TYPE_LEVEL_HIGH>;
+			clocks = <&cpg CPG_MOD 702>;
+			phys = <&usb2_phy1>;
+			phy-names = "usb";
+			power-domains = <&cpg>;
+			status = "disabled";
+		};
+
+		ehci2: usb@ee0c0100 {
+			compatible = "renesas,ehci-r8a7795", "generic-ehci";
+			reg = <0 0xee0c0100 0 0x100>;
+			interrupts = <GIC_SPI 113 IRQ_TYPE_LEVEL_HIGH>;
+			clocks = <&cpg CPG_MOD 701>;
+			phys = <&usb2_phy2>;
+			phy-names = "usb";
+			power-domains = <&cpg>;
+			status = "disabled";
+		};
+
+		ohci0: usb@ee080000 {
+			compatible = "renesas,ohci-r8a7795", "generic-ohci";
+			reg = <0 0xee080000 0 0x100>;
+			interrupts = <GIC_SPI 108 IRQ_TYPE_LEVEL_HIGH>;
+			clocks = <&cpg CPG_MOD 703>;
+			phys = <&usb2_phy0>;
+			phy-names = "usb";
+			power-domains = <&cpg>;
+			status = "disabled";
+		};
+
+		ohci1: usb@ee0a0000 {
+			compatible = "renesas,ohci-r8a7795", "generic-ohci";
+			reg = <0 0xee0a0000 0 0x100>;
+			interrupts = <GIC_SPI 112 IRQ_TYPE_LEVEL_HIGH>;
+			clocks = <&cpg CPG_MOD 702>;
+			phys = <&usb2_phy1>;
+			phy-names = "usb";
+			power-domains = <&cpg>;
+			status = "disabled";
+		};
+
+		ohci2: usb@ee0c0000 {
+			compatible = "renesas,ohci-r8a7795", "generic-ohci";
+			reg = <0 0xee0c0000 0 0x100>;
+			interrupts = <GIC_SPI 113 IRQ_TYPE_LEVEL_HIGH>;
+			clocks = <&cpg CPG_MOD 701>;
+			phys = <&usb2_phy2>;
+			phy-names = "usb";
+			power-domains = <&cpg>;
+			status = "disabled";
+		};
 	};
 };
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [PATCH/RFC v2 6/9] arm64: dts: r8a7795: add HS-USB device node
  2016-02-22  9:57 [PATCH/RFC v2 0/9] Add support for USB2.0 host/peripheral on R-Car H3 Yoshihiro Shimoda
                   ` (4 preceding siblings ...)
  2016-02-22  9:58 ` [PATCH/RFC v2 5/9] arm64: dts: r8a7795: add USB2.0 Host (EHCI/OHCI) " Yoshihiro Shimoda
@ 2016-02-22  9:58 ` Yoshihiro Shimoda
  2016-02-22  9:58 ` [PATCH/RFC v2 7/9] arm64: dts: salvator-x: enable usb2_phy Yoshihiro Shimoda
                   ` (2 subsequent siblings)
  8 siblings, 0 replies; 11+ messages in thread
From: Yoshihiro Shimoda @ 2016-02-22  9:58 UTC (permalink / raw)
  To: horms, magnus.damm, robh+dt, pawel.moll, mark.rutland,
	ijc+devicetree, galak
  Cc: devicetree, linux-renesas-soc, Yoshihiro Shimoda

Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
---
 arch/arm64/boot/dts/renesas/r8a7795.dtsi | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/arch/arm64/boot/dts/renesas/r8a7795.dtsi b/arch/arm64/boot/dts/renesas/r8a7795.dtsi
index 75142f3..76ad097 100644
--- a/arch/arm64/boot/dts/renesas/r8a7795.dtsi
+++ b/arch/arm64/boot/dts/renesas/r8a7795.dtsi
@@ -1500,5 +1500,18 @@
 			power-domains = <&cpg>;
 			status = "disabled";
 		};
+
+		hsusb: usb@e6590000 {
+			compatible = "renesas,usbhs-r8a7795",
+				     "renesas,rcar-gen3-usbhs";
+			reg = <0 0xe6590000 0 0x100>;
+			interrupts = <0 107 IRQ_TYPE_LEVEL_HIGH>;
+			clocks = <&cpg CPG_MOD 704>;
+			renesas,buswait = <11>;
+			phys = <&usb2_phy0>;
+			phy-names = "usb";
+			power-domains = <&cpg>;
+			status = "disabled";
+		};
 	};
 };
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [PATCH/RFC v2 7/9] arm64: dts: salvator-x: enable usb2_phy
  2016-02-22  9:57 [PATCH/RFC v2 0/9] Add support for USB2.0 host/peripheral on R-Car H3 Yoshihiro Shimoda
                   ` (5 preceding siblings ...)
  2016-02-22  9:58 ` [PATCH/RFC v2 6/9] arm64: dts: r8a7795: add HS-USB device node Yoshihiro Shimoda
@ 2016-02-22  9:58 ` Yoshihiro Shimoda
  2016-02-22  9:58 ` [PATCH/RFC v2 8/9] arm64: dts: salvator-x: enable USB 2.0 Host channels Yoshihiro Shimoda
  2016-02-22  9:58 ` [PATCH/RFC v2 9/9] arm64: dts: salvator-x: enable HS-USB Yoshihiro Shimoda
  8 siblings, 0 replies; 11+ messages in thread
From: Yoshihiro Shimoda @ 2016-02-22  9:58 UTC (permalink / raw)
  To: horms, magnus.damm, robh+dt, pawel.moll, mark.rutland,
	ijc+devicetree, galak
  Cc: devicetree, linux-renesas-soc, Yoshihiro Shimoda

This patch also adds a regulator node for USB2.0 to handle VBUS on/off
by the generic PHY framework.
This board has a MAX3355 chip. However, we cannot use the extcon/max3355
driver because the ID pin doesn't connect to a gpio pin (in other words,
it connects to the SoC specific pin).

Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
---
 arch/arm64/boot/dts/renesas/r8a7795-salvator-x.dts | 45 +++++++++++++++++++++-
 1 file changed, 44 insertions(+), 1 deletion(-)

diff --git a/arch/arm64/boot/dts/renesas/r8a7795-salvator-x.dts b/arch/arm64/boot/dts/renesas/r8a7795-salvator-x.dts
index fb1f382..6adb65f 100644
--- a/arch/arm64/boot/dts/renesas/r8a7795-salvator-x.dts
+++ b/arch/arm64/boot/dts/renesas/r8a7795-salvator-x.dts
@@ -33,6 +33,7 @@
 
 /dts-v1/;
 #include "r8a7795.dtsi"
+#include <dt-bindings/gpio/gpio.h>
 
 / {
 	model = "Renesas Salvator-X board based on r8a7795";
@@ -118,6 +119,15 @@
 			};
 		};
 	};
+
+	vcc_usb2_phy0: regulator@0 {
+		compatible = "regulator-fixed";
+		regulator-name = "USB20_VBUS0";
+		regulator-min-microvolt = <5000000>;
+		regulator-max-microvolt = <5000000>;
+		gpio = <&gpio6 16 GPIO_ACTIVE_HIGH>;
+		enable-active-high;
+	};
 };
 
 &du {
@@ -173,8 +183,22 @@
 				 "audio_clkout_a", "audio_clkout3_a";
 		renesas,function = "audio_clk";
 	};
-};
 
+	usb0_pins: usb0 {
+		renesas,groups = "usb0";
+		renesas,function = "usb";
+	};
+
+	usb1_pins: usb1 {
+		renesas,groups = "usb1";
+		renesas,function = "usb";
+	};
+
+	usb2_pins: usb2 {
+		renesas,groups = "usb2";
+		renesas,function = "usb";
+	};
+};
 &scif1 {
 	pinctrl-0 = <&scif1_pins>;
 	pinctrl-names = "default";
@@ -321,3 +345,22 @@
 &xhci0 {
 	status = "okay";
 };
+
+&usb2_phy0 {
+	status = "okay";
+	vbus-supply = <&vcc_usb2_phy0>;
+	pinctrl-0 = <&usb0_pins>;
+	pinctrl-names = "default";
+};
+
+&usb2_phy1 {
+	status = "okay";
+	pinctrl-0 = <&usb1_pins>;
+	pinctrl-names = "default";
+};
+
+&usb2_phy2 {
+	status = "okay";
+	pinctrl-0 = <&usb2_pins>;
+	pinctrl-names = "default";
+};
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [PATCH/RFC v2 8/9] arm64: dts: salvator-x: enable USB 2.0 Host channels
  2016-02-22  9:57 [PATCH/RFC v2 0/9] Add support for USB2.0 host/peripheral on R-Car H3 Yoshihiro Shimoda
                   ` (6 preceding siblings ...)
  2016-02-22  9:58 ` [PATCH/RFC v2 7/9] arm64: dts: salvator-x: enable usb2_phy Yoshihiro Shimoda
@ 2016-02-22  9:58 ` Yoshihiro Shimoda
  2016-02-22  9:58 ` [PATCH/RFC v2 9/9] arm64: dts: salvator-x: enable HS-USB Yoshihiro Shimoda
  8 siblings, 0 replies; 11+ messages in thread
From: Yoshihiro Shimoda @ 2016-02-22  9:58 UTC (permalink / raw)
  To: horms, magnus.damm, robh+dt, pawel.moll, mark.rutland,
	ijc+devicetree, galak
  Cc: devicetree, linux-renesas-soc, Yoshihiro Shimoda

We should set SW15 to pin 2-3 side on the board before we use CN9
as USB host or peripheral.

Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
---
 arch/arm64/boot/dts/renesas/r8a7795-salvator-x.dts | 24 ++++++++++++++++++++++
 1 file changed, 24 insertions(+)

diff --git a/arch/arm64/boot/dts/renesas/r8a7795-salvator-x.dts b/arch/arm64/boot/dts/renesas/r8a7795-salvator-x.dts
index 6adb65f..f9d904b 100644
--- a/arch/arm64/boot/dts/renesas/r8a7795-salvator-x.dts
+++ b/arch/arm64/boot/dts/renesas/r8a7795-salvator-x.dts
@@ -364,3 +364,27 @@
 	pinctrl-0 = <&usb2_pins>;
 	pinctrl-names = "default";
 };
+
+&ehci0 {
+	status = "okay";
+};
+
+&ehci1 {
+	status = "okay";
+};
+
+&ehci2 {
+	status = "okay";
+};
+
+&ohci0 {
+	status = "okay";
+};
+
+&ohci1 {
+	status = "okay";
+};
+
+&ohci2 {
+	status = "okay";
+};
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [PATCH/RFC v2 9/9] arm64: dts: salvator-x: enable HS-USB
  2016-02-22  9:57 [PATCH/RFC v2 0/9] Add support for USB2.0 host/peripheral on R-Car H3 Yoshihiro Shimoda
                   ` (7 preceding siblings ...)
  2016-02-22  9:58 ` [PATCH/RFC v2 8/9] arm64: dts: salvator-x: enable USB 2.0 Host channels Yoshihiro Shimoda
@ 2016-02-22  9:58 ` Yoshihiro Shimoda
  8 siblings, 0 replies; 11+ messages in thread
From: Yoshihiro Shimoda @ 2016-02-22  9:58 UTC (permalink / raw)
  To: horms, magnus.damm, robh+dt, pawel.moll, mark.rutland,
	ijc+devicetree, galak
  Cc: devicetree, linux-renesas-soc, Yoshihiro Shimoda

Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
---
 arch/arm64/boot/dts/renesas/r8a7795-salvator-x.dts | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/arch/arm64/boot/dts/renesas/r8a7795-salvator-x.dts b/arch/arm64/boot/dts/renesas/r8a7795-salvator-x.dts
index f9d904b..66e7e04 100644
--- a/arch/arm64/boot/dts/renesas/r8a7795-salvator-x.dts
+++ b/arch/arm64/boot/dts/renesas/r8a7795-salvator-x.dts
@@ -388,3 +388,7 @@
 &ohci2 {
 	status = "okay";
 };
+
+&hsusb {
+	status = "okay";
+};
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 11+ messages in thread

* Re: [PATCH/RFC v2 2/9] phy: rcar-gen3-usb2: Add vbus-supply to handle VBUS on/off
  2016-02-22  9:58 ` [PATCH/RFC v2 2/9] phy: rcar-gen3-usb2: Add vbus-supply to handle VBUS on/off Yoshihiro Shimoda
@ 2016-02-23 21:39   ` Rob Herring
  0 siblings, 0 replies; 11+ messages in thread
From: Rob Herring @ 2016-02-23 21:39 UTC (permalink / raw)
  To: Yoshihiro Shimoda
  Cc: horms, magnus.damm, pawel.moll, mark.rutland, ijc+devicetree,
	galak, devicetree, linux-renesas-soc

On Mon, Feb 22, 2016 at 06:58:01PM +0900, Yoshihiro Shimoda wrote:
> To handle the VBUS on/off by a regulator driver, this patch adds
> regulator APIs calling in the driver and description about vbus-supply
> in the rcar-gen3-phy-usb2.txt.
> 
> Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
> ---
>  .../devicetree/bindings/phy/rcar-gen3-phy-usb2.txt |  2 ++

Acked-by: Rob Herring <robh@kernel.org>

>  drivers/phy/phy-rcar-gen3-usb2.c                   | 28 ++++++++++++++++++++++
>  2 files changed, 30 insertions(+)

^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2016-02-23 21:39 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-02-22  9:57 [PATCH/RFC v2 0/9] Add support for USB2.0 host/peripheral on R-Car H3 Yoshihiro Shimoda
2016-02-22  9:58 ` [PATCH/RFC v2 1/9] phy: rcar-gen3-usb2: remove unnecesary struct rcar_gen3_data Yoshihiro Shimoda
2016-02-22  9:58 ` [PATCH/RFC v2 2/9] phy: rcar-gen3-usb2: Add vbus-supply to handle VBUS on/off Yoshihiro Shimoda
2016-02-23 21:39   ` Rob Herring
2016-02-22  9:58 ` [PATCH/RFC v2 3/9] phy: rcar-gen3-usb2: add extcon support Yoshihiro Shimoda
2016-02-22  9:58 ` [PATCH/RFC v2 4/9] arm64: dts: r8a7795: add usb2_phy device nodes Yoshihiro Shimoda
2016-02-22  9:58 ` [PATCH/RFC v2 5/9] arm64: dts: r8a7795: add USB2.0 Host (EHCI/OHCI) " Yoshihiro Shimoda
2016-02-22  9:58 ` [PATCH/RFC v2 6/9] arm64: dts: r8a7795: add HS-USB device node Yoshihiro Shimoda
2016-02-22  9:58 ` [PATCH/RFC v2 7/9] arm64: dts: salvator-x: enable usb2_phy Yoshihiro Shimoda
2016-02-22  9:58 ` [PATCH/RFC v2 8/9] arm64: dts: salvator-x: enable USB 2.0 Host channels Yoshihiro Shimoda
2016-02-22  9:58 ` [PATCH/RFC v2 9/9] arm64: dts: salvator-x: enable HS-USB Yoshihiro Shimoda

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox