[SCSI] net: add FCoE offload support through net_device
[linux-2.6/mini2440.git] / arch / arm / mach-w90x900 / w90p910.c
blobaa783bc943109d6a9fb4f4cf95f1d74782762032
1 /*
2 * linux/arch/arm/mach-w90x900/w90p910.c
4 * Based on linux/arch/arm/plat-s3c24xx/s3c244x.c by Ben Dooks
6 * Copyright (c) 2008 Nuvoton technology corporation
7 * All rights reserved.
9 * Wan ZongShun <mcuos.com@gmail.com>
11 * W90P910 cpu support
13 * This program is free software; you can redistribute it and/or modify
14 * it under the terms of the GNU General Public License as published by
15 * the Free Software Foundation; either version 2 of the License, or
16 * (at your option) any later version.
20 #include <linux/kernel.h>
21 #include <linux/types.h>
22 #include <linux/interrupt.h>
23 #include <linux/list.h>
24 #include <linux/timer.h>
25 #include <linux/init.h>
26 #include <linux/platform_device.h>
27 #include <linux/io.h>
29 #include <asm/mach/arch.h>
30 #include <asm/mach/map.h>
31 #include <asm/mach/irq.h>
32 #include <asm/irq.h>
34 #include <mach/hardware.h>
35 #include <mach/regs-serial.h>
37 #include "cpu.h"
39 /*W90P910 has five uarts*/
41 #define MAX_UART_COUNT 5
42 static int uart_count;
43 static struct platform_device *uart_devs[MAX_UART_COUNT-1];
45 /* Initial IO mappings */
47 static struct map_desc w90p910_iodesc[] __initdata = {
48 IODESC_ENT(IRQ),
49 IODESC_ENT(GCR),
50 IODESC_ENT(UART),
51 IODESC_ENT(TIMER),
52 IODESC_ENT(EBI),
53 /*IODESC_ENT(LCD),*/
56 /*Init the dev resource*/
58 static W90X900_RES(UART0);
59 static W90X900_RES(UART1);
60 static W90X900_RES(UART2);
61 static W90X900_RES(UART3);
62 static W90X900_RES(UART4);
63 static W90X900_DEVICE(uart0, UART0, 0, "w90x900-uart");
64 static W90X900_DEVICE(uart1, UART1, 1, "w90x900-uart");
65 static W90X900_DEVICE(uart2, UART2, 2, "w90x900-uart");
66 static W90X900_DEVICE(uart3, UART3, 3, "w90x900-uart");
67 static W90X900_DEVICE(uart4, UART4, 4, "w90x900-uart");
69 static struct platform_device *uart_devices[] __initdata = {
70 &w90x900_uart0,
71 &w90x900_uart1,
72 &w90x900_uart2,
73 &w90x900_uart3,
74 &w90x900_uart4
77 /*Init W90P910 uart device*/
79 void __init w90p910_init_uarts(struct w90x900_uartcfg *cfg, int no)
81 struct platform_device *platdev;
82 int uart, uartdev;
84 /*By min() to judge count of uart be used indeed*/
86 uartdev = ARRAY_SIZE(uart_devices);
87 no = min(uartdev, no);
89 for (uart = 0; uart < no; uart++, cfg++) {
90 if (cfg->hwport != uart)
91 printk(KERN_ERR "w90x900_uartcfg[%d] error\n", uart);
92 platdev = uart_devices[cfg->hwport];
93 uart_devs[uart] = platdev;
94 platdev->dev.platform_data = cfg;
96 uart_count = uart;
99 /*Init W90P910 evb io*/
101 void __init w90p910_map_io(struct map_desc *mach_desc, int mach_size)
103 unsigned long idcode = 0x0;
105 iotable_init(w90p910_iodesc, ARRAY_SIZE(w90p910_iodesc));
107 idcode = __raw_readl(W90X900PDID);
108 if (idcode != W90P910_CPUID)
109 printk(KERN_ERR "CPU type 0x%08lx is not W90P910\n", idcode);
112 /*Init W90P910 clock*/
114 void __init w90p910_init_clocks(int xtal)
118 static int __init w90p910_init_cpu(void)
120 return 0;
123 static int __init w90x900_arch_init(void)
125 int ret;
127 ret = w90p910_init_cpu();
128 if (ret != 0)
129 return ret;
131 return platform_add_devices(uart_devs, uart_count);
134 arch_initcall(w90x900_arch_init);