aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/serial
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@g5.osdl.org>2006-01-07 13:44:22 -0500
committerLinus Torvalds <torvalds@g5.osdl.org>2006-01-07 13:44:22 -0500
commitcc918c7ab7da017bfaf9661420bb5c462e057cfb (patch)
tree36198fe17267200131ec6c3df7c046a857f76b8d /drivers/serial
parentf9c5d0451b406a6bd0d0bf1fdd63c7777af6ebc6 (diff)
parentdd68e88c72ac9ad25052065c4a443326eda6a052 (diff)
Merge master.kernel.org:/home/rmk/linux-2.6-serial
Diffstat (limited to 'drivers/serial')
-rw-r--r--drivers/serial/8250.c60
-rw-r--r--drivers/serial/8250.h6
-rw-r--r--drivers/serial/8250_pci.c124
-rw-r--r--drivers/serial/serial_core.c2
4 files changed, 146 insertions, 46 deletions
diff --git a/drivers/serial/8250.c b/drivers/serial/8250.c
index d2bcd1f87cd6..1891cf5bdeef 100644
--- a/drivers/serial/8250.c
+++ b/drivers/serial/8250.c
@@ -296,7 +296,7 @@ static inline int map_8250_out_reg(struct uart_8250_port *up, int offset)
296 296
297#endif 297#endif
298 298
299static _INLINE_ unsigned int serial_in(struct uart_8250_port *up, int offset) 299static unsigned int serial_in(struct uart_8250_port *up, int offset)
300{ 300{
301 offset = map_8250_in_reg(up, offset) << up->port.regshift; 301 offset = map_8250_in_reg(up, offset) << up->port.regshift;
302 302
@@ -321,7 +321,7 @@ static _INLINE_ unsigned int serial_in(struct uart_8250_port *up, int offset)
321 } 321 }
322} 322}
323 323
324static _INLINE_ void 324static void
325serial_out(struct uart_8250_port *up, int offset, int value) 325serial_out(struct uart_8250_port *up, int offset, int value)
326{ 326{
327 offset = map_8250_out_reg(up, offset) << up->port.regshift; 327 offset = map_8250_out_reg(up, offset) << up->port.regshift;
@@ -1131,7 +1131,7 @@ static void serial8250_enable_ms(struct uart_port *port)
1131 serial_out(up, UART_IER, up->ier); 1131 serial_out(up, UART_IER, up->ier);
1132} 1132}
1133 1133
1134static _INLINE_ void 1134static void
1135receive_chars(struct uart_8250_port *up, int *status, struct pt_regs *regs) 1135receive_chars(struct uart_8250_port *up, int *status, struct pt_regs *regs)
1136{ 1136{
1137 struct tty_struct *tty = up->port.info->tty; 1137 struct tty_struct *tty = up->port.info->tty;
@@ -1217,7 +1217,7 @@ receive_chars(struct uart_8250_port *up, int *status, struct pt_regs *regs)
1217 *status = lsr; 1217 *status = lsr;
1218} 1218}
1219 1219
1220static _INLINE_ void transmit_chars(struct uart_8250_port *up) 1220static void transmit_chars(struct uart_8250_port *up)
1221{ 1221{
1222 struct circ_buf *xmit = &up->port.info->xmit; 1222 struct circ_buf *xmit = &up->port.info->xmit;
1223 int count; 1223 int count;
@@ -1255,25 +1255,24 @@ static _INLINE_ void transmit_chars(struct uart_8250_port *up)
1255 __stop_tx(up); 1255 __stop_tx(up);
1256} 1256}
1257 1257
1258static _INLINE_ void check_modem_status(struct uart_8250_port *up) 1258static unsigned int check_modem_status(struct uart_8250_port *up)
1259{ 1259{
1260 int status; 1260 unsigned int status = serial_in(up, UART_MSR);
1261
1262 status = serial_in(up, UART_MSR);
1263 1261
1264 if ((status & UART_MSR_ANY_DELTA) == 0) 1262 if (status & UART_MSR_ANY_DELTA && up->ier & UART_IER_MSI) {
1265 return; 1263 if (status & UART_MSR_TERI)
1264 up->port.icount.rng++;
1265 if (status & UART_MSR_DDSR)
1266 up->port.icount.dsr++;
1267 if (status & UART_MSR_DDCD)
1268 uart_handle_dcd_change(&up->port, status & UART_MSR_DCD);
1269 if (status & UART_MSR_DCTS)
1270 uart_handle_cts_change(&up->port, status & UART_MSR_CTS);
1266 1271
1267 if (status & UART_MSR_TERI) 1272 wake_up_interruptible(&up->port.info->delta_msr_wait);
1268 up->port.icount.rng++; 1273 }
1269 if (status & UART_MSR_DDSR)
1270 up->port.icount.dsr++;
1271 if (status & UART_MSR_DDCD)
1272 uart_handle_dcd_change(&up->port, status & UART_MSR_DCD);
1273 if (status & UART_MSR_DCTS)
1274 uart_handle_cts_change(&up->port, status & UART_MSR_CTS);
1275 1274
1276 wake_up_interruptible(&up->port.info->delta_msr_wait); 1275 return status;
1277} 1276}
1278 1277
1279/* 1278/*
@@ -1282,7 +1281,11 @@ static _INLINE_ void check_modem_status(struct uart_8250_port *up)
1282static inline void 1281static inline void
1283serial8250_handle_port(struct uart_8250_port *up, struct pt_regs *regs) 1282serial8250_handle_port(struct uart_8250_port *up, struct pt_regs *regs)
1284{ 1283{
1285 unsigned int status = serial_inp(up, UART_LSR); 1284 unsigned int status;
1285
1286 spin_lock(&up->port.lock);
1287
1288 status = serial_inp(up, UART_LSR);
1286 1289
1287 DEBUG_INTR("status = %x...", status); 1290 DEBUG_INTR("status = %x...", status);
1288 1291
@@ -1291,6 +1294,8 @@ serial8250_handle_port(struct uart_8250_port *up, struct pt_regs *regs)
1291 check_modem_status(up); 1294 check_modem_status(up);
1292 if (status & UART_LSR_THRE) 1295 if (status & UART_LSR_THRE)
1293 transmit_chars(up); 1296 transmit_chars(up);
1297
1298 spin_unlock(&up->port.lock);
1294} 1299}
1295 1300
1296/* 1301/*
@@ -1326,9 +1331,7 @@ static irqreturn_t serial8250_interrupt(int irq, void *dev_id, struct pt_regs *r
1326 1331
1327 iir = serial_in(up, UART_IIR); 1332 iir = serial_in(up, UART_IIR);
1328 if (!(iir & UART_IIR_NO_INT)) { 1333 if (!(iir & UART_IIR_NO_INT)) {
1329 spin_lock(&up->port.lock);
1330 serial8250_handle_port(up, regs); 1334 serial8250_handle_port(up, regs);
1331 spin_unlock(&up->port.lock);
1332 1335
1333 handled = 1; 1336 handled = 1;
1334 1337
@@ -1427,11 +1430,8 @@ static void serial8250_timeout(unsigned long data)
1427 unsigned int iir; 1430 unsigned int iir;
1428 1431
1429 iir = serial_in(up, UART_IIR); 1432 iir = serial_in(up, UART_IIR);
1430 if (!(iir & UART_IIR_NO_INT)) { 1433 if (!(iir & UART_IIR_NO_INT))
1431 spin_lock(&up->port.lock);
1432 serial8250_handle_port(up, NULL); 1434 serial8250_handle_port(up, NULL);
1433 spin_unlock(&up->port.lock);
1434 }
1435 1435
1436 timeout = up->port.timeout; 1436 timeout = up->port.timeout;
1437 timeout = timeout > 6 ? (timeout / 2 - 2) : 1; 1437 timeout = timeout > 6 ? (timeout / 2 - 2) : 1;
@@ -1454,10 +1454,10 @@ static unsigned int serial8250_tx_empty(struct uart_port *port)
1454static unsigned int serial8250_get_mctrl(struct uart_port *port) 1454static unsigned int serial8250_get_mctrl(struct uart_port *port)
1455{ 1455{
1456 struct uart_8250_port *up = (struct uart_8250_port *)port; 1456 struct uart_8250_port *up = (struct uart_8250_port *)port;
1457 unsigned char status; 1457 unsigned int status;
1458 unsigned int ret; 1458 unsigned int ret;
1459 1459
1460 status = serial_in(up, UART_MSR); 1460 status = check_modem_status(up);
1461 1461
1462 ret = 0; 1462 ret = 0;
1463 if (status & UART_MSR_DCD) 1463 if (status & UART_MSR_DCD)
@@ -2300,9 +2300,7 @@ static int __init find_port(struct uart_port *p)
2300 2300
2301 for (line = 0; line < UART_NR; line++) { 2301 for (line = 0; line < UART_NR; line++) {
2302 port = &serial8250_ports[line].port; 2302 port = &serial8250_ports[line].port;
2303 if (p->iotype == port->iotype && 2303 if (uart_match_port(p, port))
2304 p->iobase == port->iobase &&
2305 p->membase == port->membase)
2306 return line; 2304 return line;
2307 } 2305 }
2308 return -ENODEV; 2306 return -ENODEV;
diff --git a/drivers/serial/8250.h b/drivers/serial/8250.h
index a607b98016db..490606b87095 100644
--- a/drivers/serial/8250.h
+++ b/drivers/serial/8250.h
@@ -51,12 +51,6 @@ struct serial8250_config {
51#define UART_BUG_TXEN (1 << 1) /* UART has buggy TX IIR status */ 51#define UART_BUG_TXEN (1 << 1) /* UART has buggy TX IIR status */
52#define UART_BUG_NOMSR (1 << 2) /* UART has buggy MSR status bits (Au1x00) */ 52#define UART_BUG_NOMSR (1 << 2) /* UART has buggy MSR status bits (Au1x00) */
53 53
54#if defined(__i386__) && (defined(CONFIG_M386) || defined(CONFIG_M486))
55#define _INLINE_ inline
56#else
57#define _INLINE_
58#endif
59
60#define PROBE_RSA (1 << 0) 54#define PROBE_RSA (1 << 0)
61#define PROBE_ANY (~0) 55#define PROBE_ANY (~0)
62 56
diff --git a/drivers/serial/8250_pci.c b/drivers/serial/8250_pci.c
index 8adca0ce267f..589fb076654a 100644
--- a/drivers/serial/8250_pci.c
+++ b/drivers/serial/8250_pci.c
@@ -837,8 +837,8 @@ static struct pci_serial_quirk *find_quirk(struct pci_dev *dev)
837 return quirk; 837 return quirk;
838} 838}
839 839
840static _INLINE_ int 840static inline int get_pci_irq(struct pci_dev *dev,
841get_pci_irq(struct pci_dev *dev, struct pciserial_board *board) 841 struct pciserial_board *board)
842{ 842{
843 if (board->flags & FL_NOIRQ) 843 if (board->flags & FL_NOIRQ)
844 return 0; 844 return 0;
@@ -853,14 +853,15 @@ get_pci_irq(struct pci_dev *dev, struct pciserial_board *board)
853 * driver_data member. 853 * driver_data member.
854 * 854 *
855 * The makeup of these names are: 855 * The makeup of these names are:
856 * pbn_bn{_bt}_n_baud 856 * pbn_bn{_bt}_n_baud{_offsetinhex}
857 * 857 *
858 * bn = PCI BAR number 858 * bn = PCI BAR number
859 * bt = Index using PCI BARs 859 * bt = Index using PCI BARs
860 * n = number of serial ports 860 * n = number of serial ports
861 * baud = baud rate 861 * baud = baud rate
862 * offsetinhex = offset for each sequential port (in hex)
862 * 863 *
863 * This table is sorted by (in order): baud, bt, bn, n. 864 * This table is sorted by (in order): bn, bt, baud, offsetindex, n.
864 * 865 *
865 * Please note: in theory if n = 1, _bt infix should make no difference. 866 * Please note: in theory if n = 1, _bt infix should make no difference.
866 * ie, pbn_b0_1_115200 is the same as pbn_b0_bt_1_115200 867 * ie, pbn_b0_1_115200 is the same as pbn_b0_bt_1_115200
@@ -881,6 +882,13 @@ enum pci_board_num_t {
881 882
882 pbn_b0_4_1152000, 883 pbn_b0_4_1152000,
883 884
885 pbn_b0_2_1843200,
886 pbn_b0_4_1843200,
887
888 pbn_b0_2_1843200_200,
889 pbn_b0_4_1843200_200,
890 pbn_b0_8_1843200_200,
891
884 pbn_b0_bt_1_115200, 892 pbn_b0_bt_1_115200,
885 pbn_b0_bt_2_115200, 893 pbn_b0_bt_2_115200,
886 pbn_b0_bt_8_115200, 894 pbn_b0_bt_8_115200,
@@ -904,6 +912,8 @@ enum pci_board_num_t {
904 pbn_b1_4_921600, 912 pbn_b1_4_921600,
905 pbn_b1_8_921600, 913 pbn_b1_8_921600,
906 914
915 pbn_b1_2_1250000,
916
907 pbn_b1_bt_2_921600, 917 pbn_b1_bt_2_921600,
908 918
909 pbn_b1_1_1382400, 919 pbn_b1_1_1382400,
@@ -1029,6 +1039,38 @@ static struct pciserial_board pci_boards[] __devinitdata = {
1029 .uart_offset = 8, 1039 .uart_offset = 8,
1030 }, 1040 },
1031 1041
1042 [pbn_b0_2_1843200] = {
1043 .flags = FL_BASE0,
1044 .num_ports = 2,
1045 .base_baud = 1843200,
1046 .uart_offset = 8,
1047 },
1048 [pbn_b0_4_1843200] = {
1049 .flags = FL_BASE0,
1050 .num_ports = 4,
1051 .base_baud = 1843200,
1052 .uart_offset = 8,
1053 },
1054
1055 [pbn_b0_2_1843200_200] = {
1056 .flags = FL_BASE0,
1057 .num_ports = 2,
1058 .base_baud = 1843200,
1059 .uart_offset = 0x200,
1060 },
1061 [pbn_b0_4_1843200_200] = {
1062 .flags = FL_BASE0,
1063 .num_ports = 4,
1064 .base_baud = 1843200,
1065 .uart_offset = 0x200,
1066 },
1067 [pbn_b0_8_1843200_200] = {
1068 .flags = FL_BASE0,
1069 .num_ports = 8,
1070 .base_baud = 1843200,
1071 .uart_offset = 0x200,
1072 },
1073
1032 [pbn_b0_bt_1_115200] = { 1074 [pbn_b0_bt_1_115200] = {
1033 .flags = FL_BASE0|FL_BASE_BARS, 1075 .flags = FL_BASE0|FL_BASE_BARS,
1034 .num_ports = 1, 1076 .num_ports = 1,
@@ -1141,6 +1183,12 @@ static struct pciserial_board pci_boards[] __devinitdata = {
1141 .base_baud = 921600, 1183 .base_baud = 921600,
1142 .uart_offset = 8, 1184 .uart_offset = 8,
1143 }, 1185 },
1186 [pbn_b1_2_1250000] = {
1187 .flags = FL_BASE1,
1188 .num_ports = 2,
1189 .base_baud = 1250000,
1190 .uart_offset = 8,
1191 },
1144 1192
1145 [pbn_b1_bt_2_921600] = { 1193 [pbn_b1_bt_2_921600] = {
1146 .flags = FL_BASE1|FL_BASE_BARS, 1194 .flags = FL_BASE1|FL_BASE_BARS,
@@ -1801,6 +1849,66 @@ static struct pci_device_id serial_pci_tbl[] = {
1801 PCI_SUBVENDOR_ID_CONNECT_TECH, 1849 PCI_SUBVENDOR_ID_CONNECT_TECH,
1802 PCI_SUBDEVICE_ID_CONNECT_TECH_BH041101V1, 0, 0, 1850 PCI_SUBDEVICE_ID_CONNECT_TECH_BH041101V1, 0, 0,
1803 pbn_b1_4_921600 }, 1851 pbn_b1_4_921600 },
1852 { PCI_VENDOR_ID_V3, PCI_DEVICE_ID_V3_V351,
1853 PCI_SUBVENDOR_ID_CONNECT_TECH,
1854 PCI_SUBDEVICE_ID_CONNECT_TECH_BH2_20MHZ, 0, 0,
1855 pbn_b1_2_1250000 },
1856 { PCI_VENDOR_ID_OXSEMI, PCI_DEVICE_ID_OXSEMI_16PCI954,
1857 PCI_SUBVENDOR_ID_CONNECT_TECH,
1858 PCI_SUBDEVICE_ID_CONNECT_TECH_TITAN_2, 0, 0,
1859 pbn_b0_2_1843200 },
1860 { PCI_VENDOR_ID_OXSEMI, PCI_DEVICE_ID_OXSEMI_16PCI954,
1861 PCI_SUBVENDOR_ID_CONNECT_TECH,
1862 PCI_SUBDEVICE_ID_CONNECT_TECH_TITAN_4, 0, 0,
1863 pbn_b0_4_1843200 },
1864 { PCI_VENDOR_ID_EXAR, PCI_DEVICE_ID_EXAR_XR17C152,
1865 PCI_SUBVENDOR_ID_CONNECT_TECH,
1866 PCI_SUBDEVICE_ID_CONNECT_TECH_PCI_UART_2_232, 0, 0,
1867 pbn_b0_2_1843200_200 },
1868 { PCI_VENDOR_ID_EXAR, PCI_DEVICE_ID_EXAR_XR17C154,
1869 PCI_SUBVENDOR_ID_CONNECT_TECH,
1870 PCI_SUBDEVICE_ID_CONNECT_TECH_PCI_UART_4_232, 0, 0,
1871 pbn_b0_4_1843200_200 },
1872 { PCI_VENDOR_ID_EXAR, PCI_DEVICE_ID_EXAR_XR17C158,
1873 PCI_SUBVENDOR_ID_CONNECT_TECH,
1874 PCI_SUBDEVICE_ID_CONNECT_TECH_PCI_UART_8_232, 0, 0,
1875 pbn_b0_8_1843200_200 },
1876 { PCI_VENDOR_ID_EXAR, PCI_DEVICE_ID_EXAR_XR17C152,
1877 PCI_SUBVENDOR_ID_CONNECT_TECH,
1878 PCI_SUBDEVICE_ID_CONNECT_TECH_PCI_UART_1_1, 0, 0,
1879 pbn_b0_2_1843200_200 },
1880 { PCI_VENDOR_ID_EXAR, PCI_DEVICE_ID_EXAR_XR17C154,
1881 PCI_SUBVENDOR_ID_CONNECT_TECH,
1882 PCI_SUBDEVICE_ID_CONNECT_TECH_PCI_UART_2_2, 0, 0,
1883 pbn_b0_4_1843200_200 },
1884 { PCI_VENDOR_ID_EXAR, PCI_DEVICE_ID_EXAR_XR17C158,
1885 PCI_SUBVENDOR_ID_CONNECT_TECH,
1886 PCI_SUBDEVICE_ID_CONNECT_TECH_PCI_UART_4_4, 0, 0,
1887 pbn_b0_8_1843200_200 },
1888 { PCI_VENDOR_ID_EXAR, PCI_DEVICE_ID_EXAR_XR17C152,
1889 PCI_SUBVENDOR_ID_CONNECT_TECH,
1890 PCI_SUBDEVICE_ID_CONNECT_TECH_PCI_UART_2, 0, 0,
1891 pbn_b0_2_1843200_200 },
1892 { PCI_VENDOR_ID_EXAR, PCI_DEVICE_ID_EXAR_XR17C154,
1893 PCI_SUBVENDOR_ID_CONNECT_TECH,
1894 PCI_SUBDEVICE_ID_CONNECT_TECH_PCI_UART_4, 0, 0,
1895 pbn_b0_4_1843200_200 },
1896 { PCI_VENDOR_ID_EXAR, PCI_DEVICE_ID_EXAR_XR17C158,
1897 PCI_SUBVENDOR_ID_CONNECT_TECH,
1898 PCI_SUBDEVICE_ID_CONNECT_TECH_PCI_UART_8, 0, 0,
1899 pbn_b0_8_1843200_200 },
1900 { PCI_VENDOR_ID_EXAR, PCI_DEVICE_ID_EXAR_XR17C152,
1901 PCI_SUBVENDOR_ID_CONNECT_TECH,
1902 PCI_SUBDEVICE_ID_CONNECT_TECH_PCI_UART_2_485, 0, 0,
1903 pbn_b0_2_1843200_200 },
1904 { PCI_VENDOR_ID_EXAR, PCI_DEVICE_ID_EXAR_XR17C154,
1905 PCI_SUBVENDOR_ID_CONNECT_TECH,
1906 PCI_SUBDEVICE_ID_CONNECT_TECH_PCI_UART_4_485, 0, 0,
1907 pbn_b0_4_1843200_200 },
1908 { PCI_VENDOR_ID_EXAR, PCI_DEVICE_ID_EXAR_XR17C158,
1909 PCI_SUBVENDOR_ID_CONNECT_TECH,
1910 PCI_SUBDEVICE_ID_CONNECT_TECH_PCI_UART_8_485, 0, 0,
1911 pbn_b0_8_1843200_200 },
1804 1912
1805 { PCI_VENDOR_ID_SEALEVEL, PCI_DEVICE_ID_SEALEVEL_U530, 1913 { PCI_VENDOR_ID_SEALEVEL, PCI_DEVICE_ID_SEALEVEL_U530,
1806 PCI_ANY_ID, PCI_ANY_ID, 0, 0, 1914 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
diff --git a/drivers/serial/serial_core.c b/drivers/serial/serial_core.c
index c17d680e3f04..34c576dfad8d 100644
--- a/drivers/serial/serial_core.c
+++ b/drivers/serial/serial_core.c
@@ -2307,7 +2307,7 @@ int uart_match_port(struct uart_port *port1, struct uart_port *port2)
2307 return (port1->iobase == port2->iobase) && 2307 return (port1->iobase == port2->iobase) &&
2308 (port1->hub6 == port2->hub6); 2308 (port1->hub6 == port2->hub6);
2309 case UPIO_MEM: 2309 case UPIO_MEM:
2310 return (port1->membase == port2->membase); 2310 return (port1->mapbase == port2->mapbase);
2311 } 2311 }
2312 return 0; 2312 return 0;
2313} 2313}