diff options
author | Gabor Juhos <juhosg@openwrt.org> | 2012-12-22 12:11:06 +0000 |
---|---|---|
committer | Gabor Juhos <juhosg@openwrt.org> | 2012-12-22 12:11:06 +0000 |
commit | c0e1a6f34235026ee4f7d375b3a711b8d7eb5b39 (patch) | |
tree | 7237732570eab7327249682635d2d91f7ad68aa0 /target/linux/generic | |
parent | b21458709a78eccd8c072a9af5d6f37e23a5eab2 (diff) | |
download | upstream-c0e1a6f34235026ee4f7d375b3a711b8d7eb5b39.tar.gz upstream-c0e1a6f34235026ee4f7d375b3a711b8d7eb5b39.tar.bz2 upstream-c0e1a6f34235026ee4f7d375b3a711b8d7eb5b39.zip |
generic/3.6: add platform specific power callbacks to {e,o}hci_platform drivers
Backport of upstream commits:
86e4cb35f2260374df4139c2352afe7fe247cb60 usb: host: ehci-platform: BUG_ON() to WARN_ON() on probe
b6dd245c4594482d46507a0bfd100439be367952 usb: host: ohci-platform: BUG_ON() to WARN_ON() on probe
04216bedafb1b3992a6c2b7f1518281d2ba5fc7b usb: host: ehci-platform: add platform specific power callback
e4d37aeb373a5edceecc1dadc76fabbe8bc18e44 usb: host: ohci-platform: addplatform specific power callback
Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
SVN-Revision: 34842
Diffstat (limited to 'target/linux/generic')
4 files changed, 305 insertions, 0 deletions
diff --git a/target/linux/generic/patches-3.6/001-usb-host-ehci-platform-BUG_ON-to-WARN_ON-on-probe.patch b/target/linux/generic/patches-3.6/001-usb-host-ehci-platform-BUG_ON-to-WARN_ON-on-probe.patch new file mode 100644 index 0000000000..88c678f2a8 --- /dev/null +++ b/target/linux/generic/patches-3.6/001-usb-host-ehci-platform-BUG_ON-to-WARN_ON-on-probe.patch @@ -0,0 +1,36 @@ +From 86e4cb35f2260374df4139c2352afe7fe247cb60 Mon Sep 17 00:00:00 2001 +From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> +Date: Mon, 6 Aug 2012 18:06:53 -0700 +Subject: [PATCH] usb: host: ehci-platform: BUG_ON() to WARN_ON() on probe + +Commit 86e4cb35f2260374df4139c2352afe7fe247cb60 upstream. + +usb_ehci_pdata is certainly required in ehci-platform driver. +This patch avoids using BUG_ON() from driver, +and return from probe with WARN_ON() if pdata was NULL. + +Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> +Acked-by: Alan Stern <stern@rowland.harvard.edu> +Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> +--- + drivers/usb/host/ehci-platform.c | 6 +++++- + 1 file changed, 5 insertions(+), 1 deletion(-) + +--- a/drivers/usb/host/ehci-platform.c ++++ b/drivers/usb/host/ehci-platform.c +@@ -82,10 +82,14 @@ static int __devinit ehci_platform_probe + { + struct usb_hcd *hcd; + struct resource *res_mem; ++ struct usb_ehci_pdata *pdata = dev->dev.platform_data; + int irq; + int err = -ENOMEM; + +- BUG_ON(!dev->dev.platform_data); ++ if (!pdata) { ++ WARN_ON(1); ++ return -ENODEV; ++ } + + if (usb_disabled()) + return -ENODEV; diff --git a/target/linux/generic/patches-3.6/002-usb-host-ohci-platform-BUG_ON-to-WARN_ON-on-probe.patch b/target/linux/generic/patches-3.6/002-usb-host-ohci-platform-BUG_ON-to-WARN_ON-on-probe.patch new file mode 100644 index 0000000000..68e8a7a35b --- /dev/null +++ b/target/linux/generic/patches-3.6/002-usb-host-ohci-platform-BUG_ON-to-WARN_ON-on-probe.patch @@ -0,0 +1,36 @@ +From b6dd245c4594482d46507a0bfd100439be367952 Mon Sep 17 00:00:00 2001 +From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> +Date: Mon, 6 Aug 2012 18:07:30 -0700 +Subject: [PATCH] usb: host: ohci-platform: BUG_ON() to WARN_ON() on probe + +Commit b6dd245c4594482d46507a0bfd100439be367952 upstream. + +usb_ohci_pdata is certainly required in ohci-platform driver. +This patch avoids using BUG_ON() from driver, +and return from probe with WARN_ON() if pdata was NULL. + +Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> +Acked-by: Alan Stern <stern@rowland.harvard.edu> +Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> +--- + drivers/usb/host/ohci-platform.c | 6 +++++- + 1 file changed, 5 insertions(+), 1 deletion(-) + +--- a/drivers/usb/host/ohci-platform.c ++++ b/drivers/usb/host/ohci-platform.c +@@ -83,10 +83,14 @@ static int __devinit ohci_platform_probe + { + struct usb_hcd *hcd; + struct resource *res_mem; ++ struct usb_ohci_pdata *pdata = dev->dev.platform_data; + int irq; + int err = -ENOMEM; + +- BUG_ON(!dev->dev.platform_data); ++ if (!pdata) { ++ WARN_ON(1); ++ return -ENODEV; ++ } + + if (usb_disabled()) + return -ENODEV; diff --git a/target/linux/generic/patches-3.6/003-usb-host-ehci-platform-add-platform-specific-power-c.patch b/target/linux/generic/patches-3.6/003-usb-host-ehci-platform-add-platform-specific-power-c.patch new file mode 100644 index 0000000000..12030ebc1c --- /dev/null +++ b/target/linux/generic/patches-3.6/003-usb-host-ehci-platform-add-platform-specific-power-c.patch @@ -0,0 +1,119 @@ +From 04216bedafb1b3992a6c2b7f1518281d2ba5fc7b Mon Sep 17 00:00:00 2001 +From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> +Date: Mon, 6 Aug 2012 18:08:39 -0700 +Subject: [PATCH] usb: host: ehci-platform: add platform specific power callback + +Commit 04216bedafb1b3992a6c2b7f1518281d2ba5fc7b upstream. + +This patch enables to call platform specific power callback function. + +Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> +Acked-by: Alan Stern <stern@rowland.harvard.edu> +Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> +--- + drivers/usb/host/ehci-platform.c | 40 +++++++++++++++++++++++++++++++++++--- + include/linux/usb/ehci_pdriver.h | 8 ++++++++ + 2 files changed, 45 insertions(+), 3 deletions(-) + +--- a/drivers/usb/host/ehci-platform.c ++++ b/drivers/usb/host/ehci-platform.c +@@ -105,10 +105,18 @@ static int __devinit ehci_platform_probe + return -ENXIO; + } + ++ if (pdata->power_on) { ++ err = pdata->power_on(dev); ++ if (err < 0) ++ return err; ++ } ++ + hcd = usb_create_hcd(&ehci_platform_hc_driver, &dev->dev, + dev_name(&dev->dev)); +- if (!hcd) +- return -ENOMEM; ++ if (!hcd) { ++ err = -ENOMEM; ++ goto err_power; ++ } + + hcd->rsrc_start = res_mem->start; + hcd->rsrc_len = resource_size(res_mem); +@@ -136,12 +144,17 @@ err_release_region: + release_mem_region(hcd->rsrc_start, hcd->rsrc_len); + err_put_hcd: + usb_put_hcd(hcd); ++err_power: ++ if (pdata->power_off) ++ pdata->power_off(dev); ++ + return err; + } + + static int __devexit ehci_platform_remove(struct platform_device *dev) + { + struct usb_hcd *hcd = platform_get_drvdata(dev); ++ struct usb_ehci_pdata *pdata = dev->dev.platform_data; + + usb_remove_hcd(hcd); + iounmap(hcd->regs); +@@ -149,6 +162,9 @@ static int __devexit ehci_platform_remov + usb_put_hcd(hcd); + platform_set_drvdata(dev, NULL); + ++ if (pdata->power_off) ++ pdata->power_off(dev); ++ + return 0; + } + +@@ -157,14 +173,32 @@ static int __devexit ehci_platform_remov + static int ehci_platform_suspend(struct device *dev) + { + struct usb_hcd *hcd = dev_get_drvdata(dev); ++ struct usb_ehci_pdata *pdata = dev->platform_data; ++ struct platform_device *pdev = ++ container_of(dev, struct platform_device, dev); + bool do_wakeup = device_may_wakeup(dev); ++ int ret; ++ ++ ret = ehci_suspend(hcd, do_wakeup); + +- return ehci_suspend(hcd, do_wakeup); ++ if (pdata->power_suspend) ++ pdata->power_suspend(pdev); ++ ++ return ret; + } + + static int ehci_platform_resume(struct device *dev) + { + struct usb_hcd *hcd = dev_get_drvdata(dev); ++ struct usb_ehci_pdata *pdata = dev->platform_data; ++ struct platform_device *pdev = ++ container_of(dev, struct platform_device, dev); ++ ++ if (pdata->power_on) { ++ int err = pdata->power_on(pdev); ++ if (err < 0) ++ return err; ++ } + + ehci_resume(hcd, false); + return 0; +--- a/include/linux/usb/ehci_pdriver.h ++++ b/include/linux/usb/ehci_pdriver.h +@@ -41,6 +41,14 @@ struct usb_ehci_pdata { + unsigned big_endian_mmio:1; + unsigned port_power_on:1; + unsigned port_power_off:1; ++ ++ /* Turn on all power and clocks */ ++ int (*power_on)(struct platform_device *pdev); ++ /* Turn off all power and clocks */ ++ void (*power_off)(struct platform_device *pdev); ++ /* Turn on only VBUS suspend power and hotplug detection, ++ * turn off everything else */ ++ void (*power_suspend)(struct platform_device *pdev); + }; + + #endif /* __USB_CORE_EHCI_PDRIVER_H */ diff --git a/target/linux/generic/patches-3.6/004-usb-host-ohci-platform-add-platform-specific-power-c.patch b/target/linux/generic/patches-3.6/004-usb-host-ohci-platform-add-platform-specific-power-c.patch new file mode 100644 index 0000000000..7a4169bb03 --- /dev/null +++ b/target/linux/generic/patches-3.6/004-usb-host-ohci-platform-add-platform-specific-power-c.patch @@ -0,0 +1,114 @@ +From e4d37aeb373a5edceecc1dadc76fabbe8bc18e44 Mon Sep 17 00:00:00 2001 +From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> +Date: Mon, 6 Aug 2012 18:09:10 -0700 +Subject: [PATCH] usb: host: ohci-platform: add platform specific power callback + +Commit e4d37aeb373a5edceecc1dadc76fabbe8bc18e44 upstream. + +This patch enables to call platform specific power callback function. + +Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> +Acked-by: Alan Stern <stern@rowland.harvard.edu> +Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> +--- + drivers/usb/host/ohci-platform.c | 36 ++++++++++++++++++++++++++++++++++-- + include/linux/usb/ohci_pdriver.h | 8 ++++++++ + 2 files changed, 42 insertions(+), 2 deletions(-) + +--- a/drivers/usb/host/ohci-platform.c ++++ b/drivers/usb/host/ohci-platform.c +@@ -107,10 +107,18 @@ static int __devinit ohci_platform_probe + return -ENXIO; + } + ++ if (pdata->power_on) { ++ err = pdata->power_on(dev); ++ if (err < 0) ++ return err; ++ } ++ + hcd = usb_create_hcd(&ohci_platform_hc_driver, &dev->dev, + dev_name(&dev->dev)); +- if (!hcd) +- return -ENOMEM; ++ if (!hcd) { ++ err = -ENOMEM; ++ goto err_power; ++ } + + hcd->rsrc_start = res_mem->start; + hcd->rsrc_len = resource_size(res_mem); +@@ -138,12 +146,17 @@ err_release_region: + release_mem_region(hcd->rsrc_start, hcd->rsrc_len); + err_put_hcd: + usb_put_hcd(hcd); ++err_power: ++ if (pdata->power_off) ++ pdata->power_off(dev); ++ + return err; + } + + static int __devexit ohci_platform_remove(struct platform_device *dev) + { + struct usb_hcd *hcd = platform_get_drvdata(dev); ++ struct usb_ohci_pdata *pdata = dev->dev.platform_data; + + usb_remove_hcd(hcd); + iounmap(hcd->regs); +@@ -151,6 +164,9 @@ static int __devexit ohci_platform_remov + usb_put_hcd(hcd); + platform_set_drvdata(dev, NULL); + ++ if (pdata->power_off) ++ pdata->power_off(dev); ++ + return 0; + } + +@@ -158,12 +174,28 @@ static int __devexit ohci_platform_remov + + static int ohci_platform_suspend(struct device *dev) + { ++ struct usb_ohci_pdata *pdata = dev->platform_data; ++ struct platform_device *pdev = ++ container_of(dev, struct platform_device, dev); ++ ++ if (pdata->power_suspend) ++ pdata->power_suspend(pdev); ++ + return 0; + } + + static int ohci_platform_resume(struct device *dev) + { + struct usb_hcd *hcd = dev_get_drvdata(dev); ++ struct usb_ohci_pdata *pdata = dev->platform_data; ++ struct platform_device *pdev = ++ container_of(dev, struct platform_device, dev); ++ ++ if (pdata->power_on) { ++ int err = pdata->power_on(pdev); ++ if (err < 0) ++ return err; ++ } + + ohci_finish_controller_resume(hcd); + return 0; +--- a/include/linux/usb/ohci_pdriver.h ++++ b/include/linux/usb/ohci_pdriver.h +@@ -33,6 +33,14 @@ struct usb_ohci_pdata { + unsigned big_endian_desc:1; + unsigned big_endian_mmio:1; + unsigned no_big_frame_no:1; ++ ++ /* Turn on all power and clocks */ ++ int (*power_on)(struct platform_device *pdev); ++ /* Turn off all power and clocks */ ++ void (*power_off)(struct platform_device *pdev); ++ /* Turn on only VBUS suspend power and hotplug detection, ++ * turn off everything else */ ++ void (*power_suspend)(struct platform_device *pdev); + }; + + #endif /* __USB_CORE_OHCI_PDRIVER_H */ |