diff options
author | Alan Stern <stern@rowland.harvard.edu> | 2014-02-11 11:26:00 -0500 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2014-02-11 13:39:54 -0800 |
commit | adff52952ef52c4dbfb930727f6f8cfe14d9967c (patch) | |
tree | 8fbaeabb0f629e016ec95bae5460f397c48ccfdb /drivers/usb | |
parent | 843d5e036419bddb4aaf21d60c7ffe437e963166 (diff) |
USB: ohci-platform: check for platform data misconfiguration
The ohci-platform driver checks for misconfigurations in cases where
the Device Tree data specifies big-endian registers or descriptors but
the corresponding driver config settings have not been enabled. As
Jonas Gorski suggested, we may as well apply the same check to general
platform data too.
This requires moving the code that sets the big-endian quirk flags
from the ohci_platform_reset() routine into ohci_platform_probe(), and
moving the checks out of the DT-specific "if" statement clause.
The patch also changes the text of the error messages in an attempt to
make the nature of the error more clear.
Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Reported-by: Jonas Gorski <jogo@openwrt.org>
Acked-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/usb')
-rw-r--r-- | drivers/usb/host/ohci-platform.c | 42 |
1 files changed, 22 insertions, 20 deletions
diff --git a/drivers/usb/host/ohci-platform.c b/drivers/usb/host/ohci-platform.c index b6ca0b25259a..b6002c951c5c 100644 --- a/drivers/usb/host/ohci-platform.c +++ b/drivers/usb/host/ohci-platform.c @@ -47,10 +47,6 @@ static int ohci_platform_reset(struct usb_hcd *hcd) struct usb_ohci_pdata *pdata = dev_get_platdata(&pdev->dev); struct ohci_hcd *ohci = hcd_to_ohci(hcd); - if (pdata->big_endian_desc) - ohci->flags |= OHCI_QUIRK_BE_DESC; - if (pdata->big_endian_mmio) - ohci->flags |= OHCI_QUIRK_BE_MMIO; if (pdata->no_big_frame_no) ohci->flags |= OHCI_QUIRK_FRAME_NO; if (pdata->num_ports) @@ -177,22 +173,6 @@ static int ohci_platform_probe(struct platform_device *dev) 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); @@ -213,6 +193,28 @@ static int ohci_platform_probe(struct platform_device *dev) } } + if (pdata->big_endian_desc) + ohci->flags |= OHCI_QUIRK_BE_DESC; + if (pdata->big_endian_mmio) + ohci->flags |= OHCI_QUIRK_BE_MMIO; + +#ifndef CONFIG_USB_OHCI_BIG_ENDIAN_MMIO + if (ohci->flags & OHCI_QUIRK_BE_MMIO) { + dev_err(&dev->dev, + "Error: CONFIG_USB_OHCI_BIG_ENDIAN_MMIO not set\n"); + err = -EINVAL; + goto err_put_clks; + } +#endif +#ifndef CONFIG_USB_OHCI_BIG_ENDIAN_DESC + if (ohci->flags & OHCI_QUIRK_BE_DESC) { + dev_err(&dev->dev, + "Error: CONFIG_USB_OHCI_BIG_ENDIAN_DESC not set\n"); + err = -EINVAL; + goto err_put_clks; + } +#endif + if (pdata->power_on) { err = pdata->power_on(dev); if (err < 0) |