blob: 4770db08e5a6c1895b52794d02eba84b499da56c [file] [log] [blame]
Ryan Mallon064baac2010-07-06 21:48:53 +01001/*
2 * linux/arch/arm/mach-at91/board-snapper9260.c
3 *
4 * Copyright (C) 2010 Bluewater System Ltd
5 *
6 * Author: Andre Renaud <andre@bluewatersys.com>
Ryan Mallon1c5454e2011-06-15 14:45:36 +10007 * Author: Ryan Mallon
Ryan Mallon064baac2010-07-06 21:48:53 +01008 *
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 2 of the License, or
12 * (at your option) any later version.
13 *
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
18 *
19 * You should have received a copy of the GNU General Public License
20 * along with this program; if not, write to the Free Software
21 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
22 *
23 */
24
25#include <linux/init.h>
26#include <linux/gpio.h>
27#include <linux/platform_device.h>
28#include <linux/spi/spi.h>
29#include <linux/i2c/pca953x.h>
30
31#include <asm/mach-types.h>
32#include <asm/mach/arch.h>
33
34#include <mach/hardware.h>
35#include <mach/board.h>
36#include <mach/at91sam9_smc.h>
37
38#include "sam9_smc.h"
39#include "generic.h"
40
41#define SNAPPER9260_IO_EXP_GPIO(x) (NR_BUILTIN_GPIO + (x))
42
Jean-Christophe PLAGNIOL-VILLARD1b021a32011-04-28 20:19:32 +080043static void __init snapper9260_init_early(void)
Ryan Mallon064baac2010-07-06 21:48:53 +010044{
Jean-Christophe PLAGNIOL-VILLARD21d08b92011-04-23 15:28:34 +080045 at91_initialize(18432000);
Ryan Mallon064baac2010-07-06 21:48:53 +010046
47 /* Debug on ttyS0 */
48 at91_register_uart(0, 0, 0);
49 at91_set_serial_console(0);
50
51 at91_register_uart(AT91SAM9260_ID_US0, 1,
52 ATMEL_UART_CTS | ATMEL_UART_RTS);
53 at91_register_uart(AT91SAM9260_ID_US1, 2,
54 ATMEL_UART_CTS | ATMEL_UART_RTS);
55 at91_register_uart(AT91SAM9260_ID_US2, 3, 0);
56}
57
Ryan Mallon064baac2010-07-06 21:48:53 +010058static struct at91_usbh_data __initdata snapper9260_usbh_data = {
59 .ports = 2,
Jean-Christophe PLAGNIOL-VILLARD63b4c292011-11-25 01:51:06 +080060 .vbus_pin = {-EINVAL, -EINVAL},
61 .overcurrent_pin= {-EINVAL, -EINVAL},
Ryan Mallon064baac2010-07-06 21:48:53 +010062};
63
64static struct at91_udc_data __initdata snapper9260_udc_data = {
65 .vbus_pin = SNAPPER9260_IO_EXP_GPIO(5),
66 .vbus_active_low = 1,
67 .vbus_polled = 1,
Jean-Christophe PLAGNIOL-VILLARD63b4c292011-11-25 01:51:06 +080068 .pullup_pin = -EINVAL,
Ryan Mallon064baac2010-07-06 21:48:53 +010069};
70
Jamie Iles84e0cdb2011-03-08 20:17:06 +000071static struct macb_platform_data snapper9260_macb_data = {
Jean-Christophe PLAGNIOL-VILLARD63b4c292011-11-25 01:51:06 +080072 .phy_irq_pin = -EINVAL,
Ryan Mallon064baac2010-07-06 21:48:53 +010073 .is_rmii = 1,
74};
75
76static struct mtd_partition __initdata snapper9260_nand_partitions[] = {
77 {
78 .name = "Preboot",
79 .offset = 0,
80 .size = SZ_128K,
81 },
82 {
83 .name = "Bootloader",
84 .offset = MTDPART_OFS_APPEND,
85 .size = SZ_256K,
86 },
87 {
88 .name = "Environment",
89 .offset = MTDPART_OFS_APPEND,
90 .size = SZ_128K,
91 },
92 {
93 .name = "Kernel",
94 .offset = MTDPART_OFS_APPEND,
95 .size = SZ_4M,
96 },
97 {
98 .name = "Filesystem",
99 .offset = MTDPART_OFS_APPEND,
100 .size = MTDPART_SIZ_FULL,
101 },
102};
103
Ryan Mallon064baac2010-07-06 21:48:53 +0100104static struct atmel_nand_data __initdata snapper9260_nand_data = {
105 .ale = 21,
106 .cle = 22,
107 .rdy_pin = AT91_PIN_PC13,
Dmitry Eremin-Solenikov1754aab2011-05-29 17:49:22 +0400108 .parts = snapper9260_nand_partitions,
109 .num_parts = ARRAY_SIZE(snapper9260_nand_partitions),
Ryan Mallon064baac2010-07-06 21:48:53 +0100110 .bus_width_16 = 0,
Jean-Christophe PLAGNIOL-VILLARD63b4c292011-11-25 01:51:06 +0800111 .enable_pin = -EINVAL,
112 .det_pin = -EINVAL,
Ryan Mallon064baac2010-07-06 21:48:53 +0100113};
114
115static struct sam9_smc_config __initdata snapper9260_nand_smc_config = {
116 .ncs_read_setup = 0,
117 .nrd_setup = 0,
118 .ncs_write_setup = 0,
119 .nwe_setup = 0,
120
121 .ncs_read_pulse = 5,
122 .nrd_pulse = 2,
123 .ncs_write_pulse = 5,
124 .nwe_pulse = 2,
125
126 .read_cycle = 7,
127 .write_cycle = 7,
128
129 .mode = (AT91_SMC_READMODE | AT91_SMC_WRITEMODE |
130 AT91_SMC_EXNWMODE_DISABLE),
131 .tdf_cycles = 1,
132};
133
134static struct pca953x_platform_data snapper9260_io_expander_data = {
135 .gpio_base = SNAPPER9260_IO_EXP_GPIO(0),
136};
137
138static struct i2c_board_info __initdata snapper9260_i2c_devices[] = {
139 {
140 /* IO expander */
141 I2C_BOARD_INFO("max7312", 0x28),
142 .platform_data = &snapper9260_io_expander_data,
143 },
144 {
145 /* Audio codec */
146 I2C_BOARD_INFO("tlv320aic23", 0x1a),
147 },
148 {
149 /* RTC */
150 I2C_BOARD_INFO("isl1208", 0x6f),
Ryan Mallond0813772011-02-14 03:46:42 +0100151 .irq = gpio_to_irq(AT91_PIN_PA31),
Ryan Mallon064baac2010-07-06 21:48:53 +0100152 },
153};
154
155static void __init snapper9260_add_device_nand(void)
156{
157 at91_set_A_periph(AT91_PIN_PC14, 0);
Jean-Christophe PLAGNIOL-VILLARDfaee0cc2011-10-14 01:37:09 +0800158 sam9_smc_configure(0, 3, &snapper9260_nand_smc_config);
Ryan Mallon064baac2010-07-06 21:48:53 +0100159 at91_add_device_nand(&snapper9260_nand_data);
160}
161
162static void __init snapper9260_board_init(void)
163{
164 at91_add_device_i2c(snapper9260_i2c_devices,
165 ARRAY_SIZE(snapper9260_i2c_devices));
166 at91_add_device_serial();
167 at91_add_device_usbh(&snapper9260_usbh_data);
168 at91_add_device_udc(&snapper9260_udc_data);
169 at91_add_device_eth(&snapper9260_macb_data);
170 at91_add_device_ssc(AT91SAM9260_ID_SSC, (ATMEL_SSC_TF | ATMEL_SSC_TK |
171 ATMEL_SSC_TD | ATMEL_SSC_RD));
172 snapper9260_add_device_nand();
173}
174
175MACHINE_START(SNAPPER_9260, "Bluewater Systems Snapper 9260/9G20 module")
Ryan Mallon064baac2010-07-06 21:48:53 +0100176 .timer = &at91sam926x_timer,
Jean-Christophe PLAGNIOL-VILLARD21d08b92011-04-23 15:28:34 +0800177 .map_io = at91_map_io,
Jean-Christophe PLAGNIOL-VILLARD1b021a32011-04-28 20:19:32 +0800178 .init_early = snapper9260_init_early,
Jean-Christophe PLAGNIOL-VILLARD92100c12011-04-23 15:28:34 +0800179 .init_irq = at91_init_irq_default,
Ryan Mallon064baac2010-07-06 21:48:53 +0100180 .init_machine = snapper9260_board_init,
181MACHINE_END
182
183