diff options
Diffstat (limited to 'drivers/serial')
| -rw-r--r-- | drivers/serial/8250.c | 23 | ||||
| -rw-r--r-- | drivers/serial/8250_gsc.c | 2 | ||||
| -rw-r--r-- | drivers/serial/Kconfig | 36 | ||||
| -rw-r--r-- | drivers/serial/cpm_uart/cpm_uart_core.c | 3 | ||||
| -rw-r--r-- | drivers/serial/cpm_uart/cpm_uart_cpm1.c | 6 | ||||
| -rw-r--r-- | drivers/serial/cpm_uart/cpm_uart_cpm2.c | 6 | ||||
| -rw-r--r-- | drivers/serial/mpc52xx_uart.c | 181 | ||||
| -rw-r--r-- | drivers/serial/s3c2400.c | 2 | ||||
| -rw-r--r-- | drivers/serial/s3c2410.c | 2 | ||||
| -rw-r--r-- | drivers/serial/s3c2412.c | 2 | ||||
| -rw-r--r-- | drivers/serial/s3c2440.c | 2 | ||||
| -rw-r--r-- | drivers/serial/samsung.c | 2 | ||||
| -rw-r--r-- | drivers/serial/serial_txx9.c | 2 | ||||
| -rw-r--r-- | drivers/serial/sh-sci.c | 90 | ||||
| -rw-r--r-- | drivers/serial/sh-sci.h | 23 | ||||
| -rw-r--r-- | drivers/serial/sn_console.c | 2 | ||||
| -rw-r--r-- | drivers/serial/ucc_uart.c | 4 |
17 files changed, 97 insertions, 291 deletions
diff --git a/drivers/serial/8250.c b/drivers/serial/8250.c index 006617e2211d..303272af386e 100644 --- a/drivers/serial/8250.c +++ b/drivers/serial/8250.c | |||
| @@ -2269,9 +2269,9 @@ serial8250_set_termios(struct uart_port *port, struct ktermios *termios, | |||
| 2269 | serial_outp(up, UART_EFR, efr); | 2269 | serial_outp(up, UART_EFR, efr); |
| 2270 | } | 2270 | } |
| 2271 | 2271 | ||
| 2272 | #ifdef CONFIG_ARCH_OMAP15XX | 2272 | #ifdef CONFIG_ARCH_OMAP |
| 2273 | /* Workaround to enable 115200 baud on OMAP1510 internal ports */ | 2273 | /* Workaround to enable 115200 baud on OMAP1510 internal ports */ |
| 2274 | if (cpu_is_omap1510() && is_omap_port((unsigned int)up->port.membase)) { | 2274 | if (cpu_is_omap1510() && is_omap_port(up)) { |
| 2275 | if (baud == 115200) { | 2275 | if (baud == 115200) { |
| 2276 | quot = 1; | 2276 | quot = 1; |
| 2277 | serial_out(up, UART_OMAP_OSC_12M_SEL, 1); | 2277 | serial_out(up, UART_OMAP_OSC_12M_SEL, 1); |
| @@ -2324,18 +2324,27 @@ serial8250_pm(struct uart_port *port, unsigned int state, | |||
| 2324 | p->pm(port, state, oldstate); | 2324 | p->pm(port, state, oldstate); |
| 2325 | } | 2325 | } |
| 2326 | 2326 | ||
| 2327 | static unsigned int serial8250_port_size(struct uart_8250_port *pt) | ||
| 2328 | { | ||
| 2329 | if (pt->port.iotype == UPIO_AU) | ||
| 2330 | return 0x100000; | ||
| 2331 | #ifdef CONFIG_ARCH_OMAP | ||
| 2332 | if (is_omap_port(pt)) | ||
| 2333 | return 0x16 << pt->port.regshift; | ||
| 2334 | #endif | ||
| 2335 | return 8 << pt->port.regshift; | ||
| 2336 | } | ||
| 2337 | |||
| 2327 | /* | 2338 | /* |
| 2328 | * Resource handling. | 2339 | * Resource handling. |
| 2329 | */ | 2340 | */ |
| 2330 | static int serial8250_request_std_resource(struct uart_8250_port *up) | 2341 | static int serial8250_request_std_resource(struct uart_8250_port *up) |
| 2331 | { | 2342 | { |
| 2332 | unsigned int size = 8 << up->port.regshift; | 2343 | unsigned int size = serial8250_port_size(up); |
| 2333 | int ret = 0; | 2344 | int ret = 0; |
| 2334 | 2345 | ||
| 2335 | switch (up->port.iotype) { | 2346 | switch (up->port.iotype) { |
| 2336 | case UPIO_AU: | 2347 | case UPIO_AU: |
| 2337 | size = 0x100000; | ||
| 2338 | /* fall thru */ | ||
| 2339 | case UPIO_TSI: | 2348 | case UPIO_TSI: |
| 2340 | case UPIO_MEM32: | 2349 | case UPIO_MEM32: |
| 2341 | case UPIO_MEM: | 2350 | case UPIO_MEM: |
| @@ -2369,12 +2378,10 @@ static int serial8250_request_std_resource(struct uart_8250_port *up) | |||
| 2369 | 2378 | ||
| 2370 | static void serial8250_release_std_resource(struct uart_8250_port *up) | 2379 | static void serial8250_release_std_resource(struct uart_8250_port *up) |
| 2371 | { | 2380 | { |
| 2372 | unsigned int size = 8 << up->port.regshift; | 2381 | unsigned int size = serial8250_port_size(up); |
| 2373 | 2382 | ||
| 2374 | switch (up->port.iotype) { | 2383 | switch (up->port.iotype) { |
| 2375 | case UPIO_AU: | 2384 | case UPIO_AU: |
| 2376 | size = 0x100000; | ||
| 2377 | /* fall thru */ | ||
| 2378 | case UPIO_TSI: | 2385 | case UPIO_TSI: |
| 2379 | case UPIO_MEM32: | 2386 | case UPIO_MEM32: |
| 2380 | case UPIO_MEM: | 2387 | case UPIO_MEM: |
diff --git a/drivers/serial/8250_gsc.c b/drivers/serial/8250_gsc.c index 0416ad3bc127..418b4fe9a0a1 100644 --- a/drivers/serial/8250_gsc.c +++ b/drivers/serial/8250_gsc.c | |||
| @@ -111,7 +111,7 @@ static struct parisc_driver serial_driver = { | |||
| 111 | .probe = serial_init_chip, | 111 | .probe = serial_init_chip, |
| 112 | }; | 112 | }; |
| 113 | 113 | ||
| 114 | int __init probe_serial_gsc(void) | 114 | static int __init probe_serial_gsc(void) |
| 115 | { | 115 | { |
| 116 | register_parisc_driver(&lasi_driver); | 116 | register_parisc_driver(&lasi_driver); |
| 117 | register_parisc_driver(&serial_driver); | 117 | register_parisc_driver(&serial_driver); |
diff --git a/drivers/serial/Kconfig b/drivers/serial/Kconfig index 31786b3b0a68..db783b77a881 100644 --- a/drivers/serial/Kconfig +++ b/drivers/serial/Kconfig | |||
| @@ -1123,42 +1123,6 @@ config SERIAL_CPM_CONSOLE | |||
| 1123 | your boot loader (lilo or loadlin) about how to pass options to the | 1123 | your boot loader (lilo or loadlin) about how to pass options to the |
| 1124 | kernel at boot time.) | 1124 | kernel at boot time.) |
| 1125 | 1125 | ||
| 1126 | config SERIAL_CPM_SCC1 | ||
| 1127 | bool "Support for SCC1 serial port" | ||
| 1128 | depends on SERIAL_CPM=y | ||
| 1129 | help | ||
| 1130 | Select this option to use SCC1 as a serial port | ||
| 1131 | |||
| 1132 | config SERIAL_CPM_SCC2 | ||
| 1133 | bool "Support for SCC2 serial port" | ||
| 1134 | depends on SERIAL_CPM=y | ||
| 1135 | help | ||
| 1136 | Select this option to use SCC2 as a serial port | ||
| 1137 | |||
| 1138 | config SERIAL_CPM_SCC3 | ||
| 1139 | bool "Support for SCC3 serial port" | ||
| 1140 | depends on SERIAL_CPM=y | ||
| 1141 | help | ||
| 1142 | Select this option to use SCC3 as a serial port | ||
| 1143 | |||
| 1144 | config SERIAL_CPM_SCC4 | ||
| 1145 | bool "Support for SCC4 serial port" | ||
| 1146 | depends on SERIAL_CPM=y | ||
| 1147 | help | ||
| 1148 | Select this option to use SCC4 as a serial port | ||
| 1149 | |||
| 1150 | config SERIAL_CPM_SMC1 | ||
| 1151 | bool "Support for SMC1 serial port" | ||
| 1152 | depends on SERIAL_CPM=y | ||
| 1153 | help | ||
| 1154 | Select this option to use SMC1 as a serial port | ||
| 1155 | |||
| 1156 | config SERIAL_CPM_SMC2 | ||
| 1157 | bool "Support for SMC2 serial port" | ||
| 1158 | depends on SERIAL_CPM=y | ||
| 1159 | help | ||
| 1160 | Select this option to use SMC2 as a serial port | ||
| 1161 | |||
| 1162 | config SERIAL_SGI_L1_CONSOLE | 1126 | config SERIAL_SGI_L1_CONSOLE |
| 1163 | bool "SGI Altix L1 serial console support" | 1127 | bool "SGI Altix L1 serial console support" |
| 1164 | depends on IA64_GENERIC || IA64_SGI_SN2 | 1128 | depends on IA64_GENERIC || IA64_SGI_SN2 |
diff --git a/drivers/serial/cpm_uart/cpm_uart_core.c b/drivers/serial/cpm_uart/cpm_uart_core.c index e54574c49a38..bde4b4b0b80f 100644 --- a/drivers/serial/cpm_uart/cpm_uart_core.c +++ b/drivers/serial/cpm_uart/cpm_uart_core.c | |||
| @@ -1333,6 +1333,9 @@ static int __devinit cpm_uart_probe(struct of_device *ofdev, | |||
| 1333 | if (ret) | 1333 | if (ret) |
| 1334 | return ret; | 1334 | return ret; |
| 1335 | 1335 | ||
| 1336 | /* initialize the device pointer for the port */ | ||
| 1337 | pinfo->port.dev = &ofdev->dev; | ||
| 1338 | |||
| 1336 | return uart_add_one_port(&cpm_reg, &pinfo->port); | 1339 | return uart_add_one_port(&cpm_reg, &pinfo->port); |
| 1337 | } | 1340 | } |
| 1338 | 1341 | ||
diff --git a/drivers/serial/cpm_uart/cpm_uart_cpm1.c b/drivers/serial/cpm_uart/cpm_uart_cpm1.c index 0f0aff06c596..1b94c56ec239 100644 --- a/drivers/serial/cpm_uart/cpm_uart_cpm1.c +++ b/drivers/serial/cpm_uart/cpm_uart_cpm1.c | |||
| @@ -100,7 +100,7 @@ int cpm_uart_allocbuf(struct uart_cpm_port *pinfo, unsigned int is_con) | |||
| 100 | mem_addr = (u8 *) cpm_dpram_addr(cpm_dpalloc(memsz, 8)); | 100 | mem_addr = (u8 *) cpm_dpram_addr(cpm_dpalloc(memsz, 8)); |
| 101 | dma_addr = (u32)cpm_dpram_phys(mem_addr); | 101 | dma_addr = (u32)cpm_dpram_phys(mem_addr); |
| 102 | } else | 102 | } else |
| 103 | mem_addr = dma_alloc_coherent(NULL, memsz, &dma_addr, | 103 | mem_addr = dma_alloc_coherent(pinfo->port.dev, memsz, &dma_addr, |
| 104 | GFP_KERNEL); | 104 | GFP_KERNEL); |
| 105 | 105 | ||
| 106 | if (mem_addr == NULL) { | 106 | if (mem_addr == NULL) { |
| @@ -127,8 +127,8 @@ int cpm_uart_allocbuf(struct uart_cpm_port *pinfo, unsigned int is_con) | |||
| 127 | 127 | ||
| 128 | void cpm_uart_freebuf(struct uart_cpm_port *pinfo) | 128 | void cpm_uart_freebuf(struct uart_cpm_port *pinfo) |
| 129 | { | 129 | { |
| 130 | dma_free_coherent(NULL, L1_CACHE_ALIGN(pinfo->rx_nrfifos * | 130 | dma_free_coherent(pinfo->port.dev, L1_CACHE_ALIGN(pinfo->rx_nrfifos * |
| 131 | pinfo->rx_fifosize) + | 131 | pinfo->rx_fifosize) + |
| 132 | L1_CACHE_ALIGN(pinfo->tx_nrfifos * | 132 | L1_CACHE_ALIGN(pinfo->tx_nrfifos * |
| 133 | pinfo->tx_fifosize), pinfo->mem_addr, | 133 | pinfo->tx_fifosize), pinfo->mem_addr, |
| 134 | pinfo->dma_addr); | 134 | pinfo->dma_addr); |
diff --git a/drivers/serial/cpm_uart/cpm_uart_cpm2.c b/drivers/serial/cpm_uart/cpm_uart_cpm2.c index b8db4d3eed36..141c0a3333ad 100644 --- a/drivers/serial/cpm_uart/cpm_uart_cpm2.c +++ b/drivers/serial/cpm_uart/cpm_uart_cpm2.c | |||
| @@ -136,7 +136,7 @@ int cpm_uart_allocbuf(struct uart_cpm_port *pinfo, unsigned int is_con) | |||
| 136 | dma_addr = virt_to_bus(mem_addr); | 136 | dma_addr = virt_to_bus(mem_addr); |
| 137 | } | 137 | } |
| 138 | else | 138 | else |
| 139 | mem_addr = dma_alloc_coherent(NULL, memsz, &dma_addr, | 139 | mem_addr = dma_alloc_coherent(pinfo->port.dev, memsz, &dma_addr, |
| 140 | GFP_KERNEL); | 140 | GFP_KERNEL); |
| 141 | 141 | ||
| 142 | if (mem_addr == NULL) { | 142 | if (mem_addr == NULL) { |
| @@ -163,8 +163,8 @@ int cpm_uart_allocbuf(struct uart_cpm_port *pinfo, unsigned int is_con) | |||
| 163 | 163 | ||
| 164 | void cpm_uart_freebuf(struct uart_cpm_port *pinfo) | 164 | void cpm_uart_freebuf(struct uart_cpm_port *pinfo) |
| 165 | { | 165 | { |
| 166 | dma_free_coherent(NULL, L1_CACHE_ALIGN(pinfo->rx_nrfifos * | 166 | dma_free_coherent(pinfo->port.dev, L1_CACHE_ALIGN(pinfo->rx_nrfifos * |
| 167 | pinfo->rx_fifosize) + | 167 | pinfo->rx_fifosize) + |
| 168 | L1_CACHE_ALIGN(pinfo->tx_nrfifos * | 168 | L1_CACHE_ALIGN(pinfo->tx_nrfifos * |
| 169 | pinfo->tx_fifosize), (void __force *)pinfo->mem_addr, | 169 | pinfo->tx_fifosize), (void __force *)pinfo->mem_addr, |
| 170 | pinfo->dma_addr); | 170 | pinfo->dma_addr); |
diff --git a/drivers/serial/mpc52xx_uart.c b/drivers/serial/mpc52xx_uart.c index 36126070d9af..6117d3db0b66 100644 --- a/drivers/serial/mpc52xx_uart.c +++ b/drivers/serial/mpc52xx_uart.c | |||
| @@ -72,13 +72,8 @@ | |||
| 72 | #include <linux/console.h> | 72 | #include <linux/console.h> |
| 73 | #include <linux/delay.h> | 73 | #include <linux/delay.h> |
| 74 | #include <linux/io.h> | 74 | #include <linux/io.h> |
| 75 | |||
| 76 | #if defined(CONFIG_PPC_MERGE) | ||
| 77 | #include <linux/of.h> | 75 | #include <linux/of.h> |
| 78 | #include <linux/of_platform.h> | 76 | #include <linux/of_platform.h> |
| 79 | #else | ||
| 80 | #include <linux/platform_device.h> | ||
| 81 | #endif | ||
| 82 | 77 | ||
| 83 | #include <asm/mpc52xx.h> | 78 | #include <asm/mpc52xx.h> |
| 84 | #include <asm/mpc512x.h> | 79 | #include <asm/mpc512x.h> |
| @@ -107,12 +102,11 @@ static struct uart_port mpc52xx_uart_ports[MPC52xx_PSC_MAXNUM]; | |||
| 107 | * it's cleared, then a memset(...,0,...) should be added to | 102 | * it's cleared, then a memset(...,0,...) should be added to |
| 108 | * the console_init | 103 | * the console_init |
| 109 | */ | 104 | */ |
| 110 | #if defined(CONFIG_PPC_MERGE) | 105 | |
| 111 | /* lookup table for matching device nodes to index numbers */ | 106 | /* lookup table for matching device nodes to index numbers */ |
| 112 | static struct device_node *mpc52xx_uart_nodes[MPC52xx_PSC_MAXNUM]; | 107 | static struct device_node *mpc52xx_uart_nodes[MPC52xx_PSC_MAXNUM]; |
| 113 | 108 | ||
| 114 | static void mpc52xx_uart_of_enumerate(void); | 109 | static void mpc52xx_uart_of_enumerate(void); |
| 115 | #endif | ||
| 116 | 110 | ||
| 117 | 111 | ||
| 118 | #define PSC(port) ((struct mpc52xx_psc __iomem *)((port)->membase)) | 112 | #define PSC(port) ((struct mpc52xx_psc __iomem *)((port)->membase)) |
| @@ -255,17 +249,12 @@ static void mpc52xx_psc_cw_restore_ints(struct uart_port *port) | |||
| 255 | /* Search for bus-frequency property in this node or a parent */ | 249 | /* Search for bus-frequency property in this node or a parent */ |
| 256 | static unsigned long mpc52xx_getuartclk(void *p) | 250 | static unsigned long mpc52xx_getuartclk(void *p) |
| 257 | { | 251 | { |
| 258 | #if defined(CONFIG_PPC_MERGE) | ||
| 259 | /* | 252 | /* |
| 260 | * 5200 UARTs have a / 32 prescaler | 253 | * 5200 UARTs have a / 32 prescaler |
| 261 | * but the generic serial code assumes 16 | 254 | * but the generic serial code assumes 16 |
| 262 | * so return ipb freq / 2 | 255 | * so return ipb freq / 2 |
| 263 | */ | 256 | */ |
| 264 | return mpc52xx_find_ipb_freq(p) / 2; | 257 | return mpc52xx_find_ipb_freq(p) / 2; |
| 265 | #else | ||
| 266 | pr_debug("unexpected call to mpc52xx_getuartclk with arch/ppc\n"); | ||
| 267 | return NULL; | ||
| 268 | #endif | ||
| 269 | } | 258 | } |
| 270 | 259 | ||
| 271 | static struct psc_ops mpc52xx_psc_ops = { | 260 | static struct psc_ops mpc52xx_psc_ops = { |
| @@ -886,10 +875,6 @@ mpc52xx_console_get_options(struct uart_port *port, | |||
| 886 | 875 | ||
| 887 | /* CT{U,L}R are write-only ! */ | 876 | /* CT{U,L}R are write-only ! */ |
| 888 | *baud = CONFIG_SERIAL_MPC52xx_CONSOLE_BAUD; | 877 | *baud = CONFIG_SERIAL_MPC52xx_CONSOLE_BAUD; |
| 889 | #if !defined(CONFIG_PPC_MERGE) | ||
| 890 | if (__res.bi_baudrate) | ||
| 891 | *baud = __res.bi_baudrate; | ||
| 892 | #endif | ||
| 893 | 878 | ||
| 894 | /* Parse them */ | 879 | /* Parse them */ |
| 895 | switch (mr1 & MPC52xx_PSC_MODE_BITS_MASK) { | 880 | switch (mr1 & MPC52xx_PSC_MODE_BITS_MASK) { |
| @@ -946,42 +931,6 @@ mpc52xx_console_write(struct console *co, const char *s, unsigned int count) | |||
| 946 | psc_ops->cw_restore_ints(port); | 931 | psc_ops->cw_restore_ints(port); |
| 947 | } | 932 | } |
| 948 | 933 | ||
| 949 | #if !defined(CONFIG_PPC_MERGE) | ||
| 950 | static int __init | ||
| 951 | mpc52xx_console_setup(struct console *co, char *options) | ||
| 952 | { | ||
| 953 | struct uart_port *port = &mpc52xx_uart_ports[co->index]; | ||
| 954 | |||
| 955 | int baud = CONFIG_SERIAL_MPC52xx_CONSOLE_BAUD; | ||
| 956 | int bits = 8; | ||
| 957 | int parity = 'n'; | ||
| 958 | int flow = 'n'; | ||
| 959 | |||
| 960 | if (co->index < 0 || co->index >= MPC52xx_PSC_MAXNUM) | ||
| 961 | return -EINVAL; | ||
| 962 | |||
| 963 | /* Basic port init. Needed since we use some uart_??? func before | ||
| 964 | * real init for early access */ | ||
| 965 | spin_lock_init(&port->lock); | ||
| 966 | port->uartclk = __res.bi_ipbfreq / 2; /* Look at CTLR doc */ | ||
| 967 | port->ops = &mpc52xx_uart_ops; | ||
| 968 | port->mapbase = MPC52xx_PA(MPC52xx_PSCx_OFFSET(co->index+1)); | ||
| 969 | |||
| 970 | /* We ioremap ourself */ | ||
| 971 | port->membase = ioremap(port->mapbase, MPC52xx_PSC_SIZE); | ||
| 972 | if (port->membase == NULL) | ||
| 973 | return -EINVAL; | ||
| 974 | |||
| 975 | /* Setup the port parameters accoding to options */ | ||
| 976 | if (options) | ||
| 977 | uart_parse_options(options, &baud, &parity, &bits, &flow); | ||
| 978 | else | ||
| 979 | mpc52xx_console_get_options(port, &baud, &parity, &bits, &flow); | ||
| 980 | |||
| 981 | return uart_set_options(port, co, baud, parity, bits, flow); | ||
| 982 | } | ||
| 983 | |||
| 984 | #else | ||
| 985 | 934 | ||
| 986 | static int __init | 935 | static int __init |
| 987 | mpc52xx_console_setup(struct console *co, char *options) | 936 | mpc52xx_console_setup(struct console *co, char *options) |
| @@ -1053,7 +1002,6 @@ mpc52xx_console_setup(struct console *co, char *options) | |||
| 1053 | 1002 | ||
| 1054 | return uart_set_options(port, co, baud, parity, bits, flow); | 1003 | return uart_set_options(port, co, baud, parity, bits, flow); |
| 1055 | } | 1004 | } |
| 1056 | #endif /* defined(CONFIG_PPC_MERGE) */ | ||
| 1057 | 1005 | ||
| 1058 | 1006 | ||
| 1059 | static struct uart_driver mpc52xx_uart_driver; | 1007 | static struct uart_driver mpc52xx_uart_driver; |
| @@ -1072,9 +1020,7 @@ static struct console mpc52xx_console = { | |||
| 1072 | static int __init | 1020 | static int __init |
| 1073 | mpc52xx_console_init(void) | 1021 | mpc52xx_console_init(void) |
| 1074 | { | 1022 | { |
| 1075 | #if defined(CONFIG_PPC_MERGE) | ||
| 1076 | mpc52xx_uart_of_enumerate(); | 1023 | mpc52xx_uart_of_enumerate(); |
| 1077 | #endif | ||
| 1078 | register_console(&mpc52xx_console); | 1024 | register_console(&mpc52xx_console); |
| 1079 | return 0; | 1025 | return 0; |
| 1080 | } | 1026 | } |
| @@ -1100,115 +1046,6 @@ static struct uart_driver mpc52xx_uart_driver = { | |||
| 1100 | .cons = MPC52xx_PSC_CONSOLE, | 1046 | .cons = MPC52xx_PSC_CONSOLE, |
| 1101 | }; | 1047 | }; |
| 1102 | 1048 | ||
| 1103 | |||
| 1104 | #if !defined(CONFIG_PPC_MERGE) | ||
| 1105 | /* ======================================================================== */ | ||
| 1106 | /* Platform Driver */ | ||
| 1107 | /* ======================================================================== */ | ||
| 1108 | |||
| 1109 | static int __devinit | ||
| 1110 | mpc52xx_uart_probe(struct platform_device *dev) | ||
| 1111 | { | ||
| 1112 | struct resource *res = dev->resource; | ||
| 1113 | |||
| 1114 | struct uart_port *port = NULL; | ||
| 1115 | int i, idx, ret; | ||
| 1116 | |||
| 1117 | /* Check validity & presence */ | ||
| 1118 | idx = dev->id; | ||
| 1119 | if (idx < 0 || idx >= MPC52xx_PSC_MAXNUM) | ||
| 1120 | return -EINVAL; | ||
| 1121 | |||
| 1122 | if (!mpc52xx_match_psc_function(idx, "uart")) | ||
| 1123 | return -ENODEV; | ||
| 1124 | |||
| 1125 | /* Init the port structure */ | ||
| 1126 | port = &mpc52xx_uart_ports[idx]; | ||
| 1127 | |||
| 1128 | spin_lock_init(&port->lock); | ||
| 1129 | port->uartclk = __res.bi_ipbfreq / 2; /* Look at CTLR doc */ | ||
| 1130 | port->fifosize = 512; | ||
| 1131 | port->iotype = UPIO_MEM; | ||
| 1132 | port->flags = UPF_BOOT_AUTOCONF | | ||
| 1133 | (uart_console(port) ? 0 : UPF_IOREMAP); | ||
| 1134 | port->line = idx; | ||
| 1135 | port->ops = &mpc52xx_uart_ops; | ||
| 1136 | port->dev = &dev->dev; | ||
| 1137 | |||
| 1138 | /* Search for IRQ and mapbase */ | ||
| 1139 | for (i = 0 ; i < dev->num_resources ; i++, res++) { | ||
| 1140 | if (res->flags & IORESOURCE_MEM) | ||
| 1141 | port->mapbase = res->start; | ||
| 1142 | else if (res->flags & IORESOURCE_IRQ) | ||
| 1143 | port->irq = res->start; | ||
| 1144 | } | ||
| 1145 | if (!port->irq || !port->mapbase) | ||
| 1146 | return -EINVAL; | ||
| 1147 | |||
| 1148 | /* Add the port to the uart sub-system */ | ||
| 1149 | ret = uart_add_one_port(&mpc52xx_uart_driver, port); | ||
| 1150 | if (!ret) | ||
| 1151 | platform_set_drvdata(dev, (void *)port); | ||
| 1152 | |||
| 1153 | return ret; | ||
| 1154 | } | ||
| 1155 | |||
| 1156 | static int | ||
| 1157 | mpc52xx_uart_remove(struct platform_device *dev) | ||
| 1158 | { | ||
| 1159 | struct uart_port *port = (struct uart_port *) platform_get_drvdata(dev); | ||
| 1160 | |||
| 1161 | platform_set_drvdata(dev, NULL); | ||
| 1162 | |||
| 1163 | if (port) | ||
| 1164 | uart_remove_one_port(&mpc52xx_uart_driver, port); | ||
| 1165 | |||
| 1166 | return 0; | ||
| 1167 | } | ||
| 1168 | |||
| 1169 | #ifdef CONFIG_PM | ||
| 1170 | static int | ||
| 1171 | mpc52xx_uart_suspend(struct platform_device *dev, pm_message_t state) | ||
| 1172 | { | ||
| 1173 | struct uart_port *port = (struct uart_port *) platform_get_drvdata(dev); | ||
| 1174 | |||
| 1175 | if (port) | ||
| 1176 | uart_suspend_port(&mpc52xx_uart_driver, port); | ||
| 1177 | |||
| 1178 | return 0; | ||
| 1179 | } | ||
| 1180 | |||
| 1181 | static int | ||
| 1182 | mpc52xx_uart_resume(struct platform_device *dev) | ||
| 1183 | { | ||
| 1184 | struct uart_port *port = (struct uart_port *) platform_get_drvdata(dev); | ||
| 1185 | |||
| 1186 | if (port) | ||
| 1187 | uart_resume_port(&mpc52xx_uart_driver, port); | ||
| 1188 | |||
| 1189 | return 0; | ||
| 1190 | } | ||
| 1191 | #endif | ||
| 1192 | |||
| 1193 | /* work with hotplug and coldplug */ | ||
| 1194 | MODULE_ALIAS("platform:mpc52xx-psc"); | ||
| 1195 | |||
| 1196 | static struct platform_driver mpc52xx_uart_platform_driver = { | ||
| 1197 | .probe = mpc52xx_uart_probe, | ||
| 1198 | .remove = mpc52xx_uart_remove, | ||
| 1199 | #ifdef CONFIG_PM | ||
| 1200 | .suspend = mpc52xx_uart_suspend, | ||
| 1201 | .resume = mpc52xx_uart_resume, | ||
| 1202 | #endif | ||
| 1203 | .driver = { | ||
| 1204 | .owner = THIS_MODULE, | ||
| 1205 | .name = "mpc52xx-psc", | ||
| 1206 | }, | ||
| 1207 | }; | ||
| 1208 | #endif /* !defined(CONFIG_PPC_MERGE) */ | ||
| 1209 | |||
| 1210 | |||
| 1211 | #if defined(CONFIG_PPC_MERGE) | ||
| 1212 | /* ======================================================================== */ | 1049 | /* ======================================================================== */ |
| 1213 | /* OF Platform Driver */ | 1050 | /* OF Platform Driver */ |
| 1214 | /* ======================================================================== */ | 1051 | /* ======================================================================== */ |
| @@ -1402,7 +1239,6 @@ static struct of_platform_driver mpc52xx_uart_of_driver = { | |||
| 1402 | .name = "mpc52xx-psc-uart", | 1239 | .name = "mpc52xx-psc-uart", |
| 1403 | }, | 1240 | }, |
| 1404 | }; | 1241 | }; |
| 1405 | #endif /* defined(CONFIG_PPC_MERGE) */ | ||
| 1406 | 1242 | ||
| 1407 | 1243 | ||
| 1408 | /* ======================================================================== */ | 1244 | /* ======================================================================== */ |
| @@ -1423,7 +1259,6 @@ mpc52xx_uart_init(void) | |||
| 1423 | return ret; | 1259 | return ret; |
| 1424 | } | 1260 | } |
| 1425 | 1261 | ||
| 1426 | #if defined(CONFIG_PPC_MERGE) | ||
| 1427 | mpc52xx_uart_of_enumerate(); | 1262 | mpc52xx_uart_of_enumerate(); |
| 1428 | 1263 | ||
| 1429 | ret = of_register_platform_driver(&mpc52xx_uart_of_driver); | 1264 | ret = of_register_platform_driver(&mpc52xx_uart_of_driver); |
| @@ -1433,16 +1268,6 @@ mpc52xx_uart_init(void) | |||
| 1433 | uart_unregister_driver(&mpc52xx_uart_driver); | 1268 | uart_unregister_driver(&mpc52xx_uart_driver); |
| 1434 | return ret; | 1269 | return ret; |
| 1435 | } | 1270 | } |
| 1436 | #else | ||
| 1437 | psc_ops = &mpc52xx_psc_ops; | ||
| 1438 | ret = platform_driver_register(&mpc52xx_uart_platform_driver); | ||
| 1439 | if (ret) { | ||
| 1440 | printk(KERN_ERR "%s: platform_driver_register failed (%i)\n", | ||
| 1441 | __FILE__, ret); | ||
| 1442 | uart_unregister_driver(&mpc52xx_uart_driver); | ||
| 1443 | return ret; | ||
| 1444 | } | ||
| 1445 | #endif | ||
| 1446 | 1271 | ||
| 1447 | return 0; | 1272 | return 0; |
| 1448 | } | 1273 | } |
| @@ -1450,11 +1275,7 @@ mpc52xx_uart_init(void) | |||
| 1450 | static void __exit | 1275 | static void __exit |
| 1451 | mpc52xx_uart_exit(void) | 1276 | mpc52xx_uart_exit(void) |
| 1452 | { | 1277 | { |
| 1453 | #if defined(CONFIG_PPC_MERGE) | ||
| 1454 | of_unregister_platform_driver(&mpc52xx_uart_of_driver); | 1278 | of_unregister_platform_driver(&mpc52xx_uart_of_driver); |
| 1455 | #else | ||
| 1456 | platform_driver_unregister(&mpc52xx_uart_platform_driver); | ||
| 1457 | #endif | ||
| 1458 | uart_unregister_driver(&mpc52xx_uart_driver); | 1279 | uart_unregister_driver(&mpc52xx_uart_driver); |
| 1459 | } | 1280 | } |
| 1460 | 1281 | ||
diff --git a/drivers/serial/s3c2400.c b/drivers/serial/s3c2400.c index c8b4266ac35f..4873f2978bd2 100644 --- a/drivers/serial/s3c2400.c +++ b/drivers/serial/s3c2400.c | |||
| @@ -19,7 +19,7 @@ | |||
| 19 | 19 | ||
| 20 | #include <mach/hardware.h> | 20 | #include <mach/hardware.h> |
| 21 | 21 | ||
| 22 | #include <asm/plat-s3c/regs-serial.h> | 22 | #include <plat/regs-serial.h> |
| 23 | #include <mach/regs-gpio.h> | 23 | #include <mach/regs-gpio.h> |
| 24 | 24 | ||
| 25 | #include "samsung.h" | 25 | #include "samsung.h" |
diff --git a/drivers/serial/s3c2410.c b/drivers/serial/s3c2410.c index 40a2531b5541..87c182ef71b8 100644 --- a/drivers/serial/s3c2410.c +++ b/drivers/serial/s3c2410.c | |||
| @@ -21,7 +21,7 @@ | |||
| 21 | #include <asm/irq.h> | 21 | #include <asm/irq.h> |
| 22 | #include <mach/hardware.h> | 22 | #include <mach/hardware.h> |
| 23 | 23 | ||
| 24 | #include <asm/plat-s3c/regs-serial.h> | 24 | #include <plat/regs-serial.h> |
| 25 | #include <mach/regs-gpio.h> | 25 | #include <mach/regs-gpio.h> |
| 26 | 26 | ||
| 27 | #include "samsung.h" | 27 | #include "samsung.h" |
diff --git a/drivers/serial/s3c2412.c b/drivers/serial/s3c2412.c index d0170319c729..fd017b375568 100644 --- a/drivers/serial/s3c2412.c +++ b/drivers/serial/s3c2412.c | |||
| @@ -21,7 +21,7 @@ | |||
| 21 | #include <asm/irq.h> | 21 | #include <asm/irq.h> |
| 22 | #include <mach/hardware.h> | 22 | #include <mach/hardware.h> |
| 23 | 23 | ||
| 24 | #include <asm/plat-s3c/regs-serial.h> | 24 | #include <plat/regs-serial.h> |
| 25 | #include <mach/regs-gpio.h> | 25 | #include <mach/regs-gpio.h> |
| 26 | 26 | ||
| 27 | #include "samsung.h" | 27 | #include "samsung.h" |
diff --git a/drivers/serial/s3c2440.c b/drivers/serial/s3c2440.c index d4a2b17b2498..317d239ab740 100644 --- a/drivers/serial/s3c2440.c +++ b/drivers/serial/s3c2440.c | |||
| @@ -21,7 +21,7 @@ | |||
| 21 | #include <asm/irq.h> | 21 | #include <asm/irq.h> |
| 22 | #include <mach/hardware.h> | 22 | #include <mach/hardware.h> |
| 23 | 23 | ||
| 24 | #include <asm/plat-s3c/regs-serial.h> | 24 | #include <plat/regs-serial.h> |
| 25 | #include <mach/regs-gpio.h> | 25 | #include <mach/regs-gpio.h> |
| 26 | 26 | ||
| 27 | #include "samsung.h" | 27 | #include "samsung.h" |
diff --git a/drivers/serial/samsung.c b/drivers/serial/samsung.c index 5a88b3f9fe9b..1e219d3d0352 100644 --- a/drivers/serial/samsung.c +++ b/drivers/serial/samsung.c | |||
| @@ -47,7 +47,7 @@ | |||
| 47 | 47 | ||
| 48 | #include <mach/hardware.h> | 48 | #include <mach/hardware.h> |
| 49 | 49 | ||
| 50 | #include <asm/plat-s3c/regs-serial.h> | 50 | #include <plat/regs-serial.h> |
| 51 | #include <mach/regs-gpio.h> | 51 | #include <mach/regs-gpio.h> |
| 52 | 52 | ||
| 53 | #include "samsung.h" | 53 | #include "samsung.h" |
diff --git a/drivers/serial/serial_txx9.c b/drivers/serial/serial_txx9.c index 8fcb4c5b9a26..7313c2edcb83 100644 --- a/drivers/serial/serial_txx9.c +++ b/drivers/serial/serial_txx9.c | |||
| @@ -1039,7 +1039,7 @@ static int __devinit serial_txx9_probe(struct platform_device *dev) | |||
| 1039 | ret = serial_txx9_register_port(&port); | 1039 | ret = serial_txx9_register_port(&port); |
| 1040 | if (ret < 0) { | 1040 | if (ret < 0) { |
| 1041 | dev_err(&dev->dev, "unable to register port at index %d " | 1041 | dev_err(&dev->dev, "unable to register port at index %d " |
| 1042 | "(IO%x MEM%llx IRQ%d): %d\n", i, | 1042 | "(IO%lx MEM%llx IRQ%d): %d\n", i, |
| 1043 | p->iobase, (unsigned long long)p->mapbase, | 1043 | p->iobase, (unsigned long long)p->mapbase, |
| 1044 | p->irq, ret); | 1044 | p->irq, ret); |
| 1045 | } | 1045 | } |
diff --git a/drivers/serial/sh-sci.c b/drivers/serial/sh-sci.c index 667b4b8fd074..f0658d2c45b2 100644 --- a/drivers/serial/sh-sci.c +++ b/drivers/serial/sh-sci.c | |||
| @@ -3,7 +3,7 @@ | |||
| 3 | * | 3 | * |
| 4 | * SuperH on-chip serial module support. (SCI with no FIFO / with FIFO) | 4 | * SuperH on-chip serial module support. (SCI with no FIFO / with FIFO) |
| 5 | * | 5 | * |
| 6 | * Copyright (C) 2002 - 2006 Paul Mundt | 6 | * Copyright (C) 2002 - 2008 Paul Mundt |
| 7 | * Modified to support SH7720 SCIF. Markus Brunner, Mark Jonas (Jul 2007). | 7 | * Modified to support SH7720 SCIF. Markus Brunner, Mark Jonas (Jul 2007). |
| 8 | * | 8 | * |
| 9 | * based off of the old drivers/char/sh-sci.c by: | 9 | * based off of the old drivers/char/sh-sci.c by: |
| @@ -46,6 +46,7 @@ | |||
| 46 | #include <linux/cpufreq.h> | 46 | #include <linux/cpufreq.h> |
| 47 | #include <linux/clk.h> | 47 | #include <linux/clk.h> |
| 48 | #include <linux/ctype.h> | 48 | #include <linux/ctype.h> |
| 49 | #include <linux/err.h> | ||
| 49 | 50 | ||
| 50 | #ifdef CONFIG_SUPERH | 51 | #ifdef CONFIG_SUPERH |
| 51 | #include <asm/clock.h> | 52 | #include <asm/clock.h> |
| @@ -78,7 +79,7 @@ struct sci_port { | |||
| 78 | struct timer_list break_timer; | 79 | struct timer_list break_timer; |
| 79 | int break_flag; | 80 | int break_flag; |
| 80 | 81 | ||
| 81 | #ifdef CONFIG_SUPERH | 82 | #ifdef CONFIG_HAVE_CLK |
| 82 | /* Port clock */ | 83 | /* Port clock */ |
| 83 | struct clk *clk; | 84 | struct clk *clk; |
| 84 | #endif | 85 | #endif |
| @@ -831,7 +832,7 @@ static irqreturn_t sci_mpxed_interrupt(int irq, void *ptr) | |||
| 831 | return IRQ_HANDLED; | 832 | return IRQ_HANDLED; |
| 832 | } | 833 | } |
| 833 | 834 | ||
| 834 | #ifdef CONFIG_CPU_FREQ | 835 | #if defined(CONFIG_CPU_FREQ) && defined(CONFIG_HAVE_CLK) |
| 835 | /* | 836 | /* |
| 836 | * Here we define a transistion notifier so that we can update all of our | 837 | * Here we define a transistion notifier so that we can update all of our |
| 837 | * ports' baud rate when the peripheral clock changes. | 838 | * ports' baud rate when the peripheral clock changes. |
| @@ -860,7 +861,7 @@ static int sci_notifier(struct notifier_block *self, | |||
| 860 | * Clean this up later.. | 861 | * Clean this up later.. |
| 861 | */ | 862 | */ |
| 862 | clk = clk_get(NULL, "module_clk"); | 863 | clk = clk_get(NULL, "module_clk"); |
| 863 | port->uartclk = clk_get_rate(clk) * 16; | 864 | port->uartclk = clk_get_rate(clk); |
| 864 | clk_put(clk); | 865 | clk_put(clk); |
| 865 | } | 866 | } |
| 866 | 867 | ||
| @@ -873,7 +874,7 @@ static int sci_notifier(struct notifier_block *self, | |||
| 873 | } | 874 | } |
| 874 | 875 | ||
| 875 | static struct notifier_block sci_nb = { &sci_notifier, NULL, 0 }; | 876 | static struct notifier_block sci_nb = { &sci_notifier, NULL, 0 }; |
| 876 | #endif /* CONFIG_CPU_FREQ */ | 877 | #endif /* CONFIG_CPU_FREQ && CONFIG_HAVE_CLK */ |
| 877 | 878 | ||
| 878 | static int sci_request_irq(struct sci_port *port) | 879 | static int sci_request_irq(struct sci_port *port) |
| 879 | { | 880 | { |
| @@ -1008,7 +1009,7 @@ static int sci_startup(struct uart_port *port) | |||
| 1008 | if (s->enable) | 1009 | if (s->enable) |
| 1009 | s->enable(port); | 1010 | s->enable(port); |
| 1010 | 1011 | ||
| 1011 | #if defined(CONFIG_SUPERH) && !defined(CONFIG_SUPERH64) | 1012 | #ifdef CONFIG_HAVE_CLK |
| 1012 | s->clk = clk_get(NULL, "module_clk"); | 1013 | s->clk = clk_get(NULL, "module_clk"); |
| 1013 | #endif | 1014 | #endif |
| 1014 | 1015 | ||
| @@ -1030,7 +1031,7 @@ static void sci_shutdown(struct uart_port *port) | |||
| 1030 | if (s->disable) | 1031 | if (s->disable) |
| 1031 | s->disable(port); | 1032 | s->disable(port); |
| 1032 | 1033 | ||
| 1033 | #if defined(CONFIG_SUPERH) && !defined(CONFIG_SUPERH64) | 1034 | #ifdef CONFIG_HAVE_CLK |
| 1034 | clk_put(s->clk); | 1035 | clk_put(s->clk); |
| 1035 | s->clk = NULL; | 1036 | s->clk = NULL; |
| 1036 | #endif | 1037 | #endif |
| @@ -1041,24 +1042,11 @@ static void sci_set_termios(struct uart_port *port, struct ktermios *termios, | |||
| 1041 | { | 1042 | { |
| 1042 | struct sci_port *s = &sci_ports[port->line]; | 1043 | struct sci_port *s = &sci_ports[port->line]; |
| 1043 | unsigned int status, baud, smr_val; | 1044 | unsigned int status, baud, smr_val; |
| 1044 | int t; | 1045 | int t = -1; |
| 1045 | 1046 | ||
| 1046 | baud = uart_get_baud_rate(port, termios, old, 0, port->uartclk/16); | 1047 | baud = uart_get_baud_rate(port, termios, old, 0, port->uartclk/16); |
| 1047 | 1048 | if (likely(baud)) | |
| 1048 | switch (baud) { | 1049 | t = SCBRR_VALUE(baud, port->uartclk); |
| 1049 | case 0: | ||
| 1050 | t = -1; | ||
| 1051 | break; | ||
| 1052 | default: | ||
| 1053 | { | ||
| 1054 | #if defined(CONFIG_SUPERH) && !defined(CONFIG_SUPERH64) | ||
| 1055 | t = SCBRR_VALUE(baud, clk_get_rate(s->clk)); | ||
| 1056 | #else | ||
| 1057 | t = SCBRR_VALUE(baud); | ||
| 1058 | #endif | ||
| 1059 | break; | ||
| 1060 | } | ||
| 1061 | } | ||
| 1062 | 1050 | ||
| 1063 | do { | 1051 | do { |
| 1064 | status = sci_in(port, SCxSR); | 1052 | status = sci_in(port, SCxSR); |
| @@ -1113,7 +1101,7 @@ static const char *sci_type(struct uart_port *port) | |||
| 1113 | case PORT_IRDA: return "irda"; | 1101 | case PORT_IRDA: return "irda"; |
| 1114 | } | 1102 | } |
| 1115 | 1103 | ||
| 1116 | return 0; | 1104 | return NULL; |
| 1117 | } | 1105 | } |
| 1118 | 1106 | ||
| 1119 | static void sci_release_port(struct uart_port *port) | 1107 | static void sci_release_port(struct uart_port *port) |
| @@ -1145,12 +1133,16 @@ static void sci_config_port(struct uart_port *port, int flags) | |||
| 1145 | break; | 1133 | break; |
| 1146 | } | 1134 | } |
| 1147 | 1135 | ||
| 1148 | #if defined(CONFIG_CPU_SUBTYPE_SH5_101) || defined(CONFIG_CPU_SUBTYPE_SH5_103) | 1136 | if (port->flags & UPF_IOREMAP && !port->membase) { |
| 1149 | if (port->mapbase == 0) | 1137 | #if defined(CONFIG_SUPERH64) |
| 1150 | port->mapbase = onchip_remap(SCIF_ADDR_SH5, 1024, "SCIF"); | 1138 | port->mapbase = onchip_remap(SCIF_ADDR_SH5, 1024, "SCIF"); |
| 1151 | 1139 | port->membase = (void __iomem *)port->mapbase; | |
| 1152 | port->membase = (void __iomem *)port->mapbase; | 1140 | #else |
| 1141 | port->membase = ioremap_nocache(port->mapbase, 0x40); | ||
| 1153 | #endif | 1142 | #endif |
| 1143 | |||
| 1144 | printk(KERN_ERR "sci: can't remap port#%d\n", port->line); | ||
| 1145 | } | ||
| 1154 | } | 1146 | } |
| 1155 | 1147 | ||
| 1156 | static int sci_verify_port(struct uart_port *port, struct serial_struct *ser) | 1148 | static int sci_verify_port(struct uart_port *port, struct serial_struct *ser) |
| @@ -1207,17 +1199,17 @@ static void __init sci_init_ports(void) | |||
| 1207 | sci_ports[i].disable = h8300_sci_disable; | 1199 | sci_ports[i].disable = h8300_sci_disable; |
| 1208 | #endif | 1200 | #endif |
| 1209 | sci_ports[i].port.uartclk = CONFIG_CPU_CLOCK; | 1201 | sci_ports[i].port.uartclk = CONFIG_CPU_CLOCK; |
| 1210 | #elif defined(CONFIG_SUPERH64) | 1202 | #elif defined(CONFIG_HAVE_CLK) |
| 1211 | sci_ports[i].port.uartclk = current_cpu_data.module_clock * 16; | ||
| 1212 | #else | ||
| 1213 | /* | 1203 | /* |
| 1214 | * XXX: We should use a proper SCI/SCIF clock | 1204 | * XXX: We should use a proper SCI/SCIF clock |
| 1215 | */ | 1205 | */ |
| 1216 | { | 1206 | { |
| 1217 | struct clk *clk = clk_get(NULL, "module_clk"); | 1207 | struct clk *clk = clk_get(NULL, "module_clk"); |
| 1218 | sci_ports[i].port.uartclk = clk_get_rate(clk) * 16; | 1208 | sci_ports[i].port.uartclk = clk_get_rate(clk); |
| 1219 | clk_put(clk); | 1209 | clk_put(clk); |
| 1220 | } | 1210 | } |
| 1211 | #else | ||
| 1212 | #error "Need a valid uartclk" | ||
| 1221 | #endif | 1213 | #endif |
| 1222 | 1214 | ||
| 1223 | sci_ports[i].break_timer.data = (unsigned long)&sci_ports[i]; | 1215 | sci_ports[i].break_timer.data = (unsigned long)&sci_ports[i]; |
| @@ -1285,7 +1277,7 @@ static int __init serial_console_setup(struct console *co, char *options) | |||
| 1285 | 1277 | ||
| 1286 | port->type = serial_console_port->type; | 1278 | port->type = serial_console_port->type; |
| 1287 | 1279 | ||
| 1288 | #if defined(CONFIG_SUPERH) && !defined(CONFIG_SUPERH64) | 1280 | #ifdef CONFIG_HAVE_CLK |
| 1289 | if (!serial_console_port->clk) | 1281 | if (!serial_console_port->clk) |
| 1290 | serial_console_port->clk = clk_get(NULL, "module_clk"); | 1282 | serial_console_port->clk = clk_get(NULL, "module_clk"); |
| 1291 | #endif | 1283 | #endif |
| @@ -1436,7 +1428,7 @@ static struct uart_driver sci_uart_driver = { | |||
| 1436 | static int __devinit sci_probe(struct platform_device *dev) | 1428 | static int __devinit sci_probe(struct platform_device *dev) |
| 1437 | { | 1429 | { |
| 1438 | struct plat_sci_port *p = dev->dev.platform_data; | 1430 | struct plat_sci_port *p = dev->dev.platform_data; |
| 1439 | int i; | 1431 | int i, ret = -EINVAL; |
| 1440 | 1432 | ||
| 1441 | for (i = 0; p && p->flags != 0; p++, i++) { | 1433 | for (i = 0; p && p->flags != 0; p++, i++) { |
| 1442 | struct sci_port *sciport = &sci_ports[i]; | 1434 | struct sci_port *sciport = &sci_ports[i]; |
| @@ -1453,12 +1445,22 @@ static int __devinit sci_probe(struct platform_device *dev) | |||
| 1453 | 1445 | ||
| 1454 | sciport->port.mapbase = p->mapbase; | 1446 | sciport->port.mapbase = p->mapbase; |
| 1455 | 1447 | ||
| 1456 | /* | 1448 | if (p->mapbase && !p->membase) { |
| 1457 | * For the simple (and majority of) cases where we don't need | 1449 | if (p->flags & UPF_IOREMAP) { |
| 1458 | * to do any remapping, just cast the cookie directly. | 1450 | p->membase = ioremap_nocache(p->mapbase, 0x40); |
| 1459 | */ | 1451 | if (IS_ERR(p->membase)) { |
| 1460 | if (p->mapbase && !p->membase && !(p->flags & UPF_IOREMAP)) | 1452 | ret = PTR_ERR(p->membase); |
| 1461 | p->membase = (void __iomem *)p->mapbase; | 1453 | goto err_unreg; |
| 1454 | } | ||
| 1455 | } else { | ||
| 1456 | /* | ||
| 1457 | * For the simple (and majority of) cases | ||
| 1458 | * where we don't need to do any remapping, | ||
| 1459 | * just cast the cookie directly. | ||
| 1460 | */ | ||
| 1461 | p->membase = (void __iomem *)p->mapbase; | ||
| 1462 | } | ||
| 1463 | } | ||
| 1462 | 1464 | ||
| 1463 | sciport->port.membase = p->membase; | 1465 | sciport->port.membase = p->membase; |
| 1464 | 1466 | ||
| @@ -1479,7 +1481,7 @@ static int __devinit sci_probe(struct platform_device *dev) | |||
| 1479 | kgdb_putchar = kgdb_sci_putchar; | 1481 | kgdb_putchar = kgdb_sci_putchar; |
| 1480 | #endif | 1482 | #endif |
| 1481 | 1483 | ||
| 1482 | #ifdef CONFIG_CPU_FREQ | 1484 | #if defined(CONFIG_CPU_FREQ) && defined(CONFIG_HAVE_CLK) |
| 1483 | cpufreq_register_notifier(&sci_nb, CPUFREQ_TRANSITION_NOTIFIER); | 1485 | cpufreq_register_notifier(&sci_nb, CPUFREQ_TRANSITION_NOTIFIER); |
| 1484 | dev_info(&dev->dev, "CPU frequency notifier registered\n"); | 1486 | dev_info(&dev->dev, "CPU frequency notifier registered\n"); |
| 1485 | #endif | 1487 | #endif |
| @@ -1489,6 +1491,12 @@ static int __devinit sci_probe(struct platform_device *dev) | |||
| 1489 | #endif | 1491 | #endif |
| 1490 | 1492 | ||
| 1491 | return 0; | 1493 | return 0; |
| 1494 | |||
| 1495 | err_unreg: | ||
| 1496 | for (i = i - 1; i >= 0; i--) | ||
| 1497 | uart_remove_one_port(&sci_uart_driver, &sci_ports[i].port); | ||
| 1498 | |||
| 1499 | return ret; | ||
| 1492 | } | 1500 | } |
| 1493 | 1501 | ||
| 1494 | static int __devexit sci_remove(struct platform_device *dev) | 1502 | static int __devexit sci_remove(struct platform_device *dev) |
diff --git a/drivers/serial/sh-sci.h b/drivers/serial/sh-sci.h index 8a0749e34ca3..7cd28b226800 100644 --- a/drivers/serial/sh-sci.h +++ b/drivers/serial/sh-sci.h | |||
| @@ -320,18 +320,16 @@ | |||
| 320 | #define SCI_EVENT_WRITE_WAKEUP 0 | 320 | #define SCI_EVENT_WRITE_WAKEUP 0 |
| 321 | 321 | ||
| 322 | #define SCI_IN(size, offset) \ | 322 | #define SCI_IN(size, offset) \ |
| 323 | unsigned int addr = port->mapbase + (offset); \ | ||
| 324 | if ((size) == 8) { \ | 323 | if ((size) == 8) { \ |
| 325 | return ctrl_inb(addr); \ | 324 | return ioread8(port->membase + (offset)); \ |
| 326 | } else { \ | 325 | } else { \ |
| 327 | return ctrl_inw(addr); \ | 326 | return ioread16(port->membase + (offset)); \ |
| 328 | } | 327 | } |
| 329 | #define SCI_OUT(size, offset, value) \ | 328 | #define SCI_OUT(size, offset, value) \ |
| 330 | unsigned int addr = port->mapbase + (offset); \ | ||
| 331 | if ((size) == 8) { \ | 329 | if ((size) == 8) { \ |
| 332 | ctrl_outb(value, addr); \ | 330 | iowrite8(value, port->membase + (offset)); \ |
| 333 | } else if ((size) == 16) { \ | 331 | } else if ((size) == 16) { \ |
| 334 | ctrl_outw(value, addr); \ | 332 | iowrite16(value, port->membase + (offset)); \ |
| 335 | } | 333 | } |
| 336 | 334 | ||
| 337 | #define CPU_SCIx_FNS(name, sci_offset, sci_size, scif_offset, scif_size)\ | 335 | #define CPU_SCIx_FNS(name, sci_offset, sci_size, scif_offset, scif_size)\ |
| @@ -791,11 +789,16 @@ static inline int sci_rxd_in(struct uart_port *port) | |||
| 791 | defined(CONFIG_CPU_SUBTYPE_SH7721) | 789 | defined(CONFIG_CPU_SUBTYPE_SH7721) |
| 792 | #define SCBRR_VALUE(bps, clk) (((clk*2)+16*bps)/(32*bps)-1) | 790 | #define SCBRR_VALUE(bps, clk) (((clk*2)+16*bps)/(32*bps)-1) |
| 793 | #elif defined(CONFIG_CPU_SUBTYPE_SH7723) | 791 | #elif defined(CONFIG_CPU_SUBTYPE_SH7723) |
| 794 | #define SCBRR_VALUE(bps, clk) (((clk*2)+16*bps)/(16*bps)-1) | 792 | static inline int scbrr_calc(struct uart_port *port, int bps, int clk) |
| 793 | { | ||
| 794 | if (port->type == PORT_SCIF) | ||
| 795 | return (clk+16*bps)/(32*bps)-1; | ||
| 796 | else | ||
| 797 | return ((clk*2)+16*bps)/(16*bps)-1; | ||
| 798 | } | ||
| 799 | #define SCBRR_VALUE(bps, clk) scbrr_calc(port, bps, clk) | ||
| 795 | #elif defined(__H8300H__) || defined(__H8300S__) | 800 | #elif defined(__H8300H__) || defined(__H8300S__) |
| 796 | #define SCBRR_VALUE(bps) (((CONFIG_CPU_CLOCK*1000/32)/bps)-1) | 801 | #define SCBRR_VALUE(bps, clk) (((clk*1000/32)/bps)-1) |
| 797 | #elif defined(CONFIG_SUPERH64) | ||
| 798 | #define SCBRR_VALUE(bps) ((current_cpu_data.module_clock+16*bps)/(32*bps)-1) | ||
| 799 | #else /* Generic SH */ | 802 | #else /* Generic SH */ |
| 800 | #define SCBRR_VALUE(bps, clk) ((clk+16*bps)/(32*bps)-1) | 803 | #define SCBRR_VALUE(bps, clk) ((clk+16*bps)/(32*bps)-1) |
| 801 | #endif | 804 | #endif |
diff --git a/drivers/serial/sn_console.c b/drivers/serial/sn_console.c index b73e3c0056cd..d5276c012f78 100644 --- a/drivers/serial/sn_console.c +++ b/drivers/serial/sn_console.c | |||
| @@ -61,7 +61,7 @@ | |||
| 61 | #define SN_SAL_BUFFER_SIZE (64 * (1 << 10)) | 61 | #define SN_SAL_BUFFER_SIZE (64 * (1 << 10)) |
| 62 | 62 | ||
| 63 | #define SN_SAL_UART_FIFO_DEPTH 16 | 63 | #define SN_SAL_UART_FIFO_DEPTH 16 |
| 64 | #define SN_SAL_UART_FIFO_SPEED_CPS 9600/10 | 64 | #define SN_SAL_UART_FIFO_SPEED_CPS (9600/10) |
| 65 | 65 | ||
| 66 | /* sn_transmit_chars() calling args */ | 66 | /* sn_transmit_chars() calling args */ |
| 67 | #define TRANSMIT_BUFFERED 0 | 67 | #define TRANSMIT_BUFFERED 0 |
diff --git a/drivers/serial/ucc_uart.c b/drivers/serial/ucc_uart.c index 503f0b99a3b8..315a9333ca3c 100644 --- a/drivers/serial/ucc_uart.c +++ b/drivers/serial/ucc_uart.c | |||
| @@ -1009,7 +1009,7 @@ static int qe_uart_request_port(struct uart_port *port) | |||
| 1009 | rx_size = L1_CACHE_ALIGN(qe_port->rx_nrfifos * qe_port->rx_fifosize); | 1009 | rx_size = L1_CACHE_ALIGN(qe_port->rx_nrfifos * qe_port->rx_fifosize); |
| 1010 | tx_size = L1_CACHE_ALIGN(qe_port->tx_nrfifos * qe_port->tx_fifosize); | 1010 | tx_size = L1_CACHE_ALIGN(qe_port->tx_nrfifos * qe_port->tx_fifosize); |
| 1011 | 1011 | ||
| 1012 | bd_virt = dma_alloc_coherent(NULL, rx_size + tx_size, &bd_dma_addr, | 1012 | bd_virt = dma_alloc_coherent(port->dev, rx_size + tx_size, &bd_dma_addr, |
| 1013 | GFP_KERNEL); | 1013 | GFP_KERNEL); |
| 1014 | if (!bd_virt) { | 1014 | if (!bd_virt) { |
| 1015 | dev_err(port->dev, "could not allocate buffer descriptors\n"); | 1015 | dev_err(port->dev, "could not allocate buffer descriptors\n"); |
| @@ -1051,7 +1051,7 @@ static void qe_uart_release_port(struct uart_port *port) | |||
| 1051 | container_of(port, struct uart_qe_port, port); | 1051 | container_of(port, struct uart_qe_port, port); |
| 1052 | struct ucc_slow_private *uccs = qe_port->us_private; | 1052 | struct ucc_slow_private *uccs = qe_port->us_private; |
| 1053 | 1053 | ||
| 1054 | dma_free_coherent(NULL, qe_port->bd_size, qe_port->bd_virt, | 1054 | dma_free_coherent(port->dev, qe_port->bd_size, qe_port->bd_virt, |
| 1055 | qe_port->bd_dma_addr); | 1055 | qe_port->bd_dma_addr); |
| 1056 | 1056 | ||
| 1057 | ucc_slow_free(uccs); | 1057 | ucc_slow_free(uccs); |
