aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVitaly Bordug <vbordug@ru.mvista.com>2006-09-21 09:27:15 -0400
committerVitaly Bordug <vbordug@ru.mvista.com>2006-09-21 09:27:15 -0400
commit3dd0dcbe9dc5c116df96989c42a062951b644e04 (patch)
tree348b654c3e4ae5518369358c5033d0467ce2b4fd
parentfba43665360d361d338efd120a34ad615ca960d8 (diff)
cpm_uart: make it possible to utilize from powerpc
Driver core has been updated to make use of the new powerpc OF-inspired platform devices, yet keeping compatibility to the vast board list from ppc. Signed-off-by: Vitaly Bordug <vbordug@ru.mvista.com>
-rw-r--r--drivers/serial/cpm_uart/cpm_uart_core.c11
-rw-r--r--drivers/serial/cpm_uart/cpm_uart_cpm2.c13
-rw-r--r--include/asm-powerpc/fs_pd.h27
-rw-r--r--include/asm-ppc/fs_pd.h32
4 files changed, 70 insertions, 13 deletions
diff --git a/drivers/serial/cpm_uart/cpm_uart_core.c b/drivers/serial/cpm_uart/cpm_uart_core.c
index 90ff96e3339b..dfa06b644957 100644
--- a/drivers/serial/cpm_uart/cpm_uart_core.c
+++ b/drivers/serial/cpm_uart/cpm_uart_core.c
@@ -46,6 +46,7 @@
46#include <asm/io.h> 46#include <asm/io.h>
47#include <asm/irq.h> 47#include <asm/irq.h>
48#include <asm/delay.h> 48#include <asm/delay.h>
49#include <asm/fs_pd.h>
49 50
50#if defined(CONFIG_SERIAL_CPM_CONSOLE) && defined(CONFIG_MAGIC_SYSRQ) 51#if defined(CONFIG_SERIAL_CPM_CONSOLE) && defined(CONFIG_MAGIC_SYSRQ)
51#define SUPPORT_SYSRQ 52#define SUPPORT_SYSRQ
@@ -1044,11 +1045,11 @@ int cpm_uart_drv_get_platform_data(struct platform_device *pdev, int is_con)
1044 1045
1045 if (!(r = platform_get_resource_byname(pdev, IORESOURCE_MEM, "regs"))) 1046 if (!(r = platform_get_resource_byname(pdev, IORESOURCE_MEM, "regs")))
1046 return -EINVAL; 1047 return -EINVAL;
1047 mem = r->start; 1048 mem = (u32)ioremap(r->start, r->end - r->start + 1);
1048 1049
1049 if (!(r = platform_get_resource_byname(pdev, IORESOURCE_MEM, "pram"))) 1050 if (!(r = platform_get_resource_byname(pdev, IORESOURCE_MEM, "pram")))
1050 return -EINVAL; 1051 return -EINVAL;
1051 pram = r->start; 1052 pram = (u32)ioremap(r->start, r->end - r->start + 1);
1052 1053
1053 if(idx > fsid_smc2_uart) { 1054 if(idx > fsid_smc2_uart) {
1054 pinfo->sccp = (scc_t *)mem; 1055 pinfo->sccp = (scc_t *)mem;
@@ -1189,11 +1190,7 @@ static int __init cpm_uart_console_setup(struct console *co, char *options)
1189 if (options) { 1190 if (options) {
1190 uart_parse_options(options, &baud, &parity, &bits, &flow); 1191 uart_parse_options(options, &baud, &parity, &bits, &flow);
1191 } else { 1192 } else {
1192 bd_t *bd = (bd_t *) __res; 1193 if ((baud = uart_baudrate()) == -1)
1193
1194 if (bd->bi_baudrate)
1195 baud = bd->bi_baudrate;
1196 else
1197 baud = 9600; 1194 baud = 9600;
1198 } 1195 }
1199 1196
diff --git a/drivers/serial/cpm_uart/cpm_uart_cpm2.c b/drivers/serial/cpm_uart/cpm_uart_cpm2.c
index ef3bb476c432..02b9ef9abd3f 100644
--- a/drivers/serial/cpm_uart/cpm_uart_cpm2.c
+++ b/drivers/serial/cpm_uart/cpm_uart_cpm2.c
@@ -40,6 +40,7 @@
40 40
41#include <asm/io.h> 41#include <asm/io.h>
42#include <asm/irq.h> 42#include <asm/irq.h>
43#include <asm/fs_pd.h>
43 44
44#include <linux/serial_core.h> 45#include <linux/serial_core.h>
45#include <linux/kernel.h> 46#include <linux/kernel.h>
@@ -266,7 +267,7 @@ int cpm_uart_init_portdesc(void)
266 (unsigned long)&cpm2_immr->im_smc[0]; 267 (unsigned long)&cpm2_immr->im_smc[0];
267 cpm_uart_ports[UART_SMC1].smcp->smc_smcm |= (SMCM_RX | SMCM_TX); 268 cpm_uart_ports[UART_SMC1].smcp->smc_smcm |= (SMCM_RX | SMCM_TX);
268 cpm_uart_ports[UART_SMC1].smcp->smc_smcmr &= ~(SMCMR_REN | SMCMR_TEN); 269 cpm_uart_ports[UART_SMC1].smcp->smc_smcmr &= ~(SMCMR_REN | SMCMR_TEN);
269 cpm_uart_ports[UART_SMC1].port.uartclk = (((bd_t *) __res)->bi_intfreq); 270 cpm_uart_ports[UART_SMC1].port.uartclk = uart_clock();
270 cpm_uart_port_map[cpm_uart_nr++] = UART_SMC1; 271 cpm_uart_port_map[cpm_uart_nr++] = UART_SMC1;
271#endif 272#endif
272 273
@@ -279,7 +280,7 @@ int cpm_uart_init_portdesc(void)
279 (unsigned long)&cpm2_immr->im_smc[1]; 280 (unsigned long)&cpm2_immr->im_smc[1];
280 cpm_uart_ports[UART_SMC2].smcp->smc_smcm |= (SMCM_RX | SMCM_TX); 281 cpm_uart_ports[UART_SMC2].smcp->smc_smcm |= (SMCM_RX | SMCM_TX);
281 cpm_uart_ports[UART_SMC2].smcp->smc_smcmr &= ~(SMCMR_REN | SMCMR_TEN); 282 cpm_uart_ports[UART_SMC2].smcp->smc_smcmr &= ~(SMCMR_REN | SMCMR_TEN);
282 cpm_uart_ports[UART_SMC2].port.uartclk = (((bd_t *) __res)->bi_intfreq); 283 cpm_uart_ports[UART_SMC2].port.uartclk = uart_clock();
283 cpm_uart_port_map[cpm_uart_nr++] = UART_SMC2; 284 cpm_uart_port_map[cpm_uart_nr++] = UART_SMC2;
284#endif 285#endif
285 286
@@ -293,7 +294,7 @@ int cpm_uart_init_portdesc(void)
293 ~(UART_SCCM_TX | UART_SCCM_RX); 294 ~(UART_SCCM_TX | UART_SCCM_RX);
294 cpm_uart_ports[UART_SCC1].sccp->scc_gsmrl &= 295 cpm_uart_ports[UART_SCC1].sccp->scc_gsmrl &=
295 ~(SCC_GSMRL_ENR | SCC_GSMRL_ENT); 296 ~(SCC_GSMRL_ENR | SCC_GSMRL_ENT);
296 cpm_uart_ports[UART_SCC1].port.uartclk = (((bd_t *) __res)->bi_intfreq); 297 cpm_uart_ports[UART_SCC1].port.uartclk = uart_clock();
297 cpm_uart_port_map[cpm_uart_nr++] = UART_SCC1; 298 cpm_uart_port_map[cpm_uart_nr++] = UART_SCC1;
298#endif 299#endif
299 300
@@ -307,7 +308,7 @@ int cpm_uart_init_portdesc(void)
307 ~(UART_SCCM_TX | UART_SCCM_RX); 308 ~(UART_SCCM_TX | UART_SCCM_RX);
308 cpm_uart_ports[UART_SCC2].sccp->scc_gsmrl &= 309 cpm_uart_ports[UART_SCC2].sccp->scc_gsmrl &=
309 ~(SCC_GSMRL_ENR | SCC_GSMRL_ENT); 310 ~(SCC_GSMRL_ENR | SCC_GSMRL_ENT);
310 cpm_uart_ports[UART_SCC2].port.uartclk = (((bd_t *) __res)->bi_intfreq); 311 cpm_uart_ports[UART_SCC2].port.uartclk = uart_clock();
311 cpm_uart_port_map[cpm_uart_nr++] = UART_SCC2; 312 cpm_uart_port_map[cpm_uart_nr++] = UART_SCC2;
312#endif 313#endif
313 314
@@ -321,7 +322,7 @@ int cpm_uart_init_portdesc(void)
321 ~(UART_SCCM_TX | UART_SCCM_RX); 322 ~(UART_SCCM_TX | UART_SCCM_RX);
322 cpm_uart_ports[UART_SCC3].sccp->scc_gsmrl &= 323 cpm_uart_ports[UART_SCC3].sccp->scc_gsmrl &=
323 ~(SCC_GSMRL_ENR | SCC_GSMRL_ENT); 324 ~(SCC_GSMRL_ENR | SCC_GSMRL_ENT);
324 cpm_uart_ports[UART_SCC3].port.uartclk = (((bd_t *) __res)->bi_intfreq); 325 cpm_uart_ports[UART_SCC3].port.uartclk = uart_clock();
325 cpm_uart_port_map[cpm_uart_nr++] = UART_SCC3; 326 cpm_uart_port_map[cpm_uart_nr++] = UART_SCC3;
326#endif 327#endif
327 328
@@ -335,7 +336,7 @@ int cpm_uart_init_portdesc(void)
335 ~(UART_SCCM_TX | UART_SCCM_RX); 336 ~(UART_SCCM_TX | UART_SCCM_RX);
336 cpm_uart_ports[UART_SCC4].sccp->scc_gsmrl &= 337 cpm_uart_ports[UART_SCC4].sccp->scc_gsmrl &=
337 ~(SCC_GSMRL_ENR | SCC_GSMRL_ENT); 338 ~(SCC_GSMRL_ENR | SCC_GSMRL_ENT);
338 cpm_uart_ports[UART_SCC4].port.uartclk = (((bd_t *) __res)->bi_intfreq); 339 cpm_uart_ports[UART_SCC4].port.uartclk = uart_clock();
339 cpm_uart_port_map[cpm_uart_nr++] = UART_SCC4; 340 cpm_uart_port_map[cpm_uart_nr++] = UART_SCC4;
340#endif 341#endif
341 342
diff --git a/include/asm-powerpc/fs_pd.h b/include/asm-powerpc/fs_pd.h
new file mode 100644
index 000000000000..d530f68b4eef
--- /dev/null
+++ b/include/asm-powerpc/fs_pd.h
@@ -0,0 +1,27 @@
1/*
2 * Platform information definitions.
3 *
4 * 2006 (c) MontaVista Software, Inc.
5 * Vitaly Bordug <vbordug@ru.mvista.com>
6 *
7 * This file is licensed under the terms of the GNU General Public License
8 * version 2. This program is licensed "as is" without any warranty of any
9 * kind, whether express or implied.
10 */
11
12#ifndef FS_PD_H
13#define FS_PD_H
14#include <sysdev/fsl_soc.h>
15#include <asm/time.h>
16
17static inline int uart_baudrate(void)
18{
19 return get_baudrate();
20}
21
22static inline int uart_clock(void)
23{
24 return ppc_proc_freq;
25}
26
27#endif
diff --git a/include/asm-ppc/fs_pd.h b/include/asm-ppc/fs_pd.h
new file mode 100644
index 000000000000..eed777834121
--- /dev/null
+++ b/include/asm-ppc/fs_pd.h
@@ -0,0 +1,32 @@
1/*
2 * Platform information definitions.
3 *
4 * 2006 (c) MontaVista Software, Inc.
5 * Vitaly Bordug <vbordug@ru.mvista.com>
6 *
7 * This file is licensed under the terms of the GNU General Public License
8 * version 2. This program is licensed "as is" without any warranty of any
9 * kind, whether express or implied.
10 */
11
12#ifndef FS_PD_H
13#define FS_PD_H
14
15static inline int uart_baudrate(void)
16{
17 int baud;
18 bd_t *bd = (bd_t *) __res;
19
20 if (bd->bi_baudrate)
21 baud = bd->bi_baudrate;
22 else
23 baud = -1;
24 return baud;
25}
26
27static inline int uart_clock(void)
28{
29 return (((bd_t *) __res)->bi_intfreq);
30}
31
32#endif