Skip to contentSkip to conversation

usb: tegra20-ehci: Add devicetree support.

PATCH In review [email protected] 5 participants 8 messages Jul 21, 2011 – Dec 7, 2011

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

PATCH v4 1/3 usb: tegra20-ehci: Add devicetree support.

From: Andrew Chew <[email protected]>

Add code to try to get platform data information (register base, irq, modes, various tuning parameters) from device tree, if not present in board files.

---
Applied Olof Johansson's comments:
- Use direct assignment when copying default config structs.
- Use __devinitdata for static default config structs.
- Don't compile the default config structs if CONFIG_OF is disabled, to avoid a warning.

 .../devicetree/bindings/usb/tegra20-ehci.txt       |   27 +++
 drivers/usb/host/ehci-tegra.c                      |  189 ++++++++++++++++++++
 2 files changed, 216 insertions(+), 0 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/usb/tegra20-ehci.txt
Documentation/devicetree/bindings/usb/tegra20-ehci.txt new file +27 -0
new file mode 100644
index 0000000..315ea6e
@@ -0,0 +1,27 @@
+NVIDIA Tegra20 SOC USB controllers
+
+The device node for a USB controller that is part of a Tegra20
+SOC is as described in the document "Open Firmware Recommended
+Practice: Universal Serial Bus" with the following modifications
+and additions:
+
+Required properties:
+ - compatible: Should be "nvidia,tegra20-ehci".
+ - phy-type: Should be one of "utmi" or "ulpi".  Defaults to utmi.
+ - dr-mode: Should be one of "peripheral", "host", or "otg".  Defaults to host.
+ - power-down-on-bus-suspend: For host mode only.  If present, then
+   the USB phy will power down when the host is suspended.
+
+Required properties for phy-type = "utmi".  These values are derived from
+characterization by system engineering.
+ - nvidia,hssync-start-delay: Defaults to 9.
+ - nvidia,idle-wait-delay: Defaults to 17.
+ - nvidia,elastic-limit: Defaults to 16.
+ - nvidia,term-range-adj: Defaults to 6.
+ - nvidia,xcvr-setup: Defaults to 9.
+ - nvidia,xcvr-lsfslew: Defaults to 2.
+ - nvidia,xcvr-lsrslew: Defaults to 2.
+
+Required properties for phy-type = "ulpi":
+ - reset-gpio: The GPIO used to drive reset.  Defaults to 169.
+ - clk: Defaults to "cdev2".
drivers/usb/host/ehci-tegra.c +189 -0

227 lines not on this page · raw message

Signature · 1 line
1.7.6
#1 lore raw

PATCH v4 2/3 dt: tegra20: Add ehci host controller nodes.

From: Andrew Chew <[email protected]>

These values were derived from various headers in arch/arm/mach-tegra.

---
 arch/arm/boot/dts/tegra20.dtsi |   18 ++++++++++++++++++
 1 files changed, 18 insertions(+), 0 deletions(-)
arch/arm/boot/dts/tegra20.dtsi +18 -0
index 83fedf3..d51f887 100644
@@ -160,5 +160,23 @@
 		interrupts = < 63 >;
 		status = "disabled";
 	};
+
+	ehci@c5000000 {
+		compatible = "nvidia,tegra20-ehci";
+		reg = <0xc5000000 0x4000>;
+		interrupts = < 52 >;
+	};
+
+	ehci@c5004000 {
+		compatible = "nvidia,tegra20-ehci";
+		reg = <0xc5004000 0x4000>;
+		interrupts = < 53 >;
+	};
+
+	ehci@c5008000 {
+		compatible = "nvidia,tegra20-ehci";
+		reg = <0xc5008000 0x4000>;
+		interrupts = < 129 >;
+	};
 };
 
Signature · 1 line
1.7.6
#2 lore raw

PATCH v4 3/3 dt: tegra20: Add ehci overrides to Seaboard.

In reply to [email protected]

From: Andrew Chew <[email protected]>

Seaboard has different values for some of the utmi properties.

---
 arch/arm/boot/dts/tegra-seaboard.dts |   17 +++++++++++++++++
 1 files changed, 17 insertions(+), 0 deletions(-)
arch/arm/boot/dts/tegra-seaboard.dts +17 -0
index 5a99b4c..adc000a 100644
@@ -31,4 +31,21 @@
 	sdhci@c8000600 {
 		status = "ok";
 	};
+
+	ehci@c5000000 {
+		power-down-on-bus-suspend;
+		nvidia,hssync-start-delay = < 0 >;
+		nvidia,xcvr-setup = < 15 >;
+	};
+
+	ehci@c5004000 {
+		power-down-on-bus-suspend;
+		phy-type = "ulpi";
+	};
+
+	ehci@c5008000 {
+		power-down-on-bus-suspend;
+		nvidia,hssync-start-delay = < 0 >;
+		nvidia,xcvr-setup = < 8 >;
+	};
 };
Signature · 1 line
1.7.6
#3 lore raw
In reply to [email protected]
Quoted 6 lines · Andrew Chew

From: Andrew Chew <[email protected]>

Add code to try to get platform data information (register base, irq, modes, various tuning parameters) from device tree, if not present in board
files.

This patch no longer gets the register base or irq, just the modes and tuning parameters.

- Dan Willemsen

Quoted 10 lines

---
Applied Olof Johansson's comments:
- Use direct assignment when copying default config structs.
- Use __devinitdata for static default config structs.
- Don't compile the default config structs if CONFIG_OF is disabled, to avoid
a warning.

Quoted 5 lines

.../devicetree/bindings/usb/tegra20-ehci.txt | 27 +++
drivers/usb/host/ehci-tegra.c | 189
++++++++++++++++++++

2 files changed, 216 insertions(+), 0 deletions(-)

create mode 100644 Documentation/devicetree/bindings/usb/tegra20-ehci.txt

--
nvpublic

#4 lore raw
Quoted 8 lines · Andrew Chew
Quoted 6 lines

From: Andrew Chew <[email protected]>

Add code to try to get platform data information (register base, irq, modes, various tuning parameters) from device tree, if not present in board
files.

Quoted 4 lines

This patch no longer gets the register base or irq, just the modes and tuning parameters.

- Dan Willemsen

You're totally right, Dan. Grant, would you mind fixing the commit message, if nothing else comes up? Or would you prefer I send a new patchset out?

I suppose the commit message should just read:

Add code to try to get platform data information (modes, various tuning parameters) from device tree, if not present in board files.

Acked-by on v4 1/3
#5 lore raw
In reply to [email protected]
Quoted 8 lines · On Thu, Jul 21, 2011 at 2:17 PM, <[email protected]…

From: Andrew Chew <[email protected]>

Add code to try to get platform data information (register base, irq, modes, various tuning parameters) from device tree, if not present in board files.

-Olof

#6 lore raw
In reply to [email protected]
Quoted 61 lines · On 14:17 Thu 21 Jul , [email protected] wrote:

From: Andrew Chew <[email protected]>

Add code to try to get platform data information (register base, irq, modes, various tuning parameters) from device tree, if not present in board files.

---
Applied Olof Johansson's comments:
- Use direct assignment when copying default config structs.
- Use __devinitdata for static default config structs.
- Don't compile the default config structs if CONFIG_OF is disabled, to avoid a warning.

 .../devicetree/bindings/usb/tegra20-ehci.txt       |   27 +++
 drivers/usb/host/ehci-tegra.c                      |  189 ++++++++++++++++++++
 2 files changed, 216 insertions(+), 0 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/usb/tegra20-ehci.txt
Documentation/devicetree/bindings/usb/tegra20-ehci.txt new file +27 -0
new file mode 100644
index 0000000..315ea6e
@@ -0,0 +1,27 @@
+NVIDIA Tegra20 SOC USB controllers
+
+The device node for a USB controller that is part of a Tegra20
+SOC is as described in the document "Open Firmware Recommended
+Practice: Universal Serial Bus" with the following modifications
+and additions:
+
+Required properties:
+ - compatible: Should be "nvidia,tegra20-ehci".
+ - phy-type: Should be one of "utmi" or "ulpi".  Defaults to utmi.
+ - dr-mode: Should be one of "peripheral", "host", or "otg".  Defaults to host.
+ - power-down-on-bus-suspend: For host mode only.  If present, then
+   the USB phy will power down when the host is suspended.
+
+Required properties for phy-type = "utmi".  These values are derived from
+characterization by system engineering.
+ - nvidia,hssync-start-delay: Defaults to 9.
+ - nvidia,idle-wait-delay: Defaults to 17.
+ - nvidia,elastic-limit: Defaults to 16.
+ - nvidia,term-range-adj: Defaults to 6.
+ - nvidia,xcvr-setup: Defaults to 9.
+ - nvidia,xcvr-lsfslew: Defaults to 2.
+ - nvidia,xcvr-lsrslew: Defaults to 2.
+
+Required properties for phy-type = "ulpi":
+ - reset-gpio: The GPIO used to drive reset.  Defaults to 169.
+ - clk: Defaults to "cdev2".
drivers/usb/host/ehci-tegra.c +0 -0
index 02b2bfd..d7295eb 100644
@@ -21,10 +21,34 @@
 #include <linux/platform_data/tegra_usb.h>
 #include <linux/irq.h>
 #include <linux/usb/otg.h>

drivers/usb/host/ehci-tegra.c line 33

Quoted 10 lines
drivers/usb/host/ehci-tegra.c +6 -0
+#include <linux/of.h>
+#include <linux/of_address.h>
+#include <linux/of_irq.h>
+#include <linux/of_platform.h>
+
 #include <mach/usb_phy.h>
 
 #define TEGRA_USB_DMA_ALIGN 32
 
+static u64 tegra_ehci_dmamask = DMA_BIT_MASK(TEGRA_USB_DMA_ALIGN);

I really does not like this
as the dmamask is supposed to be device specific

before we put it in the soc codewhich alow to have it generic

this need to be manage a DT level

	dmamask = <32>

or

	dmamask = <0xffffffff>

Best Regards,
J.

#7 lore raw

Jean-Christophe PLAGNIOL-VILLARD wrote at Tuesday, December 06, 2011 8:42 PM:

Quoted 6 lines · On 14:17 Thu 21 Jul , [email protected] wrote:
Quoted 5 lines

From: Andrew Chew <[email protected]>

Add code to try to get platform data information (register base, irq, modes, various tuning parameters) from device tree, if not present in board files.

...

Quoted 11 lines
Quoted 1 line

+static u64 tegra_ehci_dmamask = DMA_BIT_MASK(TEGRA_USB_DMA_ALIGN);

I really does not like this
as the dmamask is supposed to be device specific

before we put it in the soc codewhich alow to have it generic

this need to be manage a DT level

	dmamask = <32>

or

	dmamask = <0xffffffff>

Jean-Christophe,

The patch you're replying to is very old; Olof has posted (and applied) some basic USB bindings much more recently than the above.

Signature · 1 line
nvpublic