Skip to content

Commit

Permalink
m68knommu: simplify the 520x UART setup code
Browse files Browse the repository at this point in the history
Simplify the UART setup code so that it no longer loops for each UART
present. Just make it do all the work it needs in a single function.
This will make the code easier to share when we move to a single set
of platform data for ColdFire UARTs.

Signed-off-by: Greg Ungerer <gerg@uclinux.org>
  • Loading branch information
Greg Ungerer committed Mar 4, 2012
1 parent a579748 commit b92225c
Showing 1 changed file with 12 additions and 30 deletions.
42 changes: 12 additions & 30 deletions arch/m68k/platform/520x/config.c
Original file line number Diff line number Diff line change
Expand Up @@ -227,41 +227,23 @@ static struct platform_device *m520x_devices[] __initdata = {

/***************************************************************************/

static void __init m520x_uart_init_line(int line, int irq)
static void __init m520x_uarts_init(void)
{
u16 par;
u8 par2;

switch (line) {
case 0:
par = readw(MCF_GPIO_PAR_UART);
par |= MCF_GPIO_PAR_UART_PAR_UTXD0 |
MCF_GPIO_PAR_UART_PAR_URXD0;
writew(par, MCF_GPIO_PAR_UART);
break;
case 1:
par = readw(MCF_GPIO_PAR_UART);
par |= MCF_GPIO_PAR_UART_PAR_UTXD1 |
MCF_GPIO_PAR_UART_PAR_URXD1;
writew(par, MCF_GPIO_PAR_UART);
break;
case 2:
par2 = readb(MCF_GPIO_PAR_FECI2C);
par2 &= ~0x0F;
par2 |= MCF_GPIO_PAR_FECI2C_PAR_SCL_UTXD2 |
MCF_GPIO_PAR_FECI2C_PAR_SDA_URXD2;
writeb(par2, MCF_GPIO_PAR_FECI2C);
break;
}
}

static void __init m520x_uarts_init(void)
{
const int nrlines = ARRAY_SIZE(m520x_uart_platform);
int line;
/* UART0 and UART1 GPIO pin setup */
par = readw(MCF_GPIO_PAR_UART);
par |= MCF_GPIO_PAR_UART_PAR_UTXD0 | MCF_GPIO_PAR_UART_PAR_URXD0;
par |= MCF_GPIO_PAR_UART_PAR_UTXD1 | MCF_GPIO_PAR_UART_PAR_URXD1;
writew(par, MCF_GPIO_PAR_UART);

for (line = 0; (line < nrlines); line++)
m520x_uart_init_line(line, m520x_uart_platform[line].irq);
/* UART1 GPIO pin setup */
par2 = readb(MCF_GPIO_PAR_FECI2C);
par2 &= ~0x0F;
par2 |= MCF_GPIO_PAR_FECI2C_PAR_SCL_UTXD2 |
MCF_GPIO_PAR_FECI2C_PAR_SDA_URXD2;
writeb(par2, MCF_GPIO_PAR_FECI2C);
}

/***************************************************************************/
Expand Down

0 comments on commit b92225c

Please sign in to comment.