aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGreg Ungerer <gerg@uclinux.org>2011-12-23 09:53:54 -0500
committerGreg Ungerer <gerg@uclinux.org>2012-03-04 18:43:06 -0500
commitb92225c7164dd75bca6bb0ebbac1355998fac8ba (patch)
treebb8621d571dbebd9258915dea8f8debf5aa3fda9
parenta579748dc1b5233e13c7b2fdb0f005f93369bb83 (diff)
m68knommu: simplify the 520x UART setup code
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>
-rw-r--r--arch/m68k/platform/520x/config.c42
1 files changed, 12 insertions, 30 deletions
diff --git a/arch/m68k/platform/520x/config.c b/arch/m68k/platform/520x/config.c
index 27c7d056dc1f..fe203bd7a56b 100644
--- a/arch/m68k/platform/520x/config.c
+++ b/arch/m68k/platform/520x/config.c
@@ -227,41 +227,23 @@ static struct platform_device *m520x_devices[] __initdata = {
227 227
228/***************************************************************************/ 228/***************************************************************************/
229 229
230static void __init m520x_uart_init_line(int line, int irq) 230static void __init m520x_uarts_init(void)
231{ 231{
232 u16 par; 232 u16 par;
233 u8 par2; 233 u8 par2;
234 234
235 switch (line) { 235 /* UART0 and UART1 GPIO pin setup */
236 case 0: 236 par = readw(MCF_GPIO_PAR_UART);
237 par = readw(MCF_GPIO_PAR_UART); 237 par |= MCF_GPIO_PAR_UART_PAR_UTXD0 | MCF_GPIO_PAR_UART_PAR_URXD0;
238 par |= MCF_GPIO_PAR_UART_PAR_UTXD0 | 238 par |= MCF_GPIO_PAR_UART_PAR_UTXD1 | MCF_GPIO_PAR_UART_PAR_URXD1;
239 MCF_GPIO_PAR_UART_PAR_URXD0; 239 writew(par, MCF_GPIO_PAR_UART);
240 writew(par, MCF_GPIO_PAR_UART);
241 break;
242 case 1:
243 par = readw(MCF_GPIO_PAR_UART);
244 par |= MCF_GPIO_PAR_UART_PAR_UTXD1 |
245 MCF_GPIO_PAR_UART_PAR_URXD1;
246 writew(par, MCF_GPIO_PAR_UART);
247 break;
248 case 2:
249 par2 = readb(MCF_GPIO_PAR_FECI2C);
250 par2 &= ~0x0F;
251 par2 |= MCF_GPIO_PAR_FECI2C_PAR_SCL_UTXD2 |
252 MCF_GPIO_PAR_FECI2C_PAR_SDA_URXD2;
253 writeb(par2, MCF_GPIO_PAR_FECI2C);
254 break;
255 }
256}
257
258static void __init m520x_uarts_init(void)
259{
260 const int nrlines = ARRAY_SIZE(m520x_uart_platform);
261 int line;
262 240
263 for (line = 0; (line < nrlines); line++) 241 /* UART1 GPIO pin setup */
264 m520x_uart_init_line(line, m520x_uart_platform[line].irq); 242 par2 = readb(MCF_GPIO_PAR_FECI2C);
243 par2 &= ~0x0F;
244 par2 |= MCF_GPIO_PAR_FECI2C_PAR_SCL_UTXD2 |
245 MCF_GPIO_PAR_FECI2C_PAR_SDA_URXD2;
246 writeb(par2, MCF_GPIO_PAR_FECI2C);
265} 247}
266 248
267/***************************************************************************/ 249/***************************************************************************/