Message ID | 1392964293-13687-4-git-send-email-alistair@popple.id.au (mailing list archive) |
---|---|
State | Superseded |
Headers | show |
On Friday 21 February 2014 17:31:29 Alistair Popple wrote: > > +static const struct of_device_id ohci_of_match[] = { > + { .compatible = "usb-ohci", }, > + {}, > +}; > + > static const struct platform_device_id ohci_platform_table[] = { > { "ohci-platform", 0 }, > { } > @@ -198,6 +209,7 @@ static struct platform_driver ohci_platform_driver = { > .owner = THIS_MODULE, > .name = "ohci-platform", > .pm = &ohci_platform_pm_ops, > + .of_match_table = ohci_of_match, > } > }; > > Linux-next already has a patch to add an of_match_table in this driver, using static const struct of_device_id ohci_platform_ids[] = { { .compatible = "generic-ohci", }, { } }; I think you should just use that string on your platform. Arnd
On Fri, 21 Feb 2014, Alistair Popple wrote: > The IBM Akebono board uses the PPC476GTR SoC which has a OHCI > compliant USB host interface. This patch adds support for it to the > OHCI platform driver. > > As we use device tree to pass platform specific data instead of > platform data we remove the check for platform data and instead > provide reasonable defaults if no platform data is present. This is > similar to what is currently done in ehci-platform.c. > > Signed-off-by: Alistair Popple <alistair@popple.id.au> > Acked-by: Alan Stern <stern@rowland.harvard.edu> As Arnd pointed out, this patch is out of date. See https://git.kernel.org/cgit/linux/kernel/git/gregkh/usb.git/commit/drivers/usb/host/ohci-platform.c?h=usb-next&id=ca52a17ba975dbf47e87c9bc63086aca0cf92806 and https://git.kernel.org/cgit/linux/kernel/git/gregkh/usb.git/commit/drivers/usb/host/ohci-platform.c?h=usb-next&id=ce149c30b9f89d0c9addd1d71ccdb57c1051553b Alan Stern
On Fri, 21 Feb 2014 15:16:52 Arnd Bergmann wrote: > On Friday 21 February 2014 17:31:29 Alistair Popple wrote: > > +static const struct of_device_id ohci_of_match[] = { > > + { .compatible = "usb-ohci", }, > > + {}, > > +}; > > + > > > > static const struct platform_device_id ohci_platform_table[] = { > > > > { "ohci-platform", 0 }, > > { } > > > > @@ -198,6 +209,7 @@ static struct platform_driver ohci_platform_driver = { > > > > .owner = THIS_MODULE, > > .name = "ohci-platform", > > .pm = &ohci_platform_pm_ops, > > > > + .of_match_table = ohci_of_match, > > > > } > > > > }; > > Linux-next already has a patch to add an of_match_table in this driver, > using > > static const struct of_device_id ohci_platform_ids[] = { > { .compatible = "generic-ohci", }, > { } > }; > > I think you should just use that string on your platform. Excellent! I will drop this patch and use "generic-ohci" instead. Thanks for pointing this out. - Alistair > Arnd
diff --git a/drivers/usb/host/ohci-platform.c b/drivers/usb/host/ohci-platform.c index f351ff5..e5a5979 100644 --- a/drivers/usb/host/ohci-platform.c +++ b/drivers/usb/host/ohci-platform.c @@ -23,6 +23,8 @@ #include <linux/usb/ohci_pdriver.h> #include <linux/usb.h> #include <linux/usb/hcd.h> +#include <linux/slab.h> +#include <linux/of.h> #include "ohci.h" @@ -55,6 +57,8 @@ static const struct ohci_driver_overrides platform_overrides __initconst = { .reset = ohci_platform_reset, }; +static struct usb_ohci_pdata ohci_platform_defaults; + static int ohci_platform_probe(struct platform_device *dev) { struct usb_hcd *hcd; @@ -63,14 +67,16 @@ static int ohci_platform_probe(struct platform_device *dev) int irq; int err = -ENOMEM; - if (!pdata) { - WARN_ON(1); - return -ENODEV; - } - if (usb_disabled()) return -ENODEV; + /* + * Platforms using DT don't always provide platform data. + * This should provide reasonable defaults. + */ + if (!pdata) + dev->dev.platform_data = pdata = &ohci_platform_defaults; + irq = platform_get_irq(dev, 0); if (irq < 0) { dev_err(&dev->dev, "no irq provided"); @@ -178,6 +184,11 @@ static int ohci_platform_resume(struct device *dev) #define ohci_platform_resume NULL #endif /* CONFIG_PM */ +static const struct of_device_id ohci_of_match[] = { + { .compatible = "usb-ohci", }, + {}, +}; + static const struct platform_device_id ohci_platform_table[] = { { "ohci-platform", 0 }, { } @@ -198,6 +209,7 @@ static struct platform_driver ohci_platform_driver = { .owner = THIS_MODULE, .name = "ohci-platform", .pm = &ohci_platform_pm_ops, + .of_match_table = ohci_of_match, } };