linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 00/24] ARM: OMAP2+: Adapt to ehci-omap changes for 3.10
@ 2013-03-12 11:43 Roger Quadros
  2013-03-12 11:43 ` [PATCH 01/24] usb: phy: nop: Add some parameters to platform data Roger Quadros
                   ` (24 more replies)
  0 siblings, 25 replies; 35+ messages in thread
From: Roger Quadros @ 2013-03-12 11:43 UTC (permalink / raw)
  To: tony
  Cc: balbi, b-cousson, linux-kernel, linux-usb, linux-omap,
	devicetree-discuss, rogerq

Hi Tony,

These patches provide the SoC side code required to support
the changes in the OMAP USB Host drivers done in [1], [2] & [3].

Device tree support is added for Beagleboard and Panda.

NOTE: The first patch needs to be shared between the
OMAP tree and Felipe's USB tree.

[1] MFD side changes to omap-usb-host and omap-usb-tll
  https://lkml.org/lkml/2013/3/12/179
[2] USB EHCI side changes to ehci-omap 
  http://www.mail-archive.com/linux-omap@vger.kernel.org/msg86265.html
[3] USB PHY driver changes
  http://www.mail-archive.com/linux-omap@vger.kernel.org/msg86293.html

The following changes since commit f6161aa153581da4a3867a2d1a7caf4be19b6ec9:

  Linux 3.9-rc2 (2013-03-10 16:54:19 -0700)

are available in the git repository at:
  git://github.com/rogerq/linux.git usbhost-arm-next

Roger Quadros (24):
  usb: phy: nop: Add some parameters to platform data
  ARM: OMAP2+: omap4panda: Provide USB Host's PHY platform data
  ARM: OMAP2+: omap4panda: Adapt to ehci-omap changes
  ARM: OMAP3: Beagle: Adapt to ehci-omap changes
  ARM: OMAP3: 3430SDP: Adapt to ehci-omap changes
  ARM: OMAP3: 3630SDP: Adapt to ehci-omap changes
  ARM: OMAP: AM3517crane: Adapt to ehci-omap changes
  ARM: OMAP: AM3517evm: Adapt to ehci-omap changes
  ARM: OMAP3: cm-t35: Adapt to ehci-omap changes
  ARM: OMAP3: cm-t3517: Adapt to ehci-omap changes
  ARM: OMAP: devkit8000: Adapt to ehci-omap changes
  ARM: OMAP3: igep0020: Adapt to ehci-omap changes
  ARM: OMAP3: omap3evm: Adapt to ehci-omap changes
  ARM: OMAP3: omap3pandora: Adapt to ehci-omap changes
  ARM: OMAP3: omap3stalker: Adapt to ehci-omap changes
  ARM: OMAP3: omap3touchbook: Adapt to ehci-omap changes
  ARM: OMAP3: overo: Adapt to ehci-omap changes
  ARM: OMAP: zoom: Adapt to ehci-omap changes
  ARM: dts: OMAP4: Add HS USB Host IP nodes
  ARM: dts: omap4-panda: Add USB Host support
  ARM: dts: OMAP3: Add HS USB Host IP nodes
  ARM: dts: omap3-beagle: Add USB Host support
  ARM: OMAP2+: Allow clock alias provision from device tree
  ARM: dts: omap4-panda: Add clock alias for USB PHY

 .../devicetree/bindings/clock/ti-clock-alias.txt   |   26 ++++
 arch/arm/boot/dts/omap3-beagle.dts                 |   71 +++++++++++
 arch/arm/boot/dts/omap3.dtsi                       |   31 +++++
 arch/arm/boot/dts/omap4-panda.dts                  |   63 ++++++++++
 arch/arm/boot/dts/omap4.dtsi                       |   30 +++++
 arch/arm/mach-omap2/board-3430sdp.c                |   97 +++++++++++++++-
 arch/arm/mach-omap2/board-3630sdp.c                |  100 +++++++++++++++-
 arch/arm/mach-omap2/board-am3517crane.c            |   95 +++++++++++++--
 arch/arm/mach-omap2/board-am3517evm.c              |   66 ++++++++++-
 arch/arm/mach-omap2/board-cm-t35.c                 |   95 ++++++++++++++-
 arch/arm/mach-omap2/board-cm-t3517.c               |   97 +++++++++++++++-
 arch/arm/mach-omap2/board-devkit8000.c             |   20 ++--
 arch/arm/mach-omap2/board-generic.c                |   67 +++++++++++
 arch/arm/mach-omap2/board-igep0020.c               |  112 ++++++++++++++++---
 arch/arm/mach-omap2/board-omap3beagle.c            |   93 +++++++++++++--
 arch/arm/mach-omap2/board-omap3evm.c               |   62 ++++++++--
 arch/arm/mach-omap2/board-omap3pandora.c           |   52 +++++++--
 arch/arm/mach-omap2/board-omap3stalker.c           |   52 +++++++-
 arch/arm/mach-omap2/board-omap3touchbook.c         |   62 +++++++++-
 arch/arm/mach-omap2/board-omap4panda.c             |  122 ++++++++++++++------
 arch/arm/mach-omap2/board-overo.c                  |   54 ++++++++-
 arch/arm/mach-omap2/board-zoom.c                   |   56 ++++++++-
 include/linux/usb/nop-usb-xceiv.h                  |    5 +
 23 files changed, 1377 insertions(+), 151 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/clock/ti-clock-alias.txt

--
cheers,
-roger 


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

* [PATCH 01/24] usb: phy: nop: Add some parameters to platform data
  2013-03-12 11:43 [PATCH 00/24] ARM: OMAP2+: Adapt to ehci-omap changes for 3.10 Roger Quadros
@ 2013-03-12 11:43 ` Roger Quadros
  2013-03-12 11:43 ` [PATCH 02/24] ARM: OMAP2+: omap4panda: Provide USB Host's PHY " Roger Quadros
                   ` (23 subsequent siblings)
  24 siblings, 0 replies; 35+ messages in thread
From: Roger Quadros @ 2013-03-12 11:43 UTC (permalink / raw)
  To: tony
  Cc: balbi, b-cousson, linux-kernel, linux-usb, linux-omap,
	devicetree-discuss, rogerq

Add clk_rate parameter to platform data. If supplied, the
NOP phy driver will program the clock to that rate during probe.

Also add 2 flags, needs_vcc and needs_reset.
If the flag is set and the regulator couldn't be found
then the driver will bail out with -EPROBE_DEFER.

Signed-off-by: Roger Quadros <rogerq@ti.com>
Acked-by: Felipe Balbi <balbi@ti.com>
---
 include/linux/usb/nop-usb-xceiv.h |    5 +++++
 1 files changed, 5 insertions(+), 0 deletions(-)

diff --git a/include/linux/usb/nop-usb-xceiv.h b/include/linux/usb/nop-usb-xceiv.h
index 28884c7..148d351 100644
--- a/include/linux/usb/nop-usb-xceiv.h
+++ b/include/linux/usb/nop-usb-xceiv.h
@@ -5,6 +5,11 @@
 
 struct nop_usb_xceiv_platform_data {
 	enum usb_phy_type type;
+	unsigned long clk_rate;
+
+	/* if set fails with -EPROBE_DEFER if can't get regulator */
+	unsigned int needs_vcc:1;
+	unsigned int needs_reset:1;
 };
 
 #if defined(CONFIG_NOP_USB_XCEIV) || (defined(CONFIG_NOP_USB_XCEIV_MODULE) && defined(MODULE))
-- 
1.7.4.1


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

* [PATCH 02/24] ARM: OMAP2+: omap4panda: Provide USB Host's PHY platform data
  2013-03-12 11:43 [PATCH 00/24] ARM: OMAP2+: Adapt to ehci-omap changes for 3.10 Roger Quadros
  2013-03-12 11:43 ` [PATCH 01/24] usb: phy: nop: Add some parameters to platform data Roger Quadros
@ 2013-03-12 11:43 ` Roger Quadros
  2013-03-12 11:43 ` [PATCH 03/24] ARM: OMAP2+: omap4panda: Adapt to ehci-omap changes Roger Quadros
                   ` (22 subsequent siblings)
  24 siblings, 0 replies; 35+ messages in thread
From: Roger Quadros @ 2013-03-12 11:43 UTC (permalink / raw)
  To: tony
  Cc: balbi, b-cousson, linux-kernel, linux-usb, linux-omap,
	devicetree-discuss, rogerq

Add platform device and data for 'nop-usb-xceiv'. This will be used
as PHY for HS USB port 1, so provide binding information for it.

Get rid of managing the PHY clock as it will be done by the PHY driver.
For that to work we create a clock alias that links the PHY clock name
to the PHY device name.

Signed-off-by: Roger Quadros <rogerq@ti.com>
Acked-by: Felipe Balbi <balbi@ti.com>
---
 arch/arm/mach-omap2/board-omap4panda.c |   34 ++++++++++++++++++++++---------
 1 files changed, 24 insertions(+), 10 deletions(-)

diff --git a/arch/arm/mach-omap2/board-omap4panda.c b/arch/arm/mach-omap2/board-omap4panda.c
index b02c2f0..feffde6 100644
--- a/arch/arm/mach-omap2/board-omap4panda.c
+++ b/arch/arm/mach-omap2/board-omap4panda.c
@@ -31,6 +31,7 @@
 #include <linux/ti_wilink_st.h>
 #include <linux/usb/musb.h>
 #include <linux/usb/phy.h>
+#include <linux/usb/nop-usb-xceiv.h>
 #include <linux/wl12xx.h>
 #include <linux/irqchip/arm-gic.h>
 #include <linux/platform_data/omap-abe-twl6040.h>
@@ -132,12 +133,27 @@ static struct platform_device btwilink_device = {
 	.id	= -1,
 };
 
+/* PHY device on HS USB Port 1 i.e. nop_usb_xceiv.1 */
+static struct nop_usb_xceiv_platform_data hsusb1_phy_data = {
+	/* FREF_CLK3 provides the 19.2 MHz reference clock to the PHY */
+	.clk_rate = 19200000,
+};
+
+static struct platform_device hsusb1_phy_device = {
+	.name	= "nop_usb_xceiv",
+	.id	= 1,
+	.dev	= {
+		.platform_data = &hsusb1_phy_data,
+	},
+};
+
 static struct platform_device *panda_devices[] __initdata = {
 	&leds_gpio,
 	&wl1271_device,
 	&panda_abe_audio,
 	&panda_hdmi_audio_codec,
 	&btwilink_device,
+	&hsusb1_phy_device,
 };
 
 static struct usbhs_omap_platform_data usbhs_bdata __initdata = {
@@ -158,16 +174,6 @@ static struct gpio panda_ehci_gpios[] __initdata = {
 static void __init omap4_ehci_init(void)
 {
 	int ret;
-	struct clk *phy_ref_clk;
-
-	/* FREF_CLK3 provides the 19.2 MHz reference clock to the PHY */
-	phy_ref_clk = clk_get(NULL, "auxclk3_ck");
-	if (IS_ERR(phy_ref_clk)) {
-		pr_err("Cannot request auxclk3\n");
-		return;
-	}
-	clk_set_rate(phy_ref_clk, 19200000);
-	clk_prepare_enable(phy_ref_clk);
 
 	/* disable the power to the usb hub prior to init and reset phy+hub */
 	ret = gpio_request_array(panda_ehci_gpios,
@@ -181,6 +187,14 @@ static void __init omap4_ehci_init(void)
 	gpio_export(GPIO_HUB_NRESET, 0);
 	gpio_set_value(GPIO_HUB_NRESET, 1);
 
+	/* FREF_CLK3 provides the 19.2 MHz reference clock to the PHY */
+	ret = clk_add_alias("main_clk", "nop_usb_xceiv.1", "auxclk3_ck", NULL);
+	if (ret)
+		pr_err("Failed to add main_clk alias to auxclk3_ck\n");
+
+	/* PHY on HS USB Port 1 i.e. index 0 */
+	usb_bind_phy("ehci-omap.0", 0, "nop_usb_xceiv.1");
+
 	usbhs_init(&usbhs_bdata);
 
 	/* enable power to hub */
-- 
1.7.4.1


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

* [PATCH 03/24] ARM: OMAP2+: omap4panda: Adapt to ehci-omap changes
  2013-03-12 11:43 [PATCH 00/24] ARM: OMAP2+: Adapt to ehci-omap changes for 3.10 Roger Quadros
  2013-03-12 11:43 ` [PATCH 01/24] usb: phy: nop: Add some parameters to platform data Roger Quadros
  2013-03-12 11:43 ` [PATCH 02/24] ARM: OMAP2+: omap4panda: Provide USB Host's PHY " Roger Quadros
@ 2013-03-12 11:43 ` Roger Quadros
  2013-03-12 11:43 ` [PATCH 04/24] ARM: OMAP3: Beagle: " Roger Quadros
                   ` (21 subsequent siblings)
  24 siblings, 0 replies; 35+ messages in thread
From: Roger Quadros @ 2013-03-12 11:43 UTC (permalink / raw)
  To: tony
  Cc: balbi, b-cousson, linux-kernel, linux-usb, linux-omap,
	devicetree-discuss, rogerq

Model RESET and Power for HS USB Port 1 as GPIO fixed regulators
and link them to the 'nop-usb-xceiv' PHY by making them as "reset"
and "vcc" supplies.

The RESET and Power will then be managed by the PHY driver.

Signed-off-by: Roger Quadros <rogerq@ti.com>
Acked-by: Felipe Balbi <balbi@ti.com>
---
 arch/arm/mach-omap2/board-omap4panda.c |   92 +++++++++++++++++++++++---------
 1 files changed, 66 insertions(+), 26 deletions(-)

diff --git a/arch/arm/mach-omap2/board-omap4panda.c b/arch/arm/mach-omap2/board-omap4panda.c
index feffde6..3f34db3 100644
--- a/arch/arm/mach-omap2/board-omap4panda.c
+++ b/arch/arm/mach-omap2/board-omap4panda.c
@@ -147,6 +147,70 @@ static struct platform_device hsusb1_phy_device = {
 	},
 };
 
+/* Regulator for USB HUB/PHY reset */
+static struct regulator_consumer_supply hsusb1_reset_supplies[] = {
+/* Link PHY device to reset supply so it gets used in the PHY driver */
+	REGULATOR_SUPPLY("reset", "nop_usb_xceiv.1"),
+};
+
+static struct regulator_init_data hsusb1_reset_data = {
+	.constraints = {
+		.valid_ops_mask = REGULATOR_CHANGE_STATUS,
+	},
+	.consumer_supplies	= hsusb1_reset_supplies,
+	.num_consumer_supplies	= ARRAY_SIZE(hsusb1_reset_supplies),
+};
+
+static struct fixed_voltage_config hsusb1_reset_config = {
+	.supply_name    = "hsusb1_reset",
+	.microvolts = 3300000,
+	.gpio = GPIO_HUB_NRESET,
+	.startup_delay = 70000, /* 70msec */
+	.enable_high = 1,
+	.enabled_at_boot = 0,	/* keep in RESET */
+	.init_data = &hsusb1_reset_data,
+};
+
+static struct platform_device hsusb1_reset_device = {
+	.name	= "reg-fixed-voltage",
+	.id	= PLATFORM_DEVID_AUTO,
+	.dev = {
+		.platform_data = &hsusb1_reset_config,
+	},
+};
+
+/* Regulator for USB HUB supply */
+static struct regulator_consumer_supply hsusb1_power_supplies[] = {
+/* Link PHY device to USB HUB supply so it gets enabled in the PHY driver */
+	REGULATOR_SUPPLY("vcc", "nop_usb_xceiv.1"),
+};
+
+static struct regulator_init_data hsusb1_power_data = {
+	.constraints = {
+		.valid_ops_mask = REGULATOR_CHANGE_STATUS,
+	},
+	.consumer_supplies	= hsusb1_power_supplies,
+	.num_consumer_supplies	= ARRAY_SIZE(hsusb1_power_supplies),
+};
+
+static struct fixed_voltage_config hsusb1_power_config = {
+	.supply_name    = "hsusb1_vbus",
+	.microvolts = 3300000,
+	.gpio = GPIO_HUB_POWER,
+	.startup_delay = 70000, /* 70msec */
+	.enable_high = 1,
+	.enabled_at_boot = 0,
+	.init_data = &hsusb1_power_data,
+};
+
+static struct platform_device hsusb1_power_device = {
+	.name	= "reg-fixed-voltage",
+	.id	= PLATFORM_DEVID_AUTO,
+	.dev = {
+		.platform_data = &hsusb1_power_config,
+	},
+};
+
 static struct platform_device *panda_devices[] __initdata = {
 	&leds_gpio,
 	&wl1271_device,
@@ -154,39 +218,18 @@ static struct platform_device *panda_devices[] __initdata = {
 	&panda_hdmi_audio_codec,
 	&btwilink_device,
 	&hsusb1_phy_device,
+	&hsusb1_power_device,
+	&hsusb1_reset_device,
 };
 
 static struct usbhs_omap_platform_data usbhs_bdata __initdata = {
 	.port_mode[0] = OMAP_EHCI_PORT_MODE_PHY,
-	.port_mode[1] = OMAP_USBHS_PORT_MODE_UNUSED,
-	.port_mode[2] = OMAP_USBHS_PORT_MODE_UNUSED,
-	.phy_reset  = false,
-	.reset_gpio_port[0]  = -EINVAL,
-	.reset_gpio_port[1]  = -EINVAL,
-	.reset_gpio_port[2]  = -EINVAL
-};
-
-static struct gpio panda_ehci_gpios[] __initdata = {
-	{ GPIO_HUB_POWER,	GPIOF_OUT_INIT_LOW,  "hub_power"  },
-	{ GPIO_HUB_NRESET,	GPIOF_OUT_INIT_LOW,  "hub_nreset" },
 };
 
 static void __init omap4_ehci_init(void)
 {
 	int ret;
 
-	/* disable the power to the usb hub prior to init and reset phy+hub */
-	ret = gpio_request_array(panda_ehci_gpios,
-				 ARRAY_SIZE(panda_ehci_gpios));
-	if (ret) {
-		pr_err("Unable to initialize EHCI power/reset\n");
-		return;
-	}
-
-	gpio_export(GPIO_HUB_POWER, 0);
-	gpio_export(GPIO_HUB_NRESET, 0);
-	gpio_set_value(GPIO_HUB_NRESET, 1);
-
 	/* FREF_CLK3 provides the 19.2 MHz reference clock to the PHY */
 	ret = clk_add_alias("main_clk", "nop_usb_xceiv.1", "auxclk3_ck", NULL);
 	if (ret)
@@ -196,9 +239,6 @@ static void __init omap4_ehci_init(void)
 	usb_bind_phy("ehci-omap.0", 0, "nop_usb_xceiv.1");
 
 	usbhs_init(&usbhs_bdata);
-
-	/* enable power to hub */
-	gpio_set_value(GPIO_HUB_POWER, 1);
 }
 
 static struct omap_musb_board_data musb_board_data = {
-- 
1.7.4.1


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

* [PATCH 04/24] ARM: OMAP3: Beagle: Adapt to ehci-omap changes
  2013-03-12 11:43 [PATCH 00/24] ARM: OMAP2+: Adapt to ehci-omap changes for 3.10 Roger Quadros
                   ` (2 preceding siblings ...)
  2013-03-12 11:43 ` [PATCH 03/24] ARM: OMAP2+: omap4panda: Adapt to ehci-omap changes Roger Quadros
@ 2013-03-12 11:43 ` Roger Quadros
  2013-03-12 11:43 ` [PATCH 05/24] ARM: OMAP3: 3430SDP: " Roger Quadros
                   ` (20 subsequent siblings)
  24 siblings, 0 replies; 35+ messages in thread
From: Roger Quadros @ 2013-03-12 11:43 UTC (permalink / raw)
  To: tony
  Cc: balbi, b-cousson, linux-kernel, linux-usb, linux-omap,
	devicetree-discuss, rogerq

Add platform device for 'nop-usb-xceiv'. This will be used as a
PHY for HS USB Port 2, so provide binding information for it.

Model RESET and Power for HS USB Port 2 as GPIO fixed regulators
and link them to the 'nop-usb-xceiv' PHY.

NOTE: Register the PHY device only after the power regulator has
been registered else power won't be enabled for the Host port.

Signed-off-by: Roger Quadros <rogerq@ti.com>
Acked-by: Felipe Balbi <balbi@ti.com>
---
 arch/arm/mach-omap2/board-omap3beagle.c |   93 +++++++++++++++++++++++++++---
 1 files changed, 83 insertions(+), 10 deletions(-)

diff --git a/arch/arm/mach-omap2/board-omap3beagle.c b/arch/arm/mach-omap2/board-omap3beagle.c
index c3558f9..a3d5e13 100644
--- a/arch/arm/mach-omap2/board-omap3beagle.c
+++ b/arch/arm/mach-omap2/board-omap3beagle.c
@@ -35,7 +35,9 @@
 #include <linux/usb/phy.h>
 
 #include <linux/regulator/machine.h>
+#include <linux/regulator/fixed.h>
 #include <linux/i2c/twl.h>
+#include <linux/usb/phy.h>
 
 #include <asm/mach-types.h>
 #include <asm/mach/arch.h>
@@ -277,6 +279,76 @@ static struct regulator_consumer_supply beagle_vsim_supply[] = {
 
 static struct gpio_led gpio_leds[];
 
+/* PHY device on HS USB Port 2 i.e. nop_usb_xceiv.2 */
+static struct platform_device hsusb2_phy_device = {
+	.name = "nop_usb_xceiv",
+	.id = 2,
+};
+
+/* Regulator for HS USB Port 2 PHY reset */
+static struct regulator_consumer_supply hsusb2_reset_supplies[] = {
+	/* Link PHY device to reset supply so it gets used in the PHY driver */
+	REGULATOR_SUPPLY("reset", "nop_usb_xceiv.2"),
+};
+
+static struct regulator_init_data hsusb2_reset_data = {
+	.constraints = {
+		.valid_ops_mask = REGULATOR_CHANGE_STATUS,
+	},
+	.consumer_supplies = hsusb2_reset_supplies,
+	.num_consumer_supplies = ARRAY_SIZE(hsusb2_reset_supplies),
+};
+
+static struct fixed_voltage_config hsusb2_reset_config = {
+	.supply_name = "hsusb2_reset",
+	.microvolts = 3300000,
+	.gpio = 147,
+	.startup_delay = 70000, /* 70msec */
+	.enable_high = 1,
+	.enabled_at_boot = 0,   /* keep in RESET */
+	.init_data = &hsusb2_reset_data,
+};
+
+static struct platform_device hsusb2_reset_device = {
+	.name = "reg-fixed-voltage",
+	.id = PLATFORM_DEVID_AUTO,
+	.dev = {
+		.platform_data = &hsusb2_reset_config,
+	},
+};
+
+/* Regulator for HS USB Port 2 supply */
+static struct regulator_consumer_supply hsusb2_power_supplies[] = {
+/* Link PHY device to power supply so it gets enabled in the PHY driver */
+	REGULATOR_SUPPLY("vcc", "nop_usb_xceiv.2"),
+};
+
+static struct regulator_init_data hsusb2_power_data = {
+	.constraints = {
+		.valid_ops_mask = REGULATOR_CHANGE_STATUS,
+	},
+	.consumer_supplies = hsusb2_power_supplies,
+	.num_consumer_supplies = ARRAY_SIZE(hsusb2_power_supplies),
+};
+
+static struct fixed_voltage_config hsusb2_power_config = {
+	.supply_name = "hsusb2_vbus",
+	.microvolts = 5000000,
+	.gpio = -1,		/* set at runtime in beagle_twl_gpio_setup */
+	.startup_delay = 70000, /* 70msec */
+	.enable_high = 0,	/* updated in omap3_beagle_init_rev() */
+	.enabled_at_boot = 0,
+	.init_data = &hsusb2_power_data,
+};
+
+static struct platform_device hsusb2_power_device = {
+	.name = "reg-fixed-voltage",
+	.id = PLATFORM_DEVID_AUTO,
+	.dev = {
+		.platform_data = &hsusb2_power_config,
+	},
+};
+
 static int beagle_twl_gpio_setup(struct device *dev,
 		unsigned gpio, unsigned ngpio)
 {
@@ -318,8 +390,12 @@ static int beagle_twl_gpio_setup(struct device *dev,
 	}
 	dvi_panel.power_down_gpio = beagle_config.dvi_pd_gpio;
 
-	gpio_request_one(gpio + TWL4030_GPIO_MAX, beagle_config.usb_pwr_level,
-			"nEN_USB_PWR");
+	/* TWL4030_GPIO_MAX controls HS USB Port 2 power */
+	hsusb2_power_config.gpio = gpio + TWL4030_GPIO_MAX;
+	hsusb2_power_config.enable_high = beagle_config.usb_pwr_level;
+
+	platform_device_register(&hsusb2_power_device);
+	platform_device_register(&hsusb2_phy_device);
 
 	return 0;
 }
@@ -450,18 +526,11 @@ static struct platform_device *omap3_beagle_devices[] __initdata = {
 	&keys_gpio,
 	&madc_hwmon,
 	&leds_pwm,
+	&hsusb2_reset_device,
 };
 
 static struct usbhs_omap_platform_data usbhs_bdata __initdata = {
-
-	.port_mode[0] = OMAP_USBHS_PORT_MODE_UNUSED,
 	.port_mode[1] = OMAP_EHCI_PORT_MODE_PHY,
-	.port_mode[2] = OMAP_USBHS_PORT_MODE_UNUSED,
-
-	.phy_reset  = true,
-	.reset_gpio_port[0]  = -EINVAL,
-	.reset_gpio_port[1]  = 147,
-	.reset_gpio_port[2]  = -EINVAL
 };
 
 #ifdef CONFIG_OMAP_MUX
@@ -543,7 +612,11 @@ static void __init omap3_beagle_init(void)
 
 	usb_bind_phy("musb-hdrc.0.auto", 0, "twl4030_usb");
 	usb_musb_init(NULL);
+
+	/* PHY on HSUSB Port 2 i.e. index 1 */
+	usb_bind_phy("ehci-omap.0", 1, "nop_usb_xceiv.2");
 	usbhs_init(&usbhs_bdata);
+
 	board_nand_init(omap3beagle_nand_partitions,
 			ARRAY_SIZE(omap3beagle_nand_partitions), NAND_CS,
 			NAND_BUSWIDTH_16, NULL);
-- 
1.7.4.1


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

* [PATCH 05/24] ARM: OMAP3: 3430SDP: Adapt to ehci-omap changes
  2013-03-12 11:43 [PATCH 00/24] ARM: OMAP2+: Adapt to ehci-omap changes for 3.10 Roger Quadros
                   ` (3 preceding siblings ...)
  2013-03-12 11:43 ` [PATCH 04/24] ARM: OMAP3: Beagle: " Roger Quadros
@ 2013-03-12 11:43 ` Roger Quadros
  2013-03-12 11:43 ` [PATCH 06/24] ARM: OMAP3: 3630SDP: " Roger Quadros
                   ` (19 subsequent siblings)
  24 siblings, 0 replies; 35+ messages in thread
From: Roger Quadros @ 2013-03-12 11:43 UTC (permalink / raw)
  To: tony
  Cc: balbi, b-cousson, linux-kernel, linux-usb, linux-omap,
	devicetree-discuss, rogerq

Add 2 platform devices for 'nop-usb-xceiv'. These will be used
as PHYs for HS USB ports 1 and 2 so provide binding information
for them.

Model RESET for HS USB Ports 1 and 2 as GPIO fixed regulators and
link them to the 2 PHYs we just created.

Signed-off-by: Roger Quadros <rogerq@ti.com>
Acked-by: Felipe Balbi <balbi@ti.com>
---
 arch/arm/mach-omap2/board-3430sdp.c |   97 ++++++++++++++++++++++++++++++++--
 1 files changed, 91 insertions(+), 6 deletions(-)

diff --git a/arch/arm/mach-omap2/board-3430sdp.c b/arch/arm/mach-omap2/board-3430sdp.c
index ce812de..7e3c88a 100644
--- a/arch/arm/mach-omap2/board-3430sdp.c
+++ b/arch/arm/mach-omap2/board-3430sdp.c
@@ -21,6 +21,8 @@
 #include <linux/spi/spi.h>
 #include <linux/i2c/twl.h>
 #include <linux/regulator/machine.h>
+#include <linux/regulator/fixed.h>
+#include <linux/usb/phy.h>
 #include <linux/io.h>
 #include <linux/gpio.h>
 #include <linux/mmc/host.h>
@@ -445,16 +447,86 @@ static void enable_board_wakeup_source(void)
 		OMAP_WAKEUP_EN | OMAP_PIN_INPUT_PULLUP);
 }
 
+/* PHY device on HS USB Port 1 i.e. nop_usb_xceiv.1 */
+static struct platform_device hsusb1_phy_device = {
+	.name = "nop_usb_xceiv",
+	.id = 1,
+};
+
+/* Regulator for HS USB Port 1 PHY reset */
+static struct regulator_consumer_supply hsusb1_reset_supplies[] = {
+	/* Link PHY device to reset supply so it gets used in the PHY driver */
+	REGULATOR_SUPPLY("reset", "nop_usb_xceiv.1"),
+};
+
+static struct regulator_init_data hsusb1_reset_data = {
+	.constraints = {
+		.valid_ops_mask = REGULATOR_CHANGE_STATUS,
+	},
+	.consumer_supplies = hsusb1_reset_supplies,
+	.num_consumer_supplies = ARRAY_SIZE(hsusb1_reset_supplies),
+};
+
+static struct fixed_voltage_config hsusb1_reset_config = {
+	.supply_name = "hsusb1_reset",
+	.microvolts = 3300000,
+	.gpio = 57,
+	.startup_delay = 70000, /* 70msec */
+	.enable_high = 1,
+	.enabled_at_boot = 0,   /* keep in RESET */
+	.init_data = &hsusb1_reset_data,
+};
+
+static struct platform_device hsusb1_reset_device = {
+	.name = "reg-fixed-voltage",
+	.id = PLATFORM_DEVID_AUTO,
+	.dev = {
+		.platform_data = &hsusb1_reset_config,
+	},
+};
+
+/* PHY device on HS USB Port 2 i.e. nop_usb_xceiv.2 */
+static struct platform_device hsusb2_phy_device = {
+	.name = "nop_usb_xceiv",
+	.id = 2,
+};
+
+/* Regulator for HS USB Port 2 PHY reset */
+static struct regulator_consumer_supply hsusb2_reset_supplies[] = {
+	/* Link PHY device to reset supply so it gets used in the PHY driver */
+	REGULATOR_SUPPLY("reset", "nop_usb_xceiv.2"),
+};
+
+static struct regulator_init_data hsusb2_reset_data = {
+	.constraints = {
+		.valid_ops_mask = REGULATOR_CHANGE_STATUS,
+	},
+	.consumer_supplies = hsusb2_reset_supplies,
+	.num_consumer_supplies = ARRAY_SIZE(hsusb2_reset_supplies),
+};
+
+static struct fixed_voltage_config hsusb2_reset_config = {
+	.supply_name = "hsusb2_reset",
+	.microvolts = 3300000,
+	.gpio = 61,
+	.startup_delay = 70000, /* 70msec */
+	.enable_high = 1,
+	.enabled_at_boot = 0,   /* keep in RESET */
+	.init_data = &hsusb2_reset_data,
+};
+
+static struct platform_device hsusb2_reset_device = {
+	.name = "reg-fixed-voltage",
+	.id = PLATFORM_DEVID_AUTO,
+	.dev = {
+		.platform_data = &hsusb2_reset_config,
+	},
+};
+
 static struct usbhs_omap_platform_data usbhs_bdata __initdata = {
 
 	.port_mode[0] = OMAP_EHCI_PORT_MODE_PHY,
 	.port_mode[1] = OMAP_EHCI_PORT_MODE_PHY,
-	.port_mode[2] = OMAP_USBHS_PORT_MODE_UNUSED,
-
-	.phy_reset  = true,
-	.reset_gpio_port[0]  = 57,
-	.reset_gpio_port[1]  = 61,
-	.reset_gpio_port[2]  = -EINVAL
 };
 
 #ifdef CONFIG_OMAP_MUX
@@ -585,6 +657,13 @@ static struct flash_partitions sdp_flash_partitions[] = {
 	},
 };
 
+static struct platform_device *sdp3430_devices[] __initdata = {
+	&hsusb1_phy_device,
+	&hsusb1_reset_device,
+	&hsusb2_phy_device,
+	&hsusb2_reset_device,
+};
+
 static void __init omap_3430sdp_init(void)
 {
 	int gpio_pendown;
@@ -606,6 +685,12 @@ static void __init omap_3430sdp_init(void)
 	board_flash_init(sdp_flash_partitions, chip_sel_3430, 0);
 	sdp3430_display_init();
 	enable_board_wakeup_source();
+
+	platform_add_devices(sdp3430_devices, ARRAY_SIZE(sdp3430_devices));
+	/* PHY on HSUSB Port 1 i.e. index 0 */
+	usb_bind_phy("ehci-omap.0", 0, "nop_usb_xceiv.1");
+	/* PHY on HSUSB Port 2 i.e. index 1 */
+	usb_bind_phy("ehci-omap.0", 1, "nop_usb_xceiv.2");
 	usbhs_init(&usbhs_bdata);
 }
 
-- 
1.7.4.1


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

* [PATCH 06/24] ARM: OMAP3: 3630SDP: Adapt to ehci-omap changes
  2013-03-12 11:43 [PATCH 00/24] ARM: OMAP2+: Adapt to ehci-omap changes for 3.10 Roger Quadros
                   ` (4 preceding siblings ...)
  2013-03-12 11:43 ` [PATCH 05/24] ARM: OMAP3: 3430SDP: " Roger Quadros
@ 2013-03-12 11:43 ` Roger Quadros
  2013-03-12 11:43 ` [PATCH 07/24] ARM: OMAP: AM3517crane: " Roger Quadros
                   ` (18 subsequent siblings)
  24 siblings, 0 replies; 35+ messages in thread
From: Roger Quadros @ 2013-03-12 11:43 UTC (permalink / raw)
  To: tony
  Cc: balbi, b-cousson, linux-kernel, linux-usb, linux-omap,
	devicetree-discuss, rogerq

Add 2 platform devices for 'nop-usb-xceiv'. These will be used
as PHYs for HS USB ports 1 and 2 so provide binding information
for them.

Model RESET for HS USB Ports 1 and 2 as GPIO fixed regulators and
link them to the 2 PHYs we just created.

Signed-off-by: Roger Quadros <rogerq@ti.com>
Acked-by: Felipe Balbi <balbi@ti.com>
---
 arch/arm/mach-omap2/board-3630sdp.c |  100 ++++++++++++++++++++++++++++++++--
 1 files changed, 94 insertions(+), 6 deletions(-)

diff --git a/arch/arm/mach-omap2/board-3630sdp.c b/arch/arm/mach-omap2/board-3630sdp.c
index 67447bd..d528101 100644
--- a/arch/arm/mach-omap2/board-3630sdp.c
+++ b/arch/arm/mach-omap2/board-3630sdp.c
@@ -12,6 +12,9 @@
 #include <linux/input.h>
 #include <linux/gpio.h>
 #include <linux/mtd/nand.h>
+#include <linux/regulator/machine.h>
+#include <linux/regulator/fixed.h>
+#include <linux/usb/phy.h>
 
 #include <asm/mach-types.h>
 #include <asm/mach/arch.h>
@@ -53,16 +56,86 @@ static void enable_board_wakeup_source(void)
 		OMAP_WAKEUP_EN | OMAP_PIN_INPUT_PULLUP);
 }
 
+/* PHY device on HS USB Port 1 i.e. nop_usb_xceiv.1 */
+static struct platform_device hsusb1_phy_device = {
+	.name = "nop_usb_xceiv",
+	.id = 1,
+};
+
+/* Regulator for HS USB Port 1 PHY reset */
+static struct regulator_consumer_supply hsusb1_reset_supplies[] = {
+	/* Link PHY device to reset supply so it gets used in the PHY driver */
+	REGULATOR_SUPPLY("reset", "nop_usb_xceiv.1"),
+};
+
+static struct regulator_init_data hsusb1_reset_data = {
+	.constraints = {
+		.valid_ops_mask = REGULATOR_CHANGE_STATUS,
+	},
+	.consumer_supplies = hsusb1_reset_supplies,
+	.num_consumer_supplies = ARRAY_SIZE(hsusb1_reset_supplies),
+};
+
+static struct fixed_voltage_config hsusb1_reset_config = {
+	.supply_name = "hsusb1_reset",
+	.microvolts = 3300000,
+	.gpio = 126,
+	.startup_delay = 70000, /* 70msec */
+	.enable_high = 1,
+	.enabled_at_boot = 0,   /* keep in RESET */
+	.init_data = &hsusb1_reset_data,
+};
+
+static struct platform_device hsusb1_reset_device = {
+	.name = "reg-fixed-voltage",
+	.id = PLATFORM_DEVID_AUTO,
+	.dev = {
+		.platform_data = &hsusb1_reset_config,
+	},
+};
+
+/* PHY device on HS USB Port 2 i.e. nop_usb_xceiv.2 */
+static struct platform_device hsusb2_phy_device = {
+	.name = "nop_usb_xceiv",
+	.id = 2,
+};
+
+/* Regulator for HS USB Port 2 PHY reset */
+static struct regulator_consumer_supply hsusb2_reset_supplies[] = {
+	/* Link PHY device to reset supply so it gets used in the PHY driver */
+	REGULATOR_SUPPLY("reset", "nop_usb_xceiv.2"),
+};
+
+static struct regulator_init_data hsusb2_reset_data = {
+	.constraints = {
+		.valid_ops_mask = REGULATOR_CHANGE_STATUS,
+	},
+	.consumer_supplies = hsusb2_reset_supplies,
+	.num_consumer_supplies = ARRAY_SIZE(hsusb2_reset_supplies),
+};
+
+static struct fixed_voltage_config hsusb2_reset_config = {
+	.supply_name = "hsusb2_reset",
+	.microvolts = 3300000,
+	.gpio = 61,
+	.startup_delay = 70000, /* 70msec */
+	.enable_high = 1,
+	.enabled_at_boot = 0,   /* keep in RESET */
+	.init_data = &hsusb2_reset_data,
+};
+
+static struct platform_device hsusb2_reset_device = {
+	.name = "reg-fixed-voltage",
+	.id = PLATFORM_DEVID_AUTO,
+	.dev = {
+		.platform_data = &hsusb2_reset_config,
+	},
+};
+
 static struct usbhs_omap_platform_data usbhs_bdata __initdata = {
 
 	.port_mode[0] = OMAP_EHCI_PORT_MODE_PHY,
 	.port_mode[1] = OMAP_EHCI_PORT_MODE_PHY,
-	.port_mode[2] = OMAP_USBHS_PORT_MODE_UNUSED,
-
-	.phy_reset  = true,
-	.reset_gpio_port[0]  = 126,
-	.reset_gpio_port[1]  = 61,
-	.reset_gpio_port[2]  = -EINVAL
 };
 
 #ifdef CONFIG_OMAP_MUX
@@ -189,6 +262,13 @@ static struct flash_partitions sdp_flash_partitions[] = {
 	},
 };
 
+static struct platform_device *sdp3630_devices[] __initdata = {
+	&hsusb1_phy_device,
+	&hsusb1_reset_device,
+	&hsusb2_phy_device,
+	&hsusb2_reset_device,
+};
+
 static void __init omap_sdp_init(void)
 {
 	omap3_mux_init(board_mux, OMAP_PACKAGE_CBP);
@@ -199,6 +279,14 @@ static void __init omap_sdp_init(void)
 	board_smc91x_init();
 	board_flash_init(sdp_flash_partitions, chip_sel_sdp, NAND_BUSWIDTH_16);
 	enable_board_wakeup_source();
+
+	platform_add_devices(sdp3630_devices, ARRAY_SIZE(sdp3630_devices));
+
+	/* PHY on HSUSB Port 1 i.e. index 0 */
+	usb_bind_phy("ehci-omap.0", 0, "nop_usb_xceiv.1");
+	/* PHY on HSUSB Port 2 i.e. index 1 */
+	usb_bind_phy("ehci-omap.0", 1, "nop_usb_xceiv.2");
+
 	usbhs_init(&usbhs_bdata);
 }
 
-- 
1.7.4.1


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

* [PATCH 07/24] ARM: OMAP: AM3517crane: Adapt to ehci-omap changes
  2013-03-12 11:43 [PATCH 00/24] ARM: OMAP2+: Adapt to ehci-omap changes for 3.10 Roger Quadros
                   ` (5 preceding siblings ...)
  2013-03-12 11:43 ` [PATCH 06/24] ARM: OMAP3: 3630SDP: " Roger Quadros
@ 2013-03-12 11:43 ` Roger Quadros
  2013-03-12 11:43 ` [PATCH 08/24] ARM: OMAP: AM3517evm: " Roger Quadros
                   ` (17 subsequent siblings)
  24 siblings, 0 replies; 35+ messages in thread
From: Roger Quadros @ 2013-03-12 11:43 UTC (permalink / raw)
  To: tony
  Cc: balbi, b-cousson, linux-kernel, linux-usb, linux-omap,
	devicetree-discuss, rogerq

Add platform device for 'nop-usb-xceiv'. This will be used as a
PHY for HS USB Port 1, so provide binding information for it.

Model RESET and Power for HS USB Port 1 as GPIO fixed regulators
and link them to the 'nop-usb-xceiv' PHY.

Signed-off-by: Roger Quadros <rogerq@ti.com>
Acked-by: Felipe Balbi <balbi@ti.com>
---
 arch/arm/mach-omap2/board-am3517crane.c |   95 +++++++++++++++++++++++++++----
 1 files changed, 83 insertions(+), 12 deletions(-)

diff --git a/arch/arm/mach-omap2/board-am3517crane.c b/arch/arm/mach-omap2/board-am3517crane.c
index 7d3358b..6dd6c1d 100644
--- a/arch/arm/mach-omap2/board-am3517crane.c
+++ b/arch/arm/mach-omap2/board-am3517crane.c
@@ -24,6 +24,9 @@
 #include <linux/mtd/mtd.h>
 #include <linux/mtd/nand.h>
 #include <linux/mtd/partitions.h>
+#include <linux/regulator/machine.h>
+#include <linux/regulator/fixed.h>
+#include <linux/usb/phy.h>
 
 #include <asm/mach-types.h>
 #include <asm/mach/arch.h>
@@ -47,15 +50,84 @@ static struct omap_board_mux board_mux[] __initdata = {
 };
 #endif
 
+/* PHY device on HS USB Port 1 i.e. nop_usb_xceiv.1 */
+static struct platform_device hsusb1_phy_device = {
+	.name = "nop_usb_xceiv",
+	.id = 1,
+};
+
+/* Regulator for HS USB Port 1 PHY reset */
+static struct regulator_consumer_supply hsusb1_reset_supplies[] = {
+	/* Link PHY device to reset supply so it gets used in the PHY driver */
+	REGULATOR_SUPPLY("reset", "nop_usb_xceiv.1"),
+};
+
+static struct regulator_init_data hsusb1_reset_data = {
+	.constraints = {
+		.valid_ops_mask = REGULATOR_CHANGE_STATUS,
+	},
+	.consumer_supplies = hsusb1_reset_supplies,
+	.num_consumer_supplies = ARRAY_SIZE(hsusb1_reset_supplies),
+};
+
+static struct fixed_voltage_config hsusb1_reset_config = {
+	.supply_name = "hsusb1_reset",
+	.microvolts = 3300000,
+	.gpio = GPIO_USB_NRESET,
+	.startup_delay = 70000, /* 70msec */
+	.enable_high = 1,
+	.enabled_at_boot = 0,   /* keep in RESET */
+	.init_data = &hsusb1_reset_data,
+};
+
+static struct platform_device hsusb1_reset_device = {
+	.name = "reg-fixed-voltage",
+	.id = PLATFORM_DEVID_AUTO,
+	.dev = {
+		.platform_data = &hsusb1_reset_config,
+	},
+};
+
+/* Regulator for HS USB Port 1 supply */
+static struct regulator_consumer_supply hsusb1_power_supplies[] = {
+/* Link PHY device to power supply so it gets enabled in the PHY driver */
+	REGULATOR_SUPPLY("vcc", "nop_usb_xceiv.1"),
+};
+
+static struct regulator_init_data hsusb1_power_data = {
+	.constraints = {
+		.valid_ops_mask = REGULATOR_CHANGE_STATUS,
+	},
+	.consumer_supplies = hsusb1_power_supplies,
+	.num_consumer_supplies  = ARRAY_SIZE(hsusb1_power_supplies),
+};
+
+static struct fixed_voltage_config hsusb1_power_config = {
+	.supply_name = "hsusb1_vbus",
+	.microvolts = 5000000,
+	.gpio = GPIO_USB_POWER,
+	.startup_delay = 70000, /* 70msec */
+	.enable_high = 1,
+	.enabled_at_boot = 0,
+	.init_data = &hsusb1_power_data,
+};
+
+static struct platform_device hsusb1_power_device = {
+	.name = "reg-fixed-voltage",
+	.id = PLATFORM_DEVID_AUTO,
+	.dev = {
+		.platform_data = &hsusb1_power_config,
+	},
+};
+
 static struct usbhs_omap_platform_data usbhs_bdata __initdata = {
 	.port_mode[0] = OMAP_EHCI_PORT_MODE_PHY,
-	.port_mode[1] = OMAP_USBHS_PORT_MODE_UNUSED,
-	.port_mode[2] = OMAP_USBHS_PORT_MODE_UNUSED,
+};
 
-	.phy_reset  = true,
-	.reset_gpio_port[0]  = GPIO_USB_NRESET,
-	.reset_gpio_port[1]  = -EINVAL,
-	.reset_gpio_port[2]  = -EINVAL
+static struct platform_device *am3517_crane_devices[] __initdata = {
+	&hsusb1_phy_device,
+	&hsusb1_reset_device,
+	&hsusb1_power_device,
 };
 
 static struct mtd_partition crane_nand_partitions[] = {
@@ -131,12 +203,11 @@ static void __init am3517_crane_init(void)
 		return;
 	}
 
-	ret = gpio_request_one(GPIO_USB_POWER, GPIOF_OUT_INIT_HIGH,
-			       "usb_ehci_enable");
-	if (ret < 0) {
-		pr_err("Can not request GPIO %d\n", GPIO_USB_POWER);
-		return;
-	}
+	platform_add_devices(am3517_crane_devices,
+				ARRAY_SIZE(am3517_crane_devices));
+
+	/* PHY on HSUSB Port 1 i.e. index 0 */
+	usb_bind_phy("ehci-omap.0", 0, "nop_usb_xceiv.1");
 
 	usbhs_init(&usbhs_bdata);
 	am35xx_emac_init(AM35XX_DEFAULT_MDIO_FREQUENCY, 1);
-- 
1.7.4.1


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

* [PATCH 08/24] ARM: OMAP: AM3517evm: Adapt to ehci-omap changes
  2013-03-12 11:43 [PATCH 00/24] ARM: OMAP2+: Adapt to ehci-omap changes for 3.10 Roger Quadros
                   ` (6 preceding siblings ...)
  2013-03-12 11:43 ` [PATCH 07/24] ARM: OMAP: AM3517crane: " Roger Quadros
@ 2013-03-12 11:43 ` Roger Quadros
  2013-03-12 11:43 ` [PATCH 09/24] ARM: OMAP3: cm-t35: " Roger Quadros
                   ` (16 subsequent siblings)
  24 siblings, 0 replies; 35+ messages in thread
From: Roger Quadros @ 2013-03-12 11:43 UTC (permalink / raw)
  To: tony
  Cc: balbi, b-cousson, linux-kernel, linux-usb, linux-omap,
	devicetree-discuss, rogerq

Add 2 platform devices for 'nop-usb-xceiv'. These will be used as a
PHY for HS USB Port 1 and 2, so provide binding information for them.

Model RESET for HS USB Port 1 as GPIO fixed regulator and link it
to the 'nop-usb-xceiv' PHY on port 1.

Signed-off-by: Roger Quadros <rogerq@ti.com>
Acked-by: Felipe Balbi <balbi@ti.com>
---
 arch/arm/mach-omap2/board-am3517evm.c |   66 ++++++++++++++++++++++++++++++---
 1 files changed, 60 insertions(+), 6 deletions(-)

diff --git a/arch/arm/mach-omap2/board-am3517evm.c b/arch/arm/mach-omap2/board-am3517evm.c
index 9fb8590..36c00fb 100644
--- a/arch/arm/mach-omap2/board-am3517evm.c
+++ b/arch/arm/mach-omap2/board-am3517evm.c
@@ -25,6 +25,9 @@
 #include <linux/can/platform/ti_hecc.h>
 #include <linux/davinci_emac.h>
 #include <linux/mmc/host.h>
+#include <linux/regulator/machine.h>
+#include <linux/regulator/fixed.h>
+#include <linux/usb/phy.h>
 #include <linux/usb/musb.h>
 #include <linux/platform_data/gpio-omap.h>
 
@@ -274,6 +277,50 @@ static __init void am3517_evm_mcbsp1_init(void)
 	omap_ctrl_writel(devconf0, OMAP2_CONTROL_DEVCONF0);
 }
 
+/* PHY device on HS USB Port 1 i.e. nop_usb_xceiv.1 */
+static struct platform_device hsusb1_phy_device = {
+	.name = "nop_usb_xceiv",
+	.id = 1,
+};
+
+/* Regulator for HS USB Port 1 PHY reset */
+static struct regulator_consumer_supply hsusb1_reset_supplies[] = {
+	/* Link PHY device to reset supply so it gets used in the PHY driver */
+	REGULATOR_SUPPLY("reset", "nop_usb_xceiv.1"),
+};
+
+static struct regulator_init_data hsusb1_reset_data = {
+	.constraints = {
+		.valid_ops_mask = REGULATOR_CHANGE_STATUS,
+	},
+	.consumer_supplies = hsusb1_reset_supplies,
+	.num_consumer_supplies = ARRAY_SIZE(hsusb1_reset_supplies),
+};
+
+static struct fixed_voltage_config hsusb1_reset_config = {
+	.supply_name = "hsusb1_reset",
+	.microvolts = 3300000,
+	.gpio = 57,
+	.startup_delay = 70000, /* 70msec */
+	.enable_high = 1,
+	.enabled_at_boot = 0,   /* keep in RESET */
+	.init_data = &hsusb1_reset_data,
+};
+
+static struct platform_device hsusb1_reset_device = {
+	.name = "reg-fixed-voltage",
+	.id = PLATFORM_DEVID_AUTO,
+	.dev = {
+		.platform_data = &hsusb1_reset_config,
+	},
+};
+
+/* PHY device on HS USB Port 2 i.e. nop_usb_xceiv.2 */
+static struct platform_device hsusb2_phy_device = {
+	.name = "nop_usb_xceiv",
+	.id = 2,
+};
+
 static struct usbhs_omap_platform_data usbhs_bdata __initdata = {
 	.port_mode[0] = OMAP_EHCI_PORT_MODE_PHY,
 #if defined(CONFIG_PANEL_SHARP_LQ043T1DG01) || \
@@ -282,12 +329,6 @@ static struct usbhs_omap_platform_data usbhs_bdata __initdata = {
 #else
 	.port_mode[1] = OMAP_EHCI_PORT_MODE_PHY,
 #endif
-	.port_mode[2] = OMAP_USBHS_PORT_MODE_UNUSED,
-
-	.phy_reset  = true,
-	.reset_gpio_port[0]  = 57,
-	.reset_gpio_port[1]  = -EINVAL,
-	.reset_gpio_port[2]  = -EINVAL
 };
 
 #ifdef CONFIG_OMAP_MUX
@@ -349,6 +390,11 @@ static struct omap2_hsmmc_info mmc[] = {
 	{}      /* Terminator */
 };
 
+static struct platform_device *am3517evm_devices[] __initdata = {
+	&hsusb1_phy_device,
+	&hsusb1_reset_device,
+	&hsusb2_phy_device,
+};
 
 static void __init am3517_evm_init(void)
 {
@@ -361,6 +407,14 @@ static void __init am3517_evm_init(void)
 
 	/* Configure GPIO for EHCI port */
 	omap_mux_init_gpio(57, OMAP_PIN_OUTPUT);
+
+	platform_add_devices(am3517evm_devices, ARRAY_SIZE(am3517evm_devices));
+
+	/* PHY on HSUSB Port 1 i.e. index 0 */
+	usb_bind_phy("ehci-omap.0", 0, "nop_usb_xceiv.1");
+	/* PHY on HSUSB Port 2 i.e. index 1 */
+	usb_bind_phy("ehci-omap.0", 1, "nop_usb_xceiv.2");
+
 	usbhs_init(&usbhs_bdata);
 	am3517_evm_hecc_init(&am3517_evm_hecc_pdata);
 	/* DSS */
-- 
1.7.4.1


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

* [PATCH 09/24] ARM: OMAP3: cm-t35: Adapt to ehci-omap changes
  2013-03-12 11:43 [PATCH 00/24] ARM: OMAP2+: Adapt to ehci-omap changes for 3.10 Roger Quadros
                   ` (7 preceding siblings ...)
  2013-03-12 11:43 ` [PATCH 08/24] ARM: OMAP: AM3517evm: " Roger Quadros
@ 2013-03-12 11:43 ` Roger Quadros
  2013-03-12 11:43 ` [PATCH 10/24] ARM: OMAP3: cm-t3517: " Roger Quadros
                   ` (15 subsequent siblings)
  24 siblings, 0 replies; 35+ messages in thread
From: Roger Quadros @ 2013-03-12 11:43 UTC (permalink / raw)
  To: tony
  Cc: balbi, b-cousson, linux-kernel, linux-usb, linux-omap,
	devicetree-discuss, rogerq

Add 2 platform devices for 'nop-usb-xceiv'. These will be used
as PHYs for HS USB ports 1 and 2 so provide binding information
for them.

Model RESET for HS USB Ports 1 and 2 as GPIO fixed regulators and
link them to the 2 PHYs we just created.

Signed-off-by: Roger Quadros <rogerq@ti.com>
Acked-by: Felipe Balbi <balbi@ti.com>
---
 arch/arm/mach-omap2/board-cm-t35.c |   95 ++++++++++++++++++++++++++++++++++--
 1 files changed, 90 insertions(+), 5 deletions(-)

diff --git a/arch/arm/mach-omap2/board-cm-t35.c b/arch/arm/mach-omap2/board-cm-t35.c
index af2bb21..155ab13 100644
--- a/arch/arm/mach-omap2/board-cm-t35.c
+++ b/arch/arm/mach-omap2/board-cm-t35.c
@@ -29,6 +29,7 @@
 #include <linux/i2c/twl.h>
 #include <linux/regulator/fixed.h>
 #include <linux/regulator/machine.h>
+#include <linux/usb/phy.h>
 #include <linux/mmc/host.h>
 #include <linux/usb/phy.h>
 
@@ -419,15 +420,92 @@ static struct omap2_hsmmc_info mmc[] = {
 	{}	/* Terminator */
 };
 
+/* PHY device on HS USB Port 1 i.e. nop_usb_xceiv.1 */
+static struct platform_device hsusb1_phy_device = {
+	.name = "nop_usb_xceiv",
+	.id = 1,
+};
+
+/* Regulator for HS USB Port 1 PHY reset */
+static struct regulator_consumer_supply hsusb1_reset_supplies[] = {
+	/* Link PHY device to reset supply so it gets used in the PHY driver */
+	REGULATOR_SUPPLY("reset", "nop_usb_xceiv.1"),
+};
+
+static struct regulator_init_data hsusb1_reset_data = {
+	.constraints = {
+		.valid_ops_mask = REGULATOR_CHANGE_STATUS,
+	},
+	.consumer_supplies = hsusb1_reset_supplies,
+	.num_consumer_supplies = ARRAY_SIZE(hsusb1_reset_supplies),
+};
+
+static struct fixed_voltage_config hsusb1_reset_config = {
+	.supply_name = "hsusb1_reset",
+	.microvolts = 3300000,
+	.gpio = OMAP_MAX_GPIO_LINES + 6,
+	.startup_delay = 70000, /* 70msec */
+	.enable_high = 1,
+	.enabled_at_boot = 0,   /* keep in RESET */
+	.init_data = &hsusb1_reset_data,
+};
+
+static struct platform_device hsusb1_reset_device = {
+	.name = "reg-fixed-voltage",
+	.id = PLATFORM_DEVID_AUTO,
+	.dev = {
+		.platform_data = &hsusb1_reset_config,
+	},
+};
+
+/* PHY device on HS USB Port 2 i.e. nop_usb_xceiv.2 */
+static struct platform_device hsusb2_phy_device = {
+	.name = "nop_usb_xceiv",
+	.id = 2,
+};
+
+/* Regulator for HS USB Port 2 PHY reset */
+static struct regulator_consumer_supply hsusb2_reset_supplies[] = {
+	/* Link PHY device to reset supply so it gets used in the PHY driver */
+	REGULATOR_SUPPLY("reset", "nop_usb_xceiv.2"),
+};
+
+static struct regulator_init_data hsusb2_reset_data = {
+	.constraints = {
+		.valid_ops_mask = REGULATOR_CHANGE_STATUS,
+	},
+	.consumer_supplies = hsusb2_reset_supplies,
+	.num_consumer_supplies = ARRAY_SIZE(hsusb2_reset_supplies),
+};
+
+static struct fixed_voltage_config hsusb2_reset_config = {
+	.supply_name = "hsusb2_reset",
+	.microvolts = 3300000,
+	.gpio = OMAP_MAX_GPIO_LINES + 7,
+	.startup_delay = 70000, /* 70msec */
+	.enable_high = 1,
+	.enabled_at_boot = 0,   /* keep in RESET */
+	.init_data = &hsusb2_reset_data,
+};
+
+static struct platform_device hsusb2_reset_device = {
+	.name = "reg-fixed-voltage",
+	.id = PLATFORM_DEVID_AUTO,
+	.dev = {
+		.platform_data = &hsusb2_reset_config,
+	},
+};
+
 static struct usbhs_omap_platform_data usbhs_bdata __initdata = {
 	.port_mode[0] = OMAP_EHCI_PORT_MODE_PHY,
 	.port_mode[1] = OMAP_EHCI_PORT_MODE_PHY,
-	.port_mode[2] = OMAP_USBHS_PORT_MODE_UNUSED,
+};
 
-	.phy_reset  = true,
-	.reset_gpio_port[0]  = OMAP_MAX_GPIO_LINES + 6,
-	.reset_gpio_port[1]  = OMAP_MAX_GPIO_LINES + 7,
-	.reset_gpio_port[2]  = -EINVAL
+static struct platform_device *usbhs_devices[] = {
+	&hsusb1_phy_device,
+	&hsusb1_reset_device,
+	&hsusb2_phy_device,
+	&hsusb2_reset_device,
 };
 
 static void  __init cm_t35_init_usbh(void)
@@ -444,6 +522,13 @@ static void  __init cm_t35_init_usbh(void)
 		msleep(1);
 	}
 
+	platform_add_devices(usbhs_devices, ARRAY_SIZE(usbhs_devices));
+
+	/* PHY on HSUSB Port 1 i.e. index 0 */
+	usb_bind_phy("ehci-omap.0", 0, "nop_usb_xceiv.1");
+	/* PHY on HSUSB Port 2 i.e. index 1 */
+	usb_bind_phy("ehci-omap.0", 1, "nop_usb_xceiv.2");
+
 	usbhs_init(&usbhs_bdata);
 }
 
-- 
1.7.4.1


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

* [PATCH 10/24] ARM: OMAP3: cm-t3517: Adapt to ehci-omap changes
  2013-03-12 11:43 [PATCH 00/24] ARM: OMAP2+: Adapt to ehci-omap changes for 3.10 Roger Quadros
                   ` (8 preceding siblings ...)
  2013-03-12 11:43 ` [PATCH 09/24] ARM: OMAP3: cm-t35: " Roger Quadros
@ 2013-03-12 11:43 ` Roger Quadros
  2013-03-12 11:43 ` [PATCH 11/24] ARM: OMAP: devkit8000: " Roger Quadros
                   ` (14 subsequent siblings)
  24 siblings, 0 replies; 35+ messages in thread
From: Roger Quadros @ 2013-03-12 11:43 UTC (permalink / raw)
  To: tony
  Cc: balbi, b-cousson, linux-kernel, linux-usb, linux-omap,
	devicetree-discuss, rogerq

Add 2 platform devices for 'nop-usb-xceiv'. These will be used
as PHYs for HS USB ports 1 and 2 so provide binding information
for them.

Model RESET for HS USB Ports 1 and 2 as GPIO fixed regulators and
link them to the 2 PHYs we just created.

Signed-off-by: Roger Quadros <rogerq@ti.com>
Acked-by: Felipe Balbi <balbi@ti.com>
---
 arch/arm/mach-omap2/board-cm-t3517.c |   97 ++++++++++++++++++++++++++++++++--
 1 files changed, 92 insertions(+), 5 deletions(-)

diff --git a/arch/arm/mach-omap2/board-cm-t3517.c b/arch/arm/mach-omap2/board-cm-t3517.c
index a66da80..de470c8 100644
--- a/arch/arm/mach-omap2/board-cm-t3517.c
+++ b/arch/arm/mach-omap2/board-cm-t3517.c
@@ -34,6 +34,9 @@
 #include <linux/mtd/partitions.h>
 #include <linux/mmc/host.h>
 #include <linux/can/platform/ti_hecc.h>
+#include <linux/regulator/machine.h>
+#include <linux/regulator/fixed.h>
+#include <linux/usb/phy.h>
 
 #include <asm/mach-types.h>
 #include <asm/mach/arch.h>
@@ -188,15 +191,92 @@ static inline void cm_t3517_init_rtc(void) {}
 #define HSUSB2_RESET_GPIO	(147)
 #define USB_HUB_RESET_GPIO	(152)
 
+/* PHY device on HS USB Port 1 i.e. nop_usb_xceiv.1 */
+static struct platform_device hsusb1_phy_device = {
+	.name = "nop_usb_xceiv",
+	.id = 1,
+};
+
+/* Regulator for HS USB Port 1 PHY reset */
+static struct regulator_consumer_supply hsusb1_reset_supplies[] = {
+	/* Link PHY device to reset supply so it gets used in the PHY driver */
+	REGULATOR_SUPPLY("reset", "nop_usb_xceiv.1"),
+};
+
+static struct regulator_init_data hsusb1_reset_data = {
+	.constraints = {
+		.valid_ops_mask = REGULATOR_CHANGE_STATUS,
+	},
+	.consumer_supplies = hsusb1_reset_supplies,
+	.num_consumer_supplies = ARRAY_SIZE(hsusb1_reset_supplies),
+};
+
+static struct fixed_voltage_config hsusb1_reset_config = {
+	.supply_name = "hsusb1_reset",
+	.microvolts = 3300000,
+	.gpio = HSUSB1_RESET_GPIO,
+	.startup_delay = 70000, /* 70msec */
+	.enable_high = 1,
+	.enabled_at_boot = 0,   /* keep in RESET */
+	.init_data = &hsusb1_reset_data,
+};
+
+static struct platform_device hsusb1_reset_device = {
+	.name = "reg-fixed-voltage",
+	.id = PLATFORM_DEVID_AUTO,
+	.dev = {
+		.platform_data = &hsusb1_reset_config,
+	},
+};
+
+/* PHY device on HS USB Port 2 i.e. nop_usb_xceiv.2 */
+static struct platform_device hsusb2_phy_device = {
+	.name = "nop_usb_xceiv",
+	.id = 2,
+};
+
+/* Regulator for HS USB Port 2 PHY reset */
+static struct regulator_consumer_supply hsusb2_reset_supplies[] = {
+	/* Link PHY device to reset supply so it gets used in the PHY driver */
+	REGULATOR_SUPPLY("reset", "nop_usb_xceiv.2"),
+};
+
+static struct regulator_init_data hsusb2_reset_data = {
+	.constraints = {
+		.valid_ops_mask = REGULATOR_CHANGE_STATUS,
+	},
+	.consumer_supplies = hsusb2_reset_supplies,
+	.num_consumer_supplies = ARRAY_SIZE(hsusb2_reset_supplies),
+};
+
+static struct fixed_voltage_config hsusb2_reset_config = {
+	.supply_name = "hsusb2_reset",
+	.microvolts = 3300000,
+	.gpio = HSUSB2_RESET_GPIO,
+	.startup_delay = 70000, /* 70msec */
+	.enable_high = 1,
+	.enabled_at_boot = 0,   /* keep in RESET */
+	.init_data = &hsusb2_reset_data,
+};
+
+static struct platform_device hsusb2_reset_device = {
+	.name = "reg-fixed-voltage",
+	.id = PLATFORM_DEVID_AUTO,
+	.dev = {
+		.platform_data = &hsusb2_reset_config,
+	},
+};
+
 static struct usbhs_omap_platform_data cm_t3517_ehci_pdata __initdata = {
 	.port_mode[0] = OMAP_EHCI_PORT_MODE_PHY,
 	.port_mode[1] = OMAP_EHCI_PORT_MODE_PHY,
-	.port_mode[2] = OMAP_USBHS_PORT_MODE_UNUSED,
+};
 
-	.phy_reset  = true,
-	.reset_gpio_port[0]  = HSUSB1_RESET_GPIO,
-	.reset_gpio_port[1]  = HSUSB2_RESET_GPIO,
-	.reset_gpio_port[2]  = -EINVAL,
+static struct platform_device *usbhs_devices[] = {
+	&hsusb1_phy_device,
+	&hsusb1_reset_device,
+	&hsusb2_phy_device,
+	&hsusb2_reset_device,
 };
 
 static int __init cm_t3517_init_usbh(void)
@@ -213,6 +293,13 @@ static int __init cm_t3517_init_usbh(void)
 		msleep(1);
 	}
 
+	platform_add_devices(usbhs_devices, ARRAY_SIZE(usbhs_devices));
+
+	/* PHY on HSUSB Port 1 i.e. index 0 */
+	usb_bind_phy("ehci-omap.0", 0, "nop_usb_xceiv.1");
+	/* PHY on HSUSB Port 2 i.e. index 1 */
+	usb_bind_phy("ehci-omap.0", 1, "nop_usb_xceiv.2");
+
 	usbhs_init(&cm_t3517_ehci_pdata);
 
 	return 0;
-- 
1.7.4.1


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

* [PATCH 11/24] ARM: OMAP: devkit8000: Adapt to ehci-omap changes
  2013-03-12 11:43 [PATCH 00/24] ARM: OMAP2+: Adapt to ehci-omap changes for 3.10 Roger Quadros
                   ` (9 preceding siblings ...)
  2013-03-12 11:43 ` [PATCH 10/24] ARM: OMAP3: cm-t3517: " Roger Quadros
@ 2013-03-12 11:43 ` Roger Quadros
  2013-03-12 11:43 ` [PATCH 12/24] ARM: OMAP3: igep0020: " Roger Quadros
                   ` (13 subsequent siblings)
  24 siblings, 0 replies; 35+ messages in thread
From: Roger Quadros @ 2013-03-12 11:43 UTC (permalink / raw)
  To: tony
  Cc: balbi, b-cousson, linux-kernel, linux-usb, linux-omap,
	devicetree-discuss, rogerq

Add platform device for 'nop-usb-xceiv'. This will be used as a
PHY for HS USB Port 1, so provide binding information for it.

Signed-off-by: Roger Quadros <rogerq@ti.com>
Acked-by: Felipe Balbi <balbi@ti.com>
---
 arch/arm/mach-omap2/board-devkit8000.c |   20 ++++++++++++--------
 1 files changed, 12 insertions(+), 8 deletions(-)

diff --git a/arch/arm/mach-omap2/board-devkit8000.c b/arch/arm/mach-omap2/board-devkit8000.c
index 53056c3..922ca91 100644
--- a/arch/arm/mach-omap2/board-devkit8000.c
+++ b/arch/arm/mach-omap2/board-devkit8000.c
@@ -33,6 +33,7 @@
 
 #include <linux/regulator/machine.h>
 #include <linux/i2c/twl.h>
+#include <linux/usb/phy.h>
 #include "id.h"
 #include <asm/mach-types.h>
 #include <asm/mach/arch.h>
@@ -430,22 +431,21 @@ static void __init omap_dm9000_init(void)
 	eth_addr[5] = (odi.id_0 & 0x000000ff);
 }
 
+/* PHY device on HS USB Port 1 i.e. nop_usb_xceiv.1 */
+static struct platform_device hsusb1_phy_device = {
+	.name = "nop_usb_xceiv",
+	.id = 1,
+};
+
 static struct platform_device *devkit8000_devices[] __initdata = {
 	&leds_gpio,
 	&keys_gpio,
 	&omap_dm9000_dev,
+	&hsusb1_phy_device,
 };
 
 static struct usbhs_omap_platform_data usbhs_bdata __initdata = {
-
 	.port_mode[0] = OMAP_EHCI_PORT_MODE_PHY,
-	.port_mode[1] = OMAP_USBHS_PORT_MODE_UNUSED,
-	.port_mode[2] = OMAP_USBHS_PORT_MODE_UNUSED,
-
-	.phy_reset  = true,
-	.reset_gpio_port[0]  = -EINVAL,
-	.reset_gpio_port[1]  = -EINVAL,
-	.reset_gpio_port[2]  = -EINVAL
 };
 
 #ifdef CONFIG_OMAP_MUX
@@ -625,6 +625,10 @@ static void __init devkit8000_init(void)
 
 	usb_bind_phy("musb-hdrc.0.auto", 0, "twl4030_usb");
 	usb_musb_init(NULL);
+
+	/* PHY on HSUSB Port 1 i.e. index 0 */
+	usb_bind_phy("ehci-omap.0", 0, "nop_usb_xceiv.1");
+
 	usbhs_init(&usbhs_bdata);
 	board_nand_init(devkit8000_nand_partitions,
 			ARRAY_SIZE(devkit8000_nand_partitions), NAND_CS,
-- 
1.7.4.1


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

* [PATCH 12/24] ARM: OMAP3: igep0020: Adapt to ehci-omap changes
  2013-03-12 11:43 [PATCH 00/24] ARM: OMAP2+: Adapt to ehci-omap changes for 3.10 Roger Quadros
                   ` (10 preceding siblings ...)
  2013-03-12 11:43 ` [PATCH 11/24] ARM: OMAP: devkit8000: " Roger Quadros
@ 2013-03-12 11:43 ` Roger Quadros
  2013-03-12 11:43 ` [PATCH 13/24] ARM: OMAP3: omap3evm: " Roger Quadros
                   ` (12 subsequent siblings)
  24 siblings, 0 replies; 35+ messages in thread
From: Roger Quadros @ 2013-03-12 11:43 UTC (permalink / raw)
  To: tony
  Cc: balbi, b-cousson, linux-kernel, linux-usb, linux-omap,
	devicetree-discuss, rogerq

Add 2 platform devices for 'nop-usb-xceiv'. These will be used
as PHYs for HS USB ports 1 and 2 so provide binding information
for them.

Model RESET for HS USB Ports 1 and 2 as GPIO fixed regulators and
link them to the 2 PHYs we just created.

Signed-off-by: Roger Quadros <rogerq@ti.com>
Acked-by: Felipe Balbi <balbi@ti.com>
---
 arch/arm/mach-omap2/board-igep0020.c |  112 +++++++++++++++++++++++++++++----
 1 files changed, 98 insertions(+), 14 deletions(-)

diff --git a/arch/arm/mach-omap2/board-igep0020.c b/arch/arm/mach-omap2/board-igep0020.c
index bf92678..c4730c6 100644
--- a/arch/arm/mach-omap2/board-igep0020.c
+++ b/arch/arm/mach-omap2/board-igep0020.c
@@ -22,6 +22,7 @@
 
 #include <linux/regulator/machine.h>
 #include <linux/regulator/fixed.h>
+#include <linux/usb/phy.h>
 #include <linux/i2c/twl.h>
 #include <linux/mmc/host.h>
 
@@ -527,26 +528,98 @@ static void __init igep_i2c_init(void)
 	omap3_pmic_init("twl4030", &igep_twldata);
 }
 
+/* PHY device on HS USB Port 1 i.e. nop_usb_xceiv.1 */
+static struct platform_device hsusb1_phy_device = {
+	.name = "nop_usb_xceiv",
+	.id = 1,
+};
+
+/* Regulator for HS USB Port 1 PHY reset */
+static struct regulator_consumer_supply hsusb1_reset_supplies[] = {
+	/* Link PHY device to reset supply so it gets used in the PHY driver */
+	REGULATOR_SUPPLY("reset", "nop_usb_xceiv.1"),
+};
+
+static struct regulator_init_data hsusb1_reset_data = {
+	.constraints = {
+		.valid_ops_mask = REGULATOR_CHANGE_STATUS,
+	},
+	.consumer_supplies = hsusb1_reset_supplies,
+	.num_consumer_supplies = ARRAY_SIZE(hsusb1_reset_supplies),
+};
+
+static struct fixed_voltage_config hsusb1_reset_config = {
+	.supply_name = "hsusb1_reset",
+	.microvolts = 3300000,
+	.gpio = IGEP2_GPIO_USBH_NRESET,
+	.startup_delay = 70000, /* 70msec */
+	.enable_high = 1,
+	.enabled_at_boot = 0,   /* keep in RESET */
+	.init_data = &hsusb1_reset_data,
+};
+
+static struct platform_device hsusb1_reset_device = {
+	.name = "reg-fixed-voltage",
+	.id = PLATFORM_DEVID_AUTO,
+	.dev = {
+		.platform_data = &hsusb1_reset_config,
+	},
+};
+
+/* PHY device on HS USB Port 2 i.e. nop_usb_xceiv.2 */
+static struct platform_device hsusb2_phy_device = {
+	.name = "nop_usb_xceiv",
+	.id = 2,
+};
+
+/* Regulator for HS USB Port 2 PHY reset */
+static struct regulator_consumer_supply hsusb2_reset_supplies[] = {
+	/* Link PHY device to reset supply so it gets used in the PHY driver */
+	REGULATOR_SUPPLY("reset", "nop_usb_xceiv.2"),
+};
+
+static struct regulator_init_data hsusb2_reset_data = {
+	.constraints = {
+		.valid_ops_mask = REGULATOR_CHANGE_STATUS,
+	},
+	.consumer_supplies = hsusb2_reset_supplies,
+	.num_consumer_supplies = ARRAY_SIZE(hsusb2_reset_supplies),
+};
+
+static struct fixed_voltage_config hsusb2_reset_config = {
+	.supply_name = "hsusb2_reset",
+	.microvolts = 3300000,
+	.gpio = IGEP3_GPIO_USBH_NRESET,
+	.startup_delay = 70000, /* 70msec */
+	.enable_high = 1,
+	.enabled_at_boot = 0,   /* keep in RESET */
+	.init_data = &hsusb2_reset_data,
+};
+
+static struct platform_device hsusb2_reset_device = {
+	.name = "reg-fixed-voltage",
+	.id = PLATFORM_DEVID_AUTO,
+	.dev = {
+		.platform_data = &hsusb2_reset_config,
+	},
+};
+
+static struct platform_device *igep2_devices[] __initdata = {
+	&hsusb1_phy_device,
+	&hsusb1_reset_device,
+};
+
+static struct platform_device *igep3_devices[] __initdata = {
+	&hsusb2_phy_device,
+	&hsusb2_reset_device,
+};
+
 static struct usbhs_omap_platform_data igep2_usbhs_bdata __initdata = {
 	.port_mode[0] = OMAP_EHCI_PORT_MODE_PHY,
-	.port_mode[1] = OMAP_USBHS_PORT_MODE_UNUSED,
-	.port_mode[2] = OMAP_USBHS_PORT_MODE_UNUSED,
-
-	.phy_reset = true,
-	.reset_gpio_port[0] = IGEP2_GPIO_USBH_NRESET,
-	.reset_gpio_port[1] = -EINVAL,
-	.reset_gpio_port[2] = -EINVAL,
 };
 
 static struct usbhs_omap_platform_data igep3_usbhs_bdata __initdata = {
-	.port_mode[0] = OMAP_USBHS_PORT_MODE_UNUSED,
 	.port_mode[1] = OMAP_EHCI_PORT_MODE_PHY,
-	.port_mode[2] = OMAP_USBHS_PORT_MODE_UNUSED,
-
-	.phy_reset = true,
-	.reset_gpio_port[0] = -EINVAL,
-	.reset_gpio_port[1] = IGEP3_GPIO_USBH_NRESET,
-	.reset_gpio_port[2] = -EINVAL,
 };
 
 #ifdef CONFIG_OMAP_MUX
@@ -642,8 +715,19 @@ static void __init igep_init(void)
 	if (machine_is_igep0020()) {
 		omap_display_init(&igep2_dss_data);
 		igep2_init_smsc911x();
+
+		platform_add_devices(igep2_devices, ARRAY_SIZE(igep2_devices));
+
+		/* PHY on HSUSB Port 1 i.e. index 0 */
+		usb_bind_phy("ehci-omap.0", 0, "nop_usb_xceiv.1");
+
 		usbhs_init(&igep2_usbhs_bdata);
 	} else {
+		platform_add_devices(igep3_devices, ARRAY_SIZE(igep3_devices));
+
+		/* PHY on HSUSB Port 2 i.e. index 1 */
+		usb_bind_phy("ehci-omap.0", 1, "nop_usb_xceiv.2");
+
 		usbhs_init(&igep3_usbhs_bdata);
 	}
 }
-- 
1.7.4.1


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

* [PATCH 13/24] ARM: OMAP3: omap3evm: Adapt to ehci-omap changes
  2013-03-12 11:43 [PATCH 00/24] ARM: OMAP2+: Adapt to ehci-omap changes for 3.10 Roger Quadros
                   ` (11 preceding siblings ...)
  2013-03-12 11:43 ` [PATCH 12/24] ARM: OMAP3: igep0020: " Roger Quadros
@ 2013-03-12 11:43 ` Roger Quadros
  2013-03-12 11:43 ` [PATCH 14/24] ARM: OMAP3: omap3pandora: " Roger Quadros
                   ` (11 subsequent siblings)
  24 siblings, 0 replies; 35+ messages in thread
From: Roger Quadros @ 2013-03-12 11:43 UTC (permalink / raw)
  To: tony
  Cc: balbi, b-cousson, linux-kernel, linux-usb, linux-omap,
	devicetree-discuss, rogerq

Add platform device for 'nop-usb-xceiv'. This will be used as a
PHY for HS USB Port 2, so provide binding information for it.

Model RESET for HS USB Port 2 as GPIO fixed regulator and link
it to the 'nop-usb-xceiv' PHY.

Signed-off-by: Roger Quadros <rogerq@ti.com>
Acked-by: Felipe Balbi <balbi@ti.com>
---
 arch/arm/mach-omap2/board-omap3evm.c |   62 ++++++++++++++++++++++++++++------
 1 files changed, 51 insertions(+), 11 deletions(-)

diff --git a/arch/arm/mach-omap2/board-omap3evm.c b/arch/arm/mach-omap2/board-omap3evm.c
index 48789e0..5da465e 100644
--- a/arch/arm/mach-omap2/board-omap3evm.c
+++ b/arch/arm/mach-omap2/board-omap3evm.c
@@ -34,6 +34,7 @@
 #include <linux/usb/otg.h>
 #include <linux/usb/musb.h>
 #include <linux/usb/nop-usb-xceiv.h>
+#include <linux/usb/phy.h>
 #include <linux/smsc911x.h>
 
 #include <linux/wl12xx.h>
@@ -539,17 +540,51 @@ static int __init omap3_evm_i2c_init(void)
 	return 0;
 }
 
-static struct usbhs_omap_platform_data usbhs_bdata __initdata = {
+/* PHY device on HS USB Port 2 i.e. nop_usb_xceiv.2 */
+static struct platform_device hsusb2_phy_device = {
+	.name = "nop_usb_xceiv",
+	.id = 2,
+};
 
-	.port_mode[0] = OMAP_USBHS_PORT_MODE_UNUSED,
-	.port_mode[1] = OMAP_EHCI_PORT_MODE_PHY,
-	.port_mode[2] = OMAP_USBHS_PORT_MODE_UNUSED,
+/* Regulator for HS USB Port 2 PHY reset */
+static struct regulator_consumer_supply hsusb2_reset_supplies[] = {
+	/* Link PHY device to reset supply so it gets used in the PHY driver */
+	REGULATOR_SUPPLY("reset", "nop_usb_xceiv.2"),
+};
 
-	.phy_reset  = true,
-	/* PHY reset GPIO will be runtime programmed based on EVM version */
-	.reset_gpio_port[0]  = -EINVAL,
-	.reset_gpio_port[1]  = -EINVAL,
-	.reset_gpio_port[2]  = -EINVAL
+static struct regulator_init_data hsusb2_reset_data = {
+	.constraints = {
+		.valid_ops_mask = REGULATOR_CHANGE_STATUS,
+	},
+	.consumer_supplies = hsusb2_reset_supplies,
+	.num_consumer_supplies = ARRAY_SIZE(hsusb2_reset_supplies),
+};
+
+static struct fixed_voltage_config hsusb2_reset_config = {
+	.supply_name = "hsusb2_reset",
+	.microvolts = 3300000,
+	.gpio = -1,		/* set at runtime */
+	.startup_delay = 70000, /* 70msec */
+	.enable_high = 1,
+	.enabled_at_boot = 0,   /* keep in RESET */
+	.init_data = &hsusb2_reset_data,
+};
+
+static struct platform_device hsusb2_reset_device = {
+	.name = "reg-fixed-voltage",
+	.id = PLATFORM_DEVID_AUTO,
+	.dev = {
+		.platform_data = &hsusb2_reset_config,
+	},
+};
+
+static struct platform_device *omap3evm_devices[] __initdata = {
+	&hsusb2_phy_device,
+	&hsusb2_reset_device,
+};
+
+static struct usbhs_omap_platform_data usbhs_bdata __initdata = {
+	.port_mode[1] = OMAP_EHCI_PORT_MODE_PHY,
 };
 
 #ifdef CONFIG_OMAP_MUX
@@ -725,7 +760,7 @@ static void __init omap3_evm_init(void)
 
 		/* setup EHCI phy reset config */
 		omap_mux_init_gpio(21, OMAP_PIN_INPUT_PULLUP);
-		usbhs_bdata.reset_gpio_port[1] = 21;
+		hsusb2_reset_config.gpio = 21;
 
 		/* EVM REV >= E can supply 500mA with EXTVBUS programming */
 		musb_board_data.power = 500;
@@ -733,10 +768,15 @@ static void __init omap3_evm_init(void)
 	} else {
 		/* setup EHCI phy reset on MDC */
 		omap_mux_init_gpio(135, OMAP_PIN_OUTPUT);
-		usbhs_bdata.reset_gpio_port[1] = 135;
+		hsusb2_reset_config.gpio = 135;
 	}
 	usb_bind_phy("musb-hdrc.0.auto", 0, "twl4030_usb");
 	usb_musb_init(&musb_board_data);
+
+	platform_add_devices(omap3evm_devices, ARRAY_SIZE(omap3evm_devices));
+	/* PHY on HSUSB Port 2 i.e. index 1 */
+	usb_bind_phy("ehci-omap.0", 1, "nop_usb_xceiv.2");
+
 	usbhs_init(&usbhs_bdata);
 	board_nand_init(omap3evm_nand_partitions,
 			ARRAY_SIZE(omap3evm_nand_partitions), NAND_CS,
-- 
1.7.4.1


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

* [PATCH 14/24] ARM: OMAP3: omap3pandora: Adapt to ehci-omap changes
  2013-03-12 11:43 [PATCH 00/24] ARM: OMAP2+: Adapt to ehci-omap changes for 3.10 Roger Quadros
                   ` (12 preceding siblings ...)
  2013-03-12 11:43 ` [PATCH 13/24] ARM: OMAP3: omap3evm: " Roger Quadros
@ 2013-03-12 11:43 ` Roger Quadros
  2013-03-12 11:43 ` [PATCH 15/24] ARM: OMAP3: omap3stalker: " Roger Quadros
                   ` (10 subsequent siblings)
  24 siblings, 0 replies; 35+ messages in thread
From: Roger Quadros @ 2013-03-12 11:43 UTC (permalink / raw)
  To: tony
  Cc: balbi, b-cousson, linux-kernel, linux-usb, linux-omap,
	devicetree-discuss, rogerq

Add platform device for 'nop-usb-xceiv'. This will be used as a
PHY for HS USB Port 2, so provide binding information for it.

Model RESET for HS USB Port 2 as GPIO fixed regulator and link
it to the 'nop-usb-xceiv' PHY.

Signed-off-by: Roger Quadros <rogerq@ti.com>
Acked-by: Felipe Balbi <balbi@ti.com>
---
 arch/arm/mach-omap2/board-omap3pandora.c |   52 +++++++++++++++++++++++++----
 1 files changed, 44 insertions(+), 8 deletions(-)

diff --git a/arch/arm/mach-omap2/board-omap3pandora.c b/arch/arm/mach-omap2/board-omap3pandora.c
index 2bba362..85e5685 100644
--- a/arch/arm/mach-omap2/board-omap3pandora.c
+++ b/arch/arm/mach-omap2/board-omap3pandora.c
@@ -23,6 +23,8 @@
 
 #include <linux/spi/spi.h>
 #include <linux/regulator/machine.h>
+#include <linux/regulator/fixed.h>
+#include <linux/usb/phy.h>
 #include <linux/i2c/twl.h>
 #include <linux/wl12xx.h>
 #include <linux/mtd/partitions.h>
@@ -561,23 +563,55 @@ fail:
 	printk(KERN_ERR "wl1251 board initialisation failed\n");
 }
 
+/* PHY device on HS USB Port 2 i.e. nop_usb_xceiv.2 */
+static struct platform_device hsusb2_phy_device = {
+	.name = "nop_usb_xceiv",
+	.id = 2,
+};
+
+/* Regulator for HS USB Port 2 PHY reset */
+static struct regulator_consumer_supply hsusb2_reset_supplies[] = {
+	/* Link PHY device to reset supply so it gets used in the PHY driver */
+	REGULATOR_SUPPLY("reset", "nop_usb_xceiv.2"),
+};
+
+static struct regulator_init_data hsusb2_reset_data = {
+	.constraints = {
+		.valid_ops_mask = REGULATOR_CHANGE_STATUS,
+	},
+	.consumer_supplies = hsusb2_reset_supplies,
+	.num_consumer_supplies = ARRAY_SIZE(hsusb2_reset_supplies),
+};
+
+static struct fixed_voltage_config hsusb2_reset_config = {
+	.supply_name = "hsusb2_reset",
+	.microvolts = 3300000,
+	.gpio = 16,
+	.startup_delay = 70000, /* 70msec */
+	.enable_high = 1,
+	.enabled_at_boot = 0,   /* keep in RESET */
+	.init_data = &hsusb2_reset_data,
+};
+
+static struct platform_device hsusb2_reset_device = {
+	.name = "reg-fixed-voltage",
+	.id = PLATFORM_DEVID_AUTO,
+	.dev = {
+		.platform_data = &hsusb2_reset_config,
+	},
+};
+
 static struct platform_device *omap3pandora_devices[] __initdata = {
 	&pandora_leds_gpio,
 	&pandora_keys_gpio,
 	&pandora_vwlan_device,
 	&pandora_backlight,
+	&hsusb2_phy_device,
+	&hsusb2_reset_device,
 };
 
 static struct usbhs_omap_platform_data usbhs_bdata __initdata = {
-
-	.port_mode[0] = OMAP_USBHS_PORT_MODE_UNUSED,
 	.port_mode[1] = OMAP_EHCI_PORT_MODE_PHY,
-	.port_mode[2] = OMAP_USBHS_PORT_MODE_UNUSED,
-
-	.phy_reset  = true,
-	.reset_gpio_port[0]  = -EINVAL,
-	.reset_gpio_port[1]  = 16,
-	.reset_gpio_port[2]  = -EINVAL
 };
 
 #ifdef CONFIG_OMAP_MUX
@@ -601,6 +635,8 @@ static void __init omap3pandora_init(void)
 	spi_register_board_info(omap3pandora_spi_board_info,
 			ARRAY_SIZE(omap3pandora_spi_board_info));
 	omap_ads7846_init(1, OMAP3_PANDORA_TS_GPIO, 0, NULL);
+	/* PHY on HSUSB Port 2 i.e. index 1 */
+	usb_bind_phy("ehci-omap.0", 1, "nop_usb_xceiv.2");
 	usbhs_init(&usbhs_bdata);
 	usb_bind_phy("musb-hdrc.0.auto", 0, "twl4030_usb");
 	usb_musb_init(NULL);
-- 
1.7.4.1


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

* [PATCH 15/24] ARM: OMAP3: omap3stalker: Adapt to ehci-omap changes
  2013-03-12 11:43 [PATCH 00/24] ARM: OMAP2+: Adapt to ehci-omap changes for 3.10 Roger Quadros
                   ` (13 preceding siblings ...)
  2013-03-12 11:43 ` [PATCH 14/24] ARM: OMAP3: omap3pandora: " Roger Quadros
@ 2013-03-12 11:43 ` Roger Quadros
  2013-03-12 11:43 ` [PATCH 16/24] ARM: OMAP3: omap3touchbook: " Roger Quadros
                   ` (9 subsequent siblings)
  24 siblings, 0 replies; 35+ messages in thread
From: Roger Quadros @ 2013-03-12 11:43 UTC (permalink / raw)
  To: tony
  Cc: balbi, b-cousson, linux-kernel, linux-usb, linux-omap,
	devicetree-discuss, rogerq

Add platform device for 'nop-usb-xceiv'. This will be used as a
PHY for HS USB Port 2, so provide binding information for it.

Model RESET for HS USB Port 2 as GPIO fixed regulator and link
it to the 'nop-usb-xceiv' PHY.

Signed-off-by: Roger Quadros <rogerq@ti.com>
Acked-by: Felipe Balbi <balbi@ti.com>
---
 arch/arm/mach-omap2/board-omap3stalker.c |   52 ++++++++++++++++++++++++++----
 1 files changed, 45 insertions(+), 7 deletions(-)

diff --git a/arch/arm/mach-omap2/board-omap3stalker.c b/arch/arm/mach-omap2/board-omap3stalker.c
index 95c10b3..e38c0bd 100644
--- a/arch/arm/mach-omap2/board-omap3stalker.c
+++ b/arch/arm/mach-omap2/board-omap3stalker.c
@@ -26,6 +26,7 @@
 
 #include <linux/regulator/fixed.h>
 #include <linux/regulator/machine.h>
+#include <linux/usb/phy.h>
 #include <linux/i2c/twl.h>
 #include <linux/mmc/host.h>
 #include <linux/input/matrix_keypad.h>
@@ -358,19 +359,52 @@ static int __init omap3_stalker_i2c_init(void)
 
 #define OMAP3_STALKER_TS_GPIO	175
 
+/* PHY device on HS USB Port 2 i.e. nop_usb_xceiv.2 */
+static struct platform_device hsusb2_phy_device = {
+	.name = "nop_usb_xceiv",
+	.id = 2,
+};
+
+/* Regulator for HS USB Port 2 PHY reset */
+static struct regulator_consumer_supply hsusb2_reset_supplies[] = {
+	/* Link PHY device to reset supply so it gets used in the PHY driver */
+	REGULATOR_SUPPLY("reset", "nop_usb_xceiv.2"),
+};
+
+static struct regulator_init_data hsusb2_reset_data = {
+	.constraints = {
+		.valid_ops_mask = REGULATOR_CHANGE_STATUS,
+	},
+	.consumer_supplies = hsusb2_reset_supplies,
+	.num_consumer_supplies = ARRAY_SIZE(hsusb2_reset_supplies),
+};
+
+static struct fixed_voltage_config hsusb2_reset_config = {
+	.supply_name = "hsusb2_reset",
+	.microvolts = 3300000,
+	.gpio = 21,
+	.startup_delay = 70000, /* 70msec */
+	.enable_high = 1,
+	.enabled_at_boot = 0,   /* keep in RESET */
+	.init_data = &hsusb2_reset_data,
+};
+
+static struct platform_device hsusb2_reset_device = {
+	.name = "reg-fixed-voltage",
+	.id = PLATFORM_DEVID_AUTO,
+	.dev = {
+		.platform_data = &hsusb2_reset_config,
+	},
+};
+
 static struct platform_device *omap3_stalker_devices[] __initdata = {
 	&keys_gpio,
+	&hsusb2_phy_device,
+	&hsusb2_reset_device,
 };
 
 static struct usbhs_omap_platform_data usbhs_bdata __initdata = {
-	.port_mode[0] = OMAP_USBHS_PORT_MODE_UNUSED,
 	.port_mode[1] = OMAP_EHCI_PORT_MODE_PHY,
-	.port_mode[2] = OMAP_USBHS_PORT_MODE_UNUSED,
-
-	.phy_reset = true,
-	.reset_gpio_port[0] = -EINVAL,
-	.reset_gpio_port[1] = 21,
-	.reset_gpio_port[2] = -EINVAL,
 };
 
 #ifdef CONFIG_OMAP_MUX
@@ -407,6 +441,10 @@ static void __init omap3_stalker_init(void)
 	omap_sdrc_init(mt46h32m32lf6_sdrc_params, NULL);
 	usb_bind_phy("musb-hdrc.0.auto", 0, "twl4030_usb");
 	usb_musb_init(NULL);
+
+	/* PHY on HSUSB Port 2 i.e. index 1 */
+	usb_bind_phy("ehci-omap.0", 1, "nop_usb_xceiv.2");
+
 	usbhs_init(&usbhs_bdata);
 	omap_ads7846_init(1, OMAP3_STALKER_TS_GPIO, 310, NULL);
 
-- 
1.7.4.1


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

* [PATCH 16/24] ARM: OMAP3: omap3touchbook: Adapt to ehci-omap changes
  2013-03-12 11:43 [PATCH 00/24] ARM: OMAP2+: Adapt to ehci-omap changes for 3.10 Roger Quadros
                   ` (14 preceding siblings ...)
  2013-03-12 11:43 ` [PATCH 15/24] ARM: OMAP3: omap3stalker: " Roger Quadros
@ 2013-03-12 11:43 ` Roger Quadros
  2013-03-12 11:43 ` [PATCH 17/24] ARM: OMAP3: overo: " Roger Quadros
                   ` (8 subsequent siblings)
  24 siblings, 0 replies; 35+ messages in thread
From: Roger Quadros @ 2013-03-12 11:43 UTC (permalink / raw)
  To: tony
  Cc: balbi, b-cousson, linux-kernel, linux-usb, linux-omap,
	devicetree-discuss, rogerq

Add 2 platform devices for 'nop-usb-xceiv'. These will be used as a
PHY for HS USB Ports 1 and 2, so provide binding information for them.

Model RESET for HS USB Port 2 as GPIO fixed regulator and link it
to the respective 'nop-usb-xceiv' PHY.

Signed-off-by: Roger Quadros <rogerq@ti.com>
Acked-by: Felipe Balbi <balbi@ti.com>
---
 arch/arm/mach-omap2/board-omap3touchbook.c |   62 ++++++++++++++++++++++++---
 1 files changed, 55 insertions(+), 7 deletions(-)

diff --git a/arch/arm/mach-omap2/board-omap3touchbook.c b/arch/arm/mach-omap2/board-omap3touchbook.c
index bcd44fb..6bdde83 100644
--- a/arch/arm/mach-omap2/board-omap3touchbook.c
+++ b/arch/arm/mach-omap2/board-omap3touchbook.c
@@ -36,6 +36,8 @@
 #include <linux/spi/ads7846.h>
 
 #include <linux/regulator/machine.h>
+#include <linux/regulator/fixed.h>
+#include <linux/usb/phy.h>
 #include <linux/i2c/twl.h>
 
 #include <asm/mach-types.h>
@@ -305,21 +307,61 @@ static struct omap_board_mux board_mux[] __initdata = {
 };
 #endif
 
+/* PHY device on HS USB Port 1 i.e. nop_usb_xceiv.1 */
+static struct platform_device hsusb1_phy_device = {
+	.name = "nop_usb_xceiv",
+	.id = 1,
+};
+
+/* PHY device on HS USB Port 2 i.e. nop_usb_xceiv.2 */
+static struct platform_device hsusb2_phy_device = {
+	.name = "nop_usb_xceiv",
+	.id = 2,
+};
+
+/* Regulator for HS USB Port 2 PHY reset */
+static struct regulator_consumer_supply hsusb2_reset_supplies[] = {
+	/* Link PHY device to reset supply so it gets used in the PHY driver */
+	REGULATOR_SUPPLY("reset", "nop_usb_xceiv.2"),
+};
+
+static struct regulator_init_data hsusb2_reset_data = {
+	.constraints = {
+		.valid_ops_mask = REGULATOR_CHANGE_STATUS,
+	},
+	.consumer_supplies = hsusb2_reset_supplies,
+	.num_consumer_supplies = ARRAY_SIZE(hsusb2_reset_supplies),
+};
+
+static struct fixed_voltage_config hsusb2_reset_config = {
+	.supply_name = "hsusb2_reset",
+	.microvolts = 3300000,
+	.gpio = 147,
+	.startup_delay = 70000, /* 70msec */
+	.enable_high = 1,
+	.enabled_at_boot = 0,   /* keep in RESET */
+	.init_data = &hsusb2_reset_data,
+};
+
+static struct platform_device hsusb2_reset_device = {
+	.name = "reg-fixed-voltage",
+	.id = PLATFORM_DEVID_AUTO,
+	.dev = {
+		.platform_data = &hsusb2_reset_config,
+	},
+};
+
 static struct platform_device *omap3_touchbook_devices[] __initdata = {
 	&leds_gpio,
 	&keys_gpio,
+	&hsusb1_phy_device,
+	&hsusb2_phy_device,
+	&hsusb2_reset_device,
 };
 
 static struct usbhs_omap_platform_data usbhs_bdata __initdata = {
-
 	.port_mode[0] = OMAP_EHCI_PORT_MODE_PHY,
 	.port_mode[1] = OMAP_EHCI_PORT_MODE_PHY,
-	.port_mode[2] = OMAP_USBHS_PORT_MODE_UNUSED,
-
-	.phy_reset  = true,
-	.reset_gpio_port[0]  = -EINVAL,
-	.reset_gpio_port[1]  = 147,
-	.reset_gpio_port[2]  = -EINVAL
 };
 
 static void omap3_touchbook_poweroff(void)
@@ -368,6 +410,12 @@ static void __init omap3_touchbook_init(void)
 	omap_ads7846_init(4, OMAP3_TS_GPIO, 310, &ads7846_pdata);
 	usb_bind_phy("musb-hdrc.0.auto", 0, "twl4030_usb");
 	usb_musb_init(NULL);
+
+	/* PHY on HSUSB Port 1 i.e. index 0 */
+	usb_bind_phy("ehci-omap.0", 0, "nop_usb_xceiv.1");
+	/* PHY on HSUSB Port 2 i.e. index 1 */
+	usb_bind_phy("ehci-omap.0", 1, "nop_usb_xceiv.2");
+
 	usbhs_init(&usbhs_bdata);
 	board_nand_init(omap3touchbook_nand_partitions,
 			ARRAY_SIZE(omap3touchbook_nand_partitions), NAND_CS,
-- 
1.7.4.1


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

* [PATCH 17/24] ARM: OMAP3: overo: Adapt to ehci-omap changes
  2013-03-12 11:43 [PATCH 00/24] ARM: OMAP2+: Adapt to ehci-omap changes for 3.10 Roger Quadros
                   ` (15 preceding siblings ...)
  2013-03-12 11:43 ` [PATCH 16/24] ARM: OMAP3: omap3touchbook: " Roger Quadros
@ 2013-03-12 11:43 ` Roger Quadros
  2013-03-12 11:43 ` [PATCH 18/24] ARM: OMAP: zoom: " Roger Quadros
                   ` (7 subsequent siblings)
  24 siblings, 0 replies; 35+ messages in thread
From: Roger Quadros @ 2013-03-12 11:43 UTC (permalink / raw)
  To: tony
  Cc: balbi, b-cousson, linux-kernel, linux-usb, linux-omap,
	devicetree-discuss, rogerq

Add platform device for 'nop-usb-xceiv'. This will be used as a
PHY for HS USB Port 2, so provide binding information for it.

Model RESET for HS USB Port 2 as GPIO fixed regulator and link
it to the 'nop-usb-xceiv' PHY.

Signed-off-by: Roger Quadros <rogerq@ti.com>
Acked-by: Felipe Balbi <balbi@ti.com>
---
 arch/arm/mach-omap2/board-overo.c |   54 ++++++++++++++++++++++++++++++++----
 1 files changed, 48 insertions(+), 6 deletions(-)

diff --git a/arch/arm/mach-omap2/board-overo.c b/arch/arm/mach-omap2/board-overo.c
index 86bab51..5f93ba0 100644
--- a/arch/arm/mach-omap2/board-overo.c
+++ b/arch/arm/mach-omap2/board-overo.c
@@ -31,6 +31,7 @@
 #include <linux/regulator/machine.h>
 #include <linux/regulator/fixed.h>
 #include <linux/spi/spi.h>
+#include <linux/usb/phy.h>
 
 #include <linux/mtd/mtd.h>
 #include <linux/mtd/nand.h>
@@ -458,14 +459,51 @@ static int __init overo_spi_init(void)
 	return 0;
 }
 
+/* PHY device on HS USB Port 2 i.e. nop_usb_xceiv.2 */
+static struct platform_device hsusb2_phy_device = {
+	.name = "nop_usb_xceiv",
+	.id = 2,
+};
+
+/* Regulator for HS USB Port 2 PHY reset */
+static struct regulator_consumer_supply hsusb2_reset_supplies[] = {
+	/* Link PHY device to reset supply so it gets used in the PHY driver */
+	REGULATOR_SUPPLY("reset", "nop_usb_xceiv.2"),
+};
+
+static struct regulator_init_data hsusb2_reset_data = {
+	.constraints = {
+		.valid_ops_mask = REGULATOR_CHANGE_STATUS,
+	},
+	.consumer_supplies = hsusb2_reset_supplies,
+	.num_consumer_supplies = ARRAY_SIZE(hsusb2_reset_supplies),
+};
+
+static struct fixed_voltage_config hsusb2_reset_config = {
+	.supply_name = "hsusb2_reset",
+	.microvolts = 3300000,
+	.gpio = OVERO_GPIO_USBH_NRESET,
+	.startup_delay = 70000, /* 70msec */
+	.enable_high = 1,
+	.enabled_at_boot = 0,   /* keep in RESET */
+	.init_data = &hsusb2_reset_data,
+};
+
+static struct platform_device hsusb2_reset_device = {
+	.name = "reg-fixed-voltage",
+	.id = PLATFORM_DEVID_AUTO,
+	.dev = {
+		.platform_data = &hsusb2_reset_config,
+	},
+};
+
+static struct platform_device *overo_devices[] __initdata = {
+	&hsusb2_phy_device,
+	&hsusb2_reset_device,
+};
+
 static struct usbhs_omap_platform_data usbhs_bdata __initdata = {
-	.port_mode[0] = OMAP_USBHS_PORT_MODE_UNUSED,
 	.port_mode[1] = OMAP_EHCI_PORT_MODE_PHY,
-	.port_mode[2] = OMAP_USBHS_PORT_MODE_UNUSED,
-	.phy_reset  = true,
-	.reset_gpio_port[0]  = -EINVAL,
-	.reset_gpio_port[1]  = OVERO_GPIO_USBH_NRESET,
-	.reset_gpio_port[2]  = -EINVAL
 };
 
 #ifdef CONFIG_OMAP_MUX
@@ -502,6 +540,10 @@ static void __init overo_init(void)
 			ARRAY_SIZE(overo_nand_partitions), NAND_CS, 0, NULL);
 	usb_bind_phy("musb-hdrc.0.auto", 0, "twl4030_usb");
 	usb_musb_init(NULL);
+
+	platform_add_devices(overo_devices, ARRAY_SIZE(overo_devices));
+	/* PHY on HSUSB Port 2 i.e. index 1 */
+	usb_bind_phy("ehci-omap.0", 1, "nop_usb_xceiv.2");
 	usbhs_init(&usbhs_bdata);
 	overo_spi_init();
 	overo_init_smsc911x();
-- 
1.7.4.1


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

* [PATCH 18/24] ARM: OMAP: zoom: Adapt to ehci-omap changes
  2013-03-12 11:43 [PATCH 00/24] ARM: OMAP2+: Adapt to ehci-omap changes for 3.10 Roger Quadros
                   ` (16 preceding siblings ...)
  2013-03-12 11:43 ` [PATCH 17/24] ARM: OMAP3: overo: " Roger Quadros
@ 2013-03-12 11:43 ` Roger Quadros
  2013-03-12 11:43 ` [PATCH 19/24] ARM: dts: OMAP4: Add HS USB Host IP nodes Roger Quadros
                   ` (6 subsequent siblings)
  24 siblings, 0 replies; 35+ messages in thread
From: Roger Quadros @ 2013-03-12 11:43 UTC (permalink / raw)
  To: tony
  Cc: balbi, b-cousson, linux-kernel, linux-usb, linux-omap,
	devicetree-discuss, rogerq

Add platform device for 'nop-usb-xceiv'. This will be used as a
PHY for HS USB Port 2, so provide binding information for it.

Model RESET for HS USB Port 2 as GPIO fixed regulator and link
it to the 'nop-usb-xceiv' PHY.

Signed-off-by: Roger Quadros <rogerq@ti.com>
Acked-by: Felipe Balbi <balbi@ti.com>
---
 arch/arm/mach-omap2/board-zoom.c |   56 +++++++++++++++++++++++++++++++++----
 1 files changed, 50 insertions(+), 6 deletions(-)

diff --git a/arch/arm/mach-omap2/board-zoom.c b/arch/arm/mach-omap2/board-zoom.c
index 5e4d4c9..5c5deaa 100644
--- a/arch/arm/mach-omap2/board-zoom.c
+++ b/arch/arm/mach-omap2/board-zoom.c
@@ -17,6 +17,9 @@
 #include <linux/gpio.h>
 #include <linux/i2c/twl.h>
 #include <linux/mtd/nand.h>
+#include <linux/regulator/machine.h>
+#include <linux/regulator/fixed.h>
+#include <linux/usb/phy.h>
 
 #include <asm/mach-types.h>
 #include <asm/mach/arch.h>
@@ -92,14 +95,51 @@ static struct mtd_partition zoom_nand_partitions[] = {
 	},
 };
 
+/* PHY device on HS USB Port 2 i.e. nop_usb_xceiv.2 */
+static struct platform_device hsusb2_phy_device = {
+	.name = "nop_usb_xceiv",
+	.id = 2,
+};
+
+/* Regulator for HS USB Port 2 PHY reset */
+static struct regulator_consumer_supply hsusb2_reset_supplies[] = {
+	/* Link PHY device to reset supply so it gets used in the PHY driver */
+	REGULATOR_SUPPLY("reset", "nop_usb_xceiv.2"),
+};
+
+static struct regulator_init_data hsusb2_reset_data = {
+	.constraints = {
+		.valid_ops_mask = REGULATOR_CHANGE_STATUS,
+	},
+	.consumer_supplies = hsusb2_reset_supplies,
+	.num_consumer_supplies = ARRAY_SIZE(hsusb2_reset_supplies),
+};
+
+static struct fixed_voltage_config hsusb2_reset_config = {
+	.supply_name = "hsusb2_reset",
+	.microvolts = 3300000,
+	.gpio = ZOOM3_EHCI_RESET_GPIO,
+	.startup_delay = 70000, /* 70msec */
+	.enable_high = 1,
+	.enabled_at_boot = 0,   /* keep in RESET */
+	.init_data = &hsusb2_reset_data,
+};
+
+static struct platform_device hsusb2_reset_device = {
+	.name = "reg-fixed-voltage",
+	.id = PLATFORM_DEVID_AUTO,
+	.dev = {
+		.platform_data = &hsusb2_reset_config,
+	},
+};
+
+static struct platform_device *zoom3_devices[] __initdata = {
+	&hsusb2_phy_device,
+	&hsusb2_reset_device,
+};
+
 static struct usbhs_omap_platform_data usbhs_bdata __initdata = {
-	.port_mode[0]		= OMAP_USBHS_PORT_MODE_UNUSED,
 	.port_mode[1]		= OMAP_EHCI_PORT_MODE_PHY,
-	.port_mode[2]		= OMAP_USBHS_PORT_MODE_UNUSED,
-	.phy_reset		= true,
-	.reset_gpio_port[0]	= -EINVAL,
-	.reset_gpio_port[1]	= ZOOM3_EHCI_RESET_GPIO,
-	.reset_gpio_port[2]	= -EINVAL,
 };
 
 static void __init omap_zoom_init(void)
@@ -109,6 +149,10 @@ static void __init omap_zoom_init(void)
 	} else if (machine_is_omap_zoom3()) {
 		omap3_mux_init(board_mux, OMAP_PACKAGE_CBP);
 		omap_mux_init_gpio(ZOOM3_EHCI_RESET_GPIO, OMAP_PIN_OUTPUT);
+
+		platform_add_devices(zoom3_devices, ARRAY_SIZE(zoom3_devices));
+		/* PHY on HSUSB Port 2 i.e. index 1 */
+		usb_bind_phy("ehci-omap.0", 1, "nop_usb_xceiv.2");
 		usbhs_init(&usbhs_bdata);
 	}
 
-- 
1.7.4.1


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

* [PATCH 19/24] ARM: dts: OMAP4: Add HS USB Host IP nodes
  2013-03-12 11:43 [PATCH 00/24] ARM: OMAP2+: Adapt to ehci-omap changes for 3.10 Roger Quadros
                   ` (17 preceding siblings ...)
  2013-03-12 11:43 ` [PATCH 18/24] ARM: OMAP: zoom: " Roger Quadros
@ 2013-03-12 11:43 ` Roger Quadros
  2013-03-12 11:43 ` [PATCH 20/24] ARM: dts: omap4-panda: Add USB Host support Roger Quadros
                   ` (5 subsequent siblings)
  24 siblings, 0 replies; 35+ messages in thread
From: Roger Quadros @ 2013-03-12 11:43 UTC (permalink / raw)
  To: tony
  Cc: balbi, b-cousson, linux-kernel, linux-usb, linux-omap,
	devicetree-discuss, rogerq

Adds device nodes for HS USB Host module, TLL module,
OHCI and EHCI controllers.

Signed-off-by: Roger Quadros <rogerq@ti.com>
---
 arch/arm/boot/dts/omap4.dtsi |   30 ++++++++++++++++++++++++++++++
 1 files changed, 30 insertions(+), 0 deletions(-)

diff --git a/arch/arm/boot/dts/omap4.dtsi b/arch/arm/boot/dts/omap4.dtsi
index 739bb79..b7db1a2 100644
--- a/arch/arm/boot/dts/omap4.dtsi
+++ b/arch/arm/boot/dts/omap4.dtsi
@@ -529,5 +529,35 @@
 			ti,hwmods = "timer11";
 			ti,timer-pwm;
 		};
+
+		usbhstll: usbhstll@4a062000 {
+			compatible = "ti,usbhs-tll";
+			reg = <0x4a062000 0x1000>;
+			interrupts = <0 78 0x4>;
+			ti,hwmods = "usb_tll_hs";
+		};
+
+		usbhshost: usbhshost@4a064000 {
+			compatible = "ti,usbhs-host";
+			reg = <0x4a064000 0x800>;
+			ti,hwmods = "usb_host_hs";
+			#address-cells = <1>;
+			#size-cells = <1>;
+			ranges;
+
+			usbhsohci: ohci@4a064800 {
+				compatible = "ti,ohci-omap3", "usb-ohci";
+				reg = <0x4a064800 0x400>;
+				interrupt-parent = <&gic>;
+				interrupts = <0 76 0x4>;
+			};
+
+			usbhsehci: ehci@4a064c00 {
+				compatible = "ti,ehci-omap", "usb-ehci";
+				reg = <0x4a064c00 0x400>;
+				interrupt-parent = <&gic>;
+				interrupts = <0 77 0x4>;
+			};
+		};
 	};
 };
-- 
1.7.4.1


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

* [PATCH 20/24] ARM: dts: omap4-panda: Add USB Host support
  2013-03-12 11:43 [PATCH 00/24] ARM: OMAP2+: Adapt to ehci-omap changes for 3.10 Roger Quadros
                   ` (18 preceding siblings ...)
  2013-03-12 11:43 ` [PATCH 19/24] ARM: dts: OMAP4: Add HS USB Host IP nodes Roger Quadros
@ 2013-03-12 11:43 ` Roger Quadros
  2013-03-12 11:43 ` [PATCH 21/24] ARM: dts: OMAP3: Add HS USB Host IP nodes Roger Quadros
                   ` (4 subsequent siblings)
  24 siblings, 0 replies; 35+ messages in thread
From: Roger Quadros @ 2013-03-12 11:43 UTC (permalink / raw)
  To: tony
  Cc: balbi, b-cousson, linux-kernel, linux-usb, linux-omap,
	devicetree-discuss, rogerq

Provide the RESET and Power regulators for the USB PHY,
the USB Host port mode and the PHY device.

Also provide pin multiplexer information for the USB host
pins.

Signed-off-by: Roger Quadros <rogerq@ti.com>
---
 arch/arm/boot/dts/omap4-panda.dts |   56 +++++++++++++++++++++++++++++++++++++
 1 files changed, 56 insertions(+), 0 deletions(-)

diff --git a/arch/arm/boot/dts/omap4-panda.dts b/arch/arm/boot/dts/omap4-panda.dts
index 4122efe..cfc7683 100644
--- a/arch/arm/boot/dts/omap4-panda.dts
+++ b/arch/arm/boot/dts/omap4-panda.dts
@@ -57,6 +57,36 @@
 			"AFML", "Line In",
 			"AFMR", "Line In";
 	};
+
+	/* HS USB Port 1 RESET */
+	hsusb1_reset: hsusb1_reset_reg {
+		compatible = "regulator-fixed";
+		regulator-name = "hsusb1_reset";
+		regulator-min-microvolt = <3300000>;
+		regulator-max-microvolt = <3300000>;
+		gpio = <&gpio2 30 0>;	/* gpio_62 */
+		startup-delay-us = <70000>;
+		enable-active-high;
+	};
+
+	/* HS USB Port 1 Power */
+	hsusb1_power: hsusb1_power_reg {
+		compatible = "regulator-fixed";
+		regulator-name = "hsusb1_vbus";
+		regulator-min-microvolt = <3300000>;
+		regulator-max-microvolt = <3300000>;
+		gpio = <&gpio1 1 0>;	/* gpio_1 */
+		startup-delay-us = <70000>;
+		enable-active-high;
+	};
+
+	/* HS USB Host PHY on PORT 1 */
+	hsusb1_phy: hsusb1_phy {
+		compatible = "usb-nop-xceiv";
+		reset-supply = <&hsusb1_reset>;
+		vcc-supply = <&hsusb1_power>;
+		clock-frequency = <19200000>;
+	};
 };
 
 &omap4_pmx_core {
@@ -67,6 +97,7 @@
 			&mcbsp1_pins
 			&dss_hdmi_pins
 			&tpd12s015_pins
+			&hsusbb1_pins
 	>;
 
 	twl6040_pins: pinmux_twl6040_pins {
@@ -110,6 +141,23 @@
 			0x58 0x10b	/* hdmi_hpd.gpio_63 INPUT PULLDOWN | MODE3 */
 		>;
 	};
+
+	hsusbb1_pins: pinmux_hsusbb1_pins {
+		pinctrl-single,pins = <
+			0x82 0x10C	/* USBB1_ULPITLL_CLK_MUXMODE.usbb1_ulpiphy_clk INPUT | PULLDOWN */
+			0x84 0x4	/* USBB1_ULPITLL_CLK_MUXMODE.usbb1_ulpiphy_stp OUTPUT */
+			0x86 0x104	/* USBB1_ULPITLL_CLK_MUXMODE.usbb1_ulpiphy_dir INPUT | PULLDOWN */
+			0x88 0x104	/* USBB1_ULPITLL_CLK_MUXMODE.usbb1_ulpiphy_nxt INPUT | PULLDOWN */
+			0x8a 0x104	/* USBB1_ULPITLL_CLK_MUXMODE.usbb1_ulpiphy_dat0 INPUT | PULLDOWN */
+			0x8c 0x104	/* USBB1_ULPITLL_CLK_MUXMODE.usbb1_ulpiphy_dat1 INPUT | PULLDOWN */
+			0x8e 0x104	/* USBB1_ULPITLL_CLK_MUXMODE.usbb1_ulpiphy_dat2 INPUT | PULLDOWN */
+			0x90 0x104	/* USBB1_ULPITLL_CLK_MUXMODE.usbb1_ulpiphy_dat3 INPUT | PULLDOWN */
+			0x92 0x104	/* USBB1_ULPITLL_CLK_MUXMODE.usbb1_ulpiphy_dat4 INPUT | PULLDOWN */
+			0x94 0x104	/* USBB1_ULPITLL_CLK_MUXMODE.usbb1_ulpiphy_dat5 INPUT | PULLDOWN */
+			0x96 0x104	/* USBB1_ULPITLL_CLK_MUXMODE.usbb1_ulpiphy_dat6 INPUT | PULLDOWN */
+			0x98 0x104	/* USBB1_ULPITLL_CLK_MUXMODE.usbb1_ulpiphy_dat7 INPUT | PULLDOWN */
+		>;
+	    };
 };
 
 &i2c1 {
@@ -206,3 +254,11 @@
 &twl_usb_comparator {
 	usb-supply = <&vusb>;
 };
+
+&usbhshost {
+	port1-mode = "ehci-phy";
+};
+
+&usbhsehci {
+	phys = <&hsusb1_phy>;
+};
-- 
1.7.4.1


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

* [PATCH 21/24] ARM: dts: OMAP3: Add HS USB Host IP nodes
  2013-03-12 11:43 [PATCH 00/24] ARM: OMAP2+: Adapt to ehci-omap changes for 3.10 Roger Quadros
                   ` (19 preceding siblings ...)
  2013-03-12 11:43 ` [PATCH 20/24] ARM: dts: omap4-panda: Add USB Host support Roger Quadros
@ 2013-03-12 11:43 ` Roger Quadros
  2013-03-12 11:43 ` [PATCH 22/24] ARM: dts: omap3-beagle: Add USB Host support Roger Quadros
                   ` (3 subsequent siblings)
  24 siblings, 0 replies; 35+ messages in thread
From: Roger Quadros @ 2013-03-12 11:43 UTC (permalink / raw)
  To: tony
  Cc: balbi, b-cousson, linux-kernel, linux-usb, linux-omap,
	devicetree-discuss, rogerq

Adds device nodes for HS USB Host module, TLL module,
OHCI and EHCI controllers.

Signed-off-by: Roger Quadros <rogerq@ti.com>
---
 arch/arm/boot/dts/omap3.dtsi |   31 +++++++++++++++++++++++++++++++
 1 files changed, 31 insertions(+), 0 deletions(-)

diff --git a/arch/arm/boot/dts/omap3.dtsi b/arch/arm/boot/dts/omap3.dtsi
index 1acc261..a14f74b 100644
--- a/arch/arm/boot/dts/omap3.dtsi
+++ b/arch/arm/boot/dts/omap3.dtsi
@@ -397,5 +397,36 @@
 			ti,timer-alwon;
 			ti,timer-secure;
 		};
+
+		usbhstll: usbhstll@48062000 {
+			compatible = "ti,usbhs-tll";
+			reg = <0x48062000 0x1000>;
+			interrupts = <78>;
+			ti,hwmods = "usb_tll_hs";
+		};
+
+		usbhshost: usbhshost@48064000 {
+			compatible = "ti,usbhs-host";
+			reg = <0x48064000 0x400>;
+			ti,hwmods = "usb_host_hs";
+			#address-cells = <1>;
+			#size-cells = <1>;
+			ranges;
+
+			usbhsohci: ohci@48064400 {
+				compatible = "ti,ohci-omap3", "usb-ohci";
+				reg = <0x48064400 0x400>;
+				interrupt-parent = <&intc>;
+				interrupts = <76>;
+			};
+
+			usbhsehci: ehci@48064800 {
+				compatible = "ti,ehci-omap", "usb-ehci";
+				reg = <0x48064800 0x400>;
+				interrupt-parent = <&intc>;
+				interrupts = <77>;
+			};
+		};
+
 	};
 };
-- 
1.7.4.1


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

* [PATCH 22/24] ARM: dts: omap3-beagle: Add USB Host support
  2013-03-12 11:43 [PATCH 00/24] ARM: OMAP2+: Adapt to ehci-omap changes for 3.10 Roger Quadros
                   ` (20 preceding siblings ...)
  2013-03-12 11:43 ` [PATCH 21/24] ARM: dts: OMAP3: Add HS USB Host IP nodes Roger Quadros
@ 2013-03-12 11:43 ` Roger Quadros
  2013-03-12 11:43 ` [PATCH 23/24] ARM: OMAP2+: Allow clock alias provision from device tree Roger Quadros
                   ` (2 subsequent siblings)
  24 siblings, 0 replies; 35+ messages in thread
From: Roger Quadros @ 2013-03-12 11:43 UTC (permalink / raw)
  To: tony
  Cc: balbi, b-cousson, linux-kernel, linux-usb, linux-omap,
	devicetree-discuss, rogerq

Provide RESET and Power regulators for the USB PHY,
the USB Host port mode and the PHY device.

Also provide pin multiplexer information for USB host
pins.

Signed-off-by: Roger Quadros <rogerq@ti.com>
---
 arch/arm/boot/dts/omap3-beagle.dts |   71 ++++++++++++++++++++++++++++++++++++
 1 files changed, 71 insertions(+), 0 deletions(-)

diff --git a/arch/arm/boot/dts/omap3-beagle.dts b/arch/arm/boot/dts/omap3-beagle.dts
index f624dc8..02d23f1 100644
--- a/arch/arm/boot/dts/omap3-beagle.dts
+++ b/arch/arm/boot/dts/omap3-beagle.dts
@@ -38,6 +38,57 @@
 		};
 	};
 
+	/* HS USB Port 2 RESET */
+	hsusb2_reset: hsusb2_reset_reg {
+		compatible = "regulator-fixed";
+		regulator-name = "hsusb2_reset";
+		regulator-min-microvolt = <3300000>;
+		regulator-max-microvolt = <3300000>;
+		gpio = <&gpio5 19 0>;	/* gpio_147 */
+		startup-delay-us = <70000>;
+		enable-active-high;
+	};
+
+	/* HS USB Port 2 Power */
+	hsusb2_power: hsusb2_power_reg {
+		compatible = "regulator-fixed";
+		regulator-name = "hsusb2_vbus";
+		regulator-min-microvolt = <3300000>;
+		regulator-max-microvolt = <3300000>;
+		gpio = <&twl_gpio 18 0>;	/* GPIO LEDA */
+		startup-delay-us = <70000>;
+	};
+
+	/* HS USB Host PHY on PORT 2 */
+	hsusb2_phy: hsusb2_phy {
+		compatible = "usb-nop-xceiv";
+		reset-supply = <&hsusb2_reset>;
+		vcc-supply = <&hsusb2_power>;
+	};
+};
+
+&omap3_pmx_core {
+	pinctrl-names = "default";
+	pinctrl-0 = <
+			&hsusbb2_pins
+	>;
+
+	hsusbb2_pins: pinmux_hsusbb2_pins {
+		pinctrl-single,pins = <
+			0x5c0 0x3  /* USBB2_ULPITLL_CLK_MUXMODE.usbb1_ulpiphy_clk OUTPUT */
+			0x5c2 0x3  /* USBB2_ULPITLL_CLK_MUXMODE.usbb1_ulpiphy_stp OUTPUT */
+			0x5c4 0x10b  /* USBB2_ULPITLL_CLK_MUXMODE.usbb1_ulpiphy_dir INPUT | PULLDOWN */
+			0x5c6 0x10b  /* USBB2_ULPITLL_CLK_MUXMODE.usbb1_ulpiphy_nxt INPUT | PULLDOWN */
+			0x5c8 0x10b  /* USBB2_ULPITLL_CLK_MUXMODE.usbb1_ulpiphy_dat0 INPUT | PULLDOWN */
+			0x5cA 0x10b  /* USBB2_ULPITLL_CLK_MUXMODE.usbb1_ulpiphy_dat1 INPUT | PULLDOWN */
+			0x1a4 0x10b  /* USBB2_ULPITLL_CLK_MUXMODE.usbb1_ulpiphy_dat2 INPUT | PULLDOWN */
+			0x1a6 0x10b  /* USBB2_ULPITLL_CLK_MUXMODE.usbb1_ulpiphy_dat3 INPUT | PULLDOWN */
+			0x1a8 0x10b  /* USBB2_ULPITLL_CLK_MUXMODE.usbb1_ulpiphy_dat4 INPUT | PULLDOWN */
+			0x1aa 0x10b  /* USBB2_ULPITLL_CLK_MUXMODE.usbb1_ulpiphy_dat5 INPUT | PULLDOWN */
+			0x1ac 0x10b  /* USBB2_ULPITLL_CLK_MUXMODE.usbb1_ulpiphy_dat6 INPUT | PULLDOWN */
+			0x1ae 0x10b  /* USBB2_ULPITLL_CLK_MUXMODE.usbb1_ulpiphy_dat7 INPUT | PULLDOWN */
+		>;
+	};
 };
 
 &i2c1 {
@@ -65,3 +116,23 @@
 &mmc3 {
 	status = "disabled";
 };
+
+&usbhshost {
+	port2-mode = "ehci-phy";
+};
+
+&usbhsehci {
+	phys = <0 &hsusb2_phy>;
+};
+
+&twl_gpio {
+	ti,use-leds;
+	/* pullups: BIT(1) */
+	ti,pullups = <0x000002>;
+	/*
+	 * pulldowns:
+	 * BIT(2), BIT(6), BIT(7), BIT(8), BIT(13)
+	 * BIT(15), BIT(16), BIT(17)
+	 */
+	ti,pulldowns = <0x03a1c4>;
+};
-- 
1.7.4.1


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

* [PATCH 23/24] ARM: OMAP2+: Allow clock alias provision from device tree
  2013-03-12 11:43 [PATCH 00/24] ARM: OMAP2+: Adapt to ehci-omap changes for 3.10 Roger Quadros
                   ` (21 preceding siblings ...)
  2013-03-12 11:43 ` [PATCH 22/24] ARM: dts: omap3-beagle: Add USB Host support Roger Quadros
@ 2013-03-12 11:43 ` Roger Quadros
  2013-03-12 13:17   ` Benoit Cousson
  2013-03-12 11:43 ` [PATCH 24/24] ARM: dts: omap4-panda: Add clock alias for USB PHY Roger Quadros
  2013-03-12 16:40 ` [PATCH 00/24] ARM: OMAP2+: Adapt to ehci-omap changes for 3.10 Tony Lindgren
  24 siblings, 1 reply; 35+ messages in thread
From: Roger Quadros @ 2013-03-12 11:43 UTC (permalink / raw)
  To: tony
  Cc: balbi, b-cousson, linux-kernel, linux-usb, linux-omap,
	devicetree-discuss, rogerq, Russell King, Rajendra Nayak,
	Santosh Shilimkar

Currently on OMAP, it is not possible to specify a clock consumer
to any of the OMAP generated clocks using the device tree. This can pose
a problem for external devices that run off an OMAP clock as we
can't reliably provide a reference to the clock in the device tree.

This patch allows device trees to provide a node that contains the
clock identifier, clock alias and the device phandle. The board
initialization code then creates a clock alias to this clock id,
and associates it with the device whose phandle was supplied.

Discussion
http://www.spinics.net/lists/linux-omap/msg86241.html

CC: Russell King <linux@arm.linux.org.uk>
CC: Rajendra Nayak <rnayak@ti.com>
CC: Santosh Shilimkar <santosh.shilimkar@ti.com>

Signed-off-by: Roger Quadros <rogerq@ti.com>
---
 .../devicetree/bindings/clock/ti-clock-alias.txt   |   26 ++++++++
 arch/arm/mach-omap2/board-generic.c                |   67 ++++++++++++++++++++
 2 files changed, 93 insertions(+), 0 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/clock/ti-clock-alias.txt

diff --git a/Documentation/devicetree/bindings/clock/ti-clock-alias.txt b/Documentation/devicetree/bindings/clock/ti-clock-alias.txt
new file mode 100644
index 0000000..87ef4c3
--- /dev/null
+++ b/Documentation/devicetree/bindings/clock/ti-clock-alias.txt
@@ -0,0 +1,26 @@
+* Clock alias provision for TI OMAP2+ boards
+
+This binding allows the board's device tree file to specify a clock name,
+device phandle and clock alias so that that clock can be associated
+to the device with the alias.
+
+This is required in cases where an external device is clocked by an
+OMAP generated clock and needs to be assocated to it.
+
+NOTE: The node's name should be clock_alias
+
+Required properties
+- clock-name: The clock identifier string. Should be one of the
+  clock ids defined in OMAP common clock data.
+- clock-alias: A string specifying the alias that must be created to the clock.
+- device: A phandle to the device this clock should be associated to.
+
+e.g. On the OMAP4 Panda board, the USB PHY device is clocked by the
+FREF_CLK3 (auxclk3_ck) from the OMAP. The PHY driver expexts the clock to
+be named "main_clk". This binding can be provided like so
+
+clock_alias {
+	clock-name = "auxclk3_ck";
+	clock-alias = "main_clk";
+	device = <&hsusb1_phy>;
+};
diff --git a/arch/arm/mach-omap2/board-generic.c b/arch/arm/mach-omap2/board-generic.c
index 0274ff7..2fc48f9 100644
--- a/arch/arm/mach-omap2/board-generic.c
+++ b/arch/arm/mach-omap2/board-generic.c
@@ -15,6 +15,9 @@
 #include <linux/of_irq.h>
 #include <linux/of_platform.h>
 #include <linux/irqdomain.h>
+#include <linux/clk.h>
+#include <linux/string.h>
+#include <linux/slab.h>
 
 #include <asm/mach/arch.h>
 
@@ -35,12 +38,76 @@ static struct of_device_id omap_dt_match_table[] __initdata = {
 	{ }
 };
 
+static int __init omap_create_clk_alias(struct device_node *np)
+{
+	int ret = 0;
+	const char *s, *alias;
+	char *clk_id;
+	struct device_node *dev_np;
+	struct platform_device *pdev;
+
+	of_property_read_string(np, "clock-name", &s);
+	if (!s) {
+		pr_err("%s: couldn't find clock-name property in node %s\n",
+				__func__, np->name);
+		return -ENODEV;
+	}
+
+	clk_id = kstrdup(s, GFP_KERNEL);
+	if (!clk_id)
+		return -ENOMEM;
+
+	dev_np = of_parse_phandle(np, "device", 0);
+	if (!dev_np) {
+		pr_err("%s: couldn't find device phandle for \'%s\'\n",
+				__func__, clk_id);
+		ret = -ENODEV;
+		goto exit;
+	}
+
+	pdev = of_find_device_by_node(dev_np);
+	if (!pdev) {
+		pr_err("%s: couldn't find device for clock \'%s\'\n",
+				__func__, clk_id);
+		ret = -ENODEV;
+		goto exit;
+	}
+
+	ret = of_property_read_string(np, "clock-alias", &alias);
+	if (ret) {
+		pr_err("%s: couldn't find alias for clock \'%s\'\n",
+				__func__, clk_id);
+		ret = -ENODEV;
+		goto exit;
+	}
+
+	ret = clk_add_alias(alias, dev_name(&pdev->dev), clk_id, NULL);
+	if (ret) {
+		pr_err("%s: couldn't add alias \'%s\' to clock \'%s\'\n",
+				__func__, alias, clk_id);
+		ret = -ENODEV;
+		goto exit;
+	}
+
+exit:
+	kfree(clk_id);
+	return ret;
+}
+
 static void __init omap_generic_init(void)
 {
+	struct device_node *np;
+
 	omap_sdrc_init(NULL, NULL);
 
 	of_platform_populate(NULL, omap_dt_match_table, NULL, NULL);
 
+	/* create clock aliases based on 'clock_alias' nodes */
+	for_each_node_by_name(np, "clock_alias") {
+		omap_create_clk_alias(np);
+		of_node_put(np);
+	}
+
 	/*
 	 * HACK: call display setup code for selected boards to enable omapdss.
 	 * This will be removed when omapdss supports DT.
-- 
1.7.4.1


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

* [PATCH 24/24] ARM: dts: omap4-panda: Add clock alias for USB PHY
  2013-03-12 11:43 [PATCH 00/24] ARM: OMAP2+: Adapt to ehci-omap changes for 3.10 Roger Quadros
                   ` (22 preceding siblings ...)
  2013-03-12 11:43 ` [PATCH 23/24] ARM: OMAP2+: Allow clock alias provision from device tree Roger Quadros
@ 2013-03-12 11:43 ` Roger Quadros
  2013-03-12 16:40 ` [PATCH 00/24] ARM: OMAP2+: Adapt to ehci-omap changes for 3.10 Tony Lindgren
  24 siblings, 0 replies; 35+ messages in thread
From: Roger Quadros @ 2013-03-12 11:43 UTC (permalink / raw)
  To: tony
  Cc: balbi, b-cousson, linux-kernel, linux-usb, linux-omap,
	devicetree-discuss, rogerq, Russell King, Rajendra Nayak,
	Santosh Shilimkar

On Panda, the USB Host PHY is clocked by FREF3_CLK (auxclk3_ck) pin
of the OMAP. Provide this information in the device tree.

CC: Russell King <linux@arm.linux.org.uk>
CC: Rajendra Nayak <rnayak@ti.com>
CC: Santosh Shilimkar <santosh.shilimkar@ti.com>

Signed-off-by: Roger Quadros <rogerq@ti.com>
---
 arch/arm/boot/dts/omap4-panda.dts |    7 +++++++
 1 files changed, 7 insertions(+), 0 deletions(-)

diff --git a/arch/arm/boot/dts/omap4-panda.dts b/arch/arm/boot/dts/omap4-panda.dts
index cfc7683..0ba4458 100644
--- a/arch/arm/boot/dts/omap4-panda.dts
+++ b/arch/arm/boot/dts/omap4-panda.dts
@@ -87,6 +87,13 @@
 		vcc-supply = <&hsusb1_power>;
 		clock-frequency = <19200000>;
 	};
+
+	/* hsusb1_phy is clocked by FREF_CLK3 i.e. auxclk3 */
+	clock_alias {
+		clock-name = "auxclk3_ck";
+		clock-alias = "main_clk";
+		device = <&hsusb1_phy>;
+	};
 };
 
 &omap4_pmx_core {
-- 
1.7.4.1


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

* Re: [PATCH 23/24] ARM: OMAP2+: Allow clock alias provision from device tree
  2013-03-12 11:43 ` [PATCH 23/24] ARM: OMAP2+: Allow clock alias provision from device tree Roger Quadros
@ 2013-03-12 13:17   ` Benoit Cousson
  2013-03-12 14:01     ` Roger Quadros
  0 siblings, 1 reply; 35+ messages in thread
From: Benoit Cousson @ 2013-03-12 13:17 UTC (permalink / raw)
  To: Roger Quadros
  Cc: tony, balbi, linux-kernel, linux-usb, linux-omap,
	devicetree-discuss, Russell King, Rajendra Nayak,
	Santosh Shilimkar

Hi Roger,

On 03/12/2013 12:43 PM, Roger Quadros wrote:
> Currently on OMAP, it is not possible to specify a clock consumer
> to any of the OMAP generated clocks using the device tree. This can pose
> a problem for external devices that run off an OMAP clock as we
> can't reliably provide a reference to the clock in the device tree.

I'm really confused by that statement... Why cannot you use the current
clock binding definition?

The point is that we should avoid defining temporary custom bindings.
Especially when a generic one already exist.

I know you already discussed that on the list, but I cannot really find
the rational in the previous thread.

Here is a quote from the original "Subject: Re: how to specify an OMAP
clock in device tree?" thread.

> /* provider */
> clks: omapclocks {
>         compatible = "ti,omapclocks";
>         #clock-cells = <1>;
> };
> 
> /* consumer */
> hsusb1_phy: hsusb1_phy {
> 	compatible = "usb-nop-xceiv";
> 	clocks = <&clks "auxclk3_ck">;	/* FREF_CLK3 */
> 	clock-names = "main-clk";
> };
> 
> The only problem I see is that the argument to the clks phandle
> cannot be a string. It needs to be u32.
> 
> In that case we need to map all clocks into a u32 index.
> 
> If we can do that only for auxclks, my problem is solved for panda.

phandle is u32 as always, but you should not care about that.
What you care about is the clock node referenced by the phandle, not the
phandle itself.

What is missing right now is a proper of_clk_add_provider call to
declare a generic OMAP clock provider and thus allow OMAP clocks to be
used with DT.

The AUXCLOCKs are managed by the SCRM which is outside the PRCM, so you
should be able to add a clock providers dedicated to the SCRM clocks only.


Regards,
Benoit


> This patch allows device trees to provide a node that contains the
> clock identifier, clock alias and the device phandle. The board
> initialization code then creates a clock alias to this clock id,
> and associates it with the device whose phandle was supplied.
> 
> Discussion
> http://www.spinics.net/lists/linux-omap/msg86241.html
> 
> CC: Russell King <linux@arm.linux.org.uk>
> CC: Rajendra Nayak <rnayak@ti.com>
> CC: Santosh Shilimkar <santosh.shilimkar@ti.com>
> 
> Signed-off-by: Roger Quadros <rogerq@ti.com>
> ---
>  .../devicetree/bindings/clock/ti-clock-alias.txt   |   26 ++++++++
>  arch/arm/mach-omap2/board-generic.c                |   67 ++++++++++++++++++++
>  2 files changed, 93 insertions(+), 0 deletions(-)
>  create mode 100644 Documentation/devicetree/bindings/clock/ti-clock-alias.txt
> 
> diff --git a/Documentation/devicetree/bindings/clock/ti-clock-alias.txt b/Documentation/devicetree/bindings/clock/ti-clock-alias.txt
> new file mode 100644
> index 0000000..87ef4c3
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/clock/ti-clock-alias.txt
> @@ -0,0 +1,26 @@
> +* Clock alias provision for TI OMAP2+ boards
> +
> +This binding allows the board's device tree file to specify a clock name,
> +device phandle and clock alias so that that clock can be associated
> +to the device with the alias.
> +
> +This is required in cases where an external device is clocked by an
> +OMAP generated clock and needs to be assocated to it.
> +
> +NOTE: The node's name should be clock_alias
> +
> +Required properties
> +- clock-name: The clock identifier string. Should be one of the
> +  clock ids defined in OMAP common clock data.
> +- clock-alias: A string specifying the alias that must be created to the clock.
> +- device: A phandle to the device this clock should be associated to.
> +
> +e.g. On the OMAP4 Panda board, the USB PHY device is clocked by the
> +FREF_CLK3 (auxclk3_ck) from the OMAP. The PHY driver expexts the clock to
> +be named "main_clk". This binding can be provided like so
> +
> +clock_alias {
> +	clock-name = "auxclk3_ck";
> +	clock-alias = "main_clk";
> +	device = <&hsusb1_phy>;
> +};
> diff --git a/arch/arm/mach-omap2/board-generic.c b/arch/arm/mach-omap2/board-generic.c
> index 0274ff7..2fc48f9 100644
> --- a/arch/arm/mach-omap2/board-generic.c
> +++ b/arch/arm/mach-omap2/board-generic.c
> @@ -15,6 +15,9 @@
>  #include <linux/of_irq.h>
>  #include <linux/of_platform.h>
>  #include <linux/irqdomain.h>
> +#include <linux/clk.h>
> +#include <linux/string.h>
> +#include <linux/slab.h>
>  
>  #include <asm/mach/arch.h>
>  
> @@ -35,12 +38,76 @@ static struct of_device_id omap_dt_match_table[] __initdata = {
>  	{ }
>  };
>  
> +static int __init omap_create_clk_alias(struct device_node *np)
> +{
> +	int ret = 0;
> +	const char *s, *alias;
> +	char *clk_id;
> +	struct device_node *dev_np;
> +	struct platform_device *pdev;
> +
> +	of_property_read_string(np, "clock-name", &s);
> +	if (!s) {
> +		pr_err("%s: couldn't find clock-name property in node %s\n",
> +				__func__, np->name);
> +		return -ENODEV;
> +	}
> +
> +	clk_id = kstrdup(s, GFP_KERNEL);
> +	if (!clk_id)
> +		return -ENOMEM;
> +
> +	dev_np = of_parse_phandle(np, "device", 0);
> +	if (!dev_np) {
> +		pr_err("%s: couldn't find device phandle for \'%s\'\n",
> +				__func__, clk_id);
> +		ret = -ENODEV;
> +		goto exit;
> +	}
> +
> +	pdev = of_find_device_by_node(dev_np);
> +	if (!pdev) {
> +		pr_err("%s: couldn't find device for clock \'%s\'\n",
> +				__func__, clk_id);
> +		ret = -ENODEV;
> +		goto exit;
> +	}
> +
> +	ret = of_property_read_string(np, "clock-alias", &alias);
> +	if (ret) {
> +		pr_err("%s: couldn't find alias for clock \'%s\'\n",
> +				__func__, clk_id);
> +		ret = -ENODEV;
> +		goto exit;
> +	}
> +
> +	ret = clk_add_alias(alias, dev_name(&pdev->dev), clk_id, NULL);
> +	if (ret) {
> +		pr_err("%s: couldn't add alias \'%s\' to clock \'%s\'\n",
> +				__func__, alias, clk_id);
> +		ret = -ENODEV;
> +		goto exit;
> +	}
> +
> +exit:
> +	kfree(clk_id);
> +	return ret;
> +}
> +
>  static void __init omap_generic_init(void)
>  {
> +	struct device_node *np;
> +
>  	omap_sdrc_init(NULL, NULL);
>  
>  	of_platform_populate(NULL, omap_dt_match_table, NULL, NULL);
>  
> +	/* create clock aliases based on 'clock_alias' nodes */
> +	for_each_node_by_name(np, "clock_alias") {
> +		omap_create_clk_alias(np);
> +		of_node_put(np);
> +	}
> +
>  	/*
>  	 * HACK: call display setup code for selected boards to enable omapdss.
>  	 * This will be removed when omapdss supports DT.
> 


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

* Re: [PATCH 23/24] ARM: OMAP2+: Allow clock alias provision from device tree
  2013-03-12 13:17   ` Benoit Cousson
@ 2013-03-12 14:01     ` Roger Quadros
  0 siblings, 0 replies; 35+ messages in thread
From: Roger Quadros @ 2013-03-12 14:01 UTC (permalink / raw)
  To: Benoit Cousson, tony
  Cc: balbi, linux-kernel, linux-usb, linux-omap, devicetree-discuss,
	Russell King, Rajendra Nayak, Santosh Shilimkar

Hi Benoit,

On 03/12/2013 03:17 PM, Benoit Cousson wrote:
> Hi Roger,
> 
> On 03/12/2013 12:43 PM, Roger Quadros wrote:
>> Currently on OMAP, it is not possible to specify a clock consumer
>> to any of the OMAP generated clocks using the device tree. This can pose
>> a problem for external devices that run off an OMAP clock as we
>> can't reliably provide a reference to the clock in the device tree.
> 
> I'm really confused by that statement... Why cannot you use the current
> clock binding definition?
> 
> The point is that we should avoid defining temporary custom bindings.
> Especially when a generic one already exist.
> 
> I know you already discussed that on the list, but I cannot really find
> the rational in the previous thread.
> 
> Here is a quote from the original "Subject: Re: how to specify an OMAP
> clock in device tree?" thread.
> 
>> /* provider */
>> clks: omapclocks {
>>         compatible = "ti,omapclocks";
>>         #clock-cells = <1>;
>> };
>>
>> /* consumer */
>> hsusb1_phy: hsusb1_phy {
>> 	compatible = "usb-nop-xceiv";
>> 	clocks = <&clks "auxclk3_ck">;	/* FREF_CLK3 */
>> 	clock-names = "main-clk";
>> };
>>
>> The only problem I see is that the argument to the clks phandle
>> cannot be a string. It needs to be u32.
>>
>> In that case we need to map all clocks into a u32 index.
>>
>> If we can do that only for auxclks, my problem is solved for panda.
> 
> phandle is u32 as always, but you should not care about that.
> What you care about is the clock node referenced by the phandle, not the
> phandle itself.
> 
> What is missing right now is a proper of_clk_add_provider call to
> declare a generic OMAP clock provider and thus allow OMAP clocks to be
> used with DT.
> 
> The AUXCLOCKs are managed by the SCRM which is outside the PRCM, so you
> should be able to add a clock providers dedicated to the SCRM clocks only.

Okay, I will convert at least the SCRM clocks to be provided by device tree.

Tony,

Please drop this patch and patch 24. The rest should be fine.
Just that Panda EHCI won't work till we have the PHY clock correctly
provided.

cheers,
-roger

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

* Re: [PATCH 00/24] ARM: OMAP2+: Adapt to ehci-omap changes for 3.10
  2013-03-12 11:43 [PATCH 00/24] ARM: OMAP2+: Adapt to ehci-omap changes for 3.10 Roger Quadros
                   ` (23 preceding siblings ...)
  2013-03-12 11:43 ` [PATCH 24/24] ARM: dts: omap4-panda: Add clock alias for USB PHY Roger Quadros
@ 2013-03-12 16:40 ` Tony Lindgren
  2013-03-13 13:41   ` Roger Quadros
  24 siblings, 1 reply; 35+ messages in thread
From: Tony Lindgren @ 2013-03-12 16:40 UTC (permalink / raw)
  To: Roger Quadros
  Cc: balbi, b-cousson, linux-kernel, linux-usb, linux-omap,
	devicetree-discuss

* Roger Quadros <rogerq@ti.com> [130312 04:47]:
> Hi Tony,
> 
> These patches provide the SoC side code required to support
> the changes in the OMAP USB Host drivers done in [1], [2] & [3].
... 

>  arch/arm/mach-omap2/board-3430sdp.c                |   97 +++++++++++++++-
>  arch/arm/mach-omap2/board-3630sdp.c                |  100 +++++++++++++++-
>  arch/arm/mach-omap2/board-am3517crane.c            |   95 +++++++++++++--
>  arch/arm/mach-omap2/board-am3517evm.c              |   66 ++++++++++-
>  arch/arm/mach-omap2/board-cm-t35.c                 |   95 ++++++++++++++-
>  arch/arm/mach-omap2/board-cm-t3517.c               |   97 +++++++++++++++-
>  arch/arm/mach-omap2/board-devkit8000.c             |   20 ++--
>  arch/arm/mach-omap2/board-generic.c                |   67 +++++++++++
>  arch/arm/mach-omap2/board-igep0020.c               |  112 ++++++++++++++++---
>  arch/arm/mach-omap2/board-omap3beagle.c            |   93 +++++++++++++--
>  arch/arm/mach-omap2/board-omap3evm.c               |   62 ++++++++--
>  arch/arm/mach-omap2/board-omap3pandora.c           |   52 +++++++--
>  arch/arm/mach-omap2/board-omap3stalker.c           |   52 +++++++-
>  arch/arm/mach-omap2/board-omap3touchbook.c         |   62 +++++++++-
>  arch/arm/mach-omap2/board-omap4panda.c             |  122 ++++++++++++++------
>  arch/arm/mach-omap2/board-overo.c                  |   54 ++++++++-
>  arch/arm/mach-omap2/board-zoom.c                   |   56 ++++++++-

Can't you have some mach-omap2/ehci-common.c that takes care
of the initializiation to avoid this much addition to the
board-*.c files? You may be able to have just a common function
to do it and pass few parameters?

Regards,

Tony

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

* Re: [PATCH 00/24] ARM: OMAP2+: Adapt to ehci-omap changes for 3.10
  2013-03-12 16:40 ` [PATCH 00/24] ARM: OMAP2+: Adapt to ehci-omap changes for 3.10 Tony Lindgren
@ 2013-03-13 13:41   ` Roger Quadros
  2013-03-13 16:24     ` Tony Lindgren
  0 siblings, 1 reply; 35+ messages in thread
From: Roger Quadros @ 2013-03-13 13:41 UTC (permalink / raw)
  To: Tony Lindgren
  Cc: balbi, b-cousson, linux-kernel, linux-usb, linux-omap,
	devicetree-discuss

On 03/12/2013 06:40 PM, Tony Lindgren wrote:
> * Roger Quadros <rogerq@ti.com> [130312 04:47]:
>> Hi Tony,
>>
>> These patches provide the SoC side code required to support
>> the changes in the OMAP USB Host drivers done in [1], [2] & [3].
> ... 
> 
>>  arch/arm/mach-omap2/board-3430sdp.c                |   97 +++++++++++++++-
>>  arch/arm/mach-omap2/board-3630sdp.c                |  100 +++++++++++++++-
>>  arch/arm/mach-omap2/board-am3517crane.c            |   95 +++++++++++++--
>>  arch/arm/mach-omap2/board-am3517evm.c              |   66 ++++++++++-
>>  arch/arm/mach-omap2/board-cm-t35.c                 |   95 ++++++++++++++-
>>  arch/arm/mach-omap2/board-cm-t3517.c               |   97 +++++++++++++++-
>>  arch/arm/mach-omap2/board-devkit8000.c             |   20 ++--
>>  arch/arm/mach-omap2/board-generic.c                |   67 +++++++++++
>>  arch/arm/mach-omap2/board-igep0020.c               |  112 ++++++++++++++++---
>>  arch/arm/mach-omap2/board-omap3beagle.c            |   93 +++++++++++++--
>>  arch/arm/mach-omap2/board-omap3evm.c               |   62 ++++++++--
>>  arch/arm/mach-omap2/board-omap3pandora.c           |   52 +++++++--
>>  arch/arm/mach-omap2/board-omap3stalker.c           |   52 +++++++-
>>  arch/arm/mach-omap2/board-omap3touchbook.c         |   62 +++++++++-
>>  arch/arm/mach-omap2/board-omap4panda.c             |  122 ++++++++++++++------
>>  arch/arm/mach-omap2/board-overo.c                  |   54 ++++++++-
>>  arch/arm/mach-omap2/board-zoom.c                   |   56 ++++++++-
> 
> Can't you have some mach-omap2/ehci-common.c that takes care
> of the initializiation to avoid this much addition to the
> board-*.c files? You may be able to have just a common function
> to do it and pass few parameters?

Since we moved reset and power handling for the USB PHYs from omap-echi
driver into the USB PHY driver we need to define the regulator data
for RESET and Power line of each PHY. So most of the code added is just
regulator data for the PHY rather than omap-ehci.

Instead of a common function, I can implement some macros that make it
easier to define the regulators for the PHY in the board files.
Does this sound OK?

Personally I don't like such macros because it hides the implementation
and is difficult to read/debug.

cheers,
-roger

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

* Re: [PATCH 00/24] ARM: OMAP2+: Adapt to ehci-omap changes for 3.10
  2013-03-13 13:41   ` Roger Quadros
@ 2013-03-13 16:24     ` Tony Lindgren
  2013-03-13 16:36       ` Roger Quadros
  0 siblings, 1 reply; 35+ messages in thread
From: Tony Lindgren @ 2013-03-13 16:24 UTC (permalink / raw)
  To: Roger Quadros
  Cc: balbi, b-cousson, linux-kernel, linux-usb, linux-omap,
	devicetree-discuss

* Roger Quadros <rogerq@ti.com> [130313 06:46]:
> On 03/12/2013 06:40 PM, Tony Lindgren wrote:
> > * Roger Quadros <rogerq@ti.com> [130312 04:47]:
> >> Hi Tony,
> >>
> >> These patches provide the SoC side code required to support
> >> the changes in the OMAP USB Host drivers done in [1], [2] & [3].
> > ... 
> > 
> >>  arch/arm/mach-omap2/board-3430sdp.c                |   97 +++++++++++++++-
> >>  arch/arm/mach-omap2/board-3630sdp.c                |  100 +++++++++++++++-
> >>  arch/arm/mach-omap2/board-am3517crane.c            |   95 +++++++++++++--
> >>  arch/arm/mach-omap2/board-am3517evm.c              |   66 ++++++++++-
> >>  arch/arm/mach-omap2/board-cm-t35.c                 |   95 ++++++++++++++-
> >>  arch/arm/mach-omap2/board-cm-t3517.c               |   97 +++++++++++++++-
> >>  arch/arm/mach-omap2/board-devkit8000.c             |   20 ++--
> >>  arch/arm/mach-omap2/board-generic.c                |   67 +++++++++++
> >>  arch/arm/mach-omap2/board-igep0020.c               |  112 ++++++++++++++++---
> >>  arch/arm/mach-omap2/board-omap3beagle.c            |   93 +++++++++++++--
> >>  arch/arm/mach-omap2/board-omap3evm.c               |   62 ++++++++--
> >>  arch/arm/mach-omap2/board-omap3pandora.c           |   52 +++++++--
> >>  arch/arm/mach-omap2/board-omap3stalker.c           |   52 +++++++-
> >>  arch/arm/mach-omap2/board-omap3touchbook.c         |   62 +++++++++-
> >>  arch/arm/mach-omap2/board-omap4panda.c             |  122 ++++++++++++++------
> >>  arch/arm/mach-omap2/board-overo.c                  |   54 ++++++++-
> >>  arch/arm/mach-omap2/board-zoom.c                   |   56 ++++++++-
> > 
> > Can't you have some mach-omap2/ehci-common.c that takes care
> > of the initializiation to avoid this much addition to the
> > board-*.c files? You may be able to have just a common function
> > to do it and pass few parameters?
> 
> Since we moved reset and power handling for the USB PHYs from omap-echi
> driver into the USB PHY driver we need to define the regulator data
> for RESET and Power line of each PHY. So most of the code added is just
> regulator data for the PHY rather than omap-ehci.

It seems that you're now repeating minor variations of the same PHY
over and over again though.
 
> Instead of a common function, I can implement some macros that make it
> easier to define the regulators for the PHY in the board files.
> Does this sound OK?
> 
> Personally I don't like such macros because it hides the implementation
> and is difficult to read/debug.

I'd prefer a common function to initialize the PHY though as it sounds
like using macros would just allocate similar PHY many times which seems
unnecessary.

Regards,

Tony

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

* Re: [PATCH 00/24] ARM: OMAP2+: Adapt to ehci-omap changes for 3.10
  2013-03-13 16:24     ` Tony Lindgren
@ 2013-03-13 16:36       ` Roger Quadros
  2013-03-13 16:57         ` Tony Lindgren
  0 siblings, 1 reply; 35+ messages in thread
From: Roger Quadros @ 2013-03-13 16:36 UTC (permalink / raw)
  To: Tony Lindgren
  Cc: balbi, b-cousson, linux-kernel, linux-usb, linux-omap,
	devicetree-discuss

On 03/13/2013 06:24 PM, Tony Lindgren wrote:
> * Roger Quadros <rogerq@ti.com> [130313 06:46]:
>> On 03/12/2013 06:40 PM, Tony Lindgren wrote:
>>> * Roger Quadros <rogerq@ti.com> [130312 04:47]:
>>>> Hi Tony,
>>>>
>>>> These patches provide the SoC side code required to support
>>>> the changes in the OMAP USB Host drivers done in [1], [2] & [3].
>>> ... 
>>>
>>>>  arch/arm/mach-omap2/board-3430sdp.c                |   97 +++++++++++++++-
>>>>  arch/arm/mach-omap2/board-3630sdp.c                |  100 +++++++++++++++-
>>>>  arch/arm/mach-omap2/board-am3517crane.c            |   95 +++++++++++++--
>>>>  arch/arm/mach-omap2/board-am3517evm.c              |   66 ++++++++++-
>>>>  arch/arm/mach-omap2/board-cm-t35.c                 |   95 ++++++++++++++-
>>>>  arch/arm/mach-omap2/board-cm-t3517.c               |   97 +++++++++++++++-
>>>>  arch/arm/mach-omap2/board-devkit8000.c             |   20 ++--
>>>>  arch/arm/mach-omap2/board-generic.c                |   67 +++++++++++
>>>>  arch/arm/mach-omap2/board-igep0020.c               |  112 ++++++++++++++++---
>>>>  arch/arm/mach-omap2/board-omap3beagle.c            |   93 +++++++++++++--
>>>>  arch/arm/mach-omap2/board-omap3evm.c               |   62 ++++++++--
>>>>  arch/arm/mach-omap2/board-omap3pandora.c           |   52 +++++++--
>>>>  arch/arm/mach-omap2/board-omap3stalker.c           |   52 +++++++-
>>>>  arch/arm/mach-omap2/board-omap3touchbook.c         |   62 +++++++++-
>>>>  arch/arm/mach-omap2/board-omap4panda.c             |  122 ++++++++++++++------
>>>>  arch/arm/mach-omap2/board-overo.c                  |   54 ++++++++-
>>>>  arch/arm/mach-omap2/board-zoom.c                   |   56 ++++++++-
>>>
>>> Can't you have some mach-omap2/ehci-common.c that takes care
>>> of the initializiation to avoid this much addition to the
>>> board-*.c files? You may be able to have just a common function
>>> to do it and pass few parameters?
>>
>> Since we moved reset and power handling for the USB PHYs from omap-echi
>> driver into the USB PHY driver we need to define the regulator data
>> for RESET and Power line of each PHY. So most of the code added is just
>> regulator data for the PHY rather than omap-ehci.
> 
> It seems that you're now repeating minor variations of the same PHY
> over and over again though.

Yes it is the vcc and reset regulator data for the PHY that
is getting repeated with variations in the GPIO number.

>  
>> Instead of a common function, I can implement some macros that make it
>> easier to define the regulators for the PHY in the board files.
>> Does this sound OK?
>>
>> Personally I don't like such macros because it hides the implementation
>> and is difficult to read/debug.
> 
> I'd prefer a common function to initialize the PHY though as it sounds
> like using macros would just allocate similar PHY many times which seems
> unnecessary.
> 
OK, so we want to create the regulator data at runtime to save some memory?
I'll come up with something.

cheers,
-roger

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

* Re: [PATCH 00/24] ARM: OMAP2+: Adapt to ehci-omap changes for 3.10
  2013-03-13 16:36       ` Roger Quadros
@ 2013-03-13 16:57         ` Tony Lindgren
  2013-03-14 15:41           ` Roger Quadros
  0 siblings, 1 reply; 35+ messages in thread
From: Tony Lindgren @ 2013-03-13 16:57 UTC (permalink / raw)
  To: Roger Quadros
  Cc: balbi, b-cousson, linux-kernel, linux-usb, linux-omap,
	devicetree-discuss

* Roger Quadros <rogerq@ti.com> [130313 09:40]:
> On 03/13/2013 06:24 PM, Tony Lindgren wrote:
> > * Roger Quadros <rogerq@ti.com> [130313 06:46]:
> >> On 03/12/2013 06:40 PM, Tony Lindgren wrote:
> >>> * Roger Quadros <rogerq@ti.com> [130312 04:47]:
> >>>> Hi Tony,
> >>>>
> >>>> These patches provide the SoC side code required to support
> >>>> the changes in the OMAP USB Host drivers done in [1], [2] & [3].
> >>> ... 
> >>>
> >>>>  arch/arm/mach-omap2/board-3430sdp.c                |   97 +++++++++++++++-
> >>>>  arch/arm/mach-omap2/board-3630sdp.c                |  100 +++++++++++++++-
> >>>>  arch/arm/mach-omap2/board-am3517crane.c            |   95 +++++++++++++--
> >>>>  arch/arm/mach-omap2/board-am3517evm.c              |   66 ++++++++++-
> >>>>  arch/arm/mach-omap2/board-cm-t35.c                 |   95 ++++++++++++++-
> >>>>  arch/arm/mach-omap2/board-cm-t3517.c               |   97 +++++++++++++++-
> >>>>  arch/arm/mach-omap2/board-devkit8000.c             |   20 ++--
> >>>>  arch/arm/mach-omap2/board-generic.c                |   67 +++++++++++
> >>>>  arch/arm/mach-omap2/board-igep0020.c               |  112 ++++++++++++++++---
> >>>>  arch/arm/mach-omap2/board-omap3beagle.c            |   93 +++++++++++++--
> >>>>  arch/arm/mach-omap2/board-omap3evm.c               |   62 ++++++++--
> >>>>  arch/arm/mach-omap2/board-omap3pandora.c           |   52 +++++++--
> >>>>  arch/arm/mach-omap2/board-omap3stalker.c           |   52 +++++++-
> >>>>  arch/arm/mach-omap2/board-omap3touchbook.c         |   62 +++++++++-
> >>>>  arch/arm/mach-omap2/board-omap4panda.c             |  122 ++++++++++++++------
> >>>>  arch/arm/mach-omap2/board-overo.c                  |   54 ++++++++-
> >>>>  arch/arm/mach-omap2/board-zoom.c                   |   56 ++++++++-
> >>>
> >>> Can't you have some mach-omap2/ehci-common.c that takes care
> >>> of the initializiation to avoid this much addition to the
> >>> board-*.c files? You may be able to have just a common function
> >>> to do it and pass few parameters?
> >>
> >> Since we moved reset and power handling for the USB PHYs from omap-echi
> >> driver into the USB PHY driver we need to define the regulator data
> >> for RESET and Power line of each PHY. So most of the code added is just
> >> regulator data for the PHY rather than omap-ehci.
> > 
> > It seems that you're now repeating minor variations of the same PHY
> > over and over again though.
> 
> Yes it is the vcc and reset regulator data for the PHY that
> is getting repeated with variations in the GPIO number.
> 
> >  
> >> Instead of a common function, I can implement some macros that make it
> >> easier to define the regulators for the PHY in the board files.
> >> Does this sound OK?
> >>
> >> Personally I don't like such macros because it hides the implementation
> >> and is difficult to read/debug.
> > 
> > I'd prefer a common function to initialize the PHY though as it sounds
> > like using macros would just allocate similar PHY many times which seems
> > unnecessary.
> > 
> OK, so we want to create the regulator data at runtime to save some memory?
> I'll come up with something.

Or I guess you can have just one instance that gets filled in by some PHY
platform init function.

Regards,

Tony

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

* Re: [PATCH 00/24] ARM: OMAP2+: Adapt to ehci-omap changes for 3.10
  2013-03-13 16:57         ` Tony Lindgren
@ 2013-03-14 15:41           ` Roger Quadros
  2013-03-14 16:54             ` Tony Lindgren
  0 siblings, 1 reply; 35+ messages in thread
From: Roger Quadros @ 2013-03-14 15:41 UTC (permalink / raw)
  To: Tony Lindgren
  Cc: balbi, b-cousson, linux-kernel, linux-usb, linux-omap,
	devicetree-discuss

On 03/13/2013 06:57 PM, Tony Lindgren wrote:
> * Roger Quadros <rogerq@ti.com> [130313 09:40]:
>> On 03/13/2013 06:24 PM, Tony Lindgren wrote:
>>> * Roger Quadros <rogerq@ti.com> [130313 06:46]:
>>>> On 03/12/2013 06:40 PM, Tony Lindgren wrote:
>>>>> * Roger Quadros <rogerq@ti.com> [130312 04:47]:
>>>>>> Hi Tony,
>>>>>>
>>>>>> These patches provide the SoC side code required to support
>>>>>> the changes in the OMAP USB Host drivers done in [1], [2] & [3].
>>>>> ... 
>>>>>
>>>>>>  arch/arm/mach-omap2/board-3430sdp.c                |   97 +++++++++++++++-
>>>>>>  arch/arm/mach-omap2/board-3630sdp.c                |  100 +++++++++++++++-
>>>>>>  arch/arm/mach-omap2/board-am3517crane.c            |   95 +++++++++++++--
>>>>>>  arch/arm/mach-omap2/board-am3517evm.c              |   66 ++++++++++-
>>>>>>  arch/arm/mach-omap2/board-cm-t35.c                 |   95 ++++++++++++++-
>>>>>>  arch/arm/mach-omap2/board-cm-t3517.c               |   97 +++++++++++++++-
>>>>>>  arch/arm/mach-omap2/board-devkit8000.c             |   20 ++--
>>>>>>  arch/arm/mach-omap2/board-generic.c                |   67 +++++++++++
>>>>>>  arch/arm/mach-omap2/board-igep0020.c               |  112 ++++++++++++++++---
>>>>>>  arch/arm/mach-omap2/board-omap3beagle.c            |   93 +++++++++++++--
>>>>>>  arch/arm/mach-omap2/board-omap3evm.c               |   62 ++++++++--
>>>>>>  arch/arm/mach-omap2/board-omap3pandora.c           |   52 +++++++--
>>>>>>  arch/arm/mach-omap2/board-omap3stalker.c           |   52 +++++++-
>>>>>>  arch/arm/mach-omap2/board-omap3touchbook.c         |   62 +++++++++-
>>>>>>  arch/arm/mach-omap2/board-omap4panda.c             |  122 ++++++++++++++------
>>>>>>  arch/arm/mach-omap2/board-overo.c                  |   54 ++++++++-
>>>>>>  arch/arm/mach-omap2/board-zoom.c                   |   56 ++++++++-
>>>>>
>>>>> Can't you have some mach-omap2/ehci-common.c that takes care
>>>>> of the initializiation to avoid this much addition to the
>>>>> board-*.c files? You may be able to have just a common function
>>>>> to do it and pass few parameters?
>>>>
>>>> Since we moved reset and power handling for the USB PHYs from omap-echi
>>>> driver into the USB PHY driver we need to define the regulator data
>>>> for RESET and Power line of each PHY. So most of the code added is just
>>>> regulator data for the PHY rather than omap-ehci.
>>>
>>> It seems that you're now repeating minor variations of the same PHY
>>> over and over again though.
>>
>> Yes it is the vcc and reset regulator data for the PHY that
>> is getting repeated with variations in the GPIO number.
>>
>>>  
>>>> Instead of a common function, I can implement some macros that make it
>>>> easier to define the regulators for the PHY in the board files.
>>>> Does this sound OK?
>>>>
>>>> Personally I don't like such macros because it hides the implementation
>>>> and is difficult to read/debug.
>>>
>>> I'd prefer a common function to initialize the PHY though as it sounds
>>> like using macros would just allocate similar PHY many times which seems
>>> unnecessary.
>>>
>> OK, so we want to create the regulator data at runtime to save some memory?
>> I'll come up with something.
> 
> Or I guess you can have just one instance that gets filled in by some PHY
> platform init function.
> 

OK. Let me know how the below patch looks. After that, the board code
will look like.

static struct usbhs_phy_data phy_data[] = {
	{
		.reset_gpio = 147,
		.vcc_gpio = 148
		.vcc_polarity = 1,
		.phy_id = "nop_usb_xceiv.2",
	},
	{}, /* Terminator */
};

usbhs_init_phys(phy_data);

Patch to implement usbhs_init_phys();

diff --git a/arch/arm/mach-omap2/usb-host.c b/arch/arm/mach-omap2/usb-host.c
index 5706bdc..b9d6bff 100644
--- a/arch/arm/mach-omap2/usb-host.c
+++ b/arch/arm/mach-omap2/usb-host.c
@@ -22,8 +22,12 @@
 #include <linux/platform_device.h>
 #include <linux/slab.h>
 #include <linux/dma-mapping.h>
+#include <linux/regulator/machine.h>
+#include <linux/regulator/fixed.h>
+#include <linux/string.h>
 
 #include <asm/io.h>
+#include <asm/gpio.h>
 
 #include "soc.h"
 #include "omap_device.h"
@@ -472,6 +476,141 @@ void __init setup_4430ohci_io_mux(const enum usbhs_omap_port_mode *port_mode)
 	}
 }
 
+static const char *reset_supply = "reset";
+static const char *vcc_supply = "vcc";
+
+/* Template for PHY regulators */
+static struct regulator_consumer_supply hsusb_reg_supplies[] = {
+	{ /* .supply & .dev_name filled later */ },
+};
+
+static struct regulator_init_data hsusb_reg_data = {
+	.constraints = {
+		.valid_ops_mask = REGULATOR_CHANGE_STATUS,
+	},
+	.consumer_supplies	= hsusb_reg_supplies,
+	.num_consumer_supplies	= ARRAY_SIZE(hsusb_reg_supplies),
+};
+
+static struct fixed_voltage_config hsusb_reg_config = {
+	/* .supply_name filled later */
+	.microvolts = 3300000,
+	.gpio = -1,		/* updated later */
+	.startup_delay = 70000, /* 70msec */
+	.enable_high = 1,	/* updated later */
+	.enabled_at_boot = 0,	/* keep in RESET */
+	/* .init_data filled later */
+};
+
+static struct platform_device_info hsusb_reg_pdev_info = {
+	.name	= "reg-fixed-voltage",
+	.id	= PLATFORM_DEVID_AUTO,
+};
+
+int __init usbhs_init_phys(struct usbhs_phy_data *phy)
+{
+	struct regulator_consumer_supply *supplies;
+	struct regulator_init_data *reg_data;
+	struct fixed_voltage_config *config;
+	char *supply_name;
+	int i;
+
+
+	for (i = 1; i <= OMAP3_HS_USB_PORTS; i++) {
+
+		if (!phy->phy_id)	/* Terminator ? */
+			break;
+
+		if (!gpio_is_valid(phy->reset_gpio))
+			goto check_vcc;
+
+		supplies = kmemdup(hsusb_reg_supplies,
+			    ARRAY_SIZE(hsusb_reg_supplies) *
+			    sizeof(struct regulator_consumer_supply),
+			    GFP_KERNEL);
+		if (!supplies)
+			return -ENOMEM;
+
+		supplies->supply = reset_supply;
+		supplies->dev_name = phy->phy_id;
+
+		reg_data = kmemdup(&hsusb_reg_data, sizeof(hsusb_reg_data),
+							GFP_KERNEL);
+		if (!reg_data)
+			return -ENOMEM;
+
+		reg_data->consumer_supplies = supplies;
+
+		config = kmemdup(&hsusb_reg_config, sizeof(hsusb_reg_config),
+							GFP_KERNEL);
+		if (!config)
+			return -ENOMEM;
+
+		supply_name = kmalloc(14, GFP_KERNEL);
+		if (!supply_name)
+			return -ENOMEM;
+
+		scnprintf(supply_name, 13, "hsusb%d_reset", i);
+		config->supply_name = supply_name;
+		config->gpio = phy->reset_gpio;
+		config->init_data = reg_data;
+
+		hsusb_reg_pdev_info.data = config;
+		hsusb_reg_pdev_info.size_data = sizeof(hsusb_reg_config);
+		platform_device_register_full(&hsusb_reg_pdev_info);
+
+check_vcc:
+		if (!gpio_is_valid(phy->vcc_gpio))
+			goto next;
+
+		supplies = kmemdup(hsusb_reg_supplies,
+			    ARRAY_SIZE(hsusb_reg_supplies) *
+			    sizeof(struct regulator_consumer_supply),
+			    GFP_KERNEL);
+		if (!supplies)
+			return -ENOMEM;
+
+		supplies->supply = vcc_supply;
+		supplies->dev_name = phy->phy_id;
+
+		reg_data = kmemdup(&hsusb_reg_data, sizeof(hsusb_reg_data),
+							GFP_KERNEL);
+		if (!reg_data)
+			return -ENOMEM;
+
+		reg_data->consumer_supplies = supplies;
+
+		config = kmemdup(&hsusb_reg_config, sizeof(hsusb_reg_config),
+							GFP_KERNEL);
+		if (!config)
+			return -ENOMEM;
+
+		supply_name = kmalloc(14, GFP_KERNEL);
+		if (!supply_name)
+			return -ENOMEM;
+
+		scnprintf(supply_name, 13, "hsusb%d_vcc", i);
+		config->supply_name = supply_name;
+		config->gpio = phy->vcc_gpio;
+		config->enable_high = phy->vcc_polarity;
+		config->init_data = reg_data;
+
+		hsusb_reg_pdev_info.data = config;
+		hsusb_reg_pdev_info.size_data = sizeof(hsusb_reg_config);
+		platform_device_register_full(&hsusb_reg_pdev_info);
+
+next:
+		phy++;
+	}
+
+	return 0;
+}
+
 void __init usbhs_init(struct usbhs_omap_platform_data *pdata)
 {
 	struct omap_hwmod	*uhh_hwm, *tll_hwm;
diff --git a/arch/arm/mach-omap2/usb.h b/arch/arm/mach-omap2/usb.h
index 3319f5c..70a8c63 100644
--- a/arch/arm/mach-omap2/usb.h
+++ b/arch/arm/mach-omap2/usb.h
@@ -53,8 +53,16 @@
 #define USBPHY_OTGSESSEND_EN	(1 << 20)
 #define USBPHY_DATA_POLARITY	(1 << 23)
 
+struct usbhs_phy_data {
+	int reset_gpio;
+	int vcc_gpio;
+	bool vcc_polarity;	/* 1 active high, 0 active low */
+	char *phy_id;
+};
+
 extern void usb_musb_init(struct omap_musb_board_data *board_data);
 extern void usbhs_init(struct usbhs_omap_platform_data *pdata);
+extern int usbhs_init_phys(struct usbhs_phy_data *phy);
 
 extern void am35x_musb_reset(void);
 extern void am35x_musb_phy_power(u8 on);

--
cheers,
-roger

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

* Re: [PATCH 00/24] ARM: OMAP2+: Adapt to ehci-omap changes for 3.10
  2013-03-14 15:41           ` Roger Quadros
@ 2013-03-14 16:54             ` Tony Lindgren
  2013-03-15  9:22               ` Roger Quadros
  0 siblings, 1 reply; 35+ messages in thread
From: Tony Lindgren @ 2013-03-14 16:54 UTC (permalink / raw)
  To: Roger Quadros
  Cc: balbi, b-cousson, linux-kernel, linux-usb, linux-omap,
	devicetree-discuss

* Roger Quadros <rogerq@ti.com> [130314 08:45]:
> 
> OK. Let me know how the below patch looks. After that, the board code
> will look like.
> 
> static struct usbhs_phy_data phy_data[] = {
> 	{
> 		.reset_gpio = 147,
> 		.vcc_gpio = 148
> 		.vcc_polarity = 1,
> 		.phy_id = "nop_usb_xceiv.2",
> 	},
> 	{}, /* Terminator */
> };
> 
> usbhs_init_phys(phy_data);

Great, looks good to me.
 
> Patch to implement usbhs_init_phys();
> 
> diff --git a/arch/arm/mach-omap2/usb-host.c b/arch/arm/mach-omap2/usb-host.c
> index 5706bdc..b9d6bff 100644
> --- a/arch/arm/mach-omap2/usb-host.c
> +++ b/arch/arm/mach-omap2/usb-host.c
> @@ -22,8 +22,12 @@
>  #include <linux/platform_device.h>
>  #include <linux/slab.h>
>  #include <linux/dma-mapping.h>
> +#include <linux/regulator/machine.h>
> +#include <linux/regulator/fixed.h>
> +#include <linux/string.h>
>  
>  #include <asm/io.h>
> +#include <asm/gpio.h>

Please change these both to linux/io.h and linux/gpio.h.
  
>  #include "soc.h"
>  #include "omap_device.h"
> @@ -472,6 +476,141 @@ void __init setup_4430ohci_io_mux(const enum usbhs_omap_port_mode *port_mode)
>  	}
>  }
>  
> +static const char *reset_supply = "reset";
> +static const char *vcc_supply = "vcc";
> +
> +/* Template for PHY regulators */
> +static struct regulator_consumer_supply hsusb_reg_supplies[] = {
> +	{ /* .supply & .dev_name filled later */ },
> +};
> +
> +static struct regulator_init_data hsusb_reg_data = {
> +	.constraints = {
> +		.valid_ops_mask = REGULATOR_CHANGE_STATUS,
> +	},
> +	.consumer_supplies	= hsusb_reg_supplies,
> +	.num_consumer_supplies	= ARRAY_SIZE(hsusb_reg_supplies),
> +};
> +
> +static struct fixed_voltage_config hsusb_reg_config = {
> +	/* .supply_name filled later */
> +	.microvolts = 3300000,
> +	.gpio = -1,		/* updated later */
> +	.startup_delay = 70000, /* 70msec */
> +	.enable_high = 1,	/* updated later */
> +	.enabled_at_boot = 0,	/* keep in RESET */
> +	/* .init_data filled later */
> +};
> +
> +static struct platform_device_info hsusb_reg_pdev_info = {
> +	.name	= "reg-fixed-voltage",
> +	.id	= PLATFORM_DEVID_AUTO,
> +};
> +
> +int __init usbhs_init_phys(struct usbhs_phy_data *phy)
> +{
> +	struct regulator_consumer_supply *supplies;
> +	struct regulator_init_data *reg_data;
> +	struct fixed_voltage_config *config;
> +	char *supply_name;
> +	int i;
> +
> +
> +	for (i = 1; i <= OMAP3_HS_USB_PORTS; i++) {

Maybe pass the number of ports to initialize too to the
function? Might be more future proof, although it will only
be needed until we have converted to DT.

> +
> +		if (!phy->phy_id)	/* Terminator ? */
> +			break;
> +
> +		if (!gpio_is_valid(phy->reset_gpio))
> +			goto check_vcc;
> +
> +		supplies = kmemdup(hsusb_reg_supplies,
> +			    ARRAY_SIZE(hsusb_reg_supplies) *
> +			    sizeof(struct regulator_consumer_supply),
> +			    GFP_KERNEL);
> +		if (!supplies)
> +			return -ENOMEM;
> +
> +		supplies->supply = reset_supply;
> +		supplies->dev_name = phy->phy_id;
> +
> +		reg_data = kmemdup(&hsusb_reg_data, sizeof(hsusb_reg_data),
> +							GFP_KERNEL);
> +		if (!reg_data)
> +			return -ENOMEM;
> +
> +		reg_data->consumer_supplies = supplies;
> +
> +		config = kmemdup(&hsusb_reg_config, sizeof(hsusb_reg_config),
> +							GFP_KERNEL);
> +		if (!config)
> +			return -ENOMEM;
> +
> +		supply_name = kmalloc(14, GFP_KERNEL);
> +		if (!supply_name)
> +			return -ENOMEM;
> +
> +		scnprintf(supply_name, 13, "hsusb%d_reset", i);
> +		config->supply_name = supply_name;
> +		config->gpio = phy->reset_gpio;
> +		config->init_data = reg_data;
> +
> +		hsusb_reg_pdev_info.data = config;
> +		hsusb_reg_pdev_info.size_data = sizeof(hsusb_reg_config);
> +		platform_device_register_full(&hsusb_reg_pdev_info);
> +
> +check_vcc:
> +		if (!gpio_is_valid(phy->vcc_gpio))
> +			goto next;
> +
> +		supplies = kmemdup(hsusb_reg_supplies,
> +			    ARRAY_SIZE(hsusb_reg_supplies) *
> +			    sizeof(struct regulator_consumer_supply),
> +			    GFP_KERNEL);
> +		if (!supplies)
> +			return -ENOMEM;
> +
> +		supplies->supply = vcc_supply;
> +		supplies->dev_name = phy->phy_id;
> +
> +		reg_data = kmemdup(&hsusb_reg_data, sizeof(hsusb_reg_data),
> +							GFP_KERNEL);
> +		if (!reg_data)
> +			return -ENOMEM;
> +
> +		reg_data->consumer_supplies = supplies;
> +
> +		config = kmemdup(&hsusb_reg_config, sizeof(hsusb_reg_config),
> +							GFP_KERNEL);
> +		if (!config)
> +			return -ENOMEM;
> +
> +		supply_name = kmalloc(14, GFP_KERNEL);
> +		if (!supply_name)
> +			return -ENOMEM;
> +
> +		scnprintf(supply_name, 13, "hsusb%d_vcc", i);
> +		config->supply_name = supply_name;
> +		config->gpio = phy->vcc_gpio;
> +		config->enable_high = phy->vcc_polarity;
> +		config->init_data = reg_data;
> +
> +		hsusb_reg_pdev_info.data = config;
> +		hsusb_reg_pdev_info.size_data = sizeof(hsusb_reg_config);
> +		platform_device_register_full(&hsusb_reg_pdev_info);
> +
> +next:
> +		phy++;
> +	}
> +
> +	return 0;
> +}
> +
>  void __init usbhs_init(struct usbhs_omap_platform_data *pdata)
>  {
>  	struct omap_hwmod	*uhh_hwm, *tll_hwm;
> diff --git a/arch/arm/mach-omap2/usb.h b/arch/arm/mach-omap2/usb.h
> index 3319f5c..70a8c63 100644
> --- a/arch/arm/mach-omap2/usb.h
> +++ b/arch/arm/mach-omap2/usb.h
> @@ -53,8 +53,16 @@
>  #define USBPHY_OTGSESSEND_EN	(1 << 20)
>  #define USBPHY_DATA_POLARITY	(1 << 23)
>  
> +struct usbhs_phy_data {
> +	int reset_gpio;
> +	int vcc_gpio;
> +	bool vcc_polarity;	/* 1 active high, 0 active low */
> +	char *phy_id;
> +};
> +
>  extern void usb_musb_init(struct omap_musb_board_data *board_data);
>  extern void usbhs_init(struct usbhs_omap_platform_data *pdata);
> +extern int usbhs_init_phys(struct usbhs_phy_data *phy);

Maybe need a static inline version when no EHCI is selected?

Otherwise looks good to me, thanks for updating it.

Regards,

Tony

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

* Re: [PATCH 00/24] ARM: OMAP2+: Adapt to ehci-omap changes for 3.10
  2013-03-14 16:54             ` Tony Lindgren
@ 2013-03-15  9:22               ` Roger Quadros
  0 siblings, 0 replies; 35+ messages in thread
From: Roger Quadros @ 2013-03-15  9:22 UTC (permalink / raw)
  To: Tony Lindgren
  Cc: balbi, b-cousson, linux-kernel, linux-usb, linux-omap,
	devicetree-discuss

On 03/14/2013 06:54 PM, Tony Lindgren wrote:
> * Roger Quadros <rogerq@ti.com> [130314 08:45]:
>>
>> OK. Let me know how the below patch looks. After that, the board code
>> will look like.
>>
>> static struct usbhs_phy_data phy_data[] = {
>> 	{
>> 		.reset_gpio = 147,
>> 		.vcc_gpio = 148
>> 		.vcc_polarity = 1,
>> 		.phy_id = "nop_usb_xceiv.2",
>> 	},
>> 	{}, /* Terminator */
>> };
>>
>> usbhs_init_phys(phy_data);
> 
> Great, looks good to me.
>  
>> Patch to implement usbhs_init_phys();
>>
>> diff --git a/arch/arm/mach-omap2/usb-host.c b/arch/arm/mach-omap2/usb-host.c
>> index 5706bdc..b9d6bff 100644
>> --- a/arch/arm/mach-omap2/usb-host.c
>> +++ b/arch/arm/mach-omap2/usb-host.c
>> @@ -22,8 +22,12 @@
>>  #include <linux/platform_device.h>
>>  #include <linux/slab.h>
>>  #include <linux/dma-mapping.h>
>> +#include <linux/regulator/machine.h>
>> +#include <linux/regulator/fixed.h>
>> +#include <linux/string.h>
>>  
>>  #include <asm/io.h>
>> +#include <asm/gpio.h>
> 
> Please change these both to linux/io.h and linux/gpio.h.

OK.

>   
>>  #include "soc.h"
>>  #include "omap_device.h"
>> @@ -472,6 +476,141 @@ void __init setup_4430ohci_io_mux(const enum usbhs_omap_port_mode *port_mode)
>>  	}
>>  }
>>  
>> +static const char *reset_supply = "reset";
>> +static const char *vcc_supply = "vcc";
>> +
>> +/* Template for PHY regulators */
>> +static struct regulator_consumer_supply hsusb_reg_supplies[] = {
>> +	{ /* .supply & .dev_name filled later */ },
>> +};
>> +
>> +static struct regulator_init_data hsusb_reg_data = {
>> +	.constraints = {
>> +		.valid_ops_mask = REGULATOR_CHANGE_STATUS,
>> +	},
>> +	.consumer_supplies	= hsusb_reg_supplies,
>> +	.num_consumer_supplies	= ARRAY_SIZE(hsusb_reg_supplies),
>> +};
>> +
>> +static struct fixed_voltage_config hsusb_reg_config = {
>> +	/* .supply_name filled later */
>> +	.microvolts = 3300000,
>> +	.gpio = -1,		/* updated later */
>> +	.startup_delay = 70000, /* 70msec */
>> +	.enable_high = 1,	/* updated later */
>> +	.enabled_at_boot = 0,	/* keep in RESET */
>> +	/* .init_data filled later */
>> +};
>> +
>> +static struct platform_device_info hsusb_reg_pdev_info = {
>> +	.name	= "reg-fixed-voltage",
>> +	.id	= PLATFORM_DEVID_AUTO,
>> +};
>> +
>> +int __init usbhs_init_phys(struct usbhs_phy_data *phy)
>> +{
>> +	struct regulator_consumer_supply *supplies;
>> +	struct regulator_init_data *reg_data;
>> +	struct fixed_voltage_config *config;
>> +	char *supply_name;
>> +	int i;
>> +
>> +
>> +	for (i = 1; i <= OMAP3_HS_USB_PORTS; i++) {
> 
> Maybe pass the number of ports to initialize too to the
> function? Might be more future proof, although it will only
> be needed until we have converted to DT.
> 

OK. I'll add a port index parameter to the usbhs_phy_data structure
to indicate which port the data belongs to and a number of ports
to usbhs_init_phys()

board code can then do

static struct usbhs_phy_data phy_data[] = {
	{
		.port = 1,	/* First USB port */
		.reset_gpio = 147,
		.vcc_gpio = 148
		.vcc_polarity = 1,
		.phy_id = "nop_usb_xceiv.2",
	},
};

usbhs_init_phys(phy_data, ARRAY_SIZE(phy_data));

>> +
>> +		if (!phy->phy_id)	/* Terminator ? */
>> +			break;
>> +
>> +		if (!gpio_is_valid(phy->reset_gpio))
>> +			goto check_vcc;
>> +
>> +		supplies = kmemdup(hsusb_reg_supplies,
>> +			    ARRAY_SIZE(hsusb_reg_supplies) *
>> +			    sizeof(struct regulator_consumer_supply),
>> +			    GFP_KERNEL);
>> +		if (!supplies)
>> +			return -ENOMEM;
>> +
>> +		supplies->supply = reset_supply;
>> +		supplies->dev_name = phy->phy_id;
>> +
>> +		reg_data = kmemdup(&hsusb_reg_data, sizeof(hsusb_reg_data),
>> +							GFP_KERNEL);
>> +		if (!reg_data)
>> +			return -ENOMEM;
>> +
>> +		reg_data->consumer_supplies = supplies;
>> +
>> +		config = kmemdup(&hsusb_reg_config, sizeof(hsusb_reg_config),
>> +							GFP_KERNEL);
>> +		if (!config)
>> +			return -ENOMEM;
>> +
>> +		supply_name = kmalloc(14, GFP_KERNEL);
>> +		if (!supply_name)
>> +			return -ENOMEM;
>> +
>> +		scnprintf(supply_name, 13, "hsusb%d_reset", i);
>> +		config->supply_name = supply_name;
>> +		config->gpio = phy->reset_gpio;
>> +		config->init_data = reg_data;
>> +
>> +		hsusb_reg_pdev_info.data = config;
>> +		hsusb_reg_pdev_info.size_data = sizeof(hsusb_reg_config);
>> +		platform_device_register_full(&hsusb_reg_pdev_info);
>> +
>> +check_vcc:
>> +		if (!gpio_is_valid(phy->vcc_gpio))
>> +			goto next;
>> +
>> +		supplies = kmemdup(hsusb_reg_supplies,
>> +			    ARRAY_SIZE(hsusb_reg_supplies) *
>> +			    sizeof(struct regulator_consumer_supply),
>> +			    GFP_KERNEL);
>> +		if (!supplies)
>> +			return -ENOMEM;
>> +
>> +		supplies->supply = vcc_supply;
>> +		supplies->dev_name = phy->phy_id;
>> +
>> +		reg_data = kmemdup(&hsusb_reg_data, sizeof(hsusb_reg_data),
>> +							GFP_KERNEL);
>> +		if (!reg_data)
>> +			return -ENOMEM;
>> +
>> +		reg_data->consumer_supplies = supplies;
>> +
>> +		config = kmemdup(&hsusb_reg_config, sizeof(hsusb_reg_config),
>> +							GFP_KERNEL);
>> +		if (!config)
>> +			return -ENOMEM;
>> +
>> +		supply_name = kmalloc(14, GFP_KERNEL);
>> +		if (!supply_name)
>> +			return -ENOMEM;
>> +
>> +		scnprintf(supply_name, 13, "hsusb%d_vcc", i);
>> +		config->supply_name = supply_name;
>> +		config->gpio = phy->vcc_gpio;
>> +		config->enable_high = phy->vcc_polarity;
>> +		config->init_data = reg_data;
>> +
>> +		hsusb_reg_pdev_info.data = config;
>> +		hsusb_reg_pdev_info.size_data = sizeof(hsusb_reg_config);
>> +		platform_device_register_full(&hsusb_reg_pdev_info);
>> +
>> +next:
>> +		phy++;
>> +	}
>> +
>> +	return 0;
>> +}
>> +
>>  void __init usbhs_init(struct usbhs_omap_platform_data *pdata)
>>  {
>>  	struct omap_hwmod	*uhh_hwm, *tll_hwm;
>> diff --git a/arch/arm/mach-omap2/usb.h b/arch/arm/mach-omap2/usb.h
>> index 3319f5c..70a8c63 100644
>> --- a/arch/arm/mach-omap2/usb.h
>> +++ b/arch/arm/mach-omap2/usb.h
>> @@ -53,8 +53,16 @@
>>  #define USBPHY_OTGSESSEND_EN	(1 << 20)
>>  #define USBPHY_DATA_POLARITY	(1 << 23)
>>  
>> +struct usbhs_phy_data {
>> +	int reset_gpio;
>> +	int vcc_gpio;
>> +	bool vcc_polarity;	/* 1 active high, 0 active low */
>> +	char *phy_id;
>> +};
>> +
>>  extern void usb_musb_init(struct omap_musb_board_data *board_data);
>>  extern void usbhs_init(struct usbhs_omap_platform_data *pdata);
>> +extern int usbhs_init_phys(struct usbhs_phy_data *phy);
> 
> Maybe need a static inline version when no EHCI is selected?
> 
Yes.

> Otherwise looks good to me, thanks for updating it.
> 

Cool. I'll update all boards and send it to you soon.

cheers,
-roger

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

end of thread, other threads:[~2013-03-15  9:23 UTC | newest]

Thread overview: 35+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-03-12 11:43 [PATCH 00/24] ARM: OMAP2+: Adapt to ehci-omap changes for 3.10 Roger Quadros
2013-03-12 11:43 ` [PATCH 01/24] usb: phy: nop: Add some parameters to platform data Roger Quadros
2013-03-12 11:43 ` [PATCH 02/24] ARM: OMAP2+: omap4panda: Provide USB Host's PHY " Roger Quadros
2013-03-12 11:43 ` [PATCH 03/24] ARM: OMAP2+: omap4panda: Adapt to ehci-omap changes Roger Quadros
2013-03-12 11:43 ` [PATCH 04/24] ARM: OMAP3: Beagle: " Roger Quadros
2013-03-12 11:43 ` [PATCH 05/24] ARM: OMAP3: 3430SDP: " Roger Quadros
2013-03-12 11:43 ` [PATCH 06/24] ARM: OMAP3: 3630SDP: " Roger Quadros
2013-03-12 11:43 ` [PATCH 07/24] ARM: OMAP: AM3517crane: " Roger Quadros
2013-03-12 11:43 ` [PATCH 08/24] ARM: OMAP: AM3517evm: " Roger Quadros
2013-03-12 11:43 ` [PATCH 09/24] ARM: OMAP3: cm-t35: " Roger Quadros
2013-03-12 11:43 ` [PATCH 10/24] ARM: OMAP3: cm-t3517: " Roger Quadros
2013-03-12 11:43 ` [PATCH 11/24] ARM: OMAP: devkit8000: " Roger Quadros
2013-03-12 11:43 ` [PATCH 12/24] ARM: OMAP3: igep0020: " Roger Quadros
2013-03-12 11:43 ` [PATCH 13/24] ARM: OMAP3: omap3evm: " Roger Quadros
2013-03-12 11:43 ` [PATCH 14/24] ARM: OMAP3: omap3pandora: " Roger Quadros
2013-03-12 11:43 ` [PATCH 15/24] ARM: OMAP3: omap3stalker: " Roger Quadros
2013-03-12 11:43 ` [PATCH 16/24] ARM: OMAP3: omap3touchbook: " Roger Quadros
2013-03-12 11:43 ` [PATCH 17/24] ARM: OMAP3: overo: " Roger Quadros
2013-03-12 11:43 ` [PATCH 18/24] ARM: OMAP: zoom: " Roger Quadros
2013-03-12 11:43 ` [PATCH 19/24] ARM: dts: OMAP4: Add HS USB Host IP nodes Roger Quadros
2013-03-12 11:43 ` [PATCH 20/24] ARM: dts: omap4-panda: Add USB Host support Roger Quadros
2013-03-12 11:43 ` [PATCH 21/24] ARM: dts: OMAP3: Add HS USB Host IP nodes Roger Quadros
2013-03-12 11:43 ` [PATCH 22/24] ARM: dts: omap3-beagle: Add USB Host support Roger Quadros
2013-03-12 11:43 ` [PATCH 23/24] ARM: OMAP2+: Allow clock alias provision from device tree Roger Quadros
2013-03-12 13:17   ` Benoit Cousson
2013-03-12 14:01     ` Roger Quadros
2013-03-12 11:43 ` [PATCH 24/24] ARM: dts: omap4-panda: Add clock alias for USB PHY Roger Quadros
2013-03-12 16:40 ` [PATCH 00/24] ARM: OMAP2+: Adapt to ehci-omap changes for 3.10 Tony Lindgren
2013-03-13 13:41   ` Roger Quadros
2013-03-13 16:24     ` Tony Lindgren
2013-03-13 16:36       ` Roger Quadros
2013-03-13 16:57         ` Tony Lindgren
2013-03-14 15:41           ` Roger Quadros
2013-03-14 16:54             ` Tony Lindgren
2013-03-15  9:22               ` Roger Quadros

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