Commit | Line | Data |
---|---|---|
9c784f95 SL |
1 | /* |
2 | * linux/arch/arm/mach-at91/board-afeb-9260v1.c | |
3 | * | |
4 | * Copyright (C) 2005 SAN People | |
5 | * Copyright (C) 2006 Atmel | |
6 | * Copyright (C) 2008 Sergey Lapin | |
7 | * | |
8 | * A custom board designed as open hardware; PCBs and various information | |
9 | * is available at http://groups.google.com/group/arm9fpga-evolution-board/ | |
10 | * Subversion repository: svn://194.85.238.22/home/users/george/svn/arm9eb | |
11 | * | |
12 | * This program is free software; you can redistribute it and/or modify | |
13 | * it under the terms of the GNU General Public License as published by | |
14 | * the Free Software Foundation; either version 2 of the License, or | |
15 | * (at your option) any later version. | |
16 | * | |
17 | * This program is distributed in the hope that it will be useful, | |
18 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
19 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
20 | * GNU General Public License for more details. | |
21 | * | |
22 | * You should have received a copy of the GNU General Public License | |
23 | * along with this program; if not, write to the Free Software | |
24 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |
25 | */ | |
26 | ||
27 | #include <linux/types.h> | |
2f8163ba | 28 | #include <linux/gpio.h> |
9c784f95 SL |
29 | #include <linux/init.h> |
30 | #include <linux/mm.h> | |
31 | #include <linux/module.h> | |
32 | #include <linux/platform_device.h> | |
33 | #include <linux/spi/spi.h> | |
34 | #include <linux/clk.h> | |
35 | #include <linux/dma-mapping.h> | |
36 | ||
37 | #include <mach/hardware.h> | |
38 | #include <asm/setup.h> | |
39 | #include <asm/mach-types.h> | |
40 | #include <asm/irq.h> | |
41 | ||
42 | #include <asm/mach/arch.h> | |
43 | #include <asm/mach/map.h> | |
44 | #include <asm/mach/irq.h> | |
45 | ||
a510b9ba | 46 | #include "at91_aic.h" |
43d2f532 | 47 | #include "board.h" |
9c784f95 SL |
48 | #include "generic.h" |
49 | ||
50 | ||
1b021a3b | 51 | static void __init afeb9260_init_early(void) |
9c784f95 SL |
52 | { |
53 | /* Initialize processor: 18.432 MHz crystal */ | |
21d08b9d | 54 | at91_initialize(18432000); |
9c784f95 SL |
55 | } |
56 | ||
9c784f95 SL |
57 | /* |
58 | * USB Host port | |
59 | */ | |
60 | static struct at91_usbh_data __initdata afeb9260_usbh_data = { | |
61 | .ports = 1, | |
63b4c296 JCPV |
62 | .vbus_pin = {-EINVAL, -EINVAL}, |
63 | .overcurrent_pin= {-EINVAL, -EINVAL}, | |
9c784f95 SL |
64 | }; |
65 | ||
66 | /* | |
67 | * USB Device port | |
68 | */ | |
69 | static struct at91_udc_data __initdata afeb9260_udc_data = { | |
70 | .vbus_pin = AT91_PIN_PC5, | |
63b4c296 | 71 | .pullup_pin = -EINVAL, /* pull-up driven by UDC */ |
9c784f95 SL |
72 | }; |
73 | ||
74 | ||
75 | ||
76 | /* | |
77 | * SPI devices. | |
78 | */ | |
79 | static struct spi_board_info afeb9260_spi_devices[] = { | |
80 | { /* DataFlash chip */ | |
81 | .modalias = "mtd_dataflash", | |
82 | .chip_select = 1, | |
83 | .max_speed_hz = 15 * 1000 * 1000, | |
84 | .bus_num = 0, | |
85 | }, | |
86 | }; | |
87 | ||
88 | ||
53d4351f SL |
89 | /* |
90 | * MACB Ethernet device | |
91 | */ | |
84e0cdb0 | 92 | static struct macb_platform_data __initdata afeb9260_macb_data = { |
53d4351f SL |
93 | .phy_irq_pin = AT91_PIN_PA9, |
94 | .is_rmii = 0, | |
95 | }; | |
96 | ||
9c784f95 SL |
97 | |
98 | /* | |
99 | * NAND flash | |
100 | */ | |
101 | static struct mtd_partition __initdata afeb9260_nand_partition[] = { | |
102 | { | |
103 | .name = "bootloader", | |
104 | .offset = 0, | |
105 | .size = (640 * SZ_1K), | |
106 | }, | |
107 | { | |
108 | .name = "kernel", | |
109 | .offset = MTDPART_OFS_NXTBLK, | |
110 | .size = SZ_2M, | |
111 | }, | |
112 | { | |
113 | .name = "rootfs", | |
114 | .offset = MTDPART_OFS_NXTBLK, | |
115 | .size = MTDPART_SIZ_FULL, | |
116 | }, | |
117 | }; | |
118 | ||
9c784f95 SL |
119 | static struct atmel_nand_data __initdata afeb9260_nand_data = { |
120 | .ale = 21, | |
121 | .cle = 22, | |
122 | .rdy_pin = AT91_PIN_PC13, | |
123 | .enable_pin = AT91_PIN_PC14, | |
9c784f95 | 124 | .bus_width_16 = 0, |
bf4289cb | 125 | .ecc_mode = NAND_ECC_SOFT, |
1754aab9 DES |
126 | .parts = afeb9260_nand_partition, |
127 | .num_parts = ARRAY_SIZE(afeb9260_nand_partition), | |
63b4c296 | 128 | .det_pin = -EINVAL, |
9c784f95 SL |
129 | }; |
130 | ||
131 | ||
132 | /* | |
133 | * MCI (SD/MMC) | |
134 | */ | |
4cf3326a LD |
135 | static struct mci_platform_data __initdata afeb9260_mci0_data = { |
136 | .slot[1] = { | |
137 | .bus_width = 4, | |
138 | .detect_pin = AT91_PIN_PC9, | |
139 | .wp_pin = AT91_PIN_PC4, | |
140 | }, | |
9c784f95 SL |
141 | }; |
142 | ||
143 | ||
144 | ||
145 | static struct i2c_board_info __initdata afeb9260_i2c_devices[] = { | |
146 | { | |
34e559ea SL |
147 | I2C_BOARD_INFO("tlv320aic23", 0x1a), |
148 | }, { | |
9c784f95 | 149 | I2C_BOARD_INFO("fm3130", 0x68), |
b73b925a | 150 | }, { |
9c784f95 SL |
151 | I2C_BOARD_INFO("24c64", 0x50), |
152 | }, | |
153 | }; | |
154 | ||
0c30df6f SM |
155 | /* |
156 | * IDE (CF True IDE mode) | |
157 | */ | |
158 | static struct at91_cf_data afeb9260_cf_data = { | |
159 | .chipselect = 4, | |
160 | .irq_pin = AT91_PIN_PA6, | |
63b4c296 JCPV |
161 | .det_pin = -EINVAL, |
162 | .vcc_pin = -EINVAL, | |
0c30df6f SM |
163 | .rst_pin = AT91_PIN_PA7, |
164 | .flags = AT91_CF_TRUE_IDE, | |
165 | }; | |
166 | ||
9c784f95 SL |
167 | static void __init afeb9260_board_init(void) |
168 | { | |
169 | /* Serial */ | |
71b149b3 JCPV |
170 | /* DBGU on ttyS0. (Rx & Tx only) */ |
171 | at91_register_uart(0, 0, 0); | |
172 | ||
173 | /* USART0 on ttyS1. (Rx, Tx, CTS, RTS, DTR, DSR, DCD, RI) */ | |
174 | at91_register_uart(AT91SAM9260_ID_US0, 1, | |
175 | ATMEL_UART_CTS | ATMEL_UART_RTS | |
176 | | ATMEL_UART_DTR | ATMEL_UART_DSR | |
177 | | ATMEL_UART_DCD | ATMEL_UART_RI); | |
178 | ||
179 | /* USART1 on ttyS2. (Rx, Tx, RTS, CTS) */ | |
180 | at91_register_uart(AT91SAM9260_ID_US1, 2, | |
181 | ATMEL_UART_CTS | ATMEL_UART_RTS); | |
9c784f95 SL |
182 | at91_add_device_serial(); |
183 | /* USB Host */ | |
184 | at91_add_device_usbh(&afeb9260_usbh_data); | |
185 | /* USB Device */ | |
186 | at91_add_device_udc(&afeb9260_udc_data); | |
187 | /* SPI */ | |
188 | at91_add_device_spi(afeb9260_spi_devices, | |
189 | ARRAY_SIZE(afeb9260_spi_devices)); | |
190 | /* NAND */ | |
191 | at91_add_device_nand(&afeb9260_nand_data); | |
53d4351f SL |
192 | /* Ethernet */ |
193 | at91_add_device_eth(&afeb9260_macb_data); | |
194 | ||
195 | /* Standard function's pin assignments are not | |
196 | * appropriate for us and generic code provide | |
197 | * no API to configure these pins any other way */ | |
198 | at91_set_B_periph(AT91_PIN_PA10, 0); /* ETX2 */ | |
199 | at91_set_B_periph(AT91_PIN_PA11, 0); /* ETX3 */ | |
9c784f95 | 200 | /* MMC */ |
4cf3326a | 201 | at91_add_device_mci(0, &afeb9260_mci0_data); |
9c784f95 SL |
202 | /* I2C */ |
203 | at91_add_device_i2c(afeb9260_i2c_devices, | |
204 | ARRAY_SIZE(afeb9260_i2c_devices)); | |
34e559ea SL |
205 | /* Audio */ |
206 | at91_add_device_ssc(AT91SAM9260_ID_SSC, ATMEL_SSC_TX); | |
0c30df6f SM |
207 | /* IDE */ |
208 | at91_add_device_cf(&afeb9260_cf_data); | |
9c784f95 SL |
209 | } |
210 | ||
211 | MACHINE_START(AFEB9260, "Custom afeb9260 board") | |
212 | /* Maintainer: Sergey Lapin <slapin@ossfans.org> */ | |
6bb27d73 | 213 | .init_time = at91sam926x_pit_init, |
21d08b9d | 214 | .map_io = at91_map_io, |
3e135466 | 215 | .handle_irq = at91_aic_handle_irq, |
1b021a3b | 216 | .init_early = afeb9260_init_early, |
92100c12 | 217 | .init_irq = at91_init_irq_default, |
9c784f95 SL |
218 | .init_machine = afeb9260_board_init, |
219 | MACHINE_END | |
220 |