diff options
author | Hans de Goede <hdegoede@redhat.com> | 2014-02-07 10:36:42 -0500 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2014-02-07 17:24:24 -0500 |
commit | b1034412570f38d32b88dfd5da5cb2f86b5c321c (patch) | |
tree | 9c7b4628424bc3cc267ee5986a6726c8a8c42d9f | |
parent | a4aeb2117571292f4e002c54b3f91e138722bf7a (diff) |
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>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r-- | Documentation/devicetree/bindings/usb/usb-ohci.txt | 3 | ||||
-rw-r--r-- | drivers/usb/host/ohci-platform.c | 27 |
2 files changed, 30 insertions, 0 deletions
diff --git a/Documentation/devicetree/bindings/usb/usb-ohci.txt b/Documentation/devicetree/bindings/usb/usb-ohci.txt index 6ba38d990d16..6933b0c6487d 100644 --- a/Documentation/devicetree/bindings/usb/usb-ohci.txt +++ b/Documentation/devicetree/bindings/usb/usb-ohci.txt | |||
@@ -6,6 +6,9 @@ Required properties: | |||
6 | - interrupts : ohci controller interrupt | 6 | - interrupts : ohci controller interrupt |
7 | 7 | ||
8 | Optional properties: | 8 | Optional properties: |
9 | - big-endian-regs : boolean, set this for hcds with big-endian registers | ||
10 | - big-endian-desc : boolean, set this for hcds with big-endian descriptors | ||
11 | - big-endian : boolean, for hcds with big-endian-regs + big-endian-desc | ||
9 | - clocks : a list of phandle + clock specifier pairs | 12 | - clocks : a list of phandle + clock specifier pairs |
10 | - phys : phandle + phy specifier pair | 13 | - phys : phandle + phy specifier pair |
11 | - phy-names : "usb" | 14 | - phy-names : "usb" |
diff --git a/drivers/usb/host/ohci-platform.c b/drivers/usb/host/ohci-platform.c index 49304ddde422..e2c28fd03484 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) | |||
128 | struct resource *res_mem; | 128 | struct resource *res_mem; |
129 | struct usb_ohci_pdata *pdata = dev_get_platdata(&dev->dev); | 129 | struct usb_ohci_pdata *pdata = dev_get_platdata(&dev->dev); |
130 | struct ohci_platform_priv *priv; | 130 | struct ohci_platform_priv *priv; |
131 | struct ohci_hcd *ohci; | ||
131 | int err, irq, clk = 0; | 132 | int err, irq, clk = 0; |
132 | 133 | ||
133 | if (usb_disabled()) | 134 | if (usb_disabled()) |
@@ -164,8 +165,34 @@ static int ohci_platform_probe(struct platform_device *dev) | |||
164 | platform_set_drvdata(dev, hcd); | 165 | platform_set_drvdata(dev, hcd); |
165 | dev->dev.platform_data = pdata; | 166 | dev->dev.platform_data = pdata; |
166 | priv = hcd_to_ohci_priv(hcd); | 167 | priv = hcd_to_ohci_priv(hcd); |
168 | ohci = hcd_to_ohci(hcd); | ||
167 | 169 | ||
168 | if (pdata == &ohci_platform_defaults && dev->dev.of_node) { | 170 | if (pdata == &ohci_platform_defaults && dev->dev.of_node) { |
171 | if (of_property_read_bool(dev->dev.of_node, "big-endian-regs")) | ||
172 | ohci->flags |= OHCI_QUIRK_BE_MMIO; | ||
173 | |||
174 | if (of_property_read_bool(dev->dev.of_node, "big-endian-desc")) | ||
175 | ohci->flags |= OHCI_QUIRK_BE_DESC; | ||
176 | |||
177 | if (of_property_read_bool(dev->dev.of_node, "big-endian")) | ||
178 | ohci->flags |= OHCI_QUIRK_BE_MMIO | OHCI_QUIRK_BE_DESC; | ||
179 | |||
180 | #ifndef CONFIG_USB_OHCI_BIG_ENDIAN_MMIO | ||
181 | if (ohci->flags & OHCI_QUIRK_BE_MMIO) { | ||
182 | dev_err(&dev->dev, | ||
183 | "Error big-endian-regs not compiled in\n"); | ||
184 | err = -EINVAL; | ||
185 | goto err_put_hcd; | ||
186 | } | ||
187 | #endif | ||
188 | #ifndef CONFIG_USB_OHCI_BIG_ENDIAN_DESC | ||
189 | if (ohci->flags & OHCI_QUIRK_BE_DESC) { | ||
190 | dev_err(&dev->dev, | ||
191 | "Error big-endian-desc not compiled in\n"); | ||
192 | err = -EINVAL; | ||
193 | goto err_put_hcd; | ||
194 | } | ||
195 | #endif | ||
169 | priv->phy = devm_phy_get(&dev->dev, "usb"); | 196 | priv->phy = devm_phy_get(&dev->dev, "usb"); |
170 | if (IS_ERR(priv->phy)) { | 197 | if (IS_ERR(priv->phy)) { |
171 | err = PTR_ERR(priv->phy); | 198 | err = PTR_ERR(priv->phy); |