diff mbox

[v2,07/14] USB: ohci-omap3: Add device tree support and binding information

Message ID 1360252974-7912-8-git-send-email-rogerq@ti.com (mailing list archive)
State New, archived
Headers show

Commit Message

Roger Quadros Feb. 7, 2013, 4:02 p.m. UTC
Allows the OHCI controller found in OMAP3 and later chips to
be specified via device tree.

Signed-off-by: Roger Quadros <rogerq@ti.com>
Acked-by: Alan Stern <stern@rowland.harvard.edu>
---
 .../devicetree/bindings/usb/omap3-ohci.txt         |   17 +++++++++++++++++
 drivers/usb/host/ohci-omap3.c                      |   19 +++++++++++++++++++
 2 files changed, 36 insertions(+), 0 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/usb/omap3-ohci.txt

Comments

Mark Rutland Feb. 11, 2013, 11:46 a.m. UTC | #1
On Thu, Feb 07, 2013 at 04:02:47PM +0000, Roger Quadros wrote:
> Allows the OHCI controller found in OMAP3 and later chips to
> be specified via device tree.
> 
> Signed-off-by: Roger Quadros <rogerq@ti.com>
> Acked-by: Alan Stern <stern@rowland.harvard.edu>
> ---
>  .../devicetree/bindings/usb/omap3-ohci.txt         |   17 +++++++++++++++++
>  drivers/usb/host/ohci-omap3.c                      |   19 +++++++++++++++++++
>  2 files changed, 36 insertions(+), 0 deletions(-)
>  create mode 100644 Documentation/devicetree/bindings/usb/omap3-ohci.txt
> 
> diff --git a/Documentation/devicetree/bindings/usb/omap3-ohci.txt b/Documentation/devicetree/bindings/usb/omap3-ohci.txt
> new file mode 100644
> index 0000000..ad2ace0
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/usb/omap3-ohci.txt
> @@ -0,0 +1,17 @@
> +OMAP HS USB OHCI controller (OMAP3 and later)
> +
> +Required properties:
> +
> +- compatible: should be "ti,ohci-omap3"
> +- reg: should contain one register range i.e. start and length
> +- interrupt-parent: phandle to the interrupt controller

I'm not sure that needs to be documented as a required property. It's a
standard property, and if it's defined for the parent node, you won't need it
here.

Otherwise, this looks fine to me.

Thanks,
Mark.
Roger Quadros Feb. 11, 2013, 3:22 p.m. UTC | #2
On 02/11/2013 01:46 PM, Mark Rutland wrote:
> On Thu, Feb 07, 2013 at 04:02:47PM +0000, Roger Quadros wrote:
>> Allows the OHCI controller found in OMAP3 and later chips to
>> be specified via device tree.
>>
>> Signed-off-by: Roger Quadros <rogerq@ti.com>
>> Acked-by: Alan Stern <stern@rowland.harvard.edu>
>> ---
>>  .../devicetree/bindings/usb/omap3-ohci.txt         |   17 +++++++++++++++++
>>  drivers/usb/host/ohci-omap3.c                      |   19 +++++++++++++++++++
>>  2 files changed, 36 insertions(+), 0 deletions(-)
>>  create mode 100644 Documentation/devicetree/bindings/usb/omap3-ohci.txt
>>
>> diff --git a/Documentation/devicetree/bindings/usb/omap3-ohci.txt b/Documentation/devicetree/bindings/usb/omap3-ohci.txt
>> new file mode 100644
>> index 0000000..ad2ace0
>> --- /dev/null
>> +++ b/Documentation/devicetree/bindings/usb/omap3-ohci.txt
>> @@ -0,0 +1,17 @@
>> +OMAP HS USB OHCI controller (OMAP3 and later)
>> +
>> +Required properties:
>> +
>> +- compatible: should be "ti,ohci-omap3"
>> +- reg: should contain one register range i.e. start and length
>> +- interrupt-parent: phandle to the interrupt controller
> 
> I'm not sure that needs to be documented as a required property. It's a
> standard property, and if it's defined for the parent node, you won't need it
> here.

The last time I tried without 'interrupt-parent' it complained. Doesn't do it anymore.
Maybe I did something wrong the last time. I'll remove it.

> 
> Otherwise, this looks fine to me.

Thanks. I'll add your reviewed-by tag after addressing the above comment.

cheers,
-roger
Mark Rutland Feb. 11, 2013, 3:32 p.m. UTC | #3
> >> +Required properties:
> >> +
> >> +- compatible: should be "ti,ohci-omap3"
> >> +- reg: should contain one register range i.e. start and length
> >> +- interrupt-parent: phandle to the interrupt controller
> > 
> > I'm not sure that needs to be documented as a required property. It's a
> > standard property, and if it's defined for the parent node, you won't need it
> > here.
> 
> The last time I tried without 'interrupt-parent' it complained. Doesn't do it anymore.
> Maybe I did something wrong the last time. I'll remove it.
> 
> > 
> > Otherwise, this looks fine to me.
> 
> Thanks. I'll add your reviewed-by tag after addressing the above comment.

Sure.

Thanks,
Mark.
diff mbox

Patch

diff --git a/Documentation/devicetree/bindings/usb/omap3-ohci.txt b/Documentation/devicetree/bindings/usb/omap3-ohci.txt
new file mode 100644
index 0000000..ad2ace0
--- /dev/null
+++ b/Documentation/devicetree/bindings/usb/omap3-ohci.txt
@@ -0,0 +1,17 @@ 
+OMAP HS USB OHCI controller (OMAP3 and later)
+
+Required properties:
+
+- compatible: should be "ti,ohci-omap3"
+- reg: should contain one register range i.e. start and length
+- interrupt-parent: phandle to the interrupt controller
+- interrupts: description of the interrupt line
+
+Example for OMAP4:
+
+usbhsohci: ohci@4a064800 {
+	compatible = "ti,ohci-omap3", "usb-ohci";
+	reg = <0x4a064800 0x400>;
+	interrupt-parent = <&gic>;
+	interrupts = <0 76 0x4>;
+};
diff --git a/drivers/usb/host/ohci-omap3.c b/drivers/usb/host/ohci-omap3.c
index 5ed28c5..ddfc314 100644
--- a/drivers/usb/host/ohci-omap3.c
+++ b/drivers/usb/host/ohci-omap3.c
@@ -31,6 +31,8 @@ 
 
 #include <linux/platform_device.h>
 #include <linux/pm_runtime.h>
+#include <linux/of.h>
+#include <linux/dma-mapping.h>
 
 /*-------------------------------------------------------------------------*/
 
@@ -112,6 +114,8 @@  static const struct hc_driver ohci_omap3_hc_driver = {
 
 /*-------------------------------------------------------------------------*/
 
+static u64 omap_ohci_dma_mask = DMA_BIT_MASK(32);
+
 /*
  * configure so an HC device and id are always provided
  * always called with process context; sleeping is OK
@@ -159,6 +163,13 @@  static int ohci_hcd_omap3_probe(struct platform_device *pdev)
 		return -ENOMEM;
 	}
 
+	/*
+	 * Right now device-tree probed devices don't get dma_mask set.
+	 * Since shared usb code relies on it, set it here for now.
+	 * Once we have dma capability bindings this can go away.
+	 */
+	if (!pdev->dev.dma_mask)
+		pdev->dev.dma_mask = &omap_ohci_dma_mask;
 
 	hcd = usb_create_hcd(&ohci_omap3_hc_driver, dev,
 			dev_name(dev));
@@ -228,12 +239,20 @@  static void ohci_hcd_omap3_shutdown(struct platform_device *pdev)
 		hcd->driver->shutdown(hcd);
 }
 
+static const struct of_device_id omap_ohci_dt_ids[] = {
+	{ .compatible = "ti,ohci-omap3" },
+	{ }
+};
+
+MODULE_DEVICE_TABLE(of, omap_ohci_dt_ids);
+
 static struct platform_driver ohci_hcd_omap3_driver = {
 	.probe		= ohci_hcd_omap3_probe,
 	.remove		= ohci_hcd_omap3_remove,
 	.shutdown	= ohci_hcd_omap3_shutdown,
 	.driver		= {
 		.name	= "ohci-omap3",
+		.of_match_table = of_match_ptr(omap_ohci_dt_ids),
 	},
 };