vserver 1.9.5.x5
[linux-2.6.git] / arch / arm / mach-omap / board-perseus2.c
1 /*
2  * linux/arch/arm/mach-omap/board-perseus2.c
3  *
4  * Modified from board-generic.c
5  *
6  * Original OMAP730 support by Jean Pihet <j-pihet@ti.com>
7  * Updated for 2.6 by Kevin Hilman <kjh@hilman.org>
8  *
9  * This program is free software; you can redistribute it and/or modify
10  * it under the terms of the GNU General Public License version 2 as
11  * published by the Free Software Foundation.
12  */
13
14 #include <linux/kernel.h>
15 #include <linux/init.h>
16 #include <linux/device.h>
17 #include <linux/delay.h>
18
19 #include <asm/hardware.h>
20 #include <asm/mach-types.h>
21 #include <asm/mach/arch.h>
22 #include <asm/mach/map.h>
23
24 #include <asm/arch/clocks.h>
25 #include <asm/arch/gpio.h>
26 #include <asm/arch/mux.h>
27 #include <asm/arch/fpga.h>
28 #include <asm/arch/serial.h>
29
30 #include "common.h"
31
32 static struct resource smc91x_resources[] = {
33         [0] = {
34                 .start  = H2P2_DBG_FPGA_ETHR_START,     /* Physical */
35                 .end    = H2P2_DBG_FPGA_ETHR_START + SZ_4K,
36                 .flags  = IORESOURCE_MEM,
37         },
38         [1] = {
39                 .start  = INT_730_MPU_EXT_NIRQ,
40                 .end    = 0,
41                 .flags  = IORESOURCE_IRQ,
42         },
43 };
44
45 static int __initdata p2_serial_ports[OMAP_MAX_NR_PORTS] = {1, 1, 0};
46
47 static struct platform_device smc91x_device = {
48         .name           = "smc91x",
49         .id             = 0,
50         .num_resources  = ARRAY_SIZE(smc91x_resources),
51         .resource       = smc91x_resources,
52 };
53
54 static struct platform_device *devices[] __initdata = {
55         &smc91x_device,
56 };
57
58 static void __init omap_perseus2_init(void)
59 {
60         (void) platform_add_devices(devices, ARRAY_SIZE(devices));
61 }
62
63 static void __init perseus2_init_smc91x(void)
64 {
65         fpga_write(1, H2P2_DBG_FPGA_LAN_RESET);
66         mdelay(50);
67         fpga_write(fpga_read(H2P2_DBG_FPGA_LAN_RESET) & ~1,
68                    H2P2_DBG_FPGA_LAN_RESET);
69         mdelay(50);
70 }
71
72 void omap_perseus2_init_irq(void)
73 {
74         omap_init_irq();
75         omap_gpio_init();
76         perseus2_init_smc91x();
77 }
78
79 /* Only FPGA needs to be mapped here. All others are done with ioremap */
80 static struct map_desc omap_perseus2_io_desc[] __initdata = {
81         {H2P2_DBG_FPGA_BASE, H2P2_DBG_FPGA_START, H2P2_DBG_FPGA_SIZE,
82          MT_DEVICE},
83 };
84
85 static void __init omap_perseus2_map_io(void)
86 {
87         omap_map_io();
88         iotable_init(omap_perseus2_io_desc,
89                      ARRAY_SIZE(omap_perseus2_io_desc));
90
91         /* Early, board-dependent init */
92
93         /*
94          * Hold GSM Reset until needed
95          */
96         omap_writew(omap_readw(OMAP730_DSP_M_CTL) & ~1, OMAP730_DSP_M_CTL);
97
98         /*
99          * UARTs -> done automagically by 8250 driver
100          */
101
102         /*
103          * CSx timings, GPIO Mux ... setup
104          */
105
106         /* Flash: CS0 timings setup */
107         omap_writel(0x0000fff3, OMAP730_FLASH_CFG_0);
108         omap_writel(0x00000088, OMAP730_FLASH_ACFG_0);
109
110         /*
111          * Ethernet support trough the debug board
112          * CS1 timings setup
113          */
114         omap_writel(0x0000fff3, OMAP730_FLASH_CFG_1);
115         omap_writel(0x00000000, OMAP730_FLASH_ACFG_1);
116
117         /*
118          * Configure MPU_EXT_NIRQ IO in IO_CONF9 register,
119          * It is used as the Ethernet controller interrupt
120          */
121         omap_writel(omap_readl(OMAP730_IO_CONF_9) & 0x1FFFFFFF, OMAP730_IO_CONF_9);
122         omap_serial_init(p2_serial_ports);
123 }
124
125 MACHINE_START(OMAP_PERSEUS2, "OMAP730 Perseus2")
126         MAINTAINER("Kevin Hilman <kjh@hilman.org>")
127         BOOT_MEM(0x10000000, 0xfff00000, 0xfef00000)
128         BOOT_PARAMS(0x10000100)
129         MAPIO(omap_perseus2_map_io)
130         INITIRQ(omap_perseus2_init_irq)
131         INIT_MACHINE(omap_perseus2_init)
132         .timer          = &omap_timer,
133 MACHINE_END