All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/5 v3] usb: host: add DT bindings for faraday fotg2
@ 2017-04-21 20:40 ` Linus Walleij
  0 siblings, 0 replies; 15+ messages in thread
From: Linus Walleij @ 2017-04-21 20:40 UTC (permalink / raw)
  To: Hans Ulli Kroll, Florian Fainelli,
	linux-usb-u79uwXL29TY76Z2rM5mHXA, Greg Kroah-Hartman
  Cc: Janos Laube, Paulius Zaleckas,
	openwrt-devel-p3rKhJxN3npAfugRpC6u6w,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
	devicetree-u79uwXL29TY76Z2rM5mHXA, Linus Walleij

From: Hans Ulli Kroll <ulli.kroll-gM/Ye1E23mwN+BqQ9rBEUg@public.gmane.org>

This adds device tree bindings for the Faraday FOTG2
dual-mode host controller.

Cc: devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Signed-off-by: Hans Ulli Kroll <ulli.kroll-gM/Ye1E23mwN+BqQ9rBEUg@public.gmane.org>
Signed-off-by: Linus Walleij <linus.walleij-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
---
ChangeLog v1->v3:
- Change compatible to "faraday,fotg210" as the name of the
  hardware block.
- Add an elaborate SoC-specific compatible string for the
  Cortina Systems Gemini so that SoC-specific features can
  be enabled.
- Add cortina,gemini-mini-b to indicate a Gemini PHY with
  a Mini-B adapter connected.
- Indicated that the Gemini version can handle "wakeup-source".
- Add optional IP block clock.
---
 .../devicetree/bindings/usb/faraday,fotg210.txt    | 35 ++++++++++++++++++++++
 1 file changed, 35 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/usb/faraday,fotg210.txt

diff --git a/Documentation/devicetree/bindings/usb/faraday,fotg210.txt b/Documentation/devicetree/bindings/usb/faraday,fotg210.txt
new file mode 100644
index 000000000000..cf06808303e2
--- /dev/null
+++ b/Documentation/devicetree/bindings/usb/faraday,fotg210.txt
@@ -0,0 +1,35 @@
+Faraday FOTG Host controller
+
+This OTG-capable USB host controller is found in Cortina Systems
+Gemini and other SoC products.
+
+Required properties:
+- compatible: should be one of:
+  "faraday,fotg210"
+  "cortina,gemini-usb", "faraday,fotg210"
+- reg: should contain one register range i.e. start and length
+- interrupts: description of the interrupt line
+
+Optional properties:
+- clocks: should contain the IP block clock
+- clock-names: should be "PCLK" for the IP block clock
+
+Required properties for "cortina,gemini-usb" compatible:
+- syscon: a phandle to the system controller to access PHY registers
+
+Optional properties for "cortina,gemini-usb" compatible:
+- cortina,gemini-mini-b: boolean property that indicates that a Mini-B
+  OTH connector is in use
+- wakeup-source: see power/wakeup-source.txt
+
+Example for Gemini:
+
+usb@68000000 {
+	compatible = "cortina,gemini-usb", "faraday,fotg210";
+	reg = <0x68000000 0x1000>;
+	interrupts = <10 IRQ_TYPE_LEVEL_HIGH>;
+	clocks = <&cc 12>;
+	clock-names = "PCLK";
+	syscon = <&syscon>;
+	wakeup-source;
+};
-- 
2.9.3

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* [PATCH 1/5 v3] usb: host: add DT bindings for faraday fotg2
@ 2017-04-21 20:40 ` Linus Walleij
  0 siblings, 0 replies; 15+ messages in thread
From: Linus Walleij @ 2017-04-21 20:40 UTC (permalink / raw)
  To: linux-arm-kernel

From: Hans Ulli Kroll <ulli.kroll@googlemail.com>

This adds device tree bindings for the Faraday FOTG2
dual-mode host controller.

Cc: devicetree at vger.kernel.org
Signed-off-by: Hans Ulli Kroll <ulli.kroll@googlemail.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
---
ChangeLog v1->v3:
- Change compatible to "faraday,fotg210" as the name of the
  hardware block.
- Add an elaborate SoC-specific compatible string for the
  Cortina Systems Gemini so that SoC-specific features can
  be enabled.
- Add cortina,gemini-mini-b to indicate a Gemini PHY with
  a Mini-B adapter connected.
- Indicated that the Gemini version can handle "wakeup-source".
- Add optional IP block clock.
---
 .../devicetree/bindings/usb/faraday,fotg210.txt    | 35 ++++++++++++++++++++++
 1 file changed, 35 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/usb/faraday,fotg210.txt

diff --git a/Documentation/devicetree/bindings/usb/faraday,fotg210.txt b/Documentation/devicetree/bindings/usb/faraday,fotg210.txt
new file mode 100644
index 000000000000..cf06808303e2
--- /dev/null
+++ b/Documentation/devicetree/bindings/usb/faraday,fotg210.txt
@@ -0,0 +1,35 @@
+Faraday FOTG Host controller
+
+This OTG-capable USB host controller is found in Cortina Systems
+Gemini and other SoC products.
+
+Required properties:
+- compatible: should be one of:
+  "faraday,fotg210"
+  "cortina,gemini-usb", "faraday,fotg210"
+- reg: should contain one register range i.e. start and length
+- interrupts: description of the interrupt line
+
+Optional properties:
+- clocks: should contain the IP block clock
+- clock-names: should be "PCLK" for the IP block clock
+
+Required properties for "cortina,gemini-usb" compatible:
+- syscon: a phandle to the system controller to access PHY registers
+
+Optional properties for "cortina,gemini-usb" compatible:
+- cortina,gemini-mini-b: boolean property that indicates that a Mini-B
+  OTH connector is in use
+- wakeup-source: see power/wakeup-source.txt
+
+Example for Gemini:
+
+usb at 68000000 {
+	compatible = "cortina,gemini-usb", "faraday,fotg210";
+	reg = <0x68000000 0x1000>;
+	interrupts = <10 IRQ_TYPE_LEVEL_HIGH>;
+	clocks = <&cc 12>;
+	clock-names = "PCLK";
+	syscon = <&syscon>;
+	wakeup-source;
+};
-- 
2.9.3

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

* [PATCH 2/5 v3] usb: host: fotg2: add device tree probing
  2017-04-21 20:40 ` Linus Walleij
  (?)
@ 2017-04-21 20:40 ` Linus Walleij
  -1 siblings, 0 replies; 15+ messages in thread
From: Linus Walleij @ 2017-04-21 20:40 UTC (permalink / raw)
  To: linux-arm-kernel

From: Hans Ulli Kroll <ulli.kroll@googlemail.com>

Add device tree probing to the fotg2 driver.

Signed-off-by: Hans Ulli Kroll <ulli.kroll@googlemail.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
---
ChangeLog v2->v3:
- Change compatible to "faraday,fotg210" simply.
---
 drivers/usb/host/fotg210-hcd.c | 19 +++++++++++++++++++
 1 file changed, 19 insertions(+)

diff --git a/drivers/usb/host/fotg210-hcd.c b/drivers/usb/host/fotg210-hcd.c
index 1c5b34b74860..c226041101d1 100644
--- a/drivers/usb/host/fotg210-hcd.c
+++ b/drivers/usb/host/fotg210-hcd.c
@@ -23,6 +23,7 @@
  * Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  */
 #include <linux/module.h>
+#include <linux/of.h>
 #include <linux/device.h>
 #include <linux/dmapool.h>
 #include <linux/kernel.h>
@@ -5600,6 +5601,15 @@ static int fotg210_hcd_probe(struct platform_device *pdev)
 	if (usb_disabled())
 		return -ENODEV;
 
+	/* Right now device-tree probed devices don't get dma_mask set.
+	 * Since shared usb code relies on it, set it here for now.
+	 * Once we have dma capability bindings this can go away.
+	 */
+
+	retval = dma_coerce_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(32));
+	if (retval)
+		goto fail_create_hcd;
+
 	pdev->dev.power.power_state = PMSG_ON;
 
 	res = platform_get_resource(pdev, IORESOURCE_IRQ, 0);
@@ -5676,9 +5686,18 @@ static int fotg210_hcd_remove(struct platform_device *pdev)
 	return 0;
 }
 
+#ifdef CONFIG_OF
+static const struct of_device_id fotg210_of_match[] = {
+	{ .compatible = "faraday,fotg210" },
+	{},
+};
+MODULE_DEVICE_TABLE(of, fotg210_of_match);
+#endif
+
 static struct platform_driver fotg210_hcd_driver = {
 	.driver = {
 		.name   = "fotg210-hcd",
+		.of_match_table = of_match_ptr(fotg210_of_match),
 	},
 	.probe  = fotg210_hcd_probe,
 	.remove = fotg210_hcd_remove,
-- 
2.9.3

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

* [PATCH 3/5 v3] usb: host: fotg2: add silicon clock handling
  2017-04-21 20:40 ` Linus Walleij
  (?)
  (?)
@ 2017-04-21 20:40 ` Linus Walleij
  -1 siblings, 0 replies; 15+ messages in thread
From: Linus Walleij @ 2017-04-21 20:40 UTC (permalink / raw)
  To: linux-arm-kernel

When used in a system with software-controller silicon clocks,
the FOTG210 needs to grab, prepare and enable the clock.
This is needed on for example the Cortina Gemini, where the
platform will by default gate off the clock unless the
peripheral (in this case the USB driver) grabs and enables
the clock.

Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
---
 drivers/usb/host/fotg210-hcd.c | 26 ++++++++++++++++++++++----
 drivers/usb/host/fotg210.h     |  3 +++
 2 files changed, 25 insertions(+), 4 deletions(-)

diff --git a/drivers/usb/host/fotg210-hcd.c b/drivers/usb/host/fotg210-hcd.c
index c226041101d1..906e42458791 100644
--- a/drivers/usb/host/fotg210-hcd.c
+++ b/drivers/usb/host/fotg210-hcd.c
@@ -45,6 +45,7 @@
 #include <linux/uaccess.h>
 #include <linux/platform_device.h>
 #include <linux/io.h>
+#include <linux/clk.h>
 
 #include <asm/byteorder.h>
 #include <asm/irq.h>
@@ -5635,7 +5636,7 @@ static int fotg210_hcd_probe(struct platform_device *pdev)
 	hcd->regs = devm_ioremap_resource(&pdev->dev, res);
 	if (IS_ERR(hcd->regs)) {
 		retval = PTR_ERR(hcd->regs);
-		goto failed;
+		goto failed_put_hcd;
 	}
 
 	hcd->rsrc_start = res->start;
@@ -5645,22 +5646,35 @@ static int fotg210_hcd_probe(struct platform_device *pdev)
 
 	fotg210->caps = hcd->regs;
 
+	/* It's OK not to supply this clock */
+	fotg210->pclk = clk_get(dev, "PCLK");
+	if (!IS_ERR(fotg210->pclk)) {
+		retval = clk_prepare_enable(fotg210->pclk);
+		if (retval) {
+			dev_err(dev, "failed to enable PCLK\n");
+			goto failed_dis_clk;
+		}
+	}
+
 	retval = fotg210_setup(hcd);
 	if (retval)
-		goto failed;
+		goto failed_dis_clk;
 
 	fotg210_init(fotg210);
 
 	retval = usb_add_hcd(hcd, irq, IRQF_SHARED);
 	if (retval) {
 		dev_err(dev, "failed to add hcd with err %d\n", retval);
-		goto failed;
+		goto failed_dis_clk;
 	}
 	device_wakeup_enable(hcd->self.controller);
 
 	return retval;
 
-failed:
+failed_dis_clk:
+	if (!IS_ERR(fotg210->pclk))
+		clk_disable_unprepare(fotg210->pclk);
+failed_put_hcd:
 	usb_put_hcd(hcd);
 fail_create_hcd:
 	dev_err(dev, "init %s fail, %d\n", dev_name(dev), retval);
@@ -5676,6 +5690,10 @@ static int fotg210_hcd_remove(struct platform_device *pdev)
 {
 	struct device *dev = &pdev->dev;
 	struct usb_hcd *hcd = dev_get_drvdata(dev);
+	struct fotg210_hcd *fotg210 = hcd_to_fotg210(hcd);
+
+	if (!IS_ERR(fotg210->pclk))
+		clk_disable_unprepare(fotg210->pclk);
 
 	if (!hcd)
 		return 0;
diff --git a/drivers/usb/host/fotg210.h b/drivers/usb/host/fotg210.h
index b5cfa7aeb277..c429efeb2b7e 100644
--- a/drivers/usb/host/fotg210.h
+++ b/drivers/usb/host/fotg210.h
@@ -181,6 +181,9 @@ struct fotg210_hcd {			/* one per controller */
 #	define COUNT(x)
 #endif
 
+	/* silicon clock */
+	struct clk		*pclk;
+
 	/* debug files */
 	struct dentry		*debug_dir;
 };
-- 
2.9.3

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

* [PATCH 4/5 v3] usb: host: fotg2: add Gemini-specific handling
  2017-04-21 20:40 ` Linus Walleij
                   ` (2 preceding siblings ...)
  (?)
@ 2017-04-21 20:40 ` Linus Walleij
  2017-04-24 17:06   ` Hans Ulli Kroll
  -1 siblings, 1 reply; 15+ messages in thread
From: Linus Walleij @ 2017-04-21 20:40 UTC (permalink / raw)
  To: linux-arm-kernel

The Cortina Systems Gemini has bolted on a PHY inside the
silicon that can be handled by six bits in a MISC register in
the system controller.

If we are running on Gemini, look up a syscon regmap through
a phandle and enable VBUS and optionally the Mini-B connector.

If the device is flagged as "wakeup-source" using the standard
DT bindings, we also enable this in the global controller for
respective port.

Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
---
 drivers/usb/host/Kconfig       |  1 +
 drivers/usb/host/fotg210-hcd.c | 76 ++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 77 insertions(+)

diff --git a/drivers/usb/host/Kconfig b/drivers/usb/host/Kconfig
index 407d947b34ea..9750783e5481 100644
--- a/drivers/usb/host/Kconfig
+++ b/drivers/usb/host/Kconfig
@@ -375,6 +375,7 @@ config USB_ISP1362_HCD
 config USB_FOTG210_HCD
 	tristate "FOTG210 HCD support"
 	depends on USB && HAS_DMA && HAS_IOMEM
+	select MFD_SYSCON
 	---help---
 	  Faraday FOTG210 is an OTG controller which can be configured as
 	  an USB2.0 host. It is designed to meet USB2.0 EHCI specification
diff --git a/drivers/usb/host/fotg210-hcd.c b/drivers/usb/host/fotg210-hcd.c
index 906e42458791..146f1eb96b60 100644
--- a/drivers/usb/host/fotg210-hcd.c
+++ b/drivers/usb/host/fotg210-hcd.c
@@ -46,6 +46,10 @@
 #include <linux/platform_device.h>
 #include <linux/io.h>
 #include <linux/clk.h>
+#include <linux/bitops.h>
+/* For Cortina Gemini */
+#include <linux/mfd/syscon.h>
+#include <linux/regmap.h>
 
 #include <asm/byteorder.h>
 #include <asm/irq.h>
@@ -5583,6 +5587,72 @@ static void fotg210_init(struct fotg210_hcd *fotg210)
 	iowrite32(value, &fotg210->regs->otgcsr);
 }
 
+/*
+ * Gemini-specific initialization function, only executed on the
+ * Gemini SoC using the global misc control register.
+ */
+#define GEMINI_GLOBAL_MISC_CTRL		0x30
+#define GEMINI_MISC_USB0_WAKEUP		BIT(14)
+#define GEMINI_MISC_USB1_WAKEUP		BIT(15)
+#define GEMINI_MISC_USB0_VBUS_ON	BIT(22)
+#define GEMINI_MISC_USB1_VBUS_ON	BIT(23)
+#define GEMINI_MISC_USB0_MINI_B		BIT(29)
+#define GEMINI_MISC_USB1_MINI_B		BIT(30)
+
+static int fotg210_gemini_init(struct device *dev, struct usb_hcd *hcd)
+{
+	struct device_node *np = dev->of_node;
+	struct regmap *map;
+	bool mini_b;
+	bool wakeup;
+	u32 mask, val;
+	int ret;
+
+	map = syscon_regmap_lookup_by_phandle(np, "syscon");
+	if (IS_ERR(map)) {
+		dev_err(dev, "no syscon\n");
+		return PTR_ERR(map);
+	}
+	mini_b = of_property_read_bool(np, "cortina,gemini-mini-b");
+	wakeup = of_property_read_bool(np, "wakeup-source");
+
+	/*
+	 * Figure out if this is USB0 or USB1 by simply checking the
+	 * physical base address.
+	 */
+	mask = 0;
+	if (hcd->rsrc_start == 0x69000000) {
+		val = GEMINI_MISC_USB1_VBUS_ON;
+		if (mini_b)
+			val |= GEMINI_MISC_USB1_MINI_B;
+		else
+			mask |= GEMINI_MISC_USB1_MINI_B;
+		if (wakeup)
+			val |= GEMINI_MISC_USB1_WAKEUP;
+		else
+			mask |= GEMINI_MISC_USB1_WAKEUP;
+	} else {
+		val = GEMINI_MISC_USB0_VBUS_ON;
+		if (mini_b)
+			val |= GEMINI_MISC_USB0_MINI_B;
+		else
+			mask |= GEMINI_MISC_USB0_MINI_B;
+		if (wakeup)
+			val |= GEMINI_MISC_USB0_WAKEUP;
+		else
+			mask |= GEMINI_MISC_USB0_WAKEUP;
+	}
+
+	ret = regmap_update_bits(map, GEMINI_GLOBAL_MISC_CTRL, mask, val);
+	if (ret) {
+		dev_err(dev, "failed to initialize Gemini PHY\n");
+		return ret;
+	}
+
+	dev_info(dev, "initialized Gemini PHY\n");
+	return 0;
+}
+
 /**
  * fotg210_hcd_probe - initialize faraday FOTG210 HCDs
  *
@@ -5662,6 +5732,12 @@ static int fotg210_hcd_probe(struct platform_device *pdev)
 
 	fotg210_init(fotg210);
 
+	if (of_device_is_compatible(dev->of_node, "cortina,gemini-usb")) {
+		retval = fotg210_gemini_init(dev, hcd);
+		if (retval)
+			goto failed_dis_clk;
+	}
+
 	retval = usb_add_hcd(hcd, irq, IRQF_SHARED);
 	if (retval) {
 		dev_err(dev, "failed to add hcd with err %d\n", retval);
-- 
2.9.3

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

* [PATCH 5/5 v3] ARM: dts: Add the FOTG210 USB host to Gemini
  2017-04-21 20:40 ` Linus Walleij
                   ` (3 preceding siblings ...)
  (?)
@ 2017-04-21 20:40 ` Linus Walleij
  2017-04-22  2:52   ` kbuild test robot
  -1 siblings, 1 reply; 15+ messages in thread
From: Linus Walleij @ 2017-04-21 20:40 UTC (permalink / raw)
  To: linux-arm-kernel

This adds the FOTG210 USB host controller to the Gemini
device trees. In the main SoC DTSI it is flagged as disabled
and then it is selectively enabled on the devices that utilize
it (these per-platform enablements are done on the out-of-tree
OpenWrt patch set). It is not enabled on the Itian SquareOne
NAS/router since this instead has a VIA host controller
soldered on the PCI port, and can gate off these USB host
controllers.

Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
---
USB maintainers: I will merge this through the ARM SoC tree,
the patch is only included in the series for context.
---
 arch/arm/boot/dts/gemini-nas4220b.dts |  8 ++++++++
 arch/arm/boot/dts/gemini-rut1xx.dts   |  8 ++++++++
 arch/arm/boot/dts/gemini-wbd111.dts   |  8 ++++++++
 arch/arm/boot/dts/gemini-wbd222.dts   |  8 ++++++++
 arch/arm/boot/dts/gemini.dtsi         | 22 ++++++++++++++++++++++
 5 files changed, 54 insertions(+)

diff --git a/arch/arm/boot/dts/gemini-nas4220b.dts b/arch/arm/boot/dts/gemini-nas4220b.dts
index 7668ba52158e..55059a72aef2 100644
--- a/arch/arm/boot/dts/gemini-nas4220b.dts
+++ b/arch/arm/boot/dts/gemini-nas4220b.dts
@@ -98,5 +98,13 @@
 				read-only;
 			};
 		};
+
+		usb at 68000000 {
+			status = "okay";
+		};
+
+		usb at 69000000 {
+			status = "okay";
+		};
 	};
 };
diff --git a/arch/arm/boot/dts/gemini-rut1xx.dts b/arch/arm/boot/dts/gemini-rut1xx.dts
index 7b920bfbda32..1c253da9f28c 100644
--- a/arch/arm/boot/dts/gemini-rut1xx.dts
+++ b/arch/arm/boot/dts/gemini-rut1xx.dts
@@ -61,5 +61,13 @@
 			reg = <0x30000000 0x00800000>;
 			/* TODO: add flash partitions here */
 		};
+
+		usb at 68000000 {
+			status = "okay";
+		};
+
+		usb at 69000000 {
+			status = "okay";
+		};
 	};
 };
diff --git a/arch/arm/boot/dts/gemini-wbd111.dts b/arch/arm/boot/dts/gemini-wbd111.dts
index 63b756e3bf5a..c6a5abca0935 100644
--- a/arch/arm/boot/dts/gemini-wbd111.dts
+++ b/arch/arm/boot/dts/gemini-wbd111.dts
@@ -98,5 +98,13 @@
 				read-only;
 			};
 		};
+
+		usb at 68000000 {
+			status = "okay";
+		};
+
+		usb at 69000000 {
+			status = "okay";
+		};
 	};
 };
diff --git a/arch/arm/boot/dts/gemini-wbd222.dts b/arch/arm/boot/dts/gemini-wbd222.dts
index 9747f5a47807..415380262140 100644
--- a/arch/arm/boot/dts/gemini-wbd222.dts
+++ b/arch/arm/boot/dts/gemini-wbd222.dts
@@ -98,5 +98,13 @@
 				read-only;
 			};
 		};
+
+		usb at 68000000 {
+			status = "okay";
+		};
+
+		usb at 69000000 {
+			status = "okay";
+		};
 	};
 };
diff --git a/arch/arm/boot/dts/gemini.dtsi b/arch/arm/boot/dts/gemini.dtsi
index 6fe678a68e31..2f8d0381d5eb 100644
--- a/arch/arm/boot/dts/gemini.dtsi
+++ b/arch/arm/boot/dts/gemini.dtsi
@@ -183,5 +183,27 @@
 				#interrupt-cells = <1>;
 			};
 		};
+
+		usb at 68000000 {
+			compatible = "cortina,gemini-usb", "faraday,fotg210";
+			reg = <0x68000000 0x1000>;
+			interrupts = <10 IRQ_TYPE_LEVEL_HIGH>;
+			resets = <&rcon 8>;
+			clocks = <&gcc GEMINI_CLK_GATE_USB0>;
+			clock-names = "PCLK";
+			syscon = <&syscon>;
+			status = "disabled";
+		};
+
+		usb at 69000000 {
+			compatible = "cortina,gemini-usb", "faraday,fotg210";
+			reg = <0x69000000 0x1000>;
+			interrupts = <11 IRQ_TYPE_LEVEL_HIGH>;
+			resets = <&rcon 9>;
+			clocks = <&gcc GEMINI_CLK_GATE_USB1>;
+			clock-names = "PCLK";
+			syscon = <&syscon>;
+			status = "disabled";
+		};
 	};
 };
-- 
2.9.3

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

* [PATCH 5/5 v3] ARM: dts: Add the FOTG210 USB host to Gemini
  2017-04-21 20:40 ` [PATCH 5/5 v3] ARM: dts: Add the FOTG210 USB host to Gemini Linus Walleij
@ 2017-04-22  2:52   ` kbuild test robot
  0 siblings, 0 replies; 15+ messages in thread
From: kbuild test robot @ 2017-04-22  2:52 UTC (permalink / raw)
  To: linux-arm-kernel

Hi Linus,

[auto build test ERROR on next-20170421]
[cannot apply to robh/for-next usb/usb-testing balbi-usb/next v4.9-rc8 v4.9-rc7 v4.9-rc6 v4.11-rc7]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]

url:    https://github.com/0day-ci/linux/commits/Linus-Walleij/usb-host-add-DT-bindings-for-faraday-fotg2/20170422-072414
config: arm-sama5_defconfig (attached as .config)
compiler: arm-linux-gnueabi-gcc (Debian 6.1.1-9) 6.1.1 20160705
reproduce:
        wget https://raw.githubusercontent.com/01org/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # save the attached .config to linux build tree
        make.cross ARCH=arm 

All errors (new ones prefixed by >>):

>> Error: arch/arm/boot/dts/gemini.dtsi:161.19-20 syntax error
   FATAL ERROR: Unable to parse input tree

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation
-------------- next part --------------
A non-text attachment was scrubbed...
Name: .config.gz
Type: application/gzip
Size: 24300 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20170422/a2a86dda/attachment-0001.gz>

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

* Re: [PATCH 1/5 v3] usb: host: add DT bindings for faraday fotg2
  2017-04-21 20:40 ` Linus Walleij
@ 2017-04-24 16:53   ` Hans Ulli Kroll
  -1 siblings, 0 replies; 15+ messages in thread
From: Hans Ulli Kroll @ 2017-04-24 16:53 UTC (permalink / raw)
  To: Linus Walleij
  Cc: openwrt-devel, devicetree, Paulius Zaleckas, Greg Kroah-Hartman,
	linux-usb, Janos Laube, linux-arm-kernel

Hi Linus

On Fri, 21 Apr 2017, Linus Walleij wrote:

> From: Hans Ulli Kroll <ulli.kroll@googlemail.com>
> 
> This adds device tree bindings for the Faraday FOTG2
> dual-mode host controller.
> 
> Cc: devicetree@vger.kernel.org
> Signed-off-by: Hans Ulli Kroll <ulli.kroll@googlemail.com>
> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
> ---
> ChangeLog v1->v3:
> - Change compatible to "faraday,fotg210" as the name of the
>   hardware block.
> - Add an elaborate SoC-specific compatible string for the
>   Cortina Systems Gemini so that SoC-specific features can
>   be enabled.
> - Add cortina,gemini-mini-b to indicate a Gemini PHY with
>   a Mini-B adapter connected.
> - Indicated that the Gemini version can handle "wakeup-source".
> - Add optional IP block clock.
> ---
>  .../devicetree/bindings/usb/faraday,fotg210.txt    | 35 ++++++++++++++++++++++
>  1 file changed, 35 insertions(+)
>  create mode 100644 Documentation/devicetree/bindings/usb/faraday,fotg210.txt
> 

Got NAK'ed from Rob on some ealier round due missing "device mode" on this 
IP. I've blatantly overrided this to a host only driver.

These are the needed changes in DT to support both modes
Note the -dr at the end of fotg210, to reflect this in an dual role device

diff --git a/Documentation/devicetree/bindings/usb/faraday,fotg210.txt 
b/Documentation/devicetree/bindings/usb/faraday,fotg210.txt
index cf06808303e2..862cda19e9d3 100644
--- a/Documentation/devicetree/bindings/usb/faraday,fotg210.txt
+++ b/Documentation/devicetree/bindings/usb/faraday,fotg210.txt
@@ -13,6 +13,9 @@ Required properties:
 Optional properties:
 - clocks: should contain the IP block clock
 - clock-names: should be "PCLK" for the IP block clock
+- dr_mode : indicates the working mode for "fotg210-dr" compatible
+   controllers.  Can be "host", "peripheral". Default to
+   "host" if not defined for backward compatibility.
 
 Required properties for "cortina,gemini-usb" compatible:
 - syscon: a phandle to the system controller to access PHY registers
@@ -25,7 +28,7 @@ Optional properties for "cortina,gemini-usb" compatible:
 Example for Gemini:
 
 usb@68000000 {
-       compatible = "cortina,gemini-usb", "faraday,fotg210";
+       compatible = "cortina,gemini-usb", "faraday,fotg210-dr";
        reg = <0x68000000 0x1000>;
        interrupts = <10 IRQ_TYPE_LEVEL_HIGH>;
        clocks = <&cc 12>;
_______________________________________________
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel

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

* [PATCH 1/5 v3] usb: host: add DT bindings for faraday fotg2
@ 2017-04-24 16:53   ` Hans Ulli Kroll
  0 siblings, 0 replies; 15+ messages in thread
From: Hans Ulli Kroll @ 2017-04-24 16:53 UTC (permalink / raw)
  To: linux-arm-kernel

Hi Linus

On Fri, 21 Apr 2017, Linus Walleij wrote:

> From: Hans Ulli Kroll <ulli.kroll@googlemail.com>
> 
> This adds device tree bindings for the Faraday FOTG2
> dual-mode host controller.
> 
> Cc: devicetree at vger.kernel.org
> Signed-off-by: Hans Ulli Kroll <ulli.kroll@googlemail.com>
> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
> ---
> ChangeLog v1->v3:
> - Change compatible to "faraday,fotg210" as the name of the
>   hardware block.
> - Add an elaborate SoC-specific compatible string for the
>   Cortina Systems Gemini so that SoC-specific features can
>   be enabled.
> - Add cortina,gemini-mini-b to indicate a Gemini PHY with
>   a Mini-B adapter connected.
> - Indicated that the Gemini version can handle "wakeup-source".
> - Add optional IP block clock.
> ---
>  .../devicetree/bindings/usb/faraday,fotg210.txt    | 35 ++++++++++++++++++++++
>  1 file changed, 35 insertions(+)
>  create mode 100644 Documentation/devicetree/bindings/usb/faraday,fotg210.txt
> 

Got NAK'ed from Rob on some ealier round due missing "device mode" on this 
IP. I've blatantly overrided this to a host only driver.

These are the needed changes in DT to support both modes
Note the -dr at the end of fotg210, to reflect this in an dual role device

diff --git a/Documentation/devicetree/bindings/usb/faraday,fotg210.txt 
b/Documentation/devicetree/bindings/usb/faraday,fotg210.txt
index cf06808303e2..862cda19e9d3 100644
--- a/Documentation/devicetree/bindings/usb/faraday,fotg210.txt
+++ b/Documentation/devicetree/bindings/usb/faraday,fotg210.txt
@@ -13,6 +13,9 @@ Required properties:
 Optional properties:
 - clocks: should contain the IP block clock
 - clock-names: should be "PCLK" for the IP block clock
+- dr_mode : indicates the working mode for "fotg210-dr" compatible
+   controllers.  Can be "host", "peripheral". Default to
+   "host" if not defined for backward compatibility.
 
 Required properties for "cortina,gemini-usb" compatible:
 - syscon: a phandle to the system controller to access PHY registers
@@ -25,7 +28,7 @@ Optional properties for "cortina,gemini-usb" compatible:
 Example for Gemini:
 
 usb at 68000000 {
-       compatible = "cortina,gemini-usb", "faraday,fotg210";
+       compatible = "cortina,gemini-usb", "faraday,fotg210-dr";
        reg = <0x68000000 0x1000>;
        interrupts = <10 IRQ_TYPE_LEVEL_HIGH>;
        clocks = <&cc 12>;

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

* [PATCH 4/5 v3] usb: host: fotg2: add Gemini-specific handling
  2017-04-21 20:40 ` [PATCH 4/5 v3] usb: host: fotg2: add Gemini-specific handling Linus Walleij
@ 2017-04-24 17:06   ` Hans Ulli Kroll
  2017-04-25  8:15     ` Linus Walleij
  0 siblings, 1 reply; 15+ messages in thread
From: Hans Ulli Kroll @ 2017-04-24 17:06 UTC (permalink / raw)
  To: linux-arm-kernel

Hi Linus

On Fri, 21 Apr 2017, Linus Walleij wrote:

> The Cortina Systems Gemini has bolted on a PHY inside the
> silicon that can be handled by six bits in a MISC register in
> the system controller.
> 
> If we are running on Gemini, look up a syscon regmap through
> a phandle and enable VBUS and optionally the Mini-B connector.
> 
> If the device is flagged as "wakeup-source" using the standard
> DT bindings, we also enable this in the global controller for
> respective port.
> 
> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
> ---
>  drivers/usb/host/Kconfig       |  1 +
>  drivers/usb/host/fotg210-hcd.c | 76 ++++++++++++++++++++++++++++++++++++++++++
>  2 files changed, 77 insertions(+)
> 

please wait for a while, I'm working on some glue code to support both 
host and device mode on FOTG.

Hans Ulli Kroll

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

* Re: [PATCH 1/5 v3] usb: host: add DT bindings for faraday fotg2
  2017-04-24 16:53   ` Hans Ulli Kroll
@ 2017-04-25  8:12     ` Linus Walleij
  -1 siblings, 0 replies; 15+ messages in thread
From: Linus Walleij @ 2017-04-25  8:12 UTC (permalink / raw)
  To: Hans Ulli Kroll
  Cc: openwrt-devel, devicetree, Paulius Zaleckas, Greg Kroah-Hartman,
	linux-usb, Janos Laube, linux-arm-kernel

On Mon, Apr 24, 2017 at 6:53 PM, Hans Ulli Kroll
<ulli.kroll@googlemail.com> wrote:

> Got NAK'ed from Rob on some ealier round due missing "device mode" on this
> IP. I've blatantly overrided this to a host only driver.
>
> These are the needed changes in DT to support both modes
> Note the -dr at the end of fotg210, to reflect this in an dual role device

OK I understood the discussion such that the compatible should
simply be ""faraday,fotg210" as that is the name of the hardware
IP block. This is the name of the hardware name in the Faraday
page:
http://www.faraday-tech.com/html/Product/IPProduct/InterfaceIP/USB2_0.htm

Any other string implies how it is used, so that was what I understood
as the reason to reject it with the "-hcd" (host controller device) suffix.

> +- dr_mode : indicates the working mode for "fotg210-dr" compatible
> +   controllers.  Can be "host", "peripheral". Default to
> +   "host" if not defined for backward compatibility.

This seems right, so it is part of the generic bindings, correct?

>  usb@68000000 {
> -       compatible = "cortina,gemini-usb", "faraday,fotg210";
> +       compatible = "cortina,gemini-usb", "faraday,fotg210-dr";

But this would be wrong, because the compatible should only
indicate what kind of hardware it is, not how it is going to be used
(whether as host only, slave only or dual-role (OTG).

I hope I didn't get anything wrong here :/

Yours,
Linus Walleij
_______________________________________________
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel

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

* [PATCH 1/5 v3] usb: host: add DT bindings for faraday fotg2
@ 2017-04-25  8:12     ` Linus Walleij
  0 siblings, 0 replies; 15+ messages in thread
From: Linus Walleij @ 2017-04-25  8:12 UTC (permalink / raw)
  To: linux-arm-kernel

On Mon, Apr 24, 2017 at 6:53 PM, Hans Ulli Kroll
<ulli.kroll@googlemail.com> wrote:

> Got NAK'ed from Rob on some ealier round due missing "device mode" on this
> IP. I've blatantly overrided this to a host only driver.
>
> These are the needed changes in DT to support both modes
> Note the -dr at the end of fotg210, to reflect this in an dual role device

OK I understood the discussion such that the compatible should
simply be ""faraday,fotg210" as that is the name of the hardware
IP block. This is the name of the hardware name in the Faraday
page:
http://www.faraday-tech.com/html/Product/IPProduct/InterfaceIP/USB2_0.htm

Any other string implies how it is used, so that was what I understood
as the reason to reject it with the "-hcd" (host controller device) suffix.

> +- dr_mode : indicates the working mode for "fotg210-dr" compatible
> +   controllers.  Can be "host", "peripheral". Default to
> +   "host" if not defined for backward compatibility.

This seems right, so it is part of the generic bindings, correct?

>  usb at 68000000 {
> -       compatible = "cortina,gemini-usb", "faraday,fotg210";
> +       compatible = "cortina,gemini-usb", "faraday,fotg210-dr";

But this would be wrong, because the compatible should only
indicate what kind of hardware it is, not how it is going to be used
(whether as host only, slave only or dual-role (OTG).

I hope I didn't get anything wrong here :/

Yours,
Linus Walleij

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

* [PATCH 4/5 v3] usb: host: fotg2: add Gemini-specific handling
  2017-04-24 17:06   ` Hans Ulli Kroll
@ 2017-04-25  8:15     ` Linus Walleij
  0 siblings, 0 replies; 15+ messages in thread
From: Linus Walleij @ 2017-04-25  8:15 UTC (permalink / raw)
  To: linux-arm-kernel

On Mon, Apr 24, 2017 at 7:06 PM, Hans Ulli Kroll
<ulli.kroll@googlemail.com> wrote:

> please wait for a while, I'm working on some glue code to support both
> host and device mode on FOTG.

Sure no problem, sorry for being so impatient, it's a character trait.

I sent out bindings and drivers for the Gemini clock controller and reset
controller, so we might want to queue the clock handling at least.
I'm happy if you pick some of these patches and keep them in your
queue BTW.

Yours,
Linus Walleij

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

* Re: [PATCH 1/5 v3] usb: host: add DT bindings for faraday fotg2
  2017-04-25  8:12     ` Linus Walleij
@ 2017-04-25 19:07         ` Hans Ulli Kroll
  -1 siblings, 0 replies; 15+ messages in thread
From: Hans Ulli Kroll @ 2017-04-25 19:07 UTC (permalink / raw)
  To: Linus Walleij
  Cc: Hans Ulli Kroll, Florian Fainelli,
	linux-usb-u79uwXL29TY76Z2rM5mHXA, Greg Kroah-Hartman,
	Janos Laube, Paulius Zaleckas,
	openwrt-devel-p3rKhJxN3npAfugRpC6u6w,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
	devicetree-u79uwXL29TY76Z2rM5mHXA

Hi Linus

On Tue, 25 Apr 2017, Linus Walleij wrote:

> On Mon, Apr 24, 2017 at 6:53 PM, Hans Ulli Kroll
> <ulli.kroll-gM/Ye1E23mwN+BqQ9rBEUg@public.gmane.org> wrote:
> 
> > Got NAK'ed from Rob on some ealier round due missing "device mode" on this
> > IP. I've blatantly overrided this to a host only driver.
> >
> > These are the needed changes in DT to support both modes
> > Note the -dr at the end of fotg210, to reflect this in an dual role device
> 
> OK I understood the discussion such that the compatible should
> simply be ""faraday,fotg210" as that is the name of the hardware
> IP block. This is the name of the hardware name in the Faraday
> page:
> http://www.faraday-tech.com/html/Product/IPProduct/InterfaceIP/USB2_0.htm
> 
> Any other string implies how it is used, so that was what I understood
> as the reason to reject it with the "-hcd" (host controller device) suffix.
> 
> > +- dr_mode : indicates the working mode for "fotg210-dr" compatible
> > +   controllers.  Can be "host", "peripheral". Default to
> > +   "host" if not defined for backward compatibility.
> 
> This seems right, so it is part of the generic bindings, correct?
> 
> >  usb@68000000 {
> > -       compatible = "cortina,gemini-usb", "faraday,fotg210";
> > +       compatible = "cortina,gemini-usb", "faraday,fotg210-dr";
> 
> But this would be wrong, because the compatible should only
> indicate what kind of hardware it is, not how it is going to be used
> (whether as host only, slave only or dual-role (OTG).
> 

for compatible I think yes.
But in Rob's opinion we missed the device part of the controller.

Greetings
Hans Ulli Kroll
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* [PATCH 1/5 v3] usb: host: add DT bindings for faraday fotg2
@ 2017-04-25 19:07         ` Hans Ulli Kroll
  0 siblings, 0 replies; 15+ messages in thread
From: Hans Ulli Kroll @ 2017-04-25 19:07 UTC (permalink / raw)
  To: linux-arm-kernel

Hi Linus

On Tue, 25 Apr 2017, Linus Walleij wrote:

> On Mon, Apr 24, 2017 at 6:53 PM, Hans Ulli Kroll
> <ulli.kroll@googlemail.com> wrote:
> 
> > Got NAK'ed from Rob on some ealier round due missing "device mode" on this
> > IP. I've blatantly overrided this to a host only driver.
> >
> > These are the needed changes in DT to support both modes
> > Note the -dr at the end of fotg210, to reflect this in an dual role device
> 
> OK I understood the discussion such that the compatible should
> simply be ""faraday,fotg210" as that is the name of the hardware
> IP block. This is the name of the hardware name in the Faraday
> page:
> http://www.faraday-tech.com/html/Product/IPProduct/InterfaceIP/USB2_0.htm
> 
> Any other string implies how it is used, so that was what I understood
> as the reason to reject it with the "-hcd" (host controller device) suffix.
> 
> > +- dr_mode : indicates the working mode for "fotg210-dr" compatible
> > +   controllers.  Can be "host", "peripheral". Default to
> > +   "host" if not defined for backward compatibility.
> 
> This seems right, so it is part of the generic bindings, correct?
> 
> >  usb at 68000000 {
> > -       compatible = "cortina,gemini-usb", "faraday,fotg210";
> > +       compatible = "cortina,gemini-usb", "faraday,fotg210-dr";
> 
> But this would be wrong, because the compatible should only
> indicate what kind of hardware it is, not how it is going to be used
> (whether as host only, slave only or dual-role (OTG).
> 

for compatible I think yes.
But in Rob's opinion we missed the device part of the controller.

Greetings
Hans Ulli Kroll

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

end of thread, other threads:[~2017-04-25 19:07 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-04-21 20:40 [PATCH 1/5 v3] usb: host: add DT bindings for faraday fotg2 Linus Walleij
2017-04-21 20:40 ` Linus Walleij
2017-04-21 20:40 ` [PATCH 2/5 v3] usb: host: fotg2: add device tree probing Linus Walleij
2017-04-21 20:40 ` [PATCH 3/5 v3] usb: host: fotg2: add silicon clock handling Linus Walleij
2017-04-21 20:40 ` [PATCH 4/5 v3] usb: host: fotg2: add Gemini-specific handling Linus Walleij
2017-04-24 17:06   ` Hans Ulli Kroll
2017-04-25  8:15     ` Linus Walleij
2017-04-21 20:40 ` [PATCH 5/5 v3] ARM: dts: Add the FOTG210 USB host to Gemini Linus Walleij
2017-04-22  2:52   ` kbuild test robot
2017-04-24 16:53 ` [PATCH 1/5 v3] usb: host: add DT bindings for faraday fotg2 Hans Ulli Kroll
2017-04-24 16:53   ` Hans Ulli Kroll
2017-04-25  8:12   ` Linus Walleij
2017-04-25  8:12     ` Linus Walleij
     [not found]     ` <CACRpkda-2OQZJDQndrDg_d4iK4oecz4HNSCQPSztBFTG5Rwg8w-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2017-04-25 19:07       ` Hans Ulli Kroll
2017-04-25 19:07         ` Hans Ulli Kroll

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.