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
7 This uses the already documented devicetree booleans for this, see:
8 Documentation/devicetree/bindings/usb/usb-ehci.txt
10 Signed-off-by: Hans de Goede <hdegoede@redhat.com>
12 drivers/usb/host/ehci-platform.c | 33 +++++++++++++++++++++++++++++++--
13 1 file changed, 31 insertions(+), 2 deletions(-)
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)
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;
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;
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);
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;
50 + if (of_property_read_bool(dev->dev.of_node, "big-endian-desc"))
51 + ehci->big_endian_desc = 1;
53 + if (of_property_read_bool(dev->dev.of_node, "big-endian"))
54 + ehci->big_endian_mmio = ehci->big_endian_desc = 1;
56 +#ifndef CONFIG_USB_EHCI_BIG_ENDIAN_MMIO
57 + if (ehci->big_endian_mmio) {
59 + "Error big-endian-regs not compiled in\n");
64 +#ifndef CONFIG_USB_EHCI_BIG_ENDIAN_DESC
65 + if (ehci->big_endian_desc) {
67 + "Error big-endian-desc not compiled in\n");
72 priv->phy = devm_phy_get(&dev->dev, "usb");
73 if (IS_ERR(priv->phy)) {
74 err = PTR_ERR(priv->phy);