Merge branch 'battery' into release
[deliverable/linux.git] / arch / arm / mach-at91 / board-ecbat91.c
1 /*
2 * linux/arch/arm/mach-at91rm9200/board-ecbat91.c
3 * Copyright (C) 2007 emQbit.com.
4 *
5 * We started from board-dk.c, which is Copyright (C) 2005 SAN People.
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 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 */
21
22 #include <linux/types.h>
23 #include <linux/init.h>
24 #include <linux/mm.h>
25 #include <linux/module.h>
26 #include <linux/platform_device.h>
27 #include <linux/spi/spi.h>
28 #include <linux/spi/flash.h>
29
30 #include <mach/hardware.h>
31 #include <asm/setup.h>
32 #include <asm/mach-types.h>
33 #include <asm/irq.h>
34
35 #include <asm/mach/arch.h>
36 #include <asm/mach/map.h>
37 #include <asm/mach/irq.h>
38
39 #include <mach/board.h>
40 #include <mach/gpio.h>
41 #include <mach/cpu.h>
42
43 #include "generic.h"
44
45
46 static void __init ecb_at91init_early(void)
47 {
48 /* Set cpu type: PQFP */
49 at91rm9200_set_type(ARCH_REVISON_9200_PQFP);
50
51 /* Initialize processor: 18.432 MHz crystal */
52 at91_initialize(18432000);
53
54 /* Setup the LEDs */
55 at91_init_leds(AT91_PIN_PC7, AT91_PIN_PC7);
56
57 /* DBGU on ttyS0. (Rx & Tx only) */
58 at91_register_uart(0, 0, 0);
59
60 /* USART0 on ttyS1. (Rx & Tx only) */
61 at91_register_uart(AT91RM9200_ID_US0, 1, 0);
62
63 /* set serial console to ttyS0 (ie, DBGU) */
64 at91_set_serial_console(0);
65 }
66
67 static struct at91_eth_data __initdata ecb_at91eth_data = {
68 .phy_irq_pin = AT91_PIN_PC4,
69 .is_rmii = 0,
70 };
71
72 static struct at91_usbh_data __initdata ecb_at91usbh_data = {
73 .ports = 1,
74 };
75
76 static struct at91_mmc_data __initdata ecb_at91mmc_data = {
77 .slot_b = 0,
78 .wire4 = 1,
79 };
80
81
82 #if defined(CONFIG_MTD_DATAFLASH)
83 static struct mtd_partition __initdata my_flash0_partitions[] =
84 {
85 { /* 0x8400 */
86 .name = "Darrell-loader",
87 .offset = 0,
88 .size = 12 * 1056,
89 },
90 {
91 .name = "U-boot",
92 .offset = MTDPART_OFS_NXTBLK,
93 .size = 110 * 1056,
94 },
95 { /* 1336 (167 blocks) pages * 1056 bytes = 0x158700 bytes */
96 .name = "UBoot-env",
97 .offset = MTDPART_OFS_NXTBLK,
98 .size = 8 * 1056,
99 },
100 { /* 1336 (167 blocks) pages * 1056 bytes = 0x158700 bytes */
101 .name = "Kernel",
102 .offset = MTDPART_OFS_NXTBLK,
103 .size = 1534 * 1056,
104 },
105 { /* 190200 - jffs2 root filesystem */
106 .name = "Filesystem",
107 .offset = MTDPART_OFS_NXTBLK,
108 .size = MTDPART_SIZ_FULL, /* 26 sectors */
109 }
110 };
111
112 static struct flash_platform_data __initdata my_flash0_platform = {
113 .name = "Removable flash card",
114 .parts = my_flash0_partitions,
115 .nr_parts = ARRAY_SIZE(my_flash0_partitions)
116 };
117
118 #endif
119
120 static struct spi_board_info __initdata ecb_at91spi_devices[] = {
121 { /* DataFlash chip */
122 .modalias = "mtd_dataflash",
123 .chip_select = 0,
124 .max_speed_hz = 10 * 1000 * 1000,
125 .bus_num = 0,
126 #if defined(CONFIG_MTD_DATAFLASH)
127 .platform_data = &my_flash0_platform,
128 #endif
129 },
130 { /* User accessible spi - cs1 (250KHz) */
131 .modalias = "spi-cs1",
132 .chip_select = 1,
133 .max_speed_hz = 250 * 1000,
134 },
135 { /* User accessible spi - cs2 (1MHz) */
136 .modalias = "spi-cs2",
137 .chip_select = 2,
138 .max_speed_hz = 1 * 1000 * 1000,
139 },
140 { /* User accessible spi - cs3 (10MHz) */
141 .modalias = "spi-cs3",
142 .chip_select = 3,
143 .max_speed_hz = 10 * 1000 * 1000,
144 },
145 };
146
147 static void __init ecb_at91board_init(void)
148 {
149 /* Serial */
150 at91_add_device_serial();
151
152 /* Ethernet */
153 at91_add_device_eth(&ecb_at91eth_data);
154
155 /* USB Host */
156 at91_add_device_usbh(&ecb_at91usbh_data);
157
158 /* I2C */
159 at91_add_device_i2c(NULL, 0);
160
161 /* MMC */
162 at91_add_device_mmc(0, &ecb_at91mmc_data);
163
164 /* SPI */
165 at91_add_device_spi(ecb_at91spi_devices, ARRAY_SIZE(ecb_at91spi_devices));
166 }
167
168 MACHINE_START(ECBAT91, "emQbit's ECB_AT91")
169 /* Maintainer: emQbit.com */
170 .timer = &at91rm9200_timer,
171 .map_io = at91_map_io,
172 .init_early = ecb_at91init_early,
173 .init_irq = at91_init_irq_default,
174 .init_machine = ecb_at91board_init,
175 MACHINE_END
This page took 0.038467 seconds and 6 git commands to generate.