| 
									
										
										
										
											2010-09-15 11:54:49 +01:00
										 |  |  | /*
 | 
					
						
							|  |  |  |  * linux/arch/arm/mach-at91/board-flexibity.c | 
					
						
							|  |  |  |  * | 
					
						
							| 
									
										
										
										
											2011-05-07 12:47:00 +01:00
										 |  |  |  *  Copyright (C) 2010-2011 Flexibity | 
					
						
							| 
									
										
										
										
											2010-09-15 11:54:49 +01:00
										 |  |  |  *  Copyright (C) 2005 SAN People | 
					
						
							|  |  |  |  *  Copyright (C) 2006 Atmel | 
					
						
							|  |  |  |  * | 
					
						
							|  |  |  |  * This program is free software; you can redistribute it and/or modify | 
					
						
							|  |  |  |  * it under the terms of the GNU General Public License as published by | 
					
						
							|  |  |  |  * the Free Software Foundation; either version 2 of the License, or | 
					
						
							|  |  |  |  * (at your option) any later version. | 
					
						
							|  |  |  |  * | 
					
						
							|  |  |  |  * This program is distributed in the hope that it will be useful, | 
					
						
							|  |  |  |  * but WITHOUT ANY WARRANTY; without even the implied warranty of | 
					
						
							|  |  |  |  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the | 
					
						
							|  |  |  |  * GNU General Public License for more details. | 
					
						
							|  |  |  |  * | 
					
						
							|  |  |  |  * You should have received a copy of the GNU General Public License | 
					
						
							|  |  |  |  * along with this program; if not, write to the Free Software | 
					
						
							|  |  |  |  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA | 
					
						
							|  |  |  |  */ | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | #include <linux/init.h>
 | 
					
						
							|  |  |  | #include <linux/platform_device.h>
 | 
					
						
							|  |  |  | #include <linux/spi/spi.h>
 | 
					
						
							|  |  |  | #include <linux/input.h>
 | 
					
						
							|  |  |  | #include <linux/gpio.h>
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | #include <asm/mach-types.h>
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | #include <asm/mach/arch.h>
 | 
					
						
							|  |  |  | #include <asm/mach/map.h>
 | 
					
						
							|  |  |  | #include <asm/mach/irq.h>
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | #include <mach/hardware.h>
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-10-30 06:41:28 +08:00
										 |  |  | #include "at91_aic.h"
 | 
					
						
							| 
									
										
										
										
											2012-10-30 05:14:17 +08:00
										 |  |  | #include "board.h"
 | 
					
						
							| 
									
										
										
										
											2010-09-15 11:54:49 +01:00
										 |  |  | #include "generic.h"
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-04-28 20:19:32 +08:00
										 |  |  | static void __init flexibity_init_early(void) | 
					
						
							| 
									
										
										
										
											2010-09-15 11:54:49 +01:00
										 |  |  | { | 
					
						
							|  |  |  | 	/* Initialize processor: 18.432 MHz crystal */ | 
					
						
							| 
									
										
										
										
											2011-04-23 15:28:34 +08:00
										 |  |  | 	at91_initialize(18432000); | 
					
						
							| 
									
										
										
										
											2010-09-15 11:54:49 +01:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | /* USB Host port */ | 
					
						
							|  |  |  | static struct at91_usbh_data __initdata flexibity_usbh_data = { | 
					
						
							|  |  |  | 	.ports		= 2, | 
					
						
							| 
									
										
										
										
											2011-11-25 01:51:06 +08:00
										 |  |  | 	.vbus_pin	= {-EINVAL, -EINVAL}, | 
					
						
							|  |  |  | 	.overcurrent_pin= {-EINVAL, -EINVAL}, | 
					
						
							| 
									
										
										
										
											2010-09-15 11:54:49 +01:00
										 |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | /* USB Device port */ | 
					
						
							|  |  |  | static struct at91_udc_data __initdata flexibity_udc_data = { | 
					
						
							|  |  |  | 	.vbus_pin	= AT91_PIN_PC5, | 
					
						
							| 
									
										
										
										
											2011-11-25 01:51:06 +08:00
										 |  |  | 	.pullup_pin	= -EINVAL,		/* pull-up driven by UDC */ | 
					
						
							| 
									
										
										
										
											2010-09-15 11:54:49 +01:00
										 |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-05-07 12:47:00 +01:00
										 |  |  | /* I2C devices */ | 
					
						
							|  |  |  | static struct i2c_board_info __initdata flexibity_i2c_devices[] = { | 
					
						
							|  |  |  | 	{ | 
					
						
							|  |  |  | 		I2C_BOARD_INFO("ds1307", 0x68), | 
					
						
							|  |  |  | 	}, | 
					
						
							|  |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-09-15 11:54:49 +01:00
										 |  |  | /* SPI devices */ | 
					
						
							|  |  |  | static struct spi_board_info flexibity_spi_devices[] = { | 
					
						
							|  |  |  | 	{	/* DataFlash chip */ | 
					
						
							|  |  |  | 		.modalias	= "mtd_dataflash", | 
					
						
							|  |  |  | 		.chip_select	= 1, | 
					
						
							|  |  |  | 		.max_speed_hz	= 15 * 1000 * 1000, | 
					
						
							|  |  |  | 		.bus_num	= 0, | 
					
						
							|  |  |  | 	}, | 
					
						
							|  |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | /* MCI (SD/MMC) */ | 
					
						
							| 
									
										
										
										
											2012-05-21 12:23:27 +02:00
										 |  |  | static struct mci_platform_data __initdata flexibity_mci0_data = { | 
					
						
							|  |  |  | 	.slot[0] = { | 
					
						
							|  |  |  | 		.bus_width	= 4, | 
					
						
							|  |  |  | 		.detect_pin	= AT91_PIN_PC9, | 
					
						
							|  |  |  | 		.wp_pin		= AT91_PIN_PC4, | 
					
						
							|  |  |  | 	}, | 
					
						
							| 
									
										
										
										
											2010-09-15 11:54:49 +01:00
										 |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | /* LEDs */ | 
					
						
							|  |  |  | static struct gpio_led flexibity_leds[] = { | 
					
						
							|  |  |  | 	{ | 
					
						
							|  |  |  | 		.name			= "usb1:green", | 
					
						
							|  |  |  | 		.gpio			= AT91_PIN_PA12, | 
					
						
							|  |  |  | 		.active_low		= 1, | 
					
						
							|  |  |  | 		.default_trigger	= "default-on", | 
					
						
							|  |  |  | 	}, | 
					
						
							|  |  |  | 	{ | 
					
						
							|  |  |  | 		.name			= "usb1:red", | 
					
						
							|  |  |  | 		.gpio			= AT91_PIN_PA13, | 
					
						
							|  |  |  | 		.active_low		= 1, | 
					
						
							|  |  |  | 		.default_trigger	= "default-on", | 
					
						
							|  |  |  | 	}, | 
					
						
							|  |  |  | 	{ | 
					
						
							|  |  |  | 		.name			= "usb2:green", | 
					
						
							|  |  |  | 		.gpio			= AT91_PIN_PB26, | 
					
						
							|  |  |  | 		.active_low		= 1, | 
					
						
							|  |  |  | 		.default_trigger	= "default-on", | 
					
						
							|  |  |  | 	}, | 
					
						
							|  |  |  | 	{ | 
					
						
							|  |  |  | 		.name			= "usb2:red", | 
					
						
							|  |  |  | 		.gpio			= AT91_PIN_PB27, | 
					
						
							|  |  |  | 		.active_low		= 1, | 
					
						
							|  |  |  | 		.default_trigger	= "default-on", | 
					
						
							|  |  |  | 	}, | 
					
						
							|  |  |  | 	{ | 
					
						
							|  |  |  | 		.name			= "usb3:green", | 
					
						
							|  |  |  | 		.gpio			= AT91_PIN_PC8, | 
					
						
							|  |  |  | 		.active_low		= 1, | 
					
						
							|  |  |  | 		.default_trigger	= "default-on", | 
					
						
							|  |  |  | 	}, | 
					
						
							|  |  |  | 	{ | 
					
						
							|  |  |  | 		.name			= "usb3:red", | 
					
						
							|  |  |  | 		.gpio			= AT91_PIN_PC6, | 
					
						
							|  |  |  | 		.active_low		= 1, | 
					
						
							|  |  |  | 		.default_trigger	= "default-on", | 
					
						
							|  |  |  | 	}, | 
					
						
							|  |  |  | 	{ | 
					
						
							|  |  |  | 		.name			= "usb4:green", | 
					
						
							|  |  |  | 		.gpio			= AT91_PIN_PB4, | 
					
						
							|  |  |  | 		.active_low		= 1, | 
					
						
							|  |  |  | 		.default_trigger	= "default-on", | 
					
						
							|  |  |  | 	}, | 
					
						
							|  |  |  | 	{ | 
					
						
							|  |  |  | 		.name			= "usb4:red", | 
					
						
							|  |  |  | 		.gpio			= AT91_PIN_PB5, | 
					
						
							|  |  |  | 		.active_low		= 1, | 
					
						
							|  |  |  | 		.default_trigger	= "default-on", | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | static void __init flexibity_board_init(void) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | 	/* Serial */ | 
					
						
							| 
									
										
										
										
											2012-04-05 14:14:28 +08:00
										 |  |  | 	/* DBGU on ttyS0. (Rx & Tx only) */ | 
					
						
							|  |  |  | 	at91_register_uart(0, 0, 0); | 
					
						
							| 
									
										
										
										
											2010-09-15 11:54:49 +01:00
										 |  |  | 	at91_add_device_serial(); | 
					
						
							|  |  |  | 	/* USB Host */ | 
					
						
							|  |  |  | 	at91_add_device_usbh(&flexibity_usbh_data); | 
					
						
							|  |  |  | 	/* USB Device */ | 
					
						
							|  |  |  | 	at91_add_device_udc(&flexibity_udc_data); | 
					
						
							| 
									
										
										
										
											2011-05-07 12:47:00 +01:00
										 |  |  | 	/* I2C */ | 
					
						
							|  |  |  | 	at91_add_device_i2c(flexibity_i2c_devices, | 
					
						
							|  |  |  | 		ARRAY_SIZE(flexibity_i2c_devices)); | 
					
						
							| 
									
										
										
										
											2010-09-15 11:54:49 +01:00
										 |  |  | 	/* SPI */ | 
					
						
							|  |  |  | 	at91_add_device_spi(flexibity_spi_devices, | 
					
						
							|  |  |  | 		ARRAY_SIZE(flexibity_spi_devices)); | 
					
						
							|  |  |  | 	/* MMC */ | 
					
						
							| 
									
										
										
										
											2012-05-21 12:23:27 +02:00
										 |  |  | 	at91_add_device_mci(0, &flexibity_mci0_data); | 
					
						
							| 
									
										
										
										
											2010-09-15 11:54:49 +01:00
										 |  |  | 	/* LEDs */ | 
					
						
							|  |  |  | 	at91_gpio_leds(flexibity_leds, ARRAY_SIZE(flexibity_leds)); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | MACHINE_START(FLEXIBITY, "Flexibity Connect") | 
					
						
							|  |  |  | 	/* Maintainer: Maxim Osipov */ | 
					
						
							| 
									
										
										
										
											2012-11-08 12:40:59 -07:00
										 |  |  | 	.init_time	= at91sam926x_pit_init, | 
					
						
							| 
									
										
										
										
											2011-04-23 15:28:34 +08:00
										 |  |  | 	.map_io		= at91_map_io, | 
					
						
							| 
									
										
										
										
											2012-06-11 15:38:03 +02:00
										 |  |  | 	.handle_irq	= at91_aic_handle_irq, | 
					
						
							| 
									
										
										
										
											2011-04-28 20:19:32 +08:00
										 |  |  | 	.init_early	= flexibity_init_early, | 
					
						
							| 
									
										
										
										
											2011-04-23 15:28:34 +08:00
										 |  |  | 	.init_irq	= at91_init_irq_default, | 
					
						
							| 
									
										
										
										
											2010-09-15 11:54:49 +01:00
										 |  |  | 	.init_machine	= flexibity_board_init, | 
					
						
							|  |  |  | MACHINE_END |