Commit 3dd0dcbe authored by Vitaly Bordug's avatar Vitaly Bordug

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: default avatarVitaly Bordug <vbordug@ru.mvista.com>
parent fba43665
...@@ -46,6 +46,7 @@ ...@@ -46,6 +46,7 @@
#include <asm/io.h> #include <asm/io.h>
#include <asm/irq.h> #include <asm/irq.h>
#include <asm/delay.h> #include <asm/delay.h>
#include <asm/fs_pd.h>
#if defined(CONFIG_SERIAL_CPM_CONSOLE) && defined(CONFIG_MAGIC_SYSRQ) #if defined(CONFIG_SERIAL_CPM_CONSOLE) && defined(CONFIG_MAGIC_SYSRQ)
#define SUPPORT_SYSRQ #define SUPPORT_SYSRQ
...@@ -1044,11 +1045,11 @@ int cpm_uart_drv_get_platform_data(struct platform_device *pdev, int is_con) ...@@ -1044,11 +1045,11 @@ int cpm_uart_drv_get_platform_data(struct platform_device *pdev, int is_con)
if (!(r = platform_get_resource_byname(pdev, IORESOURCE_MEM, "regs"))) if (!(r = platform_get_resource_byname(pdev, IORESOURCE_MEM, "regs")))
return -EINVAL; return -EINVAL;
mem = r->start; mem = (u32)ioremap(r->start, r->end - r->start + 1);
if (!(r = platform_get_resource_byname(pdev, IORESOURCE_MEM, "pram"))) if (!(r = platform_get_resource_byname(pdev, IORESOURCE_MEM, "pram")))
return -EINVAL; return -EINVAL;
pram = r->start; pram = (u32)ioremap(r->start, r->end - r->start + 1);
if(idx > fsid_smc2_uart) { if(idx > fsid_smc2_uart) {
pinfo->sccp = (scc_t *)mem; pinfo->sccp = (scc_t *)mem;
...@@ -1189,11 +1190,7 @@ static int __init cpm_uart_console_setup(struct console *co, char *options) ...@@ -1189,11 +1190,7 @@ static int __init cpm_uart_console_setup(struct console *co, char *options)
if (options) { if (options) {
uart_parse_options(options, &baud, &parity, &bits, &flow); uart_parse_options(options, &baud, &parity, &bits, &flow);
} else { } else {
bd_t *bd = (bd_t *) __res; if ((baud = uart_baudrate()) == -1)
if (bd->bi_baudrate)
baud = bd->bi_baudrate;
else
baud = 9600; baud = 9600;
} }
......
...@@ -40,6 +40,7 @@ ...@@ -40,6 +40,7 @@
#include <asm/io.h> #include <asm/io.h>
#include <asm/irq.h> #include <asm/irq.h>
#include <asm/fs_pd.h>
#include <linux/serial_core.h> #include <linux/serial_core.h>
#include <linux/kernel.h> #include <linux/kernel.h>
...@@ -266,7 +267,7 @@ int cpm_uart_init_portdesc(void) ...@@ -266,7 +267,7 @@ int cpm_uart_init_portdesc(void)
(unsigned long)&cpm2_immr->im_smc[0]; (unsigned long)&cpm2_immr->im_smc[0];
cpm_uart_ports[UART_SMC1].smcp->smc_smcm |= (SMCM_RX | SMCM_TX); cpm_uart_ports[UART_SMC1].smcp->smc_smcm |= (SMCM_RX | SMCM_TX);
cpm_uart_ports[UART_SMC1].smcp->smc_smcmr &= ~(SMCMR_REN | SMCMR_TEN); cpm_uart_ports[UART_SMC1].smcp->smc_smcmr &= ~(SMCMR_REN | SMCMR_TEN);
cpm_uart_ports[UART_SMC1].port.uartclk = (((bd_t *) __res)->bi_intfreq); cpm_uart_ports[UART_SMC1].port.uartclk = uart_clock();
cpm_uart_port_map[cpm_uart_nr++] = UART_SMC1; cpm_uart_port_map[cpm_uart_nr++] = UART_SMC1;
#endif #endif
...@@ -279,7 +280,7 @@ int cpm_uart_init_portdesc(void) ...@@ -279,7 +280,7 @@ int cpm_uart_init_portdesc(void)
(unsigned long)&cpm2_immr->im_smc[1]; (unsigned long)&cpm2_immr->im_smc[1];
cpm_uart_ports[UART_SMC2].smcp->smc_smcm |= (SMCM_RX | SMCM_TX); cpm_uart_ports[UART_SMC2].smcp->smc_smcm |= (SMCM_RX | SMCM_TX);
cpm_uart_ports[UART_SMC2].smcp->smc_smcmr &= ~(SMCMR_REN | SMCMR_TEN); cpm_uart_ports[UART_SMC2].smcp->smc_smcmr &= ~(SMCMR_REN | SMCMR_TEN);
cpm_uart_ports[UART_SMC2].port.uartclk = (((bd_t *) __res)->bi_intfreq); cpm_uart_ports[UART_SMC2].port.uartclk = uart_clock();
cpm_uart_port_map[cpm_uart_nr++] = UART_SMC2; cpm_uart_port_map[cpm_uart_nr++] = UART_SMC2;
#endif #endif
...@@ -293,7 +294,7 @@ int cpm_uart_init_portdesc(void) ...@@ -293,7 +294,7 @@ int cpm_uart_init_portdesc(void)
~(UART_SCCM_TX | UART_SCCM_RX); ~(UART_SCCM_TX | UART_SCCM_RX);
cpm_uart_ports[UART_SCC1].sccp->scc_gsmrl &= cpm_uart_ports[UART_SCC1].sccp->scc_gsmrl &=
~(SCC_GSMRL_ENR | SCC_GSMRL_ENT); ~(SCC_GSMRL_ENR | SCC_GSMRL_ENT);
cpm_uart_ports[UART_SCC1].port.uartclk = (((bd_t *) __res)->bi_intfreq); cpm_uart_ports[UART_SCC1].port.uartclk = uart_clock();
cpm_uart_port_map[cpm_uart_nr++] = UART_SCC1; cpm_uart_port_map[cpm_uart_nr++] = UART_SCC1;
#endif #endif
...@@ -307,7 +308,7 @@ int cpm_uart_init_portdesc(void) ...@@ -307,7 +308,7 @@ int cpm_uart_init_portdesc(void)
~(UART_SCCM_TX | UART_SCCM_RX); ~(UART_SCCM_TX | UART_SCCM_RX);
cpm_uart_ports[UART_SCC2].sccp->scc_gsmrl &= cpm_uart_ports[UART_SCC2].sccp->scc_gsmrl &=
~(SCC_GSMRL_ENR | SCC_GSMRL_ENT); ~(SCC_GSMRL_ENR | SCC_GSMRL_ENT);
cpm_uart_ports[UART_SCC2].port.uartclk = (((bd_t *) __res)->bi_intfreq); cpm_uart_ports[UART_SCC2].port.uartclk = uart_clock();
cpm_uart_port_map[cpm_uart_nr++] = UART_SCC2; cpm_uart_port_map[cpm_uart_nr++] = UART_SCC2;
#endif #endif
...@@ -321,7 +322,7 @@ int cpm_uart_init_portdesc(void) ...@@ -321,7 +322,7 @@ int cpm_uart_init_portdesc(void)
~(UART_SCCM_TX | UART_SCCM_RX); ~(UART_SCCM_TX | UART_SCCM_RX);
cpm_uart_ports[UART_SCC3].sccp->scc_gsmrl &= cpm_uart_ports[UART_SCC3].sccp->scc_gsmrl &=
~(SCC_GSMRL_ENR | SCC_GSMRL_ENT); ~(SCC_GSMRL_ENR | SCC_GSMRL_ENT);
cpm_uart_ports[UART_SCC3].port.uartclk = (((bd_t *) __res)->bi_intfreq); cpm_uart_ports[UART_SCC3].port.uartclk = uart_clock();
cpm_uart_port_map[cpm_uart_nr++] = UART_SCC3; cpm_uart_port_map[cpm_uart_nr++] = UART_SCC3;
#endif #endif
...@@ -335,7 +336,7 @@ int cpm_uart_init_portdesc(void) ...@@ -335,7 +336,7 @@ int cpm_uart_init_portdesc(void)
~(UART_SCCM_TX | UART_SCCM_RX); ~(UART_SCCM_TX | UART_SCCM_RX);
cpm_uart_ports[UART_SCC4].sccp->scc_gsmrl &= cpm_uart_ports[UART_SCC4].sccp->scc_gsmrl &=
~(SCC_GSMRL_ENR | SCC_GSMRL_ENT); ~(SCC_GSMRL_ENR | SCC_GSMRL_ENT);
cpm_uart_ports[UART_SCC4].port.uartclk = (((bd_t *) __res)->bi_intfreq); cpm_uart_ports[UART_SCC4].port.uartclk = uart_clock();
cpm_uart_port_map[cpm_uart_nr++] = UART_SCC4; cpm_uart_port_map[cpm_uart_nr++] = UART_SCC4;
#endif #endif
......
/*
* Platform information definitions.
*
* 2006 (c) MontaVista Software, Inc.
* Vitaly Bordug <vbordug@ru.mvista.com>
*
* This file is licensed under the terms of the GNU General Public License
* version 2. This program is licensed "as is" without any warranty of any
* kind, whether express or implied.
*/
#ifndef FS_PD_H
#define FS_PD_H
#include <sysdev/fsl_soc.h>
#include <asm/time.h>
static inline int uart_baudrate(void)
{
return get_baudrate();
}
static inline int uart_clock(void)
{
return ppc_proc_freq;
}
#endif
/*
* Platform information definitions.
*
* 2006 (c) MontaVista Software, Inc.
* Vitaly Bordug <vbordug@ru.mvista.com>
*
* This file is licensed under the terms of the GNU General Public License
* version 2. This program is licensed "as is" without any warranty of any
* kind, whether express or implied.
*/
#ifndef FS_PD_H
#define FS_PD_H
static inline int uart_baudrate(void)
{
int baud;
bd_t *bd = (bd_t *) __res;
if (bd->bi_baudrate)
baud = bd->bi_baudrate;
else
baud = -1;
return baud;
}
static inline int uart_clock(void)
{
return (((bd_t *) __res)->bi_intfreq);
}
#endif
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment