Commit 6e766458f78ca15198cf046bc098b36e40c8b471

Authored by Sergei Shtylyov
Committed by Ralf Baechle
1 parent ce28f94ca5

[MIPS] Alchemy: move UART platform code to its proper place

Move the code registering the Alchemy UART platform devices from
drivers/serial/ to its proper place, into the Alchemy platform code.  Fix
the related Kconfig entry, while at it...

Signed-off-by: Sergei Shtylyov <sshtylyov@ru.mvista.com>
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>

Showing 4 changed files with 61 additions and 105 deletions Side-by-side Diff

arch/mips/au1000/common/platform.c
... ... @@ -3,16 +3,65 @@
3 3 *
4 4 * Copyright 2004, Matt Porter <mporter@kernel.crashing.org>
5 5 *
  6 + * (C) Copyright Embedded Alley Solutions, Inc 2005
  7 + * Author: Pantelis Antoniou <pantelis@embeddedalley.com>
  8 + *
6 9 * This file is licensed under the terms of the GNU General Public
7 10 * License version 2. This program is licensed "as is" without any
8 11 * warranty of any kind, whether express or implied.
9 12 */
10 13  
11 14 #include <linux/platform_device.h>
  15 +#include <linux/serial_8250.h>
12 16 #include <linux/init.h>
13 17  
14 18 #include <asm/mach-au1x00/au1xxx.h>
15 19  
  20 +#define PORT(_base, _irq) \
  21 + { \
  22 + .iobase = _base, \
  23 + .membase = (void __iomem *)_base,\
  24 + .mapbase = CPHYSADDR(_base), \
  25 + .irq = _irq, \
  26 + .regshift = 2, \
  27 + .iotype = UPIO_AU, \
  28 + .flags = UPF_SKIP_TEST \
  29 + }
  30 +
  31 +static struct plat_serial8250_port au1x00_uart_data[] = {
  32 +#if defined(CONFIG_SERIAL_8250_AU1X00)
  33 +#if defined(CONFIG_SOC_AU1000)
  34 + PORT(UART0_ADDR, AU1000_UART0_INT),
  35 + PORT(UART1_ADDR, AU1000_UART1_INT),
  36 + PORT(UART2_ADDR, AU1000_UART2_INT),
  37 + PORT(UART3_ADDR, AU1000_UART3_INT),
  38 +#elif defined(CONFIG_SOC_AU1500)
  39 + PORT(UART0_ADDR, AU1500_UART0_INT),
  40 + PORT(UART3_ADDR, AU1500_UART3_INT),
  41 +#elif defined(CONFIG_SOC_AU1100)
  42 + PORT(UART0_ADDR, AU1100_UART0_INT),
  43 + PORT(UART1_ADDR, AU1100_UART1_INT),
  44 + PORT(UART3_ADDR, AU1100_UART3_INT),
  45 +#elif defined(CONFIG_SOC_AU1550)
  46 + PORT(UART0_ADDR, AU1550_UART0_INT),
  47 + PORT(UART1_ADDR, AU1550_UART1_INT),
  48 + PORT(UART3_ADDR, AU1550_UART3_INT),
  49 +#elif defined(CONFIG_SOC_AU1200)
  50 + PORT(UART0_ADDR, AU1200_UART0_INT),
  51 + PORT(UART1_ADDR, AU1200_UART1_INT),
  52 +#endif
  53 +#endif /* CONFIG_SERIAL_8250_AU1X00 */
  54 + { },
  55 +};
  56 +
  57 +static struct platform_device au1xx0_uart_device = {
  58 + .name = "serial8250",
  59 + .id = PLAT8250_DEV_AU1X00,
  60 + .dev = {
  61 + .platform_data = au1x00_uart_data,
  62 + },
  63 +};
  64 +
16 65 /* OHCI (USB full speed host controller) */
17 66 static struct resource au1xxx_usb_ohci_resources[] = {
18 67 [0] = {
... ... @@ -287,6 +336,7 @@
287 336 #endif
288 337  
289 338 static struct platform_device *au1xxx_platform_devices[] __initdata = {
  339 + &au1xx0_uart_device,
290 340 &au1xxx_usb_ohci_device,
291 341 &au1x00_pcmcia_device,
292 342 #ifdef CONFIG_FB_AU1100
... ... @@ -310,6 +360,13 @@
310 360  
311 361 int __init au1xxx_platform_init(void)
312 362 {
  363 + unsigned int uartclk = get_au1x00_uart_baud_base() * 16;
  364 + int i;
  365 +
  366 + /* Fill up uartclk. */
  367 + for (i = 0; au1x00_uart_data[i].flags ; i++)
  368 + au1x00_uart_data[i].uartclk = uartclk;
  369 +
313 370 return platform_add_devices(au1xxx_platform_devices, ARRAY_SIZE(au1xxx_platform_devices));
314 371 }
315 372  
drivers/serial/8250_au1x00.c
1   -/*
2   - * Serial Device Initialisation for Au1x00
3   - *
4   - * (C) Copyright Embedded Alley Solutions, Inc 2005
5   - * Author: Pantelis Antoniou <pantelis@embeddedalley.com>
6   - *
7   - * This program is free software; you can redistribute it and/or modify
8   - * it under the terms of the GNU General Public License as published by
9   - * the Free Software Foundation; either version 2 of the License, or
10   - * (at your option) any later version.
11   - */
12   -
13   -#include <linux/errno.h>
14   -#include <linux/init.h>
15   -#include <linux/interrupt.h>
16   -#include <linux/ioport.h>
17   -#include <linux/module.h>
18   -#include <linux/serial_core.h>
19   -#include <linux/signal.h>
20   -#include <linux/slab.h>
21   -#include <linux/types.h>
22   -
23   -#include <linux/serial_8250.h>
24   -
25   -#include <asm/mach-au1x00/au1000.h>
26   -
27   -#include "8250.h"
28   -
29   -#define PORT(_base, _irq) \
30   - { \
31   - .iobase = _base, \
32   - .membase = (void __iomem *)_base,\
33   - .mapbase = CPHYSADDR(_base), \
34   - .irq = _irq, \
35   - .uartclk = 0, /* filled */ \
36   - .regshift = 2, \
37   - .iotype = UPIO_AU, \
38   - .flags = UPF_SKIP_TEST \
39   - }
40   -
41   -static struct plat_serial8250_port au1x00_data[] = {
42   -#if defined(CONFIG_SOC_AU1000)
43   - PORT(UART0_ADDR, AU1000_UART0_INT),
44   - PORT(UART1_ADDR, AU1000_UART1_INT),
45   - PORT(UART2_ADDR, AU1000_UART2_INT),
46   - PORT(UART3_ADDR, AU1000_UART3_INT),
47   -#elif defined(CONFIG_SOC_AU1500)
48   - PORT(UART0_ADDR, AU1500_UART0_INT),
49   - PORT(UART3_ADDR, AU1500_UART3_INT),
50   -#elif defined(CONFIG_SOC_AU1100)
51   - PORT(UART0_ADDR, AU1100_UART0_INT),
52   - PORT(UART1_ADDR, AU1100_UART1_INT),
53   - /* The internal UART2 does not exist on the AU1100 processor. */
54   - PORT(UART3_ADDR, AU1100_UART3_INT),
55   -#elif defined(CONFIG_SOC_AU1550)
56   - PORT(UART0_ADDR, AU1550_UART0_INT),
57   - PORT(UART1_ADDR, AU1550_UART1_INT),
58   - PORT(UART3_ADDR, AU1550_UART3_INT),
59   -#elif defined(CONFIG_SOC_AU1200)
60   - PORT(UART0_ADDR, AU1200_UART0_INT),
61   - PORT(UART1_ADDR, AU1200_UART1_INT),
62   -#endif
63   - { },
64   -};
65   -
66   -static struct platform_device au1x00_device = {
67   - .name = "serial8250",
68   - .id = PLAT8250_DEV_AU1X00,
69   - .dev = {
70   - .platform_data = au1x00_data,
71   - },
72   -};
73   -
74   -static int __init au1x00_init(void)
75   -{
76   - int i;
77   - unsigned int uartclk;
78   -
79   - /* get uart clock */
80   - uartclk = get_au1x00_uart_baud_base() * 16;
81   -
82   - /* fill up uartclk */
83   - for (i = 0; au1x00_data[i].flags ; i++)
84   - au1x00_data[i].uartclk = uartclk;
85   -
86   - return platform_device_register(&au1x00_device);
87   -}
88   -
89   -/* XXX: Yes, I know this doesn't yet work. */
90   -static void __exit au1x00_exit(void)
91   -{
92   - platform_device_unregister(&au1x00_device);
93   -}
94   -
95   -module_init(au1x00_init);
96   -module_exit(au1x00_exit);
97   -
98   -MODULE_AUTHOR("Pantelis Antoniou <pantelis@embeddedalley.com>");
99   -MODULE_DESCRIPTION("8250 serial probe module for Au1x000 cards");
100   -MODULE_LICENSE("GPL");
drivers/serial/Kconfig
... ... @@ -262,12 +262,12 @@
262 262 cards. If unsure, say N.
263 263  
264 264 config SERIAL_8250_AU1X00
265   - bool "AU1X00 serial port support"
  265 + bool "Au1x00 serial port support"
266 266 depends on SERIAL_8250 != n && SOC_AU1X00
267 267 help
268   - If you have an Au1x00 board and want to use the serial port, say Y
269   - to this option. The driver can handle 1 or 2 serial ports.
270   - If unsure, say N.
  268 + If you have an Au1x00 SOC based board and want to use the serial port,
  269 + say Y to this option. The driver can handle up to 4 serial ports,
  270 + depending on the SOC. If unsure, say N.
271 271  
272 272 config SERIAL_8250_RM9K
273 273 bool "Support for MIPS RM9xxx integrated serial port"
drivers/serial/Makefile
... ... @@ -20,7 +20,6 @@
20 20 obj-$(CONFIG_SERIAL_8250_EXAR_ST16C554) += 8250_exar_st16c554.o
21 21 obj-$(CONFIG_SERIAL_8250_HUB6) += 8250_hub6.o
22 22 obj-$(CONFIG_SERIAL_8250_MCA) += 8250_mca.o
23   -obj-$(CONFIG_SERIAL_8250_AU1X00) += 8250_au1x00.o
24 23 obj-$(CONFIG_SERIAL_AMBA_PL010) += amba-pl010.o
25 24 obj-$(CONFIG_SERIAL_AMBA_PL011) += amba-pl011.o
26 25 obj-$(CONFIG_SERIAL_CLPS711X) += clps711x.o