diff options
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/char/Kconfig | 2 | ||||
-rw-r--r-- | drivers/char/vr41xx_giu.c | 132 | ||||
-rw-r--r-- | drivers/rtc/rtc-vr41xx.c | 186 | ||||
-rw-r--r-- | drivers/serial/vr41xx_siu.c | 143 | ||||
-rw-r--r-- | drivers/tc/zs.c | 22 |
5 files changed, 148 insertions, 337 deletions
diff --git a/drivers/char/Kconfig b/drivers/char/Kconfig index ef683ebd367c..a31c6d2c061f 100644 --- a/drivers/char/Kconfig +++ b/drivers/char/Kconfig | |||
@@ -815,7 +815,7 @@ config SGI_IP27_RTC | |||
815 | 815 | ||
816 | config GEN_RTC | 816 | config GEN_RTC |
817 | tristate "Generic /dev/rtc emulation" | 817 | tristate "Generic /dev/rtc emulation" |
818 | depends on RTC!=y && !IA64 && !ARM && !M32R && !SPARC && !FRV && !S390 && !SUPERH | 818 | depends on RTC!=y && !IA64 && !ARM && !M32R && !MIPS && !SPARC && !FRV && !S390 && !SUPERH |
819 | ---help--- | 819 | ---help--- |
820 | If you say Y here and create a character special file /dev/rtc with | 820 | If you say Y here and create a character special file /dev/rtc with |
821 | major number 10 and minor number 135 using mknod ("man mknod"), you | 821 | major number 10 and minor number 135 using mknod ("man mknod"), you |
diff --git a/drivers/char/vr41xx_giu.c b/drivers/char/vr41xx_giu.c index 0cea8d4907df..e5ed09192be8 100644 --- a/drivers/char/vr41xx_giu.c +++ b/drivers/char/vr41xx_giu.c | |||
@@ -19,18 +19,17 @@ | |||
19 | * along with this program; if not, write to the Free Software | 19 | * along with this program; if not, write to the Free Software |
20 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | 20 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
21 | */ | 21 | */ |
22 | #include <linux/platform_device.h> | ||
23 | #include <linux/errno.h> | 22 | #include <linux/errno.h> |
24 | #include <linux/fs.h> | 23 | #include <linux/fs.h> |
25 | #include <linux/init.h> | 24 | #include <linux/init.h> |
26 | #include <linux/irq.h> | ||
27 | #include <linux/interrupt.h> | 25 | #include <linux/interrupt.h> |
26 | #include <linux/irq.h> | ||
28 | #include <linux/kernel.h> | 27 | #include <linux/kernel.h> |
29 | #include <linux/module.h> | 28 | #include <linux/module.h> |
29 | #include <linux/platform_device.h> | ||
30 | #include <linux/spinlock.h> | 30 | #include <linux/spinlock.h> |
31 | #include <linux/types.h> | 31 | #include <linux/types.h> |
32 | 32 | ||
33 | #include <asm/cpu.h> | ||
34 | #include <asm/io.h> | 33 | #include <asm/io.h> |
35 | #include <asm/vr41xx/giu.h> | 34 | #include <asm/vr41xx/giu.h> |
36 | #include <asm/vr41xx/irq.h> | 35 | #include <asm/vr41xx/irq.h> |
@@ -44,18 +43,6 @@ static int major; /* default is dynamic major device number */ | |||
44 | module_param(major, int, 0); | 43 | module_param(major, int, 0); |
45 | MODULE_PARM_DESC(major, "Major device number"); | 44 | MODULE_PARM_DESC(major, "Major device number"); |
46 | 45 | ||
47 | #define GIU_TYPE1_START 0x0b000100UL | ||
48 | #define GIU_TYPE1_SIZE 0x20UL | ||
49 | |||
50 | #define GIU_TYPE2_START 0x0f000140UL | ||
51 | #define GIU_TYPE2_SIZE 0x20UL | ||
52 | |||
53 | #define GIU_TYPE3_START 0x0f000140UL | ||
54 | #define GIU_TYPE3_SIZE 0x28UL | ||
55 | |||
56 | #define GIU_PULLUPDOWN_START 0x0b0002e0UL | ||
57 | #define GIU_PULLUPDOWN_SIZE 0x04UL | ||
58 | |||
59 | #define GIUIOSELL 0x00 | 46 | #define GIUIOSELL 0x00 |
60 | #define GIUIOSELH 0x02 | 47 | #define GIUIOSELH 0x02 |
61 | #define GIUPIODL 0x04 | 48 | #define GIUPIODL 0x04 |
@@ -89,8 +76,6 @@ MODULE_PARM_DESC(major, "Major device number"); | |||
89 | #define GPIO_HAS_INTERRUPT_EDGE_SELECT 0x0100 | 76 | #define GPIO_HAS_INTERRUPT_EDGE_SELECT 0x0100 |
90 | 77 | ||
91 | static spinlock_t giu_lock; | 78 | static spinlock_t giu_lock; |
92 | static struct resource *giu_resource1; | ||
93 | static struct resource *giu_resource2; | ||
94 | static unsigned long giu_flags; | 79 | static unsigned long giu_flags; |
95 | static unsigned int giu_nr_pins; | 80 | static unsigned int giu_nr_pins; |
96 | 81 | ||
@@ -234,7 +219,7 @@ void vr41xx_set_irq_trigger(unsigned int pin, irq_trigger_t trigger, irq_signal_ | |||
234 | giu_set(GIUINTHTSELL, mask); | 219 | giu_set(GIUINTHTSELL, mask); |
235 | else | 220 | else |
236 | giu_clear(GIUINTHTSELL, mask); | 221 | giu_clear(GIUINTHTSELL, mask); |
237 | if (current_cpu_data.cputype == CPU_VR4133) { | 222 | if (giu_flags & GPIO_HAS_INTERRUPT_EDGE_SELECT) { |
238 | switch (trigger) { | 223 | switch (trigger) { |
239 | case IRQ_TRIGGER_EDGE_FALLING: | 224 | case IRQ_TRIGGER_EDGE_FALLING: |
240 | giu_set(GIUFEDGEINHL, mask); | 225 | giu_set(GIUFEDGEINHL, mask); |
@@ -269,7 +254,7 @@ void vr41xx_set_irq_trigger(unsigned int pin, irq_trigger_t trigger, irq_signal_ | |||
269 | giu_set(GIUINTHTSELH, mask); | 254 | giu_set(GIUINTHTSELH, mask); |
270 | else | 255 | else |
271 | giu_clear(GIUINTHTSELH, mask); | 256 | giu_clear(GIUINTHTSELH, mask); |
272 | if (current_cpu_data.cputype == CPU_VR4133) { | 257 | if (giu_flags & GPIO_HAS_INTERRUPT_EDGE_SELECT) { |
273 | switch (trigger) { | 258 | switch (trigger) { |
274 | case IRQ_TRIGGER_EDGE_FALLING: | 259 | case IRQ_TRIGGER_EDGE_FALLING: |
275 | giu_set(GIUFEDGEINHH, mask); | 260 | giu_set(GIUFEDGEINHH, mask); |
@@ -298,7 +283,6 @@ void vr41xx_set_irq_trigger(unsigned int pin, irq_trigger_t trigger, irq_signal_ | |||
298 | giu_write(GIUINTSTATH, mask); | 283 | giu_write(GIUINTSTATH, mask); |
299 | } | 284 | } |
300 | } | 285 | } |
301 | |||
302 | EXPORT_SYMBOL_GPL(vr41xx_set_irq_trigger); | 286 | EXPORT_SYMBOL_GPL(vr41xx_set_irq_trigger); |
303 | 287 | ||
304 | void vr41xx_set_irq_level(unsigned int pin, irq_level_t level) | 288 | void vr41xx_set_irq_level(unsigned int pin, irq_level_t level) |
@@ -321,7 +305,6 @@ void vr41xx_set_irq_level(unsigned int pin, irq_level_t level) | |||
321 | giu_write(GIUINTSTATH, mask); | 305 | giu_write(GIUINTSTATH, mask); |
322 | } | 306 | } |
323 | } | 307 | } |
324 | |||
325 | EXPORT_SYMBOL_GPL(vr41xx_set_irq_level); | 308 | EXPORT_SYMBOL_GPL(vr41xx_set_irq_level); |
326 | 309 | ||
327 | gpio_data_t vr41xx_gpio_get_pin(unsigned int pin) | 310 | gpio_data_t vr41xx_gpio_get_pin(unsigned int pin) |
@@ -350,7 +333,6 @@ gpio_data_t vr41xx_gpio_get_pin(unsigned int pin) | |||
350 | 333 | ||
351 | return GPIO_DATA_LOW; | 334 | return GPIO_DATA_LOW; |
352 | } | 335 | } |
353 | |||
354 | EXPORT_SYMBOL_GPL(vr41xx_gpio_get_pin); | 336 | EXPORT_SYMBOL_GPL(vr41xx_gpio_get_pin); |
355 | 337 | ||
356 | int vr41xx_gpio_set_pin(unsigned int pin, gpio_data_t data) | 338 | int vr41xx_gpio_set_pin(unsigned int pin, gpio_data_t data) |
@@ -388,7 +370,6 @@ int vr41xx_gpio_set_pin(unsigned int pin, gpio_data_t data) | |||
388 | 370 | ||
389 | return 0; | 371 | return 0; |
390 | } | 372 | } |
391 | |||
392 | EXPORT_SYMBOL_GPL(vr41xx_gpio_set_pin); | 373 | EXPORT_SYMBOL_GPL(vr41xx_gpio_set_pin); |
393 | 374 | ||
394 | int vr41xx_gpio_set_direction(unsigned int pin, gpio_direction_t dir) | 375 | int vr41xx_gpio_set_direction(unsigned int pin, gpio_direction_t dir) |
@@ -438,7 +419,6 @@ int vr41xx_gpio_set_direction(unsigned int pin, gpio_direction_t dir) | |||
438 | 419 | ||
439 | return 0; | 420 | return 0; |
440 | } | 421 | } |
441 | |||
442 | EXPORT_SYMBOL_GPL(vr41xx_gpio_set_direction); | 422 | EXPORT_SYMBOL_GPL(vr41xx_gpio_set_direction); |
443 | 423 | ||
444 | int vr41xx_gpio_pullupdown(unsigned int pin, gpio_pull_t pull) | 424 | int vr41xx_gpio_pullupdown(unsigned int pin, gpio_pull_t pull) |
@@ -477,7 +457,6 @@ int vr41xx_gpio_pullupdown(unsigned int pin, gpio_pull_t pull) | |||
477 | 457 | ||
478 | return 0; | 458 | return 0; |
479 | } | 459 | } |
480 | |||
481 | EXPORT_SYMBOL_GPL(vr41xx_gpio_pullupdown); | 460 | EXPORT_SYMBOL_GPL(vr41xx_gpio_pullupdown); |
482 | 461 | ||
483 | static ssize_t gpio_read(struct file *file, char __user *buf, size_t len, | 462 | static ssize_t gpio_read(struct file *file, char __user *buf, size_t len, |
@@ -596,61 +575,40 @@ static const struct file_operations gpio_fops = { | |||
596 | 575 | ||
597 | static int __devinit giu_probe(struct platform_device *dev) | 576 | static int __devinit giu_probe(struct platform_device *dev) |
598 | { | 577 | { |
599 | unsigned long start, size, flags = 0; | 578 | struct resource *res; |
600 | unsigned int nr_pins = 0, trigger, i, pin; | 579 | unsigned int trigger, i, pin; |
601 | struct resource *res1, *res2 = NULL; | ||
602 | void *base; | ||
603 | struct irq_chip *chip; | 580 | struct irq_chip *chip; |
604 | int retval; | 581 | int irq, retval; |
605 | 582 | ||
606 | switch (current_cpu_data.cputype) { | 583 | switch (dev->id) { |
607 | case CPU_VR4111: | 584 | case GPIO_50PINS_PULLUPDOWN: |
608 | case CPU_VR4121: | 585 | giu_flags = GPIO_HAS_PULLUPDOWN_IO; |
609 | start = GIU_TYPE1_START; | 586 | giu_nr_pins = 50; |
610 | size = GIU_TYPE1_SIZE; | ||
611 | flags = GPIO_HAS_PULLUPDOWN_IO; | ||
612 | nr_pins = 50; | ||
613 | break; | 587 | break; |
614 | case CPU_VR4122: | 588 | case GPIO_36PINS: |
615 | case CPU_VR4131: | 589 | giu_nr_pins = 36; |
616 | start = GIU_TYPE2_START; | ||
617 | size = GIU_TYPE2_SIZE; | ||
618 | nr_pins = 36; | ||
619 | break; | 590 | break; |
620 | case CPU_VR4133: | 591 | case GPIO_48PINS_EDGE_SELECT: |
621 | start = GIU_TYPE3_START; | 592 | giu_flags = GPIO_HAS_INTERRUPT_EDGE_SELECT; |
622 | size = GIU_TYPE3_SIZE; | 593 | giu_nr_pins = 48; |
623 | flags = GPIO_HAS_INTERRUPT_EDGE_SELECT; | ||
624 | nr_pins = 48; | ||
625 | break; | 594 | break; |
626 | default: | 595 | default: |
596 | printk(KERN_ERR "GIU: unknown ID %d\n", dev->id); | ||
627 | return -ENODEV; | 597 | return -ENODEV; |
628 | } | 598 | } |
629 | 599 | ||
630 | res1 = request_mem_region(start, size, "GIU"); | 600 | res = platform_get_resource(dev, IORESOURCE_MEM, 0); |
631 | if (res1 == NULL) | 601 | if (!res) |
632 | return -EBUSY; | 602 | return -EBUSY; |
633 | 603 | ||
634 | base = ioremap(start, size); | 604 | giu_base = ioremap(res->start, res->end - res->start + 1); |
635 | if (base == NULL) { | 605 | if (!giu_base) |
636 | release_resource(res1); | ||
637 | return -ENOMEM; | 606 | return -ENOMEM; |
638 | } | ||
639 | |||
640 | if (flags & GPIO_HAS_PULLUPDOWN_IO) { | ||
641 | res2 = request_mem_region(GIU_PULLUPDOWN_START, GIU_PULLUPDOWN_SIZE, "GIU"); | ||
642 | if (res2 == NULL) { | ||
643 | iounmap(base); | ||
644 | release_resource(res1); | ||
645 | return -EBUSY; | ||
646 | } | ||
647 | } | ||
648 | 607 | ||
649 | retval = register_chrdev(major, "GIU", &gpio_fops); | 608 | retval = register_chrdev(major, "GIU", &gpio_fops); |
650 | if (retval < 0) { | 609 | if (retval < 0) { |
651 | iounmap(base); | 610 | iounmap(giu_base); |
652 | release_resource(res1); | 611 | giu_base = NULL; |
653 | release_resource(res2); | ||
654 | return retval; | 612 | return retval; |
655 | } | 613 | } |
656 | 614 | ||
@@ -660,11 +618,6 @@ static int __devinit giu_probe(struct platform_device *dev) | |||
660 | } | 618 | } |
661 | 619 | ||
662 | spin_lock_init(&giu_lock); | 620 | spin_lock_init(&giu_lock); |
663 | giu_base = base; | ||
664 | giu_resource1 = res1; | ||
665 | giu_resource2 = res2; | ||
666 | giu_flags = flags; | ||
667 | giu_nr_pins = nr_pins; | ||
668 | 621 | ||
669 | giu_write(GIUINTENL, 0); | 622 | giu_write(GIUINTENL, 0); |
670 | giu_write(GIUINTENH, 0); | 623 | giu_write(GIUINTENH, 0); |
@@ -685,22 +638,23 @@ static int __devinit giu_probe(struct platform_device *dev) | |||
685 | 638 | ||
686 | } | 639 | } |
687 | 640 | ||
688 | return cascade_irq(GIUINT_IRQ, giu_get_irq); | 641 | irq = platform_get_irq(dev, 0); |
642 | if (irq < 0 || irq >= NR_IRQS) | ||
643 | return -EBUSY; | ||
644 | |||
645 | return cascade_irq(irq, giu_get_irq); | ||
689 | } | 646 | } |
690 | 647 | ||
691 | static int __devexit giu_remove(struct platform_device *dev) | 648 | static int __devexit giu_remove(struct platform_device *dev) |
692 | { | 649 | { |
693 | iounmap(giu_base); | 650 | if (giu_base) { |
694 | 651 | iounmap(giu_base); | |
695 | release_resource(giu_resource1); | 652 | giu_base = NULL; |
696 | if (giu_flags & GPIO_HAS_PULLUPDOWN_IO) | 653 | } |
697 | release_resource(giu_resource2); | ||
698 | 654 | ||
699 | return 0; | 655 | return 0; |
700 | } | 656 | } |
701 | 657 | ||
702 | static struct platform_device *giu_platform_device; | ||
703 | |||
704 | static struct platform_driver giu_device_driver = { | 658 | static struct platform_driver giu_device_driver = { |
705 | .probe = giu_probe, | 659 | .probe = giu_probe, |
706 | .remove = __devexit_p(giu_remove), | 660 | .remove = __devexit_p(giu_remove), |
@@ -712,30 +666,12 @@ static struct platform_driver giu_device_driver = { | |||
712 | 666 | ||
713 | static int __init vr41xx_giu_init(void) | 667 | static int __init vr41xx_giu_init(void) |
714 | { | 668 | { |
715 | int retval; | 669 | return platform_driver_register(&giu_device_driver); |
716 | |||
717 | giu_platform_device = platform_device_alloc("GIU", -1); | ||
718 | if (!giu_platform_device) | ||
719 | return -ENOMEM; | ||
720 | |||
721 | retval = platform_device_add(giu_platform_device); | ||
722 | if (retval < 0) { | ||
723 | platform_device_put(giu_platform_device); | ||
724 | return retval; | ||
725 | } | ||
726 | |||
727 | retval = platform_driver_register(&giu_device_driver); | ||
728 | if (retval < 0) | ||
729 | platform_device_unregister(giu_platform_device); | ||
730 | |||
731 | return retval; | ||
732 | } | 670 | } |
733 | 671 | ||
734 | static void __exit vr41xx_giu_exit(void) | 672 | static void __exit vr41xx_giu_exit(void) |
735 | { | 673 | { |
736 | platform_driver_unregister(&giu_device_driver); | 674 | platform_driver_unregister(&giu_device_driver); |
737 | |||
738 | platform_device_unregister(giu_platform_device); | ||
739 | } | 675 | } |
740 | 676 | ||
741 | module_init(vr41xx_giu_init); | 677 | module_init(vr41xx_giu_init); |
diff --git a/drivers/rtc/rtc-vr41xx.c b/drivers/rtc/rtc-vr41xx.c index af7596ef29e2..ce2f78de7a80 100644 --- a/drivers/rtc/rtc-vr41xx.c +++ b/drivers/rtc/rtc-vr41xx.c | |||
@@ -17,10 +17,11 @@ | |||
17 | * along with this program; if not, write to the Free Software | 17 | * along with this program; if not, write to the Free Software |
18 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | 18 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
19 | */ | 19 | */ |
20 | #include <linux/err.h> | ||
20 | #include <linux/fs.h> | 21 | #include <linux/fs.h> |
21 | #include <linux/init.h> | 22 | #include <linux/init.h> |
22 | #include <linux/ioport.h> | 23 | #include <linux/ioport.h> |
23 | #include <linux/irq.h> | 24 | #include <linux/interrupt.h> |
24 | #include <linux/module.h> | 25 | #include <linux/module.h> |
25 | #include <linux/platform_device.h> | 26 | #include <linux/platform_device.h> |
26 | #include <linux/rtc.h> | 27 | #include <linux/rtc.h> |
@@ -30,25 +31,11 @@ | |||
30 | #include <asm/div64.h> | 31 | #include <asm/div64.h> |
31 | #include <asm/io.h> | 32 | #include <asm/io.h> |
32 | #include <asm/uaccess.h> | 33 | #include <asm/uaccess.h> |
33 | #include <asm/vr41xx/irq.h> | ||
34 | 34 | ||
35 | MODULE_AUTHOR("Yoichi Yuasa <yoichi_yuasa@tripeaks.co.jp>"); | 35 | MODULE_AUTHOR("Yoichi Yuasa <yoichi_yuasa@tripeaks.co.jp>"); |
36 | MODULE_DESCRIPTION("NEC VR4100 series RTC driver"); | 36 | MODULE_DESCRIPTION("NEC VR4100 series RTC driver"); |
37 | MODULE_LICENSE("GPL"); | 37 | MODULE_LICENSE("GPL"); |
38 | 38 | ||
39 | #define RTC1_TYPE1_START 0x0b0000c0UL | ||
40 | #define RTC1_TYPE1_END 0x0b0000dfUL | ||
41 | #define RTC2_TYPE1_START 0x0b0001c0UL | ||
42 | #define RTC2_TYPE1_END 0x0b0001dfUL | ||
43 | |||
44 | #define RTC1_TYPE2_START 0x0f000100UL | ||
45 | #define RTC1_TYPE2_END 0x0f00011fUL | ||
46 | #define RTC2_TYPE2_START 0x0f000120UL | ||
47 | #define RTC2_TYPE2_END 0x0f00013fUL | ||
48 | |||
49 | #define RTC1_SIZE 0x20 | ||
50 | #define RTC2_SIZE 0x20 | ||
51 | |||
52 | /* RTC 1 registers */ | 39 | /* RTC 1 registers */ |
53 | #define ETIMELREG 0x00 | 40 | #define ETIMELREG 0x00 |
54 | #define ETIMEMREG 0x02 | 41 | #define ETIMEMREG 0x02 |
@@ -98,13 +85,8 @@ static char rtc_name[] = "RTC"; | |||
98 | static unsigned long periodic_frequency; | 85 | static unsigned long periodic_frequency; |
99 | static unsigned long periodic_count; | 86 | static unsigned long periodic_count; |
100 | static unsigned int alarm_enabled; | 87 | static unsigned int alarm_enabled; |
101 | 88 | static int aie_irq = -1; | |
102 | struct resource rtc_resource[2] = { | 89 | static int pie_irq = -1; |
103 | { .name = rtc_name, | ||
104 | .flags = IORESOURCE_MEM, }, | ||
105 | { .name = rtc_name, | ||
106 | .flags = IORESOURCE_MEM, }, | ||
107 | }; | ||
108 | 90 | ||
109 | static inline unsigned long read_elapsed_second(void) | 91 | static inline unsigned long read_elapsed_second(void) |
110 | { | 92 | { |
@@ -150,8 +132,8 @@ static void vr41xx_rtc_release(struct device *dev) | |||
150 | 132 | ||
151 | spin_unlock_irq(&rtc_lock); | 133 | spin_unlock_irq(&rtc_lock); |
152 | 134 | ||
153 | disable_irq(ELAPSEDTIME_IRQ); | 135 | disable_irq(aie_irq); |
154 | disable_irq(RTCLONG1_IRQ); | 136 | disable_irq(pie_irq); |
155 | } | 137 | } |
156 | 138 | ||
157 | static int vr41xx_rtc_read_time(struct device *dev, struct rtc_time *time) | 139 | static int vr41xx_rtc_read_time(struct device *dev, struct rtc_time *time) |
@@ -209,14 +191,14 @@ static int vr41xx_rtc_set_alarm(struct device *dev, struct rtc_wkalrm *wkalrm) | |||
209 | spin_lock_irq(&rtc_lock); | 191 | spin_lock_irq(&rtc_lock); |
210 | 192 | ||
211 | if (alarm_enabled) | 193 | if (alarm_enabled) |
212 | disable_irq(ELAPSEDTIME_IRQ); | 194 | disable_irq(aie_irq); |
213 | 195 | ||
214 | rtc1_write(ECMPLREG, (uint16_t)(alarm_sec << 15)); | 196 | rtc1_write(ECMPLREG, (uint16_t)(alarm_sec << 15)); |
215 | rtc1_write(ECMPMREG, (uint16_t)(alarm_sec >> 1)); | 197 | rtc1_write(ECMPMREG, (uint16_t)(alarm_sec >> 1)); |
216 | rtc1_write(ECMPHREG, (uint16_t)(alarm_sec >> 17)); | 198 | rtc1_write(ECMPHREG, (uint16_t)(alarm_sec >> 17)); |
217 | 199 | ||
218 | if (wkalrm->enabled) | 200 | if (wkalrm->enabled) |
219 | enable_irq(ELAPSEDTIME_IRQ); | 201 | enable_irq(aie_irq); |
220 | 202 | ||
221 | alarm_enabled = wkalrm->enabled; | 203 | alarm_enabled = wkalrm->enabled; |
222 | 204 | ||
@@ -234,7 +216,7 @@ static int vr41xx_rtc_ioctl(struct device *dev, unsigned int cmd, unsigned long | |||
234 | spin_lock_irq(&rtc_lock); | 216 | spin_lock_irq(&rtc_lock); |
235 | 217 | ||
236 | if (!alarm_enabled) { | 218 | if (!alarm_enabled) { |
237 | enable_irq(ELAPSEDTIME_IRQ); | 219 | enable_irq(aie_irq); |
238 | alarm_enabled = 1; | 220 | alarm_enabled = 1; |
239 | } | 221 | } |
240 | 222 | ||
@@ -244,17 +226,17 @@ static int vr41xx_rtc_ioctl(struct device *dev, unsigned int cmd, unsigned long | |||
244 | spin_lock_irq(&rtc_lock); | 226 | spin_lock_irq(&rtc_lock); |
245 | 227 | ||
246 | if (alarm_enabled) { | 228 | if (alarm_enabled) { |
247 | disable_irq(ELAPSEDTIME_IRQ); | 229 | disable_irq(aie_irq); |
248 | alarm_enabled = 0; | 230 | alarm_enabled = 0; |
249 | } | 231 | } |
250 | 232 | ||
251 | spin_unlock_irq(&rtc_lock); | 233 | spin_unlock_irq(&rtc_lock); |
252 | break; | 234 | break; |
253 | case RTC_PIE_ON: | 235 | case RTC_PIE_ON: |
254 | enable_irq(RTCLONG1_IRQ); | 236 | enable_irq(pie_irq); |
255 | break; | 237 | break; |
256 | case RTC_PIE_OFF: | 238 | case RTC_PIE_OFF: |
257 | disable_irq(RTCLONG1_IRQ); | 239 | disable_irq(pie_irq); |
258 | break; | 240 | break; |
259 | case RTC_IRQP_READ: | 241 | case RTC_IRQP_READ: |
260 | return put_user(periodic_frequency, (unsigned long __user *)arg); | 242 | return put_user(periodic_frequency, (unsigned long __user *)arg); |
@@ -331,31 +313,37 @@ static const struct rtc_class_ops vr41xx_rtc_ops = { | |||
331 | 313 | ||
332 | static int __devinit rtc_probe(struct platform_device *pdev) | 314 | static int __devinit rtc_probe(struct platform_device *pdev) |
333 | { | 315 | { |
316 | struct resource *res; | ||
334 | struct rtc_device *rtc; | 317 | struct rtc_device *rtc; |
335 | unsigned int irq; | ||
336 | int retval; | 318 | int retval; |
337 | 319 | ||
338 | if (pdev->num_resources != 2) | 320 | if (pdev->num_resources != 4) |
339 | return -EBUSY; | 321 | return -EBUSY; |
340 | 322 | ||
341 | rtc1_base = ioremap(pdev->resource[0].start, RTC1_SIZE); | 323 | res = platform_get_resource(pdev, IORESOURCE_MEM, 0); |
342 | if (rtc1_base == NULL) | 324 | if (!res) |
343 | return -EBUSY; | 325 | return -EBUSY; |
344 | 326 | ||
345 | rtc2_base = ioremap(pdev->resource[1].start, RTC2_SIZE); | 327 | rtc1_base = ioremap(res->start, res->end - res->start + 1); |
346 | if (rtc2_base == NULL) { | 328 | if (!rtc1_base) |
347 | iounmap(rtc1_base); | ||
348 | rtc1_base = NULL; | ||
349 | return -EBUSY; | 329 | return -EBUSY; |
330 | |||
331 | res = platform_get_resource(pdev, IORESOURCE_MEM, 1); | ||
332 | if (!res) { | ||
333 | retval = -EBUSY; | ||
334 | goto err_rtc1_iounmap; | ||
335 | } | ||
336 | |||
337 | rtc2_base = ioremap(res->start, res->end - res->start + 1); | ||
338 | if (!rtc2_base) { | ||
339 | retval = -EBUSY; | ||
340 | goto err_rtc1_iounmap; | ||
350 | } | 341 | } |
351 | 342 | ||
352 | rtc = rtc_device_register(rtc_name, &pdev->dev, &vr41xx_rtc_ops, THIS_MODULE); | 343 | rtc = rtc_device_register(rtc_name, &pdev->dev, &vr41xx_rtc_ops, THIS_MODULE); |
353 | if (IS_ERR(rtc)) { | 344 | if (IS_ERR(rtc)) { |
354 | iounmap(rtc1_base); | 345 | retval = PTR_ERR(rtc); |
355 | iounmap(rtc2_base); | 346 | goto err_iounmap_all; |
356 | rtc1_base = NULL; | ||
357 | rtc2_base = NULL; | ||
358 | return PTR_ERR(rtc); | ||
359 | } | 347 | } |
360 | 348 | ||
361 | spin_lock_irq(&rtc_lock); | 349 | spin_lock_irq(&rtc_lock); |
@@ -368,35 +356,50 @@ static int __devinit rtc_probe(struct platform_device *pdev) | |||
368 | 356 | ||
369 | spin_unlock_irq(&rtc_lock); | 357 | spin_unlock_irq(&rtc_lock); |
370 | 358 | ||
371 | irq = ELAPSEDTIME_IRQ; | 359 | aie_irq = platform_get_irq(pdev, 0); |
372 | retval = request_irq(irq, elapsedtime_interrupt, IRQF_DISABLED, | 360 | if (aie_irq < 0 || aie_irq >= NR_IRQS) { |
373 | "elapsed_time", pdev); | 361 | retval = -EBUSY; |
374 | if (retval == 0) { | 362 | goto err_device_unregister; |
375 | irq = RTCLONG1_IRQ; | ||
376 | retval = request_irq(irq, rtclong1_interrupt, IRQF_DISABLED, | ||
377 | "rtclong1", pdev); | ||
378 | } | 363 | } |
379 | 364 | ||
380 | if (retval < 0) { | 365 | retval = request_irq(aie_irq, elapsedtime_interrupt, IRQF_DISABLED, |
381 | printk(KERN_ERR "rtc: IRQ%d is busy\n", irq); | 366 | "elapsed_time", pdev); |
382 | rtc_device_unregister(rtc); | 367 | if (retval < 0) |
383 | if (irq == RTCLONG1_IRQ) | 368 | goto err_device_unregister; |
384 | free_irq(ELAPSEDTIME_IRQ, NULL); | 369 | |
385 | iounmap(rtc1_base); | 370 | pie_irq = platform_get_irq(pdev, 1); |
386 | iounmap(rtc2_base); | 371 | if (pie_irq < 0 || pie_irq >= NR_IRQS) |
387 | rtc1_base = NULL; | 372 | goto err_free_irq; |
388 | rtc2_base = NULL; | 373 | |
389 | return retval; | 374 | retval = request_irq(pie_irq, rtclong1_interrupt, IRQF_DISABLED, |
390 | } | 375 | "rtclong1", pdev); |
376 | if (retval < 0) | ||
377 | goto err_free_irq; | ||
391 | 378 | ||
392 | platform_set_drvdata(pdev, rtc); | 379 | platform_set_drvdata(pdev, rtc); |
393 | 380 | ||
394 | disable_irq(ELAPSEDTIME_IRQ); | 381 | disable_irq(aie_irq); |
395 | disable_irq(RTCLONG1_IRQ); | 382 | disable_irq(pie_irq); |
396 | 383 | ||
397 | printk(KERN_INFO "rtc: Real Time Clock of NEC VR4100 series\n"); | 384 | printk(KERN_INFO "rtc: Real Time Clock of NEC VR4100 series\n"); |
398 | 385 | ||
399 | return 0; | 386 | return 0; |
387 | |||
388 | err_free_irq: | ||
389 | free_irq(aie_irq, pdev); | ||
390 | |||
391 | err_device_unregister: | ||
392 | rtc_device_unregister(rtc); | ||
393 | |||
394 | err_iounmap_all: | ||
395 | iounmap(rtc2_base); | ||
396 | rtc2_base = NULL; | ||
397 | |||
398 | err_rtc1_iounmap: | ||
399 | iounmap(rtc1_base); | ||
400 | rtc1_base = NULL; | ||
401 | |||
402 | return retval; | ||
400 | } | 403 | } |
401 | 404 | ||
402 | static int __devexit rtc_remove(struct platform_device *pdev) | 405 | static int __devexit rtc_remove(struct platform_device *pdev) |
@@ -404,23 +407,21 @@ static int __devexit rtc_remove(struct platform_device *pdev) | |||
404 | struct rtc_device *rtc; | 407 | struct rtc_device *rtc; |
405 | 408 | ||
406 | rtc = platform_get_drvdata(pdev); | 409 | rtc = platform_get_drvdata(pdev); |
407 | if (rtc != NULL) | 410 | if (rtc) |
408 | rtc_device_unregister(rtc); | 411 | rtc_device_unregister(rtc); |
409 | 412 | ||
410 | platform_set_drvdata(pdev, NULL); | 413 | platform_set_drvdata(pdev, NULL); |
411 | 414 | ||
412 | free_irq(ELAPSEDTIME_IRQ, NULL); | 415 | free_irq(aie_irq, pdev); |
413 | free_irq(RTCLONG1_IRQ, NULL); | 416 | free_irq(pie_irq, pdev); |
414 | if (rtc1_base != NULL) | 417 | if (rtc1_base) |
415 | iounmap(rtc1_base); | 418 | iounmap(rtc1_base); |
416 | if (rtc2_base != NULL) | 419 | if (rtc2_base) |
417 | iounmap(rtc2_base); | 420 | iounmap(rtc2_base); |
418 | 421 | ||
419 | return 0; | 422 | return 0; |
420 | } | 423 | } |
421 | 424 | ||
422 | static struct platform_device *rtc_platform_device; | ||
423 | |||
424 | static struct platform_driver rtc_platform_driver = { | 425 | static struct platform_driver rtc_platform_driver = { |
425 | .probe = rtc_probe, | 426 | .probe = rtc_probe, |
426 | .remove = __devexit_p(rtc_remove), | 427 | .remove = __devexit_p(rtc_remove), |
@@ -432,55 +433,12 @@ static struct platform_driver rtc_platform_driver = { | |||
432 | 433 | ||
433 | static int __init vr41xx_rtc_init(void) | 434 | static int __init vr41xx_rtc_init(void) |
434 | { | 435 | { |
435 | int retval; | 436 | return platform_driver_register(&rtc_platform_driver); |
436 | |||
437 | switch (current_cpu_data.cputype) { | ||
438 | case CPU_VR4111: | ||
439 | case CPU_VR4121: | ||
440 | rtc_resource[0].start = RTC1_TYPE1_START; | ||
441 | rtc_resource[0].end = RTC1_TYPE1_END; | ||
442 | rtc_resource[1].start = RTC2_TYPE1_START; | ||
443 | rtc_resource[1].end = RTC2_TYPE1_END; | ||
444 | break; | ||
445 | case CPU_VR4122: | ||
446 | case CPU_VR4131: | ||
447 | case CPU_VR4133: | ||
448 | rtc_resource[0].start = RTC1_TYPE2_START; | ||
449 | rtc_resource[0].end = RTC1_TYPE2_END; | ||
450 | rtc_resource[1].start = RTC2_TYPE2_START; | ||
451 | rtc_resource[1].end = RTC2_TYPE2_END; | ||
452 | break; | ||
453 | default: | ||
454 | return -ENODEV; | ||
455 | break; | ||
456 | } | ||
457 | |||
458 | rtc_platform_device = platform_device_alloc("RTC", -1); | ||
459 | if (rtc_platform_device == NULL) | ||
460 | return -ENOMEM; | ||
461 | |||
462 | retval = platform_device_add_resources(rtc_platform_device, | ||
463 | rtc_resource, ARRAY_SIZE(rtc_resource)); | ||
464 | |||
465 | if (retval == 0) | ||
466 | retval = platform_device_add(rtc_platform_device); | ||
467 | |||
468 | if (retval < 0) { | ||
469 | platform_device_put(rtc_platform_device); | ||
470 | return retval; | ||
471 | } | ||
472 | |||
473 | retval = platform_driver_register(&rtc_platform_driver); | ||
474 | if (retval < 0) | ||
475 | platform_device_unregister(rtc_platform_device); | ||
476 | |||
477 | return retval; | ||
478 | } | 437 | } |
479 | 438 | ||
480 | static void __exit vr41xx_rtc_exit(void) | 439 | static void __exit vr41xx_rtc_exit(void) |
481 | { | 440 | { |
482 | platform_driver_unregister(&rtc_platform_driver); | 441 | platform_driver_unregister(&rtc_platform_driver); |
483 | platform_device_unregister(rtc_platform_device); | ||
484 | } | 442 | } |
485 | 443 | ||
486 | module_init(vr41xx_rtc_init); | 444 | module_init(vr41xx_rtc_init); |
diff --git a/drivers/serial/vr41xx_siu.c b/drivers/serial/vr41xx_siu.c index cf0e663b42ed..85309acb75f6 100644 --- a/drivers/serial/vr41xx_siu.c +++ b/drivers/serial/vr41xx_siu.c | |||
@@ -1,7 +1,7 @@ | |||
1 | /* | 1 | /* |
2 | * Driver for NEC VR4100 series Serial Interface Unit. | 2 | * Driver for NEC VR4100 series Serial Interface Unit. |
3 | * | 3 | * |
4 | * Copyright (C) 2004-2005 Yoichi Yuasa <yoichi_yuasa@tripeaks.co.jp> | 4 | * Copyright (C) 2004-2007 Yoichi Yuasa <yoichi_yuasa@tripeaks.co.jp> |
5 | * | 5 | * |
6 | * Based on drivers/serial/8250.c, by Russell King. | 6 | * Based on drivers/serial/8250.c, by Russell King. |
7 | * | 7 | * |
@@ -25,12 +25,12 @@ | |||
25 | #endif | 25 | #endif |
26 | 26 | ||
27 | #include <linux/console.h> | 27 | #include <linux/console.h> |
28 | #include <linux/platform_device.h> | 28 | #include <linux/errno.h> |
29 | #include <linux/err.h> | ||
30 | #include <linux/ioport.h> | ||
31 | #include <linux/init.h> | 29 | #include <linux/init.h> |
32 | #include <linux/interrupt.h> | 30 | #include <linux/interrupt.h> |
31 | #include <linux/ioport.h> | ||
33 | #include <linux/module.h> | 32 | #include <linux/module.h> |
33 | #include <linux/platform_device.h> | ||
34 | #include <linux/serial.h> | 34 | #include <linux/serial.h> |
35 | #include <linux/serial_core.h> | 35 | #include <linux/serial_core.h> |
36 | #include <linux/serial_reg.h> | 36 | #include <linux/serial_reg.h> |
@@ -38,11 +38,9 @@ | |||
38 | #include <linux/tty_flip.h> | 38 | #include <linux/tty_flip.h> |
39 | 39 | ||
40 | #include <asm/io.h> | 40 | #include <asm/io.h> |
41 | #include <asm/vr41xx/irq.h> | ||
42 | #include <asm/vr41xx/siu.h> | 41 | #include <asm/vr41xx/siu.h> |
43 | #include <asm/vr41xx/vr41xx.h> | 42 | #include <asm/vr41xx/vr41xx.h> |
44 | 43 | ||
45 | #define SIU_PORTS_MAX 2 | ||
46 | #define SIU_BAUD_BASE 1152000 | 44 | #define SIU_BAUD_BASE 1152000 |
47 | #define SIU_MAJOR 204 | 45 | #define SIU_MAJOR 204 |
48 | #define SIU_MINOR_BASE 82 | 46 | #define SIU_MINOR_BASE 82 |
@@ -60,32 +58,13 @@ | |||
60 | #define IRUSESEL 0x02 | 58 | #define IRUSESEL 0x02 |
61 | #define SIRSEL 0x01 | 59 | #define SIRSEL 0x01 |
62 | 60 | ||
63 | struct siu_port { | 61 | static struct uart_port siu_uart_ports[SIU_PORTS_MAX] = { |
64 | unsigned int type; | 62 | [0 ... SIU_PORTS_MAX-1] = { |
65 | unsigned int irq; | 63 | .lock = __SPIN_LOCK_UNLOCKED(siu_uart_ports->lock), |
66 | unsigned long start; | 64 | .irq = -1, |
67 | }; | 65 | }, |
68 | |||
69 | static const struct siu_port siu_type1_ports[] = { | ||
70 | { .type = PORT_VR41XX_SIU, | ||
71 | .irq = SIU_IRQ, | ||
72 | .start = 0x0c000000UL, }, | ||
73 | }; | ||
74 | |||
75 | #define SIU_TYPE1_NR_PORTS (sizeof(siu_type1_ports) / sizeof(struct siu_port)) | ||
76 | |||
77 | static const struct siu_port siu_type2_ports[] = { | ||
78 | { .type = PORT_VR41XX_SIU, | ||
79 | .irq = SIU_IRQ, | ||
80 | .start = 0x0f000800UL, }, | ||
81 | { .type = PORT_VR41XX_DSIU, | ||
82 | .irq = DSIU_IRQ, | ||
83 | .start = 0x0f000820UL, }, | ||
84 | }; | 66 | }; |
85 | 67 | ||
86 | #define SIU_TYPE2_NR_PORTS (sizeof(siu_type2_ports) / sizeof(struct siu_port)) | ||
87 | |||
88 | static struct uart_port siu_uart_ports[SIU_PORTS_MAX]; | ||
89 | static uint8_t lsr_break_flag[SIU_PORTS_MAX]; | 68 | static uint8_t lsr_break_flag[SIU_PORTS_MAX]; |
90 | 69 | ||
91 | #define siu_read(port, offset) readb((port)->membase + (offset)) | 70 | #define siu_read(port, offset) readb((port)->membase + (offset)) |
@@ -110,7 +89,6 @@ void vr41xx_select_siu_interface(siu_interface_t interface) | |||
110 | 89 | ||
111 | spin_unlock_irqrestore(&port->lock, flags); | 90 | spin_unlock_irqrestore(&port->lock, flags); |
112 | } | 91 | } |
113 | |||
114 | EXPORT_SYMBOL_GPL(vr41xx_select_siu_interface); | 92 | EXPORT_SYMBOL_GPL(vr41xx_select_siu_interface); |
115 | 93 | ||
116 | void vr41xx_use_irda(irda_use_t use) | 94 | void vr41xx_use_irda(irda_use_t use) |
@@ -132,7 +110,6 @@ void vr41xx_use_irda(irda_use_t use) | |||
132 | 110 | ||
133 | spin_unlock_irqrestore(&port->lock, flags); | 111 | spin_unlock_irqrestore(&port->lock, flags); |
134 | } | 112 | } |
135 | |||
136 | EXPORT_SYMBOL_GPL(vr41xx_use_irda); | 113 | EXPORT_SYMBOL_GPL(vr41xx_use_irda); |
137 | 114 | ||
138 | void vr41xx_select_irda_module(irda_module_t module, irda_speed_t speed) | 115 | void vr41xx_select_irda_module(irda_module_t module, irda_speed_t speed) |
@@ -166,7 +143,6 @@ void vr41xx_select_irda_module(irda_module_t module, irda_speed_t speed) | |||
166 | 143 | ||
167 | spin_unlock_irqrestore(&port->lock, flags); | 144 | spin_unlock_irqrestore(&port->lock, flags); |
168 | } | 145 | } |
169 | |||
170 | EXPORT_SYMBOL_GPL(vr41xx_select_irda_module); | 146 | EXPORT_SYMBOL_GPL(vr41xx_select_irda_module); |
171 | 147 | ||
172 | static inline void siu_clear_fifo(struct uart_port *port) | 148 | static inline void siu_clear_fifo(struct uart_port *port) |
@@ -177,21 +153,6 @@ static inline void siu_clear_fifo(struct uart_port *port) | |||
177 | siu_write(port, UART_FCR, 0); | 153 | siu_write(port, UART_FCR, 0); |
178 | } | 154 | } |
179 | 155 | ||
180 | static inline int siu_probe_ports(void) | ||
181 | { | ||
182 | switch (current_cpu_data.cputype) { | ||
183 | case CPU_VR4111: | ||
184 | case CPU_VR4121: | ||
185 | return SIU_TYPE1_NR_PORTS; | ||
186 | case CPU_VR4122: | ||
187 | case CPU_VR4131: | ||
188 | case CPU_VR4133: | ||
189 | return SIU_TYPE2_NR_PORTS; | ||
190 | } | ||
191 | |||
192 | return 0; | ||
193 | } | ||
194 | |||
195 | static inline unsigned long siu_port_size(struct uart_port *port) | 156 | static inline unsigned long siu_port_size(struct uart_port *port) |
196 | { | 157 | { |
197 | switch (port->type) { | 158 | switch (port->type) { |
@@ -206,21 +167,10 @@ static inline unsigned long siu_port_size(struct uart_port *port) | |||
206 | 167 | ||
207 | static inline unsigned int siu_check_type(struct uart_port *port) | 168 | static inline unsigned int siu_check_type(struct uart_port *port) |
208 | { | 169 | { |
209 | switch (current_cpu_data.cputype) { | 170 | if (port->line == 0) |
210 | case CPU_VR4111: | 171 | return PORT_VR41XX_SIU; |
211 | case CPU_VR4121: | 172 | if (port->line == 1 && port->irq != -1) |
212 | if (port->line == 0) | 173 | return PORT_VR41XX_DSIU; |
213 | return PORT_VR41XX_SIU; | ||
214 | break; | ||
215 | case CPU_VR4122: | ||
216 | case CPU_VR4131: | ||
217 | case CPU_VR4133: | ||
218 | if (port->line == 0) | ||
219 | return PORT_VR41XX_SIU; | ||
220 | else if (port->line == 1) | ||
221 | return PORT_VR41XX_DSIU; | ||
222 | break; | ||
223 | } | ||
224 | 174 | ||
225 | return PORT_UNKNOWN; | 175 | return PORT_UNKNOWN; |
226 | } | 176 | } |
@@ -751,44 +701,34 @@ static struct uart_ops siu_uart_ops = { | |||
751 | .verify_port = siu_verify_port, | 701 | .verify_port = siu_verify_port, |
752 | }; | 702 | }; |
753 | 703 | ||
754 | static int siu_init_ports(void) | 704 | static int siu_init_ports(struct platform_device *pdev) |
755 | { | 705 | { |
756 | const struct siu_port *siu; | ||
757 | struct uart_port *port; | 706 | struct uart_port *port; |
758 | int i, num; | 707 | struct resource *res; |
708 | int *type = pdev->dev.platform_data; | ||
709 | int i; | ||
759 | 710 | ||
760 | switch (current_cpu_data.cputype) { | 711 | if (!type) |
761 | case CPU_VR4111: | ||
762 | case CPU_VR4121: | ||
763 | siu = siu_type1_ports; | ||
764 | break; | ||
765 | case CPU_VR4122: | ||
766 | case CPU_VR4131: | ||
767 | case CPU_VR4133: | ||
768 | siu = siu_type2_ports; | ||
769 | break; | ||
770 | default: | ||
771 | return 0; | 712 | return 0; |
772 | } | ||
773 | 713 | ||
774 | port = siu_uart_ports; | 714 | port = siu_uart_ports; |
775 | num = siu_probe_ports(); | 715 | for (i = 0; i < SIU_PORTS_MAX; i++) { |
776 | for (i = 0; i < num; i++) { | 716 | port->type = type[i]; |
777 | spin_lock_init(&port->lock); | 717 | if (port->type == PORT_UNKNOWN) |
778 | port->irq = siu->irq; | 718 | continue; |
719 | port->irq = platform_get_irq(pdev, i); | ||
779 | port->uartclk = SIU_BAUD_BASE * 16; | 720 | port->uartclk = SIU_BAUD_BASE * 16; |
780 | port->fifosize = 16; | 721 | port->fifosize = 16; |
781 | port->regshift = 0; | 722 | port->regshift = 0; |
782 | port->iotype = UPIO_MEM; | 723 | port->iotype = UPIO_MEM; |
783 | port->flags = UPF_IOREMAP | UPF_BOOT_AUTOCONF; | 724 | port->flags = UPF_IOREMAP | UPF_BOOT_AUTOCONF; |
784 | port->type = siu->type; | ||
785 | port->line = i; | 725 | port->line = i; |
786 | port->mapbase = siu->start; | 726 | res = platform_get_resource(pdev, IORESOURCE_MEM, i); |
787 | siu++; | 727 | port->mapbase = res->start; |
788 | port++; | 728 | port++; |
789 | } | 729 | } |
790 | 730 | ||
791 | return num; | 731 | return i; |
792 | } | 732 | } |
793 | 733 | ||
794 | #ifdef CONFIG_SERIAL_VR41XX_CONSOLE | 734 | #ifdef CONFIG_SERIAL_VR41XX_CONSOLE |
@@ -883,13 +823,9 @@ static struct console siu_console = { | |||
883 | static int __devinit siu_console_init(void) | 823 | static int __devinit siu_console_init(void) |
884 | { | 824 | { |
885 | struct uart_port *port; | 825 | struct uart_port *port; |
886 | int num, i; | 826 | int i; |
887 | |||
888 | num = siu_init_ports(); | ||
889 | if (num <= 0) | ||
890 | return -ENODEV; | ||
891 | 827 | ||
892 | for (i = 0; i < num; i++) { | 828 | for (i = 0; i < SIU_PORTS_MAX; i++) { |
893 | port = &siu_uart_ports[i]; | 829 | port = &siu_uart_ports[i]; |
894 | port->ops = &siu_uart_ops; | 830 | port->ops = &siu_uart_ops; |
895 | } | 831 | } |
@@ -920,7 +856,7 @@ static int __devinit siu_probe(struct platform_device *dev) | |||
920 | struct uart_port *port; | 856 | struct uart_port *port; |
921 | int num, i, retval; | 857 | int num, i, retval; |
922 | 858 | ||
923 | num = siu_init_ports(); | 859 | num = siu_init_ports(dev); |
924 | if (num <= 0) | 860 | if (num <= 0) |
925 | return -ENODEV; | 861 | return -ENODEV; |
926 | 862 | ||
@@ -998,8 +934,6 @@ static int siu_resume(struct platform_device *dev) | |||
998 | return 0; | 934 | return 0; |
999 | } | 935 | } |
1000 | 936 | ||
1001 | static struct platform_device *siu_platform_device; | ||
1002 | |||
1003 | static struct platform_driver siu_device_driver = { | 937 | static struct platform_driver siu_device_driver = { |
1004 | .probe = siu_probe, | 938 | .probe = siu_probe, |
1005 | .remove = __devexit_p(siu_remove), | 939 | .remove = __devexit_p(siu_remove), |
@@ -1013,29 +947,12 @@ static struct platform_driver siu_device_driver = { | |||
1013 | 947 | ||
1014 | static int __init vr41xx_siu_init(void) | 948 | static int __init vr41xx_siu_init(void) |
1015 | { | 949 | { |
1016 | int retval; | 950 | return platform_driver_register(&siu_device_driver); |
1017 | |||
1018 | siu_platform_device = platform_device_alloc("SIU", -1); | ||
1019 | if (!siu_platform_device) | ||
1020 | return -ENOMEM; | ||
1021 | |||
1022 | retval = platform_device_add(siu_platform_device); | ||
1023 | if (retval < 0) { | ||
1024 | platform_device_put(siu_platform_device); | ||
1025 | return retval; | ||
1026 | } | ||
1027 | |||
1028 | retval = platform_driver_register(&siu_device_driver); | ||
1029 | if (retval < 0) | ||
1030 | platform_device_unregister(siu_platform_device); | ||
1031 | |||
1032 | return retval; | ||
1033 | } | 951 | } |
1034 | 952 | ||
1035 | static void __exit vr41xx_siu_exit(void) | 953 | static void __exit vr41xx_siu_exit(void) |
1036 | { | 954 | { |
1037 | platform_driver_unregister(&siu_device_driver); | 955 | platform_driver_unregister(&siu_device_driver); |
1038 | platform_device_unregister(siu_platform_device); | ||
1039 | } | 956 | } |
1040 | 957 | ||
1041 | module_init(vr41xx_siu_init); | 958 | module_init(vr41xx_siu_init); |
diff --git a/drivers/tc/zs.c b/drivers/tc/zs.c index 4fff61b32dcb..ed979f13908a 100644 --- a/drivers/tc/zs.c +++ b/drivers/tc/zs.c | |||
@@ -136,14 +136,14 @@ struct dec_serial *zs_chain; /* list of all channels */ | |||
136 | struct tty_struct zs_ttys[NUM_CHANNELS]; | 136 | struct tty_struct zs_ttys[NUM_CHANNELS]; |
137 | 137 | ||
138 | #ifdef CONFIG_SERIAL_DEC_CONSOLE | 138 | #ifdef CONFIG_SERIAL_DEC_CONSOLE |
139 | static struct console sercons; | 139 | static struct console zs_console; |
140 | #endif | 140 | #endif |
141 | #if defined(CONFIG_SERIAL_DEC_CONSOLE) && defined(CONFIG_MAGIC_SYSRQ) && \ | 141 | #if defined(CONFIG_SERIAL_DEC_CONSOLE) && defined(CONFIG_MAGIC_SYSRQ) && \ |
142 | !defined(MODULE) | 142 | !defined(MODULE) |
143 | static unsigned long break_pressed; /* break, really ... */ | 143 | static unsigned long break_pressed; /* break, really ... */ |
144 | #endif | 144 | #endif |
145 | 145 | ||
146 | static unsigned char zs_init_regs[16] = { | 146 | static unsigned char zs_init_regs[16] __initdata = { |
147 | 0, /* write 0 */ | 147 | 0, /* write 0 */ |
148 | 0, /* write 1 */ | 148 | 0, /* write 1 */ |
149 | 0, /* write 2 */ | 149 | 0, /* write 2 */ |
@@ -383,7 +383,7 @@ static void receive_chars(struct dec_serial *info) | |||
383 | 383 | ||
384 | #if defined(CONFIG_SERIAL_DEC_CONSOLE) && defined(CONFIG_MAGIC_SYSRQ) && \ | 384 | #if defined(CONFIG_SERIAL_DEC_CONSOLE) && defined(CONFIG_MAGIC_SYSRQ) && \ |
385 | !defined(MODULE) | 385 | !defined(MODULE) |
386 | if (break_pressed && info->line == sercons.index) { | 386 | if (break_pressed && info->line == zs_console.index) { |
387 | /* Ignore the null char got when BREAK is removed. */ | 387 | /* Ignore the null char got when BREAK is removed. */ |
388 | if (ch == 0) | 388 | if (ch == 0) |
389 | continue; | 389 | continue; |
@@ -446,7 +446,7 @@ static void status_handle(struct dec_serial *info) | |||
446 | if ((stat & BRK_ABRT) && !(info->read_reg_zero & BRK_ABRT)) { | 446 | if ((stat & BRK_ABRT) && !(info->read_reg_zero & BRK_ABRT)) { |
447 | #if defined(CONFIG_SERIAL_DEC_CONSOLE) && defined(CONFIG_MAGIC_SYSRQ) && \ | 447 | #if defined(CONFIG_SERIAL_DEC_CONSOLE) && defined(CONFIG_MAGIC_SYSRQ) && \ |
448 | !defined(MODULE) | 448 | !defined(MODULE) |
449 | if (info->line == sercons.index) { | 449 | if (info->line == zs_console.index) { |
450 | if (!break_pressed) | 450 | if (!break_pressed) |
451 | break_pressed = jiffies; | 451 | break_pressed = jiffies; |
452 | } else | 452 | } else |
@@ -1557,9 +1557,9 @@ static int rs_open(struct tty_struct *tty, struct file * filp) | |||
1557 | } | 1557 | } |
1558 | 1558 | ||
1559 | #ifdef CONFIG_SERIAL_DEC_CONSOLE | 1559 | #ifdef CONFIG_SERIAL_DEC_CONSOLE |
1560 | if (sercons.cflag && sercons.index == line) { | 1560 | if (zs_console.cflag && zs_console.index == line) { |
1561 | tty->termios->c_cflag = sercons.cflag; | 1561 | tty->termios->c_cflag = zs_console.cflag; |
1562 | sercons.cflag = 0; | 1562 | zs_console.cflag = 0; |
1563 | change_speed(info); | 1563 | change_speed(info); |
1564 | } | 1564 | } |
1565 | #endif | 1565 | #endif |
@@ -1581,7 +1581,7 @@ static void __init show_serial_version(void) | |||
1581 | /* Initialize Z8530s zs_channels | 1581 | /* Initialize Z8530s zs_channels |
1582 | */ | 1582 | */ |
1583 | 1583 | ||
1584 | static void probe_sccs(void) | 1584 | static void __init probe_sccs(void) |
1585 | { | 1585 | { |
1586 | struct dec_serial **pp; | 1586 | struct dec_serial **pp; |
1587 | int i, n, n_chips = 0, n_channels, chip, channel; | 1587 | int i, n, n_chips = 0, n_channels, chip, channel; |
@@ -1923,7 +1923,7 @@ static struct tty_driver *serial_console_device(struct console *c, int *index) | |||
1923 | * - initialize the serial port | 1923 | * - initialize the serial port |
1924 | * Return non-zero if we didn't find a serial port. | 1924 | * Return non-zero if we didn't find a serial port. |
1925 | */ | 1925 | */ |
1926 | static int serial_console_setup(struct console *co, char *options) | 1926 | static int __init serial_console_setup(struct console *co, char *options) |
1927 | { | 1927 | { |
1928 | struct dec_serial *info; | 1928 | struct dec_serial *info; |
1929 | int baud = 9600; | 1929 | int baud = 9600; |
@@ -2069,7 +2069,7 @@ static int serial_console_setup(struct console *co, char *options) | |||
2069 | return 0; | 2069 | return 0; |
2070 | } | 2070 | } |
2071 | 2071 | ||
2072 | static struct console sercons = { | 2072 | static struct console zs_console = { |
2073 | .name = "ttyS", | 2073 | .name = "ttyS", |
2074 | .write = serial_console_write, | 2074 | .write = serial_console_write, |
2075 | .device = serial_console_device, | 2075 | .device = serial_console_device, |
@@ -2083,7 +2083,7 @@ static struct console sercons = { | |||
2083 | */ | 2083 | */ |
2084 | void __init zs_serial_console_init(void) | 2084 | void __init zs_serial_console_init(void) |
2085 | { | 2085 | { |
2086 | register_console(&sercons); | 2086 | register_console(&zs_console); |
2087 | } | 2087 | } |
2088 | #endif /* ifdef CONFIG_SERIAL_DEC_CONSOLE */ | 2088 | #endif /* ifdef CONFIG_SERIAL_DEC_CONSOLE */ |
2089 | 2089 | ||