kernel: update 3.14 to 3.14.18
[openwrt/openwrt.git] / target / linux / sunxi / patches-3.14 / 195-1-ohci-plat-changes.patch
index 2fb19288884c2874c388d971ec5b6783347886c1..fb4c87ea9e0350e32e5fec9ce6b1c05dfd4d92bc 100644 (file)
@@ -19,20 +19,20 @@ Acked-by: Alan Stern <stern@rowland.harvard.edu>
  2 files changed, 162 insertions(+), 22 deletions(-)
  create mode 100644 Documentation/devicetree/bindings/usb/usb-ohci.txt
 
-diff --git a/Documentation/devicetree/bindings/usb/usb-ohci.txt b/Documentation/devicetree/bindings/usb/usb-ohci.txt
-new file mode 100644
-index 0000000..6ba38d9
 --- /dev/null
 +++ b/Documentation/devicetree/bindings/usb/usb-ohci.txt
-@@ -0,0 +1,22 @@
+@@ -0,0 +1,25 @@
 +USB OHCI controllers
 +
 +Required properties:
-+- compatible : "usb-ohci"
++- compatible : "generic-ohci"
 +- reg : ohci controller register range (address and length)
 +- interrupts : ohci controller interrupt
 +
 +Optional properties:
++- big-endian-regs : boolean, set this for hcds with big-endian registers
++- big-endian-desc : boolean, set this for hcds with big-endian descriptors
++- big-endian : boolean, for hcds with big-endian-regs + big-endian-desc
 +- clocks : a list of phandle + clock specifier pairs
 +- phys : phandle + phy specifier pair
 +- phy-names : "usb"
@@ -40,15 +40,13 @@ index 0000000..6ba38d9
 +Example:
 +
 +      ohci0: usb@01c14400 {
-+              compatible = "allwinner,sun4i-a10-ohci", "usb-ohci";
++              compatible = "allwinner,sun4i-a10-ohci", "generic-ohci";
 +              reg = <0x01c14400 0x100>;
 +              interrupts = <64>;
 +              clocks = <&usb_clk 6>, <&ahb_gates 2>;
 +              phys = <&usbphy 1>;
 +              phy-names = "usb";
 +      };
-diff --git a/drivers/usb/host/ohci-platform.c b/drivers/usb/host/ohci-platform.c
-index 68f674c..49304dd 100644
 --- a/drivers/usb/host/ohci-platform.c
 +++ b/drivers/usb/host/ohci-platform.c
 @@ -3,6 +3,7 @@
@@ -88,7 +86,7 @@ index 68f674c..49304dd 100644
  
  static const char hcd_name[] = "ohci-platform";
  
-@@ -48,11 +59,67 @@ static int ohci_platform_reset(struct usb_hcd *hcd)
+@@ -48,11 +59,67 @@ static int ohci_platform_reset(struct us
        return ohci_setup(hcd);
  }
  
@@ -158,7 +156,7 @@ index 68f674c..49304dd 100644
  };
  
  static int ohci_platform_probe(struct platform_device *dev)
-@@ -60,17 +127,23 @@ static int ohci_platform_probe(struct platform_device *dev)
+@@ -60,17 +127,24 @@ static int ohci_platform_probe(struct pl
        struct usb_hcd *hcd;
        struct resource *res_mem;
        struct usb_ohci_pdata *pdata = dev_get_platdata(&dev->dev);
@@ -170,6 +168,7 @@ index 68f674c..49304dd 100644
 -              return -ENODEV;
 -      }
 +      struct ohci_platform_priv *priv;
++      struct ohci_hcd *ohci;
 +      int err, irq, clk = 0;
  
        if (usb_disabled())
@@ -189,7 +188,7 @@ index 68f674c..49304dd 100644
        irq = platform_get_irq(dev, 0);
        if (irq < 0) {
                dev_err(&dev->dev, "no irq provided");
-@@ -83,17 +156,40 @@ static int ohci_platform_probe(struct platform_device *dev)
+@@ -83,17 +157,66 @@ static int ohci_platform_probe(struct pl
                return -ENXIO;
        }
  
@@ -201,8 +200,34 @@ index 68f674c..49304dd 100644
 +      platform_set_drvdata(dev, hcd);
 +      dev->dev.platform_data = pdata;
 +      priv = hcd_to_ohci_priv(hcd);
++      ohci = hcd_to_ohci(hcd);
 +
 +      if (pdata == &ohci_platform_defaults && dev->dev.of_node) {
++              if (of_property_read_bool(dev->dev.of_node, "big-endian-regs"))
++                      ohci->flags |= OHCI_QUIRK_BE_MMIO;
++
++              if (of_property_read_bool(dev->dev.of_node, "big-endian-desc"))
++                      ohci->flags |= OHCI_QUIRK_BE_DESC;
++
++              if (of_property_read_bool(dev->dev.of_node, "big-endian"))
++                      ohci->flags |= OHCI_QUIRK_BE_MMIO | OHCI_QUIRK_BE_DESC;
++
++#ifndef CONFIG_USB_OHCI_BIG_ENDIAN_MMIO
++              if (ohci->flags & OHCI_QUIRK_BE_MMIO) {
++                      dev_err(&dev->dev,
++                              "Error big-endian-regs not compiled in\n");
++                      err = -EINVAL;
++                      goto err_put_hcd;
++              }
++#endif
++#ifndef CONFIG_USB_OHCI_BIG_ENDIAN_DESC
++              if (ohci->flags & OHCI_QUIRK_BE_DESC) {
++                      dev_err(&dev->dev,
++                              "Error big-endian-desc not compiled in\n");
++                      err = -EINVAL;
++                      goto err_put_hcd;
++              }
++#endif
 +              priv->phy = devm_phy_get(&dev->dev, "usb");
 +              if (IS_ERR(priv->phy)) {
 +                      err = PTR_ERR(priv->phy);
@@ -238,7 +263,7 @@ index 68f674c..49304dd 100644
        }
  
        hcd->rsrc_start = res_mem->start;
-@@ -102,11 +198,11 @@ static int ohci_platform_probe(struct platform_device *dev)
+@@ -102,11 +225,11 @@ static int ohci_platform_probe(struct pl
        hcd->regs = devm_ioremap_resource(&dev->dev, res_mem);
        if (IS_ERR(hcd->regs)) {
                err = PTR_ERR(hcd->regs);
@@ -252,7 +277,7 @@ index 68f674c..49304dd 100644
  
        device_wakeup_enable(hcd->self.controller);
  
-@@ -114,11 +210,17 @@ static int ohci_platform_probe(struct platform_device *dev)
+@@ -114,11 +237,17 @@ static int ohci_platform_probe(struct pl
  
        return err;
  
@@ -272,7 +297,7 @@ index 68f674c..49304dd 100644
  
        return err;
  }
-@@ -127,13 +229,22 @@ static int ohci_platform_remove(struct platform_device *dev)
+@@ -127,13 +256,22 @@ static int ohci_platform_remove(struct p
  {
        struct usb_hcd *hcd = platform_get_drvdata(dev);
        struct usb_ohci_pdata *pdata = dev_get_platdata(&dev->dev);
@@ -296,12 +321,12 @@ index 68f674c..49304dd 100644
        return 0;
  }
  
-@@ -180,6 +291,12 @@ static int ohci_platform_resume(struct device *dev)
+@@ -180,6 +318,12 @@ static int ohci_platform_resume(struct d
  #define ohci_platform_resume  NULL
  #endif /* CONFIG_PM */
  
 +static const struct of_device_id ohci_platform_ids[] = {
-+      { .compatible = "usb-ohci", },
++      { .compatible = "generic-ohci", },
 +      { }
 +};
 +MODULE_DEVICE_TABLE(of, ohci_platform_ids);
@@ -309,7 +334,7 @@ index 68f674c..49304dd 100644
  static const struct platform_device_id ohci_platform_table[] = {
        { "ohci-platform", 0 },
        { }
-@@ -200,6 +317,7 @@ static struct platform_driver ohci_platform_driver = {
+@@ -200,6 +344,7 @@ static struct platform_driver ohci_platf
                .owner  = THIS_MODULE,
                .name   = "ohci-platform",
                .pm     = &ohci_platform_pm_ops,
@@ -317,155 +342,3 @@ index 68f674c..49304dd 100644
        }
  };
  
--- 
-2.0.3
-
-From 8c4b97ea8b66e0fc8bdf648675e6889ce48c5ea7 Mon Sep 17 00:00:00 2001
-From: Hans de Goede <hdegoede@redhat.com>
-Date: Tue, 21 Jan 2014 16:05:47 +0100
-Subject: [PATCH] ohci-platform: Add support for controllers with big-endian
- regs / descriptors
-
-Note this commit uses the same devicetree booleans for this as the ones
-already existing in the usb-ehci bindings, see:
-Documentation/devicetree/bindings/usb/usb-ehci.txt
-
-Signed-off-by: Hans de Goede <hdegoede@redhat.com>
----
- Documentation/devicetree/bindings/usb/usb-ohci.txt |  3 +++
- drivers/usb/host/ohci-platform.c                   | 27 ++++++++++++++++++++++
- 2 files changed, 30 insertions(+)
-
-diff --git a/Documentation/devicetree/bindings/usb/usb-ohci.txt b/Documentation/devicetree/bindings/usb/usb-ohci.txt
-index 6ba38d9..6933b0c 100644
---- a/Documentation/devicetree/bindings/usb/usb-ohci.txt
-+++ b/Documentation/devicetree/bindings/usb/usb-ohci.txt
-@@ -6,6 +6,9 @@ Required properties:
- - interrupts : ohci controller interrupt
- Optional properties:
-+- big-endian-regs : boolean, set this for hcds with big-endian registers
-+- big-endian-desc : boolean, set this for hcds with big-endian descriptors
-+- big-endian : boolean, for hcds with big-endian-regs + big-endian-desc
- - clocks : a list of phandle + clock specifier pairs
- - phys : phandle + phy specifier pair
- - phy-names : "usb"
-diff --git a/drivers/usb/host/ohci-platform.c b/drivers/usb/host/ohci-platform.c
-index 49304dd..e2c28fd 100644
---- a/drivers/usb/host/ohci-platform.c
-+++ b/drivers/usb/host/ohci-platform.c
-@@ -128,6 +128,7 @@ static int ohci_platform_probe(struct platform_device *dev)
-       struct resource *res_mem;
-       struct usb_ohci_pdata *pdata = dev_get_platdata(&dev->dev);
-       struct ohci_platform_priv *priv;
-+      struct ohci_hcd *ohci;
-       int err, irq, clk = 0;
-       if (usb_disabled())
-@@ -164,8 +165,34 @@ static int ohci_platform_probe(struct platform_device *dev)
-       platform_set_drvdata(dev, hcd);
-       dev->dev.platform_data = pdata;
-       priv = hcd_to_ohci_priv(hcd);
-+      ohci = hcd_to_ohci(hcd);
-       if (pdata == &ohci_platform_defaults && dev->dev.of_node) {
-+              if (of_property_read_bool(dev->dev.of_node, "big-endian-regs"))
-+                      ohci->flags |= OHCI_QUIRK_BE_MMIO;
-+
-+              if (of_property_read_bool(dev->dev.of_node, "big-endian-desc"))
-+                      ohci->flags |= OHCI_QUIRK_BE_DESC;
-+
-+              if (of_property_read_bool(dev->dev.of_node, "big-endian"))
-+                      ohci->flags |= OHCI_QUIRK_BE_MMIO | OHCI_QUIRK_BE_DESC;
-+
-+#ifndef CONFIG_USB_OHCI_BIG_ENDIAN_MMIO
-+              if (ohci->flags & OHCI_QUIRK_BE_MMIO) {
-+                      dev_err(&dev->dev,
-+                              "Error big-endian-regs not compiled in\n");
-+                      err = -EINVAL;
-+                      goto err_put_hcd;
-+              }
-+#endif
-+#ifndef CONFIG_USB_OHCI_BIG_ENDIAN_DESC
-+              if (ohci->flags & OHCI_QUIRK_BE_DESC) {
-+                      dev_err(&dev->dev,
-+                              "Error big-endian-desc not compiled in\n");
-+                      err = -EINVAL;
-+                      goto err_put_hcd;
-+              }
-+#endif
-               priv->phy = devm_phy_get(&dev->dev, "usb");
-               if (IS_ERR(priv->phy)) {
-                       err = PTR_ERR(priv->phy);
--- 
-2.0.3
-
-From ddf77eb2ec72a3676dabe17baf6e3b32ce0542e5 Mon Sep 17 00:00:00 2001
-From: Hans de Goede <hdegoede@redhat.com>
-Date: Tue, 11 Feb 2014 11:27:29 +0100
-Subject: [PATCH] ohci-platform: Change compatible string from usb-ohci to
- generic-ohci
-
-The initial versions of the devicetree enablement patches for ohci-platform
-used "ohci-platform" as compatible string. However this was disliked by various
-reviewers because the platform bus is a Linux invention and devicetree is
-supposed to be OS agnostic. After much discussion I gave up and went with
-the generic usb-ohci as requested.
-
-In retro-spect I should have chosen something different, the dts files for many
-existing boards already claim to be compatible with "usb-ohci", ie they have:
-
-       compatible = "ti,ohci-omap3", "usb-ohci";
-
-In theory this should not be a problem since the "ti,ohci-omap3" entry takes
-presedence, but in practice using a conflicting compatible string is an issue,
-because it makes which driver gets used depend on driver registration order.
-
-This patch changes the compatible string claimed by ohci-platform to
-"generic-ohci", avoiding the driver registration / module loading ordering
-problems.
-
-Signed-off-by: Hans de Goede <hdegoede@redhat.com>
----
- Documentation/devicetree/bindings/usb/usb-ohci.txt | 4 ++--
- drivers/usb/host/ohci-platform.c                   | 2 +-
- 2 files changed, 3 insertions(+), 3 deletions(-)
-
-diff --git a/Documentation/devicetree/bindings/usb/usb-ohci.txt b/Documentation/devicetree/bindings/usb/usb-ohci.txt
-index 6933b0c..45f67d9 100644
---- a/Documentation/devicetree/bindings/usb/usb-ohci.txt
-+++ b/Documentation/devicetree/bindings/usb/usb-ohci.txt
-@@ -1,7 +1,7 @@
- USB OHCI controllers
- Required properties:
--- compatible : "usb-ohci"
-+- compatible : "generic-ohci"
- - reg : ohci controller register range (address and length)
- - interrupts : ohci controller interrupt
-@@ -16,7 +16,7 @@ Optional properties:
- Example:
-       ohci0: usb@01c14400 {
--              compatible = "allwinner,sun4i-a10-ohci", "usb-ohci";
-+              compatible = "allwinner,sun4i-a10-ohci", "generic-ohci";
-               reg = <0x01c14400 0x100>;
-               interrupts = <64>;
-               clocks = <&usb_clk 6>, <&ahb_gates 2>;
-diff --git a/drivers/usb/host/ohci-platform.c b/drivers/usb/host/ohci-platform.c
-index e2c28fd..b6ca0b2 100644
---- a/drivers/usb/host/ohci-platform.c
-+++ b/drivers/usb/host/ohci-platform.c
-@@ -319,7 +319,7 @@ static int ohci_platform_resume(struct device *dev)
- #endif /* CONFIG_PM */
- static const struct of_device_id ohci_platform_ids[] = {
--      { .compatible = "usb-ohci", },
-+      { .compatible = "generic-ohci", },
-       { }
- };
- MODULE_DEVICE_TABLE(of, ohci_platform_ids);
--- 
-2.0.3
-