Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

David Miller and committed by
Linus Torvalds
b70ac771 b5d674ab

+33 -10
+6
arch/sparc/include/asm/serial.h
··· 1 + #ifndef __SPARC_SERIAL_H 2 + #define __SPARC_SERIAL_H 3 + 4 + #define BASE_BAUD ( 1843200 / 16 ) 5 + 6 + #endif /* __SPARC_SERIAL_H */
+17 -4
drivers/serial/8250.c
··· 44 44 45 45 #include "8250.h" 46 46 47 + #ifdef CONFIG_SPARC 48 + #include "suncore.h" 49 + #endif 50 + 47 51 /* 48 52 * Configuration: 49 53 * share_irqs - whether we pass IRQF_SHARED to request_irq(). This option ··· 2680 2676 .dev_name = "ttyS", 2681 2677 .major = TTY_MAJOR, 2682 2678 .minor = 64, 2683 - .nr = UART_NR, 2684 2679 .cons = SERIAL8250_CONSOLE, 2685 2680 }; 2686 2681 ··· 2961 2958 "%d ports, IRQ sharing %sabled\n", nr_uarts, 2962 2959 share_irqs ? "en" : "dis"); 2963 2960 2964 - for (i = 0; i < NR_IRQS; i++) 2965 - spin_lock_init(&irq_lists[i].lock); 2966 - 2961 + #ifdef CONFIG_SPARC 2962 + ret = sunserial_register_minors(&serial8250_reg, UART_NR); 2963 + #else 2964 + serial8250_reg.nr = UART_NR; 2967 2965 ret = uart_register_driver(&serial8250_reg); 2966 + #endif 2968 2967 if (ret) 2969 2968 goto out; 2970 2969 ··· 2991 2986 put_dev: 2992 2987 platform_device_put(serial8250_isa_devs); 2993 2988 unreg_uart_drv: 2989 + #ifdef CONFIG_SPARC 2990 + sunserial_unregister_minors(&serial8250_reg, UART_NR); 2991 + #else 2994 2992 uart_unregister_driver(&serial8250_reg); 2993 + #endif 2995 2994 out: 2996 2995 return ret; 2997 2996 } ··· 3014 3005 platform_driver_unregister(&serial8250_isa_driver); 3015 3006 platform_device_unregister(isa_dev); 3016 3007 3008 + #ifdef CONFIG_SPARC 3009 + sunserial_unregister_minors(&serial8250_reg, UART_NR); 3010 + #else 3017 3011 uart_unregister_driver(&serial8250_reg); 3012 + #endif 3018 3013 } 3019 3014 3020 3015 module_init(serial8250_init);
-1
drivers/serial/Kconfig
··· 9 9 # The new 8250/16550 serial drivers 10 10 config SERIAL_8250 11 11 tristate "8250/16550 and compatible serial support" 12 - depends on (BROKEN || !SPARC) 13 12 select SERIAL_CORE 14 13 ---help--- 15 14 This selects whether you want to include the driver for the standard
+10 -5
drivers/serial/Makefile
··· 4 4 5 5 obj-$(CONFIG_SERIAL_CORE) += serial_core.o 6 6 obj-$(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. 11 + obj-$(CONFIG_SERIAL_SUNCORE) += suncore.o 12 + obj-$(CONFIG_SERIAL_SUNHV) += sunhv.o 13 + obj-$(CONFIG_SERIAL_SUNZILOG) += sunzilog.o 14 + obj-$(CONFIG_SERIAL_SUNSU) += sunsu.o 15 + obj-$(CONFIG_SERIAL_SUNSAB) += sunsab.o 16 + 7 17 obj-$(CONFIG_SERIAL_8250) += 8250.o 8 18 obj-$(CONFIG_SERIAL_8250_PNP) += 8250_pnp.o 9 19 obj-$(CONFIG_SERIAL_8250_GSC) += 8250_gsc.o ··· 41 31 obj-$(CONFIG_SERIAL_S3C2410) += s3c2410.o 42 32 obj-$(CONFIG_SERIAL_S3C2412) += s3c2412.o 43 33 obj-$(CONFIG_SERIAL_S3C2440) += s3c2440.o 44 - obj-$(CONFIG_SERIAL_SUNCORE) += suncore.o 45 - obj-$(CONFIG_SERIAL_SUNHV) += sunhv.o 46 - obj-$(CONFIG_SERIAL_SUNZILOG) += sunzilog.o 47 34 obj-$(CONFIG_SERIAL_IP22_ZILOG) += ip22zilog.o 48 - obj-$(CONFIG_SERIAL_SUNSU) += sunsu.o 49 - obj-$(CONFIG_SERIAL_SUNSAB) += sunsab.o 50 35 obj-$(CONFIG_SERIAL_MUX) += mux.o 51 36 obj-$(CONFIG_SERIAL_68328) += 68328serial.o 52 37 obj-$(CONFIG_SERIAL_68360) += 68360serial.o