| Andrew Victor | ca0a789 | 2008-05-24 17:47:04 +0100 | [diff] [blame] | 1 | /* | 
| Nico Erfurth | 6939fd4 | 2011-08-30 18:25:52 +0200 | [diff] [blame] | 2 |  * linux/arch/arm/mach-at91/board-usb-a926x.c | 
| Andrew Victor | ca0a789 | 2008-05-24 17:47:04 +0100 | [diff] [blame] | 3 |  * | 
 | 4 |  *  Copyright (C) 2005 SAN People | 
 | 5 |  *  Copyright (C) 2007 Atmel Corporation. | 
 | 6 |  *  Copyright (C) 2007 Calao-systems | 
| Jean-Christophe PLAGNIOL-VILLARD | 0a072a2 | 2011-08-30 18:25:53 +0200 | [diff] [blame] | 7 |  *  Copyright (C) 2011 Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com> | 
| Andrew Victor | ca0a789 | 2008-05-24 17:47:04 +0100 | [diff] [blame] | 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 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 | #include <linux/types.h> | 
 | 25 | #include <linux/init.h> | 
 | 26 | #include <linux/mm.h> | 
 | 27 | #include <linux/module.h> | 
 | 28 | #include <linux/platform_device.h> | 
 | 29 | #include <linux/spi/spi.h> | 
 | 30 | #include <linux/gpio_keys.h> | 
| Arnd Bergmann | 3353327 | 2011-10-21 16:46:26 +0200 | [diff] [blame] | 31 | #include <linux/gpio.h> | 
| Andrew Victor | ca0a789 | 2008-05-24 17:47:04 +0100 | [diff] [blame] | 32 | #include <linux/input.h> | 
| Jean-Christophe PLAGNIOL-VILLARD | 0a072a2 | 2011-08-30 18:25:53 +0200 | [diff] [blame] | 33 | #include <linux/spi/mmc_spi.h> | 
| Andrew Victor | ca0a789 | 2008-05-24 17:47:04 +0100 | [diff] [blame] | 34 |  | 
| Andrew Victor | ca0a789 | 2008-05-24 17:47:04 +0100 | [diff] [blame] | 35 | #include <asm/setup.h> | 
 | 36 | #include <asm/mach-types.h> | 
 | 37 | #include <asm/irq.h> | 
 | 38 |  | 
 | 39 | #include <asm/mach/arch.h> | 
 | 40 | #include <asm/mach/map.h> | 
 | 41 | #include <asm/mach/irq.h> | 
 | 42 |  | 
| Andrew Victor | e505240 | 2008-09-21 21:30:02 +0100 | [diff] [blame] | 43 | #include <mach/hardware.h> | 
| Russell King | a09e64f | 2008-08-05 16:14:15 +0100 | [diff] [blame] | 44 | #include <mach/board.h> | 
| Andrew Victor | 8cdae51 | 2008-10-06 20:05:35 +0100 | [diff] [blame] | 45 | #include <mach/at91sam9_smc.h> | 
| Russell King | a09e64f | 2008-08-05 16:14:15 +0100 | [diff] [blame] | 46 | #include <mach/at91_shdwc.h> | 
| Andrew Victor | ca0a789 | 2008-05-24 17:47:04 +0100 | [diff] [blame] | 47 |  | 
| Andrew Victor | 8cdae51 | 2008-10-06 20:05:35 +0100 | [diff] [blame] | 48 | #include "sam9_smc.h" | 
| Andrew Victor | ca0a789 | 2008-05-24 17:47:04 +0100 | [diff] [blame] | 49 | #include "generic.h" | 
 | 50 |  | 
 | 51 |  | 
| Jean-Christophe PLAGNIOL-VILLARD | 1b021a3 | 2011-04-28 20:19:32 +0800 | [diff] [blame] | 52 | static void __init ek_init_early(void) | 
| Andrew Victor | ca0a789 | 2008-05-24 17:47:04 +0100 | [diff] [blame] | 53 | { | 
 | 54 | 	/* Initialize processor: 12.00 MHz crystal */ | 
| Jean-Christophe PLAGNIOL-VILLARD | 21d08b9 | 2011-04-23 15:28:34 +0800 | [diff] [blame] | 55 | 	at91_initialize(12000000); | 
| Andrew Victor | ca0a789 | 2008-05-24 17:47:04 +0100 | [diff] [blame] | 56 | } | 
 | 57 |  | 
| Andrew Victor | ca0a789 | 2008-05-24 17:47:04 +0100 | [diff] [blame] | 58 | /* | 
 | 59 |  * USB Host port | 
 | 60 |  */ | 
 | 61 | static struct at91_usbh_data __initdata ek_usbh_data = { | 
 | 62 | 	.ports		= 2, | 
| Jean-Christophe PLAGNIOL-VILLARD | 63b4c29 | 2011-11-25 01:51:06 +0800 | [diff] [blame] | 63 | 	.vbus_pin	= {-EINVAL, -EINVAL}, | 
 | 64 | 	.overcurrent_pin= {-EINVAL, -EINVAL}, | 
| Andrew Victor | ca0a789 | 2008-05-24 17:47:04 +0100 | [diff] [blame] | 65 | }; | 
 | 66 |  | 
 | 67 | /* | 
 | 68 |  * USB Device port | 
 | 69 |  */ | 
 | 70 | static struct at91_udc_data __initdata ek_udc_data = { | 
 | 71 | 	.vbus_pin	= AT91_PIN_PB11, | 
| Jean-Christophe PLAGNIOL-VILLARD | 63b4c29 | 2011-11-25 01:51:06 +0800 | [diff] [blame] | 72 | 	.pullup_pin	= -EINVAL,		/* pull-up driven by UDC */ | 
| Andrew Victor | ca0a789 | 2008-05-24 17:47:04 +0100 | [diff] [blame] | 73 | }; | 
 | 74 |  | 
| Jean-Christophe PLAGNIOL-VILLARD | 0a072a2 | 2011-08-30 18:25:53 +0200 | [diff] [blame] | 75 | static void __init ek_add_device_udc(void) | 
| Nico Erfurth | 6939fd4 | 2011-08-30 18:25:52 +0200 | [diff] [blame] | 76 | { | 
| Jean-Christophe PLAGNIOL-VILLARD | 0a072a2 | 2011-08-30 18:25:53 +0200 | [diff] [blame] | 77 | 	if (machine_is_usb_a9260() || machine_is_usb_a9g20()) | 
| Nico Erfurth | 6939fd4 | 2011-08-30 18:25:52 +0200 | [diff] [blame] | 78 | 		ek_udc_data.vbus_pin = AT91_PIN_PC5; | 
 | 79 |  | 
 | 80 | 	at91_add_device_udc(&ek_udc_data); | 
 | 81 | } | 
 | 82 |  | 
| Jean-Christophe PLAGNIOL-VILLARD | 0a072a2 | 2011-08-30 18:25:53 +0200 | [diff] [blame] | 83 | #if defined(CONFIG_MMC_SPI) || defined(CONFIG_MMC_SPI_MODULE) | 
 | 84 | #define MMC_SPI_CARD_DETECT_INT AT91_PIN_PC4 | 
 | 85 | static int at91_mmc_spi_init(struct device *dev, | 
 | 86 | 	irqreturn_t (*detect_int)(int, void *), void *data) | 
 | 87 | { | 
 | 88 | 	/* Configure Interrupt pin as input, no pull-up */ | 
 | 89 | 	at91_set_gpio_input(MMC_SPI_CARD_DETECT_INT, 0); | 
 | 90 | 	return request_irq(gpio_to_irq(MMC_SPI_CARD_DETECT_INT), detect_int, | 
 | 91 | 		IRQF_TRIGGER_FALLING | IRQF_TRIGGER_RISING, | 
 | 92 | 		"mmc-spi-detect", data); | 
 | 93 | } | 
 | 94 |  | 
 | 95 | static void at91_mmc_spi_exit(struct device *dev, void *data) | 
 | 96 | { | 
 | 97 | 	free_irq(gpio_to_irq(MMC_SPI_CARD_DETECT_INT), data); | 
 | 98 | } | 
 | 99 |  | 
 | 100 | static struct mmc_spi_platform_data at91_mmc_spi_pdata = { | 
 | 101 | 	.init = at91_mmc_spi_init, | 
 | 102 | 	.exit = at91_mmc_spi_exit, | 
 | 103 | 	.detect_delay = 100, /* msecs */ | 
 | 104 | }; | 
 | 105 | #endif | 
 | 106 |  | 
| Andrew Victor | ca0a789 | 2008-05-24 17:47:04 +0100 | [diff] [blame] | 107 | /* | 
 | 108 |  * SPI devices. | 
 | 109 |  */ | 
| Jean-Christophe PLAGNIOL-VILLARD | 0a072a2 | 2011-08-30 18:25:53 +0200 | [diff] [blame] | 110 | static struct spi_board_info usb_a9263_spi_devices[] = { | 
| Andrew Victor | ca0a789 | 2008-05-24 17:47:04 +0100 | [diff] [blame] | 111 | #if !defined(CONFIG_MMC_AT91) | 
 | 112 | 	{	/* DataFlash chip */ | 
 | 113 | 		.modalias	= "mtd_dataflash", | 
 | 114 | 		.chip_select	= 0, | 
 | 115 | 		.max_speed_hz	= 15 * 1000 * 1000, | 
 | 116 | 		.bus_num	= 0, | 
 | 117 | 	} | 
 | 118 | #endif | 
 | 119 | }; | 
 | 120 |  | 
| Jean-Christophe PLAGNIOL-VILLARD | 0a072a2 | 2011-08-30 18:25:53 +0200 | [diff] [blame] | 121 | static struct spi_board_info usb_a9g20_spi_devices[] = { | 
 | 122 | #if defined(CONFIG_MMC_SPI) || defined(CONFIG_MMC_SPI_MODULE) | 
 | 123 | 	{ | 
 | 124 | 		.modalias = "mmc_spi", | 
 | 125 | 		.max_speed_hz = 20000000,	/* max spi clock (SCK) speed in HZ */ | 
 | 126 | 		.bus_num = 1, | 
 | 127 | 		.chip_select = 0, | 
 | 128 | 		.platform_data = &at91_mmc_spi_pdata, | 
 | 129 | 		.mode = SPI_MODE_3, | 
 | 130 | 	}, | 
 | 131 | #endif | 
 | 132 | }; | 
 | 133 |  | 
 | 134 | static void __init ek_add_device_spi(void) | 
| Nico Erfurth | 6939fd4 | 2011-08-30 18:25:52 +0200 | [diff] [blame] | 135 | { | 
 | 136 | 	if (machine_is_usb_a9263()) | 
| Jean-Christophe PLAGNIOL-VILLARD | 0a072a2 | 2011-08-30 18:25:53 +0200 | [diff] [blame] | 137 | 		at91_add_device_spi(usb_a9263_spi_devices, ARRAY_SIZE(usb_a9263_spi_devices)); | 
 | 138 | 	else if (machine_is_usb_a9g20()) | 
 | 139 | 		at91_add_device_spi(usb_a9g20_spi_devices, ARRAY_SIZE(usb_a9g20_spi_devices)); | 
| Nico Erfurth | 6939fd4 | 2011-08-30 18:25:52 +0200 | [diff] [blame] | 140 | } | 
 | 141 |  | 
| Andrew Victor | ca0a789 | 2008-05-24 17:47:04 +0100 | [diff] [blame] | 142 | /* | 
 | 143 |  * MACB Ethernet device | 
 | 144 |  */ | 
| Jamie Iles | 84e0cdb | 2011-03-08 20:17:06 +0000 | [diff] [blame] | 145 | static struct macb_platform_data __initdata ek_macb_data = { | 
| Andrew Victor | ca0a789 | 2008-05-24 17:47:04 +0100 | [diff] [blame] | 146 | 	.phy_irq_pin	= AT91_PIN_PE31, | 
 | 147 | 	.is_rmii	= 1, | 
 | 148 | }; | 
 | 149 |  | 
| Jean-Christophe PLAGNIOL-VILLARD | 0a072a2 | 2011-08-30 18:25:53 +0200 | [diff] [blame] | 150 | static void __init ek_add_device_eth(void) | 
| Nico Erfurth | 6939fd4 | 2011-08-30 18:25:52 +0200 | [diff] [blame] | 151 | { | 
| Jean-Christophe PLAGNIOL-VILLARD | 0a072a2 | 2011-08-30 18:25:53 +0200 | [diff] [blame] | 152 | 	if (machine_is_usb_a9260() || machine_is_usb_a9g20()) | 
| Nico Erfurth | 6939fd4 | 2011-08-30 18:25:52 +0200 | [diff] [blame] | 153 | 		ek_macb_data.phy_irq_pin = AT91_PIN_PA31; | 
 | 154 |  | 
 | 155 | 	at91_add_device_eth(&ek_macb_data); | 
 | 156 | } | 
 | 157 |  | 
| Andrew Victor | ca0a789 | 2008-05-24 17:47:04 +0100 | [diff] [blame] | 158 | /* | 
 | 159 |  * NAND flash | 
 | 160 |  */ | 
 | 161 | static struct mtd_partition __initdata ek_nand_partition[] = { | 
 | 162 | 	{ | 
| Jean-Christophe PLAGNIOL-VILLARD | 0a072a2 | 2011-08-30 18:25:53 +0200 | [diff] [blame] | 163 | 		.name	= "barebox", | 
| Andrew Victor | e505240 | 2008-09-21 21:30:02 +0100 | [diff] [blame] | 164 | 		.offset	= 0, | 
| Jean-Christophe PLAGNIOL-VILLARD | 0a072a2 | 2011-08-30 18:25:53 +0200 | [diff] [blame] | 165 | 		.size	= 3 * SZ_128K, | 
 | 166 | 	}, { | 
 | 167 | 		.name	= "bareboxenv", | 
 | 168 | 		.offset	= MTDPART_OFS_NXTBLK, | 
 | 169 | 		.size	= SZ_128K, | 
 | 170 | 	}, { | 
 | 171 | 		.name	= "bareboxenv2", | 
 | 172 | 		.offset	= MTDPART_OFS_NXTBLK, | 
 | 173 | 		.size	= SZ_128K, | 
 | 174 | 	}, { | 
| Jean-Christophe PLAGNIOL-VILLARD | d785047 | 2012-04-11 23:40:31 +0800 | [diff] [blame] | 175 | 		.name	= "oftree", | 
 | 176 | 		.offset	= MTDPART_OFS_NXTBLK, | 
 | 177 | 		.size	= SZ_128K, | 
 | 178 | 	}, { | 
| Jean-Christophe PLAGNIOL-VILLARD | 0a072a2 | 2011-08-30 18:25:53 +0200 | [diff] [blame] | 179 | 		.name	= "kernel", | 
 | 180 | 		.offset	= MTDPART_OFS_NXTBLK, | 
 | 181 | 		.size	= 4 * SZ_1M, | 
 | 182 | 	}, { | 
 | 183 | 		.name	= "rootfs", | 
| Andrew Victor | e505240 | 2008-09-21 21:30:02 +0100 | [diff] [blame] | 184 | 		.offset	= MTDPART_OFS_NXTBLK, | 
 | 185 | 		.size	= 120 * SZ_1M, | 
| Jean-Christophe PLAGNIOL-VILLARD | 0a072a2 | 2011-08-30 18:25:53 +0200 | [diff] [blame] | 186 | 	}, { | 
 | 187 | 		.name	= "data", | 
| Andrew Victor | e505240 | 2008-09-21 21:30:02 +0100 | [diff] [blame] | 188 | 		.offset	= MTDPART_OFS_NXTBLK, | 
| Jean-Christophe PLAGNIOL-VILLARD | 0a072a2 | 2011-08-30 18:25:53 +0200 | [diff] [blame] | 189 | 		.size	= MTDPART_SIZ_FULL, | 
| Andrew Victor | ca0a789 | 2008-05-24 17:47:04 +0100 | [diff] [blame] | 190 | 	} | 
 | 191 | }; | 
 | 192 |  | 
| Haavard Skinnemoen | 7c89683 | 2008-07-28 16:57:22 +0100 | [diff] [blame] | 193 | static struct atmel_nand_data __initdata ek_nand_data = { | 
| Andrew Victor | ca0a789 | 2008-05-24 17:47:04 +0100 | [diff] [blame] | 194 | 	.ale		= 21, | 
 | 195 | 	.cle		= 22, | 
| Jean-Christophe PLAGNIOL-VILLARD | 63b4c29 | 2011-11-25 01:51:06 +0800 | [diff] [blame] | 196 | 	.det_pin	= -EINVAL, | 
| Andrew Victor | ca0a789 | 2008-05-24 17:47:04 +0100 | [diff] [blame] | 197 | 	.rdy_pin	= AT91_PIN_PA22, | 
 | 198 | 	.enable_pin	= AT91_PIN_PD15, | 
| Jean-Christophe PLAGNIOL-VILLARD | bf4289c | 2011-12-29 14:43:24 +0800 | [diff] [blame] | 199 | 	.ecc_mode	= NAND_ECC_SOFT, | 
| Jean-Christophe PLAGNIOL-VILLARD | 98619dc | 2011-12-29 15:05:50 +0800 | [diff] [blame] | 200 | 	.on_flash_bbt	= 1, | 
| Linus Torvalds | e0d6511 | 2011-11-07 09:11:16 -0800 | [diff] [blame] | 201 | 	.parts		= ek_nand_partition, | 
 | 202 | 	.num_parts	= ARRAY_SIZE(ek_nand_partition), | 
| Andrew Victor | ca0a789 | 2008-05-24 17:47:04 +0100 | [diff] [blame] | 203 | }; | 
 | 204 |  | 
| Jean-Christophe PLAGNIOL-VILLARD | 0a072a2 | 2011-08-30 18:25:53 +0200 | [diff] [blame] | 205 | static struct sam9_smc_config __initdata usb_a9260_nand_smc_config = { | 
| Andrew Victor | 8cdae51 | 2008-10-06 20:05:35 +0100 | [diff] [blame] | 206 | 	.ncs_read_setup		= 0, | 
 | 207 | 	.nrd_setup		= 1, | 
 | 208 | 	.ncs_write_setup	= 0, | 
 | 209 | 	.nwe_setup		= 1, | 
 | 210 |  | 
 | 211 | 	.ncs_read_pulse		= 3, | 
 | 212 | 	.nrd_pulse		= 3, | 
 | 213 | 	.ncs_write_pulse	= 3, | 
 | 214 | 	.nwe_pulse		= 3, | 
 | 215 |  | 
 | 216 | 	.read_cycle		= 5, | 
 | 217 | 	.write_cycle		= 5, | 
 | 218 |  | 
 | 219 | 	.mode			= AT91_SMC_READMODE | AT91_SMC_WRITEMODE | AT91_SMC_EXNWMODE_DISABLE | AT91_SMC_DBW_8, | 
 | 220 | 	.tdf_cycles		= 2, | 
 | 221 | }; | 
 | 222 |  | 
| Jean-Christophe PLAGNIOL-VILLARD | 0a072a2 | 2011-08-30 18:25:53 +0200 | [diff] [blame] | 223 | static struct sam9_smc_config __initdata usb_a9g20_nand_smc_config = { | 
 | 224 | 	.ncs_read_setup		= 0, | 
 | 225 | 	.nrd_setup		= 2, | 
 | 226 | 	.ncs_write_setup	= 0, | 
 | 227 | 	.nwe_setup		= 2, | 
 | 228 |  | 
 | 229 | 	.ncs_read_pulse		= 4, | 
 | 230 | 	.nrd_pulse		= 4, | 
 | 231 | 	.ncs_write_pulse	= 4, | 
 | 232 | 	.nwe_pulse		= 4, | 
 | 233 |  | 
 | 234 | 	.read_cycle		= 7, | 
 | 235 | 	.write_cycle		= 7, | 
 | 236 |  | 
 | 237 | 	.mode			= AT91_SMC_READMODE | AT91_SMC_WRITEMODE | AT91_SMC_EXNWMODE_DISABLE | AT91_SMC_DBW_8, | 
 | 238 | 	.tdf_cycles		= 3, | 
 | 239 | }; | 
 | 240 |  | 
| Andrew Victor | 8cdae51 | 2008-10-06 20:05:35 +0100 | [diff] [blame] | 241 | static void __init ek_add_device_nand(void) | 
 | 242 | { | 
| Jean-Christophe PLAGNIOL-VILLARD | 0a072a2 | 2011-08-30 18:25:53 +0200 | [diff] [blame] | 243 | 	if (machine_is_usb_a9260() || machine_is_usb_a9g20()) { | 
| Nico Erfurth | 6939fd4 | 2011-08-30 18:25:52 +0200 | [diff] [blame] | 244 | 		ek_nand_data.rdy_pin	= AT91_PIN_PC13; | 
 | 245 | 		ek_nand_data.enable_pin	= AT91_PIN_PC14; | 
 | 246 | 	} | 
 | 247 |  | 
| Andrew Victor | 8cdae51 | 2008-10-06 20:05:35 +0100 | [diff] [blame] | 248 | 	/* configure chip-select 3 (NAND) */ | 
| Jean-Christophe PLAGNIOL-VILLARD | 0a072a2 | 2011-08-30 18:25:53 +0200 | [diff] [blame] | 249 | 	if (machine_is_usb_a9g20()) | 
| Jean-Christophe PLAGNIOL-VILLARD | faee0cc | 2011-10-14 01:37:09 +0800 | [diff] [blame] | 250 | 		sam9_smc_configure(0, 3, &usb_a9g20_nand_smc_config); | 
| Jean-Christophe PLAGNIOL-VILLARD | 0a072a2 | 2011-08-30 18:25:53 +0200 | [diff] [blame] | 251 | 	else | 
| Jean-Christophe PLAGNIOL-VILLARD | faee0cc | 2011-10-14 01:37:09 +0800 | [diff] [blame] | 252 | 		sam9_smc_configure(0, 3, &usb_a9260_nand_smc_config); | 
| Andrew Victor | 8cdae51 | 2008-10-06 20:05:35 +0100 | [diff] [blame] | 253 |  | 
 | 254 | 	at91_add_device_nand(&ek_nand_data); | 
 | 255 | } | 
 | 256 |  | 
 | 257 |  | 
| Andrew Victor | ca0a789 | 2008-05-24 17:47:04 +0100 | [diff] [blame] | 258 | /* | 
 | 259 |  * GPIO Buttons | 
 | 260 |  */ | 
 | 261 | #if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE) | 
 | 262 | static struct gpio_keys_button ek_buttons[] = { | 
 | 263 | 	{	/* USER PUSH BUTTON */ | 
 | 264 | 		.code		= KEY_ENTER, | 
 | 265 | 		.gpio		= AT91_PIN_PB10, | 
 | 266 | 		.active_low	= 1, | 
 | 267 | 		.desc		= "user_pb", | 
 | 268 | 		.wakeup		= 1, | 
 | 269 | 	} | 
 | 270 | }; | 
 | 271 |  | 
 | 272 | static struct gpio_keys_platform_data ek_button_data = { | 
 | 273 | 	.buttons	= ek_buttons, | 
 | 274 | 	.nbuttons	= ARRAY_SIZE(ek_buttons), | 
 | 275 | }; | 
 | 276 |  | 
 | 277 | static struct platform_device ek_button_device = { | 
 | 278 | 	.name		= "gpio-keys", | 
 | 279 | 	.id		= -1, | 
 | 280 | 	.num_resources	= 0, | 
 | 281 | 	.dev		= { | 
 | 282 | 		.platform_data	= &ek_button_data, | 
 | 283 | 	} | 
 | 284 | }; | 
 | 285 |  | 
 | 286 | static void __init ek_add_device_buttons(void) | 
 | 287 | { | 
 | 288 | 	at91_set_GPIO_periph(AT91_PIN_PB10, 1);	/* user push button, pull up enabled */ | 
 | 289 | 	at91_set_deglitch(AT91_PIN_PB10, 1); | 
 | 290 |  | 
 | 291 | 	platform_device_register(&ek_button_device); | 
 | 292 | } | 
 | 293 | #else | 
 | 294 | static void __init ek_add_device_buttons(void) {} | 
 | 295 | #endif | 
 | 296 |  | 
 | 297 | /* | 
 | 298 |  * LEDs | 
 | 299 |  */ | 
 | 300 | static struct gpio_led ek_leds[] = { | 
 | 301 | 	{	/* user_led (green) */ | 
 | 302 | 		.name			= "user_led", | 
 | 303 | 		.gpio			= AT91_PIN_PB21, | 
 | 304 | 		.active_low		= 1, | 
 | 305 | 		.default_trigger	= "heartbeat", | 
 | 306 | 	} | 
 | 307 | }; | 
 | 308 |  | 
| Jean-Christophe PLAGNIOL-VILLARD | 0a072a2 | 2011-08-30 18:25:53 +0200 | [diff] [blame] | 309 | static struct i2c_board_info __initdata ek_i2c_devices[] = { | 
 | 310 | 	{ | 
 | 311 | 		I2C_BOARD_INFO("rv3029c2", 0x56), | 
 | 312 | 	}, | 
 | 313 | }; | 
 | 314 |  | 
 | 315 | static void __init ek_add_device_leds(void) | 
| Nico Erfurth | 6939fd4 | 2011-08-30 18:25:52 +0200 | [diff] [blame] | 316 | { | 
| Jean-Christophe PLAGNIOL-VILLARD | 0a072a2 | 2011-08-30 18:25:53 +0200 | [diff] [blame] | 317 | 	if (machine_is_usb_a9260() || machine_is_usb_a9g20()) | 
| Nico Erfurth | 6939fd4 | 2011-08-30 18:25:52 +0200 | [diff] [blame] | 318 | 		ek_leds[0].active_low = 0; | 
 | 319 |  | 
 | 320 | 	at91_gpio_leds(ek_leds, ARRAY_SIZE(ek_leds)); | 
 | 321 | } | 
 | 322 |  | 
| Andrew Victor | ca0a789 | 2008-05-24 17:47:04 +0100 | [diff] [blame] | 323 | static void __init ek_board_init(void) | 
 | 324 | { | 
 | 325 | 	/* Serial */ | 
| Jean-Christophe PLAGNIOL-VILLARD | 71b149b | 2012-04-05 14:14:28 +0800 | [diff] [blame] | 326 | 	/* DBGU on ttyS0. (Rx & Tx only) */ | 
 | 327 | 	at91_register_uart(0, 0, 0); | 
| Andrew Victor | ca0a789 | 2008-05-24 17:47:04 +0100 | [diff] [blame] | 328 | 	at91_add_device_serial(); | 
 | 329 | 	/* USB Host */ | 
 | 330 | 	at91_add_device_usbh(&ek_usbh_data); | 
 | 331 | 	/* USB Device */ | 
| Nico Erfurth | 6939fd4 | 2011-08-30 18:25:52 +0200 | [diff] [blame] | 332 | 	ek_add_device_udc(); | 
| Andrew Victor | ca0a789 | 2008-05-24 17:47:04 +0100 | [diff] [blame] | 333 | 	/* SPI */ | 
| Nico Erfurth | 6939fd4 | 2011-08-30 18:25:52 +0200 | [diff] [blame] | 334 | 	ek_add_device_spi(); | 
| Andrew Victor | ca0a789 | 2008-05-24 17:47:04 +0100 | [diff] [blame] | 335 | 	/* Ethernet */ | 
| Nico Erfurth | 6939fd4 | 2011-08-30 18:25:52 +0200 | [diff] [blame] | 336 | 	ek_add_device_eth(); | 
| Andrew Victor | ca0a789 | 2008-05-24 17:47:04 +0100 | [diff] [blame] | 337 | 	/* NAND */ | 
| Andrew Victor | 8cdae51 | 2008-10-06 20:05:35 +0100 | [diff] [blame] | 338 | 	ek_add_device_nand(); | 
| Andrew Victor | ca0a789 | 2008-05-24 17:47:04 +0100 | [diff] [blame] | 339 | 	/* Push Buttons */ | 
 | 340 | 	ek_add_device_buttons(); | 
 | 341 | 	/* LEDs */ | 
| Nico Erfurth | 6939fd4 | 2011-08-30 18:25:52 +0200 | [diff] [blame] | 342 | 	ek_add_device_leds(); | 
| Jean-Christophe PLAGNIOL-VILLARD | 0a072a2 | 2011-08-30 18:25:53 +0200 | [diff] [blame] | 343 |  | 
 | 344 | 	if (machine_is_usb_a9g20()) { | 
 | 345 | 		/* I2C */ | 
 | 346 | 		at91_add_device_i2c(ek_i2c_devices, ARRAY_SIZE(ek_i2c_devices)); | 
 | 347 | 	} else { | 
 | 348 | 		/* I2C */ | 
 | 349 | 		at91_add_device_i2c(NULL, 0); | 
 | 350 | 		/* shutdown controller, wakeup button (5 msec low) */ | 
| Jean-Christophe PLAGNIOL-VILLARD | f22deee | 2011-11-01 01:23:20 +0800 | [diff] [blame] | 351 | 		at91_shdwc_write(AT91_SHDW_MR, AT91_SHDW_CPTWK0_(10) | 
| Jean-Christophe PLAGNIOL-VILLARD | 0a072a2 | 2011-08-30 18:25:53 +0200 | [diff] [blame] | 352 | 				| AT91_SHDW_WKMODE0_LOW | 
| Andrew Victor | ca0a789 | 2008-05-24 17:47:04 +0100 | [diff] [blame] | 353 | 				| AT91_SHDW_RTTWKEN); | 
| Jean-Christophe PLAGNIOL-VILLARD | 0a072a2 | 2011-08-30 18:25:53 +0200 | [diff] [blame] | 354 | 	} | 
| Andrew Victor | ca0a789 | 2008-05-24 17:47:04 +0100 | [diff] [blame] | 355 | } | 
 | 356 |  | 
 | 357 | MACHINE_START(USB_A9263, "CALAO USB_A9263") | 
 | 358 | 	/* Maintainer: calao-systems */ | 
| Andrew Victor | ca0a789 | 2008-05-24 17:47:04 +0100 | [diff] [blame] | 359 | 	.timer		= &at91sam926x_timer, | 
| Jean-Christophe PLAGNIOL-VILLARD | 21d08b9 | 2011-04-23 15:28:34 +0800 | [diff] [blame] | 360 | 	.map_io		= at91_map_io, | 
| Jean-Christophe PLAGNIOL-VILLARD | 1b021a3 | 2011-04-28 20:19:32 +0800 | [diff] [blame] | 361 | 	.init_early	= ek_init_early, | 
| Jean-Christophe PLAGNIOL-VILLARD | 92100c1 | 2011-04-23 15:28:34 +0800 | [diff] [blame] | 362 | 	.init_irq	= at91_init_irq_default, | 
| Andrew Victor | ca0a789 | 2008-05-24 17:47:04 +0100 | [diff] [blame] | 363 | 	.init_machine	= ek_board_init, | 
 | 364 | MACHINE_END | 
| Nico Erfurth | 6939fd4 | 2011-08-30 18:25:52 +0200 | [diff] [blame] | 365 |  | 
 | 366 | MACHINE_START(USB_A9260, "CALAO USB_A9260") | 
 | 367 | 	/* Maintainer: calao-systems */ | 
 | 368 | 	.timer		= &at91sam926x_timer, | 
 | 369 | 	.map_io		= at91_map_io, | 
 | 370 | 	.init_early	= ek_init_early, | 
 | 371 | 	.init_irq	= at91_init_irq_default, | 
 | 372 | 	.init_machine	= ek_board_init, | 
 | 373 | MACHINE_END | 
| Jean-Christophe PLAGNIOL-VILLARD | 0a072a2 | 2011-08-30 18:25:53 +0200 | [diff] [blame] | 374 |  | 
 | 375 | MACHINE_START(USB_A9G20, "CALAO USB_A92G0") | 
 | 376 | 	/* Maintainer: Jean-Christophe PLAGNIOL-VILLARD */ | 
 | 377 | 	.timer		= &at91sam926x_timer, | 
 | 378 | 	.map_io		= at91_map_io, | 
 | 379 | 	.init_early	= ek_init_early, | 
 | 380 | 	.init_irq	= at91_init_irq_default, | 
 | 381 | 	.init_machine	= ek_board_init, | 
 | 382 | MACHINE_END |