linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v6 00/12] ARM: berlin: USB support
@ 2014-09-23 10:27 Antoine Tenart
  2014-09-23 10:27 ` [PATCH v6 01/12] reset: add the Berlin reset controller driver Antoine Tenart
                   ` (11 more replies)
  0 siblings, 12 replies; 52+ messages in thread
From: Antoine Tenart @ 2014-09-23 10:27 UTC (permalink / raw)
  To: sebastian.hesselbarth, Peter.Chen, balbi, p.zabel
  Cc: Antoine Tenart, alexandre.belloni, thomas.petazzoni, zmxu,
	jszhang, linux-arm-kernel, linux-usb, devicetree, linux-kernel

This series adds the support for ChipIdea USB2 (ci13xxx) controllers,
the USB PHYs of the Marvell Berlin SoCs and also adds a reset
controller for these SoCs.

The reset controller is used by the PHY driver and shares the
existing chip controller node with the clocks and one pin controller.

The Marvell Berlin USB controllers are host only on the BG2Q and are
compatible with USB ChipIdea. We here add a glue to use the available
common functions for this kind of controllers, and add a generic USB2
ChipIdea driver. A PHY driver is also added to control the USB PHY.

This series applies on top of the generic PHY support in the USB
framework[1].

Patches 1-4 have already been taken by Sebastian.

Changes since v5:
	- added a missing header in ci_hdrc_usb2

Changes since v4:
        - fixed the error handling of ci_hdrc_usb2_probe()

Changes since v3:
        - removed the DMA mask property
        - moved the clock handling in the common probe function
        - fixed the documentation for the USB2 ChipIdea USB PHY binding
        - made sure the reset bit is 0-31 in the reset driver

Changes since v2:
        - moved the PHY driver to the generic PHY framework
        - changed the compatible to 'chipidea,usb2'
        - added a property to set the DMA mask in the USB2 CI driver
        - separated dt specific calls in the CI probing function
        - rebased on top of the generic PHY support for CI[1]

Changes since v1:
        - made the Berlin CI USB driver a generic one
        - added support to custom offset for the reset register
        - added fixed regulators to support supply the VBUS
        - modified the PHY driver to support the one one the BG2CD as
          well
        - documented the reset properties
        - added bindings for the BG2CD
        - cosmetic fixes

[1] git://git.free-electrons.com:users/antoine-tenart/linux.git usb-phy

Antoine Tenart (10):
  reset: add the Berlin reset controller driver
  Documentation: bindings: add reset bindings docs for Marvell Berlin
    SoCs
  ARM: Berlin: select the reset controller
  ARM: dts: berlin: add a required reset property in the chip controller
    node
  phy: add the Berlin USB PHY driver
  Documentation: bindings: add doc for the Berlin USB PHY
  usb: chipidea: add a usb2 driver for ci13xxx
  Documentation: bindings: add doc for the USB2 ChipIdea USB driver
  ARM: dts: berlin: add BG2Q nodes for USB support
  ARM: dts: Berlin: enable USB on the BG2Q DMP

Sebastian Hesselbarth (2):
  ARM: dts: berlin: add BG2CD nodes for USB support
  ARM: dts: berlin: enable USB on the Google Chromecast

 .../devicetree/bindings/arm/marvell,berlin.txt     |  10 +
 .../devicetree/bindings/phy/berlin-usb-phy.txt     |  16 ++
 .../devicetree/bindings/usb/ci-hdrc-usb2.txt       |  22 ++
 arch/arm/boot/dts/berlin2.dtsi                     |   1 +
 arch/arm/boot/dts/berlin2cd-google-chromecast.dts  |   4 +
 arch/arm/boot/dts/berlin2cd.dtsi                   |  35 ++++
 arch/arm/boot/dts/berlin2q-marvell-dmp.dts         |  53 +++++
 arch/arm/boot/dts/berlin2q.dtsi                    |  53 +++++
 arch/arm/mach-berlin/Kconfig                       |   2 +
 drivers/phy/Kconfig                                |   7 +
 drivers/phy/Makefile                               |   1 +
 drivers/phy/phy-berlin-usb.c                       | 224 +++++++++++++++++++++
 drivers/reset/Makefile                             |   1 +
 drivers/reset/reset-berlin.c                       | 131 ++++++++++++
 drivers/usb/chipidea/Makefile                      |   1 +
 drivers/usb/chipidea/ci_hdrc_usb2.c                | 138 +++++++++++++
 16 files changed, 699 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/phy/berlin-usb-phy.txt
 create mode 100644 Documentation/devicetree/bindings/usb/ci-hdrc-usb2.txt
 create mode 100644 drivers/phy/phy-berlin-usb.c
 create mode 100644 drivers/reset/reset-berlin.c
 create mode 100644 drivers/usb/chipidea/ci_hdrc_usb2.c

-- 
1.9.1


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

* [PATCH v6 01/12] reset: add the Berlin reset controller driver
  2014-09-23 10:27 [PATCH v6 00/12] ARM: berlin: USB support Antoine Tenart
@ 2014-09-23 10:27 ` Antoine Tenart
  2014-09-23 10:27 ` [PATCH v6 02/12] Documentation: bindings: add reset bindings docs for Marvell Berlin SoCs Antoine Tenart
                   ` (10 subsequent siblings)
  11 siblings, 0 replies; 52+ messages in thread
From: Antoine Tenart @ 2014-09-23 10:27 UTC (permalink / raw)
  To: sebastian.hesselbarth, Peter.Chen, balbi, p.zabel
  Cc: Antoine Tenart, alexandre.belloni, thomas.petazzoni, zmxu,
	jszhang, linux-arm-kernel, linux-usb, devicetree, linux-kernel

Add a reset controller for Marvell Berlin SoCs which is used by the
USB PHYs drivers (for now).

Signed-off-by: Antoine Tenart <antoine.tenart@free-electrons.com>
Signed-off-by: Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com>
Acked-by: Philipp Zabel <p.zabel@pengutronix.de>
---
 drivers/reset/Makefile       |   1 +
 drivers/reset/reset-berlin.c | 131 +++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 132 insertions(+)
 create mode 100644 drivers/reset/reset-berlin.c

diff --git a/drivers/reset/Makefile b/drivers/reset/Makefile
index 60fed3d7820b..157d421f755b 100644
--- a/drivers/reset/Makefile
+++ b/drivers/reset/Makefile
@@ -1,4 +1,5 @@
 obj-$(CONFIG_RESET_CONTROLLER) += core.o
 obj-$(CONFIG_ARCH_SOCFPGA) += reset-socfpga.o
+obj-$(CONFIG_ARCH_BERLIN) += reset-berlin.o
 obj-$(CONFIG_ARCH_SUNXI) += reset-sunxi.o
 obj-$(CONFIG_ARCH_STI) += sti/
diff --git a/drivers/reset/reset-berlin.c b/drivers/reset/reset-berlin.c
new file mode 100644
index 000000000000..f8b48a13cf0b
--- /dev/null
+++ b/drivers/reset/reset-berlin.c
@@ -0,0 +1,131 @@
+/*
+ * Copyright (C) 2014 Marvell Technology Group Ltd.
+ *
+ * Antoine Tenart <antoine.tenart@free-electrons.com>
+ * Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com>
+ *
+ * This file is licensed under the terms of the GNU General Public
+ * License version 2. This program is licensed "as is" without any
+ * warranty of any kind, whether express or implied.
+ */
+
+#include <linux/delay.h>
+#include <linux/io.h>
+#include <linux/module.h>
+#include <linux/of.h>
+#include <linux/of_address.h>
+#include <linux/platform_device.h>
+#include <linux/reset-controller.h>
+#include <linux/slab.h>
+#include <linux/types.h>
+
+#define BERLIN_MAX_RESETS	32
+
+#define to_berlin_reset_priv(p)		\
+	container_of((p), struct berlin_reset_priv, rcdev)
+
+struct berlin_reset_priv {
+	void __iomem			*base;
+	unsigned int			size;
+	struct reset_controller_dev	rcdev;
+};
+
+static int berlin_reset_reset(struct reset_controller_dev *rcdev,
+			      unsigned long id)
+{
+	struct berlin_reset_priv *priv = to_berlin_reset_priv(rcdev);
+	int offset = id >> 8;
+	int mask = BIT(id & 0x1f);
+
+	writel(mask, priv->base + offset);
+
+	/* let the reset be effective */
+	udelay(10);
+
+	return 0;
+}
+
+static struct reset_control_ops berlin_reset_ops = {
+	.reset	= berlin_reset_reset,
+};
+
+static int berlin_reset_xlate(struct reset_controller_dev *rcdev,
+			      const struct of_phandle_args *reset_spec)
+{
+	struct berlin_reset_priv *priv = to_berlin_reset_priv(rcdev);
+	unsigned offset, bit;
+
+	if (WARN_ON(reset_spec->args_count != rcdev->of_reset_n_cells))
+		return -EINVAL;
+
+	offset = reset_spec->args[0];
+	bit = reset_spec->args[1];
+
+	if (offset >= priv->size)
+		return -EINVAL;
+
+	if (bit >= BERLIN_MAX_RESETS)
+		return -EINVAL;
+
+	return (offset << 8) | bit;
+}
+
+static int __berlin_reset_init(struct device_node *np)
+{
+	struct berlin_reset_priv *priv;
+	struct resource res;
+	resource_size_t size;
+	int ret;
+
+	priv = kzalloc(sizeof(*priv), GFP_KERNEL);
+	if (!priv)
+		return -ENOMEM;
+
+	ret = of_address_to_resource(np, 0, &res);
+	if (ret)
+		goto err;
+
+	size = resource_size(&res);
+	priv->base = ioremap(res.start, size);
+	if (!priv->base) {
+		ret = -ENOMEM;
+		goto err;
+	}
+	priv->size = size;
+
+	priv->rcdev.owner = THIS_MODULE;
+	priv->rcdev.ops = &berlin_reset_ops;
+	priv->rcdev.of_node = np;
+	priv->rcdev.of_reset_n_cells = 2;
+	priv->rcdev.of_xlate = berlin_reset_xlate;
+
+	reset_controller_register(&priv->rcdev);
+
+	return 0;
+
+err:
+	kfree(priv);
+	return ret;
+}
+
+static const struct of_device_id berlin_reset_of_match[] __initconst = {
+	{ .compatible = "marvell,berlin2-chip-ctrl" },
+	{ .compatible = "marvell,berlin2cd-chip-ctrl" },
+	{ .compatible = "marvell,berlin2q-chip-ctrl" },
+	{ },
+};
+
+static int __init berlin_reset_init(void)
+{
+	struct device_node *np;
+	int ret;
+
+	for_each_matching_node(np, berlin_reset_of_match) {
+		ret = __berlin_reset_init(np);
+		if (ret)
+			return ret;
+	}
+
+	return 0;
+}
+arch_initcall(berlin_reset_init);
-- 
1.9.1


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

* [PATCH v6 02/12] Documentation: bindings: add reset bindings docs for Marvell Berlin SoCs
  2014-09-23 10:27 [PATCH v6 00/12] ARM: berlin: USB support Antoine Tenart
  2014-09-23 10:27 ` [PATCH v6 01/12] reset: add the Berlin reset controller driver Antoine Tenart
@ 2014-09-23 10:27 ` Antoine Tenart
  2014-09-23 10:27 ` [PATCH v6 03/12] ARM: Berlin: select the reset controller Antoine Tenart
                   ` (9 subsequent siblings)
  11 siblings, 0 replies; 52+ messages in thread
From: Antoine Tenart @ 2014-09-23 10:27 UTC (permalink / raw)
  To: sebastian.hesselbarth, Peter.Chen, balbi, p.zabel
  Cc: Antoine Tenart, alexandre.belloni, thomas.petazzoni, zmxu,
	jszhang, linux-arm-kernel, linux-usb, devicetree, linux-kernel

Add the reset binding documentation to the SoC binding documentation as
the reset driver in Marvell Berlin SoC is part of the chip/system
control registers. This patch adds the required properties to configure
the reset controller.

Signed-off-by: Antoine Tenart <antoine.tenart@free-electrons.com>
Acked-by: Philipp Zabel <p.zabel@pengutronix.de>
---
 Documentation/devicetree/bindings/arm/marvell,berlin.txt | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/Documentation/devicetree/bindings/arm/marvell,berlin.txt b/Documentation/devicetree/bindings/arm/marvell,berlin.txt
index 904de5781f44..a99eb9eb14c0 100644
--- a/Documentation/devicetree/bindings/arm/marvell,berlin.txt
+++ b/Documentation/devicetree/bindings/arm/marvell,berlin.txt
@@ -106,11 +106,21 @@ Required subnode-properties:
 - groups: a list of strings describing the group names.
 - function: a string describing the function used to mux the groups.
 
+* Reset controller binding
+
+A reset controller is part of the chip control registers set. The chip control
+node also provides the reset. The register set is not at the same offset between
+Berlin SoCs.
+
+Required property:
+- #reset-cells: must be set to 2
+
 Example:
 
 chip: chip-control@ea0000 {
 	compatible = "marvell,berlin2-chip-ctrl";
 	#clock-cells = <1>;
+	#reset-cells = <2>;
 	reg = <0xea0000 0x400>;
 	clocks = <&refclk>, <&externaldev 0>;
 	clock-names = "refclk", "video_ext0";
-- 
1.9.1


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

* [PATCH v6 03/12] ARM: Berlin: select the reset controller
  2014-09-23 10:27 [PATCH v6 00/12] ARM: berlin: USB support Antoine Tenart
  2014-09-23 10:27 ` [PATCH v6 01/12] reset: add the Berlin reset controller driver Antoine Tenart
  2014-09-23 10:27 ` [PATCH v6 02/12] Documentation: bindings: add reset bindings docs for Marvell Berlin SoCs Antoine Tenart
@ 2014-09-23 10:27 ` Antoine Tenart
  2014-09-23 10:28 ` [PATCH v6 04/12] ARM: dts: berlin: add a required reset property in the chip controller node Antoine Tenart
                   ` (8 subsequent siblings)
  11 siblings, 0 replies; 52+ messages in thread
From: Antoine Tenart @ 2014-09-23 10:27 UTC (permalink / raw)
  To: sebastian.hesselbarth, Peter.Chen, balbi, p.zabel
  Cc: Antoine Tenart, alexandre.belloni, thomas.petazzoni, zmxu,
	jszhang, linux-arm-kernel, linux-usb, devicetree, linux-kernel

The Marvell Berlin SoCs now has a reset controller. Add the needed
configuration.

Signed-off-by: Antoine Tenart <antoine.tenart@free-electrons.com>
---
 arch/arm/mach-berlin/Kconfig | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/arch/arm/mach-berlin/Kconfig b/arch/arm/mach-berlin/Kconfig
index 24f85be71671..5803f773a065 100644
--- a/arch/arm/mach-berlin/Kconfig
+++ b/arch/arm/mach-berlin/Kconfig
@@ -1,11 +1,13 @@
 menuconfig ARCH_BERLIN
 	bool "Marvell Berlin SoCs" if ARCH_MULTI_V7
+	select ARCH_HAS_RESET_CONTROLLER
 	select ARCH_REQUIRE_GPIOLIB
 	select ARM_GIC
 	select GENERIC_IRQ_CHIP
 	select DW_APB_ICTL
 	select DW_APB_TIMER_OF
 	select PINCTRL
+	select RESET_CONTROLLER
 
 if ARCH_BERLIN
 
-- 
1.9.1


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

* [PATCH v6 04/12] ARM: dts: berlin: add a required reset property in the chip controller node
  2014-09-23 10:27 [PATCH v6 00/12] ARM: berlin: USB support Antoine Tenart
                   ` (2 preceding siblings ...)
  2014-09-23 10:27 ` [PATCH v6 03/12] ARM: Berlin: select the reset controller Antoine Tenart
@ 2014-09-23 10:28 ` Antoine Tenart
  2014-09-23 10:28 ` [PATCH v6 05/12] phy: add the Berlin USB PHY driver Antoine Tenart
                   ` (7 subsequent siblings)
  11 siblings, 0 replies; 52+ messages in thread
From: Antoine Tenart @ 2014-09-23 10:28 UTC (permalink / raw)
  To: sebastian.hesselbarth, Peter.Chen, balbi, p.zabel
  Cc: Antoine Tenart, alexandre.belloni, thomas.petazzoni, zmxu,
	jszhang, linux-arm-kernel, linux-usb, devicetree, linux-kernel

The chip controller node now also describes the Marvell Berlin reset
controller. Add the required 'reset-cells' property.

Signed-off-by: Antoine Tenart <antoine.tenart@free-electrons.com>
Acked-by: Philipp Zabel <p.zabel@pengutronix.de>
---
 arch/arm/boot/dts/berlin2.dtsi   | 1 +
 arch/arm/boot/dts/berlin2cd.dtsi | 1 +
 arch/arm/boot/dts/berlin2q.dtsi  | 1 +
 3 files changed, 3 insertions(+)

diff --git a/arch/arm/boot/dts/berlin2.dtsi b/arch/arm/boot/dts/berlin2.dtsi
index 9d7c810ebd0b..d7e81e124de0 100644
--- a/arch/arm/boot/dts/berlin2.dtsi
+++ b/arch/arm/boot/dts/berlin2.dtsi
@@ -249,6 +249,7 @@
 		chip: chip-control@ea0000 {
 			compatible = "marvell,berlin2-chip-ctrl";
 			#clock-cells = <1>;
+			#reset-cells = <2>;
 			reg = <0xea0000 0x400>;
 			clocks = <&refclk>;
 			clock-names = "refclk";
diff --git a/arch/arm/boot/dts/berlin2cd.dtsi b/arch/arm/boot/dts/berlin2cd.dtsi
index cc1df65da504..68f7032b4686 100644
--- a/arch/arm/boot/dts/berlin2cd.dtsi
+++ b/arch/arm/boot/dts/berlin2cd.dtsi
@@ -231,6 +231,7 @@
 		chip: chip-control@ea0000 {
 			compatible = "marvell,berlin2cd-chip-ctrl";
 			#clock-cells = <1>;
+			#reset-cells = <2>;
 			reg = <0xea0000 0x400>;
 			clocks = <&refclk>;
 			clock-names = "refclk";
diff --git a/arch/arm/boot/dts/berlin2q.dtsi b/arch/arm/boot/dts/berlin2q.dtsi
index 400c40fceccc..ffba5c3bdab8 100644
--- a/arch/arm/boot/dts/berlin2q.dtsi
+++ b/arch/arm/boot/dts/berlin2q.dtsi
@@ -332,6 +332,7 @@
 		chip: chip-control@ea0000 {
 			compatible = "marvell,berlin2q-chip-ctrl";
 			#clock-cells = <1>;
+			#reset-cells = <2>;
 			reg = <0xea0000 0x400>, <0xdd0170 0x10>;
 			clocks = <&refclk>;
 			clock-names = "refclk";
-- 
1.9.1


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

* [PATCH v6 05/12] phy: add the Berlin USB PHY driver
  2014-09-23 10:27 [PATCH v6 00/12] ARM: berlin: USB support Antoine Tenart
                   ` (3 preceding siblings ...)
  2014-09-23 10:28 ` [PATCH v6 04/12] ARM: dts: berlin: add a required reset property in the chip controller node Antoine Tenart
@ 2014-09-23 10:28 ` Antoine Tenart
  2014-09-23 10:28 ` [PATCH v6 06/12] Documentation: bindings: add doc for the Berlin USB PHY Antoine Tenart
                   ` (6 subsequent siblings)
  11 siblings, 0 replies; 52+ messages in thread
From: Antoine Tenart @ 2014-09-23 10:28 UTC (permalink / raw)
  To: sebastian.hesselbarth, Peter.Chen, balbi, p.zabel
  Cc: Antoine Tenart, alexandre.belloni, thomas.petazzoni, zmxu,
	jszhang, linux-arm-kernel, linux-usb, devicetree, linux-kernel

Add the driver driving the Marvell Berlin USB PHY. This allows to
initialize the PHY and to use it from the USB driver later.

Signed-off-by: Antoine Tenart <antoine.tenart@free-electrons.com>
---
 drivers/phy/Kconfig          |   7 ++
 drivers/phy/Makefile         |   1 +
 drivers/phy/phy-berlin-usb.c | 224 +++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 232 insertions(+)
 create mode 100644 drivers/phy/phy-berlin-usb.c

diff --git a/drivers/phy/Kconfig b/drivers/phy/Kconfig
index 0dd742719154..d1d73dd8c1fb 100644
--- a/drivers/phy/Kconfig
+++ b/drivers/phy/Kconfig
@@ -15,6 +15,13 @@ config GENERIC_PHY
 	  phy users can obtain reference to the PHY. All the users of this
 	  framework should select this config.
 
+config PHY_BERLIN_USB
+	tristate "Marvell Berlin USB PHY Driver"
+	depends on ARCH_BERLIN && HAS_IOMEM && OF
+	select GENERIC_PHY
+	help
+	  Enable this to support the USB PHY on Marvell Berlin SoCs.
+
 config PHY_BERLIN_SATA
 	tristate "Marvell Berlin SATA PHY driver"
 	depends on ARCH_BERLIN && HAS_IOMEM && OF
diff --git a/drivers/phy/Makefile b/drivers/phy/Makefile
index 95c69ed5ed45..b12e84b69c23 100644
--- a/drivers/phy/Makefile
+++ b/drivers/phy/Makefile
@@ -3,6 +3,7 @@
 #
 
 obj-$(CONFIG_GENERIC_PHY)		+= phy-core.o
+obj-$(CONFIG_PHY_BERLIN_USB)		+= phy-berlin-usb.o
 obj-$(CONFIG_PHY_BERLIN_SATA)		+= phy-berlin-sata.o
 obj-$(CONFIG_BCM_KONA_USB2_PHY)		+= phy-bcm-kona-usb2.o
 obj-$(CONFIG_PHY_EXYNOS_DP_VIDEO)	+= phy-exynos-dp-video.o
diff --git a/drivers/phy/phy-berlin-usb.c b/drivers/phy/phy-berlin-usb.c
new file mode 100644
index 000000000000..f9f13067f50f
--- /dev/null
+++ b/drivers/phy/phy-berlin-usb.c
@@ -0,0 +1,224 @@
+/*
+ * Copyright (C) 2014 Marvell Technology Group Ltd.
+ *
+ * Antoine Tenart <antoine.tenart@free-electrons.com>
+ * Jisheng Zhang <jszhang@marvell.com>
+ *
+ * This file is licensed under the terms of the GNU General Public
+ * License version 2. This program is licensed "as is" without any
+ * warranty of any kind, whether express or implied.
+ */
+
+#include <linux/gpio.h>
+#include <linux/io.h>
+#include <linux/module.h>
+#include <linux/of_device.h>
+#include <linux/of_gpio.h>
+#include <linux/phy/phy.h>
+#include <linux/platform_device.h>
+#include <linux/reset.h>
+
+#define USB_PHY_PLL		0x04
+#define USB_PHY_PLL_CONTROL	0x08
+#define USB_PHY_TX_CTRL0	0x10
+#define USB_PHY_TX_CTRL1	0x14
+#define USB_PHY_TX_CTRL2	0x18
+#define USB_PHY_RX_CTRL		0x20
+#define USB_PHY_ANALOG		0x34
+
+/* USB_PHY_PLL */
+#define CLK_REF_DIV(x)		((x) << 4)
+#define FEEDBACK_CLK_DIV(x)	((x) << 8)
+
+/* USB_PHY_PLL_CONTROL */
+#define CLK_STABLE		BIT(0)
+#define PLL_CTRL_PIN		BIT(1)
+#define PLL_CTRL_REG		BIT(2)
+#define PLL_ON			BIT(3)
+#define PHASE_OFF_TOL_125	(0x0 << 5)
+#define PHASE_OFF_TOL_250	BIT(5)
+#define KVC0_CALIB		(0x0 << 9)
+#define KVC0_REG_CTRL		BIT(9)
+#define KVC0_HIGH		(0x0 << 10)
+#define KVC0_LOW		(0x3 << 10)
+#define CLK_BLK_EN		BIT(13)
+
+/* USB_PHY_TX_CTRL0 */
+#define EXT_HS_RCAL_EN		BIT(3)
+#define EXT_FS_RCAL_EN		BIT(4)
+#define IMPCAL_VTH_DIV(x)	((x) << 5)
+#define EXT_RS_RCAL_DIV(x)	((x) << 8)
+#define EXT_FS_RCAL_DIV(x)	((x) << 12)
+
+/* USB_PHY_TX_CTRL1 */
+#define TX_VDD15_14		(0x0 << 4)
+#define TX_VDD15_15		BIT(4)
+#define TX_VDD15_16		(0x2 << 4)
+#define TX_VDD15_17		(0x3 << 4)
+#define TX_VDD12_VDD		(0x0 << 6)
+#define TX_VDD12_11		BIT(6)
+#define TX_VDD12_12		(0x2 << 6)
+#define TX_VDD12_13		(0x3 << 6)
+#define LOW_VDD_EN		BIT(8)
+#define TX_OUT_AMP(x)		((x) << 9)
+
+/* USB_PHY_TX_CTRL2 */
+#define TX_CHAN_CTRL_REG(x)	((x) << 0)
+#define DRV_SLEWRATE(x)		((x) << 4)
+#define IMP_CAL_FS_HS_DLY_0	(0x0 << 6)
+#define IMP_CAL_FS_HS_DLY_1	BIT(6)
+#define IMP_CAL_FS_HS_DLY_2	(0x2 << 6)
+#define IMP_CAL_FS_HS_DLY_3	(0x3 << 6)
+#define FS_DRV_EN_MASK(x)	((x) << 8)
+#define HS_DRV_EN_MASK(x)	((x) << 12)
+
+/* USB_PHY_RX_CTRL */
+#define PHASE_FREEZE_DLY_2_CL	(0x0 << 0)
+#define PHASE_FREEZE_DLY_4_CL	BIT(0)
+#define ACK_LENGTH_8_CL		(0x0 << 2)
+#define ACK_LENGTH_12_CL	BIT(2)
+#define ACK_LENGTH_16_CL	(0x2 << 2)
+#define ACK_LENGTH_20_CL	(0x3 << 2)
+#define SQ_LENGTH_3		(0x0 << 4)
+#define SQ_LENGTH_6		BIT(4)
+#define SQ_LENGTH_9		(0x2 << 4)
+#define SQ_LENGTH_12		(0x3 << 4)
+#define DISCON_THRESHOLD_260	(0x0 << 6)
+#define DISCON_THRESHOLD_270	BIT(6)
+#define DISCON_THRESHOLD_280	(0x2 << 6)
+#define DISCON_THRESHOLD_290	(0x3 << 6)
+#define SQ_THRESHOLD(x)		((x) << 8)
+#define LPF_COEF(x)		((x) << 12)
+#define INTPL_CUR_10		(0x0 << 14)
+#define INTPL_CUR_20		BIT(14)
+#define INTPL_CUR_30		(0x2 << 14)
+#define INTPL_CUR_40		(0x3 << 14)
+
+/* USB_PHY_ANALOG */
+#define ANA_PWR_UP		BIT(1)
+#define ANA_PWR_DOWN		BIT(2)
+#define V2I_VCO_RATIO(x)	((x) << 7)
+#define R_ROTATE_90		(0x0 << 10)
+#define R_ROTATE_0		BIT(10)
+#define MODE_TEST_EN		BIT(11)
+#define ANA_TEST_DC_CTRL(x)	((x) << 12)
+
+#define to_phy_berlin_usb_priv(p)	\
+	container_of((p), struct phy_berlin_usb_priv, phy)
+
+static const u32 phy_berlin_pll_dividers[] = {
+	/* Berlin 2 */
+	CLK_REF_DIV(0xc) | FEEDBACK_CLK_DIV(0x54),
+	/* Berlin 2CD */
+	CLK_REF_DIV(0x6) | FEEDBACK_CLK_DIV(0x55),
+};
+
+struct phy_berlin_usb_priv {
+	void __iomem		*base;
+	struct phy		*phy;
+	struct reset_control	*rst_ctrl;
+	u32			pll_divider;
+};
+
+static int phy_berlin_usb_power_on(struct phy *phy)
+{
+	struct phy_berlin_usb_priv *priv = dev_get_drvdata(phy->dev.parent);
+
+	reset_control_reset(priv->rst_ctrl);
+
+	writel(priv->pll_divider,
+	       priv->base + USB_PHY_PLL);
+	writel(CLK_STABLE | PLL_CTRL_REG | PHASE_OFF_TOL_250 | KVC0_REG_CTRL |
+	       CLK_BLK_EN, priv->base + USB_PHY_PLL_CONTROL);
+	writel(V2I_VCO_RATIO(0x5) | R_ROTATE_0 | ANA_TEST_DC_CTRL(0x5),
+	       priv->base + USB_PHY_ANALOG);
+	writel(PHASE_FREEZE_DLY_4_CL | ACK_LENGTH_16_CL | SQ_LENGTH_12 |
+	       DISCON_THRESHOLD_260 | SQ_THRESHOLD(0xa) | LPF_COEF(0x2) |
+	       INTPL_CUR_30, priv->base + USB_PHY_RX_CTRL);
+
+	writel(TX_VDD12_13 | TX_OUT_AMP(0x3), priv->base + USB_PHY_TX_CTRL1);
+	writel(EXT_HS_RCAL_EN | IMPCAL_VTH_DIV(0x3) | EXT_RS_RCAL_DIV(0x4),
+	       priv->base + USB_PHY_TX_CTRL0);
+
+	writel(EXT_HS_RCAL_EN | IMPCAL_VTH_DIV(0x3) | EXT_RS_RCAL_DIV(0x4) |
+	       EXT_FS_RCAL_DIV(0x2), priv->base + USB_PHY_TX_CTRL0);
+
+	writel(EXT_HS_RCAL_EN | IMPCAL_VTH_DIV(0x3) | EXT_RS_RCAL_DIV(0x4),
+	       priv->base + USB_PHY_TX_CTRL0);
+	writel(TX_CHAN_CTRL_REG(0xf) | DRV_SLEWRATE(0x3) | IMP_CAL_FS_HS_DLY_3 |
+	       FS_DRV_EN_MASK(0xd), priv->base + USB_PHY_TX_CTRL2);
+
+	return 0;
+}
+
+static struct phy_ops phy_berlin_usb_ops = {
+	.power_on	= phy_berlin_usb_power_on,
+	.owner		= THIS_MODULE,
+};
+
+static const struct of_device_id phy_berlin_sata_of_match[] = {
+	{
+		.compatible = "marvell,berlin2-usb-phy",
+		.data = &phy_berlin_pll_dividers[0],
+	},
+	{
+		.compatible = "marvell,berlin2cd-usb-phy",
+		.data = &phy_berlin_pll_dividers[1],
+	},
+	{ },
+};
+MODULE_DEVICE_TABLE(of, phy_berlin_sata_of_match);
+
+static int phy_berlin_usb_probe(struct platform_device *pdev)
+{
+	const struct of_device_id *match =
+		of_match_device(phy_berlin_sata_of_match, &pdev->dev);
+	struct phy_berlin_usb_priv *priv;
+	struct resource *res;
+	struct phy_provider *phy_provider;
+
+	priv = devm_kzalloc(&pdev->dev, sizeof(*priv), GFP_KERNEL);
+	if (!priv)
+		return -ENOMEM;
+
+	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
+	priv->base = devm_ioremap_resource(&pdev->dev, res);
+	if (IS_ERR(priv->base))
+		return PTR_ERR(priv->base);
+
+	priv->rst_ctrl = devm_reset_control_get(&pdev->dev, NULL);
+	if (IS_ERR(priv->rst_ctrl))
+		return PTR_ERR(priv->rst_ctrl);
+
+	priv->pll_divider = *((u32 *)match->data);
+
+	priv->phy = devm_phy_create(&pdev->dev, NULL, &phy_berlin_usb_ops,
+				    NULL);
+	if (IS_ERR(priv->phy)) {
+		dev_err(&pdev->dev, "failed to create PHY\n");
+		return PTR_ERR(priv->phy);
+	}
+
+	platform_set_drvdata(pdev, priv);
+
+	phy_provider =
+		devm_of_phy_provider_register(&pdev->dev, of_phy_simple_xlate);
+	if (IS_ERR(phy_provider))
+		return PTR_ERR(phy_provider);
+
+	return 0;
+}
+
+static struct platform_driver phy_berlin_usb_driver = {
+	.probe	= phy_berlin_usb_probe,
+	.driver	= {
+		.name		= "phy-berlin-usb",
+		.owner		= THIS_MODULE,
+		.of_match_table	= phy_berlin_sata_of_match,
+	 },
+};
+module_platform_driver(phy_berlin_usb_driver);
+
+MODULE_AUTHOR("Antoine Tenart <antoine.tenart@free-electrons.com>");
+MODULE_DESCRIPTION("Marvell Berlin PHY driver for USB");
+MODULE_LICENSE("GPL");
-- 
1.9.1


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

* [PATCH v6 06/12] Documentation: bindings: add doc for the Berlin USB PHY
  2014-09-23 10:27 [PATCH v6 00/12] ARM: berlin: USB support Antoine Tenart
                   ` (4 preceding siblings ...)
  2014-09-23 10:28 ` [PATCH v6 05/12] phy: add the Berlin USB PHY driver Antoine Tenart
@ 2014-09-23 10:28 ` Antoine Tenart
  2014-09-23 10:28 ` [PATCH v6 07/12] usb: chipidea: add a usb2 driver for ci13xxx Antoine Tenart
                   ` (5 subsequent siblings)
  11 siblings, 0 replies; 52+ messages in thread
From: Antoine Tenart @ 2014-09-23 10:28 UTC (permalink / raw)
  To: sebastian.hesselbarth, Peter.Chen, balbi, p.zabel
  Cc: Antoine Tenart, alexandre.belloni, thomas.petazzoni, zmxu,
	jszhang, linux-arm-kernel, linux-usb, devicetree, linux-kernel

Document the bindings of the Marvell Berlin USB PHY driver.

Signed-off-by: Antoine Tenart <antoine.tenart@free-electrons.com>
---
 Documentation/devicetree/bindings/phy/berlin-usb-phy.txt | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/phy/berlin-usb-phy.txt

diff --git a/Documentation/devicetree/bindings/phy/berlin-usb-phy.txt b/Documentation/devicetree/bindings/phy/berlin-usb-phy.txt
new file mode 100644
index 000000000000..be33780f668e
--- /dev/null
+++ b/Documentation/devicetree/bindings/phy/berlin-usb-phy.txt
@@ -0,0 +1,16 @@
+* Marvell Berlin USB PHY
+
+Required properties:
+- compatible: "marvell,berlin2-usb-phy" or "marvell,berlin2cd-usb-phy"
+- reg: base address and length of the registers
+- #phys-cells: should be 0
+- resets: reference to the reset controller
+
+Example:
+
+	usb-phy@f774000 {
+		compatible = "marvell,berlin2-usb-phy";
+		reg = <0xf774000 0x128>;
+		#phy-cells = <0>;
+		resets = <&chip 0x104 14>;
+	};
-- 
1.9.1


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

* [PATCH v6 07/12] usb: chipidea: add a usb2 driver for ci13xxx
  2014-09-23 10:27 [PATCH v6 00/12] ARM: berlin: USB support Antoine Tenart
                   ` (5 preceding siblings ...)
  2014-09-23 10:28 ` [PATCH v6 06/12] Documentation: bindings: add doc for the Berlin USB PHY Antoine Tenart
@ 2014-09-23 10:28 ` Antoine Tenart
  2014-09-23 10:39   ` Arnd Bergmann
                     ` (5 more replies)
  2014-09-23 10:28 ` [PATCH v6 08/12] Documentation: bindings: add doc for the USB2 ChipIdea USB driver Antoine Tenart
                   ` (4 subsequent siblings)
  11 siblings, 6 replies; 52+ messages in thread
From: Antoine Tenart @ 2014-09-23 10:28 UTC (permalink / raw)
  To: sebastian.hesselbarth, Peter.Chen, balbi, p.zabel
  Cc: Antoine Tenart, alexandre.belloni, thomas.petazzoni, zmxu,
	jszhang, linux-arm-kernel, linux-usb, devicetree, linux-kernel

Add a USB2 ChipIdea driver for ci13xxx, with optional PHY, clock
and DMA mask, to support USB2 ChipIdea controllers that don't need
specific functions.

Tested on the Marvell Berlin SoCs USB controllers.

Signed-off-by: Antoine Tenart <antoine.tenart@free-electrons.com>
---
 drivers/usb/chipidea/Makefile       |   1 +
 drivers/usb/chipidea/ci_hdrc_usb2.c | 138 ++++++++++++++++++++++++++++++++++++
 2 files changed, 139 insertions(+)
 create mode 100644 drivers/usb/chipidea/ci_hdrc_usb2.c

diff --git a/drivers/usb/chipidea/Makefile b/drivers/usb/chipidea/Makefile
index 2f099c7df7b5..1fc86a2ca22d 100644
--- a/drivers/usb/chipidea/Makefile
+++ b/drivers/usb/chipidea/Makefile
@@ -10,6 +10,7 @@ ci_hdrc-$(CONFIG_USB_OTG_FSM)		+= otg_fsm.o
 
 # Glue/Bridge layers go here
 
+obj-$(CONFIG_USB_CHIPIDEA)	+= ci_hdrc_usb2.o
 obj-$(CONFIG_USB_CHIPIDEA)	+= ci_hdrc_msm.o
 obj-$(CONFIG_USB_CHIPIDEA)	+= ci_hdrc_zevio.o
 
diff --git a/drivers/usb/chipidea/ci_hdrc_usb2.c b/drivers/usb/chipidea/ci_hdrc_usb2.c
new file mode 100644
index 000000000000..6eae1de587f2
--- /dev/null
+++ b/drivers/usb/chipidea/ci_hdrc_usb2.c
@@ -0,0 +1,138 @@
+/*
+ * Copyright (C) 2014 Marvell Technology Group Ltd.
+ *
+ * Antoine Tenart <antoine.tenart@free-electrons.com>
+ *
+ * This file is licensed under the terms of the GNU General Public
+ * License version 2. This program is licensed "as is" without any
+ * warranty of any kind, whether express or implied.
+ */
+
+#include <linux/clk.h>
+#include <linux/dma-mapping.h>
+#include <linux/module.h>
+#include <linux/of.h>
+#include <linux/phy/phy.h>
+#include <linux/platform_device.h>
+#include <linux/usb/chipidea.h>
+#include <linux/usb/hcd.h>
+#include <linux/usb/ulpi.h>
+
+#include "ci.h"
+
+struct ci_hdrc_usb2_priv {
+	struct platform_device	*ci_pdev;
+	struct clk		*clk;
+};
+
+static int ci_hdrc_usb2_dt_probe(struct device *dev,
+				 struct ci_hdrc_platform_data *ci_pdata)
+{
+	ci_pdata->phy = of_phy_get(dev->of_node, 0);
+	if (IS_ERR(ci_pdata->phy)) {
+		if (PTR_ERR(ci_pdata->phy) == -EPROBE_DEFER)
+			return -EPROBE_DEFER;
+
+		/* PHY is optional */
+		ci_pdata->phy = NULL;
+	}
+
+	return 0;
+}
+
+static struct ci_hdrc_platform_data ci_default_pdata = {
+	.capoffset	= DEF_CAPOFFSET,
+	.flags		= CI_HDRC_REQUIRE_TRANSCEIVER |
+			  CI_HDRC_DISABLE_STREAMING,
+};
+
+static int ci_hdrc_usb2_probe(struct platform_device *pdev)
+{
+	struct device *dev = &pdev->dev;
+	struct ci_hdrc_usb2_priv *priv;
+	struct ci_hdrc_platform_data *ci_pdata = dev_get_platdata(&pdev->dev);
+	int ret;
+
+	if (!ci_pdata)
+		ci_pdata = &ci_default_pdata;
+
+	priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL);
+	if (!priv)
+		return -ENOMEM;
+
+	priv->clk = devm_clk_get(dev, NULL);
+	if (!IS_ERR(priv->clk)) {
+		ret = clk_prepare_enable(priv->clk);
+		if (ret) {
+			dev_err(dev, "failed to enable the clock: %d\n", ret);
+			return ret;
+		}
+	}
+
+	if (dev->of_node) {
+		ret = ci_hdrc_usb2_dt_probe(dev, ci_pdata);
+		if (ret)
+			goto clk_err;
+	} else {
+		ret = dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(32));
+		if (ret)
+			goto clk_err;
+	}
+
+	ci_pdata->name = dev_name(&pdev->dev);
+
+	priv->ci_pdev = ci_hdrc_add_device(dev, pdev->resource,
+					   pdev->num_resources, ci_pdata);
+	if (IS_ERR(priv->ci_pdev)) {
+		ret = PTR_ERR(priv->ci_pdev);
+		if (ret != -EPROBE_DEFER)
+			dev_err(dev,
+				"failed to register ci_hdrc platform device: %d\n",
+				ret);
+		goto clk_err;
+	}
+
+	platform_set_drvdata(pdev, priv);
+
+	pm_runtime_no_callbacks(dev);
+	pm_runtime_enable(dev);
+
+	return 0;
+
+clk_err:
+	if (!IS_ERR(priv->clk))
+		clk_disable_unprepare(priv->clk);
+	return ret;
+}
+
+static int ci_hdrc_usb2_remove(struct platform_device *pdev)
+{
+	struct ci_hdrc_usb2_priv *priv = platform_get_drvdata(pdev);
+
+	pm_runtime_disable(&pdev->dev);
+	ci_hdrc_remove_device(priv->ci_pdev);
+	clk_disable_unprepare(priv->clk);
+
+	return 0;
+}
+
+static const struct of_device_id ci_hdrc_usb2_of_match[] = {
+	{ .compatible = "chipidea,usb2" },
+	{ }
+};
+MODULE_DEVICE_TABLE(of, ci_hdrc_usb2_of_match);
+
+static struct platform_driver ci_hdrc_usb2_driver = {
+	.probe	= ci_hdrc_usb2_probe,
+	.remove	= ci_hdrc_usb2_remove,
+	.driver	= {
+		.name		= "chipidea-usb2",
+		.owner		= THIS_MODULE,
+		.of_match_table	= of_match_ptr(ci_hdrc_usb2_of_match),
+	},
+};
+module_platform_driver(ci_hdrc_usb2_driver);
+
+MODULE_DESCRIPTION("ChipIdea HDRC USB2 binding for ci13xxx");
+MODULE_AUTHOR("Antoine Tenart <antoine.tenart@free-electrons.com>");
+MODULE_LICENSE("GPL");
-- 
1.9.1


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

* [PATCH v6 08/12] Documentation: bindings: add doc for the USB2 ChipIdea USB driver
  2014-09-23 10:27 [PATCH v6 00/12] ARM: berlin: USB support Antoine Tenart
                   ` (6 preceding siblings ...)
  2014-09-23 10:28 ` [PATCH v6 07/12] usb: chipidea: add a usb2 driver for ci13xxx Antoine Tenart
@ 2014-09-23 10:28 ` Antoine Tenart
  2014-09-23 10:28 ` [PATCH v6 09/12] ARM: dts: berlin: add BG2Q nodes for USB support Antoine Tenart
                   ` (3 subsequent siblings)
  11 siblings, 0 replies; 52+ messages in thread
From: Antoine Tenart @ 2014-09-23 10:28 UTC (permalink / raw)
  To: sebastian.hesselbarth, Peter.Chen, balbi, p.zabel
  Cc: Antoine Tenart, alexandre.belloni, thomas.petazzoni, zmxu,
	jszhang, linux-arm-kernel, linux-usb, devicetree, linux-kernel

Document the USB2 ChipIdea driver (ci13xxx) bindings.

Signed-off-by: Antoine Tenart <antoine.tenart@free-electrons.com>
---
 .../devicetree/bindings/usb/ci-hdrc-usb2.txt       | 22 ++++++++++++++++++++++
 1 file changed, 22 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/usb/ci-hdrc-usb2.txt

diff --git a/Documentation/devicetree/bindings/usb/ci-hdrc-usb2.txt b/Documentation/devicetree/bindings/usb/ci-hdrc-usb2.txt
new file mode 100644
index 000000000000..8dd6d8285dab
--- /dev/null
+++ b/Documentation/devicetree/bindings/usb/ci-hdrc-usb2.txt
@@ -0,0 +1,22 @@
+* USB2 ChipIdea USB controller for ci13xxx
+
+Required properties:
+- compatible: should be "chipidea,usb2"
+- reg: base address and length of the registers
+- interrupts: interrupt for the USB controller
+
+Optional properties:
+- clocks: reference to the USB clock
+- phys: reference to the USB PHY
+- vbus-supply: reference to the VBUS regulator
+
+Example:
+
+	usb@f7ed0000 {
+		compatible = "chipidea,usb2";
+		reg = <0xf7ed0000 0x10000>;
+		interrupts = <GIC_SPI 11 IRQ_TYPE_LEVEL_HIGH>;
+		clocks = <&chip CLKID_USB0>;
+		phys = <&usb_phy0>;
+		vbus-supply = <&reg_usb0_vbus>;
+	};
-- 
1.9.1


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

* [PATCH v6 09/12] ARM: dts: berlin: add BG2Q nodes for USB support
  2014-09-23 10:27 [PATCH v6 00/12] ARM: berlin: USB support Antoine Tenart
                   ` (7 preceding siblings ...)
  2014-09-23 10:28 ` [PATCH v6 08/12] Documentation: bindings: add doc for the USB2 ChipIdea USB driver Antoine Tenart
@ 2014-09-23 10:28 ` Antoine Tenart
  2014-09-23 10:28 ` [PATCH v6 10/12] ARM: dts: Berlin: enable USB on the BG2Q DMP Antoine Tenart
                   ` (2 subsequent siblings)
  11 siblings, 0 replies; 52+ messages in thread
From: Antoine Tenart @ 2014-09-23 10:28 UTC (permalink / raw)
  To: sebastian.hesselbarth, Peter.Chen, balbi, p.zabel
  Cc: Antoine Tenart, alexandre.belloni, thomas.petazzoni, zmxu,
	jszhang, linux-arm-kernel, linux-usb, devicetree, linux-kernel

Adds nodes describing the Marvell Berlin BG2Q USB PHY and USB. The BG2Q
SoC has 3 USB host controller, compatible with ChipIdea.

Signed-off-by: Antoine Tenart <antoine.tenart@free-electrons.com>
---
 arch/arm/boot/dts/berlin2q.dtsi | 52 +++++++++++++++++++++++++++++++++++++++++
 1 file changed, 52 insertions(+)

diff --git a/arch/arm/boot/dts/berlin2q.dtsi b/arch/arm/boot/dts/berlin2q.dtsi
index ffba5c3bdab8..faf7cbe2af20 100644
--- a/arch/arm/boot/dts/berlin2q.dtsi
+++ b/arch/arm/boot/dts/berlin2q.dtsi
@@ -114,6 +114,39 @@
 			#interrupt-cells = <3>;
 		};
 
+		usb_phy2: phy@a2f400 {
+			compatible = "marvell,berlin2-usb-phy";
+			reg = <0xa2f400 0x128>;
+			#phy-cells = <0>;
+			resets = <&chip 0x104 14>;
+			status = "disabled";
+		};
+
+		usb2: usb@a30000 {
+			compatible = "chipidea,usb2";
+			reg = <0xa30000 0x10000>;
+			interrupts = <GIC_SPI 52 IRQ_TYPE_LEVEL_HIGH>;
+			clocks = <&chip CLKID_USB2>;
+			phys = <&usb_phy2>;
+			status = "disabled";
+		};
+
+		usb_phy0: phy@b74000 {
+			compatible = "marvell,berlin2-usb-phy";
+			reg = <0xb74000 0x128>;
+			#phy-cells = <0>;
+			resets = <&chip 0x104 12>;
+			status = "disabled";
+		};
+
+		usb_phy1: phy@b78000 {
+			compatible = "marvell,berlin2-usb-phy";
+			reg = <0xb78000 0x128>;
+			#phy-cells = <0>;
+			resets = <&chip 0x104 13>;
+			status = "disabled";
+		};
+
 		cpu-ctrl@dd0000 {
 			compatible = "marvell,berlin-cpu-ctrl";
 			reg = <0xdd0000 0x10000>;
@@ -348,6 +381,24 @@
 			};
 		};
 
+		usb0: usb@ed0000 {
+			compatible = "chipidea,usb2";
+			reg = <0xed0000 0x10000>;
+			interrupts = <GIC_SPI 11 IRQ_TYPE_LEVEL_HIGH>;
+			clocks = <&chip CLKID_USB0>;
+			phys = <&usb_phy0>;
+			status = "disabled";
+		};
+
+		usb1: usb@ee0000 {
+			compatible = "chipidea,usb2";
+			reg = <0xee0000 0x10000>;
+			interrupts = <GIC_SPI 12 IRQ_TYPE_LEVEL_HIGH>;
+			clocks = <&chip CLKID_USB1>;
+			phys = <&usb_phy1>;
+			status = "disabled";
+		};
+
 		apb@fc0000 {
 			compatible = "simple-bus";
 			#address-cells = <1>;
@@ -440,5 +491,6 @@
 				interrupts = <GIC_SPI 15 IRQ_TYPE_LEVEL_HIGH>;
 			};
 		};
+
 	};
 };
-- 
1.9.1


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

* [PATCH v6 10/12] ARM: dts: Berlin: enable USB on the BG2Q DMP
  2014-09-23 10:27 [PATCH v6 00/12] ARM: berlin: USB support Antoine Tenart
                   ` (8 preceding siblings ...)
  2014-09-23 10:28 ` [PATCH v6 09/12] ARM: dts: berlin: add BG2Q nodes for USB support Antoine Tenart
@ 2014-09-23 10:28 ` Antoine Tenart
  2014-09-23 10:28 ` [PATCH v6 11/12] ARM: dts: berlin: add BG2CD nodes for USB support Antoine Tenart
  2014-09-23 10:28 ` [PATCH v6 12/12] ARM: dts: berlin: enable USB on the Google Chromecast Antoine Tenart
  11 siblings, 0 replies; 52+ messages in thread
From: Antoine Tenart @ 2014-09-23 10:28 UTC (permalink / raw)
  To: sebastian.hesselbarth, Peter.Chen, balbi, p.zabel
  Cc: Antoine Tenart, alexandre.belloni, thomas.petazzoni, zmxu,
	jszhang, linux-arm-kernel, linux-usb, devicetree, linux-kernel

Enable the 2 available USB PHY and USB nodes on the Marvell Berlin BG2Q
DMP.

Signed-off-by: Antoine Tenart <antoine.tenart@free-electrons.com>
---
 arch/arm/boot/dts/berlin2q-marvell-dmp.dts | 53 ++++++++++++++++++++++++++++++
 1 file changed, 53 insertions(+)

diff --git a/arch/arm/boot/dts/berlin2q-marvell-dmp.dts b/arch/arm/boot/dts/berlin2q-marvell-dmp.dts
index a357ce02a64e..663aedb173e0 100644
--- a/arch/arm/boot/dts/berlin2q-marvell-dmp.dts
+++ b/arch/arm/boot/dts/berlin2q-marvell-dmp.dts
@@ -7,6 +7,8 @@
  */
 
 /dts-v1/;
+
+#include <dt-bindings/gpio/gpio.h>
 #include "berlin2q.dtsi"
 
 / {
@@ -21,6 +23,39 @@
 	choosen {
 		bootargs = "console=ttyS0,115200 earlyprintk";
 	};
+
+	regulators {
+		compatible = "simple-bus";
+		#address-cells = <1>;
+		#size-cells = <0>;
+
+		reg_usb0_vbus: regulator@0 {
+			compatible = "regulator-fixed";
+			regulator-name = "usb0_vbus";
+			regulator-min-microvolt = <5000000>;
+			regulator-max-microvolt = <5000000>;
+			gpio = <&portb 8 GPIO_ACTIVE_HIGH>;
+			enable-active-high;
+		};
+
+		reg_usb1_vbus: regulator@1 {
+			compatible = "regulator-fixed";
+			regulator-name = "usb1_vbus";
+			regulator-min-microvolt = <5000000>;
+			regulator-max-microvolt = <5000000>;
+			gpio = <&portb 10 GPIO_ACTIVE_HIGH>;
+			enable-active-high;
+		};
+
+		reg_usb2_vbus: regulator@2 {
+			compatible = "regulator-fixed";
+			regulator-name = "usb2_vbus";
+			regulator-min-microvolt = <5000000>;
+			regulator-max-microvolt = <5000000>;
+			gpio = <&portb 12 GPIO_ACTIVE_HIGH>;
+			enable-active-high;
+		};
+	};
 };
 
 &sdhci1 {
@@ -45,3 +80,21 @@
 &uart0 {
 	status = "okay";
 };
+
+&usb_phy0 {
+	status = "okay";
+};
+
+&usb_phy2 {
+	status = "okay";
+};
+
+&usb0 {
+	vbus-supply = <&reg_usb0_vbus>;
+	status = "okay";
+};
+
+&usb2 {
+	vbus-supply = <&reg_usb2_vbus>;
+	status = "okay";
+};
-- 
1.9.1


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

* [PATCH v6 11/12] ARM: dts: berlin: add BG2CD nodes for USB support
  2014-09-23 10:27 [PATCH v6 00/12] ARM: berlin: USB support Antoine Tenart
                   ` (9 preceding siblings ...)
  2014-09-23 10:28 ` [PATCH v6 10/12] ARM: dts: Berlin: enable USB on the BG2Q DMP Antoine Tenart
@ 2014-09-23 10:28 ` Antoine Tenart
  2014-09-23 10:28 ` [PATCH v6 12/12] ARM: dts: berlin: enable USB on the Google Chromecast Antoine Tenart
  11 siblings, 0 replies; 52+ messages in thread
From: Antoine Tenart @ 2014-09-23 10:28 UTC (permalink / raw)
  To: sebastian.hesselbarth, Peter.Chen, balbi, p.zabel
  Cc: alexandre.belloni, thomas.petazzoni, zmxu, jszhang,
	linux-arm-kernel, linux-usb, devicetree, linux-kernel,
	Antoine Tenart

From: Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com>

Adds nodes describing the Marvell Berlin BG2CD USB PHY and USB. The BG2CD
SoC has 2 USB ChipIdea controllers, with usb0 host-only and usb1 dual-role
capable.

Signed-off-by: Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com>
Signed-off-by: Antoine Tenart <antoine.tenart@free-electrons.com>
---
 arch/arm/boot/dts/berlin2cd.dtsi | 34 ++++++++++++++++++++++++++++++++++
 1 file changed, 34 insertions(+)

diff --git a/arch/arm/boot/dts/berlin2cd.dtsi b/arch/arm/boot/dts/berlin2cd.dtsi
index 68f7032b4686..5c6950531327 100644
--- a/arch/arm/boot/dts/berlin2cd.dtsi
+++ b/arch/arm/boot/dts/berlin2cd.dtsi
@@ -66,6 +66,22 @@
 			clocks = <&chip CLKID_TWD>;
 		};
 
+		usb_phy0: usb-phy@b74000 {
+			compatible = "marvell,berlin2cd-usb-phy";
+			reg = <0xb74000 0x128>;
+			#phy-cells = <0>;
+			resets = <&chip 0x178 23>;
+			status = "disabled";
+		};
+
+		usb_phy1: usb-phy@b78000 {
+			compatible = "marvell,berlin2cd-usb-phy";
+			reg = <0xb78000 0x128>;
+			#phy-cells = <0>;
+			resets = <&chip 0x178 24>;
+			status = "disabled";
+		};
+
 		apb@e80000 {
 			compatible = "simple-bus";
 			#address-cells = <1>;
@@ -242,6 +258,24 @@
 			};
 		};
 
+		usb0: usb@ed0000 {
+			compatible = "chipidea,usb2";
+			reg = <0xed0000 0x200>;
+			interrupts = <GIC_SPI 11 IRQ_TYPE_LEVEL_HIGH>;
+			clocks = <&chip CLKID_USB0>;
+			usb-phy = <&usb_phy0>;
+			status = "disabled";
+		};
+
+		usb1: usb@ee0000 {
+			compatible = "chipidea,usb2";
+			reg = <0xee0000 0x200>;
+			interrupts = <GIC_SPI 12 IRQ_TYPE_LEVEL_HIGH>;
+			clocks = <&chip CLKID_USB1>;
+			usb-phy = <&usb_phy1>;
+			status = "disabled";
+		};
+
 		apb@fc0000 {
 			compatible = "simple-bus";
 			#address-cells = <1>;
-- 
1.9.1


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

* [PATCH v6 12/12] ARM: dts: berlin: enable USB on the Google Chromecast
  2014-09-23 10:27 [PATCH v6 00/12] ARM: berlin: USB support Antoine Tenart
                   ` (10 preceding siblings ...)
  2014-09-23 10:28 ` [PATCH v6 11/12] ARM: dts: berlin: add BG2CD nodes for USB support Antoine Tenart
@ 2014-09-23 10:28 ` Antoine Tenart
  11 siblings, 0 replies; 52+ messages in thread
From: Antoine Tenart @ 2014-09-23 10:28 UTC (permalink / raw)
  To: sebastian.hesselbarth, Peter.Chen, balbi, p.zabel
  Cc: alexandre.belloni, thomas.petazzoni, zmxu, jszhang,
	linux-arm-kernel, linux-usb, devicetree, linux-kernel,
	Antoine Tenart

From: Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com>

Enable usb1 on Google Chromecast which is connected to micro-USB
plug used for external power supply, too.

Signed-off-by: Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com>
Signed-off-by: Antoine Tenart <antoine.tenart@free-electrons.com>
---
 arch/arm/boot/dts/berlin2cd-google-chromecast.dts | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/arch/arm/boot/dts/berlin2cd-google-chromecast.dts b/arch/arm/boot/dts/berlin2cd-google-chromecast.dts
index bcd81ffc495d..5c42c3bfb613 100644
--- a/arch/arm/boot/dts/berlin2cd-google-chromecast.dts
+++ b/arch/arm/boot/dts/berlin2cd-google-chromecast.dts
@@ -27,3 +27,7 @@
 };
 
 &uart0 { status = "okay"; };
+
+&usb_phy1 { status = "okay"; };
+
+&usb1 { status = "okay"; };
-- 
1.9.1


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

* Re: [PATCH v6 07/12] usb: chipidea: add a usb2 driver for ci13xxx
  2014-09-23 10:28 ` [PATCH v6 07/12] usb: chipidea: add a usb2 driver for ci13xxx Antoine Tenart
@ 2014-09-23 10:39   ` Arnd Bergmann
  2014-09-23 13:36     ` Antoine Tenart
  2014-09-24 23:58   ` Sören Brinkmann
                     ` (4 subsequent siblings)
  5 siblings, 1 reply; 52+ messages in thread
From: Arnd Bergmann @ 2014-09-23 10:39 UTC (permalink / raw)
  To: linux-arm-kernel
  Cc: Antoine Tenart, sebastian.hesselbarth, Peter.Chen, balbi,
	p.zabel, thomas.petazzoni, zmxu, devicetree, linux-usb,
	linux-kernel, alexandre.belloni, jszhang

On Tuesday 23 September 2014 12:28:03 Antoine Tenart wrote:
> +       if (dev->of_node) {
> +               ret = ci_hdrc_usb2_dt_probe(dev, ci_pdata);
> +               if (ret)
> +                       goto clk_err;
> +       } else {
> +               ret = dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(32));
> +               if (ret)
> +                       goto clk_err;
> +       }
> 

Why do you care about the non-DT case here? I think it would be nicer to
open-code the ci_hdrc_usb2_dt_probe() function in here and remove
the dma_set_mask_and_coherent(), which should not even be necessary for
the case where you have a hardwired platform device.

	Arnd

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

* Re: [PATCH v6 07/12] usb: chipidea: add a usb2 driver for ci13xxx
  2014-09-23 10:39   ` Arnd Bergmann
@ 2014-09-23 13:36     ` Antoine Tenart
  2014-09-23 16:44       ` Arnd Bergmann
  0 siblings, 1 reply; 52+ messages in thread
From: Antoine Tenart @ 2014-09-23 13:36 UTC (permalink / raw)
  To: Arnd Bergmann
  Cc: linux-arm-kernel, Antoine Tenart, sebastian.hesselbarth,
	Peter.Chen, balbi, p.zabel, thomas.petazzoni, zmxu, devicetree,
	linux-usb, linux-kernel, alexandre.belloni, jszhang

Arnd,

On Tue, Sep 23, 2014 at 12:39:04PM +0200, Arnd Bergmann wrote:
> On Tuesday 23 September 2014 12:28:03 Antoine Tenart wrote:
> > +       if (dev->of_node) {
> > +               ret = ci_hdrc_usb2_dt_probe(dev, ci_pdata);
> > +               if (ret)
> > +                       goto clk_err;
> > +       } else {
> > +               ret = dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(32));
> > +               if (ret)
> > +                       goto clk_err;
> > +       }
> > 
> 
> Why do you care about the non-DT case here? I think it would be nicer to
> open-code the ci_hdrc_usb2_dt_probe() function in here and remove
> the dma_set_mask_and_coherent(), which should not even be necessary for
> the case where you have a hardwired platform device.
> 

I thought we agreed to call dma_set_mask_and_coherent():
http://lists.infradead.org/pipermail/linux-arm-kernel/2014-July/273335.html

I do not have a strong opinion on this as I only use the dt case for my
usage.


Antoine

-- 
Antoine Ténart, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com

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

* Re: [PATCH v6 07/12] usb: chipidea: add a usb2 driver for ci13xxx
  2014-09-23 13:36     ` Antoine Tenart
@ 2014-09-23 16:44       ` Arnd Bergmann
  2014-09-23 16:55         ` Felipe Balbi
  0 siblings, 1 reply; 52+ messages in thread
From: Arnd Bergmann @ 2014-09-23 16:44 UTC (permalink / raw)
  To: Antoine Tenart
  Cc: linux-arm-kernel, sebastian.hesselbarth, Peter.Chen, balbi,
	p.zabel, thomas.petazzoni, zmxu, devicetree, linux-usb,
	linux-kernel, alexandre.belloni, jszhang

On Tuesday 23 September 2014 15:36:45 Antoine Tenart wrote:
> On Tue, Sep 23, 2014 at 12:39:04PM +0200, Arnd Bergmann wrote:
> > On Tuesday 23 September 2014 12:28:03 Antoine Tenart wrote:
> > > +       if (dev->of_node) {
> > > +               ret = ci_hdrc_usb2_dt_probe(dev, ci_pdata);
> > > +               if (ret)
> > > +                       goto clk_err;
> > > +       } else {
> > > +               ret = dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(32));
> > > +               if (ret)
> > > +                       goto clk_err;
> > > +       }
> > > 
> > 
> > Why do you care about the non-DT case here? I think it would be nicer to
> > open-code the ci_hdrc_usb2_dt_probe() function in here and remove
> > the dma_set_mask_and_coherent(), which should not even be necessary for
> > the case where you have a hardwired platform device.
> > 
> 
> I thought we agreed to call dma_set_mask_and_coherent():
> http://lists.infradead.org/pipermail/linux-arm-kernel/2014-July/273335.html
> 
> I do not have a strong opinion on this as I only use the dt case for my
> usage.

The question is more about who actually wants the non-DT case.

Since this is a new driver, I suspect that the answer is "nobody",
as the existing board files are all for legacy platforms that we
are not going to adapt for this driver.

I see in the thread that at least Peter Chen was assuming the non-DT
case was still needed, but I can't find a reason for this in the code.
If we no longer care about that, the call to dev_get_platdata()
can also get removed.

Looking through the code some more, I also notice that it's using
a strange way of doing the abstraction: ci_hdrc_add_device()
actually creates a child device node, while the preferred way would
be to just call into ci_hdrc_probe(), or a generalized version of
that.
That should probably be changed, but can be done as a later cleanup.


	Arnd

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

* Re: [PATCH v6 07/12] usb: chipidea: add a usb2 driver for ci13xxx
  2014-09-23 16:44       ` Arnd Bergmann
@ 2014-09-23 16:55         ` Felipe Balbi
  2014-09-23 17:37           ` Arnd Bergmann
  0 siblings, 1 reply; 52+ messages in thread
From: Felipe Balbi @ 2014-09-23 16:55 UTC (permalink / raw)
  To: Arnd Bergmann
  Cc: Antoine Tenart, linux-arm-kernel, sebastian.hesselbarth,
	Peter.Chen, balbi, p.zabel, thomas.petazzoni, zmxu, devicetree,
	linux-usb, linux-kernel, alexandre.belloni, jszhang

[-- Attachment #1: Type: text/plain, Size: 1900 bytes --]

HI,

On Tue, Sep 23, 2014 at 06:44:40PM +0200, Arnd Bergmann wrote:
> On Tuesday 23 September 2014 15:36:45 Antoine Tenart wrote:
> > On Tue, Sep 23, 2014 at 12:39:04PM +0200, Arnd Bergmann wrote:
> > > On Tuesday 23 September 2014 12:28:03 Antoine Tenart wrote:
> > > > +       if (dev->of_node) {
> > > > +               ret = ci_hdrc_usb2_dt_probe(dev, ci_pdata);
> > > > +               if (ret)
> > > > +                       goto clk_err;
> > > > +       } else {
> > > > +               ret = dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(32));
> > > > +               if (ret)
> > > > +                       goto clk_err;
> > > > +       }
> > > > 
> > > 
> > > Why do you care about the non-DT case here? I think it would be nicer to
> > > open-code the ci_hdrc_usb2_dt_probe() function in here and remove
> > > the dma_set_mask_and_coherent(), which should not even be necessary for
> > > the case where you have a hardwired platform device.
> > > 
> > 
> > I thought we agreed to call dma_set_mask_and_coherent():
> > http://lists.infradead.org/pipermail/linux-arm-kernel/2014-July/273335.html
> > 
> > I do not have a strong opinion on this as I only use the dt case for my
> > usage.
> 
> The question is more about who actually wants the non-DT case.
> 
> Since this is a new driver, I suspect that the answer is "nobody",
> as the existing board files are all for legacy platforms that we
> are not going to adapt for this driver.

wait a minute... will the legacy platforms be adapted to DT and, thus,
to this driver in the future ? I really don't want to keep several
copies of chipidea driver just because there are still some legacy
platforms still using them. I have said in the past and will say again,
everybody should move to the generic chipidea driver at the earliest
opportunity so we avoid duplication of work.

-- 
balbi

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

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

* Re: [PATCH v6 07/12] usb: chipidea: add a usb2 driver for ci13xxx
  2014-09-23 16:55         ` Felipe Balbi
@ 2014-09-23 17:37           ` Arnd Bergmann
  2014-09-23 17:43             ` Felipe Balbi
  2014-09-24  2:27             ` Peter Chen
  0 siblings, 2 replies; 52+ messages in thread
From: Arnd Bergmann @ 2014-09-23 17:37 UTC (permalink / raw)
  To: balbi
  Cc: Antoine Tenart, linux-arm-kernel, sebastian.hesselbarth,
	Peter.Chen, p.zabel, thomas.petazzoni, zmxu, devicetree,
	linux-usb, linux-kernel, alexandre.belloni, jszhang

On Tuesday 23 September 2014 11:55:15 Felipe Balbi wrote:
> On Tue, Sep 23, 2014 at 06:44:40PM +0200, Arnd Bergmann wrote:
> > On Tuesday 23 September 2014 15:36:45 Antoine Tenart wrote:
> > > On Tue, Sep 23, 2014 at 12:39:04PM +0200, Arnd Bergmann wrote:
> > > > On Tuesday 23 September 2014 12:28:03 Antoine Tenart wrote:
> > > > > +       if (dev->of_node) {
> > > > > +               ret = ci_hdrc_usb2_dt_probe(dev, ci_pdata);
> > > > > +               if (ret)
> > > > > +                       goto clk_err;
> > > > > +       } else {
> > > > > +               ret = dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(32));
> > > > > +               if (ret)
> > > > > +                       goto clk_err;
> > > > > +       }
> > > > > 
> > > > 
> > > > Why do you care about the non-DT case here? I think it would be nicer to
> > > > open-code the ci_hdrc_usb2_dt_probe() function in here and remove
> > > > the dma_set_mask_and_coherent(), which should not even be necessary for
> > > > the case where you have a hardwired platform device.
> > > > 
> > > 
> > > I thought we agreed to call dma_set_mask_and_coherent():
> > > http://lists.infradead.org/pipermail/linux-arm-kernel/2014-July/273335.html
> > > 
> > > I do not have a strong opinion on this as I only use the dt case for my
> > > usage.
> > 
> > The question is more about who actually wants the non-DT case.
> > 
> > Since this is a new driver, I suspect that the answer is "nobody",
> > as the existing board files are all for legacy platforms that we
> > are not going to adapt for this driver.
> 
> wait a minute... will the legacy platforms be adapted to DT and, thus,
> to this driver in the future ? I really don't want to keep several
> copies of chipidea driver just because there are still some legacy
> platforms still using them. I have said in the past and will say again,
> everybody should move to the generic chipidea driver at the earliest
> opportunity so we avoid duplication of work.
> 

Sorry, my mistake. The intention that this new driver is meant to
replace the existing ones wasn't clear to me from the changelog,
and if I'd been involved in the discussion before, then I've forgotten
about it.

It absolutely makes sense to migrate to a common driver, and in that
case we should keep the platform_data handling and dma_set_mask_and_coherent()
call in there, so we can do the two conversions (migrating from platform
specific frontends to the generic one, and migrating from platform_data
to DT) on independent schedules. Eventually I'd like all of the existing
users of the platform_data path to move to DT, but that should not
hold up the other cleanup if it takes longer.

There is however still my point that we shouldn't have an extra platform
device that is not attached to the device node. I think the generic driver
should just be part of the common code, without an extra framework.
Something like the (entirely untested) patch below.

	Arnd

---
diff --git a/drivers/usb/chipidea/ci.h b/drivers/usb/chipidea/ci.h
index 9563cb56d564..a2b20c1342f1 100644
--- a/drivers/usb/chipidea/ci.h
+++ b/drivers/usb/chipidea/ci.h
@@ -207,6 +207,7 @@ struct ci_hdrc {
 	bool				id_event;
 	bool				b_sess_valid_event;
 	bool				imx28_write_fix;
+	struct clk			*clk;
 };
 
 static inline struct ci_role_driver *ci_role(struct ci_hdrc *ci)
diff --git a/drivers/usb/chipidea/ci_hdrc_usb2.c b/drivers/usb/chipidea/ci_hdrc_usb2.c
index 6eae1de587f2..03ef35997dd8 100644
--- a/drivers/usb/chipidea/ci_hdrc_usb2.c
+++ b/drivers/usb/chipidea/ci_hdrc_usb2.c
@@ -70,6 +70,7 @@ static int ci_hdrc_usb2_probe(struct platform_device *pdev)
 	}
 
 	if (dev->of_node) {
+		ret = ci_get_platdata(dev, platdata);
 		ret = ci_hdrc_usb2_dt_probe(dev, ci_pdata);
 		if (ret)
 			goto clk_err;
diff --git a/drivers/usb/chipidea/core.c b/drivers/usb/chipidea/core.c
index 619d13e29995..32613751e731 100644
--- a/drivers/usb/chipidea/core.c
+++ b/drivers/usb/chipidea/core.c
@@ -478,6 +478,15 @@ static int ci_get_platdata(struct device *dev,
 	if (of_usb_get_maximum_speed(dev->of_node) == USB_SPEED_FULL)
 		platdata->flags |= CI_HDRC_FORCE_FULLSPEED;
 
+	platdata->phy = of_phy_get(dev->of_node, 0);
+	if (IS_ERR(platdata->phy)) {
+		if (PTR_ERR(platdata->phy) == -EPROBE_DEFER)
+			return -EPROBE_DEFER;
+
+		/* PHY is optional */
+		platdata->phy = NULL;
+	}
+
 	return 0;
 }
 
@@ -559,6 +568,12 @@ static void ci_get_otg_capable(struct ci_hdrc *ci)
 		dev_dbg(ci->dev, "It is OTG capable controller\n");
 }
 
+static const struct ci_hdrc_platform_data ci_default_pdata = {
+	.capoffset	= DEF_CAPOFFSET,
+	.flags		= CI_HDRC_REQUIRE_TRANSCEIVER |
+			  CI_HDRC_DISABLE_STREAMING,
+};
+
 static int ci_hdrc_probe(struct platform_device *pdev)
 {
 	struct device	*dev = &pdev->dev;
@@ -568,11 +583,6 @@ static int ci_hdrc_probe(struct platform_device *pdev)
 	int		ret;
 	enum usb_dr_mode dr_mode;
 
-	if (!dev_get_platdata(dev)) {
-		dev_err(dev, "platform data missing\n");
-		return -ENODEV;
-	}
-
 	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
 	base = devm_ioremap_resource(dev, res);
 	if (IS_ERR(base))
@@ -586,6 +596,32 @@ static int ci_hdrc_probe(struct platform_device *pdev)
 
 	ci->dev = dev;
 	ci->platdata = dev_get_platdata(dev);
+	if (!ci->platdata) {
+		ci->platdata = devm_kmemdup(dev, &ci_default_pdata,
+					    sizeof(ci_default_pdata),
+					    GFP_KERNEL);
+
+		if (!ci->platdata)
+			return -ENOMEM;
+
+		ret = ci_get_platdata(dev, platdata);
+		if (ret)
+			return ERR_PTR(ret);
+	}
+
+	priv->clk = devm_clk_get(dev, NULL);
+	if (!IS_ERR(priv->clk)) {
+		ret = clk_prepare_enable(priv->clk);
+		if (ret) {
+			dev_err(dev, "failed to enable the clock: %d\n", ret);
+			return ret;
+		}
+	}
+
+	ret = dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(32));
+	if (ret)
+		return ret;
+
 	ci->imx28_write_fix = !!(ci->platdata->flags &
 		CI_HDRC_IMX28_WRITE_FIX);
 
@@ -702,8 +738,8 @@ static int ci_hdrc_probe(struct platform_device *pdev)
 	}
 
 	platform_set_drvdata(pdev, ci);
-	ret = request_irq(ci->irq, ci_irq, IRQF_SHARED, ci->platdata->name,
-			  ci);
+	ret = devm_request_irq(ci->irq, ci_irq, IRQF_SHARED,
+			       ci->platdata->name, ci);
 	if (ret)
 		goto stop;
 
@@ -711,10 +747,13 @@ static int ci_hdrc_probe(struct platform_device *pdev)
 		ci_hdrc_otg_fsm_start(ci);
 
 	ret = dbg_create_files(ci);
-	if (!ret)
-		return 0;
+	if (ret)
+		goto stop;
+
+	pm_runtime_no_callbacks(dev);
+	pm_runtime_enable(dev);
+	return 0;
 
-	free_irq(ci->irq, ci);
 stop:
 	ci_role_destroy(ci);
 deinit_phy:
@@ -727,22 +766,32 @@ static int ci_hdrc_remove(struct platform_device *pdev)
 {
 	struct ci_hdrc *ci = platform_get_drvdata(pdev);
 
+	pm_runtime_disable(&pdev->dev);
 	dbg_remove_files(ci);
 	free_irq(ci->irq, ci);
 	ci_role_destroy(ci);
 	ci_hdrc_enter_lpm(ci, true);
 	usb_phy_shutdown(ci->transceiver);
 	kfree(ci->hw_bank.regmap);
+	clk_disable_unprepare(ci->clk);
 
 	return 0;
 }
 
+static const struct of_device_id ci_hdrc_usb2_of_match[] = {
+	{ .compatible = "chipidea,usb2" },
+	{ }
+};
+MODULE_DEVICE_TABLE(of, ci_hdrc_usb2_of_match);
+
+
 static struct platform_driver ci_hdrc_driver = {
 	.probe	= ci_hdrc_probe,
 	.remove	= ci_hdrc_remove,
 	.driver	= {
 		.name	= "ci_hdrc",
 		.owner	= THIS_MODULE,
+		.of_match_table	= of_match_ptr(ci_hdrc_usb2_of_match),
 	},
 };
 


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

* Re: [PATCH v6 07/12] usb: chipidea: add a usb2 driver for ci13xxx
  2014-09-23 17:37           ` Arnd Bergmann
@ 2014-09-23 17:43             ` Felipe Balbi
  2014-09-24  2:27             ` Peter Chen
  1 sibling, 0 replies; 52+ messages in thread
From: Felipe Balbi @ 2014-09-23 17:43 UTC (permalink / raw)
  To: Arnd Bergmann
  Cc: balbi, Antoine Tenart, linux-arm-kernel, sebastian.hesselbarth,
	Peter.Chen, p.zabel, thomas.petazzoni, zmxu, devicetree,
	linux-usb, linux-kernel, alexandre.belloni, jszhang

[-- Attachment #1: Type: text/plain, Size: 3573 bytes --]

Hi,

On Tue, Sep 23, 2014 at 07:37:25PM +0200, Arnd Bergmann wrote:
> On Tuesday 23 September 2014 11:55:15 Felipe Balbi wrote:
> > On Tue, Sep 23, 2014 at 06:44:40PM +0200, Arnd Bergmann wrote:
> > > On Tuesday 23 September 2014 15:36:45 Antoine Tenart wrote:
> > > > On Tue, Sep 23, 2014 at 12:39:04PM +0200, Arnd Bergmann wrote:
> > > > > On Tuesday 23 September 2014 12:28:03 Antoine Tenart wrote:
> > > > > > +       if (dev->of_node) {
> > > > > > +               ret = ci_hdrc_usb2_dt_probe(dev, ci_pdata);
> > > > > > +               if (ret)
> > > > > > +                       goto clk_err;
> > > > > > +       } else {
> > > > > > +               ret = dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(32));
> > > > > > +               if (ret)
> > > > > > +                       goto clk_err;
> > > > > > +       }
> > > > > > 
> > > > > 
> > > > > Why do you care about the non-DT case here? I think it would be nicer to
> > > > > open-code the ci_hdrc_usb2_dt_probe() function in here and remove
> > > > > the dma_set_mask_and_coherent(), which should not even be necessary for
> > > > > the case where you have a hardwired platform device.
> > > > > 
> > > > 
> > > > I thought we agreed to call dma_set_mask_and_coherent():
> > > > http://lists.infradead.org/pipermail/linux-arm-kernel/2014-July/273335.html
> > > > 
> > > > I do not have a strong opinion on this as I only use the dt case for my
> > > > usage.
> > > 
> > > The question is more about who actually wants the non-DT case.
> > > 
> > > Since this is a new driver, I suspect that the answer is "nobody",
> > > as the existing board files are all for legacy platforms that we
> > > are not going to adapt for this driver.
> > 
> > wait a minute... will the legacy platforms be adapted to DT and, thus,
> > to this driver in the future ? I really don't want to keep several
> > copies of chipidea driver just because there are still some legacy
> > platforms still using them. I have said in the past and will say again,
> > everybody should move to the generic chipidea driver at the earliest
> > opportunity so we avoid duplication of work.
> > 
> 
> Sorry, my mistake. The intention that this new driver is meant to
> replace the existing ones wasn't clear to me from the changelog, and
> if I'd been involved in the discussion before, then I've forgotten
> about it.
> 
> It absolutely makes sense to migrate to a common driver, and in that
> case we should keep the platform_data handling and
> dma_set_mask_and_coherent() call in there, so we can do the two
> conversions (migrating from platform specific frontends to the generic
> one, and migrating from platform_data to DT) on independent schedules.

makes sense to me.

> Eventually I'd like all of the existing users of the platform_data
> path to move to DT, but that should not hold up the other cleanup if
> it takes longer.

yeah, certainly.

> There is however still my point that we shouldn't have an extra
> platform device that is not attached to the device node. I think the
> generic driver should just be part of the common code, without an
> extra framework.  Something like the (entirely untested) patch below.

yeah, that's what I did on dwc3 at least. We support platform_data and
DT on the core driver. As for glue layers, we have ST, Qcom, PCI, OMAP,
Exynos and Keystone.

The only difference is that core dwc3 still doesn't know about clocks,
but that's not an issue right now because we're not yet supporting
pm_runtime.

-- 
balbi

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

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

* Re: [PATCH v6 07/12] usb: chipidea: add a usb2 driver for ci13xxx
  2014-09-23 17:37           ` Arnd Bergmann
  2014-09-23 17:43             ` Felipe Balbi
@ 2014-09-24  2:27             ` Peter Chen
  2014-09-24  7:44               ` Arnd Bergmann
  1 sibling, 1 reply; 52+ messages in thread
From: Peter Chen @ 2014-09-24  2:27 UTC (permalink / raw)
  To: Arnd Bergmann
  Cc: balbi, Antoine Tenart, linux-arm-kernel, sebastian.hesselbarth,
	p.zabel, thomas.petazzoni, zmxu, devicetree, linux-usb,
	linux-kernel, alexandre.belloni, jszhang

On Tue, Sep 23, 2014 at 07:37:25PM +0200, Arnd Bergmann wrote:
> On Tuesday 23 September 2014 11:55:15 Felipe Balbi wrote:
> > On Tue, Sep 23, 2014 at 06:44:40PM +0200, Arnd Bergmann wrote:
> > > On Tuesday 23 September 2014 15:36:45 Antoine Tenart wrote:
> > > > On Tue, Sep 23, 2014 at 12:39:04PM +0200, Arnd Bergmann wrote:
> > > > > On Tuesday 23 September 2014 12:28:03 Antoine Tenart wrote:
> > > > > > +       if (dev->of_node) {
> > > > > > +               ret = ci_hdrc_usb2_dt_probe(dev, ci_pdata);
> > > > > > +               if (ret)
> > > > > > +                       goto clk_err;
> > > > > > +       } else {
> > > > > > +               ret = dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(32));
> > > > > > +               if (ret)
> > > > > > +                       goto clk_err;
> > > > > > +       }
> > > > > > 
> > > > > 
> > > > > Why do you care about the non-DT case here? I think it would be nicer to
> > > > > open-code the ci_hdrc_usb2_dt_probe() function in here and remove
> > > > > the dma_set_mask_and_coherent(), which should not even be necessary for
> > > > > the case where you have a hardwired platform device.
> > > > > 
> > > > 
> > > > I thought we agreed to call dma_set_mask_and_coherent():
> > > > http://lists.infradead.org/pipermail/linux-arm-kernel/2014-July/273335.html
> > > > 
> > > > I do not have a strong opinion on this as I only use the dt case for my
> > > > usage.
> > > 
> > > The question is more about who actually wants the non-DT case.
> > > 
> > > Since this is a new driver, I suspect that the answer is "nobody",
> > > as the existing board files are all for legacy platforms that we
> > > are not going to adapt for this driver.
> > 
> > wait a minute... will the legacy platforms be adapted to DT and, thus,
> > to this driver in the future ? I really don't want to keep several
> > copies of chipidea driver just because there are still some legacy
> > platforms still using them. I have said in the past and will say again,
> > everybody should move to the generic chipidea driver at the earliest
> > opportunity so we avoid duplication of work.
> > 
> 
> Sorry, my mistake. The intention that this new driver is meant to
> replace the existing ones wasn't clear to me from the changelog,
> and if I'd been involved in the discussion before, then I've forgotten
> about it.
> 
> It absolutely makes sense to migrate to a common driver, and in that
> case we should keep the platform_data handling and dma_set_mask_and_coherent()
> call in there, so we can do the two conversions (migrating from platform
> specific frontends to the generic one, and migrating from platform_data
> to DT) on independent schedules. Eventually I'd like all of the existing
> users of the platform_data path to move to DT, but that should not
> hold up the other cleanup if it takes longer.
> 
> There is however still my point that we shouldn't have an extra platform
> device that is not attached to the device node. I think the generic driver
> should just be part of the common code, without an extra framework.
> Something like the (entirely untested) patch below.
> 
> 	Arnd

Thanks, Arnd.

Antoine is adding a generic chipdea glue layer driver, which like ehci generic
platform driver: drivers/usb/host/ehci-platform.c, since other architectures
like MIPS (Someone submitted mips chipidea driver before) may not have device
tree support, I think non-dt support is also needed.

It is a good suggestion for adding DT support for core driver, Since we did
not do it at the first, it is a little embarrass at current situation.

- For the new chipidea glue drivers, it is ok we can have a child node
for core device at glue device node, and some common entries can be there
like: phy, vbus, dr_mode, etc. We need to add support for getting
these common things for both through device tree and platform data
(parent is DT support and parent is non-DT support) at core driver.

- For the existing glue drivers, since we can't change existed dts, we can
only do it from future SoC support. Then, in this kinds of glue drivers,
we need to support for both create core driver by node and by current
calling platform_device_add way.

Peter

> 
> ---
> diff --git a/drivers/usb/chipidea/ci.h b/drivers/usb/chipidea/ci.h
> index 9563cb56d564..a2b20c1342f1 100644
> --- a/drivers/usb/chipidea/ci.h
> +++ b/drivers/usb/chipidea/ci.h
> @@ -207,6 +207,7 @@ struct ci_hdrc {
>  	bool				id_event;
>  	bool				b_sess_valid_event;
>  	bool				imx28_write_fix;
> +	struct clk			*clk;
>  };
>  
>  static inline struct ci_role_driver *ci_role(struct ci_hdrc *ci)
> diff --git a/drivers/usb/chipidea/ci_hdrc_usb2.c b/drivers/usb/chipidea/ci_hdrc_usb2.c
> index 6eae1de587f2..03ef35997dd8 100644
> --- a/drivers/usb/chipidea/ci_hdrc_usb2.c
> +++ b/drivers/usb/chipidea/ci_hdrc_usb2.c
> @@ -70,6 +70,7 @@ static int ci_hdrc_usb2_probe(struct platform_device *pdev)
>  	}
>  
>  	if (dev->of_node) {
> +		ret = ci_get_platdata(dev, platdata);
>  		ret = ci_hdrc_usb2_dt_probe(dev, ci_pdata);
>  		if (ret)
>  			goto clk_err;
> diff --git a/drivers/usb/chipidea/core.c b/drivers/usb/chipidea/core.c
> index 619d13e29995..32613751e731 100644
> --- a/drivers/usb/chipidea/core.c
> +++ b/drivers/usb/chipidea/core.c
> @@ -478,6 +478,15 @@ static int ci_get_platdata(struct device *dev,
>  	if (of_usb_get_maximum_speed(dev->of_node) == USB_SPEED_FULL)
>  		platdata->flags |= CI_HDRC_FORCE_FULLSPEED;
>  
> +	platdata->phy = of_phy_get(dev->of_node, 0);
> +	if (IS_ERR(platdata->phy)) {
> +		if (PTR_ERR(platdata->phy) == -EPROBE_DEFER)
> +			return -EPROBE_DEFER;
> +
> +		/* PHY is optional */
> +		platdata->phy = NULL;
> +	}
> +
>  	return 0;
>  }
>  
> @@ -559,6 +568,12 @@ static void ci_get_otg_capable(struct ci_hdrc *ci)
>  		dev_dbg(ci->dev, "It is OTG capable controller\n");
>  }
>  
> +static const struct ci_hdrc_platform_data ci_default_pdata = {
> +	.capoffset	= DEF_CAPOFFSET,
> +	.flags		= CI_HDRC_REQUIRE_TRANSCEIVER |
> +			  CI_HDRC_DISABLE_STREAMING,
> +};
> +
>  static int ci_hdrc_probe(struct platform_device *pdev)
>  {
>  	struct device	*dev = &pdev->dev;
> @@ -568,11 +583,6 @@ static int ci_hdrc_probe(struct platform_device *pdev)
>  	int		ret;
>  	enum usb_dr_mode dr_mode;
>  
> -	if (!dev_get_platdata(dev)) {
> -		dev_err(dev, "platform data missing\n");
> -		return -ENODEV;
> -	}
> -
>  	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
>  	base = devm_ioremap_resource(dev, res);
>  	if (IS_ERR(base))
> @@ -586,6 +596,32 @@ static int ci_hdrc_probe(struct platform_device *pdev)
>  
>  	ci->dev = dev;
>  	ci->platdata = dev_get_platdata(dev);
> +	if (!ci->platdata) {
> +		ci->platdata = devm_kmemdup(dev, &ci_default_pdata,
> +					    sizeof(ci_default_pdata),
> +					    GFP_KERNEL);
> +
> +		if (!ci->platdata)
> +			return -ENOMEM;
> +
> +		ret = ci_get_platdata(dev, platdata);
> +		if (ret)
> +			return ERR_PTR(ret);
> +	}
> +
> +	priv->clk = devm_clk_get(dev, NULL);
> +	if (!IS_ERR(priv->clk)) {
> +		ret = clk_prepare_enable(priv->clk);
> +		if (ret) {
> +			dev_err(dev, "failed to enable the clock: %d\n", ret);
> +			return ret;
> +		}
> +	}
> +
> +	ret = dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(32));
> +	if (ret)
> +		return ret;
> +
>  	ci->imx28_write_fix = !!(ci->platdata->flags &
>  		CI_HDRC_IMX28_WRITE_FIX);
>  
> @@ -702,8 +738,8 @@ static int ci_hdrc_probe(struct platform_device *pdev)
>  	}
>  
>  	platform_set_drvdata(pdev, ci);
> -	ret = request_irq(ci->irq, ci_irq, IRQF_SHARED, ci->platdata->name,
> -			  ci);
> +	ret = devm_request_irq(ci->irq, ci_irq, IRQF_SHARED,
> +			       ci->platdata->name, ci);
>  	if (ret)
>  		goto stop;
>  
> @@ -711,10 +747,13 @@ static int ci_hdrc_probe(struct platform_device *pdev)
>  		ci_hdrc_otg_fsm_start(ci);
>  
>  	ret = dbg_create_files(ci);
> -	if (!ret)
> -		return 0;
> +	if (ret)
> +		goto stop;
> +
> +	pm_runtime_no_callbacks(dev);
> +	pm_runtime_enable(dev);
> +	return 0;
>  
> -	free_irq(ci->irq, ci);
>  stop:
>  	ci_role_destroy(ci);
>  deinit_phy:
> @@ -727,22 +766,32 @@ static int ci_hdrc_remove(struct platform_device *pdev)
>  {
>  	struct ci_hdrc *ci = platform_get_drvdata(pdev);
>  
> +	pm_runtime_disable(&pdev->dev);
>  	dbg_remove_files(ci);
>  	free_irq(ci->irq, ci);
>  	ci_role_destroy(ci);
>  	ci_hdrc_enter_lpm(ci, true);
>  	usb_phy_shutdown(ci->transceiver);
>  	kfree(ci->hw_bank.regmap);
> +	clk_disable_unprepare(ci->clk);
>  
>  	return 0;
>  }
>  
> +static const struct of_device_id ci_hdrc_usb2_of_match[] = {
> +	{ .compatible = "chipidea,usb2" },
> +	{ }
> +};
> +MODULE_DEVICE_TABLE(of, ci_hdrc_usb2_of_match);
> +
> +
>  static struct platform_driver ci_hdrc_driver = {
>  	.probe	= ci_hdrc_probe,
>  	.remove	= ci_hdrc_remove,
>  	.driver	= {
>  		.name	= "ci_hdrc",
>  		.owner	= THIS_MODULE,
> +		.of_match_table	= of_match_ptr(ci_hdrc_usb2_of_match),
>  	},
>  };
>  
> 

-- 
Best Regards,
Peter Chen

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

* Re: [PATCH v6 07/12] usb: chipidea: add a usb2 driver for ci13xxx
  2014-09-24  2:27             ` Peter Chen
@ 2014-09-24  7:44               ` Arnd Bergmann
  2014-09-24  8:30                 ` Arnd Bergmann
  2014-09-25 14:09                 ` Felipe Balbi
  0 siblings, 2 replies; 52+ messages in thread
From: Arnd Bergmann @ 2014-09-24  7:44 UTC (permalink / raw)
  To: Peter Chen
  Cc: balbi, Antoine Tenart, linux-arm-kernel, sebastian.hesselbarth,
	p.zabel, thomas.petazzoni, zmxu, devicetree, linux-usb,
	linux-kernel, alexandre.belloni, jszhang

On Wednesday 24 September 2014 10:27:52 Peter Chen wrote:
> 
> Antoine is adding a generic chipdea glue layer driver, which like ehci generic
> platform driver: drivers/usb/host/ehci-platform.c, since other architectures
> like MIPS (Someone submitted mips chipidea driver before) may not have device
> tree support, I think non-dt support is also needed.

Right.

> It is a good suggestion for adding DT support for core driver, Since we did
> not do it at the first, it is a little embarrass at current situation.
> 
> - For the new chipidea glue drivers, it is ok we can have a child node
> for core device at glue device node, and some common entries can be there
> like: phy, vbus, dr_mode, etc. We need to add support for getting
> these common things for both through device tree and platform data
> (parent is DT support and parent is non-DT support) at core driver.

I don't really want to see the child devices show up in DT, as this is
really an implementation detail of the way that the driver currently works,
and IMHO we should change that.

I know that Felipe disagrees with me on this, but almost every other
driver that has soc-specific specializations does not use parent/child
nodes, neither in DT nor in Linux. Instead you have a single device
node that gets distinguished by "compatible" string.

> - For the existing glue drivers, since we can't change existed dts, we can
> only do it from future SoC support. Then, in this kinds of glue drivers,
> we need to support for both create core driver by node and by current
> calling platform_device_add way.

We should be able to easily change the ci_hdrc_add_device call into
a different exported function that calls a version of the probe()
code directly, as we do in all sorts of other drivers (ehci, ohci,
dwc2, ..., but not dwc3 and musb as they are maintained by Felipe).

We can also gradually move in some of the other glue drivers into
the main driver if the differences are small enough.

Moving the PCI driver over to this model requires a little more
work but is absolutely doable (again, see ehci, ahci, sdhci examples)
by moving the platform_device handling out of core.c and changing
it just operate on the plain 'struct device', with an exported
probe function that gets called on either the platform device
or the pci device.

	Arnd

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

* Re: [PATCH v6 07/12] usb: chipidea: add a usb2 driver for ci13xxx
  2014-09-24  7:44               ` Arnd Bergmann
@ 2014-09-24  8:30                 ` Arnd Bergmann
  2014-09-24 11:29                   ` Peter Chen
  2014-09-25 14:09                 ` Felipe Balbi
  1 sibling, 1 reply; 52+ messages in thread
From: Arnd Bergmann @ 2014-09-24  8:30 UTC (permalink / raw)
  To: Peter Chen
  Cc: balbi, Antoine Tenart, linux-arm-kernel, sebastian.hesselbarth,
	p.zabel, thomas.petazzoni, zmxu, devicetree, linux-usb,
	linux-kernel, alexandre.belloni, jszhang

On Wednesday 24 September 2014 09:44:19 Arnd Bergmann wrote:
> 
> We can also gradually move in some of the other glue drivers into
> the main driver if the differences are small enough.
> 

FWIW, I've just looked at the other glue drivers that already
exist:

- zevio can just get merged into the common driver, all that seems
  to be needed for that is the additional compatible string, and
  keying off the ci_default_zevio_platdata on the .data field of
  the of_device_id table.

- msm has a custom notifier, which justifies leaving it in a separate
  driver, but it's also small enough that it wouldn't hurt to have
  that merged into the main driver too.

- imx requires a lot of other things, in particular the dependency
  on the usbmisc driver means we don't want to have that in the
  core anyway, so we can't really merge that in.

- the proposed ar933x driver again looks almost trivial, so no reason
  for a separate glue driver for that.

	Arnd

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

* Re: [PATCH v6 07/12] usb: chipidea: add a usb2 driver for ci13xxx
  2014-09-24  8:30                 ` Arnd Bergmann
@ 2014-09-24 11:29                   ` Peter Chen
  2014-09-24 12:23                     ` Arnd Bergmann
  0 siblings, 1 reply; 52+ messages in thread
From: Peter Chen @ 2014-09-24 11:29 UTC (permalink / raw)
  To: Arnd Bergmann
  Cc: balbi, Antoine Tenart, linux-arm-kernel, sebastian.hesselbarth,
	p.zabel, thomas.petazzoni, zmxu, devicetree, linux-usb,
	linux-kernel, alexandre.belloni, jszhang

On Wed, Sep 24, 2014 at 10:30:41AM +0200, Arnd Bergmann wrote:
> On Wednesday 24 September 2014 09:44:19 Arnd Bergmann wrote:
> > 
> > We can also gradually move in some of the other glue drivers into
> > the main driver if the differences are small enough.
> > 
> 
> FWIW, I've just looked at the other glue drivers that already
> exist:
> 
> - zevio can just get merged into the common driver, all that seems
>   to be needed for that is the additional compatible string, and
>   keying off the ci_default_zevio_platdata on the .data field of
>   the of_device_id table.
> 
> - msm has a custom notifier, which justifies leaving it in a separate
>   driver, but it's also small enough that it wouldn't hurt to have
>   that merged into the main driver too.
> 
> - imx requires a lot of other things, in particular the dependency
>   on the usbmisc driver means we don't want to have that in the
>   core anyway, so we can't really merge that in.
> 
> - the proposed ar933x driver again looks almost trivial, so no reason
>   for a separate glue driver for that.
> 
> 	Arnd

Thanks, Arnd.

So, it is IP CORE LIB (you suggest) vs IP CORE Platform Driver
(dwc3, musb, chipidea) you are talking about, right? Except for
creating another platform driver as well as related DT node (optional),
are there any advantages compared to current IP core driver structure?

In this thread, we are talking about creating common platform driver for glue
layer, its design purpose (adapt it for as many as platforms) should be the
same, no matter the IP core part is a LIB or platform driver, am I missing
something?

-- 
Best Regards,
Peter Chen

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

* Re: [PATCH v6 07/12] usb: chipidea: add a usb2 driver for ci13xxx
  2014-09-24 11:29                   ` Peter Chen
@ 2014-09-24 12:23                     ` Arnd Bergmann
  2014-09-25  0:56                       ` Peter Chen
  2014-09-25 14:15                       ` Felipe Balbi
  0 siblings, 2 replies; 52+ messages in thread
From: Arnd Bergmann @ 2014-09-24 12:23 UTC (permalink / raw)
  To: Peter Chen
  Cc: balbi, Antoine Tenart, linux-arm-kernel, sebastian.hesselbarth,
	p.zabel, thomas.petazzoni, zmxu, devicetree, linux-usb,
	linux-kernel, alexandre.belloni, jszhang

On Wednesday 24 September 2014 19:29:05 Peter Chen wrote:
> 
> So, it is IP CORE LIB (you suggest) vs IP CORE Platform Driver
> (dwc3, musb, chipidea) you are talking about, right? Except for
> creating another platform driver as well as related DT node (optional),
> are there any advantages compared to current IP core driver structure?

Having a library module usually requires less code, and is more consistent
with other drivers, which helps new developers understand what the
driver is doing.

The most important aspect though is the DT binding: once the structure
with separate kernel drivers leaks out into the DT format, you can't
easily change the driver any more, e.g. to make a property that was
introduced for one glue driver more general so it can get handled by
the common part. Having a single node lets us convert to the library
model later, so that would be a strong reason to keep the DT binding
simple, without child nodes.

Following that logic, it turns into another reason for using the library
model to start with, because otherwise the child device does not have
any DT properties itself and has to rely on the parent device properties,
which somewhat complicates the driver structure.

> In this thread, we are talking about creating common platform driver for glue
> layer, its design purpose (adapt it for as many as platforms) should be the
> same, no matter the IP core part is a LIB or platform driver, am I missing
> something?

No, you are absolutely right with that, introducing the generic glue
driver is orthogonal to the structure of the core driver in principle.

I mainly brought it up because I noticed how this patch could be done
in a simpler way by combining the new generic glue with the move to
a library driver model.

	Arnd

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

* Re: [PATCH v6 07/12] usb: chipidea: add a usb2 driver for ci13xxx
  2014-09-23 10:28 ` [PATCH v6 07/12] usb: chipidea: add a usb2 driver for ci13xxx Antoine Tenart
  2014-09-23 10:39   ` Arnd Bergmann
@ 2014-09-24 23:58   ` Sören Brinkmann
  2014-09-29 14:57     ` Antoine Tenart
  2014-09-25  1:16   ` Peter Chen
                     ` (3 subsequent siblings)
  5 siblings, 1 reply; 52+ messages in thread
From: Sören Brinkmann @ 2014-09-24 23:58 UTC (permalink / raw)
  To: Antoine Tenart
  Cc: sebastian.hesselbarth, Peter.Chen, balbi, p.zabel,
	alexandre.belloni, thomas.petazzoni, zmxu, jszhang,
	linux-arm-kernel, linux-usb, devicetree, linux-kernel

On Tue, 2014-09-23 at 12:28PM +0200, Antoine Tenart wrote:
> Add a USB2 ChipIdea driver for ci13xxx, with optional PHY, clock
> and DMA mask, to support USB2 ChipIdea controllers that don't need
> specific functions.
> 
> Tested on the Marvell Berlin SoCs USB controllers.
> 
> Signed-off-by: Antoine Tenart <antoine.tenart@free-electrons.com>

This driver also works for Zynq. I didn't do extensive testing, but I
could access a flash drive successfully.

Tested-by: Soren Brinkmann <soren.brinkmann@xilinx.com>

	Thanks,
	Sören

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

* Re: [PATCH v6 07/12] usb: chipidea: add a usb2 driver for ci13xxx
  2014-09-24 12:23                     ` Arnd Bergmann
@ 2014-09-25  0:56                       ` Peter Chen
  2014-09-25 14:15                       ` Felipe Balbi
  1 sibling, 0 replies; 52+ messages in thread
From: Peter Chen @ 2014-09-25  0:56 UTC (permalink / raw)
  To: Arnd Bergmann
  Cc: balbi, Antoine Tenart, linux-arm-kernel, sebastian.hesselbarth,
	p.zabel, thomas.petazzoni, zmxu, devicetree, linux-usb,
	linux-kernel, alexandre.belloni, jszhang

On Wed, Sep 24, 2014 at 02:23:38PM +0200, Arnd Bergmann wrote:
> On Wednesday 24 September 2014 19:29:05 Peter Chen wrote:
> > 
> > So, it is IP CORE LIB (you suggest) vs IP CORE Platform Driver
> > (dwc3, musb, chipidea) you are talking about, right? Except for
> > creating another platform driver as well as related DT node (optional),
> > are there any advantages compared to current IP core driver structure?
> 
> Having a library module usually requires less code, and is more consistent
> with other drivers, which helps new developers understand what the
> driver is doing.

Yes, more consistent is a good reason.

> 
> The most important aspect though is the DT binding: once the structure
> with separate kernel drivers leaks out into the DT format, you can't
> easily change the driver any more, e.g. to make a property that was
> introduced for one glue driver more general so it can get handled by
> the common part. Having a single node lets us convert to the library
> model later, so that would be a strong reason to keep the DT binding
> simple, without child nodes.
> 
> Following that logic, it turns into another reason for using the library
> model to start with, because otherwise the child device does not have
> any DT properties itself and has to rely on the parent device properties,
> which somewhat complicates the driver structure.
> 

Although it is not a problem for chipidea, chipidea core exports API
to handle parent's common DT entries. It is a little inconsistent for
current chipidea core driver, it works as a driver, but exports some
APIs for other drivers use which is like a library. One more benefit I
can see is the platform driver can visit the common struct like io
address if using library, currently, the platform driver isn't suitable
to visit core driver's struct, since they are two drivers.

For chipidea, it doesn't has child device DT node, so it can convert to
core library + platform driver model with moderate effort, I will do
it at next two versions, thanks.

-- 
Best Regards,
Peter Chen

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

* Re: [PATCH v6 07/12] usb: chipidea: add a usb2 driver for ci13xxx
  2014-09-23 10:28 ` [PATCH v6 07/12] usb: chipidea: add a usb2 driver for ci13xxx Antoine Tenart
  2014-09-23 10:39   ` Arnd Bergmann
  2014-09-24 23:58   ` Sören Brinkmann
@ 2014-09-25  1:16   ` Peter Chen
  2014-09-25  7:11     ` Arnd Bergmann
  2014-09-25 19:12   ` Arnd Bergmann
                     ` (2 subsequent siblings)
  5 siblings, 1 reply; 52+ messages in thread
From: Peter Chen @ 2014-09-25  1:16 UTC (permalink / raw)
  To: Antoine Tenart
  Cc: sebastian.hesselbarth, balbi, p.zabel, alexandre.belloni,
	thomas.petazzoni, zmxu, jszhang, linux-arm-kernel, linux-usb,
	devicetree, linux-kernel

On Tue, Sep 23, 2014 at 12:28:03PM +0200, Antoine Tenart wrote:
> Add a USB2 ChipIdea driver for ci13xxx, with optional PHY, clock
> and DMA mask, to support USB2 ChipIdea controllers that don't need
> specific functions.
> 
> Tested on the Marvell Berlin SoCs USB controllers.
> 
> Signed-off-by: Antoine Tenart <antoine.tenart@free-electrons.com>
> ---
>  drivers/usb/chipidea/Makefile       |   1 +
>  drivers/usb/chipidea/ci_hdrc_usb2.c | 138 ++++++++++++++++++++++++++++++++++++
>  2 files changed, 139 insertions(+)
>  create mode 100644 drivers/usb/chipidea/ci_hdrc_usb2.c
> 
> diff --git a/drivers/usb/chipidea/Makefile b/drivers/usb/chipidea/Makefile
> index 2f099c7df7b5..1fc86a2ca22d 100644
> --- a/drivers/usb/chipidea/Makefile
> +++ b/drivers/usb/chipidea/Makefile
> @@ -10,6 +10,7 @@ ci_hdrc-$(CONFIG_USB_OTG_FSM)		+= otg_fsm.o
>  
>  # Glue/Bridge layers go here
>  
> +obj-$(CONFIG_USB_CHIPIDEA)	+= ci_hdrc_usb2.o
>  obj-$(CONFIG_USB_CHIPIDEA)	+= ci_hdrc_msm.o
>  obj-$(CONFIG_USB_CHIPIDEA)	+= ci_hdrc_zevio.o
>  
> diff --git a/drivers/usb/chipidea/ci_hdrc_usb2.c b/drivers/usb/chipidea/ci_hdrc_usb2.c
> new file mode 100644
> index 000000000000..6eae1de587f2
> --- /dev/null
> +++ b/drivers/usb/chipidea/ci_hdrc_usb2.c
> @@ -0,0 +1,138 @@
> +/*
> + * Copyright (C) 2014 Marvell Technology Group Ltd.
> + *
> + * Antoine Tenart <antoine.tenart@free-electrons.com>
> + *
> + * This file is licensed under the terms of the GNU General Public
> + * License version 2. This program is licensed "as is" without any
> + * warranty of any kind, whether express or implied.
> + */
> +
> +#include <linux/clk.h>
> +#include <linux/dma-mapping.h>
> +#include <linux/module.h>
> +#include <linux/of.h>
> +#include <linux/phy/phy.h>
> +#include <linux/platform_device.h>
> +#include <linux/usb/chipidea.h>
> +#include <linux/usb/hcd.h>
> +#include <linux/usb/ulpi.h>
> +
> +#include "ci.h"
> +
> +struct ci_hdrc_usb2_priv {
> +	struct platform_device	*ci_pdev;
> +	struct clk		*clk;
> +};
> +
> +static int ci_hdrc_usb2_dt_probe(struct device *dev,
> +				 struct ci_hdrc_platform_data *ci_pdata)
> +{
> +	ci_pdata->phy = of_phy_get(dev->of_node, 0);
> +	if (IS_ERR(ci_pdata->phy)) {
> +		if (PTR_ERR(ci_pdata->phy) == -EPROBE_DEFER)
> +			return -EPROBE_DEFER;
> +
> +		/* PHY is optional */
> +		ci_pdata->phy = NULL;
> +	}
> +
> +	return 0;
> +}
> +
> +static struct ci_hdrc_platform_data ci_default_pdata = {
> +	.capoffset	= DEF_CAPOFFSET,
> +	.flags		= CI_HDRC_REQUIRE_TRANSCEIVER |
> +			  CI_HDRC_DISABLE_STREAMING,
> +};
> +
> +static int ci_hdrc_usb2_probe(struct platform_device *pdev)
> +{
> +	struct device *dev = &pdev->dev;
> +	struct ci_hdrc_usb2_priv *priv;
> +	struct ci_hdrc_platform_data *ci_pdata = dev_get_platdata(&pdev->dev);
> +	int ret;
> +
> +	if (!ci_pdata)
> +		ci_pdata = &ci_default_pdata;
> +
> +	priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL);
> +	if (!priv)
> +		return -ENOMEM;
> +
> +	priv->clk = devm_clk_get(dev, NULL);
> +	if (!IS_ERR(priv->clk)) {
> +		ret = clk_prepare_enable(priv->clk);
> +		if (ret) {
> +			dev_err(dev, "failed to enable the clock: %d\n", ret);
> +			return ret;
> +		}
> +	}
> +
> +	if (dev->of_node) {
> +		ret = ci_hdrc_usb2_dt_probe(dev, ci_pdata);
> +		if (ret)
> +			goto clk_err;
> +	} else {
> +		ret = dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(32));
> +		if (ret)
> +			goto clk_err;
> +	}

Hi Antoine, the above code may not be needed, since get phy and set dma
mask are common operation, we can do it at core code, the only thing you
need to do is something like: dev->dma_mask = DMA_BIT_MASK(32).

I will check your generic phy support for chipidea driver later, if it is
ok to apply, you can have a patchset to move get phy operation to common
code prior to this one (If you have no time, I can do it).

Peter

> +
> +	ci_pdata->name = dev_name(&pdev->dev);
> +
> +	priv->ci_pdev = ci_hdrc_add_device(dev, pdev->resource,
> +					   pdev->num_resources, ci_pdata);
> +	if (IS_ERR(priv->ci_pdev)) {
> +		ret = PTR_ERR(priv->ci_pdev);
> +		if (ret != -EPROBE_DEFER)
> +			dev_err(dev,
> +				"failed to register ci_hdrc platform device: %d\n",
> +				ret);
> +		goto clk_err;
> +	}
> +
> +	platform_set_drvdata(pdev, priv);
> +
> +	pm_runtime_no_callbacks(dev);
> +	pm_runtime_enable(dev);
> +
> +	return 0;
> +
> +clk_err:
> +	if (!IS_ERR(priv->clk))
> +		clk_disable_unprepare(priv->clk);
> +	return ret;
> +}
> +
> +static int ci_hdrc_usb2_remove(struct platform_device *pdev)
> +{
> +	struct ci_hdrc_usb2_priv *priv = platform_get_drvdata(pdev);
> +
> +	pm_runtime_disable(&pdev->dev);
> +	ci_hdrc_remove_device(priv->ci_pdev);
> +	clk_disable_unprepare(priv->clk);
> +
> +	return 0;
> +}
> +
> +static const struct of_device_id ci_hdrc_usb2_of_match[] = {
> +	{ .compatible = "chipidea,usb2" },
> +	{ }
> +};
> +MODULE_DEVICE_TABLE(of, ci_hdrc_usb2_of_match);
> +
> +static struct platform_driver ci_hdrc_usb2_driver = {
> +	.probe	= ci_hdrc_usb2_probe,
> +	.remove	= ci_hdrc_usb2_remove,
> +	.driver	= {
> +		.name		= "chipidea-usb2",
> +		.owner		= THIS_MODULE,
> +		.of_match_table	= of_match_ptr(ci_hdrc_usb2_of_match),
> +	},
> +};
> +module_platform_driver(ci_hdrc_usb2_driver);
> +
> +MODULE_DESCRIPTION("ChipIdea HDRC USB2 binding for ci13xxx");
> +MODULE_AUTHOR("Antoine Tenart <antoine.tenart@free-electrons.com>");
> +MODULE_LICENSE("GPL");
> -- 
> 1.9.1
> 

-- 
Best Regards,
Peter Chen

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

* Re: [PATCH v6 07/12] usb: chipidea: add a usb2 driver for ci13xxx
  2014-09-25  1:16   ` Peter Chen
@ 2014-09-25  7:11     ` Arnd Bergmann
  2014-09-26  0:23       ` Peter Chen
  0 siblings, 1 reply; 52+ messages in thread
From: Arnd Bergmann @ 2014-09-25  7:11 UTC (permalink / raw)
  To: linux-arm-kernel
  Cc: Peter Chen, Antoine Tenart, thomas.petazzoni, zmxu, devicetree,
	linux-usb, linux-kernel, balbi, alexandre.belloni, p.zabel,
	jszhang, sebastian.hesselbarth

On Thursday 25 September 2014 09:16:48 Peter Chen wrote:
> > +     }
> > +
> > +     if (dev->of_node) {
> > +             ret = ci_hdrc_usb2_dt_probe(dev, ci_pdata);
> > +             if (ret)
> > +                     goto clk_err;
> > +     } else {
> > +             ret = dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(32));
> > +             if (ret)
> > +                     goto clk_err;
> > +     }
> 
> Hi Antoine, the above code may not be needed, since get phy and set dma
> mask are common operation, we can do it at core code, the only thing you
> need to do is something like: dev->dma_mask = DMA_BIT_MASK(32).
> 

Certainly not, doing that would be broken for a number of reasons:

- dev->dma_mask is a pointer, a driver should not reassign that
- the device may have been set up for a bus that requires a smaller mask
  that is already set, changing the mask would cause data corruption
- setting just the dma mask but not coherent mask is wrong
- setting the dma mask can fail, e.g. if the mask is smaller than the
  smallest memory zone, so you have to check the return value.

	Arnd

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

* Re: [PATCH v6 07/12] usb: chipidea: add a usb2 driver for ci13xxx
  2014-09-24  7:44               ` Arnd Bergmann
  2014-09-24  8:30                 ` Arnd Bergmann
@ 2014-09-25 14:09                 ` Felipe Balbi
  1 sibling, 0 replies; 52+ messages in thread
From: Felipe Balbi @ 2014-09-25 14:09 UTC (permalink / raw)
  To: Arnd Bergmann
  Cc: Peter Chen, balbi, Antoine Tenart, linux-arm-kernel,
	sebastian.hesselbarth, p.zabel, thomas.petazzoni, zmxu,
	devicetree, linux-usb, linux-kernel, alexandre.belloni, jszhang

[-- Attachment #1: Type: text/plain, Size: 3799 bytes --]

Hi,

On Wed, Sep 24, 2014 at 09:44:19AM +0200, Arnd Bergmann wrote:
> > It is a good suggestion for adding DT support for core driver, Since we did
> > not do it at the first, it is a little embarrass at current situation.
> > 
> > - For the new chipidea glue drivers, it is ok we can have a child node
> > for core device at glue device node, and some common entries can be there
> > like: phy, vbus, dr_mode, etc. We need to add support for getting
> > these common things for both through device tree and platform data
> > (parent is DT support and parent is non-DT support) at core driver.
> 
> I don't really want to see the child devices show up in DT, as this is
> really an implementation detail of the way that the driver currently works,
> and IMHO we should change that.
> 
> I know that Felipe disagrees with me on this, but almost every other
> driver that has soc-specific specializations does not use parent/child
> nodes, neither in DT nor in Linux. Instead you have a single device
> node that gets distinguished by "compatible" string.

I have two answers for this:

1) We need to let different buses use the same device. The same IP can
be used on PCI, platform, OMAP (yes, OMAP is pretty much a bus, even
though we're using platform-bus with a bunch of code to match things),
AMBA, etc.

2) I like to mode the HW in code and if you look into RTL you'll see
that PCIe, OMAP, QCOM, Exynos, etc, take a semi-bus-agnostic core IP and
write a wrapper IP to make it fit into the SoC. That Wrapper is also an
IP of its own and has its own clocks, sometimes its own IRQs. Not to
mention that PM requirements for different architectures might be (and
actually are) different, while PM requirements for the core IP is
"generic" because it comes from IP provider.

By using a parent device, we can hide all platform-/bus-specific details
on the parent driver and keep core driver "pristine". I see many, many
benefits of doing things this way and many of the benefits are already
cooked into the driver model itself, so why not use it ?

> > - For the existing glue drivers, since we can't change existed dts, we can
> > only do it from future SoC support. Then, in this kinds of glue drivers,
> > we need to support for both create core driver by node and by current
> > calling platform_device_add way.
> 
> We should be able to easily change the ci_hdrc_add_device call into
> a different exported function that calls a version of the probe()
> code directly, as we do in all sorts of other drivers (ehci, ohci,
> dwc2, ..., but not dwc3 and musb as they are maintained by Felipe).

Go back a few commits and you'll see EHCI couldn't even be built with
different glues (say ehci-omap and ehci-pci).

> We can also gradually move in some of the other glue drivers into
> the main driver if the differences are small enough.

you'll end up with a bunch of conflicting requirements very soon. In
fact that's one reason for MUSB being a mess. It was, originally, a
single driver with platform-specific glue chosen in build-time. To this
day, we still can't have different DMA glues on the kernel and
TUSB6010-glue doesn't work with anybody else.

When you have a single driver like that, you end up accepting
platform-specific details into the core IP just because the changes are
small enough.

> Moving the PCI driver over to this model requires a little more
> work but is absolutely doable (again, see ehci, ahci, sdhci examples)
> by moving the platform_device handling out of core.c and changing
> it just operate on the plain 'struct device', with an exported
> probe function that gets called on either the platform device
> or the pci device.

sounds like a disaster waiting to happen for me.

-- 
balbi

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

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

* Re: [PATCH v6 07/12] usb: chipidea: add a usb2 driver for ci13xxx
  2014-09-24 12:23                     ` Arnd Bergmann
  2014-09-25  0:56                       ` Peter Chen
@ 2014-09-25 14:15                       ` Felipe Balbi
  2014-09-25 23:39                         ` Peter Chen
  1 sibling, 1 reply; 52+ messages in thread
From: Felipe Balbi @ 2014-09-25 14:15 UTC (permalink / raw)
  To: Arnd Bergmann
  Cc: Peter Chen, balbi, Antoine Tenart, linux-arm-kernel,
	sebastian.hesselbarth, p.zabel, thomas.petazzoni, zmxu,
	devicetree, linux-usb, linux-kernel, alexandre.belloni, jszhang

[-- Attachment #1: Type: text/plain, Size: 2533 bytes --]

On Wed, Sep 24, 2014 at 02:23:38PM +0200, Arnd Bergmann wrote:
> On Wednesday 24 September 2014 19:29:05 Peter Chen wrote:
> > 
> > So, it is IP CORE LIB (you suggest) vs IP CORE Platform Driver
> > (dwc3, musb, chipidea) you are talking about, right? Except for
> > creating another platform driver as well as related DT node (optional),
> > are there any advantages compared to current IP core driver structure?
> 
> Having a library module usually requires less code, and is more
> consistent with other drivers, which helps new developers understand
> what the driver is doing.

I beg to differ. You end-up having to pass function pointers through
platform_data to handle differences which could be handled by the core
IP.

> The most important aspect though is the DT binding: once the structure
> with separate kernel drivers leaks out into the DT format, you can't
> easily change the driver any more, e.g. to make a property that was
> introduced for one glue driver more general so it can get handled by
> the common part. Having a single node lets us convert to the library
> model later, so that would be a strong reason to keep the DT binding
> simple, without child nodes.
> 
> Following that logic, it turns into another reason for using the library
> model to start with, because otherwise the child device does not have
> any DT properties itself and has to rely on the parent device properties,
> which somewhat complicates the driver structure.

this is bullcrap. Take a look at
Documentation/devicetree/bindings/usb/dwc3.txt:

synopsys DWC3 CORE

DWC3- USB3 CONTROLLER

Required properties:
 - compatible: must be "snps,dwc3"
 - reg : Address and length of the register set for the device
 - interrupts: Interrupts used by the dwc3 controller.

Optional properties:
 - usb-phy : array of phandle for the PHY device.  The first element
   in the array is expected to be a handle to the USB2/HS PHY and
   the second element is expected to be a handle to the USB3/SS PHY
 - phys: from the *Generic PHY* bindings
 - phy-names: from the *Generic PHY* bindings
 - tx-fifo-resize: determines if the FIFO *has* to be reallocated.

This is usually a subnode to DWC3 glue to which it is connected.

dwc3@4a030000 {
	compatible = "snps,dwc3";
	reg = <0x4a030000 0xcfff>;
	interrupts = <0 92 4>
	usb-phy = <&usb2_phy>, <&usb3,phy>;
	tx-fifo-resize;
};

This contains all the attributes it needs to work. In fact, this could
be used without any glue.

-- 
balbi

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

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

* Re: [PATCH v6 07/12] usb: chipidea: add a usb2 driver for ci13xxx
  2014-09-23 10:28 ` [PATCH v6 07/12] usb: chipidea: add a usb2 driver for ci13xxx Antoine Tenart
                     ` (2 preceding siblings ...)
  2014-09-25  1:16   ` Peter Chen
@ 2014-09-25 19:12   ` Arnd Bergmann
  2014-09-25 19:54     ` Antoine Tenart
  2014-09-29 15:08   ` Antoine Tenart
  2014-09-30  0:12   ` Peter Chen
  5 siblings, 1 reply; 52+ messages in thread
From: Arnd Bergmann @ 2014-09-25 19:12 UTC (permalink / raw)
  To: linux-arm-kernel
  Cc: Antoine Tenart, sebastian.hesselbarth, Peter.Chen, balbi,
	p.zabel, thomas.petazzoni, zmxu, devicetree, linux-usb,
	linux-kernel, alexandre.belloni, jszhang

On Tuesday 23 September 2014, Antoine Tenart wrote:
> +static int ci_hdrc_usb2_dt_probe(struct device *dev,
> +                                struct ci_hdrc_platform_data *ci_pdata)
> +{
> +       ci_pdata->phy = of_phy_get(dev->of_node, 0);

FWIW, I accidentally built a kernel with this driver enabled and got a warning
for this code. The problem is that ci_pdata->phy is a 'struct usb_phy' pointer,
while of_phy_get() returns a generic 'struct phy'. While the two have similar
behavior, they are not the same thing and this can't work.

	Arnd

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

* Re: [PATCH v6 07/12] usb: chipidea: add a usb2 driver for ci13xxx
  2014-09-25 19:12   ` Arnd Bergmann
@ 2014-09-25 19:54     ` Antoine Tenart
  0 siblings, 0 replies; 52+ messages in thread
From: Antoine Tenart @ 2014-09-25 19:54 UTC (permalink / raw)
  To: Arnd Bergmann
  Cc: linux-arm-kernel, Antoine Tenart, sebastian.hesselbarth,
	Peter.Chen, balbi, p.zabel, thomas.petazzoni, zmxu, devicetree,
	linux-usb, linux-kernel, alexandre.belloni, jszhang

Arnd,

On Thu, Sep 25, 2014 at 09:12:07PM +0200, Arnd Bergmann wrote:
> On Tuesday 23 September 2014, Antoine Tenart wrote:
> > +static int ci_hdrc_usb2_dt_probe(struct device *dev,
> > +                                struct ci_hdrc_platform_data *ci_pdata)
> > +{
> > +       ci_pdata->phy = of_phy_get(dev->of_node, 0);
> 
> FWIW, I accidentally built a kernel with this driver enabled and got a warning
> for this code. The problem is that ci_pdata->phy is a 'struct usb_phy' pointer,
> while of_phy_get() returns a generic 'struct phy'. While the two have similar
> behavior, they are not the same thing and this can't work.

That's because this series applies on top of:
https://lkml.org/lkml/2014/9/15/141

Antoine

-- 
Antoine Ténart, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com

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

* Re: [PATCH v6 07/12] usb: chipidea: add a usb2 driver for ci13xxx
  2014-09-25 14:15                       ` Felipe Balbi
@ 2014-09-25 23:39                         ` Peter Chen
  2014-09-26  0:37                           ` Felipe Balbi
  0 siblings, 1 reply; 52+ messages in thread
From: Peter Chen @ 2014-09-25 23:39 UTC (permalink / raw)
  To: Felipe Balbi
  Cc: Arnd Bergmann, Antoine Tenart, linux-arm-kernel,
	sebastian.hesselbarth, p.zabel, thomas.petazzoni, zmxu,
	devicetree, linux-usb, linux-kernel, alexandre.belloni, jszhang

On Thu, Sep 25, 2014 at 09:15:53AM -0500, Felipe Balbi wrote:
> On Wed, Sep 24, 2014 at 02:23:38PM +0200, Arnd Bergmann wrote:
> > On Wednesday 24 September 2014 19:29:05 Peter Chen wrote:
> > > 
> > > So, it is IP CORE LIB (you suggest) vs IP CORE Platform Driver
> > > (dwc3, musb, chipidea) you are talking about, right? Except for
> > > creating another platform driver as well as related DT node (optional),
> > > are there any advantages compared to current IP core driver structure?
> > 
> > Having a library module usually requires less code, and is more
> > consistent with other drivers, which helps new developers understand
> > what the driver is doing.
> 
> I beg to differ. You end-up having to pass function pointers through
> platform_data to handle differences which could be handled by the core
> IP.
> 
> > The most important aspect though is the DT binding: once the structure
> > with separate kernel drivers leaks out into the DT format, you can't
> > easily change the driver any more, e.g. to make a property that was
> > introduced for one glue driver more general so it can get handled by
> > the common part. Having a single node lets us convert to the library
> > model later, so that would be a strong reason to keep the DT binding
> > simple, without child nodes.
> > 
> > Following that logic, it turns into another reason for using the library
> > model to start with, because otherwise the child device does not have
> > any DT properties itself and has to rely on the parent device properties,
> > which somewhat complicates the driver structure.
> 
> this is bullcrap. Take a look at
> Documentation/devicetree/bindings/usb/dwc3.txt:
> 
> synopsys DWC3 CORE
> 
> DWC3- USB3 CONTROLLER
> 
> Required properties:
>  - compatible: must be "snps,dwc3"
>  - reg : Address and length of the register set for the device
>  - interrupts: Interrupts used by the dwc3 controller.
> 
> Optional properties:
>  - usb-phy : array of phandle for the PHY device.  The first element
>    in the array is expected to be a handle to the USB2/HS PHY and
>    the second element is expected to be a handle to the USB3/SS PHY
>  - phys: from the *Generic PHY* bindings
>  - phy-names: from the *Generic PHY* bindings
>  - tx-fifo-resize: determines if the FIFO *has* to be reallocated.
> 
> This is usually a subnode to DWC3 glue to which it is connected.
> 
> dwc3@4a030000 {
> 	compatible = "snps,dwc3";
> 	reg = <0x4a030000 0xcfff>;
> 	interrupts = <0 92 4>
> 	usb-phy = <&usb2_phy>, <&usb3,phy>;
> 	tx-fifo-resize;
> };
> 
> This contains all the attributes it needs to work. In fact, this could
> be used without any glue.
> 

If you want to add "vbus-supply" core node to support ID switch, what's
the plan for that?

Is it possible that the glue layer needs to access core register
(eg, portsc.phcd during suspend)? The wrapper IP may wait some signals
at core IP to change.

-- 
Best Regards,
Peter Chen

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

* Re: [PATCH v6 07/12] usb: chipidea: add a usb2 driver for ci13xxx
  2014-09-25  7:11     ` Arnd Bergmann
@ 2014-09-26  0:23       ` Peter Chen
  2014-09-26  7:01         ` Arnd Bergmann
  0 siblings, 1 reply; 52+ messages in thread
From: Peter Chen @ 2014-09-26  0:23 UTC (permalink / raw)
  To: Arnd Bergmann
  Cc: linux-arm-kernel, Antoine Tenart, thomas.petazzoni, zmxu,
	devicetree, linux-usb, linux-kernel, balbi, alexandre.belloni,
	p.zabel, jszhang, sebastian.hesselbarth

On Thu, Sep 25, 2014 at 09:11:35AM +0200, Arnd Bergmann wrote:
> On Thursday 25 September 2014 09:16:48 Peter Chen wrote:
> > > +     }
> > > +
> > > +     if (dev->of_node) {
> > > +             ret = ci_hdrc_usb2_dt_probe(dev, ci_pdata);
> > > +             if (ret)
> > > +                     goto clk_err;
> > > +     } else {
> > > +             ret = dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(32));
> > > +             if (ret)
> > > +                     goto clk_err;
> > > +     }
> > 
> > Hi Antoine, the above code may not be needed, since get phy and set dma
> > mask are common operation, we can do it at core code, the only thing you
> > need to do is something like: dev->dma_mask = DMA_BIT_MASK(32).
> > 
> 
> Certainly not, doing that would be broken for a number of reasons:
> 
> - dev->dma_mask is a pointer, a driver should not reassign that
> - the device may have been set up for a bus that requires a smaller mask
>   that is already set, changing the mask would cause data corruption
> - setting just the dma mask but not coherent mask is wrong
> - setting the dma mask can fail, e.g. if the mask is smaller than the
>   smallest memory zone, so you have to check the return value.
> 

In current chipidea structure, the parent (glue layer) driver will not be
used for dma, udc/host driver uses dma mask from child (core layer), at core
layer we will do:


	pdev->dev.dma_mask = dev->dma_mask; /* this device is parent */
	dma_set_coherent_mask(&pdev->dev, dev->coherent_dma_mask);

Would you suggestion us a suitable way? Or it is ok we use just Antoine's way that
call dma_coerce_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(32)) at parent
driver no matter dt or non-dt? Thanks.

-- 
Best Regards,
Peter Chen

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

* Re: [PATCH v6 07/12] usb: chipidea: add a usb2 driver for ci13xxx
  2014-09-25 23:39                         ` Peter Chen
@ 2014-09-26  0:37                           ` Felipe Balbi
  2014-09-26  0:39                             ` Felipe Balbi
                                               ` (2 more replies)
  0 siblings, 3 replies; 52+ messages in thread
From: Felipe Balbi @ 2014-09-26  0:37 UTC (permalink / raw)
  To: Peter Chen
  Cc: Felipe Balbi, Arnd Bergmann, Antoine Tenart, linux-arm-kernel,
	sebastian.hesselbarth, p.zabel, thomas.petazzoni, zmxu,
	devicetree, linux-usb, linux-kernel, alexandre.belloni, jszhang

[-- Attachment #1: Type: text/plain, Size: 3741 bytes --]

HI,

On Fri, Sep 26, 2014 at 07:39:34AM +0800, Peter Chen wrote:
> On Thu, Sep 25, 2014 at 09:15:53AM -0500, Felipe Balbi wrote:
> > On Wed, Sep 24, 2014 at 02:23:38PM +0200, Arnd Bergmann wrote:
> > > On Wednesday 24 September 2014 19:29:05 Peter Chen wrote:
> > > > 
> > > > So, it is IP CORE LIB (you suggest) vs IP CORE Platform Driver
> > > > (dwc3, musb, chipidea) you are talking about, right? Except for
> > > > creating another platform driver as well as related DT node (optional),
> > > > are there any advantages compared to current IP core driver structure?
> > > 
> > > Having a library module usually requires less code, and is more
> > > consistent with other drivers, which helps new developers understand
> > > what the driver is doing.
> > 
> > I beg to differ. You end-up having to pass function pointers through
> > platform_data to handle differences which could be handled by the core
> > IP.
> > 
> > > The most important aspect though is the DT binding: once the structure
> > > with separate kernel drivers leaks out into the DT format, you can't
> > > easily change the driver any more, e.g. to make a property that was
> > > introduced for one glue driver more general so it can get handled by
> > > the common part. Having a single node lets us convert to the library
> > > model later, so that would be a strong reason to keep the DT binding
> > > simple, without child nodes.
> > > 
> > > Following that logic, it turns into another reason for using the library
> > > model to start with, because otherwise the child device does not have
> > > any DT properties itself and has to rely on the parent device properties,
> > > which somewhat complicates the driver structure.
> > 
> > this is bullcrap. Take a look at
> > Documentation/devicetree/bindings/usb/dwc3.txt:
> > 
> > synopsys DWC3 CORE
> > 
> > DWC3- USB3 CONTROLLER
> > 
> > Required properties:
> >  - compatible: must be "snps,dwc3"
> >  - reg : Address and length of the register set for the device
> >  - interrupts: Interrupts used by the dwc3 controller.
> > 
> > Optional properties:
> >  - usb-phy : array of phandle for the PHY device.  The first element
> >    in the array is expected to be a handle to the USB2/HS PHY and
> >    the second element is expected to be a handle to the USB3/SS PHY
> >  - phys: from the *Generic PHY* bindings
> >  - phy-names: from the *Generic PHY* bindings
> >  - tx-fifo-resize: determines if the FIFO *has* to be reallocated.
> > 
> > This is usually a subnode to DWC3 glue to which it is connected.
> > 
> > dwc3@4a030000 {
> > 	compatible = "snps,dwc3";
> > 	reg = <0x4a030000 0xcfff>;
> > 	interrupts = <0 92 4>
> > 	usb-phy = <&usb2_phy>, <&usb3,phy>;
> > 	tx-fifo-resize;
> > };
> > 
> > This contains all the attributes it needs to work. In fact, this could
> > be used without any glue.
> > 
> 
> If you want to add "vbus-supply" core node to support ID switch, what's
> the plan for that?

send a patch ? Just make sure it's optional because not everybody needs
a vbus-supply. Also, DRD will still take a few merge windows to become a
reality. I don't want to merge something before considering it carefuly,
otherwise we will having which is broken and doesn't work for everybody
;-)

> Is it possible that the glue layer needs to access core register
> (eg, portsc.phcd during suspend)? The wrapper IP may wait some signals
> at core IP to change.

why would a glue layer need to access registers from the core ? That
sounds very odd. I haven't seen that and will, definitely, NACK such a
patch :-)

can you further describe why you think a glue layer might need to access
core IP's registers ?

-- 
balbi

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

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

* Re: [PATCH v6 07/12] usb: chipidea: add a usb2 driver for ci13xxx
  2014-09-26  0:37                           ` Felipe Balbi
@ 2014-09-26  0:39                             ` Felipe Balbi
  2014-09-26  7:20                               ` Arnd Bergmann
  2014-09-28  0:40                             ` Peter Chen
  2014-10-13  8:47                             ` Peter Chen
  2 siblings, 1 reply; 52+ messages in thread
From: Felipe Balbi @ 2014-09-26  0:39 UTC (permalink / raw)
  To: Felipe Balbi
  Cc: Peter Chen, Arnd Bergmann, Antoine Tenart, linux-arm-kernel,
	sebastian.hesselbarth, p.zabel, thomas.petazzoni, zmxu,
	devicetree, linux-usb, linux-kernel, alexandre.belloni, jszhang

[-- Attachment #1: Type: text/plain, Size: 4129 bytes --]

Hi again,

On Thu, Sep 25, 2014 at 07:37:50PM -0500, Felipe Balbi wrote:
> On Fri, Sep 26, 2014 at 07:39:34AM +0800, Peter Chen wrote:
> > On Thu, Sep 25, 2014 at 09:15:53AM -0500, Felipe Balbi wrote:
> > > On Wed, Sep 24, 2014 at 02:23:38PM +0200, Arnd Bergmann wrote:
> > > > On Wednesday 24 September 2014 19:29:05 Peter Chen wrote:
> > > > > 
> > > > > So, it is IP CORE LIB (you suggest) vs IP CORE Platform Driver
> > > > > (dwc3, musb, chipidea) you are talking about, right? Except for
> > > > > creating another platform driver as well as related DT node (optional),
> > > > > are there any advantages compared to current IP core driver structure?
> > > > 
> > > > Having a library module usually requires less code, and is more
> > > > consistent with other drivers, which helps new developers understand
> > > > what the driver is doing.
> > > 
> > > I beg to differ. You end-up having to pass function pointers through
> > > platform_data to handle differences which could be handled by the core
> > > IP.
> > > 
> > > > The most important aspect though is the DT binding: once the structure
> > > > with separate kernel drivers leaks out into the DT format, you can't
> > > > easily change the driver any more, e.g. to make a property that was
> > > > introduced for one glue driver more general so it can get handled by
> > > > the common part. Having a single node lets us convert to the library
> > > > model later, so that would be a strong reason to keep the DT binding
> > > > simple, without child nodes.
> > > > 
> > > > Following that logic, it turns into another reason for using the library
> > > > model to start with, because otherwise the child device does not have
> > > > any DT properties itself and has to rely on the parent device properties,
> > > > which somewhat complicates the driver structure.
> > > 
> > > this is bullcrap. Take a look at
> > > Documentation/devicetree/bindings/usb/dwc3.txt:
> > > 
> > > synopsys DWC3 CORE
> > > 
> > > DWC3- USB3 CONTROLLER
> > > 
> > > Required properties:
> > >  - compatible: must be "snps,dwc3"
> > >  - reg : Address and length of the register set for the device
> > >  - interrupts: Interrupts used by the dwc3 controller.
> > > 
> > > Optional properties:
> > >  - usb-phy : array of phandle for the PHY device.  The first element
> > >    in the array is expected to be a handle to the USB2/HS PHY and
> > >    the second element is expected to be a handle to the USB3/SS PHY
> > >  - phys: from the *Generic PHY* bindings
> > >  - phy-names: from the *Generic PHY* bindings
> > >  - tx-fifo-resize: determines if the FIFO *has* to be reallocated.
> > > 
> > > This is usually a subnode to DWC3 glue to which it is connected.
> > > 
> > > dwc3@4a030000 {
> > > 	compatible = "snps,dwc3";
> > > 	reg = <0x4a030000 0xcfff>;
> > > 	interrupts = <0 92 4>
> > > 	usb-phy = <&usb2_phy>, <&usb3,phy>;
> > > 	tx-fifo-resize;
> > > };
> > > 
> > > This contains all the attributes it needs to work. In fact, this could
> > > be used without any glue.
> > > 
> > 
> > If you want to add "vbus-supply" core node to support ID switch, what's
> > the plan for that?
> 
> send a patch ? Just make sure it's optional because not everybody needs
> a vbus-supply. Also, DRD will still take a few merge windows to become a
> reality. I don't want to merge something before considering it carefuly,
> otherwise we will having which is broken and doesn't work for everybody
> ;-)
> 
> > Is it possible that the glue layer needs to access core register
> > (eg, portsc.phcd during suspend)? The wrapper IP may wait some signals
> > at core IP to change.
> 
> why would a glue layer need to access registers from the core ? That
> sounds very odd. I haven't seen that and will, definitely, NACK such a
> patch :-)
> 
> can you further describe why you think a glue layer might need to access
> core IP's registers ?

I just realised we're talking about chipidea here... in any case, it's
still valid to ask why would glue need to fiddle with core IP's
registers.

-- 
balbi

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

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

* Re: [PATCH v6 07/12] usb: chipidea: add a usb2 driver for ci13xxx
  2014-09-26  0:23       ` Peter Chen
@ 2014-09-26  7:01         ` Arnd Bergmann
  0 siblings, 0 replies; 52+ messages in thread
From: Arnd Bergmann @ 2014-09-26  7:01 UTC (permalink / raw)
  To: Peter Chen
  Cc: linux-arm-kernel, Antoine Tenart, thomas.petazzoni, zmxu,
	devicetree, linux-usb, linux-kernel, balbi, alexandre.belloni,
	p.zabel, jszhang, sebastian.hesselbarth

On Friday 26 September 2014 08:23:40 Peter Chen wrote:
> In current chipidea structure, the parent (glue layer) driver will not be
> used for dma, udc/host driver uses dma mask from child (core layer), at core
> layer we will do:
> 
> 
>         pdev->dev.dma_mask = dev->dma_mask; /* this device is parent */
>         dma_set_coherent_mask(&pdev->dev, dev->coherent_dma_mask);
> 
> Would you suggestion us a suitable way? Or it is ok we use just Antoine's way that
> call dma_coerce_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(32)) at parent
> driver no matter dt or non-dt? Thanks.

dma_coerce_mask_and_coherent is not ok, it will force a dma mask that is
unrelated to the actual requirements of the hardware.

I think the best way would be to never use the child device pointer for
DMA operations, just use a pointer to the parent device and make the
child dev->dma_mask pointer NULL to ensure all DMA operations fail.

	Arnd

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

* Re: [PATCH v6 07/12] usb: chipidea: add a usb2 driver for ci13xxx
  2014-09-26  0:39                             ` Felipe Balbi
@ 2014-09-26  7:20                               ` Arnd Bergmann
  2014-09-26 15:43                                 ` Felipe Balbi
  0 siblings, 1 reply; 52+ messages in thread
From: Arnd Bergmann @ 2014-09-26  7:20 UTC (permalink / raw)
  To: linux-arm-kernel, balbi
  Cc: thomas.petazzoni, zmxu, devicetree, Antoine Tenart, linux-usb,
	linux-kernel, alexandre.belloni, Peter Chen, p.zabel, jszhang,
	sebastian.hesselbarth

On Thursday 25 September 2014 19:39:34 Felipe Balbi wrote:
> > 
> > why would a glue layer need to access registers from the core ? That
> > sounds very odd. I haven't seen that and will, definitely, NACK such a
> > patch 
> > 
> > can you further describe why you think a glue layer might need to access
> > core IP's registers ?
> 
> I just realised we're talking about chipidea here... in any case, it's
> still valid to ask why would glue need to fiddle with core IP's
> registers.

Generally, the glue driver wouldn't access the registers, but I don't
think it's important to prevent it from doing that. In some cases, 
a glue driver needs to override a function of the core driver, e.g.
to work around an errata. We have a lot of those quirks in ATA drivers,
one example from ahci_mvebu.c is

static void ahci_mvebu_regret_option(struct ahci_host_priv *hpriv)
{
        /*
         * Enable the regret bit to allow the SATA unit to regret a
         * request that didn't receive an acknowlegde and avoid a
         * deadlock
         */
        writel(0x4, hpriv->mmio + AHCI_VENDOR_SPECIFIC_0_ADDR);
        writel(0x80, hpriv->mmio + AHCI_VENDOR_SPECIFIC_0_DATA);
}

	Arnd

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

* Re: [PATCH v6 07/12] usb: chipidea: add a usb2 driver for ci13xxx
  2014-09-26  7:20                               ` Arnd Bergmann
@ 2014-09-26 15:43                                 ` Felipe Balbi
  0 siblings, 0 replies; 52+ messages in thread
From: Felipe Balbi @ 2014-09-26 15:43 UTC (permalink / raw)
  To: Arnd Bergmann
  Cc: linux-arm-kernel, balbi, thomas.petazzoni, zmxu, devicetree,
	Antoine Tenart, linux-usb, linux-kernel, alexandre.belloni,
	Peter Chen, p.zabel, jszhang, sebastian.hesselbarth

[-- Attachment #1: Type: text/plain, Size: 1901 bytes --]

Hi,

On Fri, Sep 26, 2014 at 09:20:54AM +0200, Arnd Bergmann wrote:
> On Thursday 25 September 2014 19:39:34 Felipe Balbi wrote:
> > > 
> > > why would a glue layer need to access registers from the core ? That
> > > sounds very odd. I haven't seen that and will, definitely, NACK such a
> > > patch 
> > > 
> > > can you further describe why you think a glue layer might need to access
> > > core IP's registers ?
> > 
> > I just realised we're talking about chipidea here... in any case, it's
> > still valid to ask why would glue need to fiddle with core IP's
> > registers.
> 
> Generally, the glue driver wouldn't access the registers, but I don't
> think it's important to prevent it from doing that. In some cases, 

sure it is. Have already gone through debugging sessions just because
someone fiddled with registers they shouldn't. Also RMK's L2 rework
patchset is another example of why it's important to prevent other
layers from messing with registers they don't really own.

> a glue driver needs to override a function of the core driver, e.g.
> to work around an errata. We have a lot of those quirks in ATA drivers,

pass a quirk flag and let core driver handle it.

> one example from ahci_mvebu.c is
> 
> static void ahci_mvebu_regret_option(struct ahci_host_priv *hpriv)
> {
>         /*
>          * Enable the regret bit to allow the SATA unit to regret a
>          * request that didn't receive an acknowlegde and avoid a
>          * deadlock
>          */
>         writel(0x4, hpriv->mmio + AHCI_VENDOR_SPECIFIC_0_ADDR);
>         writel(0x80, hpriv->mmio + AHCI_VENDOR_SPECIFIC_0_DATA);

I would rather see:

	if (this_is_one_of_the_broken_mvebu_versions(hpriv))
		quirks |= AHCI_NEEDS_REGRET_BIT;

then let core handle the rest. If other glue has the same bug and needs
the workaround, we don't duplicate code.

-- 
balbi

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

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

* Re: [PATCH v6 07/12] usb: chipidea: add a usb2 driver for ci13xxx
  2014-09-26  0:37                           ` Felipe Balbi
  2014-09-26  0:39                             ` Felipe Balbi
@ 2014-09-28  0:40                             ` Peter Chen
  2014-10-13  8:47                             ` Peter Chen
  2 siblings, 0 replies; 52+ messages in thread
From: Peter Chen @ 2014-09-28  0:40 UTC (permalink / raw)
  To: Felipe Balbi
  Cc: Arnd Bergmann, Antoine Tenart, linux-arm-kernel,
	sebastian.hesselbarth, p.zabel, thomas.petazzoni, zmxu,
	devicetree, linux-usb, linux-kernel, alexandre.belloni, jszhang

On Thu, Sep 25, 2014 at 07:37:50PM -0500, Felipe Balbi wrote:
> HI,
> 
> On Fri, Sep 26, 2014 at 07:39:34AM +0800, Peter Chen wrote:
> > On Thu, Sep 25, 2014 at 09:15:53AM -0500, Felipe Balbi wrote:
> > > On Wed, Sep 24, 2014 at 02:23:38PM +0200, Arnd Bergmann wrote:
> > > > On Wednesday 24 September 2014 19:29:05 Peter Chen wrote:
> > > > > 
> > > > > So, it is IP CORE LIB (you suggest) vs IP CORE Platform Driver
> > > > > (dwc3, musb, chipidea) you are talking about, right? Except for
> > > > > creating another platform driver as well as related DT node (optional),
> > > > > are there any advantages compared to current IP core driver structure?
> > > > 
> > > > Having a library module usually requires less code, and is more
> > > > consistent with other drivers, which helps new developers understand
> > > > what the driver is doing.
> > > 
> > > I beg to differ. You end-up having to pass function pointers through
> > > platform_data to handle differences which could be handled by the core
> > > IP.
> > > 
> > > > The most important aspect though is the DT binding: once the structure
> > > > with separate kernel drivers leaks out into the DT format, you can't
> > > > easily change the driver any more, e.g. to make a property that was
> > > > introduced for one glue driver more general so it can get handled by
> > > > the common part. Having a single node lets us convert to the library
> > > > model later, so that would be a strong reason to keep the DT binding
> > > > simple, without child nodes.
> > > > 
> > > > Following that logic, it turns into another reason for using the library
> > > > model to start with, because otherwise the child device does not have
> > > > any DT properties itself and has to rely on the parent device properties,
> > > > which somewhat complicates the driver structure.
> > > 
> > > this is bullcrap. Take a look at
> > > Documentation/devicetree/bindings/usb/dwc3.txt:
> > > 
> > > synopsys DWC3 CORE
> > > 
> > > DWC3- USB3 CONTROLLER
> > > 
> > > Required properties:
> > >  - compatible: must be "snps,dwc3"
> > >  - reg : Address and length of the register set for the device
> > >  - interrupts: Interrupts used by the dwc3 controller.
> > > 
> > > Optional properties:
> > >  - usb-phy : array of phandle for the PHY device.  The first element
> > >    in the array is expected to be a handle to the USB2/HS PHY and
> > >    the second element is expected to be a handle to the USB3/SS PHY
> > >  - phys: from the *Generic PHY* bindings
> > >  - phy-names: from the *Generic PHY* bindings
> > >  - tx-fifo-resize: determines if the FIFO *has* to be reallocated.
> > > 
> > > This is usually a subnode to DWC3 glue to which it is connected.
> > > 
> > > dwc3@4a030000 {
> > > 	compatible = "snps,dwc3";
> > > 	reg = <0x4a030000 0xcfff>;
> > > 	interrupts = <0 92 4>
> > > 	usb-phy = <&usb2_phy>, <&usb3,phy>;
> > > 	tx-fifo-resize;
> > > };
> > > 
> > > This contains all the attributes it needs to work. In fact, this could
> > > be used without any glue.
> > > 
> > 
> > If you want to add "vbus-supply" core node to support ID switch, what's
> > the plan for that?
> 
> send a patch ? Just make sure it's optional because not everybody needs
> a vbus-supply. Also, DRD will still take a few merge windows to become a
> reality. I don't want to merge something before considering it carefuly,
> otherwise we will having which is broken and doesn't work for everybody
> ;-)
> 
> > Is it possible that the glue layer needs to access core register
> > (eg, portsc.phcd during suspend)? The wrapper IP may wait some signals
> > at core IP to change.
> 
> why would a glue layer need to access registers from the core ? That
> sounds very odd. I haven't seen that and will, definitely, NACK such a
> patch :-)
> 
> can you further describe why you think a glue layer might need to access
> core IP's registers ?
> 

My mistake, we can just wait core layer for finishing before doing PHY
and wrapper operation.

-- 
Best Regards,
Peter Chen

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

* Re: [PATCH v6 07/12] usb: chipidea: add a usb2 driver for ci13xxx
  2014-09-24 23:58   ` Sören Brinkmann
@ 2014-09-29 14:57     ` Antoine Tenart
  0 siblings, 0 replies; 52+ messages in thread
From: Antoine Tenart @ 2014-09-29 14:57 UTC (permalink / raw)
  To: Sören Brinkmann
  Cc: Antoine Tenart, sebastian.hesselbarth, Peter.Chen, balbi,
	p.zabel, alexandre.belloni, thomas.petazzoni, zmxu, jszhang,
	linux-arm-kernel, linux-usb, devicetree, linux-kernel

On Wed, Sep 24, 2014 at 04:58:14PM -0700, Sören Brinkmann wrote:
> On Tue, 2014-09-23 at 12:28PM +0200, Antoine Tenart wrote:
> > Add a USB2 ChipIdea driver for ci13xxx, with optional PHY, clock
> > and DMA mask, to support USB2 ChipIdea controllers that don't need
> > specific functions.
> > 
> > Tested on the Marvell Berlin SoCs USB controllers.
> > 
> > Signed-off-by: Antoine Tenart <antoine.tenart@free-electrons.com>
> 
> This driver also works for Zynq. I didn't do extensive testing, but I
> could access a flash drive successfully.
> 
> Tested-by: Soren Brinkmann <soren.brinkmann@xilinx.com>

Thanks!

Antoine

-- 
Antoine Ténart, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com

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

* Re: [PATCH v6 07/12] usb: chipidea: add a usb2 driver for ci13xxx
  2014-09-23 10:28 ` [PATCH v6 07/12] usb: chipidea: add a usb2 driver for ci13xxx Antoine Tenart
                     ` (3 preceding siblings ...)
  2014-09-25 19:12   ` Arnd Bergmann
@ 2014-09-29 15:08   ` Antoine Tenart
  2014-10-01 12:39     ` Antoine Tenart
  2014-09-30  0:12   ` Peter Chen
  5 siblings, 1 reply; 52+ messages in thread
From: Antoine Tenart @ 2014-09-29 15:08 UTC (permalink / raw)
  To: sebastian.hesselbarth, Peter.Chen, balbi, p.zabel, arnd
  Cc: Antoine Tenart, alexandre.belloni, thomas.petazzoni, zmxu,
	jszhang, linux-arm-kernel, linux-usb, devicetree, linux-kernel

Peter, Arnd, Felipe,

On Tue, Sep 23, 2014 at 12:28:03PM +0200, Antoine Tenart wrote:
> Add a USB2 ChipIdea driver for ci13xxx, with optional PHY, clock
> and DMA mask, to support USB2 ChipIdea controllers that don't need
> specific functions.

Did we agree on the modifications needed to get this accepted? If so,
can one of you sum up what's need to be done, I got a bit lost reading
all the discussions on this thread.

Anyway, that would be good to get this series accepted as the Berlin USB
support depends on it. This series has been out since the beginning of
June and non-critical changes can be added by future series.

Thanks,

Antoine

-- 
Antoine Ténart, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com

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

* Re: [PATCH v6 07/12] usb: chipidea: add a usb2 driver for ci13xxx
  2014-09-23 10:28 ` [PATCH v6 07/12] usb: chipidea: add a usb2 driver for ci13xxx Antoine Tenart
                     ` (4 preceding siblings ...)
  2014-09-29 15:08   ` Antoine Tenart
@ 2014-09-30  0:12   ` Peter Chen
  2014-09-30 10:03     ` Arnd Bergmann
  2014-10-01 23:40     ` Peter Chen
  5 siblings, 2 replies; 52+ messages in thread
From: Peter Chen @ 2014-09-30  0:12 UTC (permalink / raw)
  To: Antoine Tenart
  Cc: sebastian.hesselbarth, balbi, p.zabel, alexandre.belloni,
	thomas.petazzoni, zmxu, jszhang, linux-arm-kernel, linux-usb,
	devicetree, linux-kernel

On Tue, Sep 23, 2014 at 12:28:03PM +0200, Antoine Tenart wrote:
> Add a USB2 ChipIdea driver for ci13xxx, with optional PHY, clock
> and DMA mask, to support USB2 ChipIdea controllers that don't need
> specific functions.
> 
> Tested on the Marvell Berlin SoCs USB controllers.
> 
> Signed-off-by: Antoine Tenart <antoine.tenart@free-electrons.com>
> ---
>  drivers/usb/chipidea/Makefile       |   1 +
>  drivers/usb/chipidea/ci_hdrc_usb2.c | 138 ++++++++++++++++++++++++++++++++++++
>  2 files changed, 139 insertions(+)
>  create mode 100644 drivers/usb/chipidea/ci_hdrc_usb2.c
> 
> diff --git a/drivers/usb/chipidea/Makefile b/drivers/usb/chipidea/Makefile
> index 2f099c7df7b5..1fc86a2ca22d 100644
> --- a/drivers/usb/chipidea/Makefile
> +++ b/drivers/usb/chipidea/Makefile
> @@ -10,6 +10,7 @@ ci_hdrc-$(CONFIG_USB_OTG_FSM)		+= otg_fsm.o
>  
>  # Glue/Bridge layers go here
>  
> +obj-$(CONFIG_USB_CHIPIDEA)	+= ci_hdrc_usb2.o
>  obj-$(CONFIG_USB_CHIPIDEA)	+= ci_hdrc_msm.o
>  obj-$(CONFIG_USB_CHIPIDEA)	+= ci_hdrc_zevio.o
>  
> diff --git a/drivers/usb/chipidea/ci_hdrc_usb2.c b/drivers/usb/chipidea/ci_hdrc_usb2.c
> new file mode 100644
> index 000000000000..6eae1de587f2
> --- /dev/null
> +++ b/drivers/usb/chipidea/ci_hdrc_usb2.c
> @@ -0,0 +1,138 @@
> +/*
> + * Copyright (C) 2014 Marvell Technology Group Ltd.
> + *
> + * Antoine Tenart <antoine.tenart@free-electrons.com>
> + *
> + * This file is licensed under the terms of the GNU General Public
> + * License version 2. This program is licensed "as is" without any
> + * warranty of any kind, whether express or implied.
> + */
> +
> +#include <linux/clk.h>
> +#include <linux/dma-mapping.h>
> +#include <linux/module.h>
> +#include <linux/of.h>
> +#include <linux/phy/phy.h>
> +#include <linux/platform_device.h>
> +#include <linux/usb/chipidea.h>
> +#include <linux/usb/hcd.h>
> +#include <linux/usb/ulpi.h>
> +
> +#include "ci.h"
> +
> +struct ci_hdrc_usb2_priv {
> +	struct platform_device	*ci_pdev;
> +	struct clk		*clk;
> +};
> +
> +static int ci_hdrc_usb2_dt_probe(struct device *dev,
> +				 struct ci_hdrc_platform_data *ci_pdata)
> +{
> +	ci_pdata->phy = of_phy_get(dev->of_node, 0);
> +	if (IS_ERR(ci_pdata->phy)) {
> +		if (PTR_ERR(ci_pdata->phy) == -EPROBE_DEFER)
> +			return -EPROBE_DEFER;
> +
> +		/* PHY is optional */
> +		ci_pdata->phy = NULL;
> +	}
> +
> +	return 0;
> +}
> +
> +static struct ci_hdrc_platform_data ci_default_pdata = {
> +	.capoffset	= DEF_CAPOFFSET,
> +	.flags		= CI_HDRC_REQUIRE_TRANSCEIVER |
> +			  CI_HDRC_DISABLE_STREAMING,
> +};
> +
> +static int ci_hdrc_usb2_probe(struct platform_device *pdev)
> +{
> +	struct device *dev = &pdev->dev;
> +	struct ci_hdrc_usb2_priv *priv;
> +	struct ci_hdrc_platform_data *ci_pdata = dev_get_platdata(&pdev->dev);
> +	int ret;
> +
> +	if (!ci_pdata)
> +		ci_pdata = &ci_default_pdata;
> +
> +	priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL);
> +	if (!priv)
> +		return -ENOMEM;
> +
> +	priv->clk = devm_clk_get(dev, NULL);
> +	if (!IS_ERR(priv->clk)) {
> +		ret = clk_prepare_enable(priv->clk);
> +		if (ret) {
> +			dev_err(dev, "failed to enable the clock: %d\n", ret);
> +			return ret;
> +		}
> +	}
> +
> +	if (dev->of_node) {
> +		ret = ci_hdrc_usb2_dt_probe(dev, ci_pdata);
> +		if (ret)
> +			goto clk_err;
> +	} else {
> +		ret = dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(32));
> +		if (ret)
> +			goto clk_err;
> +	}

My suggestion:

- call dma_coerce_mask_and_coherent(&dev->dev, DMA_BIT_MASK(32)) for both 
dt and non-dt
- Do not need function ci_hdrc_usb2_dt_probe, the phy handle should be moved
to core driver, since your generic phy driver are still not accepted, I
can't do it by myself. Either you or I can do it after your generic phy support
series has been accepted.
- Others are ok.

Peter

> +
> +	ci_pdata->name = dev_name(&pdev->dev);
> +
> +	priv->ci_pdev = ci_hdrc_add_device(dev, pdev->resource,
> +					   pdev->num_resources, ci_pdata);
> +	if (IS_ERR(priv->ci_pdev)) {
> +		ret = PTR_ERR(priv->ci_pdev);
> +		if (ret != -EPROBE_DEFER)
> +			dev_err(dev,
> +				"failed to register ci_hdrc platform device: %d\n",
> +				ret);
> +		goto clk_err;
> +	}
> +
> +	platform_set_drvdata(pdev, priv);
> +
> +	pm_runtime_no_callbacks(dev);
> +	pm_runtime_enable(dev);
> +
> +	return 0;
> +
> +clk_err:
> +	if (!IS_ERR(priv->clk))
> +		clk_disable_unprepare(priv->clk);
> +	return ret;
> +}
> +
> +static int ci_hdrc_usb2_remove(struct platform_device *pdev)
> +{
> +	struct ci_hdrc_usb2_priv *priv = platform_get_drvdata(pdev);
> +
> +	pm_runtime_disable(&pdev->dev);
> +	ci_hdrc_remove_device(priv->ci_pdev);
> +	clk_disable_unprepare(priv->clk);
> +
> +	return 0;
> +}
> +
> +static const struct of_device_id ci_hdrc_usb2_of_match[] = {
> +	{ .compatible = "chipidea,usb2" },
> +	{ }
> +};
> +MODULE_DEVICE_TABLE(of, ci_hdrc_usb2_of_match);
> +
> +static struct platform_driver ci_hdrc_usb2_driver = {
> +	.probe	= ci_hdrc_usb2_probe,
> +	.remove	= ci_hdrc_usb2_remove,
> +	.driver	= {
> +		.name		= "chipidea-usb2",
> +		.owner		= THIS_MODULE,
> +		.of_match_table	= of_match_ptr(ci_hdrc_usb2_of_match),
> +	},
> +};
> +module_platform_driver(ci_hdrc_usb2_driver);
> +
> +MODULE_DESCRIPTION("ChipIdea HDRC USB2 binding for ci13xxx");
> +MODULE_AUTHOR("Antoine Tenart <antoine.tenart@free-electrons.com>");
> +MODULE_LICENSE("GPL");
> -- 
> 1.9.1
> 

-- 
Best Regards,
Peter Chen

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

* Re: [PATCH v6 07/12] usb: chipidea: add a usb2 driver for ci13xxx
  2014-09-30  0:12   ` Peter Chen
@ 2014-09-30 10:03     ` Arnd Bergmann
  2014-09-30 12:39       ` Peter Chen
  2014-10-01 23:40     ` Peter Chen
  1 sibling, 1 reply; 52+ messages in thread
From: Arnd Bergmann @ 2014-09-30 10:03 UTC (permalink / raw)
  To: linux-arm-kernel
  Cc: Peter Chen, Antoine Tenart, thomas.petazzoni, zmxu, devicetree,
	linux-usb, linux-kernel, balbi, alexandre.belloni, p.zabel,
	jszhang, sebastian.hesselbarth

On Tuesday 30 September 2014 08:12:07 Peter Chen wrote:
> > +
> > +     if (dev->of_node) {
> > +             ret = ci_hdrc_usb2_dt_probe(dev, ci_pdata);
> > +             if (ret)
> > +                     goto clk_err;
> > +     } else {
> > +             ret = dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(32));
> > +             if (ret)
> > +                     goto clk_err;
> > +     }
> 
> My suggestion:
> 
> - call dma_coerce_mask_and_coherent(&dev->dev, DMA_BIT_MASK(32)) for both 
> dt and non-dt

No, as I explained before, hardcoding the dma mask is always wrong, don't
do that. Call dma_set_mask_and_coherent and check the return value.
It's not wrong to do that for both DT and ATAGS.

	Arnd

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

* Re: [PATCH v6 07/12] usb: chipidea: add a usb2 driver for ci13xxx
  2014-09-30 10:03     ` Arnd Bergmann
@ 2014-09-30 12:39       ` Peter Chen
  2014-09-30 13:43         ` Arnd Bergmann
  0 siblings, 1 reply; 52+ messages in thread
From: Peter Chen @ 2014-09-30 12:39 UTC (permalink / raw)
  To: Arnd Bergmann
  Cc: linux-arm-kernel, Antoine Tenart, thomas.petazzoni, zmxu,
	devicetree, linux-usb, linux-kernel, balbi, alexandre.belloni,
	p.zabel, jszhang, sebastian.hesselbarth

On Tue, Sep 30, 2014 at 12:03:42PM +0200, Arnd Bergmann wrote:
> On Tuesday 30 September 2014 08:12:07 Peter Chen wrote:
> > > +
> > > +     if (dev->of_node) {
> > > +             ret = ci_hdrc_usb2_dt_probe(dev, ci_pdata);
> > > +             if (ret)
> > > +                     goto clk_err;
> > > +     } else {
> > > +             ret = dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(32));
> > > +             if (ret)
> > > +                     goto clk_err;
> > > +     }
> > 
> > My suggestion:
> > 
> > - call dma_coerce_mask_and_coherent(&dev->dev, DMA_BIT_MASK(32)) for both 
> > dt and non-dt
> 
> No, as I explained before, hardcoding the dma mask is always wrong, don't
> do that. Call dma_set_mask_and_coherent and check the return value.
> It's not wrong to do that for both DT and ATAGS.
> 

Thanks, Arnd. I had not thought setting dma mask is so complicated, yes, it
should check the return value, two things to confirm:

- dma_coerce_mask_and_coherent or dma_set_mask_and_coherent, the only difference
of these two API is the first one do "dev->dma_mask = &dev->coherent_dma_mask;"
The reason you suggest choosing dma_set_mask_and_coherent is you do not want
assign dev->dma_mask?
- The second parameter for dma_set_mask_and_coherent is DMA_BIT_MASK(32), is it
ok?

I just a little confused of what's the operation is "hardcoding the dma mask"?

-- 
Best Regards,
Peter Chen

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

* Re: [PATCH v6 07/12] usb: chipidea: add a usb2 driver for ci13xxx
  2014-09-30 12:39       ` Peter Chen
@ 2014-09-30 13:43         ` Arnd Bergmann
  2014-10-01  6:35           ` Peter Chen
  0 siblings, 1 reply; 52+ messages in thread
From: Arnd Bergmann @ 2014-09-30 13:43 UTC (permalink / raw)
  To: Peter Chen
  Cc: linux-arm-kernel, Antoine Tenart, thomas.petazzoni, zmxu,
	devicetree, linux-usb, linux-kernel, balbi, alexandre.belloni,
	p.zabel, jszhang, sebastian.hesselbarth

On Tuesday 30 September 2014 20:39:34 Peter Chen wrote:
> Thanks, Arnd. I had not thought setting dma mask is so complicated, yes, it
> should check the return value, two things to confirm:
> 
> - dma_coerce_mask_and_coherent or dma_set_mask_and_coherent, the only difference
> of these two API is the first one do "dev->dma_mask = &dev->coherent_dma_mask;"
> The reason you suggest choosing dma_set_mask_and_coherent is you do not want
> assign dev->dma_mask?

No, that is just the current definition on ARM32 with CONFIG_ARCH_MULTIPLATFORM, and
that is going to change soon to be DT aware.
dma_set_mask_and_coherent() is supposed to check whether the platform can support
the respective mask and return an error if it cannot.

> - The second parameter for dma_set_mask_and_coherent is DMA_BIT_MASK(32), is it
> ok?
> 
> I just a little confused of what's the operation is "hardcoding the dma mask"?

dma_coerce_mask_and_coherent() will hardcode the dma mask and override whatever
the platform says is necessary.

	Arnd

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

* RE: [PATCH v6 07/12] usb: chipidea: add a usb2 driver for ci13xxx
  2014-09-30 13:43         ` Arnd Bergmann
@ 2014-10-01  6:35           ` Peter Chen
  2014-10-01  8:41             ` Arnd Bergmann
  0 siblings, 1 reply; 52+ messages in thread
From: Peter Chen @ 2014-10-01  6:35 UTC (permalink / raw)
  To: Arnd Bergmann
  Cc: linux-arm-kernel, Antoine Tenart, thomas.petazzoni, zmxu,
	devicetree, linux-usb, linux-kernel, balbi, alexandre.belloni,
	p.zabel, jszhang, sebastian.hesselbarth

 
> Subject: Re: [PATCH v6 07/12] usb: chipidea: add a usb2 driver for ci13xxx
> 
> On Tuesday 30 September 2014 20:39:34 Peter Chen wrote:
> > Thanks, Arnd. I had not thought setting dma mask is so complicated,
> > yes, it should check the return value, two things to confirm:
> >
> > - dma_coerce_mask_and_coherent or dma_set_mask_and_coherent, the
> only
> > difference of these two API is the first one do "dev->dma_mask = &dev-
> >coherent_dma_mask;"
> > The reason you suggest choosing dma_set_mask_and_coherent is you do
> > not want assign dev->dma_mask?
> 
> No, that is just the current definition on ARM32 with
> CONFIG_ARCH_MULTIPLATFORM, and that is going to change soon to be DT
> aware.
> dma_set_mask_and_coherent() is supposed to check whether the platform
> can support the respective mask and return an error if it cannot.
> 
> > - The second parameter for dma_set_mask_and_coherent is
> > DMA_BIT_MASK(32), is it ok?
> >
> > I just a little confused of what's the operation is "hardcoding the dma mask"?
> 
> dma_coerce_mask_and_coherent() will hardcode the dma mask and override
> whatever the platform says is necessary.
> 

So, we should use dma_set_mask_and_coherent() in most of cases in device driver,
and use dma_coerce_mask_and_coherent() only  when the device's dma_mask is wrong?

Peter


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

* Re: [PATCH v6 07/12] usb: chipidea: add a usb2 driver for ci13xxx
  2014-10-01  6:35           ` Peter Chen
@ 2014-10-01  8:41             ` Arnd Bergmann
  2014-10-01 12:25               ` Peter Chen
  0 siblings, 1 reply; 52+ messages in thread
From: Arnd Bergmann @ 2014-10-01  8:41 UTC (permalink / raw)
  To: Peter Chen
  Cc: linux-arm-kernel, Antoine Tenart, thomas.petazzoni, zmxu,
	devicetree, linux-usb, linux-kernel, balbi, alexandre.belloni,
	p.zabel, jszhang, sebastian.hesselbarth

On Wednesday 01 October 2014 06:35:58 Peter Chen wrote:
> > Subject: Re: [PATCH v6 07/12] usb: chipidea: add a usb2 driver for ci13xxx
> > 
> > On Tuesday 30 September 2014 20:39:34 Peter Chen wrote:
> > > Thanks, Arnd. I had not thought setting dma mask is so complicated,
> > > yes, it should check the return value, two things to confirm:
> > >
> > > - dma_coerce_mask_and_coherent or dma_set_mask_and_coherent, the
> > only
> > > difference of these two API is the first one do "dev->dma_mask = &dev-
> > >coherent_dma_mask;"
> > > The reason you suggest choosing dma_set_mask_and_coherent is you do
> > > not want assign dev->dma_mask?
> > 
> > No, that is just the current definition on ARM32 with
> > CONFIG_ARCH_MULTIPLATFORM, and that is going to change soon to be DT
> > aware.
> > dma_set_mask_and_coherent() is supposed to check whether the platform
> > can support the respective mask and return an error if it cannot.
> > 
> > > - The second parameter for dma_set_mask_and_coherent is
> > > DMA_BIT_MASK(32), is it ok?
> > >
> > > I just a little confused of what's the operation is "hardcoding the dma mask"?
> > 
> > dma_coerce_mask_and_coherent() will hardcode the dma mask and override
> > whatever the platform says is necessary.
> > 
> 
> So, we should use dma_set_mask_and_coherent() in most of cases in device driver,
> and use dma_coerce_mask_and_coherent() only  when the device's dma_mask is wrong?
> 
> 

dma_coerce_mask_and_coherent() should really not be used at all. Russell
introduced it to convert drivers that were incorrectly setting the dma_mask
pointer themselves to something slightly more palatable.

The initial dma_mask is supposed to be set by the platform for each DMA
capable device, according to the address width of its upstream bus.
For DT based probing, we now set it to 32-bit mask but should really set
it to something smaller if the bus is more limited than that.

For devices created by platform code (board files), the platform should
call platform_device_register_full() and specify the dma mask in the
platform_device_info. Older platforms sometimes define a static platform
device structure that has the dma mask set. This works as well but is
discouraged for other reasons.

Drivers that require a dma mask that is either smaller than 32-bit (because
of device specific quirks) or that know that the device is capable of
larger DMA space and want to use that need to call dma_set_mask or
dma_set_mask_and_coherent and check the return value.

Ideally all device drivers that want to do DMA should call set_dma_mask
or set_dma_mask_and_coherent, even if the device has exactly a 32-bit
connection to the upstream bus.	

One more complication: if the device is not a DMA master itself but
uses a dma engine, you should not use set_dma_mask_and_coherent()
but instead use dma_get_mask() on the dmaengine device to query its
mask, and also use that same pointer to pass into dma_alloc_coherent
and dma_map_*.

	Arnd

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

* RE: [PATCH v6 07/12] usb: chipidea: add a usb2 driver for ci13xxx
  2014-10-01  8:41             ` Arnd Bergmann
@ 2014-10-01 12:25               ` Peter Chen
  0 siblings, 0 replies; 52+ messages in thread
From: Peter Chen @ 2014-10-01 12:25 UTC (permalink / raw)
  To: Arnd Bergmann
  Cc: linux-arm-kernel, Antoine Tenart, thomas.petazzoni, zmxu,
	devicetree, linux-usb, linux-kernel, balbi, alexandre.belloni,
	p.zabel, jszhang, sebastian.hesselbarth

 
> On Wednesday 01 October 2014 06:35:58 Peter Chen wrote:
> > > Subject: Re: [PATCH v6 07/12] usb: chipidea: add a usb2 driver for
> > > ci13xxx
> > >
> > > On Tuesday 30 September 2014 20:39:34 Peter Chen wrote:
> > > > Thanks, Arnd. I had not thought setting dma mask is so
> > > > complicated, yes, it should check the return value, two things to confirm:
> > > >
> > > > - dma_coerce_mask_and_coherent or dma_set_mask_and_coherent,
> the
> > > only
> > > > difference of these two API is the first one do "dev->dma_mask =
> > > >&dev- coherent_dma_mask;"
> > > > The reason you suggest choosing dma_set_mask_and_coherent is you
> > > >do  not want assign dev->dma_mask?
> > >
> > > No, that is just the current definition on ARM32 with
> > > CONFIG_ARCH_MULTIPLATFORM, and that is going to change soon to be
> DT
> > > aware.
> > > dma_set_mask_and_coherent() is supposed to check whether the
> > > platform can support the respective mask and return an error if it cannot.
> > >
> > > > - The second parameter for dma_set_mask_and_coherent is
> > > > DMA_BIT_MASK(32), is it ok?
> > > >
> > > > I just a little confused of what's the operation is "hardcoding the dma
> mask"?
> > >
> > > dma_coerce_mask_and_coherent() will hardcode the dma mask and
> > > override whatever the platform says is necessary.
> > >
> >
> > So, we should use dma_set_mask_and_coherent() in most of cases in
> > device driver, and use dma_coerce_mask_and_coherent() only  when the
> device's dma_mask is wrong?
> >
> >
> 
> dma_coerce_mask_and_coherent() should really not be used at all. Russell
> introduced it to convert drivers that were incorrectly setting the dma_mask
> pointer themselves to something slightly more palatable.
> 
> The initial dma_mask is supposed to be set by the platform for each DMA
> capable device, according to the address width of its upstream bus.
> For DT based probing, we now set it to 32-bit mask but should really set it to
> something smaller if the bus is more limited than that.
> 
> For devices created by platform code (board files), the platform should call
> platform_device_register_full() and specify the dma mask in the
> platform_device_info. Older platforms sometimes define a static platform
> device structure that has the dma mask set. This works as well but is
> discouraged for other reasons.
> 
> Drivers that require a dma mask that is either smaller than 32-bit (because of
> device specific quirks) or that know that the device is capable of larger DMA
> space and want to use that need to call dma_set_mask or
> dma_set_mask_and_coherent and check the return value.
> 
> Ideally all device drivers that want to do DMA should call set_dma_mask or
> set_dma_mask_and_coherent, even if the device has exactly a 32-bit
> connection to the upstream bus.
> 
> One more complication: if the device is not a DMA master itself but uses a dma
> engine, you should not use set_dma_mask_and_coherent() but instead use
> dma_get_mask() on the dmaengine device to query its mask, and also use that
> same pointer to pass into dma_alloc_coherent and dma_map_*.
> 
 
Thank you very much, Arnd. It makes things clear.

Peter

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

* Re: [PATCH v6 07/12] usb: chipidea: add a usb2 driver for ci13xxx
  2014-09-29 15:08   ` Antoine Tenart
@ 2014-10-01 12:39     ` Antoine Tenart
  0 siblings, 0 replies; 52+ messages in thread
From: Antoine Tenart @ 2014-10-01 12:39 UTC (permalink / raw)
  To: sebastian.hesselbarth, Peter.Chen, balbi, p.zabel, arnd
  Cc: Antoine Tenart, alexandre.belloni, thomas.petazzoni, zmxu,
	jszhang, linux-arm-kernel, linux-usb, devicetree, linux-kernel

Peter, Arnd, Felipe,

On Mon, Sep 29, 2014 at 05:08:37PM +0200, Antoine Tenart wrote:
> On Tue, Sep 23, 2014 at 12:28:03PM +0200, Antoine Tenart wrote:
> > Add a USB2 ChipIdea driver for ci13xxx, with optional PHY, clock
> > and DMA mask, to support USB2 ChipIdea controllers that don't need
> > specific functions.
> 
> Did we agree on the modifications needed to get this accepted? If so,
> can one of you sum up what's need to be done, I got a bit lost reading
> all the discussions on this thread.
> 
> Anyway, that would be good to get this series accepted as the Berlin USB
> support depends on it. This series has been out since the beginning of
> June and non-critical changes can be added by future series.

I'm seriously considering sending a new version with dt-only support as I
don't need the other case. There are still many discussions between the
three of you regarding DMA support, which is not a problem for my use
case. As this is not a modification of an existing driver, future
additions can be done to support more cases later and we do not need
this driver to handle all possible cases right now as this won't be a
regression.

Please, can one of you sum up the modifications needed to get this
accepted, if any. If the dt part is fine for you, I'll resend this
series with dt-only support. The platform compatibility can surely be
added later, when needed by someone, and when an agreement on how to do
it is reached.

I'm afraid this series is currently blocked by implementation related
discussions not linked with the USB Berlin support, while this could be
done as a follow up series.

Thanks,

Antoine

-- 
Antoine Ténart, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com

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

* Re: [PATCH v6 07/12] usb: chipidea: add a usb2 driver for ci13xxx
  2014-09-30  0:12   ` Peter Chen
  2014-09-30 10:03     ` Arnd Bergmann
@ 2014-10-01 23:40     ` Peter Chen
  1 sibling, 0 replies; 52+ messages in thread
From: Peter Chen @ 2014-10-01 23:40 UTC (permalink / raw)
  To: Antoine Tenart
  Cc: sebastian.hesselbarth, balbi, p.zabel, alexandre.belloni,
	thomas.petazzoni, zmxu, jszhang, linux-arm-kernel, linux-usb,
	devicetree, linux-kernel

On Tue, Sep 30, 2014 at 08:12:07AM +0800, Peter Chen wrote:
> On Tue, Sep 23, 2014 at 12:28:03PM +0200, Antoine Tenart wrote:
> > Add a USB2 ChipIdea driver for ci13xxx, with optional PHY, clock
> > and DMA mask, to support USB2 ChipIdea controllers that don't need
> > specific functions.
> > 
> > Tested on the Marvell Berlin SoCs USB controllers.
> > 
> > Signed-off-by: Antoine Tenart <antoine.tenart@free-electrons.com>
> > ---
> >  drivers/usb/chipidea/Makefile       |   1 +
> >  drivers/usb/chipidea/ci_hdrc_usb2.c | 138 ++++++++++++++++++++++++++++++++++++
> >  2 files changed, 139 insertions(+)
> >  create mode 100644 drivers/usb/chipidea/ci_hdrc_usb2.c
> > 
> > diff --git a/drivers/usb/chipidea/Makefile b/drivers/usb/chipidea/Makefile
> > index 2f099c7df7b5..1fc86a2ca22d 100644
> > --- a/drivers/usb/chipidea/Makefile
> > +++ b/drivers/usb/chipidea/Makefile
> > @@ -10,6 +10,7 @@ ci_hdrc-$(CONFIG_USB_OTG_FSM)		+= otg_fsm.o
> >  
> >  # Glue/Bridge layers go here
> >  
> > +obj-$(CONFIG_USB_CHIPIDEA)	+= ci_hdrc_usb2.o
> >  obj-$(CONFIG_USB_CHIPIDEA)	+= ci_hdrc_msm.o
> >  obj-$(CONFIG_USB_CHIPIDEA)	+= ci_hdrc_zevio.o
> >  
> > diff --git a/drivers/usb/chipidea/ci_hdrc_usb2.c b/drivers/usb/chipidea/ci_hdrc_usb2.c
> > new file mode 100644
> > index 000000000000..6eae1de587f2
> > --- /dev/null
> > +++ b/drivers/usb/chipidea/ci_hdrc_usb2.c
> > @@ -0,0 +1,138 @@
> > +/*
> > + * Copyright (C) 2014 Marvell Technology Group Ltd.
> > + *
> > + * Antoine Tenart <antoine.tenart@free-electrons.com>
> > + *
> > + * This file is licensed under the terms of the GNU General Public
> > + * License version 2. This program is licensed "as is" without any
> > + * warranty of any kind, whether express or implied.
> > + */
> > +
> > +#include <linux/clk.h>
> > +#include <linux/dma-mapping.h>
> > +#include <linux/module.h>
> > +#include <linux/of.h>
> > +#include <linux/phy/phy.h>
> > +#include <linux/platform_device.h>
> > +#include <linux/usb/chipidea.h>
> > +#include <linux/usb/hcd.h>
> > +#include <linux/usb/ulpi.h>
> > +
> > +#include "ci.h"
> > +
> > +struct ci_hdrc_usb2_priv {
> > +	struct platform_device	*ci_pdev;
> > +	struct clk		*clk;
> > +};
> > +
> > +static int ci_hdrc_usb2_dt_probe(struct device *dev,
> > +				 struct ci_hdrc_platform_data *ci_pdata)
> > +{
> > +	ci_pdata->phy = of_phy_get(dev->of_node, 0);
> > +	if (IS_ERR(ci_pdata->phy)) {
> > +		if (PTR_ERR(ci_pdata->phy) == -EPROBE_DEFER)
> > +			return -EPROBE_DEFER;
> > +
> > +		/* PHY is optional */
> > +		ci_pdata->phy = NULL;
> > +	}
> > +
> > +	return 0;
> > +}
> > +
> > +static struct ci_hdrc_platform_data ci_default_pdata = {
> > +	.capoffset	= DEF_CAPOFFSET,
> > +	.flags		= CI_HDRC_REQUIRE_TRANSCEIVER |
> > +			  CI_HDRC_DISABLE_STREAMING,
> > +};
> > +
> > +static int ci_hdrc_usb2_probe(struct platform_device *pdev)
> > +{
> > +	struct device *dev = &pdev->dev;
> > +	struct ci_hdrc_usb2_priv *priv;
> > +	struct ci_hdrc_platform_data *ci_pdata = dev_get_platdata(&pdev->dev);
> > +	int ret;
> > +
> > +	if (!ci_pdata)
> > +		ci_pdata = &ci_default_pdata;
> > +
> > +	priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL);
> > +	if (!priv)
> > +		return -ENOMEM;
> > +
> > +	priv->clk = devm_clk_get(dev, NULL);
> > +	if (!IS_ERR(priv->clk)) {
> > +		ret = clk_prepare_enable(priv->clk);
> > +		if (ret) {
> > +			dev_err(dev, "failed to enable the clock: %d\n", ret);
> > +			return ret;
> > +		}
> > +	}
> > +
> > +	if (dev->of_node) {
> > +		ret = ci_hdrc_usb2_dt_probe(dev, ci_pdata);
> > +		if (ret)
> > +			goto clk_err;
> > +	} else {
> > +		ret = dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(32));
> > +		if (ret)
> > +			goto clk_err;
> > +	}
>
	
Hi Antoine, if you pay attention the discussion for this patch, you should
know to do change for your next revision

- Call below unconditionally:
> > +		ret = dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(32));
> > +		if (ret)
> > +			goto clk_err;

-Do not need function ci_hdrc_usb2_dt_probe, we need to cover
both dt and non-dt, but there is nothing we can to differentiate now,
The phy handle should be moved to core driver, since your generic phy
driver are still not accepted, I can't do it by myself. Either you or
I can do it after your generic phy support series has been accepted.

> > +		ret = ci_hdrc_usb2_dt_probe(dev, ci_pdata);

- Others are ok

- The sequence of patch sets:
1. The generic PHY support for chipidea idea
2. Move getting PHY from individual glue layer to core driver
3. The generic chipidea driver 

Peter

> > +
> > +	ci_pdata->name = dev_name(&pdev->dev);
> > +
> > +	priv->ci_pdev = ci_hdrc_add_device(dev, pdev->resource,
> > +					   pdev->num_resources, ci_pdata);
> > +	if (IS_ERR(priv->ci_pdev)) {
> > +		ret = PTR_ERR(priv->ci_pdev);
> > +		if (ret != -EPROBE_DEFER)
> > +			dev_err(dev,
> > +				"failed to register ci_hdrc platform device: %d\n",
> > +				ret);
> > +		goto clk_err;
> > +	}
> > +
> > +	platform_set_drvdata(pdev, priv);
> > +
> > +	pm_runtime_no_callbacks(dev);
> > +	pm_runtime_enable(dev);
> > +
> > +	return 0;
> > +
> > +clk_err:
> > +	if (!IS_ERR(priv->clk))
> > +		clk_disable_unprepare(priv->clk);
> > +	return ret;
> > +}
> > +
> > +static int ci_hdrc_usb2_remove(struct platform_device *pdev)
> > +{
> > +	struct ci_hdrc_usb2_priv *priv = platform_get_drvdata(pdev);
> > +
> > +	pm_runtime_disable(&pdev->dev);
> > +	ci_hdrc_remove_device(priv->ci_pdev);
> > +	clk_disable_unprepare(priv->clk);
> > +
> > +	return 0;
> > +}
> > +
> > +static const struct of_device_id ci_hdrc_usb2_of_match[] = {
> > +	{ .compatible = "chipidea,usb2" },
> > +	{ }
> > +};
> > +MODULE_DEVICE_TABLE(of, ci_hdrc_usb2_of_match);
> > +
> > +static struct platform_driver ci_hdrc_usb2_driver = {
> > +	.probe	= ci_hdrc_usb2_probe,
> > +	.remove	= ci_hdrc_usb2_remove,
> > +	.driver	= {
> > +		.name		= "chipidea-usb2",
> > +		.owner		= THIS_MODULE,
> > +		.of_match_table	= of_match_ptr(ci_hdrc_usb2_of_match),
> > +	},
> > +};
> > +module_platform_driver(ci_hdrc_usb2_driver);
> > +
> > +MODULE_DESCRIPTION("ChipIdea HDRC USB2 binding for ci13xxx");
> > +MODULE_AUTHOR("Antoine Tenart <antoine.tenart@free-electrons.com>");
> > +MODULE_LICENSE("GPL");
> > -- 
> > 1.9.1
> > 
> 
> -- 
> Best Regards,
> Peter Chen
> --
> To unsubscribe from this list: send the line "unsubscribe linux-usb" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

-- 
Best Regards,
Peter Chen

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

* Re: [PATCH v6 07/12] usb: chipidea: add a usb2 driver for ci13xxx
  2014-09-26  0:37                           ` Felipe Balbi
  2014-09-26  0:39                             ` Felipe Balbi
  2014-09-28  0:40                             ` Peter Chen
@ 2014-10-13  8:47                             ` Peter Chen
  2 siblings, 0 replies; 52+ messages in thread
From: Peter Chen @ 2014-10-13  8:47 UTC (permalink / raw)
  To: Felipe Balbi
  Cc: Arnd Bergmann, Antoine Tenart, linux-arm-kernel,
	sebastian.hesselbarth, p.zabel, thomas.petazzoni, zmxu,
	devicetree, linux-usb, linux-kernel, alexandre.belloni, jszhang

On Thu, Sep 25, 2014 at 07:37:50PM -0500, Felipe Balbi wrote:
> HI,
> 
> On Fri, Sep 26, 2014 at 07:39:34AM +0800, Peter Chen wrote:
> > On Thu, Sep 25, 2014 at 09:15:53AM -0500, Felipe Balbi wrote:
> > > On Wed, Sep 24, 2014 at 02:23:38PM +0200, Arnd Bergmann wrote:
> > > > On Wednesday 24 September 2014 19:29:05 Peter Chen wrote:
> > > > > 
> > > > > So, it is IP CORE LIB (you suggest) vs IP CORE Platform Driver
> > > > > (dwc3, musb, chipidea) you are talking about, right? Except for
> > > > > creating another platform driver as well as related DT node (optional),
> > > > > are there any advantages compared to current IP core driver structure?
> > > > 
> > > > Having a library module usually requires less code, and is more
> > > > consistent with other drivers, which helps new developers understand
> > > > what the driver is doing.
> > > 
> > > I beg to differ. You end-up having to pass function pointers through
> > > platform_data to handle differences which could be handled by the core
> > > IP.
> > > 
> > > > The most important aspect though is the DT binding: once the structure
> > > > with separate kernel drivers leaks out into the DT format, you can't
> > > > easily change the driver any more, e.g. to make a property that was
> > > > introduced for one glue driver more general so it can get handled by
> > > > the common part. Having a single node lets us convert to the library
> > > > model later, so that would be a strong reason to keep the DT binding
> > > > simple, without child nodes.
> > > > 
> > > > Following that logic, it turns into another reason for using the library
> > > > model to start with, because otherwise the child device does not have
> > > > any DT properties itself and has to rely on the parent device properties,
> > > > which somewhat complicates the driver structure.
> > > 
> > > this is bullcrap. Take a look at
> > > Documentation/devicetree/bindings/usb/dwc3.txt:
> > > 
> > > synopsys DWC3 CORE
> > > 
> > > DWC3- USB3 CONTROLLER
> > > 
> > > Required properties:
> > >  - compatible: must be "snps,dwc3"
> > >  - reg : Address and length of the register set for the device
> > >  - interrupts: Interrupts used by the dwc3 controller.
> > > 
> > > Optional properties:
> > >  - usb-phy : array of phandle for the PHY device.  The first element
> > >    in the array is expected to be a handle to the USB2/HS PHY and
> > >    the second element is expected to be a handle to the USB3/SS PHY
> > >  - phys: from the *Generic PHY* bindings
> > >  - phy-names: from the *Generic PHY* bindings
> > >  - tx-fifo-resize: determines if the FIFO *has* to be reallocated.
> > > 
> > > This is usually a subnode to DWC3 glue to which it is connected.
> > > 
> > > dwc3@4a030000 {
> > > 	compatible = "snps,dwc3";
> > > 	reg = <0x4a030000 0xcfff>;
> > > 	interrupts = <0 92 4>
> > > 	usb-phy = <&usb2_phy>, <&usb3,phy>;
> > > 	tx-fifo-resize;
> > > };
> > > 
> 
> > Is it possible that the glue layer needs to access core register
> > (eg, portsc.phcd during suspend)? The wrapper IP may wait some signals
> > at core IP to change.
> 
> why would a glue layer need to access registers from the core ? That
> sounds very odd. I haven't seen that and will, definitely, NACK such a
> patch :-)
> 

Just have a case for glue layer needs to know core layer's status.
The controller's wakeup logic is usually at glue layer, but we
may need to enable different wakeup for roles. Eg, if the current
role is host (controller is otg capable), we can't enable id wakeup,
otherwise, the user will complain plug out Micro-AB cable wakes up
system which is not expected.

-- 
Best Regards,
Peter Chen

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

end of thread, other threads:[~2014-10-13  8:48 UTC | newest]

Thread overview: 52+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-09-23 10:27 [PATCH v6 00/12] ARM: berlin: USB support Antoine Tenart
2014-09-23 10:27 ` [PATCH v6 01/12] reset: add the Berlin reset controller driver Antoine Tenart
2014-09-23 10:27 ` [PATCH v6 02/12] Documentation: bindings: add reset bindings docs for Marvell Berlin SoCs Antoine Tenart
2014-09-23 10:27 ` [PATCH v6 03/12] ARM: Berlin: select the reset controller Antoine Tenart
2014-09-23 10:28 ` [PATCH v6 04/12] ARM: dts: berlin: add a required reset property in the chip controller node Antoine Tenart
2014-09-23 10:28 ` [PATCH v6 05/12] phy: add the Berlin USB PHY driver Antoine Tenart
2014-09-23 10:28 ` [PATCH v6 06/12] Documentation: bindings: add doc for the Berlin USB PHY Antoine Tenart
2014-09-23 10:28 ` [PATCH v6 07/12] usb: chipidea: add a usb2 driver for ci13xxx Antoine Tenart
2014-09-23 10:39   ` Arnd Bergmann
2014-09-23 13:36     ` Antoine Tenart
2014-09-23 16:44       ` Arnd Bergmann
2014-09-23 16:55         ` Felipe Balbi
2014-09-23 17:37           ` Arnd Bergmann
2014-09-23 17:43             ` Felipe Balbi
2014-09-24  2:27             ` Peter Chen
2014-09-24  7:44               ` Arnd Bergmann
2014-09-24  8:30                 ` Arnd Bergmann
2014-09-24 11:29                   ` Peter Chen
2014-09-24 12:23                     ` Arnd Bergmann
2014-09-25  0:56                       ` Peter Chen
2014-09-25 14:15                       ` Felipe Balbi
2014-09-25 23:39                         ` Peter Chen
2014-09-26  0:37                           ` Felipe Balbi
2014-09-26  0:39                             ` Felipe Balbi
2014-09-26  7:20                               ` Arnd Bergmann
2014-09-26 15:43                                 ` Felipe Balbi
2014-09-28  0:40                             ` Peter Chen
2014-10-13  8:47                             ` Peter Chen
2014-09-25 14:09                 ` Felipe Balbi
2014-09-24 23:58   ` Sören Brinkmann
2014-09-29 14:57     ` Antoine Tenart
2014-09-25  1:16   ` Peter Chen
2014-09-25  7:11     ` Arnd Bergmann
2014-09-26  0:23       ` Peter Chen
2014-09-26  7:01         ` Arnd Bergmann
2014-09-25 19:12   ` Arnd Bergmann
2014-09-25 19:54     ` Antoine Tenart
2014-09-29 15:08   ` Antoine Tenart
2014-10-01 12:39     ` Antoine Tenart
2014-09-30  0:12   ` Peter Chen
2014-09-30 10:03     ` Arnd Bergmann
2014-09-30 12:39       ` Peter Chen
2014-09-30 13:43         ` Arnd Bergmann
2014-10-01  6:35           ` Peter Chen
2014-10-01  8:41             ` Arnd Bergmann
2014-10-01 12:25               ` Peter Chen
2014-10-01 23:40     ` Peter Chen
2014-09-23 10:28 ` [PATCH v6 08/12] Documentation: bindings: add doc for the USB2 ChipIdea USB driver Antoine Tenart
2014-09-23 10:28 ` [PATCH v6 09/12] ARM: dts: berlin: add BG2Q nodes for USB support Antoine Tenart
2014-09-23 10:28 ` [PATCH v6 10/12] ARM: dts: Berlin: enable USB on the BG2Q DMP Antoine Tenart
2014-09-23 10:28 ` [PATCH v6 11/12] ARM: dts: berlin: add BG2CD nodes for USB support Antoine Tenart
2014-09-23 10:28 ` [PATCH v6 12/12] ARM: dts: berlin: enable USB on the Google Chromecast Antoine Tenart

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).