[atheros] sync 2.6.26 config
[openwrt.git] / target / linux / ar7 / files / drivers / vlynq / vlynq.c
1 /*
2 * Copyright (C) 2006, 2007 Eugene Konev <ejka@openwrt.org>
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
17 */
18
19 #include <linux/init.h>
20 #include <linux/types.h>
21 #include <linux/kernel.h>
22 #include <linux/string.h>
23 #include <linux/device.h>
24 #include <linux/module.h>
25 #include <linux/errno.h>
26 #include <linux/platform_device.h>
27 #include <linux/interrupt.h>
28 #include <linux/device.h>
29 #include <linux/delay.h>
30 #include <linux/io.h>
31
32 #include <linux/vlynq.h>
33
34 #define VLYNQ_CTRL_PM_ENABLE 0x80000000
35 #define VLYNQ_CTRL_CLOCK_INT 0x00008000
36 #define VLYNQ_CTRL_CLOCK_DIV(x) (((x) & 7) << 16)
37 #define VLYNQ_CTRL_INT_LOCAL 0x00004000
38 #define VLYNQ_CTRL_INT_ENABLE 0x00002000
39 #define VLYNQ_CTRL_INT_VECTOR(x) (((x) & 0x1f) << 8)
40 #define VLYNQ_CTRL_INT2CFG 0x00000080
41 #define VLYNQ_CTRL_RESET 0x00000001
42
43 #define VLYNQ_INT_OFFSET 0x00000014
44 #define VLYNQ_REMOTE_OFFSET 0x00000080
45
46 #define VLYNQ_STATUS_LINK 0x00000001
47 #define VLYNQ_STATUS_LERROR 0x00000080
48 #define VLYNQ_STATUS_RERROR 0x00000100
49
50 #define VINT_ENABLE 0x00000100
51 #define VINT_TYPE_EDGE 0x00000080
52 #define VINT_LEVEL_LOW 0x00000040
53 #define VINT_VECTOR(x) ((x) & 0x1f)
54 #define VINT_OFFSET(irq) (8 * ((irq) % 4))
55
56 #define VLYNQ_AUTONEGO_V2 0x00010000
57
58 struct vlynq_regs {
59 u32 revision;
60 u32 control;
61 u32 status;
62 u32 int_prio;
63 u32 int_status;
64 u32 int_pending;
65 u32 int_ptr;
66 u32 tx_offset;
67 struct vlynq_mapping rx_mapping[4];
68 u32 chip;
69 u32 autonego;
70 u32 unused[6];
71 u32 int_device[8];
72 };
73
74 #define vlynq_reg_read(reg) readl(&(reg))
75 #define vlynq_reg_write(reg, val) writel(val, &(reg))
76
77 static int __vlynq_enable_device(struct vlynq_device *dev);
78
79 #ifdef VLYNQ_DEBUG
80 static void vlynq_dump_regs(struct vlynq_device *dev)
81 {
82 int i;
83 printk(KERN_DEBUG "VLYNQ local=%p remote=%p\n",
84 dev->local, dev->remote);
85 for (i = 0; i < 32; i++) {
86 printk(KERN_DEBUG "VLYNQ: local %d: %08x\n",
87 i + 1, ((u32 *)dev->local)[i]);
88 printk(KERN_DEBUG "VLYNQ: remote %d: %08x\n",
89 i + 1, ((u32 *)dev->remote)[i]);
90 }
91 }
92
93 static void vlynq_dump_mem(u32 *base, int count)
94 {
95 int i;
96 for (i = 0; i < (count + 3) / 4; i++) {
97 if (i % 4 == 0) printk(KERN_DEBUG "\nMEM[0x%04x]:", i * 4);
98 printk(KERN_DEBUG " 0x%08x", *(base + i));
99 }
100 printk(KERN_DEBUG "\n");
101 }
102 #endif
103
104 int vlynq_linked(struct vlynq_device *dev)
105 {
106 int i;
107
108 for (i = 0; i < 100; i++)
109 if (vlynq_reg_read(dev->local->status) & VLYNQ_STATUS_LINK)
110 return 1;
111 else
112 cpu_relax();
113
114 return 0;
115 }
116
117 static void vlynq_irq_unmask(unsigned int irq)
118 {
119 u32 val;
120 struct vlynq_device *dev = get_irq_chip_data(irq);
121 int virq;
122
123 BUG_ON(!dev);
124 virq = irq - dev->irq_start;
125 val = vlynq_reg_read(dev->remote->int_device[virq >> 2]);
126 val |= (VINT_ENABLE | virq) << VINT_OFFSET(virq);
127 vlynq_reg_write(dev->remote->int_device[virq >> 2], val);
128 }
129
130 static void vlynq_irq_mask(unsigned int irq)
131 {
132 u32 val;
133 struct vlynq_device *dev = get_irq_chip_data(irq);
134 int virq;
135
136 BUG_ON(!dev);
137 virq = irq - dev->irq_start;
138 val = vlynq_reg_read(dev->remote->int_device[virq >> 2]);
139 val &= ~(VINT_ENABLE << VINT_OFFSET(virq));
140 vlynq_reg_write(dev->remote->int_device[virq >> 2], val);
141 }
142
143 static int vlynq_irq_type(unsigned int irq, unsigned int flow_type)
144 {
145 u32 val;
146 struct vlynq_device *dev = get_irq_chip_data(irq);
147 int virq;
148
149 BUG_ON(!dev);
150 virq = irq - dev->irq_start;
151 val = vlynq_reg_read(dev->remote->int_device[virq >> 2]);
152 switch (flow_type & IRQ_TYPE_SENSE_MASK) {
153 case IRQ_TYPE_EDGE_RISING:
154 case IRQ_TYPE_EDGE_FALLING:
155 case IRQ_TYPE_EDGE_BOTH:
156 val |= VINT_TYPE_EDGE << VINT_OFFSET(virq);
157 val &= ~(VINT_LEVEL_LOW << VINT_OFFSET(virq));
158 break;
159 case IRQ_TYPE_LEVEL_HIGH:
160 val &= ~(VINT_TYPE_EDGE << VINT_OFFSET(virq));
161 val &= ~(VINT_LEVEL_LOW << VINT_OFFSET(virq));
162 break;
163 case IRQ_TYPE_LEVEL_LOW:
164 val &= ~(VINT_TYPE_EDGE << VINT_OFFSET(virq));
165 val |= VINT_LEVEL_LOW << VINT_OFFSET(virq);
166 break;
167 default:
168 return -EINVAL;
169 }
170 vlynq_reg_write(dev->remote->int_device[virq >> 2], val);
171 return 0;
172 }
173
174 static void vlynq_local_ack(unsigned int irq)
175 {
176 struct vlynq_device *dev = get_irq_chip_data(irq);
177 u32 status = vlynq_reg_read(dev->local->status);
178 if (printk_ratelimit())
179 printk(KERN_DEBUG "%s: local status: 0x%08x\n",
180 dev->dev.bus_id, status);
181 vlynq_reg_write(dev->local->status, status);
182 }
183
184 static void vlynq_remote_ack(unsigned int irq)
185 {
186 struct vlynq_device *dev = get_irq_chip_data(irq);
187 u32 status = vlynq_reg_read(dev->remote->status);
188 if (printk_ratelimit())
189 printk(KERN_DEBUG "%s: remote status: 0x%08x\n",
190 dev->dev.bus_id, status);
191 vlynq_reg_write(dev->remote->status, status);
192 }
193
194 static irqreturn_t vlynq_irq(int irq, void *dev_id)
195 {
196 struct vlynq_device *dev = dev_id;
197 u32 status;
198 int virq = 0;
199
200 status = vlynq_reg_read(dev->local->int_status);
201 vlynq_reg_write(dev->local->int_status, status);
202
203 if (unlikely(!status))
204 spurious_interrupt();
205
206 while (status) {
207 if (status & 1)
208 do_IRQ(dev->irq_start + virq);
209 status >>= 1;
210 virq++;
211 }
212
213 return IRQ_HANDLED;
214 }
215
216 static struct irq_chip vlynq_irq_chip = {
217 .name = "vlynq",
218 .unmask = vlynq_irq_unmask,
219 .mask = vlynq_irq_mask,
220 .set_type = vlynq_irq_type,
221 };
222
223 static struct irq_chip vlynq_local_chip = {
224 .name = "vlynq local error",
225 .unmask = vlynq_irq_unmask,
226 .mask = vlynq_irq_mask,
227 .ack = vlynq_local_ack,
228 };
229
230 static struct irq_chip vlynq_remote_chip = {
231 .name = "vlynq local error",
232 .unmask = vlynq_irq_unmask,
233 .mask = vlynq_irq_mask,
234 .ack = vlynq_remote_ack,
235 };
236
237 static int vlynq_setup_irq(struct vlynq_device *dev)
238 {
239 u32 val;
240 int i, virq;
241
242 if (dev->local_irq == dev->remote_irq) {
243 printk(KERN_ERR
244 "%s: local vlynq irq should be different from remote\n",
245 dev->dev.bus_id);
246 return -EINVAL;
247 }
248
249 /* Clear local and remote error bits */
250 vlynq_reg_write(dev->local->status, vlynq_reg_read(dev->local->status));
251 vlynq_reg_write(dev->remote->status,
252 vlynq_reg_read(dev->remote->status));
253
254 /* Now setup interrupts */
255 val = VLYNQ_CTRL_INT_VECTOR(dev->local_irq);
256 val |= VLYNQ_CTRL_INT_ENABLE | VLYNQ_CTRL_INT_LOCAL |
257 VLYNQ_CTRL_INT2CFG;
258 val |= vlynq_reg_read(dev->local->control);
259 vlynq_reg_write(dev->local->int_ptr, VLYNQ_INT_OFFSET);
260 vlynq_reg_write(dev->local->control, val);
261
262 val = VLYNQ_CTRL_INT_VECTOR(dev->remote_irq);
263 val |= VLYNQ_CTRL_INT_ENABLE;
264 val |= vlynq_reg_read(dev->remote->control);
265 vlynq_reg_write(dev->remote->int_ptr, VLYNQ_INT_OFFSET);
266 vlynq_reg_write(dev->remote->control, val);
267
268 for (i = dev->irq_start; i <= dev->irq_end; i++) {
269 virq = i - dev->irq_start;
270 if (virq == dev->local_irq) {
271 set_irq_chip_and_handler(i, &vlynq_local_chip,
272 handle_level_irq);
273 set_irq_chip_data(i, dev);
274 } else if (virq == dev->remote_irq) {
275 set_irq_chip_and_handler(i, &vlynq_remote_chip,
276 handle_level_irq);
277 set_irq_chip_data(i, dev);
278 } else {
279 set_irq_chip_and_handler(i, &vlynq_irq_chip,
280 handle_simple_irq);
281 set_irq_chip_data(i, dev);
282 vlynq_reg_write(dev->remote->int_device[virq >> 2], 0);
283 }
284 }
285
286 if (request_irq(dev->irq, vlynq_irq, IRQF_SHARED, "vlynq", dev)) {
287 printk(KERN_ERR "%s: request_irq failed\n", dev->dev.bus_id);
288 return -EAGAIN;
289 }
290
291 return 0;
292 }
293
294 static void vlynq_device_release(struct device *dev)
295 {
296 struct vlynq_device *vdev = to_vlynq_device(dev);
297 kfree(vdev);
298 }
299
300 static int vlynq_device_match(struct device *dev,
301 struct device_driver *drv)
302 {
303 struct vlynq_device *vdev = to_vlynq_device(dev);
304 struct vlynq_driver *vdrv = to_vlynq_driver(drv);
305 struct vlynq_device_id *ids = vdrv->id_table;
306
307 while (ids->id) {
308 if (ids->id == vdev->dev_id) {
309 vdev->divisor = ids->divisor;
310 vlynq_set_drvdata(vdev, ids);
311 printk(KERN_INFO "Driver found for VLYNQ " \
312 "device: %08x\n", vdev->dev_id);
313 return 1;
314 }
315 printk(KERN_DEBUG "Not using the %08x VLYNQ device's driver" \
316 " for VLYNQ device: %08x\n", ids->id, vdev->dev_id);
317 ids++;
318 }
319 return 0;
320 }
321
322 static int vlynq_device_probe(struct device *dev)
323 {
324 struct vlynq_device *vdev = to_vlynq_device(dev);
325 struct vlynq_driver *drv = to_vlynq_driver(dev->driver);
326 struct vlynq_device_id *id = vlynq_get_drvdata(vdev);
327 int result = -ENODEV;
328
329 get_device(dev);
330 if (drv && drv->probe)
331 result = drv->probe(vdev, id);
332 if (result)
333 put_device(dev);
334 return result;
335 }
336
337 static int vlynq_device_remove(struct device *dev)
338 {
339 struct vlynq_driver *drv = to_vlynq_driver(dev->driver);
340 if (drv && drv->remove)
341 drv->remove(to_vlynq_device(dev));
342 put_device(dev);
343 return 0;
344 }
345
346 int __vlynq_register_driver(struct vlynq_driver *driver, struct module *owner)
347 {
348 driver->driver.name = driver->name;
349 driver->driver.bus = &vlynq_bus_type;
350 return driver_register(&driver->driver);
351 }
352 EXPORT_SYMBOL(__vlynq_register_driver);
353
354 void vlynq_unregister_driver(struct vlynq_driver *driver)
355 {
356 driver_unregister(&driver->driver);
357 }
358 EXPORT_SYMBOL(vlynq_unregister_driver);
359
360 static int __vlynq_enable_device(struct vlynq_device *dev)
361 {
362 int i, result;
363 struct plat_vlynq_ops *ops = dev->dev.platform_data;
364
365 result = ops->on(dev);
366 if (result)
367 return result;
368
369 switch (dev->divisor) {
370 case vlynq_div_external:
371 case vlynq_div_auto:
372 vlynq_reg_write(dev->local->control, 0);
373 vlynq_reg_write(dev->remote->control, 0);
374 if (vlynq_linked(dev)) {
375 dev->divisor = vlynq_div_external;
376 printk(KERN_DEBUG "%s: using external clock\n",
377 dev->dev.bus_id);
378 return 0;
379 }
380
381 /* Only try locally supplied clock, others cause problems */
382 for (i = dev->dev_id ? vlynq_ldiv2 : vlynq_ldiv8; dev->dev_id ?
383 i <= vlynq_ldiv8 : i >= vlynq_ldiv2;
384 dev->dev_id ? i++ : i--) {
385 vlynq_reg_write(dev->local->control,
386 VLYNQ_CTRL_CLOCK_INT |
387 VLYNQ_CTRL_CLOCK_DIV(i - vlynq_ldiv1));
388 if (vlynq_linked(dev)) {
389 printk(KERN_DEBUG
390 "%s: using local clock divisor %d\n",
391 dev->dev.bus_id, i - vlynq_ldiv1 + 1);
392 dev->divisor = i;
393 return 0;
394 }
395 }
396 case vlynq_ldiv1: case vlynq_ldiv2: case vlynq_ldiv3: case vlynq_ldiv4:
397 case vlynq_ldiv5: case vlynq_ldiv6: case vlynq_ldiv7: case vlynq_ldiv8:
398 vlynq_reg_write(dev->local->control,
399 VLYNQ_CTRL_CLOCK_INT |
400 VLYNQ_CTRL_CLOCK_DIV(dev->divisor -
401 vlynq_ldiv1));
402 vlynq_reg_write(dev->remote->control, 0);
403 if (vlynq_linked(dev)) {
404 printk(KERN_DEBUG
405 "%s: using local clock divisor %d\n",
406 dev->dev.bus_id, dev->divisor - vlynq_ldiv1 + 1);
407 return 0;
408 }
409 break;
410 case vlynq_rdiv1: case vlynq_rdiv2: case vlynq_rdiv3: case vlynq_rdiv4:
411 case vlynq_rdiv5: case vlynq_rdiv6: case vlynq_rdiv7: case vlynq_rdiv8:
412 vlynq_reg_write(dev->local->control, 0);
413 vlynq_reg_write(dev->remote->control,
414 VLYNQ_CTRL_CLOCK_INT |
415 VLYNQ_CTRL_CLOCK_DIV(dev->divisor -
416 vlynq_rdiv1));
417 if (vlynq_linked(dev)) {
418 printk(KERN_DEBUG
419 "%s: using remote clock divisor %d\n",
420 dev->dev.bus_id, dev->divisor - vlynq_rdiv1 + 1);
421 return 0;
422 }
423 break;
424 }
425
426 ops->off(dev);
427 return -ENODEV;
428 }
429
430 int vlynq_enable_device(struct vlynq_device *dev)
431 {
432 struct plat_vlynq_ops *ops = dev->dev.platform_data;
433 int result = -ENODEV;
434
435 result = __vlynq_enable_device(dev);
436 if (result)
437 return result;
438
439 result = vlynq_setup_irq(dev);
440 if (result)
441 ops->off(dev);
442
443 dev->enabled = !result;
444 return result;
445 }
446 EXPORT_SYMBOL(vlynq_enable_device);
447
448
449 void vlynq_disable_device(struct vlynq_device *dev)
450 {
451 struct plat_vlynq_ops *ops = dev->dev.platform_data;
452
453 dev->enabled = 0;
454 free_irq(dev->irq, dev);
455 ops->off(dev);
456 }
457 EXPORT_SYMBOL(vlynq_disable_device);
458
459 int vlynq_set_local_mapping(struct vlynq_device *dev, u32 tx_offset,
460 struct vlynq_mapping *mapping)
461 {
462 int i;
463
464 if (!dev->enabled)
465 return -ENXIO;
466
467 vlynq_reg_write(dev->local->tx_offset, tx_offset);
468 for (i = 0; i < 4; i++) {
469 vlynq_reg_write(dev->local->rx_mapping[i].offset,
470 mapping[i].offset);
471 vlynq_reg_write(dev->local->rx_mapping[i].size,
472 mapping[i].size);
473 }
474 return 0;
475 }
476 EXPORT_SYMBOL(vlynq_set_local_mapping);
477
478 int vlynq_set_remote_mapping(struct vlynq_device *dev, u32 tx_offset,
479 struct vlynq_mapping *mapping)
480 {
481 int i;
482
483 if (!dev->enabled)
484 return -ENXIO;
485
486 vlynq_reg_write(dev->remote->tx_offset, tx_offset);
487 for (i = 0; i < 4; i++) {
488 vlynq_reg_write(dev->remote->rx_mapping[i].offset,
489 mapping[i].offset);
490 vlynq_reg_write(dev->remote->rx_mapping[i].size,
491 mapping[i].size);
492 }
493 return 0;
494 }
495 EXPORT_SYMBOL(vlynq_set_remote_mapping);
496
497 int vlynq_set_local_irq(struct vlynq_device *dev, int virq)
498 {
499 int irq = dev->irq_start + virq;
500 if (dev->enabled)
501 return -EBUSY;
502
503 if ((irq < dev->irq_start) || (irq > dev->irq_end))
504 return -EINVAL;
505
506 if (virq == dev->remote_irq)
507 return -EINVAL;
508
509 dev->local_irq = virq;
510
511 return 0;
512 }
513 EXPORT_SYMBOL(vlynq_set_local_irq);
514
515 int vlynq_set_remote_irq(struct vlynq_device *dev, int virq)
516 {
517 int irq = dev->irq_start + virq;
518 if (dev->enabled)
519 return -EBUSY;
520
521 if ((irq < dev->irq_start) || (irq > dev->irq_end))
522 return -EINVAL;
523
524 if (virq == dev->local_irq)
525 return -EINVAL;
526
527 dev->remote_irq = virq;
528
529 return 0;
530 }
531 EXPORT_SYMBOL(vlynq_set_remote_irq);
532
533 static int vlynq_probe(struct platform_device *pdev)
534 {
535 struct vlynq_device *dev;
536 struct resource *regs_res, *mem_res, *irq_res;
537 int len, result;
538
539 regs_res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "regs");
540 if (!regs_res)
541 return -ENODEV;
542
543 mem_res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "mem");
544 if (!mem_res)
545 return -ENODEV;
546
547 irq_res = platform_get_resource_byname(pdev, IORESOURCE_IRQ, "devirq");
548 if (!irq_res)
549 return -ENODEV;
550
551 dev = kzalloc(sizeof(*dev), GFP_KERNEL);
552 if (!dev) {
553 printk(KERN_ERR
554 "vlynq: failed to allocate device structure\n");
555 return -ENOMEM;
556 }
557
558 dev->id = pdev->id;
559 dev->dev.bus = &vlynq_bus_type;
560 dev->dev.parent = &pdev->dev;
561 snprintf(dev->dev.bus_id, BUS_ID_SIZE, "vlynq%d", dev->id);
562 dev->dev.bus_id[BUS_ID_SIZE - 1] = 0;
563 dev->dev.platform_data = pdev->dev.platform_data;
564 dev->dev.release = vlynq_device_release;
565
566 dev->regs_start = regs_res->start;
567 dev->regs_end = regs_res->end;
568 dev->mem_start = mem_res->start;
569 dev->mem_end = mem_res->end;
570
571 len = regs_res->end - regs_res->start;
572 if (!request_mem_region(regs_res->start, len, dev->dev.bus_id)) {
573 printk(KERN_ERR "%s: Can't request vlynq registers\n",
574 dev->dev.bus_id);
575 result = -ENXIO;
576 goto fail_request;
577 }
578
579 dev->local = ioremap(regs_res->start, len);
580 if (!dev->local) {
581 printk(KERN_ERR "%s: Can't remap vlynq registers\n",
582 dev->dev.bus_id);
583 result = -ENXIO;
584 goto fail_remap;
585 }
586
587 dev->remote = (struct vlynq_regs *)((void *)dev->local +
588 VLYNQ_REMOTE_OFFSET);
589
590 dev->irq = platform_get_irq_byname(pdev, "irq");
591 dev->irq_start = irq_res->start;
592 dev->irq_end = irq_res->end;
593 dev->local_irq = dev->irq_end - dev->irq_start;
594 dev->remote_irq = dev->local_irq - 1;
595
596 if (device_register(&dev->dev))
597 goto fail_register;
598 platform_set_drvdata(pdev, dev);
599
600 printk(KERN_INFO "%s: regs 0x%p, irq %d, mem 0x%p\n",
601 dev->dev.bus_id, (void *)dev->regs_start, dev->irq,
602 (void *)dev->mem_start);
603
604 dev->dev_id = 0;
605 dev->divisor = vlynq_div_auto;
606 result = __vlynq_enable_device(dev);
607 if (result == 0) {
608 dev->dev_id = vlynq_reg_read(dev->remote->chip);
609 ((struct plat_vlynq_ops *)(dev->dev.platform_data))->off(dev);
610 }
611 if (dev->dev_id)
612 printk(KERN_INFO "Found a VLYNQ device: %08x\n", dev->dev_id);
613
614 return 0;
615
616 fail_register:
617 iounmap(dev->local);
618 fail_remap:
619 fail_request:
620 release_mem_region(regs_res->start, len);
621 kfree(dev);
622 return result;
623 }
624
625 static int vlynq_remove(struct platform_device *pdev)
626 {
627 struct vlynq_device *dev = platform_get_drvdata(pdev);
628
629 device_unregister(&dev->dev);
630 iounmap(dev->local);
631 release_mem_region(dev->regs_start, dev->regs_end - dev->regs_start);
632
633 kfree(dev);
634
635 return 0;
636 }
637
638 static struct platform_driver vlynq_platform_driver = {
639 .driver.name = "vlynq",
640 .probe = vlynq_probe,
641 .remove = __devexit_p(vlynq_remove),
642 };
643
644 struct bus_type vlynq_bus_type = {
645 .name = "vlynq",
646 .match = vlynq_device_match,
647 .probe = vlynq_device_probe,
648 .remove = vlynq_device_remove,
649 };
650 EXPORT_SYMBOL(vlynq_bus_type);
651
652 static int __devinit vlynq_init(void)
653 {
654 int res = 0;
655
656 res = bus_register(&vlynq_bus_type);
657 if (res)
658 goto fail_bus;
659
660 res = platform_driver_register(&vlynq_platform_driver);
661 if (res)
662 goto fail_platform;
663
664 return 0;
665
666 fail_platform:
667 bus_unregister(&vlynq_bus_type);
668 fail_bus:
669 return res;
670 }
671
672 static void __devexit vlynq_exit(void)
673 {
674 platform_driver_unregister(&vlynq_platform_driver);
675 bus_unregister(&vlynq_bus_type);
676 }
677
678 module_init(vlynq_init);
679 module_exit(vlynq_exit);
This page took 0.100294 seconds and 5 git commands to generate.