packages: enable AP mode on r8188eu
[openwrt.git] / target / linux / sunxi / patches-3.13 / 180-4-usb-ehci-platform-support-bigendian.patch
1 From 57b5e74a0d7ba5dbf77ee05a2693635faba5fe30 Mon Sep 17 00:00:00 2001
2 From: Hans de Goede <hdegoede@redhat.com>
3 Date: Tue, 21 Jan 2014 16:20:53 +0100
4 Subject: [PATCH] ehci-platform: Add support for controllers with big-endian
5  regs / descriptors
6
7 This uses the already documented devicetree booleans for this, see:
8 Documentation/devicetree/bindings/usb/usb-ehci.txt
9
10 Signed-off-by: Hans de Goede <hdegoede@redhat.com>
11 ---
12  drivers/usb/host/ehci-platform.c | 33 +++++++++++++++++++++++++++++++--
13  1 file changed, 31 insertions(+), 2 deletions(-)
14
15 diff --git a/drivers/usb/host/ehci-platform.c b/drivers/usb/host/ehci-platform.c
16 index 5ebd0b7..8fde649 100644
17 --- a/drivers/usb/host/ehci-platform.c
18 +++ b/drivers/usb/host/ehci-platform.c
19 @@ -55,8 +55,10 @@ static int ehci_platform_reset(struct usb_hcd *hcd)
20  
21         hcd->has_tt = pdata->has_tt;
22         ehci->has_synopsys_hc_bug = pdata->has_synopsys_hc_bug;
23 -       ehci->big_endian_desc = pdata->big_endian_desc;
24 -       ehci->big_endian_mmio = pdata->big_endian_mmio;
25 +       if (pdata->big_endian_desc)
26 +               ehci->big_endian_desc = 1;
27 +       if (pdata->big_endian_mmio)
28 +               ehci->big_endian_mmio = 1;
29         ehci->ignore_oc = pdata->ignore_oc;
30  
31         if (pdata->pre_setup) {
32 @@ -142,6 +144,7 @@ static int ehci_platform_probe(struct platform_device *dev)
33         struct resource *res_mem;
34         struct usb_ehci_pdata *pdata = dev_get_platdata(&dev->dev);
35         struct ehci_platform_priv *priv;
36 +       struct ehci_hcd *ehci;
37         int err, irq, clk = 0;
38  
39         if (usb_disabled())
40 @@ -177,8 +180,34 @@ static int ehci_platform_probe(struct platform_device *dev)
41         platform_set_drvdata(dev, hcd);
42         dev->dev.platform_data = pdata;
43         priv = hcd_to_ehci_priv(hcd);
44 +       ehci = hcd_to_ehci(hcd);
45  
46         if (pdata == &ehci_platform_defaults && dev->dev.of_node) {
47 +               if (of_property_read_bool(dev->dev.of_node, "big-endian-regs"))
48 +                       ehci->big_endian_mmio = 1;
49 +
50 +               if (of_property_read_bool(dev->dev.of_node, "big-endian-desc"))
51 +                       ehci->big_endian_desc = 1;
52 +
53 +               if (of_property_read_bool(dev->dev.of_node, "big-endian"))
54 +                       ehci->big_endian_mmio = ehci->big_endian_desc = 1;
55 +
56 +#ifndef CONFIG_USB_EHCI_BIG_ENDIAN_MMIO
57 +               if (ehci->big_endian_mmio) {
58 +                       dev_err(&dev->dev,
59 +                               "Error big-endian-regs not compiled in\n");
60 +                       err = -EINVAL;
61 +                       goto err_put_hcd;
62 +               }
63 +#endif
64 +#ifndef CONFIG_USB_EHCI_BIG_ENDIAN_DESC
65 +               if (ehci->big_endian_desc) {
66 +                       dev_err(&dev->dev,
67 +                               "Error big-endian-desc not compiled in\n");
68 +                       err = -EINVAL;
69 +                       goto err_put_hcd;
70 +               }
71 +#endif
72                 priv->phy = devm_phy_get(&dev->dev, "usb");
73                 if (IS_ERR(priv->phy)) {
74                         err = PTR_ERR(priv->phy);
75 -- 
76 1.8.5.5
77