add support for PC-9800 architecture (20/26) serial #1
RFC PATCH 1/1 add support for PC-9800 architecture (20/26) serial #1
This is part 20/26 of patchset for add support NEC PC-9800 architecture, against 2.5.43.
Summary:
serial driver related modules.
- change IO port address and IRQ number.
- add new PNP device entry.
- add register definition for new serial driver.
diffstat:
drivers/serial/8250_cs.c | 1 + drivers/serial/8250_pnp.c | 7 +++++++ drivers/serial/Config.in | 10 ++++++++++ drivers/serial/Makefile | 6 +++++- include/asm-i386/serial.h | 18 ++++++++++++++++++ include/linux/serial.h | 13 +++++++++++++ include/linux/serialP.h | 5 +++++ include/linux/serial_core.h | 9 +++++++++ include/linux/serial_reg.h | 43 +++++++++++++++++++++++++++++++++++++++++++ 9 files changed, 111 insertions(+), 1 deletion(-)
patch:
drivers/serial/Config.in +10 -0
@@ -12,12 +12,22 @@ dep_bool ' Console on 8250/16550 and compatible serial port (EXPERIMENTAL)' CONFIG_SERIAL_8250_CONSOLE $CONFIG_SERIAL_8250 $CONFIG_EXPERIMENTAL dep_tristate ' 8250/16550 PCMCIA device support' CONFIG_SERIAL_8250_CS $CONFIG_PCMCIA $CONFIG_SERIAL_8250 +if [ "$CONFIG_PC9800" != "y" ]; then dep_mbool 'Extended 8250/16550 serial driver options' CONFIG_SERIAL_8250_EXTENDED $CONFIG_SERIAL_8250 dep_bool ' Support more than 4 serial ports' CONFIG_SERIAL_8250_MANY_PORTS $CONFIG_SERIAL_8250_EXTENDED dep_bool ' Support for sharing serial interrupts' CONFIG_SERIAL_8250_SHARE_IRQ $CONFIG_SERIAL_8250_EXTENDED dep_bool ' Autodetect IRQ on standard ports (unsafe)' CONFIG_SERIAL_8250_DETECT_IRQ $CONFIG_SERIAL_8250_EXTENDED dep_bool ' Support special multiport boards' CONFIG_SERIAL_8250_MULTIPORT $CONFIG_SERIAL_8250_EXTENDED dep_bool ' Support RSA serial ports' CONFIG_SERIAL_8250_RSA $CONFIG_SERIAL_8250_EXTENDED +else # CONFIG_PC9800=y +dep_mbool 'NEC PC-9801 primary serial port support (EXPERIMENTAL)' CONFIG_SERIAL_PC9800 $CONFIG_SERIAL_8250 +dep_bool ' Support MC16550II (EXPERIMENTAL)' CONFIG_MC16550II $CONFIG_SERIAL_PC9800 +if [ "$CONFIG_MC16550II" = "y" ]; then + comment ' MC16550II COM2, COM3 ' + int ' MC16550II shared IRQ (3, 5, 6, 12)' CONFIG_MC16550II_IRQ 3 + hex ' MC16550II base address (d0,d2,d4,d6,d8,da,dc,de)' CONFIG_MC16550II_BASE d2 +fi +fi comment 'Non-8250 serial port support'
drivers/serial/Makefile +5 -1
@@ -4,14 +4,18 @@ # $Id: Makefile,v 1.8 2002/07/21 21:32:30 rmk Exp $ # -export-objs := core.o 8250.o suncore.o +export-objs := core.o 8250.o suncore.o serial98.o serial-8250-y := serial-8250-$(CONFIG_PCI) += 8250_pci.o serial-8250-$(CONFIG_ISAPNP) += 8250_pnp.o obj-$(CONFIG_SERIAL_CORE) += core.o obj-$(CONFIG_SERIAL_21285) += 21285.o +ifneq ($(CONFIG_SERIAL_PC9800),y) obj-$(CONFIG_SERIAL_8250) += 8250.o $(serial-8250-y) +else +obj-$(CONFIG_SERIAL_8250) += serial98.o $(serial-8250-y) +endif obj-$(CONFIG_SERIAL_8250_CS) += 8250_cs.o obj-$(CONFIG_SERIAL_8250_ACORN) += 8250_acorn.o obj-$(CONFIG_SERIAL_ANAKIN) += anakin.o
drivers/serial/8250_cs.c +1 -0
@@ -307,6 +307,7 @@ serial.port = port; serial.irq = irq; serial.flags =ASYNC_SKIP_TEST |ASYNC_SHARE_IRQ ; + serial.baud_base =230400 ; line =register_serial (&serial);if (line <0 ) { printk(KERN_NOTICE "serial_cs: register_serial() at 0x%04lx,"
drivers/serial/8250_pnp.c +7 -0
@@ -187,6 +187,8 @@ { "MVX00A1", 0 },/* PC Rider K56 Phone System PnP */ { "MVX00F2", 0 }, +/* NEC 98NOTE SPEAKER PHONE FAX MODEM(33600bps) */ + { "nEC8241", 0 },/* Pace 56 Voice Internal Plug & Play Modem */ { "PMC2430", 0 },/* Generic */
@@ -379,7 +381,12 @@ ((port->min ==0x2f8 ) || (port->min ==0x3f8 ) || (port->min ==0x2e8 ) || +#ifndef CONFIG_PC9800 (port->min == 0x3e8))) +#else + (port->min ==0x3e8 ) || + (port->min == 0x8b0))) +#endif return 0; }
include/asm-i386/serial.h +18 -0
@@ -50,14 +50,22 @@#define C_P (card,port) (((card)<<6|(port)<<3) + 1) +#ifndef CONFIG_PC9800 #define STD_SERIAL_PORT_DEFNS \ /* UART CLK PORT IRQ FLAGS */ \ { 0, BASE_BAUD, 0x3F8, 4, STD_COM_FLAGS }, /* ttyS0 */ \ { 0, BASE_BAUD, 0x2F8, 3, STD_COM_FLAGS }, /* ttyS1 */ \ { 0, BASE_BAUD, 0x3E8, 4, STD_COM_FLAGS }, /* ttyS2 */ \ { 0, BASE_BAUD, 0x2E8, 3, STD_COM4_FLAGS }, /* ttyS3 */ +#else +#define STD_SERIAL_PORT_DEFNS \ + /* UART CLK PORT IRQ FLAGS */ \ + { 0, BASE_BAUD, 0x30, 4, STD_COM_FLAGS }, /* ttyS0 */ \ + { 0, BASE_BAUD, 0x238, 5, STD_COM_FLAGS }, /* ttyS1 */ +#endif /* CONFIG_PC9800 */ +#ifndef CONFIG_PC9800 #ifdef CONFIG_SERIAL_MANY_PORTS #define EXTRA_SERIAL_PORT_DEFNS \ { 0, BASE_BAUD, 0x1A0, 9, FOURPORT_FLAGS }, /* ttyS4 */ \
@@ -91,6 +99,16 @@#else #define EXTRA_SERIAL_PORT_DEFNS #endif +#else /* CONFIG_PC9800 */ +#ifdef CONFIG_MC16550II +#define EXTRA_SERIAL_PORT_DEFNS \ +/* MC16550II */ \ + { 0, BASE_BAUD*4, CONFIG_MC16550II_BASE, CONFIG_MC16550II_IRQ, STD_COM_FLAGS },/* ttyS2 */ \ + { 0, BASE_BAUD*4, CONFIG_MC16550II_BASE+0x800, CONFIG_MC16550II_IRQ, STD_COM_FLAGS }, /* ttyS3 */ +#else +#define EXTRA_SERIAL_PORT_DEFNS +#endif +#endif /* CONFIG_PC9800 */ /* You can have up to four HUB6's in the system, but I've only * included two cards here for a total of twelve ports.
include/linux/serial.h +13 -0
@@ -10,6 +10,8 @@#ifndef _LINUX_SERIAL_H#define _LINUX_SERIAL_H +#include <linux/config.h> +#ifdef __KERNEL__#include <asm/page.h>
@@ -75,11 +77,22 @@#define PORT_16654 11#define PORT_16850 12#define PORT_RSA 13/* RSA-DV II/S card */ +#ifndef CONFIG_PC9800 #define PORT_MAX 13 +#else +#define PORT_8251 14 +#define PORT_8251_19K 15 +#define PORT_8251_FIFO 16 +#define PORT_8251_VFAST 17 +#define PORT_MC16550II 18 +#define PORT_MAX 18 +#endif #define SERIAL_IO_PORT 0#define SERIAL_IO_HUB6 1#define SERIAL_IO_MEM 2 +#define SERIAL_IO_8251 3 +#define SERIAL_IO_MC16550II 4struct serial_uart_config {char *name;
include/linux/serialP.h +5 -0
@@ -20,6 +20,7 @@*/ #include <linux/config.h> +#include <linux/version.h> #include <linux/termios.h> #include <linux/workqueue.h> #include <linux/circ_buf.h>
@@ -75,6 +76,10 @@int MCR ;/* Modem control register */ int LCR ;/* Line control register */ int ACR ;/* 16950 Additional Control Reg. */ +#ifdef CONFIG_PC9800 +int cmd8251; +int msr8251; +#endif unsigned long event;unsigned long last_active;int line;
include/linux/serial_core.h +9 -0
@@ -37,7 +37,16 @@#define PORT_16654 11#define PORT_16850 12#define PORT_RSA 13 +#ifndef CONFIG_PC9800 #define PORT_MAX_8250 13/* max port ID */ +#else +#define PORT_8251 14 +#define PORT_8251_19K 15 +#define PORT_8251_FIFO 16 +#define PORT_8251_VFAST 17 +#define PORT_MC16550II 18 +#define PORT_MAX_8250 18/* max port ID */ +#endif /* * ARM specific type numbers. These are not currently guaranteed
include/linux/serial_reg.h +43 -0
55 lines not on this page · raw message
I strongly recommend _n_o_t_ merging this patch.
Quoted 10 lines · Osamu Tomita
diff -urN linux/drivers/serial/Makefile linux98/drivers/serial/Makefile
drivers/serial/Makefile +1
-1@@ -4,14 +4,18 @@ # $Id: Makefile,v 1.8 2002/07/21 21:32:30 rmk Exp $ # -export-objs := core.o 8250.o suncore.o +export-objs := core.o 8250.o suncore.o serial98.o
drivers/serial/Makefile line 18
Quoted 10 lines
drivers/serial/Makefile +4
-0serial-8250-y := serial-8250-$(CONFIG_PCI) += 8250_pci.o serial-8250-$(CONFIG_ISAPNP) += 8250_pnp.o obj-$(CONFIG_SERIAL_CORE) += core.o obj-$(CONFIG_SERIAL_21285) += 21285.o +ifneq ($(CONFIG_SERIAL_PC9800),y) obj-$(CONFIG_SERIAL_8250) += 8250.o $(serial-8250-y) +else +obj-$(CONFIG_SERIAL_8250) += serial98.o $(serial-8250-y) +endif
If you don't want 8250.c, then don't re-use CONFIG_SERIAL_8250
drivers/serial/8250_cs.c line 313
Quoted 11 lines
diff -urN
linux/drivers/serial/8250_cs.clinux98/drivers/serial/8250_cs.cdrivers/serial/8250_cs.c +1
-0@@ -307,6 +307,7 @@ serial.port = port; serial.irq = irq; serial.flags =ASYNC_SKIP_TEST |ASYNC_SHARE_IRQ ; + serial.baud_base =230400 ; line =register_serial (&serial);if (line <0 ) { printk(KERN_NOTICE "serial_cs: register_serial() at 0x%04lx,"
This breaks PCMCIA serial support on every other platform that supports PCMCIA serial cards.
Quoted 16 lines
diff -urN
linux/include/linux/serial.hlinux98/include/linux/serial.hinclude/linux/serial.h +2
-0@@ -10,6 +10,8 @@#ifndef _LINUX_SERIAL_H#define _LINUX_SERIAL_H +#include <linux/config.h> +#ifdef __KERNEL__#include <asm/page.h> @@ -75,11 +77,22 @@#define PORT_16654 11#define PORT_16850 12#define PORT_RSA 13/* RSA-DV II/S card */
include/linux/serial.h line 89
Quoted 10 lines
include/linux/serial.h +9
-0+#ifndef CONFIG_PC9800 #define PORT_MAX 13 +#else +#define PORT_8251 14 +#define PORT_8251_19K 15 +#define PORT_8251_FIFO 16 +#define PORT_8251_VFAST 17 +#define PORT_MC16550II 18 +#define PORT_MAX 18 +#endif
Yuck. Just define the new numbers. There is no point putting an ifdef around them.
Quoted 12 lines
diff -urN
linux/include/linux/serialP.hlinux98/include/linux/serialP.hinclude/linux/serialP.h +1
-0@@ -20,6 +20,7 @@*/ #include <linux/config.h> +#include <linux/version.h> #include <linux/termios.h> #include <linux/workqueue.h> #include <linux/circ_buf.h>
include/linux/serialP.h line 85
Quoted 10 lines
include/linux/serialP.h +4
-0@@ -75,6 +76,10 @@int MCR ;/* Modem control register */ int LCR ;/* Line control register */ int ACR ;/* 16950 Additional Control Reg. */ +#ifdef CONFIG_PC9800 +int cmd8251; +int msr8251; +#endif unsigned long event;unsigned long last_active;int line;
I'm deferring comment on this until I've had time to digest your other serial patch.
Quoted 10 lines
diff -urN
linux/include/linux/serial_core.hlinux98/include/linux/serial_core.hinclude/linux/serial_core.h +2
-0@@ -37,7 +37,16 @@#define PORT_16654 11#define PORT_16850 12#define PORT_RSA 13 +#ifndef CONFIG_PC9800 #define PORT_MAX_8250 13/* max port ID */ +#else
include/linux/serial_core.h line 52
Quoted 10 lines
include/linux/serial_core.h +7
-0+#define PORT_8251 14 +#define PORT_8251_19K 15 +#define PORT_8251_FIFO 16 +#define PORT_8251_VFAST 17 +#define PORT_MC16550II 18 +#define PORT_MAX_8250 18/* max port ID */ +#endif /* * ARM specific type numbers. These are not currently guaranteed
Same comments as serial.h
Quoted 47 lines
diff -urN
linux/include/linux/serial_reg.hlinux98/include/linux/serial_reg.hinclude/linux/serial_reg.h +33
-0@@ -14,6 +14,8 @@#ifndef _LINUX_SERIAL_REG_H#define _LINUX_SERIAL_REG_H +#include <linux/config.h> +#define UART_RX 0/* In: Receive buffer (DLAB=0) */ #define UART_TX 0/* Out: Transmit buffer (DLAB=0) */ #define UART_DLL 0/* Out: Divisor Latch Low (DLAB=1) */ @@ -229,6 +231,47 @@#define UART_TRG_120 0x78#define UART_TRG_128 0x80 +#ifdef CONFIG_PC9800 + +#define RX_8251F 0x130/* In: Receive buffer */ +#define TX_8251F 0x130/* Out: Transmit buffer */ +#define LSR_8251F 0x132/* In: Line Status Register */ +#define MSR_8251F 0x134/* In: Modem Status Register */ +#define IIR_8251F 0x136/* In: Interrupt ID Register */ +#define FCR_8251F 0x138/* I/O: FIFO Control Register */ +#define IER2_8251F 0x138/* I/O: Interrupt Enable Register */ +#define VFAST_8251F 0x13a/* I/O: VFAST mode Register */ + +#define COMMAND_8251F 0x32/* Out: 8251 Command Resister */ +#define IER1_8251F 0x35/* I/O: Interrupt Enable Register */ +#define IER1_8251F_COUT 0x37/* Out: Interrupt Enable Register */ + +#define COMMAND_8251F_DUMMY 0/* Dummy Command */ +#define COMMAND_8251F_RESET 0x40/* Reset Command */ + +#define VFAST_ENABLE 0x80/* V.Fast mode Enable */ + +/* Interrupt Reason */ +#define INTR_8251_TXRE 4 +#define INTR_8251_TXEE 2 +#define INTR_8251_RXRE 1 +/* I/O Port */ +#define PORT_8251_DATA 0 +#define PORT_8251_CMD 2 +#define PORT_8251_MOD 2 +#define PORT_8251_STS 2 +/* status in */ +#define STAT_8251_TXRDY 1
include/linux/serial_reg.h line 274
Quoted 10 lines
include/linux/serial_reg.h +10
-0+#define STAT_8251_RXRDY 2 +#define STAT_8251_TXEMP 4 +#define STAT_8251_PER 8 +#define STAT_8251_OER 16 +#define STAT_8251_FER 32 +#define STAT_8251_BRK 64 +#define STAT_8251_DSR 128 + +#endif /* CONFIG_PC9800 */ +
Same comments as serial.h
Signature · 2 lines
Russell King ([email protected]) The developer of ARM Linux http://www.arm.linux.org.uk/personal/aboutme.html
Quoted 1 line · Russell King
I strongly recommend _n_o_t_ merging this patch.
Did you see the next patch (21/26 serial #2) ? It looks even more interesting. As I understand serial98.c driver should support older i8251 UART. However it does it by perverting 8250.c and EMULATING i8250 on top of i8251, see ugly code in serial_in() and serial_out() functions.
May be I misunderstand the issue, but IMHO this patch is unacceptible too :(
Best regards.
Signature · 2 lines
Andrey Panin | Embedded systems software developer [email protected] | PGP key: wwwkeys.eu.pgp.net
Quoted 4 lines · Andrey Panin
Quoted 1 line · Russell King
I strongly recommend _n_o_t_ merging this patch.
Did you see the next patch (21/26 serial #2) ?
Yes. I said in the comments to #1 that I'd defer commenting on one section of #1 and all of #2. (until I can read through the whole of #2 and provide some useful feedback.)
Signature · 2 lines
Russell King ([email protected]) The developer of ARM Linux http://www.arm.linux.org.uk/personal/aboutme.html