2009-11-03 20:39:02 +01:00
/*
* 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 . , 51 Franklin Street , Fifth Floor , Boston , MA 02110 - 1301 USA
*/
# include <linux/init.h>
# include <linux/platform_device.h>
# include <linux/mtd/physmap.h>
# include <linux/gpio.h>
# include <asm/mach-types.h>
# include <asm/mach/arch.h>
# include <asm/mach/map.h>
# include <mach/at91rm9200_mc.h>
2012-02-13 12:58:53 +08:00
# include <mach/at91_ramc.h>
2011-04-24 11:40:22 +08:00
# include <mach/cpu.h>
2012-10-30 06:41:28 +08:00
# include "at91_aic.h"
2012-10-30 05:14:17 +08:00
# include "board.h"
2009-11-03 20:39:02 +01:00
# include "generic.h"
2011-04-28 20:19:32 +08:00
static void __init eco920_init_early ( void )
2009-11-03 20:39:02 +01:00
{
2011-04-24 11:40:22 +08:00
/* Set cpu type: PQFP */
at91rm9200_set_type ( ARCH_REVISON_9200_PQFP ) ;
2011-04-23 15:28:34 +08:00
at91_initialize ( 18432000 ) ;
2009-11-03 20:39:02 +01:00
}
2011-03-08 20:17:06 +00:00
static struct macb_platform_data __initdata eco920_eth_data = {
2009-11-03 20:39:02 +01:00
. phy_irq_pin = AT91_PIN_PC2 ,
. is_rmii = 1 ,
} ;
static struct at91_usbh_data __initdata eco920_usbh_data = {
. ports = 1 ,
2011-11-25 01:51:06 +08:00
. vbus_pin = { - EINVAL , - EINVAL } ,
. overcurrent_pin = { - EINVAL , - EINVAL } ,
2009-11-03 20:39:02 +01:00
} ;
static struct at91_udc_data __initdata eco920_udc_data = {
. vbus_pin = AT91_PIN_PB12 ,
. pullup_pin = AT91_PIN_PB13 ,
} ;
2012-05-21 12:23:27 +02:00
static struct mci_platform_data __initdata eco920_mci0_data = {
. slot [ 0 ] = {
. bus_width = 1 ,
. detect_pin = - EINVAL ,
. wp_pin = - EINVAL ,
} ,
2009-11-03 20:39:02 +01:00
} ;
static struct physmap_flash_data eco920_flash_data = {
. width = 2 ,
} ;
static struct resource eco920_flash_resource = {
. start = 0x11000000 ,
. end = 0x11ffffff ,
. flags = IORESOURCE_MEM ,
} ;
static struct platform_device eco920_flash = {
. name = " physmap-flash " ,
. id = 0 ,
. dev = {
. platform_data = & eco920_flash_data ,
} ,
. resource = & eco920_flash_resource ,
. num_resources = 1 ,
} ;
static struct spi_board_info eco920_spi_devices [ ] = {
{ /* CAN controller */
. modalias = " tlv5638 " ,
. chip_select = 3 ,
. max_speed_hz = 20 * 1000 * 1000 ,
. mode = SPI_CPHA ,
} ,
} ;
2012-03-13 17:47:33 +08:00
/*
* LEDs
*/
static struct gpio_led eco920_leds [ ] = {
{ /* D1 */
. name = " led1 " ,
. gpio = AT91_PIN_PB0 ,
. active_low = 1 ,
. default_trigger = " heartbeat " ,
} ,
{ /* D2 */
. name = " led2 " ,
. gpio = AT91_PIN_PB1 ,
. active_low = 1 ,
. default_trigger = " timer " ,
}
} ;
2009-11-03 20:39:02 +01:00
static void __init eco920_board_init ( void )
{
2012-04-05 14:14:28 +08:00
/* DBGU on ttyS0. (Rx & Tx only */
at91_register_uart ( 0 , 0 , 0 ) ;
2009-11-03 20:39:02 +01:00
at91_add_device_serial ( ) ;
at91_add_device_eth ( & eco920_eth_data ) ;
at91_add_device_usbh ( & eco920_usbh_data ) ;
at91_add_device_udc ( & eco920_udc_data ) ;
2012-05-21 12:23:27 +02:00
at91_add_device_mci ( 0 , & eco920_mci0_data ) ;
2009-11-03 20:39:02 +01:00
platform_device_register ( & eco920_flash ) ;
2012-02-13 12:58:53 +08:00
at91_ramc_write ( 0 , AT91_SMC_CSR ( 7 ) , AT91_SMC_RWHOLD_ ( 1 )
2009-11-03 20:39:02 +01:00
| AT91_SMC_RWSETUP_ ( 1 )
| AT91_SMC_DBW_8
| AT91_SMC_WSEN
| AT91_SMC_NWS_ ( 15 ) ) ;
at91_set_A_periph ( AT91_PIN_PC6 , 1 ) ;
at91_set_gpio_input ( AT91_PIN_PA23 , 0 ) ;
at91_set_deglitch ( AT91_PIN_PA23 , 1 ) ;
/* Initialization of the Static Memory Controller for Chip Select 3 */
2012-02-13 12:58:53 +08:00
at91_ramc_write ( 0 , AT91_SMC_CSR ( 3 ) ,
2009-11-03 20:39:02 +01:00
AT91_SMC_DBW_16 | /* 16 bit */
AT91_SMC_WSEN |
AT91_SMC_NWS_ ( 5 ) | /* wait states */
AT91_SMC_TDF_ ( 1 ) /* float time */
) ;
at91_add_device_spi ( eco920_spi_devices , ARRAY_SIZE ( eco920_spi_devices ) ) ;
2012-03-13 17:47:33 +08:00
/* LEDs */
at91_gpio_leds ( eco920_leds , ARRAY_SIZE ( eco920_leds ) ) ;
2009-11-03 20:39:02 +01:00
}
MACHINE_START ( ECO920 , " eco920 " )
/* Maintainer: Sascha Hauer */
2012-11-08 12:40:59 -07:00
. init_time = at91rm9200_timer_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 = eco920_init_early ,
2011-04-23 15:28:34 +08:00
. init_irq = at91_init_irq_default ,
2009-11-03 20:39:02 +01:00
. init_machine = eco920_board_init ,
MACHINE_END