blob: 3bb40694b02db20599fa4c87f2867b0513e1bff0 [file] [log] [blame]
Sergey Lapin9c784f92008-08-03 02:29:48 +01001/*
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>
Russell King2f8163b2011-07-26 10:53:52 +010028#include <linux/gpio.h>
Sergey Lapin9c784f92008-08-03 02:29:48 +010029#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
46#include <mach/board.h>
Sergey Lapin9c784f92008-08-03 02:29:48 +010047
48#include "generic.h"
49
50
Jean-Christophe PLAGNIOL-VILLARD1b021a32011-04-28 20:19:32 +080051static void __init afeb9260_init_early(void)
Sergey Lapin9c784f92008-08-03 02:29:48 +010052{
53 /* Initialize processor: 18.432 MHz crystal */
Jean-Christophe PLAGNIOL-VILLARD21d08b92011-04-23 15:28:34 +080054 at91_initialize(18432000);
Sergey Lapin9c784f92008-08-03 02:29:48 +010055
Samuel R. C. Vale4f379402009-07-10 12:07:15 -030056 /* DBGU on ttyS0. (Rx & Tx only) */
Sergey Lapin9c784f92008-08-03 02:29:48 +010057 at91_register_uart(0, 0, 0);
58
59 /* USART0 on ttyS1. (Rx, Tx, CTS, RTS, DTR, DSR, DCD, RI) */
60 at91_register_uart(AT91SAM9260_ID_US0, 1,
61 ATMEL_UART_CTS | ATMEL_UART_RTS
62 | ATMEL_UART_DTR | ATMEL_UART_DSR
63 | ATMEL_UART_DCD | ATMEL_UART_RI);
64
65 /* USART1 on ttyS2. (Rx, Tx, RTS, CTS) */
66 at91_register_uart(AT91SAM9260_ID_US1, 2,
67 ATMEL_UART_CTS | ATMEL_UART_RTS);
68
69 /* set serial console to ttyS0 (ie, DBGU) */
70 at91_set_serial_console(0);
71}
72
Sergey Lapin9c784f92008-08-03 02:29:48 +010073/*
74 * USB Host port
75 */
76static struct at91_usbh_data __initdata afeb9260_usbh_data = {
77 .ports = 1,
Jean-Christophe PLAGNIOL-VILLARD63b4c292011-11-25 01:51:06 +080078 .vbus_pin = {-EINVAL, -EINVAL},
79 .overcurrent_pin= {-EINVAL, -EINVAL},
Sergey Lapin9c784f92008-08-03 02:29:48 +010080};
81
82/*
83 * USB Device port
84 */
85static struct at91_udc_data __initdata afeb9260_udc_data = {
86 .vbus_pin = AT91_PIN_PC5,
Jean-Christophe PLAGNIOL-VILLARD63b4c292011-11-25 01:51:06 +080087 .pullup_pin = -EINVAL, /* pull-up driven by UDC */
Sergey Lapin9c784f92008-08-03 02:29:48 +010088};
89
90
91
92/*
93 * SPI devices.
94 */
95static struct spi_board_info afeb9260_spi_devices[] = {
96 { /* DataFlash chip */
97 .modalias = "mtd_dataflash",
98 .chip_select = 1,
99 .max_speed_hz = 15 * 1000 * 1000,
100 .bus_num = 0,
101 },
102};
103
104
Sergey Lapin53d43512008-08-12 13:35:34 +0100105/*
106 * MACB Ethernet device
107 */
Jamie Iles84e0cdb2011-03-08 20:17:06 +0000108static struct macb_platform_data __initdata afeb9260_macb_data = {
Sergey Lapin53d43512008-08-12 13:35:34 +0100109 .phy_irq_pin = AT91_PIN_PA9,
110 .is_rmii = 0,
111};
112
Sergey Lapin9c784f92008-08-03 02:29:48 +0100113
114/*
115 * NAND flash
116 */
117static struct mtd_partition __initdata afeb9260_nand_partition[] = {
118 {
119 .name = "bootloader",
120 .offset = 0,
121 .size = (640 * SZ_1K),
122 },
123 {
124 .name = "kernel",
125 .offset = MTDPART_OFS_NXTBLK,
126 .size = SZ_2M,
127 },
128 {
129 .name = "rootfs",
130 .offset = MTDPART_OFS_NXTBLK,
131 .size = MTDPART_SIZ_FULL,
132 },
133};
134
Sergey Lapin9c784f92008-08-03 02:29:48 +0100135static struct atmel_nand_data __initdata afeb9260_nand_data = {
136 .ale = 21,
137 .cle = 22,
138 .rdy_pin = AT91_PIN_PC13,
139 .enable_pin = AT91_PIN_PC14,
Sergey Lapin9c784f92008-08-03 02:29:48 +0100140 .bus_width_16 = 0,
Dmitry Eremin-Solenikov1754aab2011-05-29 17:49:22 +0400141 .parts = afeb9260_nand_partition,
142 .num_parts = ARRAY_SIZE(afeb9260_nand_partition),
Jean-Christophe PLAGNIOL-VILLARD63b4c292011-11-25 01:51:06 +0800143 .det_pin = -EINVAL,
Sergey Lapin9c784f92008-08-03 02:29:48 +0100144};
145
146
147/*
148 * MCI (SD/MMC)
149 */
150static struct at91_mmc_data __initdata afeb9260_mmc_data = {
Sergey Lapin6d361102009-05-18 22:30:10 +0100151 .det_pin = AT91_PIN_PC9,
152 .wp_pin = AT91_PIN_PC4,
Sergey Lapin9c784f92008-08-03 02:29:48 +0100153 .slot_b = 1,
154 .wire4 = 1,
Jean-Christophe PLAGNIOL-VILLARD63b4c292011-11-25 01:51:06 +0800155 .vcc_pin = -EINVAL,
Sergey Lapin9c784f92008-08-03 02:29:48 +0100156};
157
158
159
160static struct i2c_board_info __initdata afeb9260_i2c_devices[] = {
161 {
Sergey Lapin34e559e2009-05-08 15:58:57 +0100162 I2C_BOARD_INFO("tlv320aic23", 0x1a),
163 }, {
Sergey Lapin9c784f92008-08-03 02:29:48 +0100164 I2C_BOARD_INFO("fm3130", 0x68),
Sergey Lapinb73b9252008-10-27 07:43:45 +0100165 }, {
Sergey Lapin9c784f92008-08-03 02:29:48 +0100166 I2C_BOARD_INFO("24c64", 0x50),
167 },
168};
169
Sergey Matyukevich0c30df62009-07-30 22:29:07 +0100170/*
171 * IDE (CF True IDE mode)
172 */
173static struct at91_cf_data afeb9260_cf_data = {
174 .chipselect = 4,
175 .irq_pin = AT91_PIN_PA6,
Jean-Christophe PLAGNIOL-VILLARD63b4c292011-11-25 01:51:06 +0800176 .det_pin = -EINVAL,
177 .vcc_pin = -EINVAL,
Sergey Matyukevich0c30df62009-07-30 22:29:07 +0100178 .rst_pin = AT91_PIN_PA7,
179 .flags = AT91_CF_TRUE_IDE,
180};
181
Sergey Lapin9c784f92008-08-03 02:29:48 +0100182static void __init afeb9260_board_init(void)
183{
184 /* Serial */
185 at91_add_device_serial();
186 /* USB Host */
187 at91_add_device_usbh(&afeb9260_usbh_data);
188 /* USB Device */
189 at91_add_device_udc(&afeb9260_udc_data);
190 /* SPI */
191 at91_add_device_spi(afeb9260_spi_devices,
192 ARRAY_SIZE(afeb9260_spi_devices));
193 /* NAND */
194 at91_add_device_nand(&afeb9260_nand_data);
Sergey Lapin53d43512008-08-12 13:35:34 +0100195 /* Ethernet */
196 at91_add_device_eth(&afeb9260_macb_data);
197
198 /* Standard function's pin assignments are not
199 * appropriate for us and generic code provide
200 * no API to configure these pins any other way */
201 at91_set_B_periph(AT91_PIN_PA10, 0); /* ETX2 */
202 at91_set_B_periph(AT91_PIN_PA11, 0); /* ETX3 */
Sergey Lapin9c784f92008-08-03 02:29:48 +0100203 /* MMC */
204 at91_add_device_mmc(0, &afeb9260_mmc_data);
205 /* I2C */
206 at91_add_device_i2c(afeb9260_i2c_devices,
207 ARRAY_SIZE(afeb9260_i2c_devices));
Sergey Lapin34e559e2009-05-08 15:58:57 +0100208 /* Audio */
209 at91_add_device_ssc(AT91SAM9260_ID_SSC, ATMEL_SSC_TX);
Sergey Matyukevich0c30df62009-07-30 22:29:07 +0100210 /* IDE */
211 at91_add_device_cf(&afeb9260_cf_data);
Sergey Lapin9c784f92008-08-03 02:29:48 +0100212}
213
214MACHINE_START(AFEB9260, "Custom afeb9260 board")
215 /* Maintainer: Sergey Lapin <slapin@ossfans.org> */
Sergey Lapin9c784f92008-08-03 02:29:48 +0100216 .timer = &at91sam926x_timer,
Jean-Christophe PLAGNIOL-VILLARD21d08b92011-04-23 15:28:34 +0800217 .map_io = at91_map_io,
Jean-Christophe PLAGNIOL-VILLARD1b021a32011-04-28 20:19:32 +0800218 .init_early = afeb9260_init_early,
Jean-Christophe PLAGNIOL-VILLARD92100c12011-04-23 15:28:34 +0800219 .init_irq = at91_init_irq_default,
Sergey Lapin9c784f92008-08-03 02:29:48 +0100220 .init_machine = afeb9260_board_init,
221MACHINE_END
222