aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPhil Sutter <n0-1@freewrt.org>2009-01-15 09:38:38 -0500
committerRalf Baechle <ralf@linux-mips.org>2009-01-30 16:33:00 -0500
commit1452fc7d178c37c6463c95c5cc6858c7b7f478c8 (patch)
tree11087b5300be36da1b1fa851c740a4d85c8da20f
parent84c2c562c101bd84ea0f796b9838296da1bf859e (diff)
MIPS: RB532: Detect uart type, add platform device
Auto-detection works just fine, so use it instead of specifying the type manually. Also define a platform device for the uart, as suggested by David Daney. Signed-off-by: Phil Sutter <n0-1@freewrt.org> Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
-rw-r--r--arch/mips/rb532/devices.c26
-rw-r--r--arch/mips/rb532/serial.c2
2 files changed, 27 insertions, 1 deletions
diff --git a/arch/mips/rb532/devices.c b/arch/mips/rb532/devices.c
index c1c29181bd46..9b6b744d8ecc 100644
--- a/arch/mips/rb532/devices.c
+++ b/arch/mips/rb532/devices.c
@@ -24,6 +24,7 @@
24#include <linux/mtd/partitions.h> 24#include <linux/mtd/partitions.h>
25#include <linux/gpio_keys.h> 25#include <linux/gpio_keys.h>
26#include <linux/input.h> 26#include <linux/input.h>
27#include <linux/serial_8250.h>
27 28
28#include <asm/bootinfo.h> 29#include <asm/bootinfo.h>
29 30
@@ -39,6 +40,8 @@
39#define ETH0_RX_DMA_ADDR (DMA0_BASE_ADDR + 0 * DMA_CHAN_OFFSET) 40#define ETH0_RX_DMA_ADDR (DMA0_BASE_ADDR + 0 * DMA_CHAN_OFFSET)
40#define ETH0_TX_DMA_ADDR (DMA0_BASE_ADDR + 1 * DMA_CHAN_OFFSET) 41#define ETH0_TX_DMA_ADDR (DMA0_BASE_ADDR + 1 * DMA_CHAN_OFFSET)
41 42
43extern unsigned int idt_cpu_freq;
44
42static struct resource korina_dev0_res[] = { 45static struct resource korina_dev0_res[] = {
43 { 46 {
44 .name = "korina_regs", 47 .name = "korina_regs",
@@ -214,12 +217,32 @@ static struct platform_device rb532_wdt = {
214 .num_resources = ARRAY_SIZE(rb532_wdt_res), 217 .num_resources = ARRAY_SIZE(rb532_wdt_res),
215}; 218};
216 219
220static struct plat_serial8250_port rb532_uart_res[] = {
221 {
222 .membase = (char *)KSEG1ADDR(REGBASE + UART0BASE),
223 .irq = UART0_IRQ,
224 .regshift = 2,
225 .iotype = UPIO_MEM,
226 .flags = UPF_BOOT_AUTOCONF,
227 },
228 {
229 .flags = 0,
230 }
231};
232
233static struct platform_device rb532_uart = {
234 .name = "serial8250",
235 .id = PLAT8250_DEV_PLATFORM,
236 .dev.platform_data = &rb532_uart_res,
237};
238
217static struct platform_device *rb532_devs[] = { 239static struct platform_device *rb532_devs[] = {
218 &korina_dev0, 240 &korina_dev0,
219 &nand_slot0, 241 &nand_slot0,
220 &cf_slot0, 242 &cf_slot0,
221 &rb532_led, 243 &rb532_led,
222 &rb532_button, 244 &rb532_button,
245 &rb532_uart,
223 &rb532_wdt 246 &rb532_wdt
224}; 247};
225 248
@@ -294,6 +317,9 @@ static int __init plat_setup_devices(void)
294 /* Initialise the NAND device */ 317 /* Initialise the NAND device */
295 rb532_nand_setup(); 318 rb532_nand_setup();
296 319
320 /* set the uart clock to the current cpu frequency */
321 rb532_uart_res[0].uartclk = idt_cpu_freq;
322
297 return platform_add_devices(rb532_devs, ARRAY_SIZE(rb532_devs)); 323 return platform_add_devices(rb532_devs, ARRAY_SIZE(rb532_devs));
298} 324}
299 325
diff --git a/arch/mips/rb532/serial.c b/arch/mips/rb532/serial.c
index 3e0d7ec3a579..00ed19f0bdb5 100644
--- a/arch/mips/rb532/serial.c
+++ b/arch/mips/rb532/serial.c
@@ -36,7 +36,7 @@
36extern unsigned int idt_cpu_freq; 36extern unsigned int idt_cpu_freq;
37 37
38static struct uart_port rb532_uart = { 38static struct uart_port rb532_uart = {
39 .type = PORT_16550A, 39 .flags = UPF_BOOT_AUTOCONF,
40 .line = 0, 40 .line = 0,
41 .irq = UART0_IRQ, 41 .irq = UART0_IRQ,
42 .iotype = UPIO_MEM, 42 .iotype = UPIO_MEM,