All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/4] Device tree support for OMAP USB Host
@ 2012-11-15 14:56 Roger Quadros
  2012-11-15 14:56 ` [PATCH 2/4] ARM: OMAP4: USB: Add pin mux configuration for panda board Roger Quadros
       [not found] ` <1352991396-19589-1-git-send-email-rogerq-l0cyMroinI0@public.gmane.org>
  0 siblings, 2 replies; 12+ messages in thread
From: Roger Quadros @ 2012-11-15 14:56 UTC (permalink / raw)
  To: tony; +Cc: b-cousson, balbi, keshava_mgowda, linux-omap, linux-usb, rogerq

    Provides a means for the OMAP USB host subsystem to be initialized
    from Device tree. This is a first step for device tree migration where
    we specify only the board specific stuff. Things like I/O address space
    and interrupts are not yet specified in the device tree but can be
    done as a next step.
    
    This patch will allow boards to be booted with our without device tree
    and have USB host functional.

    Tested on OMAP4 Panda ES Rev B1.

    This patchset depends on the following series
	http://www.mail-archive.com/linux-omap@vger.kernel.org/msg80691.html

cheers,
-roger

---
Keshava Munegowda (1):
  ARM: OMAP4: USB: Add pin mux configuration for panda board

Roger Quadros (3):
  ARM: OMAP: usb-host: Device tree support for USB Host
  ARM/dts: omap4-panda: Add USB Host support
  regulator: fixed: Properly use input_supply parameter from device
    tree

 .../devicetree/bindings/arm/omap/usb-host.txt      |   60 +++++++++++++++++
 .../bindings/regulator/fixed-regulator.txt         |    6 +-
 arch/arm/boot/dts/omap4-panda.dts                  |   54 +++++++++++++++
 arch/arm/boot/dts/omap4.dtsi                       |    5 ++
 arch/arm/mach-omap2/board-generic.c                |    1 +
 arch/arm/mach-omap2/common.h                       |    2 +
 arch/arm/mach-omap2/usb-host.c                     |   71 ++++++++++++++++++++
 drivers/regulator/fixed.c                          |    6 +-
 8 files changed, 200 insertions(+), 5 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/arm/omap/usb-host.txt

-- 
1.7.4.1


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

* [PATCH 1/4] ARM: OMAP: usb-host: Device tree support for USB Host
       [not found] ` <1352991396-19589-1-git-send-email-rogerq-l0cyMroinI0@public.gmane.org>
@ 2012-11-15 14:56   ` Roger Quadros
  2012-11-16 10:30     ` Benoit Cousson
  2012-11-15 14:56   ` [PATCH 3/4] ARM/dts: omap4-panda: Add USB Host support Roger Quadros
  2012-11-15 14:56   ` [PATCH 4/4] regulator: fixed: Properly use input_supply parameter from device tree Roger Quadros
  2 siblings, 1 reply; 12+ messages in thread
From: Roger Quadros @ 2012-11-15 14:56 UTC (permalink / raw)
  To: tony-4v6yS6AI5VpBDgjK7y7TUQ
  Cc: b-cousson-l0cyMroinI0, balbi-l0cyMroinI0,
	keshava_mgowda-l0cyMroinI0, linux-omap-u79uwXL29TY76Z2rM5mHXA,
	linux-usb-u79uwXL29TY76Z2rM5mHXA, rogerq-l0cyMroinI0

Provides a means for the OMAP USB host subsystem to be initialized
from Device tree. This is a first step for device tree migration where
we specify only the board specific stuff. Things like I/O address space
and interrupts are not yet specified in the device tree but can be
done as a next step.

This patch will allow boards to be booted with our without device tree
and have USB host functional.

Signed-off-by: Roger Quadros <rogerq-l0cyMroinI0@public.gmane.org>
---
 .../devicetree/bindings/arm/omap/usb-host.txt      |   60 +++++++++++++++++
 arch/arm/mach-omap2/board-generic.c                |    1 +
 arch/arm/mach-omap2/common.h                       |    2 +
 arch/arm/mach-omap2/usb-host.c                     |   71 ++++++++++++++++++++
 4 files changed, 134 insertions(+), 0 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/arm/omap/usb-host.txt

diff --git a/Documentation/devicetree/bindings/arm/omap/usb-host.txt b/Documentation/devicetree/bindings/arm/omap/usb-host.txt
new file mode 100644
index 0000000..f25cfa4
--- /dev/null
+++ b/Documentation/devicetree/bindings/arm/omap/usb-host.txt
@@ -0,0 +1,60 @@
+* usb-host - OMAP USB Host Subsystem
+
+The OMAP USB host subsystem consists of the following modules
+1) USBTLL (Tranceiverless interface)
+2) USBHOST (Host Controller module) which includes both EHCI and OHCI controllers
+
+THe USB Host subsystem can be connected to the external world using 3 PORTs that could
+be configured in various modes like  UTMI+ for external PHY, ULPI transceiverless link (TLL),
+Serial TLL, High-speed interchip (HSIC), etc.
+
+Required proprties:
+- compatible: Must be "ti,usb-host";
+- num_ports: Number of physical ports available
+
+Optional properties:
+- 1 child node for each available port.  These child nodes are usually supplied by the
+  board support device tree as they are specific to how the ports are wired on the board
+
+  - mode: Integer specifying the mode in which the port is used
+	* OMAP_USBHS_PORT_MODE_UNUSED		= 0,
+	* OMAP_EHCI_PORT_MODE_PHY		= 1,
+	* OMAP_EHCI_PORT_MODE_TLL		= 2,
+	* OMAP_EHCI_PORT_MODE_HSIC		= 3,
+	* OMAP_OHCI_PORT_MODE_PHY_6PIN_DATSE0 	= 4,
+	* OMAP_OHCI_PORT_MODE_PHY_6PIN_DPDM 	= 5,
+	* OMAP_OHCI_PORT_MODE_PHY_3PIN_DATSE0	= 6,
+	* OMAP_OHCI_PORT_MODE_PHY_4PIN_DPDM	= 7,
+	* OMAP_OHCI_PORT_MODE_TLL_6PIN_DATSE0	= 8,
+	* OMAP_OHCI_PORT_MODE_TLL_6PIN_DPDM	= 9,
+	* OMAP_OHCI_PORT_MODE_TLL_3PIN_DATSE0	= 10,
+	* OMAP_OHCI_PORT_MODE_TLL_4PIN_DPDM	= 11,
+	* OMAP_OHCI_PORT_MODE_TLL_2PIN_DATSE0	= 12,
+	* OMAP_OHCI_PORT_MODE_TLL_2PIN_DPDM	= 13,
+   - clk: Name of the clock that needs to be active when using the port
+   - clkrate: Frequency at which the above clk needs to be run at
+
+
+Example:
+
+/* In the OMAP Core tree */
+usbhost: usb-host {
+	compatible = "ti,usb-host";
+	num_ports = <3>;
+};
+
+/* In the Board tree */
+&usbhost {
+	port@0 {
+		mode = <1>;
+		clk = "auxclk3_ck";
+		clkrate = <19200000>;
+	};
+	port@1 {
+		mode = <0>;
+	};
+	port@2 {
+		mode = <0>;
+	};
+};
+
diff --git a/arch/arm/mach-omap2/board-generic.c b/arch/arm/mach-omap2/board-generic.c
index 601ecdf..4e53b62 100644
--- a/arch/arm/mach-omap2/board-generic.c
+++ b/arch/arm/mach-omap2/board-generic.c
@@ -40,6 +40,7 @@ static void __init omap_generic_init(void)
 	omap_sdrc_init(NULL, NULL);
 
 	of_platform_populate(NULL, omap_dt_match_table, NULL, NULL);
+	usbhost_init_of();
 }
 
 #ifdef CONFIG_SOC_OMAP2420
diff --git a/arch/arm/mach-omap2/common.h b/arch/arm/mach-omap2/common.h
index 7045e4d..b301fcb 100644
--- a/arch/arm/mach-omap2/common.h
+++ b/arch/arm/mach-omap2/common.h
@@ -339,5 +339,7 @@ extern void omap_sdrc_init(struct omap_sdrc_params *sdrc_cs0,
 struct omap2_hsmmc_info;
 extern int omap4_twl6030_hsmmc_init(struct omap2_hsmmc_info *controllers);
 
+void __init usbhost_init_of(void);
+
 #endif /* __ASSEMBLER__ */
 #endif /* __ARCH_ARM_MACH_OMAP2PLUS_COMMON_H */
diff --git a/arch/arm/mach-omap2/usb-host.c b/arch/arm/mach-omap2/usb-host.c
index bfab301..10a297d 100644
--- a/arch/arm/mach-omap2/usb-host.c
+++ b/arch/arm/mach-omap2/usb-host.c
@@ -22,6 +22,8 @@
 #include <linux/platform_device.h>
 #include <linux/slab.h>
 #include <linux/dma-mapping.h>
+#include <linux/of.h>
+#include <linux/of_gpio.h>
 
 #include <asm/io.h>
 
@@ -556,3 +558,72 @@ void __init usbhs_init(const struct usbhs_omap_board_data *pdata)
 }
 
 #endif
+
+static struct usbhs_omap_board_data bdata;
+
+#define USBHS_NODE "usb-host"
+
+/**
+ * usbhost_init_of - initialize USB Host subsystem from device tree
+ *
+ * Scans the device tree for required information and populates
+ * platform data for the OMAP USB High Speed Host subsystem
+ */
+void __init usbhost_init_of(void)
+{
+	int r;
+	struct device_node *node, *child;
+	int num_ports;
+	int i;
+
+	node = of_find_node_by_name(NULL, USBHS_NODE);
+	if (!node) {
+		pr_err("%s could not find OF node : %s\n",
+					__func__, USBHS_NODE);
+		return;
+	}
+
+	r = of_property_read_u32(node, "num_ports", &num_ports);
+	if (r) {
+		pr_err("%s num_ports not specified in OF node %s\n",
+				__func__, USBHS_NODE);
+	}
+
+	r = of_property_read_bool(node, "phy_reset");
+	bdata.phy_reset = r;
+
+	i = 0;
+	for_each_child_of_node(node, child) {
+		int mode;
+		const char *clk_name;
+		u32 clk_rate;
+
+		r = of_property_read_u32(child, "mode", &mode);
+		if (r) {
+			pr_err("%s mode not specified in OF node %s port %d\n",
+				__func__, USBHS_NODE, i);
+			bdata.port_mode[i] = OMAP_USBHS_PORT_MODE_UNUSED;
+		} else {
+			bdata.port_mode[i] = mode;
+		}
+
+		r = of_get_named_gpio(child, "reset_gpio", 0);
+		if (gpio_is_valid(r))
+			bdata.reset_gpio_port[i] = r;
+		else
+			bdata.reset_gpio_port[i] = -EINVAL;
+
+		clk_name = of_get_property(child, "clk", NULL);
+		if (clk_name)
+			bdata.clk[i] = clk_name;
+
+		r = of_property_read_u32(child, "clkrate", &clk_rate);
+		if (!r)
+			bdata.clkrate[i] = clk_rate;
+
+		i++;
+	}
+
+	usbhs_init(&bdata);
+}
+
-- 
1.7.4.1

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

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

* [PATCH 2/4] ARM: OMAP4: USB: Add pin mux configuration for panda board
  2012-11-15 14:56 [PATCH 0/4] Device tree support for OMAP USB Host Roger Quadros
@ 2012-11-15 14:56 ` Roger Quadros
       [not found] ` <1352991396-19589-1-git-send-email-rogerq-l0cyMroinI0@public.gmane.org>
  1 sibling, 0 replies; 12+ messages in thread
From: Roger Quadros @ 2012-11-15 14:56 UTC (permalink / raw)
  To: tony; +Cc: b-cousson, balbi, keshava_mgowda, linux-omap, linux-usb, rogerq

From: Keshava Munegowda <keshava_mgowda@ti.com>

The port1 of omap4 panda board is used in ULPI PHY mode.
The pin mux of usbhs (usbb1) port 1 is configured accordingly.

Signed-off-by: Keshava Munegowda <keshava_mgowda@ti.com>
---
 arch/arm/boot/dts/omap4-panda.dts |   18 ++++++++++++++++++
 1 files changed, 18 insertions(+), 0 deletions(-)

diff --git a/arch/arm/boot/dts/omap4-panda.dts b/arch/arm/boot/dts/omap4-panda.dts
index e8f927c..6811b37 100644
--- a/arch/arm/boot/dts/omap4-panda.dts
+++ b/arch/arm/boot/dts/omap4-panda.dts
@@ -65,6 +65,7 @@
 			&twl6040_pins
 			&mcpdm_pins
 			&mcbsp1_pins
+			&usbb1_pins	/* port 0 of omap usb host port pin mux configuration */
 	>;
 
 	twl6040_pins: pinmux_twl6040_pins {
@@ -92,6 +93,23 @@
 			0xc4 0x100	/* abe_mcbsp1_fsx.abe_mcbsp1_fsx INPUT | MODE0 */
 		>;
 	};
+
+	usbb1_pins: pinmux_usbb1_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 {
-- 
1.7.4.1


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

* [PATCH 3/4] ARM/dts: omap4-panda: Add USB Host support
       [not found] ` <1352991396-19589-1-git-send-email-rogerq-l0cyMroinI0@public.gmane.org>
  2012-11-15 14:56   ` [PATCH 1/4] ARM: OMAP: usb-host: Device tree support for USB Host Roger Quadros
@ 2012-11-15 14:56   ` Roger Quadros
  2012-11-15 14:56   ` [PATCH 4/4] regulator: fixed: Properly use input_supply parameter from device tree Roger Quadros
  2 siblings, 0 replies; 12+ messages in thread
From: Roger Quadros @ 2012-11-15 14:56 UTC (permalink / raw)
  To: tony-4v6yS6AI5VpBDgjK7y7TUQ
  Cc: b-cousson-l0cyMroinI0, balbi-l0cyMroinI0,
	keshava_mgowda-l0cyMroinI0, linux-omap-u79uwXL29TY76Z2rM5mHXA,
	linux-usb-u79uwXL29TY76Z2rM5mHXA, rogerq-l0cyMroinI0

Get USB Host working. On Panda, two GPIOs are used, one for
HUB/PHY reset and other for Hub power. We model them as fixed
regulators. The regulator for RESET is made to depend on regulator
for Hub power so that the Hub power is enabled by the regulator
framework before RESET is removed.

Tested on Panda ES B1.

Signed-off-by: Roger Quadros <rogerq-l0cyMroinI0@public.gmane.org>
---
 arch/arm/boot/dts/omap4-panda.dts |   36 ++++++++++++++++++++++++++++++++++++
 arch/arm/boot/dts/omap4.dtsi      |    5 +++++
 2 files changed, 41 insertions(+), 0 deletions(-)

diff --git a/arch/arm/boot/dts/omap4-panda.dts b/arch/arm/boot/dts/omap4-panda.dts
index 6811b37..f67a65a 100644
--- a/arch/arm/boot/dts/omap4-panda.dts
+++ b/arch/arm/boot/dts/omap4-panda.dts
@@ -57,6 +57,27 @@
 			"AFML", "Line In",
 			"AFMR", "Line In";
 	};
+
+	hubpower: fixedregulator@0 {
+			compatible = "regulator-fixed";
+			regulator-name = "vhub0";
+			regulator-min-microvolt = <3300000>;
+			regulator-max-microvolt = <3300000>;
+			gpio = <&gpio1 1 0>;		/* gpio 1 : HUB Power */
+			startup-delay-us = <70000>;
+			enable-active-high;
+	};
+
+	hubreset: fixedregulator@1 {
+			compatible = "regulator-fixed";
+			regulator-name = "hsusb0";	/* tag to associate with PORT 1 */
+			regulator-min-microvolt = <3300000>;
+			regulator-max-microvolt = <3300000>;
+			gpio = <&gpio2 30 0>;	/* gpio 62 : HUB & PHY Reset */
+			startup-delay-us = <70000>;
+			enable-active-high;
+			vin-supply = "vhub0"; /* Makes regulator f/w enable power before reset */
+	};
 };
 
 &omap4_pmx_core {
@@ -136,6 +157,21 @@
 	};
 };
 
+
+&usbhost {
+	port@0 {
+		mode = <1>;		/* PHY mode */
+		clk = "auxclk3_ck";	/* PHY clock on FREF_CLK3_OUT */
+		clkrate = <19200000>;
+	};
+	port@1 {
+		mode = <0>;
+	};
+	port@2 {
+		mode = <0>;
+	};
+};
+
 /include/ "twl6030.dtsi"
 
 &i2c2 {
diff --git a/arch/arm/boot/dts/omap4.dtsi b/arch/arm/boot/dts/omap4.dtsi
index 3883f94..0062c59 100644
--- a/arch/arm/boot/dts/omap4.dtsi
+++ b/arch/arm/boot/dts/omap4.dtsi
@@ -438,5 +438,10 @@
 			ranges;
 			ti,hwmods = "ocp2scp_usb_phy";
 		};
+
+		usbhost: usb-host {
+			compatible = "ti,usb-host";
+			num_ports = <2>;
+		};
 	};
 };
-- 
1.7.4.1

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

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

* [PATCH 4/4] regulator: fixed: Properly use input_supply parameter from device tree
       [not found] ` <1352991396-19589-1-git-send-email-rogerq-l0cyMroinI0@public.gmane.org>
  2012-11-15 14:56   ` [PATCH 1/4] ARM: OMAP: usb-host: Device tree support for USB Host Roger Quadros
  2012-11-15 14:56   ` [PATCH 3/4] ARM/dts: omap4-panda: Add USB Host support Roger Quadros
@ 2012-11-15 14:56   ` Roger Quadros
       [not found]     ` <1352991396-19589-5-git-send-email-rogerq-l0cyMroinI0@public.gmane.org>
  2 siblings, 1 reply; 12+ messages in thread
From: Roger Quadros @ 2012-11-15 14:56 UTC (permalink / raw)
  To: tony-4v6yS6AI5VpBDgjK7y7TUQ
  Cc: b-cousson-l0cyMroinI0, balbi-l0cyMroinI0,
	keshava_mgowda-l0cyMroinI0, linux-omap-u79uwXL29TY76Z2rM5mHXA,
	linux-usb-u79uwXL29TY76Z2rM5mHXA, rogerq-l0cyMroinI0,
	Laxman Dewangan, Mark Brown

The device tree node will provide the input supply name as
a string. Use that to populate the supply_name parameter of
the regulator descriptor.

Also correct the documentation to reflect the same.

Signed-off-by: Roger Quadros <rogerq-l0cyMroinI0@public.gmane.org>
CC: Laxman Dewangan <ldewangan-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
CC: Mark Brown <broonie-yzvPICuk2AATkU/dhu1WVueM+bqZidxxQQ4Iyu8u01E@public.gmane.org>
---
 .../bindings/regulator/fixed-regulator.txt         |    6 +++---
 drivers/regulator/fixed.c                          |    6 ++++--
 2 files changed, 7 insertions(+), 5 deletions(-)

diff --git a/Documentation/devicetree/bindings/regulator/fixed-regulator.txt b/Documentation/devicetree/bindings/regulator/fixed-regulator.txt
index 4fae41d..fe34114 100644
--- a/Documentation/devicetree/bindings/regulator/fixed-regulator.txt
+++ b/Documentation/devicetree/bindings/regulator/fixed-regulator.txt
@@ -7,10 +7,10 @@ Optional properties:
 - gpio: gpio to use for enable control
 - startup-delay-us: startup time in microseconds
 - enable-active-high: Polarity of GPIO is Active high
-If this property is missing, the default assumed is Active low.
+  If this property is missing, the default assumed is Active low.
 - gpio-open-drain: GPIO is open drain type.
   If this property is missing then default assumption is false.
--vin-supply: Input supply name.
+- vin-supply: Input supply name.
 
 Any property defined as part of the core regulator
 binding, defined in regulator.txt, can also be used.
@@ -30,5 +30,5 @@ Example:
 		enable-active-high;
 		regulator-boot-on;
 		gpio-open-drain;
-		vin-supply = <&parent_reg>;
+		vin-supply = "input-supply-name";
 	};
diff --git a/drivers/regulator/fixed.c b/drivers/regulator/fixed.c
index 185468c..3a6f4ad 100644
--- a/drivers/regulator/fixed.c
+++ b/drivers/regulator/fixed.c
@@ -53,6 +53,7 @@ of_get_fixed_voltage_config(struct device *dev)
 	struct device_node *np = dev->of_node;
 	const __be32 *delay;
 	struct regulator_init_data *init_data;
+	const char *vin_name;
 
 	config = devm_kzalloc(dev, sizeof(struct fixed_voltage_config),
 								 GFP_KERNEL);
@@ -102,8 +103,9 @@ of_get_fixed_voltage_config(struct device *dev)
 	if (of_find_property(np, "gpio-open-drain", NULL))
 		config->gpio_is_open_drain = true;
 
-	if (of_find_property(np, "vin-supply", NULL))
-		config->input_supply = "vin";
+	vin_name = of_get_property(np, "vin-supply", NULL);
+	if (vin_name)
+		config->input_supply = vin_name;
 
 	return config;
 }
-- 
1.7.4.1

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

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

* Re: [PATCH 4/4] regulator: fixed: Properly use input_supply parameter from device tree
       [not found]     ` <1352991396-19589-5-git-send-email-rogerq-l0cyMroinI0@public.gmane.org>
@ 2012-11-15 19:11       ` Laxman Dewangan
       [not found]         ` <50A53E7F.6070705-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
  0 siblings, 1 reply; 12+ messages in thread
From: Laxman Dewangan @ 2012-11-15 19:11 UTC (permalink / raw)
  To: Roger Quadros
  Cc: tony-4v6yS6AI5VpBDgjK7y7TUQ, b-cousson-l0cyMroinI0,
	balbi-l0cyMroinI0, keshava_mgowda-l0cyMroinI0,
	linux-omap-u79uwXL29TY76Z2rM5mHXA,
	linux-usb-u79uwXL29TY76Z2rM5mHXA, Mark Brown

On 11/15/2012 09:56 AM, Roger Quadros wrote:
> The device tree node will provide the input supply name as
> a string. Use that to populate the supply_name parameter of
> the regulator descriptor.
>
> Also correct the documentation to reflect the same.
>
> Signed-off-by: Roger Quadros <rogerq-l0cyMroinI0@public.gmane.org>
> CC: Laxman Dewangan <ldewangan-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
> CC: Mark Brown <broonie-yzvPICuk2AATkU/dhu1WVueM+bqZidxxQQ4Iyu8u01E@public.gmane.org>
> ---
>   		regulator-boot-on;
>   		gpio-open-drain;
> -		vin-supply = <&parent_reg>;
> +		vin-supply = "input-supply-name";

This is not correct as per the regulator binding. It says
  - <name>-supply: phandle to the parent supply/regulator node

So we need to pass the phandle rather than string.

Just for curiosity, why do you want this change? What is the issue are 
you facing.

This change will creates regression on many platform.


-----------------------------------------------------------------------------------
This email message is for the sole use of the intended recipient(s) and may contain
confidential information.  Any unauthorized review, use, disclosure or distribution
is prohibited.  If you are not the intended recipient, please contact the sender by
reply email and destroy all copies of the original message.
-----------------------------------------------------------------------------------
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* Re: [PATCH 4/4] regulator: fixed: Properly use input_supply parameter from device tree
       [not found]         ` <50A53E7F.6070705-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
@ 2012-11-16 10:23           ` Roger Quadros
  2012-12-15 14:55             ` Mark Brown
  0 siblings, 1 reply; 12+ messages in thread
From: Roger Quadros @ 2012-11-16 10:23 UTC (permalink / raw)
  To: Laxman Dewangan
  Cc: tony-4v6yS6AI5VpBDgjK7y7TUQ, b-cousson-l0cyMroinI0,
	balbi-l0cyMroinI0, keshava_mgowda-l0cyMroinI0,
	linux-omap-u79uwXL29TY76Z2rM5mHXA,
	linux-usb-u79uwXL29TY76Z2rM5mHXA, Mark Brown

On 11/15/2012 09:11 PM, Laxman Dewangan wrote:
> On 11/15/2012 09:56 AM, Roger Quadros wrote:
>> The device tree node will provide the input supply name as
>> a string. Use that to populate the supply_name parameter of
>> the regulator descriptor.
>>
>> Also correct the documentation to reflect the same.
>>
>> Signed-off-by: Roger Quadros <rogerq-l0cyMroinI0@public.gmane.org>
>> CC: Laxman Dewangan <ldewangan-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
>> CC: Mark Brown <broonie-yzvPICuk2AATkU/dhu1WVueM+bqZidxxQQ4Iyu8u01E@public.gmane.org>
>> ---
>>           regulator-boot-on;
>>           gpio-open-drain;
>> -        vin-supply = <&parent_reg>;
>> +        vin-supply = "input-supply-name";
> 
> This is not correct as per the regulator binding. It says
>  - <name>-supply: phandle to the parent supply/regulator node
> 
> So we need to pass the phandle rather than string.
> 

If you see of_get_fixed_voltage_config() in drivers/regulator/fixed.c,
all it does (without my patch) is

	if (of_find_property(np, "vin-supply", NULL))
		config->input_supply = "vin";

How is this supposed to work? How does phandle supplied in vin-supply
map to config->input_supply?

This config->input_supply is a string which is used in
reg_fixed_voltage_probe() like below

      if (config->input_supply) {
               drvdata->desc.supply_name = kstrdup(config->input_supply,
                                                        GFP_KERNEL);

So I don't understand how supplying phandle would work. Maybe I missed
something?

> Just for curiosity, why do you want this change? What is the issue are
> you facing.
>

Because I could not understood how the original approach would work. But
if you can explain how it works maybe my patch is redundant.

> This change will creates regression on many platform.
> 

Did you test your platform on 3.7-rc5?

regards,
-roger

> 
> -----------------------------------------------------------------------------------
> 
> This email message is for the sole use of the intended recipient(s) and
> may contain
> confidential information.  Any unauthorized review, use, disclosure or
> distribution
> is prohibited.  If you are not the intended recipient, please contact
> the sender by
> reply email and destroy all copies of the original message.
> -----------------------------------------------------------------------------------
> 
> -- 
> To unsubscribe from this list: send the line "unsubscribe linux-omap" in
> the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

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

* Re: [PATCH 1/4] ARM: OMAP: usb-host: Device tree support for USB Host
  2012-11-15 14:56   ` [PATCH 1/4] ARM: OMAP: usb-host: Device tree support for USB Host Roger Quadros
@ 2012-11-16 10:30     ` Benoit Cousson
  2012-11-16 10:55       ` Roger Quadros
  0 siblings, 1 reply; 12+ messages in thread
From: Benoit Cousson @ 2012-11-16 10:30 UTC (permalink / raw)
  To: Roger Quadros; +Cc: tony, balbi, keshava_mgowda, linux-omap, linux-usb

Hi Roger,

On 11/15/2012 03:56 PM, Roger Quadros wrote:
> Provides a means for the OMAP USB host subsystem to be initialized
> from Device tree. This is a first step for device tree migration where
> we specify only the board specific stuff. Things like I/O address space
> and interrupts are not yet specified in the device tree but can be
> done as a next step.
> 
> This patch will allow boards to be booted with our without device tree
> and have USB host functional.
> 
> Signed-off-by: Roger Quadros <rogerq@ti.com>
> ---
>  .../devicetree/bindings/arm/omap/usb-host.txt      |   60 +++++++++++++++++
>  arch/arm/mach-omap2/board-generic.c                |    1 +
>  arch/arm/mach-omap2/common.h                       |    2 +
>  arch/arm/mach-omap2/usb-host.c                     |   71 ++++++++++++++++++++
>  4 files changed, 134 insertions(+), 0 deletions(-)
>  create mode 100644 Documentation/devicetree/bindings/arm/omap/usb-host.txt
> 
> diff --git a/Documentation/devicetree/bindings/arm/omap/usb-host.txt b/Documentation/devicetree/bindings/arm/omap/usb-host.txt
> new file mode 100644
> index 0000000..f25cfa4
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/arm/omap/usb-host.txt
> @@ -0,0 +1,60 @@
> +* usb-host - OMAP USB Host Subsystem
> +
> +The OMAP USB host subsystem consists of the following modules
> +1) USBTLL (Tranceiverless interface)
> +2) USBHOST (Host Controller module) which includes both EHCI and OHCI controllers
> +
> +THe USB Host subsystem can be connected to the external world using 3 PORTs that could
> +be configured in various modes like  UTMI+ for external PHY, ULPI transceiverless link (TLL),
> +Serial TLL, High-speed interchip (HSIC), etc.
> +
> +Required proprties:
> +- compatible: Must be "ti,usb-host";
> +- num_ports: Number of physical ports available
> +
> +Optional properties:
> +- 1 child node for each available port.  These child nodes are usually supplied by the
> +  board support device tree as they are specific to how the ports are wired on the board
> +
> +  - mode: Integer specifying the mode in which the port is used
> +	* OMAP_USBHS_PORT_MODE_UNUSED		= 0,
> +	* OMAP_EHCI_PORT_MODE_PHY		= 1,
> +	* OMAP_EHCI_PORT_MODE_TLL		= 2,
> +	* OMAP_EHCI_PORT_MODE_HSIC		= 3,
> +	* OMAP_OHCI_PORT_MODE_PHY_6PIN_DATSE0 	= 4,
> +	* OMAP_OHCI_PORT_MODE_PHY_6PIN_DPDM 	= 5,
> +	* OMAP_OHCI_PORT_MODE_PHY_3PIN_DATSE0	= 6,
> +	* OMAP_OHCI_PORT_MODE_PHY_4PIN_DPDM	= 7,
> +	* OMAP_OHCI_PORT_MODE_TLL_6PIN_DATSE0	= 8,
> +	* OMAP_OHCI_PORT_MODE_TLL_6PIN_DPDM	= 9,
> +	* OMAP_OHCI_PORT_MODE_TLL_3PIN_DATSE0	= 10,
> +	* OMAP_OHCI_PORT_MODE_TLL_4PIN_DPDM	= 11,
> +	* OMAP_OHCI_PORT_MODE_TLL_2PIN_DATSE0	= 12,
> +	* OMAP_OHCI_PORT_MODE_TLL_2PIN_DPDM	= 13,
> +   - clk: Name of the clock that needs to be active when using the port
> +   - clkrate: Frequency at which the above clk needs to be run at
> +
> +
> +Example:
> +
> +/* In the OMAP Core tree */
> +usbhost: usb-host {
> +	compatible = "ti,usb-host";
> +	num_ports = <3>;
> +};
> +
> +/* In the Board tree */
> +&usbhost {
> +	port@0 {
> +		mode = <1>;
> +		clk = "auxclk3_ck";
> +		clkrate = <19200000>;
> +	};
> +	port@1 {
> +		mode = <0>;
> +	};
> +	port@2 {
> +		mode = <0>;
> +	};
> +};
> +
> diff --git a/arch/arm/mach-omap2/board-generic.c b/arch/arm/mach-omap2/board-generic.c
> index 601ecdf..4e53b62 100644
> --- a/arch/arm/mach-omap2/board-generic.c
> +++ b/arch/arm/mach-omap2/board-generic.c
> @@ -40,6 +40,7 @@ static void __init omap_generic_init(void)
>  	omap_sdrc_init(NULL, NULL);
>  
>  	of_platform_populate(NULL, omap_dt_match_table, NULL, NULL);
> +	usbhost_init_of();

You should never have to add that kind of hacks in generic board file.
Why do you need that during board init?

In theory, the of_platform_populate will create all the devices, and
during the driver probe you will create the sub nodes.

This way of initializing early from DT node is done only for critical
ARM/OMAP infrastructure stuff like GIC, L2 controller...
It should not be required for USB, that is not even a mandatory IP to
use the OMAP.

Regards,
Benoit


>  }
>  
>  #ifdef CONFIG_SOC_OMAP2420
> diff --git a/arch/arm/mach-omap2/common.h b/arch/arm/mach-omap2/common.h
> index 7045e4d..b301fcb 100644
> --- a/arch/arm/mach-omap2/common.h
> +++ b/arch/arm/mach-omap2/common.h
> @@ -339,5 +339,7 @@ extern void omap_sdrc_init(struct omap_sdrc_params *sdrc_cs0,
>  struct omap2_hsmmc_info;
>  extern int omap4_twl6030_hsmmc_init(struct omap2_hsmmc_info *controllers);
>  
> +void __init usbhost_init_of(void);
> +
>  #endif /* __ASSEMBLER__ */
>  #endif /* __ARCH_ARM_MACH_OMAP2PLUS_COMMON_H */
> diff --git a/arch/arm/mach-omap2/usb-host.c b/arch/arm/mach-omap2/usb-host.c
> index bfab301..10a297d 100644
> --- a/arch/arm/mach-omap2/usb-host.c
> +++ b/arch/arm/mach-omap2/usb-host.c
> @@ -22,6 +22,8 @@
>  #include <linux/platform_device.h>
>  #include <linux/slab.h>
>  #include <linux/dma-mapping.h>
> +#include <linux/of.h>
> +#include <linux/of_gpio.h>
>  
>  #include <asm/io.h>
>  
> @@ -556,3 +558,72 @@ void __init usbhs_init(const struct usbhs_omap_board_data *pdata)
>  }
>  
>  #endif
> +
> +static struct usbhs_omap_board_data bdata;
> +
> +#define USBHS_NODE "usb-host"
> +
> +/**
> + * usbhost_init_of - initialize USB Host subsystem from device tree
> + *
> + * Scans the device tree for required information and populates
> + * platform data for the OMAP USB High Speed Host subsystem
> + */
> +void __init usbhost_init_of(void)
> +{
> +	int r;
> +	struct device_node *node, *child;
> +	int num_ports;
> +	int i;
> +
> +	node = of_find_node_by_name(NULL, USBHS_NODE);
> +	if (!node) {
> +		pr_err("%s could not find OF node : %s\n",
> +					__func__, USBHS_NODE);
> +		return;
> +	}
> +
> +	r = of_property_read_u32(node, "num_ports", &num_ports);
> +	if (r) {
> +		pr_err("%s num_ports not specified in OF node %s\n",
> +				__func__, USBHS_NODE);
> +	}
> +
> +	r = of_property_read_bool(node, "phy_reset");
> +	bdata.phy_reset = r;
> +
> +	i = 0;
> +	for_each_child_of_node(node, child) {
> +		int mode;
> +		const char *clk_name;
> +		u32 clk_rate;
> +
> +		r = of_property_read_u32(child, "mode", &mode);
> +		if (r) {
> +			pr_err("%s mode not specified in OF node %s port %d\n",
> +				__func__, USBHS_NODE, i);
> +			bdata.port_mode[i] = OMAP_USBHS_PORT_MODE_UNUSED;
> +		} else {
> +			bdata.port_mode[i] = mode;
> +		}
> +
> +		r = of_get_named_gpio(child, "reset_gpio", 0);
> +		if (gpio_is_valid(r))
> +			bdata.reset_gpio_port[i] = r;
> +		else
> +			bdata.reset_gpio_port[i] = -EINVAL;
> +
> +		clk_name = of_get_property(child, "clk", NULL);
> +		if (clk_name)
> +			bdata.clk[i] = clk_name;
> +
> +		r = of_property_read_u32(child, "clkrate", &clk_rate);
> +		if (!r)
> +			bdata.clkrate[i] = clk_rate;
> +
> +		i++;
> +	}
> +
> +	usbhs_init(&bdata);
> +}
> +
> 


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

* Re: [PATCH 1/4] ARM: OMAP: usb-host: Device tree support for USB Host
  2012-11-16 10:30     ` Benoit Cousson
@ 2012-11-16 10:55       ` Roger Quadros
  2012-11-16 11:06         ` Benoit Cousson
  0 siblings, 1 reply; 12+ messages in thread
From: Roger Quadros @ 2012-11-16 10:55 UTC (permalink / raw)
  To: Benoit Cousson; +Cc: tony, balbi, keshava_mgowda, linux-omap, linux-usb

Hi Benoit,

On 11/16/2012 12:30 PM, Benoit Cousson wrote:
> Hi Roger,
> 
> On 11/15/2012 03:56 PM, Roger Quadros wrote:
>> Provides a means for the OMAP USB host subsystem to be initialized
>> from Device tree. This is a first step for device tree migration where
>> we specify only the board specific stuff. Things like I/O address space
>> and interrupts are not yet specified in the device tree but can be
>> done as a next step.
>>
>> This patch will allow boards to be booted with our without device tree
>> and have USB host functional.
>>
>> Signed-off-by: Roger Quadros <rogerq@ti.com>
>> ---
>>  .../devicetree/bindings/arm/omap/usb-host.txt      |   60 +++++++++++++++++
>>  arch/arm/mach-omap2/board-generic.c                |    1 +
>>  arch/arm/mach-omap2/common.h                       |    2 +
>>  arch/arm/mach-omap2/usb-host.c                     |   71 ++++++++++++++++++++
>>  4 files changed, 134 insertions(+), 0 deletions(-)
>>  create mode 100644 Documentation/devicetree/bindings/arm/omap/usb-host.txt
>>
>> diff --git a/Documentation/devicetree/bindings/arm/omap/usb-host.txt b/Documentation/devicetree/bindings/arm/omap/usb-host.txt
>> new file mode 100644
>> index 0000000..f25cfa4
>> --- /dev/null
>> +++ b/Documentation/devicetree/bindings/arm/omap/usb-host.txt
>> @@ -0,0 +1,60 @@
>> +* usb-host - OMAP USB Host Subsystem
>> +
>> +The OMAP USB host subsystem consists of the following modules
>> +1) USBTLL (Tranceiverless interface)
>> +2) USBHOST (Host Controller module) which includes both EHCI and OHCI controllers
>> +
>> +THe USB Host subsystem can be connected to the external world using 3 PORTs that could
>> +be configured in various modes like  UTMI+ for external PHY, ULPI transceiverless link (TLL),
>> +Serial TLL, High-speed interchip (HSIC), etc.
>> +
>> +Required proprties:
>> +- compatible: Must be "ti,usb-host";
>> +- num_ports: Number of physical ports available
>> +
>> +Optional properties:
>> +- 1 child node for each available port.  These child nodes are usually supplied by the
>> +  board support device tree as they are specific to how the ports are wired on the board
>> +
>> +  - mode: Integer specifying the mode in which the port is used
>> +	* OMAP_USBHS_PORT_MODE_UNUSED		= 0,
>> +	* OMAP_EHCI_PORT_MODE_PHY		= 1,
>> +	* OMAP_EHCI_PORT_MODE_TLL		= 2,
>> +	* OMAP_EHCI_PORT_MODE_HSIC		= 3,
>> +	* OMAP_OHCI_PORT_MODE_PHY_6PIN_DATSE0 	= 4,
>> +	* OMAP_OHCI_PORT_MODE_PHY_6PIN_DPDM 	= 5,
>> +	* OMAP_OHCI_PORT_MODE_PHY_3PIN_DATSE0	= 6,
>> +	* OMAP_OHCI_PORT_MODE_PHY_4PIN_DPDM	= 7,
>> +	* OMAP_OHCI_PORT_MODE_TLL_6PIN_DATSE0	= 8,
>> +	* OMAP_OHCI_PORT_MODE_TLL_6PIN_DPDM	= 9,
>> +	* OMAP_OHCI_PORT_MODE_TLL_3PIN_DATSE0	= 10,
>> +	* OMAP_OHCI_PORT_MODE_TLL_4PIN_DPDM	= 11,
>> +	* OMAP_OHCI_PORT_MODE_TLL_2PIN_DATSE0	= 12,
>> +	* OMAP_OHCI_PORT_MODE_TLL_2PIN_DPDM	= 13,
>> +   - clk: Name of the clock that needs to be active when using the port
>> +   - clkrate: Frequency at which the above clk needs to be run at
>> +
>> +
>> +Example:
>> +
>> +/* In the OMAP Core tree */
>> +usbhost: usb-host {
>> +	compatible = "ti,usb-host";
>> +	num_ports = <3>;
>> +};
>> +
>> +/* In the Board tree */
>> +&usbhost {
>> +	port@0 {
>> +		mode = <1>;
>> +		clk = "auxclk3_ck";
>> +		clkrate = <19200000>;
>> +	};
>> +	port@1 {
>> +		mode = <0>;
>> +	};
>> +	port@2 {
>> +		mode = <0>;
>> +	};
>> +};
>> +
>> diff --git a/arch/arm/mach-omap2/board-generic.c b/arch/arm/mach-omap2/board-generic.c
>> index 601ecdf..4e53b62 100644
>> --- a/arch/arm/mach-omap2/board-generic.c
>> +++ b/arch/arm/mach-omap2/board-generic.c
>> @@ -40,6 +40,7 @@ static void __init omap_generic_init(void)
>>  	omap_sdrc_init(NULL, NULL);
>>  
>>  	of_platform_populate(NULL, omap_dt_match_table, NULL, NULL);
>> +	usbhost_init_of();
> 
> You should never have to add that kind of hacks in generic board file.
> Why do you need that during board init?
> 
> In theory, the of_platform_populate will create all the devices, and
> during the driver probe you will create the sub nodes.
>

OK. I was thinking of this as a temporary fix till the USB host drivers
support OF nodes natively. Maybe I should work on fixing up the host
drivers instead.

But I'm not sure how the PM runtime calls map to omap_device/hwmod
framework when device tree boot is used. I can see that the device tree
node can specify "ti,hwmods = " parameter. Just can't seem to figure out
how all this adds up :P

cheers,
-roger


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

* Re: [PATCH 1/4] ARM: OMAP: usb-host: Device tree support for USB Host
  2012-11-16 10:55       ` Roger Quadros
@ 2012-11-16 11:06         ` Benoit Cousson
  2012-11-16 12:05           ` Roger Quadros
  0 siblings, 1 reply; 12+ messages in thread
From: Benoit Cousson @ 2012-11-16 11:06 UTC (permalink / raw)
  To: Roger Quadros; +Cc: tony, balbi, keshava_mgowda, linux-omap, linux-usb

On 11/16/2012 11:55 AM, Roger Quadros wrote:
> Hi Benoit,
> 
> On 11/16/2012 12:30 PM, Benoit Cousson wrote:
>> Hi Roger,
>>
>> On 11/15/2012 03:56 PM, Roger Quadros wrote:
>>> Provides a means for the OMAP USB host subsystem to be initialized
>>> from Device tree. This is a first step for device tree migration where
>>> we specify only the board specific stuff. Things like I/O address space
>>> and interrupts are not yet specified in the device tree but can be
>>> done as a next step.
>>>
>>> This patch will allow boards to be booted with our without device tree
>>> and have USB host functional.
>>>
>>> Signed-off-by: Roger Quadros <rogerq@ti.com>
>>> ---
>>>  .../devicetree/bindings/arm/omap/usb-host.txt      |   60 +++++++++++++++++
>>>  arch/arm/mach-omap2/board-generic.c                |    1 +
>>>  arch/arm/mach-omap2/common.h                       |    2 +
>>>  arch/arm/mach-omap2/usb-host.c                     |   71 ++++++++++++++++++++
>>>  4 files changed, 134 insertions(+), 0 deletions(-)
>>>  create mode 100644 Documentation/devicetree/bindings/arm/omap/usb-host.txt
>>>
>>> diff --git a/Documentation/devicetree/bindings/arm/omap/usb-host.txt b/Documentation/devicetree/bindings/arm/omap/usb-host.txt
>>> new file mode 100644
>>> index 0000000..f25cfa4
>>> --- /dev/null
>>> +++ b/Documentation/devicetree/bindings/arm/omap/usb-host.txt
>>> @@ -0,0 +1,60 @@
>>> +* usb-host - OMAP USB Host Subsystem
>>> +
>>> +The OMAP USB host subsystem consists of the following modules
>>> +1) USBTLL (Tranceiverless interface)
>>> +2) USBHOST (Host Controller module) which includes both EHCI and OHCI controllers
>>> +
>>> +THe USB Host subsystem can be connected to the external world using 3 PORTs that could
>>> +be configured in various modes like  UTMI+ for external PHY, ULPI transceiverless link (TLL),
>>> +Serial TLL, High-speed interchip (HSIC), etc.
>>> +
>>> +Required proprties:
>>> +- compatible: Must be "ti,usb-host";
>>> +- num_ports: Number of physical ports available
>>> +
>>> +Optional properties:
>>> +- 1 child node for each available port.  These child nodes are usually supplied by the
>>> +  board support device tree as they are specific to how the ports are wired on the board
>>> +
>>> +  - mode: Integer specifying the mode in which the port is used
>>> +	* OMAP_USBHS_PORT_MODE_UNUSED		= 0,
>>> +	* OMAP_EHCI_PORT_MODE_PHY		= 1,
>>> +	* OMAP_EHCI_PORT_MODE_TLL		= 2,
>>> +	* OMAP_EHCI_PORT_MODE_HSIC		= 3,
>>> +	* OMAP_OHCI_PORT_MODE_PHY_6PIN_DATSE0 	= 4,
>>> +	* OMAP_OHCI_PORT_MODE_PHY_6PIN_DPDM 	= 5,
>>> +	* OMAP_OHCI_PORT_MODE_PHY_3PIN_DATSE0	= 6,
>>> +	* OMAP_OHCI_PORT_MODE_PHY_4PIN_DPDM	= 7,
>>> +	* OMAP_OHCI_PORT_MODE_TLL_6PIN_DATSE0	= 8,
>>> +	* OMAP_OHCI_PORT_MODE_TLL_6PIN_DPDM	= 9,
>>> +	* OMAP_OHCI_PORT_MODE_TLL_3PIN_DATSE0	= 10,
>>> +	* OMAP_OHCI_PORT_MODE_TLL_4PIN_DPDM	= 11,
>>> +	* OMAP_OHCI_PORT_MODE_TLL_2PIN_DATSE0	= 12,
>>> +	* OMAP_OHCI_PORT_MODE_TLL_2PIN_DPDM	= 13,
>>> +   - clk: Name of the clock that needs to be active when using the port
>>> +   - clkrate: Frequency at which the above clk needs to be run at
>>> +
>>> +
>>> +Example:
>>> +
>>> +/* In the OMAP Core tree */
>>> +usbhost: usb-host {
>>> +	compatible = "ti,usb-host";
>>> +	num_ports = <3>;
>>> +};
>>> +
>>> +/* In the Board tree */
>>> +&usbhost {
>>> +	port@0 {
>>> +		mode = <1>;
>>> +		clk = "auxclk3_ck";
>>> +		clkrate = <19200000>;
>>> +	};
>>> +	port@1 {
>>> +		mode = <0>;
>>> +	};
>>> +	port@2 {
>>> +		mode = <0>;
>>> +	};
>>> +};
>>> +
>>> diff --git a/arch/arm/mach-omap2/board-generic.c b/arch/arm/mach-omap2/board-generic.c
>>> index 601ecdf..4e53b62 100644
>>> --- a/arch/arm/mach-omap2/board-generic.c
>>> +++ b/arch/arm/mach-omap2/board-generic.c
>>> @@ -40,6 +40,7 @@ static void __init omap_generic_init(void)
>>>  	omap_sdrc_init(NULL, NULL);
>>>  
>>>  	of_platform_populate(NULL, omap_dt_match_table, NULL, NULL);
>>> +	usbhost_init_of();
>>
>> You should never have to add that kind of hacks in generic board file.
>> Why do you need that during board init?
>>
>> In theory, the of_platform_populate will create all the devices, and
>> during the driver probe you will create the sub nodes.
>>
> 
> OK. I was thinking of this as a temporary fix till the USB host drivers
> support OF nodes natively. Maybe I should work on fixing up the host
> drivers instead.

Well, yeah, that's clearly better.

> But I'm not sure how the PM runtime calls map to omap_device/hwmod
> framework when device tree boot is used. I can see that the device tree
> node can specify "ti,hwmods = " parameter. Just can't seem to figure out
> how all this adds up :P

It is done auto-magically in the omap_device code. As soon as you add
the "ti,hwmods: attribute, an omap_device will be created instead of a
regular platform_device. A custom PM domain is added to handle the
pm_runtime callback for OMAP IPs. And every omap_device belongs to that
PM domain.

Regards,
Benoit


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

* Re: [PATCH 1/4] ARM: OMAP: usb-host: Device tree support for USB Host
  2012-11-16 11:06         ` Benoit Cousson
@ 2012-11-16 12:05           ` Roger Quadros
  0 siblings, 0 replies; 12+ messages in thread
From: Roger Quadros @ 2012-11-16 12:05 UTC (permalink / raw)
  To: Benoit Cousson; +Cc: tony, balbi, keshava_mgowda, linux-omap, linux-usb

On 11/16/2012 01:06 PM, Benoit Cousson wrote:
> On 11/16/2012 11:55 AM, Roger Quadros wrote:
>> Hi Benoit,
>>
>> On 11/16/2012 12:30 PM, Benoit Cousson wrote:
>>> Hi Roger,
>>>
>>> On 11/15/2012 03:56 PM, Roger Quadros wrote:
>>>> Provides a means for the OMAP USB host subsystem to be initialized
>>>> from Device tree. This is a first step for device tree migration where
>>>> we specify only the board specific stuff. Things like I/O address space
>>>> and interrupts are not yet specified in the device tree but can be
>>>> done as a next step.
>>>>
>>>> This patch will allow boards to be booted with our without device tree
>>>> and have USB host functional.
>>>>
>>>> Signed-off-by: Roger Quadros <rogerq@ti.com>
>>>> ---
>>>>  .../devicetree/bindings/arm/omap/usb-host.txt      |   60 +++++++++++++++++
>>>>  arch/arm/mach-omap2/board-generic.c                |    1 +
>>>>  arch/arm/mach-omap2/common.h                       |    2 +
>>>>  arch/arm/mach-omap2/usb-host.c                     |   71 ++++++++++++++++++++
>>>>  4 files changed, 134 insertions(+), 0 deletions(-)
>>>>  create mode 100644 Documentation/devicetree/bindings/arm/omap/usb-host.txt
>>>>
>>>> diff --git a/Documentation/devicetree/bindings/arm/omap/usb-host.txt b/Documentation/devicetree/bindings/arm/omap/usb-host.txt
>>>> new file mode 100644
>>>> index 0000000..f25cfa4
>>>> --- /dev/null
>>>> +++ b/Documentation/devicetree/bindings/arm/omap/usb-host.txt
>>>> @@ -0,0 +1,60 @@
>>>> +* usb-host - OMAP USB Host Subsystem
>>>> +
>>>> +The OMAP USB host subsystem consists of the following modules
>>>> +1) USBTLL (Tranceiverless interface)
>>>> +2) USBHOST (Host Controller module) which includes both EHCI and OHCI controllers
>>>> +
>>>> +THe USB Host subsystem can be connected to the external world using 3 PORTs that could
>>>> +be configured in various modes like  UTMI+ for external PHY, ULPI transceiverless link (TLL),
>>>> +Serial TLL, High-speed interchip (HSIC), etc.
>>>> +
>>>> +Required proprties:
>>>> +- compatible: Must be "ti,usb-host";
>>>> +- num_ports: Number of physical ports available
>>>> +
>>>> +Optional properties:
>>>> +- 1 child node for each available port.  These child nodes are usually supplied by the
>>>> +  board support device tree as they are specific to how the ports are wired on the board
>>>> +
>>>> +  - mode: Integer specifying the mode in which the port is used
>>>> +	* OMAP_USBHS_PORT_MODE_UNUSED		= 0,
>>>> +	* OMAP_EHCI_PORT_MODE_PHY		= 1,
>>>> +	* OMAP_EHCI_PORT_MODE_TLL		= 2,
>>>> +	* OMAP_EHCI_PORT_MODE_HSIC		= 3,
>>>> +	* OMAP_OHCI_PORT_MODE_PHY_6PIN_DATSE0 	= 4,
>>>> +	* OMAP_OHCI_PORT_MODE_PHY_6PIN_DPDM 	= 5,
>>>> +	* OMAP_OHCI_PORT_MODE_PHY_3PIN_DATSE0	= 6,
>>>> +	* OMAP_OHCI_PORT_MODE_PHY_4PIN_DPDM	= 7,
>>>> +	* OMAP_OHCI_PORT_MODE_TLL_6PIN_DATSE0	= 8,
>>>> +	* OMAP_OHCI_PORT_MODE_TLL_6PIN_DPDM	= 9,
>>>> +	* OMAP_OHCI_PORT_MODE_TLL_3PIN_DATSE0	= 10,
>>>> +	* OMAP_OHCI_PORT_MODE_TLL_4PIN_DPDM	= 11,
>>>> +	* OMAP_OHCI_PORT_MODE_TLL_2PIN_DATSE0	= 12,
>>>> +	* OMAP_OHCI_PORT_MODE_TLL_2PIN_DPDM	= 13,
>>>> +   - clk: Name of the clock that needs to be active when using the port
>>>> +   - clkrate: Frequency at which the above clk needs to be run at
>>>> +
>>>> +
>>>> +Example:
>>>> +
>>>> +/* In the OMAP Core tree */
>>>> +usbhost: usb-host {
>>>> +	compatible = "ti,usb-host";
>>>> +	num_ports = <3>;
>>>> +};
>>>> +
>>>> +/* In the Board tree */
>>>> +&usbhost {
>>>> +	port@0 {
>>>> +		mode = <1>;
>>>> +		clk = "auxclk3_ck";
>>>> +		clkrate = <19200000>;
>>>> +	};
>>>> +	port@1 {
>>>> +		mode = <0>;
>>>> +	};
>>>> +	port@2 {
>>>> +		mode = <0>;
>>>> +	};
>>>> +};
>>>> +
>>>> diff --git a/arch/arm/mach-omap2/board-generic.c b/arch/arm/mach-omap2/board-generic.c
>>>> index 601ecdf..4e53b62 100644
>>>> --- a/arch/arm/mach-omap2/board-generic.c
>>>> +++ b/arch/arm/mach-omap2/board-generic.c
>>>> @@ -40,6 +40,7 @@ static void __init omap_generic_init(void)
>>>>  	omap_sdrc_init(NULL, NULL);
>>>>  
>>>>  	of_platform_populate(NULL, omap_dt_match_table, NULL, NULL);
>>>> +	usbhost_init_of();
>>>
>>> You should never have to add that kind of hacks in generic board file.
>>> Why do you need that during board init?
>>>
>>> In theory, the of_platform_populate will create all the devices, and
>>> during the driver probe you will create the sub nodes.
>>>
>>
>> OK. I was thinking of this as a temporary fix till the USB host drivers
>> support OF nodes natively. Maybe I should work on fixing up the host
>> drivers instead.
> 
> Well, yeah, that's clearly better.
> 
>> But I'm not sure how the PM runtime calls map to omap_device/hwmod
>> framework when device tree boot is used. I can see that the device tree
>> node can specify "ti,hwmods = " parameter. Just can't seem to figure out
>> how all this adds up :P
> 
> It is done auto-magically in the omap_device code. As soon as you add
> the "ti,hwmods: attribute, an omap_device will be created instead of a
> regular platform_device. A custom PM domain is added to handle the
> pm_runtime callback for OMAP IPs. And every omap_device belongs to that
> PM domain.
> 

Thanks. Just figured out it happens through BUS_NOTIFY_ADD_DEVICE ->
_omap_device_notifier_call() - > omap_device_build_from_dt()

cheers,
-roger

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

* Re: [PATCH 4/4] regulator: fixed: Properly use input_supply parameter from device tree
  2012-11-16 10:23           ` Roger Quadros
@ 2012-12-15 14:55             ` Mark Brown
  0 siblings, 0 replies; 12+ messages in thread
From: Mark Brown @ 2012-12-15 14:55 UTC (permalink / raw)
  To: Roger Quadros
  Cc: Laxman Dewangan, tony, b-cousson, balbi, keshava_mgowda,
	linux-omap, linux-usb

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

On Fri, Nov 16, 2012 at 12:23:43PM +0200, Roger Quadros wrote:

> How is this supposed to work? How does phandle supplied in vin-supply
> map to config->input_supply?

You should provide a separate property to name the supply, or just pick
a fixed name in the fixed voltage driver.

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

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

end of thread, other threads:[~2012-12-15 14:55 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-11-15 14:56 [PATCH 0/4] Device tree support for OMAP USB Host Roger Quadros
2012-11-15 14:56 ` [PATCH 2/4] ARM: OMAP4: USB: Add pin mux configuration for panda board Roger Quadros
     [not found] ` <1352991396-19589-1-git-send-email-rogerq-l0cyMroinI0@public.gmane.org>
2012-11-15 14:56   ` [PATCH 1/4] ARM: OMAP: usb-host: Device tree support for USB Host Roger Quadros
2012-11-16 10:30     ` Benoit Cousson
2012-11-16 10:55       ` Roger Quadros
2012-11-16 11:06         ` Benoit Cousson
2012-11-16 12:05           ` Roger Quadros
2012-11-15 14:56   ` [PATCH 3/4] ARM/dts: omap4-panda: Add USB Host support Roger Quadros
2012-11-15 14:56   ` [PATCH 4/4] regulator: fixed: Properly use input_supply parameter from device tree Roger Quadros
     [not found]     ` <1352991396-19589-5-git-send-email-rogerq-l0cyMroinI0@public.gmane.org>
2012-11-15 19:11       ` Laxman Dewangan
     [not found]         ` <50A53E7F.6070705-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
2012-11-16 10:23           ` Roger Quadros
2012-12-15 14:55             ` Mark Brown

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.