]> pilppa.org Git - linux-2.6-omap-h63xx.git/blob - arch/arm/mach-omap2/board-h4.c
ARM: OMAP: Make sure omap_gpio_init is called for all boards
[linux-2.6-omap-h63xx.git] / arch / arm / mach-omap2 / board-h4.c
1 /*
2  * linux/arch/arm/mach-omap/omap2/board-h4.c
3  *
4  * Copyright (C) 2005 Nokia Corporation
5  * Author: Paul Mundt <paul.mundt@nokia.com>
6  *
7  * Modified from mach-omap/omap1/board-generic.c
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/mtd/mtd.h>
18 #include <linux/mtd/partitions.h>
19 #include <linux/delay.h>
20
21 #include <asm/hardware.h>
22 #include <asm/mach-types.h>
23 #include <asm/mach/arch.h>
24 #include <asm/mach/map.h>
25 #include <asm/mach/flash.h>
26
27 #include <asm/arch/gpio.h>
28 #include <asm/arch/mux.h>
29 #include <asm/arch/usb.h>
30 #include <asm/arch/board.h>
31 #include <asm/arch/common.h>
32 #include <asm/arch/prcm.h>
33
34 #include <asm/io.h>
35 #include <asm/delay.h>
36
37 extern int omap_gpio_init(void);
38
39 static struct mtd_partition h4_partitions[] = {
40         /* bootloader (U-Boot, etc) in first sector */
41         {
42               .name             = "bootloader",
43               .offset           = 0,
44               .size             = SZ_128K,
45               .mask_flags       = MTD_WRITEABLE, /* force read-only */
46         },
47         /* bootloader params in the next sector */
48         {
49               .name             = "params",
50               .offset           = MTDPART_OFS_APPEND,
51               .size             = SZ_128K,
52               .mask_flags       = 0,
53         },
54         /* kernel */
55         {
56               .name             = "kernel",
57               .offset           = MTDPART_OFS_APPEND,
58               .size             = SZ_2M,
59               .mask_flags       = 0
60         },
61         /* file system */
62         {
63               .name             = "filesystem",
64               .offset           = MTDPART_OFS_APPEND,
65               .size             = MTDPART_SIZ_FULL,
66               .mask_flags       = 0
67         }
68 };
69
70 static struct flash_platform_data h4_flash_data = {
71         .map_name       = "cfi_probe",
72         .width          = 2,
73         .parts          = h4_partitions,
74         .nr_parts       = ARRAY_SIZE(h4_partitions),
75 };
76
77 static struct resource h4_flash_resource = {
78         .start          = H4_CS0_BASE,
79         .end            = H4_CS0_BASE + SZ_64M - 1,
80         .flags          = IORESOURCE_MEM,
81 };
82
83 static struct platform_device h4_flash_device = {
84         .name           = "omapflash",
85         .id             = 0,
86         .dev            = {
87                 .platform_data  = &h4_flash_data,
88         },
89         .num_resources  = 1,
90         .resource       = &h4_flash_resource,
91 };
92
93 static struct resource h4_smc91x_resources[] = {
94         [0] = {
95                 .start  = OMAP24XX_ETHR_START,          /* Physical */
96                 .end    = OMAP24XX_ETHR_START + 0xf,
97                 .flags  = IORESOURCE_MEM,
98         },
99         [1] = {
100                 .start  = OMAP_GPIO_IRQ(OMAP24XX_ETHR_GPIO_IRQ),
101                 .end    = OMAP_GPIO_IRQ(OMAP24XX_ETHR_GPIO_IRQ),
102                 .flags  = IORESOURCE_IRQ,
103         },
104 };
105
106 static struct platform_device h4_smc91x_device = {
107         .name           = "smc91x",
108         .id             = -1,
109         .num_resources  = ARRAY_SIZE(h4_smc91x_resources),
110         .resource       = h4_smc91x_resources,
111 };
112
113 static struct platform_device *h4_devices[] __initdata = {
114         &h4_smc91x_device,
115         &h4_flash_device,
116 };
117
118 static inline void __init h4_init_smc91x(void)
119 {
120         /* Make sure CS1 timings are correct */
121         GPMC_CONFIG1_1 = 0x00011200;
122         GPMC_CONFIG2_1 = 0x001f1f01;
123         GPMC_CONFIG3_1 = 0x00080803;
124         GPMC_CONFIG4_1 = 0x1c091c09;
125         GPMC_CONFIG5_1 = 0x041f1f1f;
126         GPMC_CONFIG6_1 = 0x000004c4;
127         GPMC_CONFIG7_1 = 0x00000f40 | (0x08000000 >> 24);
128         udelay(100);
129
130         omap_cfg_reg(M15_24XX_GPIO92);
131         if (omap_request_gpio(OMAP24XX_ETHR_GPIO_IRQ) < 0) {
132                 printk(KERN_ERR "Failed to request GPIO%d for smc91x IRQ\n",
133                         OMAP24XX_ETHR_GPIO_IRQ);
134                 return;
135         }
136         omap_set_gpio_direction(OMAP24XX_ETHR_GPIO_IRQ, 1);
137 }
138
139 static void __init omap_h4_init_irq(void)
140 {
141         omap_init_irq();
142         omap_gpio_init();
143         h4_init_smc91x();
144 }
145
146 static struct omap_uart_config h4_uart_config __initdata = {
147         .enabled_uarts = ((1 << 0) | (1 << 1) | (1 << 2)),
148 };
149
150 static struct omap_mmc_config h4_mmc_config __initdata = {
151         .mmc [0] = {
152                 .enabled        = 1,
153                 .wire4          = 1,
154                 .wp_pin         = -1,
155                 .power_pin      = -1,
156                 .switch_pin     = -1,
157         },
158 };
159
160 static struct omap_board_config_kernel h4_config[] = {
161         { OMAP_TAG_UART,        &h4_uart_config },
162         { OMAP_TAG_MMC,         &h4_mmc_config },
163 };
164
165 static void __init omap_h4_init(void)
166 {
167         /*
168          * Make sure the serial ports are muxed on at this point.
169          * You have to mux them off in device drivers later on
170          * if not needed.
171          */
172         platform_add_devices(h4_devices, ARRAY_SIZE(h4_devices));
173         omap_board_config = h4_config;
174         omap_board_config_size = ARRAY_SIZE(h4_config);
175         omap_serial_init();
176 }
177
178 static void __init omap_h4_map_io(void)
179 {
180         omap_map_common_io();
181 }
182
183 MACHINE_START(OMAP_H4, "OMAP2420 H4 board")
184         /* Maintainer: Paul Mundt <paul.mundt@nokia.com> */
185         .phys_ram       = 0x80000000,
186         .phys_io        = 0x48000000,
187         .io_pg_offst    = ((0xd8000000) >> 18) & 0xfffc,
188         .boot_params    = 0x80000100,
189         .map_io         = omap_h4_map_io,
190         .init_irq       = omap_h4_init_irq,
191         .init_machine   = omap_h4_init,
192         .timer          = &omap_timer,
193 MACHINE_END