aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Miller <davem@davemloft.net>2008-10-13 05:36:31 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2008-10-13 12:51:40 -0400
commitb70ac7718579b5cbf3bdd74fd01132d1c91596f4 (patch)
treea418dec814cbdea806c7767c0d77928bfe9091bc
parentb5d674abcffeacaf83038bbf7c0caf24edd497dd (diff)
serial: allow 8250 to be used on sparc
This requires three changes: 1) Remove !SPARC restriction in Kconfig. 2) Move Sparc specific serial drivers before 8250, so that serial console devices don't change names on us, even if 8250 finds devices. 3) Since the Sparc specific serial drivers try to use the same major/minor device namespace as 8250, some coordination is necessary. Use the sunserial_*() layer routines to allocate minor number space within TTY_MAJOR when CONFIG_SPARC. This has no effect on other platforms. Thanks to Josip Rodin for bringing up this issue and testing plus debugging various revisions of this patch. Signed-off-by: David S. Miller <davem@davemloft.net> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Alan Cox <alan@redhat.com> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
-rw-r--r--arch/sparc/include/asm/serial.h6
-rw-r--r--drivers/serial/8250.c21
-rw-r--r--drivers/serial/Kconfig1
-rw-r--r--drivers/serial/Makefile15
4 files changed, 33 insertions, 10 deletions
diff --git a/arch/sparc/include/asm/serial.h b/arch/sparc/include/asm/serial.h
new file mode 100644
index 000000000000..f90d61c28059
--- /dev/null
+++ b/arch/sparc/include/asm/serial.h
@@ -0,0 +1,6 @@
1#ifndef __SPARC_SERIAL_H
2#define __SPARC_SERIAL_H
3
4#define BASE_BAUD ( 1843200 / 16 )
5
6#endif /* __SPARC_SERIAL_H */
diff --git a/drivers/serial/8250.c b/drivers/serial/8250.c
index ed593c4b6e7d..db2cdc103c88 100644
--- a/drivers/serial/8250.c
+++ b/drivers/serial/8250.c
@@ -44,6 +44,10 @@
44 44
45#include "8250.h" 45#include "8250.h"
46 46
47#ifdef CONFIG_SPARC
48#include "suncore.h"
49#endif
50
47/* 51/*
48 * Configuration: 52 * Configuration:
49 * share_irqs - whether we pass IRQF_SHARED to request_irq(). This option 53 * share_irqs - whether we pass IRQF_SHARED to request_irq(). This option
@@ -2676,7 +2680,6 @@ static struct uart_driver serial8250_reg = {
2676 .dev_name = "ttyS", 2680 .dev_name = "ttyS",
2677 .major = TTY_MAJOR, 2681 .major = TTY_MAJOR,
2678 .minor = 64, 2682 .minor = 64,
2679 .nr = UART_NR,
2680 .cons = SERIAL8250_CONSOLE, 2683 .cons = SERIAL8250_CONSOLE,
2681}; 2684};
2682 2685
@@ -2958,10 +2961,12 @@ static int __init serial8250_init(void)
2958 "%d ports, IRQ sharing %sabled\n", nr_uarts, 2961 "%d ports, IRQ sharing %sabled\n", nr_uarts,
2959 share_irqs ? "en" : "dis"); 2962 share_irqs ? "en" : "dis");
2960 2963
2961 for (i = 0; i < NR_IRQS; i++) 2964#ifdef CONFIG_SPARC
2962 spin_lock_init(&irq_lists[i].lock); 2965 ret = sunserial_register_minors(&serial8250_reg, UART_NR);
2963 2966#else
2967 serial8250_reg.nr = UART_NR;
2964 ret = uart_register_driver(&serial8250_reg); 2968 ret = uart_register_driver(&serial8250_reg);
2969#endif
2965 if (ret) 2970 if (ret)
2966 goto out; 2971 goto out;
2967 2972
@@ -2986,7 +2991,11 @@ static int __init serial8250_init(void)
2986 put_dev: 2991 put_dev:
2987 platform_device_put(serial8250_isa_devs); 2992 platform_device_put(serial8250_isa_devs);
2988 unreg_uart_drv: 2993 unreg_uart_drv:
2994#ifdef CONFIG_SPARC
2995 sunserial_unregister_minors(&serial8250_reg, UART_NR);
2996#else
2989 uart_unregister_driver(&serial8250_reg); 2997 uart_unregister_driver(&serial8250_reg);
2998#endif
2990 out: 2999 out:
2991 return ret; 3000 return ret;
2992} 3001}
@@ -3005,7 +3014,11 @@ static void __exit serial8250_exit(void)
3005 platform_driver_unregister(&serial8250_isa_driver); 3014 platform_driver_unregister(&serial8250_isa_driver);
3006 platform_device_unregister(isa_dev); 3015 platform_device_unregister(isa_dev);
3007 3016
3017#ifdef CONFIG_SPARC
3018 sunserial_unregister_minors(&serial8250_reg, UART_NR);
3019#else
3008 uart_unregister_driver(&serial8250_reg); 3020 uart_unregister_driver(&serial8250_reg);
3021#endif
3009} 3022}
3010 3023
3011module_init(serial8250_init); 3024module_init(serial8250_init);
diff --git a/drivers/serial/Kconfig b/drivers/serial/Kconfig
index 0db20452c79a..31786b3b0a68 100644
--- a/drivers/serial/Kconfig
+++ b/drivers/serial/Kconfig
@@ -9,7 +9,6 @@ menu "Serial drivers"
9# The new 8250/16550 serial drivers 9# The new 8250/16550 serial drivers
10config SERIAL_8250 10config SERIAL_8250
11 tristate "8250/16550 and compatible serial support" 11 tristate "8250/16550 and compatible serial support"
12 depends on (BROKEN || !SPARC)
13 select SERIAL_CORE 12 select SERIAL_CORE
14 ---help--- 13 ---help---
15 This selects whether you want to include the driver for the standard 14 This selects whether you want to include the driver for the standard
diff --git a/drivers/serial/Makefile b/drivers/serial/Makefile
index 1462eb3f7bd2..0c17c8ddb19d 100644
--- a/drivers/serial/Makefile
+++ b/drivers/serial/Makefile
@@ -4,6 +4,16 @@
4 4
5obj-$(CONFIG_SERIAL_CORE) += serial_core.o 5obj-$(CONFIG_SERIAL_CORE) += serial_core.o
6obj-$(CONFIG_SERIAL_21285) += 21285.o 6obj-$(CONFIG_SERIAL_21285) += 21285.o
7
8# These Sparc drivers have to appear before others such as 8250
9# which share ttySx minor node space. Otherwise console device
10# names change and other unplesantries.
11obj-$(CONFIG_SERIAL_SUNCORE) += suncore.o
12obj-$(CONFIG_SERIAL_SUNHV) += sunhv.o
13obj-$(CONFIG_SERIAL_SUNZILOG) += sunzilog.o
14obj-$(CONFIG_SERIAL_SUNSU) += sunsu.o
15obj-$(CONFIG_SERIAL_SUNSAB) += sunsab.o
16
7obj-$(CONFIG_SERIAL_8250) += 8250.o 17obj-$(CONFIG_SERIAL_8250) += 8250.o
8obj-$(CONFIG_SERIAL_8250_PNP) += 8250_pnp.o 18obj-$(CONFIG_SERIAL_8250_PNP) += 8250_pnp.o
9obj-$(CONFIG_SERIAL_8250_GSC) += 8250_gsc.o 19obj-$(CONFIG_SERIAL_8250_GSC) += 8250_gsc.o
@@ -31,12 +41,7 @@ obj-$(CONFIG_SERIAL_S3C2400) += s3c2400.o
31obj-$(CONFIG_SERIAL_S3C2410) += s3c2410.o 41obj-$(CONFIG_SERIAL_S3C2410) += s3c2410.o
32obj-$(CONFIG_SERIAL_S3C2412) += s3c2412.o 42obj-$(CONFIG_SERIAL_S3C2412) += s3c2412.o
33obj-$(CONFIG_SERIAL_S3C2440) += s3c2440.o 43obj-$(CONFIG_SERIAL_S3C2440) += s3c2440.o
34obj-$(CONFIG_SERIAL_SUNCORE) += suncore.o
35obj-$(CONFIG_SERIAL_SUNHV) += sunhv.o
36obj-$(CONFIG_SERIAL_SUNZILOG) += sunzilog.o
37obj-$(CONFIG_SERIAL_IP22_ZILOG) += ip22zilog.o 44obj-$(CONFIG_SERIAL_IP22_ZILOG) += ip22zilog.o
38obj-$(CONFIG_SERIAL_SUNSU) += sunsu.o
39obj-$(CONFIG_SERIAL_SUNSAB) += sunsab.o
40obj-$(CONFIG_SERIAL_MUX) += mux.o 45obj-$(CONFIG_SERIAL_MUX) += mux.o
41obj-$(CONFIG_SERIAL_68328) += 68328serial.o 46obj-$(CONFIG_SERIAL_68328) += 68328serial.o
42obj-$(CONFIG_SERIAL_68360) += 68360serial.o 47obj-$(CONFIG_SERIAL_68360) += 68360serial.o