Sebastian Siewior | db11e47 | 2008-04-24 00:37:04 +0200 | [diff] [blame] | 1 | /* |
| 2 | * Glue code for the ISP1760 driver and bus |
| 3 | * Currently there is support for |
| 4 | * - OpenFirmware |
| 5 | * - PCI |
Michael Hennerich | 9da69c6 | 2009-07-15 23:22:54 -0400 | [diff] [blame] | 6 | * - PDEV (generic platform device centralized driver model) |
Sebastian Siewior | db11e47 | 2008-04-24 00:37:04 +0200 | [diff] [blame] | 7 | * |
| 8 | * (c) 2007 Sebastian Siewior <bigeasy@linutronix.de> |
| 9 | * |
| 10 | */ |
| 11 | |
| 12 | #include <linux/usb.h> |
| 13 | #include <linux/io.h> |
Paul Gortmaker | 6eb0de8 | 2011-07-03 16:09:31 -0400 | [diff] [blame] | 14 | #include <linux/module.h> |
Laurent Pinchart | c3cc40c | 2015-01-21 00:55:44 +0200 | [diff] [blame] | 15 | #include <linux/of.h> |
Catalin Marinas | f7e7aa5 | 2009-02-10 16:55:51 +0000 | [diff] [blame] | 16 | #include <linux/platform_device.h> |
Laurent Pinchart | c3cc40c | 2015-01-21 00:55:44 +0200 | [diff] [blame] | 17 | #include <linux/slab.h> |
Michael Hennerich | 9da69c6 | 2009-07-15 23:22:54 -0400 | [diff] [blame] | 18 | #include <linux/usb/isp1760.h> |
Eric Lescouet | 27729aa | 2010-04-24 23:21:52 +0200 | [diff] [blame] | 19 | #include <linux/usb/hcd.h> |
Sebastian Siewior | db11e47 | 2008-04-24 00:37:04 +0200 | [diff] [blame] | 20 | |
Laurent Pinchart | 4b1a577 | 2015-01-21 00:55:57 +0200 | [diff] [blame] | 21 | #include "isp1760-core.h" |
Laurent Pinchart | e19c99e | 2015-01-21 00:55:56 +0200 | [diff] [blame] | 22 | #include "isp1760-regs.h" |
Sebastian Siewior | db11e47 | 2008-04-24 00:37:04 +0200 | [diff] [blame] | 23 | |
Sebastian Andrzej Siewior | ff30bf1 | 2008-11-02 15:25:42 +0100 | [diff] [blame] | 24 | #ifdef CONFIG_PCI |
Sebastian Siewior | db11e47 | 2008-04-24 00:37:04 +0200 | [diff] [blame] | 25 | #include <linux/pci.h> |
| 26 | #endif |
| 27 | |
Sebastian Andrzej Siewior | ff30bf1 | 2008-11-02 15:25:42 +0100 | [diff] [blame] | 28 | #ifdef CONFIG_PCI |
Laurent Pinchart | c770e00 | 2015-01-21 00:55:53 +0200 | [diff] [blame] | 29 | static int isp1761_pci_init(struct pci_dev *dev) |
Sebastian Siewior | db11e47 | 2008-04-24 00:37:04 +0200 | [diff] [blame] | 30 | { |
Laurent Pinchart | c770e00 | 2015-01-21 00:55:53 +0200 | [diff] [blame] | 31 | resource_size_t mem_start; |
| 32 | resource_size_t mem_length; |
Karl Bongers | 6013bbb | 2008-12-01 11:47:40 +0100 | [diff] [blame] | 33 | u8 __iomem *iobase; |
Laurent Pinchart | c770e00 | 2015-01-21 00:55:53 +0200 | [diff] [blame] | 34 | u8 latency, limit; |
| 35 | int retry_count; |
| 36 | u32 reg_data; |
Sebastian Siewior | db11e47 | 2008-04-24 00:37:04 +0200 | [diff] [blame] | 37 | |
Laurent Pinchart | c770e00 | 2015-01-21 00:55:53 +0200 | [diff] [blame] | 38 | /* Grab the PLX PCI shared memory of the ISP 1761 we need */ |
| 39 | mem_start = pci_resource_start(dev, 3); |
| 40 | mem_length = pci_resource_len(dev, 3); |
| 41 | if (mem_length < 0xffff) { |
| 42 | printk(KERN_ERR "memory length for this resource is wrong\n"); |
| 43 | return -ENOMEM; |
| 44 | } |
Sebastian Siewior | db11e47 | 2008-04-24 00:37:04 +0200 | [diff] [blame] | 45 | |
Laurent Pinchart | c770e00 | 2015-01-21 00:55:53 +0200 | [diff] [blame] | 46 | if (!request_mem_region(mem_start, mem_length, "ISP-PCI")) { |
| 47 | printk(KERN_ERR "host controller already in use\n"); |
Sebastian Siewior | db11e47 | 2008-04-24 00:37:04 +0200 | [diff] [blame] | 48 | return -EBUSY; |
| 49 | } |
| 50 | |
Karl Bongers | 6013bbb | 2008-12-01 11:47:40 +0100 | [diff] [blame] | 51 | /* map available memory */ |
Laurent Pinchart | c770e00 | 2015-01-21 00:55:53 +0200 | [diff] [blame] | 52 | iobase = ioremap_nocache(mem_start, mem_length); |
| 53 | if (!iobase) { |
Karl Bongers | 6013bbb | 2008-12-01 11:47:40 +0100 | [diff] [blame] | 54 | printk(KERN_ERR "Error ioremap failed\n"); |
Laurent Pinchart | c770e00 | 2015-01-21 00:55:53 +0200 | [diff] [blame] | 55 | release_mem_region(mem_start, mem_length); |
| 56 | return -ENOMEM; |
Sebastian Siewior | db11e47 | 2008-04-24 00:37:04 +0200 | [diff] [blame] | 57 | } |
| 58 | |
| 59 | /* bad pci latencies can contribute to overruns */ |
| 60 | pci_read_config_byte(dev, PCI_LATENCY_TIMER, &latency); |
| 61 | if (latency) { |
| 62 | pci_read_config_byte(dev, PCI_MAX_LAT, &limit); |
| 63 | if (limit && limit < latency) |
| 64 | pci_write_config_byte(dev, PCI_LATENCY_TIMER, limit); |
| 65 | } |
| 66 | |
| 67 | /* Try to check whether we can access Scratch Register of |
| 68 | * Host Controller or not. The initial PCI access is retried until |
| 69 | * local init for the PCI bridge is completed |
| 70 | */ |
| 71 | retry_count = 20; |
| 72 | reg_data = 0; |
| 73 | while ((reg_data != 0xFACE) && retry_count) { |
| 74 | /*by default host is in 16bit mode, so |
| 75 | * io operations at this stage must be 16 bit |
| 76 | * */ |
Laurent Pinchart | c770e00 | 2015-01-21 00:55:53 +0200 | [diff] [blame] | 77 | writel(0xface, iobase + HC_SCRATCH_REG); |
Sebastian Siewior | db11e47 | 2008-04-24 00:37:04 +0200 | [diff] [blame] | 78 | udelay(100); |
Laurent Pinchart | c770e00 | 2015-01-21 00:55:53 +0200 | [diff] [blame] | 79 | reg_data = readl(iobase + HC_SCRATCH_REG) & 0x0000ffff; |
Sebastian Siewior | db11e47 | 2008-04-24 00:37:04 +0200 | [diff] [blame] | 80 | retry_count--; |
| 81 | } |
| 82 | |
Laurent Pinchart | c770e00 | 2015-01-21 00:55:53 +0200 | [diff] [blame] | 83 | iounmap(iobase); |
| 84 | release_mem_region(mem_start, mem_length); |
Karl Bongers | 6013bbb | 2008-12-01 11:47:40 +0100 | [diff] [blame] | 85 | |
Sebastian Siewior | db11e47 | 2008-04-24 00:37:04 +0200 | [diff] [blame] | 86 | /* Host Controller presence is detected by writing to scratch register |
| 87 | * and reading back and checking the contents are same or not |
| 88 | */ |
| 89 | if (reg_data != 0xFACE) { |
Greg Kroah-Hartman | 802f389 | 2008-08-14 09:37:34 -0700 | [diff] [blame] | 90 | dev_err(&dev->dev, "scratch register mismatch %x\n", reg_data); |
Laurent Pinchart | c770e00 | 2015-01-21 00:55:53 +0200 | [diff] [blame] | 91 | return -ENOMEM; |
Sebastian Siewior | db11e47 | 2008-04-24 00:37:04 +0200 | [diff] [blame] | 92 | } |
| 93 | |
Laurent Pinchart | c770e00 | 2015-01-21 00:55:53 +0200 | [diff] [blame] | 94 | /* Grab the PLX PCI mem maped port start address we need */ |
| 95 | mem_start = pci_resource_start(dev, 0); |
| 96 | mem_length = pci_resource_len(dev, 0); |
| 97 | |
| 98 | if (!request_mem_region(mem_start, mem_length, "ISP1761 IO MEM")) { |
| 99 | printk(KERN_ERR "request region #1\n"); |
| 100 | return -EBUSY; |
| 101 | } |
| 102 | |
| 103 | iobase = ioremap_nocache(mem_start, mem_length); |
| 104 | if (!iobase) { |
| 105 | printk(KERN_ERR "ioremap #1\n"); |
| 106 | release_mem_region(mem_start, mem_length); |
| 107 | return -ENOMEM; |
| 108 | } |
Sebastian Siewior | db11e47 | 2008-04-24 00:37:04 +0200 | [diff] [blame] | 109 | |
Karl Bongers | 6013bbb | 2008-12-01 11:47:40 +0100 | [diff] [blame] | 110 | /* configure PLX PCI chip to pass interrupts */ |
| 111 | #define PLX_INT_CSR_REG 0x68 |
| 112 | reg_data = readl(iobase + PLX_INT_CSR_REG); |
| 113 | reg_data |= 0x900; |
| 114 | writel(reg_data, iobase + PLX_INT_CSR_REG); |
Sebastian Siewior | db11e47 | 2008-04-24 00:37:04 +0200 | [diff] [blame] | 115 | |
Karl Bongers | 6013bbb | 2008-12-01 11:47:40 +0100 | [diff] [blame] | 116 | /* done with PLX IO access */ |
Sebastian Siewior | db11e47 | 2008-04-24 00:37:04 +0200 | [diff] [blame] | 117 | iounmap(iobase); |
Laurent Pinchart | c770e00 | 2015-01-21 00:55:53 +0200 | [diff] [blame] | 118 | release_mem_region(mem_start, mem_length); |
| 119 | |
| 120 | return 0; |
| 121 | } |
| 122 | |
| 123 | static int isp1761_pci_probe(struct pci_dev *dev, |
| 124 | const struct pci_device_id *id) |
| 125 | { |
| 126 | unsigned int devflags = 0; |
| 127 | int ret; |
| 128 | |
Laurent Pinchart | c770e00 | 2015-01-21 00:55:53 +0200 | [diff] [blame] | 129 | if (!dev->irq) |
| 130 | return -ENODEV; |
| 131 | |
| 132 | if (pci_enable_device(dev) < 0) |
| 133 | return -ENODEV; |
| 134 | |
| 135 | ret = isp1761_pci_init(dev); |
| 136 | if (ret < 0) |
| 137 | goto error; |
| 138 | |
| 139 | pci_set_master(dev); |
Karl Bongers | 6013bbb | 2008-12-01 11:47:40 +0100 | [diff] [blame] | 140 | |
Laurent Pinchart | 10feee1 | 2015-01-21 00:55:52 +0200 | [diff] [blame] | 141 | dev->dev.dma_mask = NULL; |
Laurent Pinchart | 667c45c | 2015-01-21 00:55:58 +0200 | [diff] [blame] | 142 | ret = isp1760_register(&dev->resource[3], dev->irq, 0, &dev->dev, |
| 143 | devflags); |
Laurent Pinchart | c770e00 | 2015-01-21 00:55:53 +0200 | [diff] [blame] | 144 | if (ret < 0) |
| 145 | goto error; |
Karl Bongers | 6013bbb | 2008-12-01 11:47:40 +0100 | [diff] [blame] | 146 | |
Laurent Pinchart | c770e00 | 2015-01-21 00:55:53 +0200 | [diff] [blame] | 147 | return 0; |
| 148 | |
| 149 | error: |
| 150 | pci_disable_device(dev); |
| 151 | return ret; |
Sebastian Siewior | db11e47 | 2008-04-24 00:37:04 +0200 | [diff] [blame] | 152 | } |
Karl Bongers | 6013bbb | 2008-12-01 11:47:40 +0100 | [diff] [blame] | 153 | |
Sebastian Siewior | db11e47 | 2008-04-24 00:37:04 +0200 | [diff] [blame] | 154 | static void isp1761_pci_remove(struct pci_dev *dev) |
| 155 | { |
Laurent Pinchart | 10c73f0 | 2015-01-21 00:55:45 +0200 | [diff] [blame] | 156 | isp1760_unregister(&dev->dev); |
Sebastian Siewior | db11e47 | 2008-04-24 00:37:04 +0200 | [diff] [blame] | 157 | |
| 158 | pci_disable_device(dev); |
Sebastian Siewior | db11e47 | 2008-04-24 00:37:04 +0200 | [diff] [blame] | 159 | } |
| 160 | |
| 161 | static void isp1761_pci_shutdown(struct pci_dev *dev) |
| 162 | { |
| 163 | printk(KERN_ERR "ips1761_pci_shutdown\n"); |
| 164 | } |
| 165 | |
Sandhya Bankar | 2b320d8 | 2016-05-04 07:45:37 +0530 | [diff] [blame] | 166 | static const struct pci_device_id isp1760_plx[] = { |
Sebastian Andrzej Siewior | 6c07356 | 2008-11-30 16:50:04 +0100 | [diff] [blame] | 167 | { |
| 168 | .class = PCI_CLASS_BRIDGE_OTHER << 8, |
| 169 | .class_mask = ~0, |
| 170 | .vendor = PCI_VENDOR_ID_PLX, |
| 171 | .device = 0x5406, |
| 172 | .subvendor = PCI_VENDOR_ID_PLX, |
| 173 | .subdevice = 0x9054, |
| 174 | }, |
| 175 | { } |
Sebastian Siewior | db11e47 | 2008-04-24 00:37:04 +0200 | [diff] [blame] | 176 | }; |
| 177 | MODULE_DEVICE_TABLE(pci, isp1760_plx); |
| 178 | |
| 179 | static struct pci_driver isp1761_pci_driver = { |
| 180 | .name = "isp1760", |
| 181 | .id_table = isp1760_plx, |
| 182 | .probe = isp1761_pci_probe, |
| 183 | .remove = isp1761_pci_remove, |
| 184 | .shutdown = isp1761_pci_shutdown, |
| 185 | }; |
| 186 | #endif |
| 187 | |
Bill Pemberton | 41ac7b3 | 2012-11-19 13:21:48 -0500 | [diff] [blame] | 188 | static int isp1760_plat_probe(struct platform_device *pdev) |
Catalin Marinas | f7e7aa5 | 2009-02-10 16:55:51 +0000 | [diff] [blame] | 189 | { |
Laurent Pinchart | 667c45c | 2015-01-21 00:55:58 +0200 | [diff] [blame] | 190 | unsigned long irqflags; |
Laurent Pinchart | c3cc40c | 2015-01-21 00:55:44 +0200 | [diff] [blame] | 191 | unsigned int devflags = 0; |
Catalin Marinas | f7e7aa5 | 2009-02-10 16:55:51 +0000 | [diff] [blame] | 192 | struct resource *mem_res; |
| 193 | struct resource *irq_res; |
Laurent Pinchart | c3cc40c | 2015-01-21 00:55:44 +0200 | [diff] [blame] | 194 | int ret; |
Catalin Marinas | f7e7aa5 | 2009-02-10 16:55:51 +0000 | [diff] [blame] | 195 | |
| 196 | mem_res = platform_get_resource(pdev, IORESOURCE_MEM, 0); |
Catalin Marinas | f7e7aa5 | 2009-02-10 16:55:51 +0000 | [diff] [blame] | 197 | |
| 198 | irq_res = platform_get_resource(pdev, IORESOURCE_IRQ, 0); |
| 199 | if (!irq_res) { |
| 200 | pr_warning("isp1760: IRQ resource not available\n"); |
Laurent Pinchart | 10feee1 | 2015-01-21 00:55:52 +0200 | [diff] [blame] | 201 | return -ENODEV; |
Catalin Marinas | f7e7aa5 | 2009-02-10 16:55:51 +0000 | [diff] [blame] | 202 | } |
Laurent Pinchart | 667c45c | 2015-01-21 00:55:58 +0200 | [diff] [blame] | 203 | irqflags = irq_res->flags & IRQF_TRIGGER_MASK; |
Catalin Marinas | f7e7aa5 | 2009-02-10 16:55:51 +0000 | [diff] [blame] | 204 | |
Laurent Pinchart | c3cc40c | 2015-01-21 00:55:44 +0200 | [diff] [blame] | 205 | if (IS_ENABLED(CONFIG_OF) && pdev->dev.of_node) { |
| 206 | struct device_node *dp = pdev->dev.of_node; |
| 207 | u32 bus_width = 0; |
| 208 | |
| 209 | if (of_device_is_compatible(dp, "nxp,usb-isp1761")) |
Michael Hennerich | 9da69c6 | 2009-07-15 23:22:54 -0400 | [diff] [blame] | 210 | devflags |= ISP1760_FLAG_ISP1761; |
Laurent Pinchart | c3cc40c | 2015-01-21 00:55:44 +0200 | [diff] [blame] | 211 | |
| 212 | /* Some systems wire up only 16 of the 32 data lines */ |
| 213 | of_property_read_u32(dp, "bus-width", &bus_width); |
| 214 | if (bus_width == 16) |
Michael Hennerich | 9da69c6 | 2009-07-15 23:22:54 -0400 | [diff] [blame] | 215 | devflags |= ISP1760_FLAG_BUS_WIDTH_16; |
Laurent Pinchart | c3cc40c | 2015-01-21 00:55:44 +0200 | [diff] [blame] | 216 | |
| 217 | if (of_property_read_bool(dp, "port1-otg")) |
Michael Hennerich | 9da69c6 | 2009-07-15 23:22:54 -0400 | [diff] [blame] | 218 | devflags |= ISP1760_FLAG_OTG_EN; |
Laurent Pinchart | c3cc40c | 2015-01-21 00:55:44 +0200 | [diff] [blame] | 219 | |
| 220 | if (of_property_read_bool(dp, "analog-oc")) |
Michael Hennerich | 9da69c6 | 2009-07-15 23:22:54 -0400 | [diff] [blame] | 221 | devflags |= ISP1760_FLAG_ANALOG_OC; |
Laurent Pinchart | c3cc40c | 2015-01-21 00:55:44 +0200 | [diff] [blame] | 222 | |
| 223 | if (of_property_read_bool(dp, "dack-polarity")) |
Michael Hennerich | 9da69c6 | 2009-07-15 23:22:54 -0400 | [diff] [blame] | 224 | devflags |= ISP1760_FLAG_DACK_POL_HIGH; |
Laurent Pinchart | c3cc40c | 2015-01-21 00:55:44 +0200 | [diff] [blame] | 225 | |
| 226 | if (of_property_read_bool(dp, "dreq-polarity")) |
| 227 | devflags |= ISP1760_FLAG_DREQ_POL_HIGH; |
| 228 | } else if (dev_get_platdata(&pdev->dev)) { |
| 229 | struct isp1760_platform_data *pdata = |
| 230 | dev_get_platdata(&pdev->dev); |
| 231 | |
| 232 | if (pdata->is_isp1761) |
| 233 | devflags |= ISP1760_FLAG_ISP1761; |
| 234 | if (pdata->bus_width_16) |
| 235 | devflags |= ISP1760_FLAG_BUS_WIDTH_16; |
| 236 | if (pdata->port1_otg) |
| 237 | devflags |= ISP1760_FLAG_OTG_EN; |
| 238 | if (pdata->analog_oc) |
| 239 | devflags |= ISP1760_FLAG_ANALOG_OC; |
| 240 | if (pdata->dack_polarity_high) |
| 241 | devflags |= ISP1760_FLAG_DACK_POL_HIGH; |
| 242 | if (pdata->dreq_polarity_high) |
Michael Hennerich | 9da69c6 | 2009-07-15 23:22:54 -0400 | [diff] [blame] | 243 | devflags |= ISP1760_FLAG_DREQ_POL_HIGH; |
| 244 | } |
| 245 | |
Laurent Pinchart | 4942e00 | 2015-01-21 00:55:51 +0200 | [diff] [blame] | 246 | ret = isp1760_register(mem_res, irq_res->start, irqflags, &pdev->dev, |
| 247 | devflags); |
Laurent Pinchart | f0bdbb0 | 2015-01-21 00:55:47 +0200 | [diff] [blame] | 248 | if (ret < 0) |
Laurent Pinchart | 10feee1 | 2015-01-21 00:55:52 +0200 | [diff] [blame] | 249 | return ret; |
Catalin Marinas | f7e7aa5 | 2009-02-10 16:55:51 +0000 | [diff] [blame] | 250 | |
| 251 | pr_info("ISP1760 USB device initialised\n"); |
Laurent Pinchart | c3cc40c | 2015-01-21 00:55:44 +0200 | [diff] [blame] | 252 | return 0; |
Catalin Marinas | f7e7aa5 | 2009-02-10 16:55:51 +0000 | [diff] [blame] | 253 | } |
| 254 | |
Bill Pemberton | fb4e98a | 2012-11-19 13:26:20 -0500 | [diff] [blame] | 255 | static int isp1760_plat_remove(struct platform_device *pdev) |
Catalin Marinas | f7e7aa5 | 2009-02-10 16:55:51 +0000 | [diff] [blame] | 256 | { |
Laurent Pinchart | 10c73f0 | 2015-01-21 00:55:45 +0200 | [diff] [blame] | 257 | isp1760_unregister(&pdev->dev); |
Michael Grzeschik | 310e9e3 | 2012-04-05 14:56:07 +0200 | [diff] [blame] | 258 | |
Catalin Marinas | f7e7aa5 | 2009-02-10 16:55:51 +0000 | [diff] [blame] | 259 | return 0; |
| 260 | } |
| 261 | |
Laurent Pinchart | c3cc40c | 2015-01-21 00:55:44 +0200 | [diff] [blame] | 262 | #ifdef CONFIG_OF |
| 263 | static const struct of_device_id isp1760_of_match[] = { |
| 264 | { .compatible = "nxp,usb-isp1760", }, |
| 265 | { .compatible = "nxp,usb-isp1761", }, |
| 266 | { }, |
| 267 | }; |
| 268 | MODULE_DEVICE_TABLE(of, isp1760_of_match); |
| 269 | #endif |
| 270 | |
Catalin Marinas | f7e7aa5 | 2009-02-10 16:55:51 +0000 | [diff] [blame] | 271 | static struct platform_driver isp1760_plat_driver = { |
| 272 | .probe = isp1760_plat_probe, |
Bill Pemberton | 7690417 | 2012-11-19 13:21:08 -0500 | [diff] [blame] | 273 | .remove = isp1760_plat_remove, |
Catalin Marinas | f7e7aa5 | 2009-02-10 16:55:51 +0000 | [diff] [blame] | 274 | .driver = { |
| 275 | .name = "isp1760", |
Laurent Pinchart | c3cc40c | 2015-01-21 00:55:44 +0200 | [diff] [blame] | 276 | .of_match_table = of_match_ptr(isp1760_of_match), |
Catalin Marinas | f7e7aa5 | 2009-02-10 16:55:51 +0000 | [diff] [blame] | 277 | }, |
| 278 | }; |
| 279 | |
Sebastian Siewior | db11e47 | 2008-04-24 00:37:04 +0200 | [diff] [blame] | 280 | static int __init isp1760_init(void) |
| 281 | { |
Catalin Marinas | f7e7aa5 | 2009-02-10 16:55:51 +0000 | [diff] [blame] | 282 | int ret, any_ret = -ENODEV; |
Sebastian Siewior | db11e47 | 2008-04-24 00:37:04 +0200 | [diff] [blame] | 283 | |
Laurent Pinchart | 5a6356a | 2015-01-21 00:55:49 +0200 | [diff] [blame] | 284 | isp1760_init_kmem_once(); |
Sebastian Siewior | db11e47 | 2008-04-24 00:37:04 +0200 | [diff] [blame] | 285 | |
Catalin Marinas | f7e7aa5 | 2009-02-10 16:55:51 +0000 | [diff] [blame] | 286 | ret = platform_driver_register(&isp1760_plat_driver); |
| 287 | if (!ret) |
| 288 | any_ret = 0; |
Sebastian Andrzej Siewior | ff30bf1 | 2008-11-02 15:25:42 +0100 | [diff] [blame] | 289 | #ifdef CONFIG_PCI |
Sebastian Siewior | db11e47 | 2008-04-24 00:37:04 +0200 | [diff] [blame] | 290 | ret = pci_register_driver(&isp1761_pci_driver); |
Catalin Marinas | f7e7aa5 | 2009-02-10 16:55:51 +0000 | [diff] [blame] | 291 | if (!ret) |
| 292 | any_ret = 0; |
Sebastian Siewior | db11e47 | 2008-04-24 00:37:04 +0200 | [diff] [blame] | 293 | #endif |
Sebastian Siewior | db11e47 | 2008-04-24 00:37:04 +0200 | [diff] [blame] | 294 | |
Catalin Marinas | f7e7aa5 | 2009-02-10 16:55:51 +0000 | [diff] [blame] | 295 | if (any_ret) |
Laurent Pinchart | 5a6356a | 2015-01-21 00:55:49 +0200 | [diff] [blame] | 296 | isp1760_deinit_kmem_cache(); |
Catalin Marinas | f7e7aa5 | 2009-02-10 16:55:51 +0000 | [diff] [blame] | 297 | return any_ret; |
Sebastian Siewior | db11e47 | 2008-04-24 00:37:04 +0200 | [diff] [blame] | 298 | } |
| 299 | module_init(isp1760_init); |
| 300 | |
| 301 | static void __exit isp1760_exit(void) |
| 302 | { |
Catalin Marinas | f7e7aa5 | 2009-02-10 16:55:51 +0000 | [diff] [blame] | 303 | platform_driver_unregister(&isp1760_plat_driver); |
Sebastian Andrzej Siewior | ff30bf1 | 2008-11-02 15:25:42 +0100 | [diff] [blame] | 304 | #ifdef CONFIG_PCI |
Sebastian Siewior | db11e47 | 2008-04-24 00:37:04 +0200 | [diff] [blame] | 305 | pci_unregister_driver(&isp1761_pci_driver); |
| 306 | #endif |
Laurent Pinchart | 5a6356a | 2015-01-21 00:55:49 +0200 | [diff] [blame] | 307 | isp1760_deinit_kmem_cache(); |
Sebastian Siewior | db11e47 | 2008-04-24 00:37:04 +0200 | [diff] [blame] | 308 | } |
| 309 | module_exit(isp1760_exit); |