diff options
Diffstat (limited to 'drivers/serial')
-rw-r--r-- | drivers/serial/cpm_uart/cpm_uart_cpm2.c | 2 | ||||
-rw-r--r-- | drivers/serial/mcfserial.c | 54 | ||||
-rw-r--r-- | drivers/serial/mpc52xx_uart.c | 469 | ||||
-rw-r--r-- | drivers/serial/serial_cs.c | 67 | ||||
-rw-r--r-- | drivers/serial/sh-sci.c | 6 | ||||
-rw-r--r-- | drivers/serial/sh-sci.h | 37 |
6 files changed, 525 insertions, 110 deletions
diff --git a/drivers/serial/cpm_uart/cpm_uart_cpm2.c b/drivers/serial/cpm_uart/cpm_uart_cpm2.c index b691d3e14754..787a8f134677 100644 --- a/drivers/serial/cpm_uart/cpm_uart_cpm2.c +++ b/drivers/serial/cpm_uart/cpm_uart_cpm2.c | |||
@@ -282,7 +282,7 @@ void cpm_uart_freebuf(struct uart_cpm_port *pinfo) | |||
282 | } | 282 | } |
283 | 283 | ||
284 | /* Setup any dynamic params in the uart desc */ | 284 | /* Setup any dynamic params in the uart desc */ |
285 | int cpm_uart_init_portdesc(void) | 285 | int __init cpm_uart_init_portdesc(void) |
286 | { | 286 | { |
287 | #if defined(CONFIG_SERIAL_CPM_SMC1) || defined(CONFIG_SERIAL_CPM_SMC2) | 287 | #if defined(CONFIG_SERIAL_CPM_SMC1) || defined(CONFIG_SERIAL_CPM_SMC2) |
288 | u32 addr; | 288 | u32 addr; |
diff --git a/drivers/serial/mcfserial.c b/drivers/serial/mcfserial.c index aee1b31f1a1c..3db206d29b33 100644 --- a/drivers/serial/mcfserial.c +++ b/drivers/serial/mcfserial.c | |||
@@ -60,7 +60,8 @@ struct timer_list mcfrs_timer_struct; | |||
60 | #if defined(CONFIG_HW_FEITH) | 60 | #if defined(CONFIG_HW_FEITH) |
61 | #define CONSOLE_BAUD_RATE 38400 | 61 | #define CONSOLE_BAUD_RATE 38400 |
62 | #define DEFAULT_CBAUD B38400 | 62 | #define DEFAULT_CBAUD B38400 |
63 | #elif defined(CONFIG_MOD5272) || defined(CONFIG_M5208EVB) || defined(CONFIG_M5329EVB) | 63 | #elif defined(CONFIG_MOD5272) || defined(CONFIG_M5208EVB) || \ |
64 | defined(CONFIG_M5329EVB) || defined(CONFIG_GILBARCO) | ||
64 | #define CONSOLE_BAUD_RATE 115200 | 65 | #define CONSOLE_BAUD_RATE 115200 |
65 | #define DEFAULT_CBAUD B115200 | 66 | #define DEFAULT_CBAUD B115200 |
66 | #elif defined(CONFIG_ARNEWSH) || defined(CONFIG_FREESCALE) || \ | 67 | #elif defined(CONFIG_ARNEWSH) || defined(CONFIG_FREESCALE) || \ |
@@ -109,12 +110,30 @@ static struct mcf_serial mcfrs_table[] = { | |||
109 | .irq = IRQBASE, | 110 | .irq = IRQBASE, |
110 | .flags = ASYNC_BOOT_AUTOCONF, | 111 | .flags = ASYNC_BOOT_AUTOCONF, |
111 | }, | 112 | }, |
113 | #ifdef MCFUART_BASE2 | ||
112 | { /* ttyS1 */ | 114 | { /* ttyS1 */ |
113 | .magic = 0, | 115 | .magic = 0, |
114 | .addr = (volatile unsigned char *) (MCF_MBAR+MCFUART_BASE2), | 116 | .addr = (volatile unsigned char *) (MCF_MBAR+MCFUART_BASE2), |
115 | .irq = IRQBASE+1, | 117 | .irq = IRQBASE+1, |
116 | .flags = ASYNC_BOOT_AUTOCONF, | 118 | .flags = ASYNC_BOOT_AUTOCONF, |
117 | }, | 119 | }, |
120 | #endif | ||
121 | #ifdef MCFUART_BASE3 | ||
122 | { /* ttyS2 */ | ||
123 | .magic = 0, | ||
124 | .addr = (volatile unsigned char *) (MCF_MBAR+MCFUART_BASE3), | ||
125 | .irq = IRQBASE+2, | ||
126 | .flags = ASYNC_BOOT_AUTOCONF, | ||
127 | }, | ||
128 | #endif | ||
129 | #ifdef MCFUART_BASE4 | ||
130 | { /* ttyS3 */ | ||
131 | .magic = 0, | ||
132 | .addr = (volatile unsigned char *) (MCF_MBAR+MCFUART_BASE4), | ||
133 | .irq = IRQBASE+3, | ||
134 | .flags = ASYNC_BOOT_AUTOCONF, | ||
135 | }, | ||
136 | #endif | ||
118 | }; | 137 | }; |
119 | 138 | ||
120 | 139 | ||
@@ -1516,6 +1535,22 @@ static void mcfrs_irqinit(struct mcf_serial *info) | |||
1516 | imrp = (volatile unsigned long *) (MCF_MBAR + MCFICM_INTC0 + | 1535 | imrp = (volatile unsigned long *) (MCF_MBAR + MCFICM_INTC0 + |
1517 | MCFINTC_IMRL); | 1536 | MCFINTC_IMRL); |
1518 | *imrp &= ~((1 << (info->irq - MCFINT_VECBASE)) | 1); | 1537 | *imrp &= ~((1 << (info->irq - MCFINT_VECBASE)) | 1); |
1538 | #if defined(CONFIG_M527x) | ||
1539 | { | ||
1540 | /* | ||
1541 | * External Pin Mask Setting & Enable External Pin for Interface | ||
1542 | * mrcbis@aliceposta.it | ||
1543 | */ | ||
1544 | unsigned short *serpin_enable_mask; | ||
1545 | serpin_enable_mask = (MCF_IPSBAR + MCF_GPIO_PAR_UART); | ||
1546 | if (info->line == 0) | ||
1547 | *serpin_enable_mask |= UART0_ENABLE_MASK; | ||
1548 | else if (info->line == 1) | ||
1549 | *serpin_enable_mask |= UART1_ENABLE_MASK; | ||
1550 | else if (info->line == 2) | ||
1551 | *serpin_enable_mask |= UART2_ENABLE_MASK; | ||
1552 | } | ||
1553 | #endif | ||
1519 | #elif defined(CONFIG_M520x) | 1554 | #elif defined(CONFIG_M520x) |
1520 | volatile unsigned char *icrp, *uartp; | 1555 | volatile unsigned char *icrp, *uartp; |
1521 | volatile unsigned long *imrp; | 1556 | volatile unsigned long *imrp; |
@@ -1713,7 +1748,7 @@ mcfrs_init(void) | |||
1713 | /* Initialize the tty_driver structure */ | 1748 | /* Initialize the tty_driver structure */ |
1714 | mcfrs_serial_driver->owner = THIS_MODULE; | 1749 | mcfrs_serial_driver->owner = THIS_MODULE; |
1715 | mcfrs_serial_driver->name = "ttyS"; | 1750 | mcfrs_serial_driver->name = "ttyS"; |
1716 | mcfrs_serial_driver->driver_name = "serial"; | 1751 | mcfrs_serial_driver->driver_name = "mcfserial"; |
1717 | mcfrs_serial_driver->major = TTY_MAJOR; | 1752 | mcfrs_serial_driver->major = TTY_MAJOR; |
1718 | mcfrs_serial_driver->minor_start = 64; | 1753 | mcfrs_serial_driver->minor_start = 64; |
1719 | mcfrs_serial_driver->type = TTY_DRIVER_TYPE_SERIAL; | 1754 | mcfrs_serial_driver->type = TTY_DRIVER_TYPE_SERIAL; |
@@ -1797,10 +1832,23 @@ void mcfrs_init_console(void) | |||
1797 | uartp[MCFUART_UMR] = MCFUART_MR1_PARITYNONE | MCFUART_MR1_CS8; | 1832 | uartp[MCFUART_UMR] = MCFUART_MR1_PARITYNONE | MCFUART_MR1_CS8; |
1798 | uartp[MCFUART_UMR] = MCFUART_MR2_STOP1; | 1833 | uartp[MCFUART_UMR] = MCFUART_MR2_STOP1; |
1799 | 1834 | ||
1835 | #ifdef CONFIG_M5272 | ||
1836 | { | ||
1837 | /* | ||
1838 | * For the MCF5272, also compute the baudrate fraction. | ||
1839 | */ | ||
1840 | int fraction = MCF_BUSCLK - (clk * 32 * mcfrs_console_baud); | ||
1841 | fraction *= 16; | ||
1842 | fraction /= (32 * mcfrs_console_baud); | ||
1843 | uartp[MCFUART_UFPD] = (fraction & 0xf); /* set fraction */ | ||
1844 | clk = (MCF_BUSCLK / mcfrs_console_baud) / 32; | ||
1845 | } | ||
1846 | #else | ||
1800 | clk = ((MCF_BUSCLK / mcfrs_console_baud) + 16) / 32; /* set baud */ | 1847 | clk = ((MCF_BUSCLK / mcfrs_console_baud) + 16) / 32; /* set baud */ |
1848 | #endif | ||
1849 | |||
1801 | uartp[MCFUART_UBG1] = (clk & 0xff00) >> 8; /* set msb baud */ | 1850 | uartp[MCFUART_UBG1] = (clk & 0xff00) >> 8; /* set msb baud */ |
1802 | uartp[MCFUART_UBG2] = (clk & 0xff); /* set lsb baud */ | 1851 | uartp[MCFUART_UBG2] = (clk & 0xff); /* set lsb baud */ |
1803 | |||
1804 | uartp[MCFUART_UCSR] = MCFUART_UCSR_RXCLKTIMER | MCFUART_UCSR_TXCLKTIMER; | 1852 | uartp[MCFUART_UCSR] = MCFUART_UCSR_RXCLKTIMER | MCFUART_UCSR_TXCLKTIMER; |
1805 | uartp[MCFUART_UCR] = MCFUART_UCR_RXENABLE | MCFUART_UCR_TXENABLE; | 1853 | uartp[MCFUART_UCR] = MCFUART_UCR_RXENABLE | MCFUART_UCR_TXENABLE; |
1806 | 1854 | ||
diff --git a/drivers/serial/mpc52xx_uart.c b/drivers/serial/mpc52xx_uart.c index 4f80c5b4a753..6dd579ed9777 100644 --- a/drivers/serial/mpc52xx_uart.c +++ b/drivers/serial/mpc52xx_uart.c | |||
@@ -1,6 +1,4 @@ | |||
1 | /* | 1 | /* |
2 | * drivers/serial/mpc52xx_uart.c | ||
3 | * | ||
4 | * Driver for the PSC of the Freescale MPC52xx PSCs configured as UARTs. | 2 | * Driver for the PSC of the Freescale MPC52xx PSCs configured as UARTs. |
5 | * | 3 | * |
6 | * FIXME According to the usermanual the status bits in the status register | 4 | * FIXME According to the usermanual the status bits in the status register |
@@ -14,18 +12,20 @@ | |||
14 | * | 12 | * |
15 | * | 13 | * |
16 | * Maintainer : Sylvain Munaut <tnt@246tNt.com> | 14 | * Maintainer : Sylvain Munaut <tnt@246tNt.com> |
17 | * | 15 | * |
18 | * Some of the code has been inspired/copied from the 2.4 code written | 16 | * Some of the code has been inspired/copied from the 2.4 code written |
19 | * by Dale Farnsworth <dfarnsworth@mvista.com>. | 17 | * by Dale Farnsworth <dfarnsworth@mvista.com>. |
20 | * | 18 | * |
21 | * Copyright (C) 2004-2005 Sylvain Munaut <tnt@246tNt.com> | 19 | * Copyright (C) 2006 Secret Lab Technologies Ltd. |
20 | * Grant Likely <grant.likely@secretlab.ca> | ||
21 | * Copyright (C) 2004-2006 Sylvain Munaut <tnt@246tNt.com> | ||
22 | * Copyright (C) 2003 MontaVista, Software, Inc. | 22 | * Copyright (C) 2003 MontaVista, Software, Inc. |
23 | * | 23 | * |
24 | * This file is licensed under the terms of the GNU General Public License | 24 | * This file is licensed under the terms of the GNU General Public License |
25 | * version 2. This program is licensed "as is" without any warranty of any | 25 | * version 2. This program is licensed "as is" without any warranty of any |
26 | * kind, whether express or implied. | 26 | * kind, whether express or implied. |
27 | */ | 27 | */ |
28 | 28 | ||
29 | /* Platform device Usage : | 29 | /* Platform device Usage : |
30 | * | 30 | * |
31 | * Since PSCs can have multiple function, the correct driver for each one | 31 | * Since PSCs can have multiple function, the correct driver for each one |
@@ -44,7 +44,24 @@ | |||
44 | * will be mapped to. | 44 | * will be mapped to. |
45 | */ | 45 | */ |
46 | 46 | ||
47 | #include <linux/platform_device.h> | 47 | /* OF Platform device Usage : |
48 | * | ||
49 | * This driver is only used for PSCs configured in uart mode. The device | ||
50 | * tree will have a node for each PSC in uart mode w/ device_type = "serial" | ||
51 | * and "mpc52xx-psc-uart" in the compatible string | ||
52 | * | ||
53 | * By default, PSC devices are enumerated in the order they are found. However | ||
54 | * a particular PSC number can be forces by adding 'device_no = <port#>' | ||
55 | * to the device node. | ||
56 | * | ||
57 | * The driver init all necessary registers to place the PSC in uart mode without | ||
58 | * DCD. However, the pin multiplexing aren't changed and should be set either | ||
59 | * by the bootloader or in the platform init code. | ||
60 | */ | ||
61 | |||
62 | #undef DEBUG | ||
63 | |||
64 | #include <linux/device.h> | ||
48 | #include <linux/module.h> | 65 | #include <linux/module.h> |
49 | #include <linux/tty.h> | 66 | #include <linux/tty.h> |
50 | #include <linux/serial.h> | 67 | #include <linux/serial.h> |
@@ -54,6 +71,12 @@ | |||
54 | #include <asm/delay.h> | 71 | #include <asm/delay.h> |
55 | #include <asm/io.h> | 72 | #include <asm/io.h> |
56 | 73 | ||
74 | #if defined(CONFIG_PPC_MERGE) | ||
75 | #include <asm/of_platform.h> | ||
76 | #else | ||
77 | #include <linux/platform_device.h> | ||
78 | #endif | ||
79 | |||
57 | #include <asm/mpc52xx.h> | 80 | #include <asm/mpc52xx.h> |
58 | #include <asm/mpc52xx_psc.h> | 81 | #include <asm/mpc52xx_psc.h> |
59 | 82 | ||
@@ -80,6 +103,12 @@ static struct uart_port mpc52xx_uart_ports[MPC52xx_PSC_MAXNUM]; | |||
80 | * it's cleared, then a memset(...,0,...) should be added to | 103 | * it's cleared, then a memset(...,0,...) should be added to |
81 | * the console_init | 104 | * the console_init |
82 | */ | 105 | */ |
106 | #if defined(CONFIG_PPC_MERGE) | ||
107 | /* lookup table for matching device nodes to index numbers */ | ||
108 | static struct device_node *mpc52xx_uart_nodes[MPC52xx_PSC_MAXNUM]; | ||
109 | |||
110 | static void mpc52xx_uart_of_enumerate(void); | ||
111 | #endif | ||
83 | 112 | ||
84 | #define PSC(port) ((struct mpc52xx_psc __iomem *)((port)->membase)) | 113 | #define PSC(port) ((struct mpc52xx_psc __iomem *)((port)->membase)) |
85 | 114 | ||
@@ -96,32 +125,40 @@ static irqreturn_t mpc52xx_uart_int(int irq,void *dev_id); | |||
96 | #define uart_console(port) (0) | 125 | #define uart_console(port) (0) |
97 | #endif | 126 | #endif |
98 | 127 | ||
128 | #if defined(CONFIG_PPC_MERGE) | ||
129 | static struct of_device_id mpc52xx_uart_of_match[] = { | ||
130 | { .type = "serial", .compatible = "mpc52xx-psc-uart", }, | ||
131 | { .type = "serial", .compatible = "mpc5200-psc", }, /* Efika only! */ | ||
132 | {}, | ||
133 | }; | ||
134 | #endif | ||
135 | |||
99 | 136 | ||
100 | /* ======================================================================== */ | 137 | /* ======================================================================== */ |
101 | /* UART operations */ | 138 | /* UART operations */ |
102 | /* ======================================================================== */ | 139 | /* ======================================================================== */ |
103 | 140 | ||
104 | static unsigned int | 141 | static unsigned int |
105 | mpc52xx_uart_tx_empty(struct uart_port *port) | 142 | mpc52xx_uart_tx_empty(struct uart_port *port) |
106 | { | 143 | { |
107 | int status = in_be16(&PSC(port)->mpc52xx_psc_status); | 144 | int status = in_be16(&PSC(port)->mpc52xx_psc_status); |
108 | return (status & MPC52xx_PSC_SR_TXEMP) ? TIOCSER_TEMT : 0; | 145 | return (status & MPC52xx_PSC_SR_TXEMP) ? TIOCSER_TEMT : 0; |
109 | } | 146 | } |
110 | 147 | ||
111 | static void | 148 | static void |
112 | mpc52xx_uart_set_mctrl(struct uart_port *port, unsigned int mctrl) | 149 | mpc52xx_uart_set_mctrl(struct uart_port *port, unsigned int mctrl) |
113 | { | 150 | { |
114 | /* Not implemented */ | 151 | /* Not implemented */ |
115 | } | 152 | } |
116 | 153 | ||
117 | static unsigned int | 154 | static unsigned int |
118 | mpc52xx_uart_get_mctrl(struct uart_port *port) | 155 | mpc52xx_uart_get_mctrl(struct uart_port *port) |
119 | { | 156 | { |
120 | /* Not implemented */ | 157 | /* Not implemented */ |
121 | return TIOCM_CTS | TIOCM_DSR | TIOCM_CAR; | 158 | return TIOCM_CTS | TIOCM_DSR | TIOCM_CAR; |
122 | } | 159 | } |
123 | 160 | ||
124 | static void | 161 | static void |
125 | mpc52xx_uart_stop_tx(struct uart_port *port) | 162 | mpc52xx_uart_stop_tx(struct uart_port *port) |
126 | { | 163 | { |
127 | /* port->lock taken by caller */ | 164 | /* port->lock taken by caller */ |
@@ -129,7 +166,7 @@ mpc52xx_uart_stop_tx(struct uart_port *port) | |||
129 | out_be16(&PSC(port)->mpc52xx_psc_imr,port->read_status_mask); | 166 | out_be16(&PSC(port)->mpc52xx_psc_imr,port->read_status_mask); |
130 | } | 167 | } |
131 | 168 | ||
132 | static void | 169 | static void |
133 | mpc52xx_uart_start_tx(struct uart_port *port) | 170 | mpc52xx_uart_start_tx(struct uart_port *port) |
134 | { | 171 | { |
135 | /* port->lock taken by caller */ | 172 | /* port->lock taken by caller */ |
@@ -137,12 +174,12 @@ mpc52xx_uart_start_tx(struct uart_port *port) | |||
137 | out_be16(&PSC(port)->mpc52xx_psc_imr,port->read_status_mask); | 174 | out_be16(&PSC(port)->mpc52xx_psc_imr,port->read_status_mask); |
138 | } | 175 | } |
139 | 176 | ||
140 | static void | 177 | static void |
141 | mpc52xx_uart_send_xchar(struct uart_port *port, char ch) | 178 | mpc52xx_uart_send_xchar(struct uart_port *port, char ch) |
142 | { | 179 | { |
143 | unsigned long flags; | 180 | unsigned long flags; |
144 | spin_lock_irqsave(&port->lock, flags); | 181 | spin_lock_irqsave(&port->lock, flags); |
145 | 182 | ||
146 | port->x_char = ch; | 183 | port->x_char = ch; |
147 | if (ch) { | 184 | if (ch) { |
148 | /* Make sure tx interrupts are on */ | 185 | /* Make sure tx interrupts are on */ |
@@ -150,7 +187,7 @@ mpc52xx_uart_send_xchar(struct uart_port *port, char ch) | |||
150 | port->read_status_mask |= MPC52xx_PSC_IMR_TXRDY; | 187 | port->read_status_mask |= MPC52xx_PSC_IMR_TXRDY; |
151 | out_be16(&PSC(port)->mpc52xx_psc_imr,port->read_status_mask); | 188 | out_be16(&PSC(port)->mpc52xx_psc_imr,port->read_status_mask); |
152 | } | 189 | } |
153 | 190 | ||
154 | spin_unlock_irqrestore(&port->lock, flags); | 191 | spin_unlock_irqrestore(&port->lock, flags); |
155 | } | 192 | } |
156 | 193 | ||
@@ -178,7 +215,7 @@ mpc52xx_uart_break_ctl(struct uart_port *port, int ctl) | |||
178 | out_8(&PSC(port)->command,MPC52xx_PSC_START_BRK); | 215 | out_8(&PSC(port)->command,MPC52xx_PSC_START_BRK); |
179 | else | 216 | else |
180 | out_8(&PSC(port)->command,MPC52xx_PSC_STOP_BRK); | 217 | out_8(&PSC(port)->command,MPC52xx_PSC_STOP_BRK); |
181 | 218 | ||
182 | spin_unlock_irqrestore(&port->lock, flags); | 219 | spin_unlock_irqrestore(&port->lock, flags); |
183 | } | 220 | } |
184 | 221 | ||
@@ -197,11 +234,11 @@ mpc52xx_uart_startup(struct uart_port *port) | |||
197 | /* Reset/activate the port, clear and enable interrupts */ | 234 | /* Reset/activate the port, clear and enable interrupts */ |
198 | out_8(&psc->command,MPC52xx_PSC_RST_RX); | 235 | out_8(&psc->command,MPC52xx_PSC_RST_RX); |
199 | out_8(&psc->command,MPC52xx_PSC_RST_TX); | 236 | out_8(&psc->command,MPC52xx_PSC_RST_TX); |
200 | 237 | ||
201 | out_be32(&psc->sicr,0); /* UART mode DCD ignored */ | 238 | out_be32(&psc->sicr,0); /* UART mode DCD ignored */ |
202 | 239 | ||
203 | out_be16(&psc->mpc52xx_psc_clock_select, 0xdd00); /* /16 prescaler on */ | 240 | out_be16(&psc->mpc52xx_psc_clock_select, 0xdd00); /* /16 prescaler on */ |
204 | 241 | ||
205 | out_8(&psc->rfcntl, 0x00); | 242 | out_8(&psc->rfcntl, 0x00); |
206 | out_be16(&psc->rfalarm, 0x1ff); | 243 | out_be16(&psc->rfalarm, 0x1ff); |
207 | out_8(&psc->tfcntl, 0x07); | 244 | out_8(&psc->tfcntl, 0x07); |
@@ -209,10 +246,10 @@ mpc52xx_uart_startup(struct uart_port *port) | |||
209 | 246 | ||
210 | port->read_status_mask |= MPC52xx_PSC_IMR_RXRDY | MPC52xx_PSC_IMR_TXRDY; | 247 | port->read_status_mask |= MPC52xx_PSC_IMR_RXRDY | MPC52xx_PSC_IMR_TXRDY; |
211 | out_be16(&psc->mpc52xx_psc_imr,port->read_status_mask); | 248 | out_be16(&psc->mpc52xx_psc_imr,port->read_status_mask); |
212 | 249 | ||
213 | out_8(&psc->command,MPC52xx_PSC_TX_ENABLE); | 250 | out_8(&psc->command,MPC52xx_PSC_TX_ENABLE); |
214 | out_8(&psc->command,MPC52xx_PSC_RX_ENABLE); | 251 | out_8(&psc->command,MPC52xx_PSC_RX_ENABLE); |
215 | 252 | ||
216 | return 0; | 253 | return 0; |
217 | } | 254 | } |
218 | 255 | ||
@@ -220,19 +257,19 @@ static void | |||
220 | mpc52xx_uart_shutdown(struct uart_port *port) | 257 | mpc52xx_uart_shutdown(struct uart_port *port) |
221 | { | 258 | { |
222 | struct mpc52xx_psc __iomem *psc = PSC(port); | 259 | struct mpc52xx_psc __iomem *psc = PSC(port); |
223 | 260 | ||
224 | /* Shut down the port, interrupt and all */ | 261 | /* Shut down the port, interrupt and all */ |
225 | out_8(&psc->command,MPC52xx_PSC_RST_RX); | 262 | out_8(&psc->command,MPC52xx_PSC_RST_RX); |
226 | out_8(&psc->command,MPC52xx_PSC_RST_TX); | 263 | out_8(&psc->command,MPC52xx_PSC_RST_TX); |
227 | 264 | ||
228 | port->read_status_mask = 0; | 265 | port->read_status_mask = 0; |
229 | out_be16(&psc->mpc52xx_psc_imr,port->read_status_mask); | 266 | out_be16(&psc->mpc52xx_psc_imr,port->read_status_mask); |
230 | 267 | ||
231 | /* Release interrupt */ | 268 | /* Release interrupt */ |
232 | free_irq(port->irq, port); | 269 | free_irq(port->irq, port); |
233 | } | 270 | } |
234 | 271 | ||
235 | static void | 272 | static void |
236 | mpc52xx_uart_set_termios(struct uart_port *port, struct termios *new, | 273 | mpc52xx_uart_set_termios(struct uart_port *port, struct termios *new, |
237 | struct termios *old) | 274 | struct termios *old) |
238 | { | 275 | { |
@@ -241,10 +278,10 @@ mpc52xx_uart_set_termios(struct uart_port *port, struct termios *new, | |||
241 | unsigned char mr1, mr2; | 278 | unsigned char mr1, mr2; |
242 | unsigned short ctr; | 279 | unsigned short ctr; |
243 | unsigned int j, baud, quot; | 280 | unsigned int j, baud, quot; |
244 | 281 | ||
245 | /* Prepare what we're gonna write */ | 282 | /* Prepare what we're gonna write */ |
246 | mr1 = 0; | 283 | mr1 = 0; |
247 | 284 | ||
248 | switch (new->c_cflag & CSIZE) { | 285 | switch (new->c_cflag & CSIZE) { |
249 | case CS5: mr1 |= MPC52xx_PSC_MODE_5_BITS; | 286 | case CS5: mr1 |= MPC52xx_PSC_MODE_5_BITS; |
250 | break; | 287 | break; |
@@ -261,8 +298,8 @@ mpc52xx_uart_set_termios(struct uart_port *port, struct termios *new, | |||
261 | MPC52xx_PSC_MODE_PARODD : MPC52xx_PSC_MODE_PAREVEN; | 298 | MPC52xx_PSC_MODE_PARODD : MPC52xx_PSC_MODE_PAREVEN; |
262 | } else | 299 | } else |
263 | mr1 |= MPC52xx_PSC_MODE_PARNONE; | 300 | mr1 |= MPC52xx_PSC_MODE_PARNONE; |
264 | 301 | ||
265 | 302 | ||
266 | mr2 = 0; | 303 | mr2 = 0; |
267 | 304 | ||
268 | if (new->c_cflag & CSTOPB) | 305 | if (new->c_cflag & CSTOPB) |
@@ -276,7 +313,7 @@ mpc52xx_uart_set_termios(struct uart_port *port, struct termios *new, | |||
276 | baud = uart_get_baud_rate(port, new, old, 0, port->uartclk/16); | 313 | baud = uart_get_baud_rate(port, new, old, 0, port->uartclk/16); |
277 | quot = uart_get_divisor(port, baud); | 314 | quot = uart_get_divisor(port, baud); |
278 | ctr = quot & 0xffff; | 315 | ctr = quot & 0xffff; |
279 | 316 | ||
280 | /* Get the lock */ | 317 | /* Get the lock */ |
281 | spin_lock_irqsave(&port->lock, flags); | 318 | spin_lock_irqsave(&port->lock, flags); |
282 | 319 | ||
@@ -290,14 +327,14 @@ mpc52xx_uart_set_termios(struct uart_port *port, struct termios *new, | |||
290 | * boot for the console, all stuff is not yet ready to receive at that | 327 | * boot for the console, all stuff is not yet ready to receive at that |
291 | * time and that just makes the kernel oops */ | 328 | * time and that just makes the kernel oops */ |
292 | /* while (j-- && mpc52xx_uart_int_rx_chars(port)); */ | 329 | /* while (j-- && mpc52xx_uart_int_rx_chars(port)); */ |
293 | while (!(in_be16(&psc->mpc52xx_psc_status) & MPC52xx_PSC_SR_TXEMP) && | 330 | while (!(in_be16(&psc->mpc52xx_psc_status) & MPC52xx_PSC_SR_TXEMP) && |
294 | --j) | 331 | --j) |
295 | udelay(1); | 332 | udelay(1); |
296 | 333 | ||
297 | if (!j) | 334 | if (!j) |
298 | printk( KERN_ERR "mpc52xx_uart.c: " | 335 | printk( KERN_ERR "mpc52xx_uart.c: " |
299 | "Unable to flush RX & TX fifos in-time in set_termios." | 336 | "Unable to flush RX & TX fifos in-time in set_termios." |
300 | "Some chars may have been lost.\n" ); | 337 | "Some chars may have been lost.\n" ); |
301 | 338 | ||
302 | /* Reset the TX & RX */ | 339 | /* Reset the TX & RX */ |
303 | out_8(&psc->command,MPC52xx_PSC_RST_RX); | 340 | out_8(&psc->command,MPC52xx_PSC_RST_RX); |
@@ -309,7 +346,7 @@ mpc52xx_uart_set_termios(struct uart_port *port, struct termios *new, | |||
309 | out_8(&psc->mode,mr2); | 346 | out_8(&psc->mode,mr2); |
310 | out_8(&psc->ctur,ctr >> 8); | 347 | out_8(&psc->ctur,ctr >> 8); |
311 | out_8(&psc->ctlr,ctr & 0xff); | 348 | out_8(&psc->ctlr,ctr & 0xff); |
312 | 349 | ||
313 | /* Reenable TX & RX */ | 350 | /* Reenable TX & RX */ |
314 | out_8(&psc->command,MPC52xx_PSC_TX_ENABLE); | 351 | out_8(&psc->command,MPC52xx_PSC_TX_ENABLE); |
315 | out_8(&psc->command,MPC52xx_PSC_RX_ENABLE); | 352 | out_8(&psc->command,MPC52xx_PSC_RX_ENABLE); |
@@ -332,7 +369,7 @@ mpc52xx_uart_release_port(struct uart_port *port) | |||
332 | port->membase = NULL; | 369 | port->membase = NULL; |
333 | } | 370 | } |
334 | 371 | ||
335 | release_mem_region(port->mapbase, MPC52xx_PSC_SIZE); | 372 | release_mem_region(port->mapbase, sizeof(struct mpc52xx_psc)); |
336 | } | 373 | } |
337 | 374 | ||
338 | static int | 375 | static int |
@@ -341,12 +378,13 @@ mpc52xx_uart_request_port(struct uart_port *port) | |||
341 | int err; | 378 | int err; |
342 | 379 | ||
343 | if (port->flags & UPF_IOREMAP) /* Need to remap ? */ | 380 | if (port->flags & UPF_IOREMAP) /* Need to remap ? */ |
344 | port->membase = ioremap(port->mapbase, MPC52xx_PSC_SIZE); | 381 | port->membase = ioremap(port->mapbase, |
382 | sizeof(struct mpc52xx_psc)); | ||
345 | 383 | ||
346 | if (!port->membase) | 384 | if (!port->membase) |
347 | return -EINVAL; | 385 | return -EINVAL; |
348 | 386 | ||
349 | err = request_mem_region(port->mapbase, MPC52xx_PSC_SIZE, | 387 | err = request_mem_region(port->mapbase, sizeof(struct mpc52xx_psc), |
350 | "mpc52xx_psc_uart") != NULL ? 0 : -EBUSY; | 388 | "mpc52xx_psc_uart") != NULL ? 0 : -EBUSY; |
351 | 389 | ||
352 | if (err && (port->flags & UPF_IOREMAP)) { | 390 | if (err && (port->flags & UPF_IOREMAP)) { |
@@ -373,7 +411,7 @@ mpc52xx_uart_verify_port(struct uart_port *port, struct serial_struct *ser) | |||
373 | 411 | ||
374 | if ( (ser->irq != port->irq) || | 412 | if ( (ser->irq != port->irq) || |
375 | (ser->io_type != SERIAL_IO_MEM) || | 413 | (ser->io_type != SERIAL_IO_MEM) || |
376 | (ser->baud_base != port->uartclk) || | 414 | (ser->baud_base != port->uartclk) || |
377 | (ser->iomem_base != (void*)port->mapbase) || | 415 | (ser->iomem_base != (void*)port->mapbase) || |
378 | (ser->hub6 != 0 ) ) | 416 | (ser->hub6 != 0 ) ) |
379 | return -EINVAL; | 417 | return -EINVAL; |
@@ -404,11 +442,11 @@ static struct uart_ops mpc52xx_uart_ops = { | |||
404 | .verify_port = mpc52xx_uart_verify_port | 442 | .verify_port = mpc52xx_uart_verify_port |
405 | }; | 443 | }; |
406 | 444 | ||
407 | 445 | ||
408 | /* ======================================================================== */ | 446 | /* ======================================================================== */ |
409 | /* Interrupt handling */ | 447 | /* Interrupt handling */ |
410 | /* ======================================================================== */ | 448 | /* ======================================================================== */ |
411 | 449 | ||
412 | static inline int | 450 | static inline int |
413 | mpc52xx_uart_int_rx_chars(struct uart_port *port) | 451 | mpc52xx_uart_int_rx_chars(struct uart_port *port) |
414 | { | 452 | { |
@@ -435,11 +473,11 @@ mpc52xx_uart_int_rx_chars(struct uart_port *port) | |||
435 | 473 | ||
436 | flag = TTY_NORMAL; | 474 | flag = TTY_NORMAL; |
437 | port->icount.rx++; | 475 | port->icount.rx++; |
438 | 476 | ||
439 | if ( status & (MPC52xx_PSC_SR_PE | | 477 | if ( status & (MPC52xx_PSC_SR_PE | |
440 | MPC52xx_PSC_SR_FE | | 478 | MPC52xx_PSC_SR_FE | |
441 | MPC52xx_PSC_SR_RB) ) { | 479 | MPC52xx_PSC_SR_RB) ) { |
442 | 480 | ||
443 | if (status & MPC52xx_PSC_SR_RB) { | 481 | if (status & MPC52xx_PSC_SR_RB) { |
444 | flag = TTY_BREAK; | 482 | flag = TTY_BREAK; |
445 | uart_handle_break(port); | 483 | uart_handle_break(port); |
@@ -464,7 +502,7 @@ mpc52xx_uart_int_rx_chars(struct uart_port *port) | |||
464 | } | 502 | } |
465 | 503 | ||
466 | tty_flip_buffer_push(tty); | 504 | tty_flip_buffer_push(tty); |
467 | 505 | ||
468 | return in_be16(&PSC(port)->mpc52xx_psc_status) & MPC52xx_PSC_SR_RXRDY; | 506 | return in_be16(&PSC(port)->mpc52xx_psc_status) & MPC52xx_PSC_SR_RXRDY; |
469 | } | 507 | } |
470 | 508 | ||
@@ -509,25 +547,25 @@ mpc52xx_uart_int_tx_chars(struct uart_port *port) | |||
509 | return 1; | 547 | return 1; |
510 | } | 548 | } |
511 | 549 | ||
512 | static irqreturn_t | 550 | static irqreturn_t |
513 | mpc52xx_uart_int(int irq, void *dev_id) | 551 | mpc52xx_uart_int(int irq, void *dev_id) |
514 | { | 552 | { |
515 | struct uart_port *port = dev_id; | 553 | struct uart_port *port = dev_id; |
516 | unsigned long pass = ISR_PASS_LIMIT; | 554 | unsigned long pass = ISR_PASS_LIMIT; |
517 | unsigned int keepgoing; | 555 | unsigned int keepgoing; |
518 | unsigned short status; | 556 | unsigned short status; |
519 | 557 | ||
520 | spin_lock(&port->lock); | 558 | spin_lock(&port->lock); |
521 | 559 | ||
522 | /* While we have stuff to do, we continue */ | 560 | /* While we have stuff to do, we continue */ |
523 | do { | 561 | do { |
524 | /* If we don't find anything to do, we stop */ | 562 | /* If we don't find anything to do, we stop */ |
525 | keepgoing = 0; | 563 | keepgoing = 0; |
526 | 564 | ||
527 | /* Read status */ | 565 | /* Read status */ |
528 | status = in_be16(&PSC(port)->mpc52xx_psc_isr); | 566 | status = in_be16(&PSC(port)->mpc52xx_psc_isr); |
529 | status &= port->read_status_mask; | 567 | status &= port->read_status_mask; |
530 | 568 | ||
531 | /* Do we need to receive chars ? */ | 569 | /* Do we need to receive chars ? */ |
532 | /* For this RX interrupts must be on and some chars waiting */ | 570 | /* For this RX interrupts must be on and some chars waiting */ |
533 | if ( status & MPC52xx_PSC_IMR_RXRDY ) | 571 | if ( status & MPC52xx_PSC_IMR_RXRDY ) |
@@ -537,15 +575,15 @@ mpc52xx_uart_int(int irq, void *dev_id) | |||
537 | /* For this, TX must be ready and TX interrupt enabled */ | 575 | /* For this, TX must be ready and TX interrupt enabled */ |
538 | if ( status & MPC52xx_PSC_IMR_TXRDY ) | 576 | if ( status & MPC52xx_PSC_IMR_TXRDY ) |
539 | keepgoing |= mpc52xx_uart_int_tx_chars(port); | 577 | keepgoing |= mpc52xx_uart_int_tx_chars(port); |
540 | 578 | ||
541 | /* Limit number of iteration */ | 579 | /* Limit number of iteration */ |
542 | if ( !(--pass) ) | 580 | if ( !(--pass) ) |
543 | keepgoing = 0; | 581 | keepgoing = 0; |
544 | 582 | ||
545 | } while (keepgoing); | 583 | } while (keepgoing); |
546 | 584 | ||
547 | spin_unlock(&port->lock); | 585 | spin_unlock(&port->lock); |
548 | 586 | ||
549 | return IRQ_HANDLED; | 587 | return IRQ_HANDLED; |
550 | } | 588 | } |
551 | 589 | ||
@@ -563,13 +601,18 @@ mpc52xx_console_get_options(struct uart_port *port, | |||
563 | struct mpc52xx_psc __iomem *psc = PSC(port); | 601 | struct mpc52xx_psc __iomem *psc = PSC(port); |
564 | unsigned char mr1; | 602 | unsigned char mr1; |
565 | 603 | ||
604 | pr_debug("mpc52xx_console_get_options(port=%p)\n", port); | ||
605 | |||
566 | /* Read the mode registers */ | 606 | /* Read the mode registers */ |
567 | out_8(&psc->command,MPC52xx_PSC_SEL_MODE_REG_1); | 607 | out_8(&psc->command,MPC52xx_PSC_SEL_MODE_REG_1); |
568 | mr1 = in_8(&psc->mode); | 608 | mr1 = in_8(&psc->mode); |
569 | 609 | ||
570 | /* CT{U,L}R are write-only ! */ | 610 | /* CT{U,L}R are write-only ! */ |
571 | *baud = __res.bi_baudrate ? | 611 | *baud = CONFIG_SERIAL_MPC52xx_CONSOLE_BAUD; |
572 | __res.bi_baudrate : CONFIG_SERIAL_MPC52xx_CONSOLE_BAUD; | 612 | #if !defined(CONFIG_PPC_MERGE) |
613 | if (__res.bi_baudrate) | ||
614 | *baud = __res.bi_baudrate; | ||
615 | #endif | ||
573 | 616 | ||
574 | /* Parse them */ | 617 | /* Parse them */ |
575 | switch (mr1 & MPC52xx_PSC_MODE_BITS_MASK) { | 618 | switch (mr1 & MPC52xx_PSC_MODE_BITS_MASK) { |
@@ -579,26 +622,26 @@ mpc52xx_console_get_options(struct uart_port *port, | |||
579 | case MPC52xx_PSC_MODE_8_BITS: | 622 | case MPC52xx_PSC_MODE_8_BITS: |
580 | default: *bits = 8; | 623 | default: *bits = 8; |
581 | } | 624 | } |
582 | 625 | ||
583 | if (mr1 & MPC52xx_PSC_MODE_PARNONE) | 626 | if (mr1 & MPC52xx_PSC_MODE_PARNONE) |
584 | *parity = 'n'; | 627 | *parity = 'n'; |
585 | else | 628 | else |
586 | *parity = mr1 & MPC52xx_PSC_MODE_PARODD ? 'o' : 'e'; | 629 | *parity = mr1 & MPC52xx_PSC_MODE_PARODD ? 'o' : 'e'; |
587 | } | 630 | } |
588 | 631 | ||
589 | static void | 632 | static void |
590 | mpc52xx_console_write(struct console *co, const char *s, unsigned int count) | 633 | mpc52xx_console_write(struct console *co, const char *s, unsigned int count) |
591 | { | 634 | { |
592 | struct uart_port *port = &mpc52xx_uart_ports[co->index]; | 635 | struct uart_port *port = &mpc52xx_uart_ports[co->index]; |
593 | struct mpc52xx_psc __iomem *psc = PSC(port); | 636 | struct mpc52xx_psc __iomem *psc = PSC(port); |
594 | unsigned int i, j; | 637 | unsigned int i, j; |
595 | 638 | ||
596 | /* Disable interrupts */ | 639 | /* Disable interrupts */ |
597 | out_be16(&psc->mpc52xx_psc_imr, 0); | 640 | out_be16(&psc->mpc52xx_psc_imr, 0); |
598 | 641 | ||
599 | /* Wait the TX buffer to be empty */ | 642 | /* Wait the TX buffer to be empty */ |
600 | j = 5000000; /* Maximum wait */ | 643 | j = 5000000; /* Maximum wait */ |
601 | while (!(in_be16(&psc->mpc52xx_psc_status) & MPC52xx_PSC_SR_TXEMP) && | 644 | while (!(in_be16(&psc->mpc52xx_psc_status) & MPC52xx_PSC_SR_TXEMP) && |
602 | --j) | 645 | --j) |
603 | udelay(1); | 646 | udelay(1); |
604 | 647 | ||
@@ -607,13 +650,13 @@ mpc52xx_console_write(struct console *co, const char *s, unsigned int count) | |||
607 | /* Line return handling */ | 650 | /* Line return handling */ |
608 | if (*s == '\n') | 651 | if (*s == '\n') |
609 | out_8(&psc->mpc52xx_psc_buffer_8, '\r'); | 652 | out_8(&psc->mpc52xx_psc_buffer_8, '\r'); |
610 | 653 | ||
611 | /* Send the char */ | 654 | /* Send the char */ |
612 | out_8(&psc->mpc52xx_psc_buffer_8, *s); | 655 | out_8(&psc->mpc52xx_psc_buffer_8, *s); |
613 | 656 | ||
614 | /* Wait the TX buffer to be empty */ | 657 | /* Wait the TX buffer to be empty */ |
615 | j = 20000; /* Maximum wait */ | 658 | j = 20000; /* Maximum wait */ |
616 | while (!(in_be16(&psc->mpc52xx_psc_status) & | 659 | while (!(in_be16(&psc->mpc52xx_psc_status) & |
617 | MPC52xx_PSC_SR_TXEMP) && --j) | 660 | MPC52xx_PSC_SR_TXEMP) && --j) |
618 | udelay(1); | 661 | udelay(1); |
619 | } | 662 | } |
@@ -622,6 +665,7 @@ mpc52xx_console_write(struct console *co, const char *s, unsigned int count) | |||
622 | out_be16(&psc->mpc52xx_psc_imr, port->read_status_mask); | 665 | out_be16(&psc->mpc52xx_psc_imr, port->read_status_mask); |
623 | } | 666 | } |
624 | 667 | ||
668 | #if !defined(CONFIG_PPC_MERGE) | ||
625 | static int __init | 669 | static int __init |
626 | mpc52xx_console_setup(struct console *co, char *options) | 670 | mpc52xx_console_setup(struct console *co, char *options) |
627 | { | 671 | { |
@@ -634,7 +678,7 @@ mpc52xx_console_setup(struct console *co, char *options) | |||
634 | 678 | ||
635 | if (co->index < 0 || co->index >= MPC52xx_PSC_MAXNUM) | 679 | if (co->index < 0 || co->index >= MPC52xx_PSC_MAXNUM) |
636 | return -EINVAL; | 680 | return -EINVAL; |
637 | 681 | ||
638 | /* Basic port init. Needed since we use some uart_??? func before | 682 | /* Basic port init. Needed since we use some uart_??? func before |
639 | * real init for early access */ | 683 | * real init for early access */ |
640 | spin_lock_init(&port->lock); | 684 | spin_lock_init(&port->lock); |
@@ -656,6 +700,78 @@ mpc52xx_console_setup(struct console *co, char *options) | |||
656 | return uart_set_options(port, co, baud, parity, bits, flow); | 700 | return uart_set_options(port, co, baud, parity, bits, flow); |
657 | } | 701 | } |
658 | 702 | ||
703 | #else | ||
704 | |||
705 | static int __init | ||
706 | mpc52xx_console_setup(struct console *co, char *options) | ||
707 | { | ||
708 | struct uart_port *port = &mpc52xx_uart_ports[co->index]; | ||
709 | struct device_node *np = mpc52xx_uart_nodes[co->index]; | ||
710 | unsigned int ipb_freq; | ||
711 | struct resource res; | ||
712 | int ret; | ||
713 | |||
714 | int baud = CONFIG_SERIAL_MPC52xx_CONSOLE_BAUD; | ||
715 | int bits = 8; | ||
716 | int parity = 'n'; | ||
717 | int flow = 'n'; | ||
718 | |||
719 | pr_debug("mpc52xx_console_setup co=%p, co->index=%i, options=%s\n", | ||
720 | co, co->index, options); | ||
721 | |||
722 | if ((co->index < 0) || (co->index > MPC52xx_PSC_MAXNUM)) { | ||
723 | pr_debug("PSC%x out of range\n", co->index); | ||
724 | return -EINVAL; | ||
725 | } | ||
726 | |||
727 | if (!np) { | ||
728 | pr_debug("PSC%x not found in device tree\n", co->index); | ||
729 | return -EINVAL; | ||
730 | } | ||
731 | |||
732 | pr_debug("Console on ttyPSC%x is %s\n", | ||
733 | co->index, mpc52xx_uart_nodes[co->index]->full_name); | ||
734 | |||
735 | /* Fetch register locations */ | ||
736 | if ((ret = of_address_to_resource(np, 0, &res)) != 0) { | ||
737 | pr_debug("Could not get resources for PSC%x\n", co->index); | ||
738 | return ret; | ||
739 | } | ||
740 | |||
741 | /* Search for bus-frequency property in this node or a parent */ | ||
742 | if ((ipb_freq = mpc52xx_find_ipb_freq(np)) == 0) { | ||
743 | pr_debug("Could not find IPB bus frequency!\n"); | ||
744 | return -EINVAL; | ||
745 | } | ||
746 | |||
747 | /* Basic port init. Needed since we use some uart_??? func before | ||
748 | * real init for early access */ | ||
749 | spin_lock_init(&port->lock); | ||
750 | port->uartclk = ipb_freq / 2; | ||
751 | port->ops = &mpc52xx_uart_ops; | ||
752 | port->mapbase = res.start; | ||
753 | port->membase = ioremap(res.start, sizeof(struct mpc52xx_psc)); | ||
754 | port->irq = irq_of_parse_and_map(np, 0); | ||
755 | |||
756 | if (port->membase == NULL) | ||
757 | return -EINVAL; | ||
758 | |||
759 | pr_debug("mpc52xx-psc uart at %lx, mapped to %p, irq=%x, freq=%i\n", | ||
760 | port->mapbase, port->membase, port->irq, port->uartclk); | ||
761 | |||
762 | /* Setup the port parameters accoding to options */ | ||
763 | if (options) | ||
764 | uart_parse_options(options, &baud, &parity, &bits, &flow); | ||
765 | else | ||
766 | mpc52xx_console_get_options(port, &baud, &parity, &bits, &flow); | ||
767 | |||
768 | pr_debug("Setting console parameters: %i %i%c1 flow=%c\n", | ||
769 | baud, bits, parity, flow); | ||
770 | |||
771 | return uart_set_options(port, co, baud, parity, bits, flow); | ||
772 | } | ||
773 | #endif /* defined(CONFIG_PPC_MERGE) */ | ||
774 | |||
659 | 775 | ||
660 | static struct uart_driver mpc52xx_uart_driver; | 776 | static struct uart_driver mpc52xx_uart_driver; |
661 | 777 | ||
@@ -669,10 +785,11 @@ static struct console mpc52xx_console = { | |||
669 | .data = &mpc52xx_uart_driver, | 785 | .data = &mpc52xx_uart_driver, |
670 | }; | 786 | }; |
671 | 787 | ||
672 | 788 | ||
673 | static int __init | 789 | static int __init |
674 | mpc52xx_console_init(void) | 790 | mpc52xx_console_init(void) |
675 | { | 791 | { |
792 | mpc52xx_uart_of_enumerate(); | ||
676 | register_console(&mpc52xx_console); | 793 | register_console(&mpc52xx_console); |
677 | return 0; | 794 | return 0; |
678 | } | 795 | } |
@@ -700,6 +817,7 @@ static struct uart_driver mpc52xx_uart_driver = { | |||
700 | }; | 817 | }; |
701 | 818 | ||
702 | 819 | ||
820 | #if !defined(CONFIG_PPC_MERGE) | ||
703 | /* ======================================================================== */ | 821 | /* ======================================================================== */ |
704 | /* Platform Driver */ | 822 | /* Platform Driver */ |
705 | /* ======================================================================== */ | 823 | /* ======================================================================== */ |
@@ -723,8 +841,6 @@ mpc52xx_uart_probe(struct platform_device *dev) | |||
723 | /* Init the port structure */ | 841 | /* Init the port structure */ |
724 | port = &mpc52xx_uart_ports[idx]; | 842 | port = &mpc52xx_uart_ports[idx]; |
725 | 843 | ||
726 | memset(port, 0x00, sizeof(struct uart_port)); | ||
727 | |||
728 | spin_lock_init(&port->lock); | 844 | spin_lock_init(&port->lock); |
729 | port->uartclk = __res.bi_ipbfreq / 2; /* Look at CTLR doc */ | 845 | port->uartclk = __res.bi_ipbfreq / 2; /* Look at CTLR doc */ |
730 | port->fifosize = 512; | 846 | port->fifosize = 512; |
@@ -733,6 +849,7 @@ mpc52xx_uart_probe(struct platform_device *dev) | |||
733 | ( uart_console(port) ? 0 : UPF_IOREMAP ); | 849 | ( uart_console(port) ? 0 : UPF_IOREMAP ); |
734 | port->line = idx; | 850 | port->line = idx; |
735 | port->ops = &mpc52xx_uart_ops; | 851 | port->ops = &mpc52xx_uart_ops; |
852 | port->dev = &dev->dev; | ||
736 | 853 | ||
737 | /* Search for IRQ and mapbase */ | 854 | /* Search for IRQ and mapbase */ |
738 | for (i=0 ; i<dev->num_resources ; i++, res++) { | 855 | for (i=0 ; i<dev->num_resources ; i++, res++) { |
@@ -771,7 +888,7 @@ mpc52xx_uart_suspend(struct platform_device *dev, pm_message_t state) | |||
771 | { | 888 | { |
772 | struct uart_port *port = (struct uart_port *) platform_get_drvdata(dev); | 889 | struct uart_port *port = (struct uart_port *) platform_get_drvdata(dev); |
773 | 890 | ||
774 | if (sport) | 891 | if (port) |
775 | uart_suspend_port(&mpc52xx_uart_driver, port); | 892 | uart_suspend_port(&mpc52xx_uart_driver, port); |
776 | 893 | ||
777 | return 0; | 894 | return 0; |
@@ -789,6 +906,7 @@ mpc52xx_uart_resume(struct platform_device *dev) | |||
789 | } | 906 | } |
790 | #endif | 907 | #endif |
791 | 908 | ||
909 | |||
792 | static struct platform_driver mpc52xx_uart_platform_driver = { | 910 | static struct platform_driver mpc52xx_uart_platform_driver = { |
793 | .probe = mpc52xx_uart_probe, | 911 | .probe = mpc52xx_uart_probe, |
794 | .remove = mpc52xx_uart_remove, | 912 | .remove = mpc52xx_uart_remove, |
@@ -800,6 +918,184 @@ static struct platform_driver mpc52xx_uart_platform_driver = { | |||
800 | .name = "mpc52xx-psc", | 918 | .name = "mpc52xx-psc", |
801 | }, | 919 | }, |
802 | }; | 920 | }; |
921 | #endif /* !defined(CONFIG_PPC_MERGE) */ | ||
922 | |||
923 | |||
924 | #if defined(CONFIG_PPC_MERGE) | ||
925 | /* ======================================================================== */ | ||
926 | /* OF Platform Driver */ | ||
927 | /* ======================================================================== */ | ||
928 | |||
929 | static int __devinit | ||
930 | mpc52xx_uart_of_probe(struct of_device *op, const struct of_device_id *match) | ||
931 | { | ||
932 | int idx = -1; | ||
933 | unsigned int ipb_freq; | ||
934 | struct uart_port *port = NULL; | ||
935 | struct resource res; | ||
936 | int ret; | ||
937 | |||
938 | dev_dbg(&op->dev, "mpc52xx_uart_probe(op=%p, match=%p)\n", op, match); | ||
939 | |||
940 | /* Check validity & presence */ | ||
941 | for (idx = 0; idx < MPC52xx_PSC_MAXNUM; idx++) | ||
942 | if (mpc52xx_uart_nodes[idx] == op->node) | ||
943 | break; | ||
944 | if (idx >= MPC52xx_PSC_MAXNUM) | ||
945 | return -EINVAL; | ||
946 | pr_debug("Found %s assigned to ttyPSC%x\n", | ||
947 | mpc52xx_uart_nodes[idx]->full_name, idx); | ||
948 | |||
949 | /* Search for bus-frequency property in this node or a parent */ | ||
950 | if ((ipb_freq = mpc52xx_find_ipb_freq(op->node)) == 0) { | ||
951 | dev_dbg(&op->dev, "Could not find IPB bus frequency!\n"); | ||
952 | return -EINVAL; | ||
953 | } | ||
954 | |||
955 | /* Init the port structure */ | ||
956 | port = &mpc52xx_uart_ports[idx]; | ||
957 | |||
958 | spin_lock_init(&port->lock); | ||
959 | port->uartclk = ipb_freq / 2; | ||
960 | port->fifosize = 512; | ||
961 | port->iotype = UPIO_MEM; | ||
962 | port->flags = UPF_BOOT_AUTOCONF | | ||
963 | ( uart_console(port) ? 0 : UPF_IOREMAP ); | ||
964 | port->line = idx; | ||
965 | port->ops = &mpc52xx_uart_ops; | ||
966 | port->dev = &op->dev; | ||
967 | |||
968 | /* Search for IRQ and mapbase */ | ||
969 | if ((ret = of_address_to_resource(op->node, 0, &res)) != 0) | ||
970 | return ret; | ||
971 | |||
972 | port->mapbase = res.start; | ||
973 | port->irq = irq_of_parse_and_map(op->node, 0); | ||
974 | |||
975 | dev_dbg(&op->dev, "mpc52xx-psc uart at %lx, irq=%x, freq=%i\n", | ||
976 | port->mapbase, port->irq, port->uartclk); | ||
977 | |||
978 | if ((port->irq==NO_IRQ) || !port->mapbase) { | ||
979 | printk(KERN_ERR "Could not allocate resources for PSC\n"); | ||
980 | return -EINVAL; | ||
981 | } | ||
982 | |||
983 | /* Add the port to the uart sub-system */ | ||
984 | ret = uart_add_one_port(&mpc52xx_uart_driver, port); | ||
985 | if (!ret) | ||
986 | dev_set_drvdata(&op->dev, (void*)port); | ||
987 | |||
988 | return ret; | ||
989 | } | ||
990 | |||
991 | static int | ||
992 | mpc52xx_uart_of_remove(struct of_device *op) | ||
993 | { | ||
994 | struct uart_port *port = dev_get_drvdata(&op->dev); | ||
995 | dev_set_drvdata(&op->dev, NULL); | ||
996 | |||
997 | if (port) | ||
998 | uart_remove_one_port(&mpc52xx_uart_driver, port); | ||
999 | |||
1000 | return 0; | ||
1001 | } | ||
1002 | |||
1003 | #ifdef CONFIG_PM | ||
1004 | static int | ||
1005 | mpc52xx_uart_of_suspend(struct of_device *op, pm_message_t state) | ||
1006 | { | ||
1007 | struct uart_port *port = (struct uart_port *) dev_get_drvdata(&op->dev); | ||
1008 | |||
1009 | if (port) | ||
1010 | uart_suspend_port(&mpc52xx_uart_driver, port); | ||
1011 | |||
1012 | return 0; | ||
1013 | } | ||
1014 | |||
1015 | static int | ||
1016 | mpc52xx_uart_of_resume(struct of_device *op) | ||
1017 | { | ||
1018 | struct uart_port *port = (struct uart_port *) dev_get_drvdata(&op->dev); | ||
1019 | |||
1020 | if (port) | ||
1021 | uart_resume_port(&mpc52xx_uart_driver, port); | ||
1022 | |||
1023 | return 0; | ||
1024 | } | ||
1025 | #endif | ||
1026 | |||
1027 | static void | ||
1028 | mpc52xx_uart_of_assign(struct device_node *np, int idx) | ||
1029 | { | ||
1030 | int free_idx = -1; | ||
1031 | int i; | ||
1032 | |||
1033 | /* Find the first free node */ | ||
1034 | for (i = 0; i < MPC52xx_PSC_MAXNUM; i++) { | ||
1035 | if (mpc52xx_uart_nodes[i] == NULL) { | ||
1036 | free_idx = i; | ||
1037 | break; | ||
1038 | } | ||
1039 | } | ||
1040 | |||
1041 | if ((idx < 0) || (idx >= MPC52xx_PSC_MAXNUM)) | ||
1042 | idx = free_idx; | ||
1043 | |||
1044 | if (idx < 0) | ||
1045 | return; /* No free slot; abort */ | ||
1046 | |||
1047 | /* If the slot is already occupied, then swap slots */ | ||
1048 | if (mpc52xx_uart_nodes[idx] && (free_idx != -1)) | ||
1049 | mpc52xx_uart_nodes[free_idx] = mpc52xx_uart_nodes[idx]; | ||
1050 | mpc52xx_uart_nodes[i] = np; | ||
1051 | } | ||
1052 | |||
1053 | static void | ||
1054 | mpc52xx_uart_of_enumerate(void) | ||
1055 | { | ||
1056 | static int enum_done = 0; | ||
1057 | struct device_node *np; | ||
1058 | const unsigned int *devno; | ||
1059 | int i; | ||
1060 | |||
1061 | if (enum_done) | ||
1062 | return; | ||
1063 | |||
1064 | for_each_node_by_type(np, "serial") { | ||
1065 | if (!of_match_node(mpc52xx_uart_of_match, np)) | ||
1066 | continue; | ||
1067 | |||
1068 | /* Is a particular device number requested? */ | ||
1069 | devno = get_property(np, "device_no", NULL); | ||
1070 | mpc52xx_uart_of_assign(of_node_get(np), devno ? *devno : -1); | ||
1071 | } | ||
1072 | |||
1073 | enum_done = 1; | ||
1074 | |||
1075 | for (i = 0; i < MPC52xx_PSC_MAXNUM; i++) { | ||
1076 | if (mpc52xx_uart_nodes[i]) | ||
1077 | pr_debug("%s assigned to ttyPSC%x\n", | ||
1078 | mpc52xx_uart_nodes[i]->full_name, i); | ||
1079 | } | ||
1080 | } | ||
1081 | |||
1082 | MODULE_DEVICE_TABLE(of, mpc52xx_uart_of_match); | ||
1083 | |||
1084 | static struct of_platform_driver mpc52xx_uart_of_driver = { | ||
1085 | .owner = THIS_MODULE, | ||
1086 | .name = "mpc52xx-psc-uart", | ||
1087 | .match_table = mpc52xx_uart_of_match, | ||
1088 | .probe = mpc52xx_uart_of_probe, | ||
1089 | .remove = mpc52xx_uart_of_remove, | ||
1090 | #ifdef CONFIG_PM | ||
1091 | .suspend = mpc52xx_uart_of_suspend, | ||
1092 | .resume = mpc52xx_uart_of_resume, | ||
1093 | #endif | ||
1094 | .driver = { | ||
1095 | .name = "mpc52xx-psc-uart", | ||
1096 | }, | ||
1097 | }; | ||
1098 | #endif /* defined(CONFIG_PPC_MERGE) */ | ||
803 | 1099 | ||
804 | 1100 | ||
805 | /* ======================================================================== */ | 1101 | /* ======================================================================== */ |
@@ -811,22 +1107,45 @@ mpc52xx_uart_init(void) | |||
811 | { | 1107 | { |
812 | int ret; | 1108 | int ret; |
813 | 1109 | ||
814 | printk(KERN_INFO "Serial: MPC52xx PSC driver\n"); | 1110 | printk(KERN_INFO "Serial: MPC52xx PSC UART driver\n"); |
815 | 1111 | ||
816 | ret = uart_register_driver(&mpc52xx_uart_driver); | 1112 | if ((ret = uart_register_driver(&mpc52xx_uart_driver)) != 0) { |
817 | if (ret == 0) { | 1113 | printk(KERN_ERR "%s: uart_register_driver failed (%i)\n", |
818 | ret = platform_driver_register(&mpc52xx_uart_platform_driver); | 1114 | __FILE__, ret); |
819 | if (ret) | 1115 | return ret; |
820 | uart_unregister_driver(&mpc52xx_uart_driver); | ||
821 | } | 1116 | } |
822 | 1117 | ||
823 | return ret; | 1118 | #if defined(CONFIG_PPC_MERGE) |
1119 | mpc52xx_uart_of_enumerate(); | ||
1120 | |||
1121 | ret = of_register_platform_driver(&mpc52xx_uart_of_driver); | ||
1122 | if (ret) { | ||
1123 | printk(KERN_ERR "%s: of_register_platform_driver failed (%i)\n", | ||
1124 | __FILE__, ret); | ||
1125 | uart_unregister_driver(&mpc52xx_uart_driver); | ||
1126 | return ret; | ||
1127 | } | ||
1128 | #else | ||
1129 | ret = platform_driver_register(&mpc52xx_uart_platform_driver); | ||
1130 | if (ret) { | ||
1131 | printk(KERN_ERR "%s: platform_driver_register failed (%i)\n", | ||
1132 | __FILE__, ret); | ||
1133 | uart_unregister_driver(&mpc52xx_uart_driver); | ||
1134 | return ret; | ||
1135 | } | ||
1136 | #endif | ||
1137 | |||
1138 | return 0; | ||
824 | } | 1139 | } |
825 | 1140 | ||
826 | static void __exit | 1141 | static void __exit |
827 | mpc52xx_uart_exit(void) | 1142 | mpc52xx_uart_exit(void) |
828 | { | 1143 | { |
1144 | #if defined(CONFIG_PPC_MERGE) | ||
1145 | of_unregister_platform_driver(&mpc52xx_uart_of_driver); | ||
1146 | #else | ||
829 | platform_driver_unregister(&mpc52xx_uart_platform_driver); | 1147 | platform_driver_unregister(&mpc52xx_uart_platform_driver); |
1148 | #endif | ||
830 | uart_unregister_driver(&mpc52xx_uart_driver); | 1149 | uart_unregister_driver(&mpc52xx_uart_driver); |
831 | } | 1150 | } |
832 | 1151 | ||
diff --git a/drivers/serial/serial_cs.c b/drivers/serial/serial_cs.c index 00f9ffd69489..431433f4dd6d 100644 --- a/drivers/serial/serial_cs.c +++ b/drivers/serial/serial_cs.c | |||
@@ -723,7 +723,7 @@ static int serial_config(struct pcmcia_device * link) | |||
723 | u_char *buf; | 723 | u_char *buf; |
724 | cisparse_t *parse; | 724 | cisparse_t *parse; |
725 | cistpl_cftable_entry_t *cf; | 725 | cistpl_cftable_entry_t *cf; |
726 | int i, last_ret, last_fn; | 726 | int i; |
727 | 727 | ||
728 | DEBUG(0, "serial_config(0x%p)\n", link); | 728 | DEBUG(0, "serial_config(0x%p)\n", link); |
729 | 729 | ||
@@ -740,15 +740,6 @@ static int serial_config(struct pcmcia_device * link) | |||
740 | tuple->TupleOffset = 0; | 740 | tuple->TupleOffset = 0; |
741 | tuple->TupleDataMax = 255; | 741 | tuple->TupleDataMax = 255; |
742 | tuple->Attributes = 0; | 742 | tuple->Attributes = 0; |
743 | /* Get configuration register information */ | ||
744 | tuple->DesiredTuple = CISTPL_CONFIG; | ||
745 | last_ret = first_tuple(link, tuple, parse); | ||
746 | if (last_ret != CS_SUCCESS) { | ||
747 | last_fn = ParseTuple; | ||
748 | goto cs_failed; | ||
749 | } | ||
750 | link->conf.ConfigBase = parse->config.base; | ||
751 | link->conf.Present = parse->config.rmask[0]; | ||
752 | 743 | ||
753 | /* Is this a compliant multifunction card? */ | 744 | /* Is this a compliant multifunction card? */ |
754 | tuple->DesiredTuple = CISTPL_LONGLINK_MFC; | 745 | tuple->DesiredTuple = CISTPL_LONGLINK_MFC; |
@@ -757,27 +748,25 @@ static int serial_config(struct pcmcia_device * link) | |||
757 | 748 | ||
758 | /* Is this a multiport card? */ | 749 | /* Is this a multiport card? */ |
759 | tuple->DesiredTuple = CISTPL_MANFID; | 750 | tuple->DesiredTuple = CISTPL_MANFID; |
760 | if (first_tuple(link, tuple, parse) == CS_SUCCESS) { | 751 | info->manfid = link->manf_id; |
761 | info->manfid = parse->manfid.manf; | 752 | info->prodid = link->card_id; |
762 | info->prodid = parse->manfid.card; | 753 | |
763 | 754 | for (i = 0; i < ARRAY_SIZE(quirks); i++) | |
764 | for (i = 0; i < ARRAY_SIZE(quirks); i++) | 755 | if ((quirks[i].manfid == ~0 || |
765 | if ((quirks[i].manfid == ~0 || | 756 | quirks[i].manfid == info->manfid) && |
766 | quirks[i].manfid == info->manfid) && | 757 | (quirks[i].prodid == ~0 || |
767 | (quirks[i].prodid == ~0 || | 758 | quirks[i].prodid == info->prodid)) { |
768 | quirks[i].prodid == info->prodid)) { | 759 | info->quirk = &quirks[i]; |
769 | info->quirk = &quirks[i]; | 760 | break; |
770 | break; | 761 | } |
771 | } | ||
772 | } | ||
773 | 762 | ||
774 | /* Another check for dual-serial cards: look for either serial or | 763 | /* Another check for dual-serial cards: look for either serial or |
775 | multifunction cards that ask for appropriate IO port ranges */ | 764 | multifunction cards that ask for appropriate IO port ranges */ |
776 | tuple->DesiredTuple = CISTPL_FUNCID; | 765 | tuple->DesiredTuple = CISTPL_FUNCID; |
777 | if ((info->multi == 0) && | 766 | if ((info->multi == 0) && |
778 | ((first_tuple(link, tuple, parse) != CS_SUCCESS) || | 767 | (link->has_func_id) && |
779 | (parse->funcid.func == CISTPL_FUNCID_MULTI) || | 768 | ((link->func_id == CISTPL_FUNCID_MULTI) || |
780 | (parse->funcid.func == CISTPL_FUNCID_SERIAL))) { | 769 | (link->func_id == CISTPL_FUNCID_SERIAL))) { |
781 | tuple->DesiredTuple = CISTPL_CFTABLE_ENTRY; | 770 | tuple->DesiredTuple = CISTPL_CFTABLE_ENTRY; |
782 | if (first_tuple(link, tuple, parse) == CS_SUCCESS) { | 771 | if (first_tuple(link, tuple, parse) == CS_SUCCESS) { |
783 | if ((cf->io.nwin == 1) && (cf->io.win[0].len % 8 == 0)) | 772 | if ((cf->io.nwin == 1) && (cf->io.win[0].len % 8 == 0)) |
@@ -814,8 +803,6 @@ static int serial_config(struct pcmcia_device * link) | |||
814 | kfree(cfg_mem); | 803 | kfree(cfg_mem); |
815 | return 0; | 804 | return 0; |
816 | 805 | ||
817 | cs_failed: | ||
818 | cs_error(link, last_fn, last_ret); | ||
819 | failed: | 806 | failed: |
820 | serial_remove(link); | 807 | serial_remove(link); |
821 | kfree(cfg_mem); | 808 | kfree(cfg_mem); |
@@ -925,6 +912,30 @@ static struct pcmcia_device_id serial_ids[] = { | |||
925 | PCMCIA_DEVICE_CIS_PROD_ID123("ADVANTECH", "COMpad-32/85", "1.0", 0x96913a85, 0x8fbe92ae, 0x0877b627, "COMpad2.cis"), | 912 | PCMCIA_DEVICE_CIS_PROD_ID123("ADVANTECH", "COMpad-32/85", "1.0", 0x96913a85, 0x8fbe92ae, 0x0877b627, "COMpad2.cis"), |
926 | PCMCIA_DEVICE_CIS_PROD_ID2("RS-COM 2P", 0xad20b156, "RS-COM-2P.cis"), | 913 | PCMCIA_DEVICE_CIS_PROD_ID2("RS-COM 2P", 0xad20b156, "RS-COM-2P.cis"), |
927 | PCMCIA_DEVICE_CIS_MANF_CARD(0x0013, 0x0000, "GLOBETROTTER.cis"), | 914 | PCMCIA_DEVICE_CIS_MANF_CARD(0x0013, 0x0000, "GLOBETROTTER.cis"), |
915 | PCMCIA_DEVICE_PROD_ID12("ELAN DIGITAL SYSTEMS LTD, c1997.","SERIAL CARD: SL100 1.00.",0x19ca78af,0xf964f42b), | ||
916 | PCMCIA_DEVICE_PROD_ID12("ELAN DIGITAL SYSTEMS LTD, c1997.","SERIAL CARD: SL100",0x19ca78af,0x71d98e83), | ||
917 | PCMCIA_DEVICE_PROD_ID12("ELAN DIGITAL SYSTEMS LTD, c1997.","SERIAL CARD: SL232 1.00.",0x19ca78af,0x69fb7490), | ||
918 | PCMCIA_DEVICE_PROD_ID12("ELAN DIGITAL SYSTEMS LTD, c1997.","SERIAL CARD: SL232",0x19ca78af,0xb6bc0235), | ||
919 | PCMCIA_DEVICE_PROD_ID12("ELAN DIGITAL SYSTEMS LTD, c2000.","SERIAL CARD: CF232",0x63f2e0bd,0xb9e175d3), | ||
920 | PCMCIA_DEVICE_PROD_ID12("ELAN DIGITAL SYSTEMS LTD, c2000.","SERIAL CARD: CF232-5",0x63f2e0bd,0xfce33442), | ||
921 | PCMCIA_DEVICE_PROD_ID12("Elan","Serial Port: CF232",0x3beb8cf2,0x171e7190), | ||
922 | PCMCIA_DEVICE_PROD_ID12("Elan","Serial Port: CF232-5",0x3beb8cf2,0x20da4262), | ||
923 | PCMCIA_DEVICE_PROD_ID12("Elan","Serial Port: CF428",0x3beb8cf2,0xea5dd57d), | ||
924 | PCMCIA_DEVICE_PROD_ID12("Elan","Serial Port: CF500",0x3beb8cf2,0xd77255fa), | ||
925 | PCMCIA_DEVICE_PROD_ID12("Elan","Serial Port: IC232",0x3beb8cf2,0x6a709903), | ||
926 | PCMCIA_DEVICE_PROD_ID12("Elan","Serial Port: SL232",0x3beb8cf2,0x18430676), | ||
927 | PCMCIA_DEVICE_PROD_ID12("Elan","Serial Port: XL232",0x3beb8cf2,0x6f933767), | ||
928 | PCMCIA_MFC_DEVICE_PROD_ID12(0,"Elan","Serial Port: CF332",0x3beb8cf2,0x16dc1ba7), | ||
929 | PCMCIA_MFC_DEVICE_PROD_ID12(0,"Elan","Serial Port: SL332",0x3beb8cf2,0x19816c41), | ||
930 | PCMCIA_MFC_DEVICE_PROD_ID12(0,"Elan","Serial Port: SL385",0x3beb8cf2,0x64112029), | ||
931 | PCMCIA_MFC_DEVICE_PROD_ID12(0,"Elan","Serial Port: SL432",0x3beb8cf2,0x1cce7ac4), | ||
932 | PCMCIA_MFC_DEVICE_PROD_ID12(0,"Elan","Serial+Parallel Port: SP230",0x3beb8cf2,0xdb9e58bc), | ||
933 | PCMCIA_MFC_DEVICE_PROD_ID12(1,"Elan","Serial Port: CF332",0x3beb8cf2,0x16dc1ba7), | ||
934 | PCMCIA_MFC_DEVICE_PROD_ID12(1,"Elan","Serial Port: SL332",0x3beb8cf2,0x19816c41), | ||
935 | PCMCIA_MFC_DEVICE_PROD_ID12(1,"Elan","Serial Port: SL385",0x3beb8cf2,0x64112029), | ||
936 | PCMCIA_MFC_DEVICE_PROD_ID12(1,"Elan","Serial Port: SL432",0x3beb8cf2,0x1cce7ac4), | ||
937 | PCMCIA_MFC_DEVICE_PROD_ID12(2,"Elan","Serial Port: SL432",0x3beb8cf2,0x1cce7ac4), | ||
938 | PCMCIA_MFC_DEVICE_PROD_ID12(3,"Elan","Serial Port: SL432",0x3beb8cf2,0x1cce7ac4), | ||
928 | /* too generic */ | 939 | /* too generic */ |
929 | /* PCMCIA_MFC_DEVICE_MANF_CARD(0, 0x0160, 0x0002), */ | 940 | /* PCMCIA_MFC_DEVICE_MANF_CARD(0, 0x0160, 0x0002), */ |
930 | /* PCMCIA_MFC_DEVICE_MANF_CARD(1, 0x0160, 0x0002), */ | 941 | /* PCMCIA_MFC_DEVICE_MANF_CARD(1, 0x0160, 0x0002), */ |
diff --git a/drivers/serial/sh-sci.c b/drivers/serial/sh-sci.c index cfcc3caf49d8..3b5f19ec2126 100644 --- a/drivers/serial/sh-sci.c +++ b/drivers/serial/sh-sci.c | |||
@@ -775,7 +775,7 @@ static int sci_notifier(struct notifier_block *self, | |||
775 | * | 775 | * |
776 | * Clean this up later.. | 776 | * Clean this up later.. |
777 | */ | 777 | */ |
778 | clk = clk_get("module_clk"); | 778 | clk = clk_get(NULL, "module_clk"); |
779 | port->uartclk = clk_get_rate(clk) * 16; | 779 | port->uartclk = clk_get_rate(clk) * 16; |
780 | clk_put(clk); | 780 | clk_put(clk); |
781 | } | 781 | } |
@@ -960,7 +960,7 @@ static void sci_set_termios(struct uart_port *port, struct termios *termios, | |||
960 | default: | 960 | default: |
961 | { | 961 | { |
962 | #if defined(CONFIG_SUPERH) && !defined(CONFIG_SUPERH64) | 962 | #if defined(CONFIG_SUPERH) && !defined(CONFIG_SUPERH64) |
963 | struct clk *clk = clk_get("module_clk"); | 963 | struct clk *clk = clk_get(NULL, "module_clk"); |
964 | t = SCBRR_VALUE(baud, clk_get_rate(clk)); | 964 | t = SCBRR_VALUE(baud, clk_get_rate(clk)); |
965 | clk_put(clk); | 965 | clk_put(clk); |
966 | #else | 966 | #else |
@@ -1128,7 +1128,7 @@ static void __init sci_init_ports(void) | |||
1128 | * XXX: We should use a proper SCI/SCIF clock | 1128 | * XXX: We should use a proper SCI/SCIF clock |
1129 | */ | 1129 | */ |
1130 | { | 1130 | { |
1131 | struct clk *clk = clk_get("module_clk"); | 1131 | struct clk *clk = clk_get(NULL, "module_clk"); |
1132 | sci_ports[i].port.uartclk = clk_get_rate(clk) * 16; | 1132 | sci_ports[i].port.uartclk = clk_get_rate(clk) * 16; |
1133 | clk_put(clk); | 1133 | clk_put(clk); |
1134 | } | 1134 | } |
diff --git a/drivers/serial/sh-sci.h b/drivers/serial/sh-sci.h index 7ee992146ae9..e4557cc4f74b 100644 --- a/drivers/serial/sh-sci.h +++ b/drivers/serial/sh-sci.h | |||
@@ -133,6 +133,20 @@ | |||
133 | # define SCIF_ORER 0x0001 /* Overrun error bit */ | 133 | # define SCIF_ORER 0x0001 /* Overrun error bit */ |
134 | # define SCSCR_INIT(port) 0x3a /* TIE=0,RIE=0,TE=1,RE=1,REIE=1 */ | 134 | # define SCSCR_INIT(port) 0x3a /* TIE=0,RIE=0,TE=1,RE=1,REIE=1 */ |
135 | # define SCIF_ONLY | 135 | # define SCIF_ONLY |
136 | #elif defined(CONFIG_CPU_SUBTYPE_SH7206) | ||
137 | # define SCSPTR0 0xfffe8020 /* 16 bit SCIF */ | ||
138 | # define SCSPTR1 0xfffe8820 /* 16 bit SCIF */ | ||
139 | # define SCSPTR2 0xfffe9020 /* 16 bit SCIF */ | ||
140 | # define SCSPTR3 0xfffe9820 /* 16 bit SCIF */ | ||
141 | # define SCSCR_INIT(port) 0x38 /* TIE=0,RIE=0,TE=1,RE=1,REIE=1 */ | ||
142 | # define SCIF_ONLY | ||
143 | #elif defined(CONFIG_CPU_SUBTYPE_SH7619) | ||
144 | # define SCSPTR0 0xf8400020 /* 16 bit SCIF */ | ||
145 | # define SCSPTR1 0xf8410020 /* 16 bit SCIF */ | ||
146 | # define SCSPTR2 0xf8420020 /* 16 bit SCIF */ | ||
147 | # define SCIF_ORER 0x0001 /* overrun error bit */ | ||
148 | # define SCSCR_INIT(port) 0x38 /* TIE=0,RIE=0,TE=1,RE=1,REIE=1 */ | ||
149 | # define SCIF_ONLY | ||
136 | #else | 150 | #else |
137 | # error CPU subtype not defined | 151 | # error CPU subtype not defined |
138 | #endif | 152 | #endif |
@@ -365,6 +379,7 @@ SCIx_FNS(SCxSR, 0x08, 8, 0x10, 8, 0x08, 16, 0x10, 16, 0x04, 8) | |||
365 | SCIx_FNS(SCxRDR, 0x0a, 8, 0x14, 8, 0x0A, 8, 0x14, 8, 0x05, 8) | 379 | SCIx_FNS(SCxRDR, 0x0a, 8, 0x14, 8, 0x0A, 8, 0x14, 8, 0x05, 8) |
366 | SCIF_FNS(SCFCR, 0x0c, 8, 0x18, 16) | 380 | SCIF_FNS(SCFCR, 0x0c, 8, 0x18, 16) |
367 | #if defined(CONFIG_CPU_SUBTYPE_SH7760) || defined(CONFIG_CPU_SUBTYPE_SH7780) | 381 | #if defined(CONFIG_CPU_SUBTYPE_SH7760) || defined(CONFIG_CPU_SUBTYPE_SH7780) |
382 | SCIF_FNS(SCFDR, 0x0e, 16, 0x1C, 16) | ||
368 | SCIF_FNS(SCTFDR, 0x0e, 16, 0x1C, 16) | 383 | SCIF_FNS(SCTFDR, 0x0e, 16, 0x1C, 16) |
369 | SCIF_FNS(SCRFDR, 0x0e, 16, 0x20, 16) | 384 | SCIF_FNS(SCRFDR, 0x0e, 16, 0x20, 16) |
370 | SCIF_FNS(SCSPTR, 0, 0, 0x24, 16) | 385 | SCIF_FNS(SCSPTR, 0, 0, 0x24, 16) |
@@ -544,6 +559,28 @@ static inline int sci_rxd_in(struct uart_port *port) | |||
544 | if (port->mapbase == 0xffe10000) | 559 | if (port->mapbase == 0xffe10000) |
545 | return ctrl_inw(SCSPTR1) & 0x0001 ? 1 : 0; /* SCIF */ | 560 | return ctrl_inw(SCSPTR1) & 0x0001 ? 1 : 0; /* SCIF */ |
546 | } | 561 | } |
562 | #elif defined(CONFIG_CPU_SUBTYPE_SH7206) | ||
563 | static inline int sci_rxd_in(struct uart_port *port) | ||
564 | { | ||
565 | if (port->mapbase == 0xfffe8000) | ||
566 | return ctrl_inw(SCSPTR0) & 0x0001 ? 1 : 0; /* SCIF */ | ||
567 | if (port->mapbase == 0xfffe8800) | ||
568 | return ctrl_inw(SCSPTR1) & 0x0001 ? 1 : 0; /* SCIF */ | ||
569 | if (port->mapbase == 0xfffe9000) | ||
570 | return ctrl_inw(SCSPTR2) & 0x0001 ? 1 : 0; /* SCIF */ | ||
571 | if (port->mapbase == 0xfffe9800) | ||
572 | return ctrl_inw(SCSPTR3) & 0x0001 ? 1 : 0; /* SCIF */ | ||
573 | } | ||
574 | #elif defined(CONFIG_CPU_SUBTYPE_SH7619) | ||
575 | static inline int sci_rxd_in(struct uart_port *port) | ||
576 | { | ||
577 | if (port->mapbase == 0xf8400000) | ||
578 | return ctrl_inw(SCSPTR0) & 0x0001 ? 1 : 0; /* SCIF */ | ||
579 | if (port->mapbase == 0xf8410000) | ||
580 | return ctrl_inw(SCSPTR1) & 0x0001 ? 1 : 0; /* SCIF */ | ||
581 | if (port->mapbase == 0xf8420000) | ||
582 | return ctrl_inw(SCSPTR2) & 0x0001 ? 1 : 0; /* SCIF */ | ||
583 | } | ||
547 | #endif | 584 | #endif |
548 | 585 | ||
549 | /* | 586 | /* |