usb: tegra20-ehci: Add devicetree support.
Subsystems (4)
PATCH v3 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 Grant Likely's comments:
- Use hyphens instead of underscores for property names.
- Using fsl usb bindings as a guide, changed type to phy-type and mode to dr-mode.
- Changed power-down-on-bus-suspend to a boolean, so it defaults to off unless the property is present.
- Prefixed utmi phy settings with "nvidia,".
- Unconditionally include linux/of* headers.
- Have a default value for each property (also documented in bindings).
- Removed cast when calling of_property_read_u32. Instead, hold the value in a temporary u32, and if the call succeeds, use the value (otherwise, we fall back on the default).
- Make empty version of tegra_ehci_parse_dt_node(), to simplify code in the probe method.
- Get memory and irq resources from the usual place, rather than digging into the device tree node.
.../devicetree/bindings/usb/tegra20-ehci.txt | 27 +++ drivers/usb/host/ehci-tegra.c | 187 ++++++++++++++++++++ 2 files changed, 214 insertions(+), 0 deletions(-) create mode 100644 Documentation/devicetree/bindings/usb/tegra20-ehci.txt
Documentation/devicetree/bindings/usb/tegra20-ehci.txt new file +27 -0
@@ -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 +187 -0
225 lines not on this page · raw message
Signature · 1 line
1.7.6
PATCH v3 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
@@ -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
PATCH v3 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
@@ -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
Hi,
Quoted 10 lines · On Wed, Jul 20, 2011 at 8:23 PM, <[email protected]…
drivers/usb/host/ehci-tegra.c +2
-0@@ -21,10 +21,32 @@ #include <linux/platform_data/tegra_usb.h> #include <linux/irq.h> #include <linux/usb/otg.h> +#include <linux/of.h> +#include <linux/of_address.h>
drivers/usb/host/ehci-tegra.c line 35
Quoted 10 lines
drivers/usb/host/ehci-tegra.c +6
-0+#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 ); + +static struct tegra_utmip_config utmi_default = {
__initdata, no need to keep this around after setup.
You're also going to get a warning if you build without CONFIG_OF due to a local static variable that is not referenced, I think.
drivers/usb/host/ehci-tegra.c line 45
Quoted 10 lines
drivers/usb/host/ehci-tegra.c +10
-0+ .hssync_start_delay = 9, + .idle_wait_delay = 17, + .elastic_limit = 16, + .term_range_adj = 6, + .xcvr_setup = 9, + .xcvr_lsfslew = 2, + .xcvr_lsrslew = 2, +}; + +static struct tegra_ulpi_config ulpi_default = {
Same here.
Quoted 17 lines
drivers/usb/host/ehci-tegra.c +10
-0+ .reset_gpio = 169, + .clk = "cdev2", +}; + struct tegra_ehci_hcd { struct ehci_hcd *ehci; struct tegra_usb_phy *phy;@@ -574,9 +596,155 @@ static const struct hc_driver tegra_ehci_hc_driver = { .port_handed_over = ehci_port_handed_over, }; +#if defined(CONFIG_OF ) +static int tegra_ehci_parse_dt_node_utmi (struct device_node *dn, + struct platform_device *pdev, + struct tegra_ehci_platform_data *pdata) +{ + struct device *dev = &pdev->dev;
drivers/usb/host/ehci-tegra.c static const struct hc_driver tegra_ehci_hc_driver = { · line 614
Quoted 10 lines
drivers/usb/host/ehci-tegra.c +10
-0+ struct tegra_utmip_config *phy_config; + u32 val; + + phy_config = devm_kzalloc(dev, sizeof(struct tegra_utmip_config), + GFP_KERNEL); + if (!phy_config) + return -ENOMEM; + + /* Copy default values. */ + memcpy(phy_config, &utmi_default, sizeof(struct tegra_utmip_config));
Nit: Doing *phy_config = utmi_default; here would do type checking
for you. But it's not a big deal.
-Olof
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Quoted 3 lines · Olof Johansson
Quoted 1 line
+static struct
tegra_utmip_configutmi_default= {
__initdata, no need to keep this around after setup.
Oops, I meant __devinitdata.
-Olof
Re: [PATCH 2/3 v3] dt: tegra20: Add ehci host controller nodes.
In reply to [email protected]Quoted 6 lines · On Wed, Jul 20, 2011 at 8:23 PM, <[email protected]> wrote:
From: Andrew Chew <[email protected]>
These values were derived from various headers in
arch/arm/mach-tegra.Signed-off-by Andrew Chew <[email protected]>Acked-by Stephen Warren <[email protected]>
-Olof
Re: [PATCH 3/3 v3] dt: tegra20: Add ehci overrides to Seaboard.
In reply to [email protected]Quoted 6 lines · On Wed, Jul 20, 2011 at 8:23 PM, <[email protected]…
From: Andrew Chew <[email protected]>
Seaboard has different values for some of the utmi properties.
Signed-off-by Andrew Chew <[email protected]>Acked-by Stephen Warren <[email protected]>
-Olof