Changeset 30480
- Timestamp:
- 2012-02-12T17:38:10+01:00 (6 years ago)
- Location:
- trunk/target/linux/brcm47xx/patches-3.2
- Files:
-
- 1 added
- 1 deleted
- 6 moved
Legend:
- Unmodified
- Added
- Removed
-
trunk/target/linux/brcm47xx/patches-3.2/181-USB-OHCI-Add-a-generic-platform-device-driver.patch
r30479 r30480 1 From 14297ee700e1c2e04a35466304f9a3c5e1387146Mon Sep 17 00:00:00 20011 From 2232a2ab6015496fecdfad68a9d6794312a9b2f2 Mon Sep 17 00:00:00 2001 2 2 From: Hauke Mehrtens <hauke@hauke-m.de> 3 3 Date: Sat, 26 Nov 2011 21:20:54 +0100 4 Subject: [PATCH 1 7/30] USB: OHCI: Add a generic platform device driver4 Subject: [PATCH 181/186] USB: OHCI: Add a generic platform device driver 5 5 6 6 This adds a generic driver for platform devices. It works like the PCI … … 12 12 --- 13 13 drivers/usb/host/Kconfig | 10 ++ 14 drivers/usb/host/ohci-hcd.c | 21 ++++-15 drivers/usb/host/ohci-platform.c | 1 97++++++++++++++++++++++++++++++++++++++16 3 files changed, 227 insertions(+), 1deletions(-)14 drivers/usb/host/ohci-hcd.c | 5 + 15 drivers/usb/host/ohci-platform.c | 183 ++++++++++++++++++++++++++++++++++++++ 16 3 files changed, 198 insertions(+), 0 deletions(-) 17 17 create mode 100644 drivers/usb/host/ohci-platform.c 18 18 … … 44 44 +#ifdef CONFIG_USB_OHCI_HCD_PLATFORM 45 45 +#include "ohci-platform.c" 46 +#define PLATFORM_ OHCI_DRIVERohci_platform_driver46 +#define PLATFORM_DRIVER ohci_platform_driver 47 47 +#endif 48 48 + … … 50 50 !defined(PLATFORM_DRIVER) && \ 51 51 !defined(OMAP1_PLATFORM_DRIVER) && \ 52 @@ -1125,7 +1130,8 @@ MODULE_LICENSE ("GPL");53 !defined(PS3_SYSTEM_BUS_DRIVER) && \54 !defined(SM501_OHCI_DRIVER) && \55 !defined(TMIO_OHCI_DRIVER) && \56 - !defined(SSB_OHCI_DRIVER)57 + !defined(SSB_OHCI_DRIVER) && \58 + !defined(PLATFORM_OHCI_DRIVER)59 #error "missing bus glue for ohci-hcd"60 #endif61 62 @@ -1209,9 +1215,19 @@ static int __init ohci_hcd_mod_init(void63 goto error_tmio;64 #endif65 66 +#ifdef PLATFORM_OHCI_DRIVER67 + retval = platform_driver_register(&PLATFORM_OHCI_DRIVER);68 + if (retval)69 + goto error_platform;70 +#endif71 +72 return retval;73 74 /* Error path */75 +#ifdef PLATFORM_OHCI_DRIVER76 + platform_driver_unregister(&PLATFORM_OHCI_DRIVER);77 + error_platform:78 +#endif79 #ifdef TMIO_OHCI_DRIVER80 platform_driver_unregister(&TMIO_OHCI_DRIVER);81 error_tmio:82 @@ -1265,6 +1281,9 @@ module_init(ohci_hcd_mod_init);83 84 static void __exit ohci_hcd_mod_exit(void)85 {86 +#ifdef PLATFORM_OHCI_DRIVER87 + platform_driver_unregister(&PLATFORM_OHCI_DRIVER);88 +#endif89 #ifdef TMIO_OHCI_DRIVER90 platform_driver_unregister(&TMIO_OHCI_DRIVER);91 #endif92 52 --- /dev/null 93 53 +++ b/drivers/usb/host/ohci-platform.c 94 @@ -0,0 +1,1 97@@54 @@ -0,0 +1,183 @@ 95 55 +/* 96 56 + * Generic platform ohci driver 97 57 + * 98 58 + * Copyright 2007 Michael Buesch <m@bues.ch> 99 + * Copyright 2011 Hauke Mehrtens <hauke@hauke-m.de>59 + * Copyright 2011-2012 Hauke Mehrtens <hauke@hauke-m.de> 100 60 + * 61 + * Derived from the OCHI-SSB driver 101 62 + * Derived from the OHCI-PCI driver 102 63 + * Copyright 1999 Roman Weissgaerber … … 108 69 + */ 109 70 +#include <linux/platform_device.h> 71 +#include <linux/usb/hci_driver.h> 110 72 + 111 73 +static int ohci_platform_reset(struct usb_hcd *hcd) … … 135 97 + 136 98 +static const struct hc_driver ohci_platform_hc_driver = { 137 + .description = "platform-usb-ohci",99 + .description = hcd_name, 138 100 + .product_desc = "Generic Platform OHCI Controller", 139 101 + .hcd_priv_size = sizeof(struct ohci_hcd), … … 163 125 +}; 164 126 + 165 +static int ohci_platform_attach(struct platform_device *dev)127 +static int __devinit ohci_platform_probe(struct platform_device *dev) 166 128 +{ 167 129 + struct usb_hcd *hcd; 168 + struct resource *res_irq, *res_mem; 130 + struct resource *res_mem; 131 + int irq; 169 132 + int err = -ENOMEM; 133 + 134 + if (usb_disabled()) 135 + return -ENODEV; 136 + 137 + irq = platform_get_irq(dev, 0); 138 + if (irq < 0) { 139 + pr_err("no irq provieded"); 140 + return irq; 141 + } 142 + 143 + res_mem = platform_get_resource(dev, IORESOURCE_MEM, 0); 144 + if (!res_mem) { 145 + pr_err("no memory recourse provieded"); 146 + return -ENXIO; 147 + } 170 148 + 171 149 + hcd = usb_create_hcd(&ohci_platform_hc_driver, &dev->dev, 172 150 + dev_name(&dev->dev)); 173 151 + if (!hcd) 174 + goto err_return; 175 + 176 + res_irq = platform_get_resource(dev, IORESOURCE_IRQ, 0); 177 + if (!res_irq) { 178 + err = -ENXIO; 179 + goto err_return; 180 + } 181 + res_mem = platform_get_resource(dev, IORESOURCE_MEM, 0); 182 + if (!res_mem) { 183 + err = -ENXIO; 184 + goto err_return; 185 + } 152 + return -ENOMEM; 153 + 186 154 + hcd->rsrc_start = res_mem->start; 187 + hcd->rsrc_len = res_mem->end - res_mem->start + 1; 155 + hcd->rsrc_len = resource_size(res_mem); 156 + 157 + if (!request_mem_region(hcd->rsrc_start, hcd->rsrc_len, hcd_name)) { 158 + pr_err("controller already in use"); 159 + err = -EBUSY; 160 + goto err_put_hcd; 161 + } 188 162 + 189 163 + hcd->regs = ioremap_nocache(hcd->rsrc_start, hcd->rsrc_len); 190 164 + if (!hcd->regs) 191 + goto err_ put_hcd;192 + err = usb_add_hcd(hcd, res_irq->start, IRQF_SHARED);165 + goto err_release_region; 166 + err = usb_add_hcd(hcd, irq, IRQF_SHARED); 193 167 + if (err) 194 168 + goto err_iounmap; … … 200 174 +err_iounmap: 201 175 + iounmap(hcd->regs); 176 +err_release_region: 177 + release_mem_region(hcd->rsrc_start, hcd->rsrc_len); 202 178 +err_put_hcd: 203 179 + usb_put_hcd(hcd); 204 +err_return: 205 + return err; 206 +} 207 + 208 +static int ohci_platform_probe(struct platform_device *dev) 209 +{ 210 + int err; 211 + 212 + if (usb_disabled()) 213 + return -ENODEV; 214 + 215 + /* We currently always attach BCMA_DEV_USB11_HOSTDEV 216 + * as HOST OHCI. If we want to attach it as Client device, 217 + * we must branch here and call into the (yet to 218 + * be written) Client mode driver. Same for remove(). */ 219 + 220 + err = ohci_platform_attach(dev); 221 + 222 + return err; 223 +} 224 + 225 +static int ohci_platform_remove(struct platform_device *dev) 226 +{ 227 + struct usb_hcd *hcd; 228 + 229 + hcd = platform_get_drvdata(dev); 230 + if (!hcd) 231 + return -ENODEV; 180 + return err; 181 +} 182 + 183 +static int __devexit ohci_platform_remove(struct platform_device *dev) 184 +{ 185 + struct usb_hcd *hcd = platform_get_drvdata(dev); 232 186 + 233 187 + usb_remove_hcd(hcd); … … 235 189 + release_mem_region(hcd->rsrc_start, hcd->rsrc_len); 236 190 + usb_put_hcd(hcd); 191 + platform_set_drvdata(dev, NULL); 237 192 + 238 193 + return 0; 239 194 +} 240 195 + 241 +static void ohci_platform_shutdown(struct platform_device *dev)242 +{243 + struct usb_hcd *hcd;244 +245 + hcd = platform_get_drvdata(dev);246 + if (!hcd)247 + return;248 +249 + if (hcd->driver->shutdown)250 + hcd->driver->shutdown(hcd);251 +}252 +253 196 +#ifdef CONFIG_PM 254 197 + 255 +static int ohci_platform_suspend(struct platform_device *dev, 256 + pm_message_t state) 257 +{ 258 + 198 +static int ohci_platform_suspend(struct device *dev) 199 +{ 259 200 + return 0; 260 201 +} 261 202 + 262 +static int ohci_platform_resume(struct platform_device *dev)263 +{ 264 + struct usb_hcd *hcd = platform_get_drvdata(dev);203 +static int ohci_platform_resume(struct device *dev) 204 +{ 205 + struct usb_hcd *hcd = dev_get_drvdata(dev); 265 206 + 266 207 + ohci_finish_controller_resume(hcd); … … 279 220 +MODULE_DEVICE_TABLE(platform, ohci_platform_table); 280 221 + 222 +static const struct dev_pm_ops ohci_platform_pm_ops = { 223 + .suspend = ohci_platform_suspend, 224 + .resume = ohci_platform_resume, 225 +}; 226 + 281 227 +static struct platform_driver ohci_platform_driver = { 282 228 + .id_table = ohci_platform_table, 283 229 + .probe = ohci_platform_probe, 284 + .remove = ohci_platform_remove, 285 + .shutdown = ohci_platform_shutdown, 286 + .suspend = ohci_platform_suspend, 287 + .resume = ohci_platform_resume, 230 + .remove = __devexit_p(ohci_platform_remove), 231 + .shutdown = usb_hcd_platform_shutdown, 288 232 + .driver = { 233 + .owner = THIS_MODULE, 289 234 + .name = "ohci-platform", 290 + } 291 +}; 235 + .pm = &ohci_platform_pm_ops, 236 + } 237 +}; -
trunk/target/linux/brcm47xx/patches-3.2/182-USB-EHCI-Add-a-generic-platform-device-driver.patch
r30479 r30480 1 From 2ade1c32109d2f17fdfc0b414411d4ee7f828706Mon Sep 17 00:00:00 20011 From 1be00523336ac484c52681f838dfb8a76e8531cd Mon Sep 17 00:00:00 2001 2 2 From: Hauke Mehrtens <hauke@hauke-m.de> 3 3 Date: Sat, 26 Nov 2011 21:28:56 +0100 4 Subject: [PATCH 18 /30] USB: EHCI: Add a generic platform device driver4 Subject: [PATCH 182/186] USB: EHCI: Add a generic platform device driver 5 5 6 6 This adds a generic driver for platform devices. It works like the PCI … … 13 13 drivers/usb/host/Kconfig | 10 ++ 14 14 drivers/usb/host/ehci-hcd.c | 5 + 15 drivers/usb/host/ehci-platform.c | 211++++++++++++++++++++++++++++++++++++++16 3 files changed, 2 26insertions(+), 0 deletions(-)15 drivers/usb/host/ehci-platform.c | 199 ++++++++++++++++++++++++++++++++++++++ 16 3 files changed, 214 insertions(+), 0 deletions(-) 17 17 create mode 100644 drivers/usb/host/ehci-platform.c 18 18 … … 52 52 --- /dev/null 53 53 +++ b/drivers/usb/host/ehci-platform.c 54 @@ -0,0 +1, 211@@54 @@ -0,0 +1,199 @@ 55 55 +/* 56 56 + * Generic platform ehci driver 57 57 + * 58 58 + * Copyright 2007 Steven Brown <sbrown@cortland.com> 59 + * Copyright 2010-201 1Hauke Mehrtens <hauke@hauke-m.de>59 + * Copyright 2010-2012 Hauke Mehrtens <hauke@hauke-m.de> 60 60 + * 61 61 + * Derived from the ohci-ssb driver 62 + * Copyright 2007 Michael Buesch <m b@bu3sch.de>62 + * Copyright 2007 Michael Buesch <m@bues.ch> 63 63 + * 64 64 + * Derived from the EHCI-PCI driver … … 74 74 + */ 75 75 +#include <linux/platform_device.h> 76 +#include <linux/usb/hci_driver.h> 76 77 + 77 78 +static int ehci_platform_reset(struct usb_hcd *hcd) 78 79 +{ 80 + struct platform_device *pdev = to_platform_device(hcd->self.controller); 81 + struct usb_hci_pdata *pdata = pdev->dev.platform_data; 79 82 + struct ehci_hcd *ehci = hcd_to_ehci(hcd); 83 + int caps_offset = 0; 84 + int flags = 0; 80 85 + int retval; 81 86 + 82 + ehci->caps = hcd->regs; 83 + ehci->regs = hcd->regs + 84 + HC_LENGTH(ehci, ehci_readl(ehci, &ehci->caps->hc_capbase)); 85 + 86 + dbg_hcs_params(ehci, "reset"); 87 + dbg_hcc_params(ehci, "reset"); 88 + 89 + /* cache this readonly data; minimize chip reads */ 90 + ehci->hcs_params = ehci_readl(ehci, &ehci->caps->hcs_params); 91 + 92 + retval = ehci_halt(ehci); 87 + if (pdata) { 88 + caps_offset = pdata->caps_offset; 89 + flags = pdata->flags; 90 + } 91 + 92 + if (flags & USB_HCI_PDATA_HAS_TT_SET) 93 + hcd->has_tt = pdata->has_tt; 94 + 95 + ehci->caps = hcd->regs + caps_offset; 96 + retval = ehci_setup(hcd); 93 97 + if (retval) 94 98 + return retval; 95 99 + 96 + /* data structure init */ 97 + retval = ehci_init(hcd); 98 + if (retval) 99 + return retval; 100 + 101 + ehci_reset(ehci); 102 + 103 + ehci_port_power(ehci, 1); 104 + 105 + return retval; 100 + if (flags & USB_HCI_PDATA_PORT_POWER_SET) 101 + ehci_port_power(ehci, pdata->power_set_is_on); 102 + 103 + return 0; 106 104 +} 107 105 + 108 106 +static const struct hc_driver ehci_platform_hc_driver = { 109 + .description = "platform-usb-ehci",107 + .description = hcd_name, 110 108 + .product_desc = "Generic Platform EHCI Controller", 111 109 + .hcd_priv_size = sizeof(struct ehci_hcd), … … 140 138 +}; 141 139 + 142 +static int ehci_platform_attach(struct platform_device *dev)140 +static int __devinit ehci_platform_probe(struct platform_device *dev) 143 141 +{ 144 142 + struct usb_hcd *hcd; 145 + struct resource *res_irq, *res_mem; 143 + struct resource *res_mem; 144 + int irq; 146 145 + int err = -ENOMEM; 146 + 147 + if (usb_disabled()) 148 + return -ENODEV; 149 + 150 + irq = platform_get_irq(dev, 0); 151 + if (irq < 0) { 152 + pr_err("no irq provieded"); 153 + return irq; 154 + } 155 + res_mem = platform_get_resource(dev, IORESOURCE_MEM, 0); 156 + if (!res_mem) { 157 + pr_err("no memory recourse provieded"); 158 + return -ENXIO; 159 + } 147 160 + 148 161 + hcd = usb_create_hcd(&ehci_platform_hc_driver, &dev->dev, 149 162 + dev_name(&dev->dev)); 150 163 + if (!hcd) 151 + goto err_return; 152 + 153 + res_irq = platform_get_resource(dev, IORESOURCE_IRQ, 0); 154 + if (!res_irq) { 155 + err = -ENXIO; 156 + goto err_return; 157 + } 158 + res_mem = platform_get_resource(dev, IORESOURCE_MEM, 0); 159 + if (!res_mem) { 160 + err = -ENXIO; 161 + goto err_return; 162 + } 164 + return -ENOMEM; 165 + 163 166 + hcd->rsrc_start = res_mem->start; 164 + hcd->rsrc_len = res_mem->end - res_mem->start + 1; 165 + 166 + /* 167 + * start & size modified per sbutils.c 168 + */ 167 + hcd->rsrc_len = resource_size(res_mem); 168 + 169 + if (!request_mem_region(hcd->rsrc_start, hcd->rsrc_len, hcd_name)) { 170 + pr_err("controller already in use"); 171 + err = -EBUSY; 172 + goto err_put_hcd; 173 + } 174 + 169 175 + hcd->regs = ioremap_nocache(hcd->rsrc_start, hcd->rsrc_len); 170 176 + if (!hcd->regs) 171 + goto err_ put_hcd;172 + err = usb_add_hcd(hcd, res_irq->start, IRQF_SHARED);177 + goto err_release_region; 178 + err = usb_add_hcd(hcd, irq, IRQF_SHARED); 173 179 + if (err) 174 180 + goto err_iounmap; … … 180 186 +err_iounmap: 181 187 + iounmap(hcd->regs); 188 +err_release_region: 189 + release_mem_region(hcd->rsrc_start, hcd->rsrc_len); 182 190 +err_put_hcd: 183 191 + usb_put_hcd(hcd); 184 +err_return:185 192 + return err; 186 193 +} 187 194 + 188 +static int ehci_platform_probe(struct platform_device *dev) 189 +{ 190 + int err; 191 + 192 + if (usb_disabled()) 193 + return -ENODEV; 194 + 195 + err = ehci_platform_attach(dev); 196 + 197 + return err; 198 +} 199 + 200 +static int ehci_platform_remove(struct platform_device *dev) 201 +{ 202 + struct usb_hcd *hcd; 203 + 204 + hcd = platform_get_drvdata(dev); 205 + if (!hcd) 206 + return -ENODEV; 195 +static int __devexit ehci_platform_remove(struct platform_device *dev) 196 +{ 197 + struct usb_hcd *hcd = platform_get_drvdata(dev); 207 198 + 208 199 + usb_remove_hcd(hcd); … … 210 201 + release_mem_region(hcd->rsrc_start, hcd->rsrc_len); 211 202 + usb_put_hcd(hcd); 212 + 213 + return 0; 214 +} 215 + 216 +static void ehci_platform_shutdown(struct platform_device *dev) 217 +{ 218 + struct usb_hcd *hcd; 219 + 220 + hcd = platform_get_drvdata(dev); 221 + if (!hcd) 222 + return; 223 + 224 + if (hcd->driver->shutdown) 225 + hcd->driver->shutdown(hcd); 203 + platform_set_drvdata(dev, NULL); 204 + 205 + return 0; 226 206 +} 227 207 + 228 208 +#ifdef CONFIG_PM 229 209 + 230 +static int ehci_platform_suspend(struct platform_device *dev, 231 + pm_message_t state) 232 +{ 233 + return 0; 234 +} 235 + 236 +static int ehci_platform_resume(struct platform_device *dev) 237 +{ 238 + struct usb_hcd *hcd = platform_get_drvdata(dev); 239 + 240 + ehci_finish_controller_resume(hcd); 210 +static int ehci_platform_suspend(struct device *dev) 211 +{ 212 + struct usb_hcd *hcd = dev_get_drvdata(dev); 213 + bool wakeup = device_may_wakeup(dev); 214 + 215 + ehci_prepare_ports_for_controller_suspend(hcd_to_ehci(hcd), wakeup); 216 + return 0; 217 +} 218 + 219 +static int ehci_platform_resume(struct device *dev) 220 +{ 221 + struct usb_hcd *hcd = dev_get_drvdata(dev); 222 + 223 + ehci_prepare_ports_for_controller_resume(hcd_to_ehci(hcd)); 241 224 + return 0; 242 225 +} … … 253 236 +MODULE_DEVICE_TABLE(platform, ehci_platform_table); 254 237 + 238 +static const struct dev_pm_ops ehci_platform_pm_ops = { 239 + .suspend = ehci_platform_suspend, 240 + .resume = ehci_platform_resume, 241 +}; 242 + 255 243 +static struct platform_driver ehci_platform_driver = { 256 244 + .id_table = ehci_platform_table, 257 245 + .probe = ehci_platform_probe, 258 + .remove = ehci_platform_remove, 259 + .shutdown = ehci_platform_shutdown, 260 + .suspend = ehci_platform_suspend, 261 + .resume = ehci_platform_resume, 246 + .remove = __devexit_p(ehci_platform_remove), 247 + .shutdown = usb_hcd_platform_shutdown, 262 248 + .driver = { 249 + .owner = THIS_MODULE, 263 250 + .name = "ehci-platform", 264 + } 265 +}; 251 + .pm = &ehci_platform_pm_ops, 252 + } 253 +}; -
trunk/target/linux/brcm47xx/patches-3.2/183-bcma-scan-for-extra-address-space.patch
r30479 r30480 1 From 1735daf1db79d338dccfc55444b52ed52af79e86Mon Sep 17 00:00:00 20011 From adebff2358c2b631fc04e31ba87eee48e546c655 Mon Sep 17 00:00:00 2001 2 2 From: Hauke Mehrtens <hauke@hauke-m.de> 3 3 Date: Sun, 20 Nov 2011 18:22:35 +0100 4 Subject: [PATCH 1 5/21] bcma: scan for extra address space4 Subject: [PATCH 183/186] bcma: scan for extra address space 5 5 6 6 Some cores like the USB core have two address spaces. In the USB host … … 12 12 Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de> 13 13 --- 14 drivers/bcma/scan.c | 1 7++++++++++++++++-14 drivers/bcma/scan.c | 18 +++++++++++++++++- 15 15 include/linux/bcma/bcma.h | 1 + 16 2 files changed, 1 7insertions(+), 1 deletions(-)16 2 files changed, 18 insertions(+), 1 deletions(-) 17 17 18 18 --- a/drivers/bcma/scan.c 19 19 +++ b/drivers/bcma/scan.c 20 @@ -2 86,6 +286,21@@ static int bcma_get_next_core(struct bcm20 @@ -297,6 +297,22 @@ static int bcma_get_next_core(struct bcm 21 21 return -EILSEQ; 22 22 } … … 27 27 + */ 28 28 + tmp = bcma_erom_get_addr_desc(bus, eromptr, SCAN_ADDR_TYPE_SLAVE, 0); 29 + if (tmp < 0) {29 + if (tmp <= 0) { 30 30 + /* Try again to see if it is a bridge */ 31 + tmp = bcma_erom_get_addr_desc(bus, eromptr, SCAN_ADDR_TYPE_BRIDGE, 0); 32 + if (tmp) { 33 + printk("found bridge\n"); 31 + tmp = bcma_erom_get_addr_desc(bus, eromptr, 32 + SCAN_ADDR_TYPE_BRIDGE, 0); 33 + if (tmp > 0) { 34 + pr_info("found bridge"); 35 + return -ENXIO; 34 36 + } 35 +36 37 + } 37 38 + core->addr = tmp; … … 40 41 for (i = 0; i < ports[1]; i++) { 41 42 for (j = 0; ; j++) { 42 @@ - 298,7 +313,7 @@ static int bcma_get_next_core(struct bcm43 @@ -309,7 +325,7 @@ static int bcma_get_next_core(struct bcm 43 44 break; 44 45 } else { … … 51 52 --- a/include/linux/bcma/bcma.h 52 53 +++ b/include/linux/bcma/bcma.h 53 @@ -13 8,6 +138,7 @@ struct bcma_device {54 u8 core_ index;54 @@ -139,6 +139,7 @@ struct bcma_device { 55 u8 core_unit; 55 56 56 57 u32 addr; -
trunk/target/linux/brcm47xx/patches-3.2/184-USB-Add-driver-for-the-bcma-bus.patch
r30479 r30480 1 From 0da055d81f77272ebc41d4c2cd5f533aa9025cc7Mon Sep 17 00:00:00 20011 From 70fc4b2a6200ef7a1b99a6aa28234b919f23b43c Mon Sep 17 00:00:00 2001 2 2 From: Hauke Mehrtens <hauke@hauke-m.de> 3 3 Date: Sat, 26 Nov 2011 21:33:41 +0100 4 Subject: [PATCH 1 9/30] USB: Add driver for the bcma bus4 Subject: [PATCH 184/186] USB: Add driver for the bcma bus 5 5 6 6 This adds a USB driver using the generic platform device driver for the … … 16 16 drivers/usb/host/Kconfig | 12 ++ 17 17 drivers/usb/host/Makefile | 1 + 18 drivers/usb/host/bcma-hcd.c | 3 09+++++++++++++++++++++++++++++++++++++++++++19 3 files changed, 3 22insertions(+), 0 deletions(-)18 drivers/usb/host/bcma-hcd.c | 328 +++++++++++++++++++++++++++++++++++++++++++ 19 3 files changed, 341 insertions(+), 0 deletions(-) 20 20 create mode 100644 drivers/usb/host/bcma-hcd.c 21 21 … … 47 47 --- /dev/null 48 48 +++ b/drivers/usb/host/bcma-hcd.c 49 @@ -0,0 +1,3 09@@49 @@ -0,0 +1,328 @@ 50 50 +/* 51 51 + * Broadcom specific Advanced Microcontroller Bus … … 72 72 +#include <linux/platform_device.h> 73 73 +#include <linux/module.h> 74 +#include <linux/usb/hci_driver.h> 74 75 + 75 76 +MODULE_AUTHOR("Hauke Mehrtens"); … … 81 82 + struct platform_device *ohci_dev; 82 83 +}; 84 + 85 +/* Wait for bitmask in a register to get set or cleared. 86 + * timeout is in units of ten-microseconds. 87 + */ 88 +static int bcma_wait_bits(struct bcma_device *dev, u16 reg, u32 bitmask, 89 + int timeout) 90 +{ 91 + int i; 92 + u32 val; 93 + 94 + for (i = 0; i < timeout; i++) { 95 + val = bcma_read32(dev, reg); 96 + if ((val & bitmask) == bitmask) 97 + return 0; 98 + udelay(10); 99 + } 100 + 101 + return -ETIMEDOUT; 102 +} 83 103 + 84 104 +static void __devinit bcma_hcd_4716wa(struct bcma_device *dev) … … 138 158 + tmp |= 0x100; 139 159 + bcma_write32(dev, 0x1e0, tmp); 140 + if (bcma_wait_bits(dev, 0x1e0, 1 << 24, 100 , 1))160 + if (bcma_wait_bits(dev, 0x1e0, 1 << 24, 100)) 141 161 + printk(KERN_EMERG "Failed to enable misc PPL!\n"); 142 162 + … … 164 184 + tmp = bcma_read32(dev, 0x524); 165 185 + 166 + if (bcma_wait_bits(dev, 0x528, 0xc000, 10000 , 1)) {186 + if (bcma_wait_bits(dev, 0x528, 0xc000, 10000)) { 167 187 + tmp = bcma_read32(dev, 0x528); 168 188 + printk(KERN_EMERG … … 187 207 +} 188 208 + 209 +static const struct usb_hci_pdata p_data = { 210 + .flags = USB_HCI_PDATA_PORT_POWER_SET, 211 + .power_set_is_on = 1, 212 +}; 213 + 189 214 +static struct platform_device * __devinit 190 215 +bcma_hcd_create_pdev(struct bcma_device *dev, char *name, u32 addr) … … 205 230 + hci_dev = platform_device_alloc(name, 0); 206 231 + if (!hci_dev) 207 + goto err_alloc;232 + return NULL; 208 233 + 209 234 + hci_dev->dev.parent = &dev->dev; … … 214 239 + if (ret) 215 240 + goto err_alloc; 216 + 241 + ret = platform_device_add_data(hci_dev, &p_data, sizeof(p_data)); 242 + if (ret) 243 + goto err_alloc; 217 244 + ret = platform_device_add(hci_dev); 218 + if (ret) { 245 + if (ret) 246 + goto err_alloc; 247 + 248 + return hci_dev; 249 + 219 250 +err_alloc: 220 + platform_device_put(hci_dev); 221 + return ERR_PTR(ret); 222 + } 223 + 224 + return hci_dev; 251 + platform_device_put(hci_dev); 252 + return ERR_PTR(ret); 225 253 +} 226 254 + … … 283 311 +static void __devexit bcma_hcd_remove(struct bcma_device *dev) 284 312 +{ 285 + struct bcma_hcd_device *usb_dev; 286 + struct platform_device *ohci_dev; 287 + struct platform_device *ehci_dev; 288 + 289 + usb_dev = bcma_get_drvdata(dev); 290 + if (!usb_dev) 291 + return; 292 + 293 + ohci_dev = usb_dev->ohci_dev; 294 + ehci_dev = usb_dev->ehci_dev; 295 + 296 + if (ohci_dev) { 313 + struct bcma_hcd_device *usb_dev = bcma_get_drvdata(dev); 314 + struct platform_device *ohci_dev = usb_dev->ohci_dev; 315 + struct platform_device *ehci_dev = usb_dev->ehci_dev; 316 + 317 + if (ohci_dev) 297 318 + platform_device_unregister(ohci_dev); 298 + } 299 + if (ehci_dev) { 319 + if (ehci_dev) 300 320 + platform_device_unregister(ehci_dev); 301 + }302 321 + 303 322 + bcma_core_disable(dev, 0); -
trunk/target/linux/brcm47xx/patches-3.2/185-USB-Add-driver-for-the-ssb-bus.patch
r30479 r30480 1 From ca1db834336ac19edc7a5d342f8acece1ae1feb9Mon Sep 17 00:00:00 20011 From 1840ddf07a452e640549fbd82e2f570da28e377f Mon Sep 17 00:00:00 2001 2 2 From: Hauke Mehrtens <hauke@hauke-m.de> 3 3 Date: Sat, 26 Nov 2011 21:35:17 +0100 4 Subject: [PATCH 20/30] USB: Add driver for the ssb bus4 Subject: [PATCH 185/186] USB: Add driver for the ssb bus 5 5 6 6 This adds a USB driver using the generic platform device driver for the … … 20 20 drivers/usb/host/Kconfig | 12 ++ 21 21 drivers/usb/host/Makefile | 1 + 22 drivers/usb/host/ssb-hcd.c | 27 2++++++++++++++++++++++++++++++++++++++++++++23 3 files changed, 28 5insertions(+), 0 deletions(-)22 drivers/usb/host/ssb-hcd.c | 273 ++++++++++++++++++++++++++++++++++++++++++++ 23 3 files changed, 286 insertions(+), 0 deletions(-) 24 24 create mode 100644 drivers/usb/host/ssb-hcd.c 25 25 … … 51 51 --- /dev/null 52 52 +++ b/drivers/usb/host/ssb-hcd.c 53 @@ -0,0 +1,27 2@@53 @@ -0,0 +1,273 @@ 54 54 +/* 55 55 + * Sonics Silicon Backplane … … 76 76 +#include <linux/platform_device.h> 77 77 +#include <linux/module.h> 78 +#include <linux/usb/hci_driver.h> 78 79 + 79 80 +MODULE_AUTHOR("Hauke Mehrtens"); … … 146 147 +} 147 148 + 149 +static const struct usb_hci_pdata p_data = { 150 + .flags = USB_HCI_PDATA_PORT_POWER_SET, 151 + .power_set_is_on = 1, 152 +}; 153 + 148 154 +static struct platform_device * __devinit 149 155 +ssb_hcd_create_pdev(struct ssb_device *dev, char *name, u32 addr, u32 len) … … 164 170 + hci_dev = platform_device_alloc(name, 0); 165 171 + if (!hci_dev) 166 + goto err_alloc;172 + return NULL; 167 173 + 168 174 + hci_dev->dev.parent = dev->dev; 169 175 + hci_dev->dev.dma_mask = &hci_dev->dev.coherent_dma_mask; 170 176 + 171 + ret = platform_device_add_resources(hci_dev, hci_res, 2); 177 + ret = platform_device_add_resources(hci_dev, hci_res, 178 + ARRAY_SIZE(hci_res)); 172 179 + if (ret) 173 180 + goto err_alloc; 174 + 181 + ret = platform_device_add_data(hci_dev, &p_data, sizeof(p_data)); 182 + if (ret) 183 + goto err_alloc; 175 184 + ret = platform_device_add(hci_dev); 176 + if (ret) { 185 + if (ret) 186 + goto err_alloc; 187 + 188 + return hci_dev; 189 + 177 190 +err_alloc: 178 + platform_device_put(hci_dev); 179 + return ERR_PTR(ret); 180 + } 181 + 182 + return hci_dev; 191 + platform_device_put(hci_dev); 192 + return ERR_PTR(ret); 183 193 +} 184 194 + … … 189 199 + int start, len; 190 200 + u16 chipid_top; 201 + u16 coreid = dev->id.coreid; 191 202 + struct ssb_hcd_device *usb_dev; 192 203 + … … 215 226 + 216 227 + start = ssb_admatch_base(tmp); 217 + len = ssb_admatch_size(tmp);228 + len = (coreid == SSB_DEV_USB20_HOST) ? 0x800 : ssb_admatch_size(tmp); 218 229 + usb_dev->ohci_dev = ssb_hcd_create_pdev(dev, "ohci-platform", start, 219 230 + len); … … 223 234 + } 224 235 + 225 + if ( dev->id.coreid == SSB_DEV_USB20_HOST) {236 + if (coreid == SSB_DEV_USB20_HOST) { 226 237 + start = ssb_admatch_base(tmp) + 0x800; /* ehci core offset */ 227 + len = 0x100; /* ehci reg block size */228 238 + usb_dev->ehci_dev = ssb_hcd_create_pdev(dev, "ehci-platform", 229 239 + start, len); … … 246 256 +static void __devexit ssb_hcd_remove(struct ssb_device *dev) 247 257 +{ 248 + struct ssb_hcd_device *usb_dev; 249 + struct platform_device *ohci_dev; 250 + struct platform_device *ehci_dev; 251 + 252 + usb_dev = ssb_get_drvdata(dev); 253 + if (!usb_dev) 254 + return; 255 + 256 + ohci_dev = usb_dev->ohci_dev; 257 + ehci_dev = usb_dev->ehci_dev; 258 + 259 + if (ohci_dev) { 258 + struct ssb_hcd_device *usb_dev = ssb_get_drvdata(dev); 259 + struct platform_device *ohci_dev = usb_dev->ohci_dev; 260 + struct platform_device *ehci_dev = usb_dev->ehci_dev; 261 + 262 + if (ohci_dev) 260 263 + platform_device_unregister(ohci_dev); 261 + } 262 + if (ehci_dev) { 264 + if (ehci_dev) 263 265 + platform_device_unregister(ehci_dev); 264 + }265 266 + 266 267 + ssb_device_disable(dev, 0); -
trunk/target/linux/brcm47xx/patches-3.2/186-USB-OHCI-remove-old-SSB-OHCI-driver.patch
r30479 r30480 1 From 77190e21ed262397eb924e6d48e12ecf3e9f6316Mon Sep 17 00:00:00 20011 From 57857d7df6c22eaf11e3c67042d55a9546415059 Mon Sep 17 00:00:00 2001 2 2 From: Hauke Mehrtens <hauke@hauke-m.de> 3 3 Date: Sat, 26 Nov 2011 21:36:50 +0100 4 Subject: [PATCH 21/30] USB: OHCI: remove old SSB OHCI driver4 Subject: [PATCH 186/186] USB: OHCI: remove old SSB OHCI driver 5 5 6 6 This is now replaced by the new ssb USB driver, which also supports … … 10 10 --- 11 11 drivers/usb/host/Kconfig | 13 -- 12 drivers/usb/host/ohci-hcd.c | 19---12 drivers/usb/host/ohci-hcd.c | 21 +---- 13 13 drivers/usb/host/ohci-ssb.c | 260 ------------------------------------------- 14 3 files changed, 0 insertions(+), 292deletions(-)14 3 files changed, 1 insertions(+), 293 deletions(-) 15 15 delete mode 100644 drivers/usb/host/ohci-ssb.c 16 16 … … 51 51 #include "ohci-sm501.c" 52 52 #define SM501_OHCI_DRIVER ohci_hcd_sm501_driver 53 @@ -1130,7 +1125,6 @@ MODULE_LICENSE ("GPL"); 53 @@ -1129,8 +1124,7 @@ MODULE_LICENSE ("GPL"); 54 !defined(SA1111_DRIVER) && \ 54 55 !defined(PS3_SYSTEM_BUS_DRIVER) && \ 55 56 !defined(SM501_OHCI_DRIVER) && \ 56 57 - !defined(SSB_OHCI_DRIVER) && \58 !defined(PLATFORM_OHCI_DRIVER)57 - !defined(TMIO_OHCI_DRIVER) && \ 58 - !defined(SSB_OHCI_DRIVER) 59 + !defined(TMIO_OHCI_DRIVER) 59 60 #error "missing bus glue for ohci-hcd" 60 61 #endif 61 @@ -1197,12 +1191,6 @@ static int __init ohci_hcd_mod_init(void 62 63 @@ -1196,12 +1190,6 @@ static int __init ohci_hcd_mod_init(void 62 64 goto error_pci; 63 65 #endif … … 72 74 retval = platform_driver_register(&SM501_OHCI_DRIVER); 73 75 if (retval < 0) 74 @@ -12 36,10 +1224,6 @@ static int __init ohci_hcd_mod_init(void76 @@ -1225,10 +1213,6 @@ static int __init ohci_hcd_mod_init(void 75 77 platform_driver_unregister(&SM501_OHCI_DRIVER); 76 78 error_sm501: … … 83 85 pci_unregister_driver(&PCI_DRIVER); 84 86 error_pci: 85 @@ -12 90,9 +1274,6 @@ static void __exit ohci_hcd_mod_exit(voi87 @@ -1276,9 +1260,6 @@ static void __exit ohci_hcd_mod_exit(voi 86 88 #ifdef SM501_OHCI_DRIVER 87 89 platform_driver_unregister(&SM501_OHCI_DRIVER);
Note: See TracChangeset
for help on using the changeset viewer.