2010-07-07 00:48:53 +04:00
/*
* linux / arch / arm / mach - at91 / board - snapper9260 . c
*
* Copyright ( C ) 2010 Bluewater System Ltd
*
* Author : Andre Renaud < andre @ bluewatersys . com >
2011-06-15 08:45:36 +04:00
* Author : Ryan Mallon
2010-07-07 00:48:53 +04: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 . , 59 Temple Place , Suite 330 , Boston , MA 02111 - 1307 USA
*
*/
# include <linux/init.h>
# include <linux/gpio.h>
# include <linux/platform_device.h>
# include <linux/spi/spi.h>
# include <linux/i2c/pca953x.h>
# include <asm/mach-types.h>
# include <asm/mach/arch.h>
# include <mach/hardware.h>
# include <mach/at91sam9_smc.h>
2012-10-30 02:41:28 +04:00
# include "at91_aic.h"
2012-10-30 01:14:17 +04:00
# include "board.h"
2010-07-07 00:48:53 +04:00
# include "sam9_smc.h"
# include "generic.h"
# define SNAPPER9260_IO_EXP_GPIO(x) (NR_BUILTIN_GPIO + (x))
2011-04-28 16:19:32 +04:00
static void __init snapper9260_init_early ( void )
2010-07-07 00:48:53 +04:00
{
2011-04-23 11:28:34 +04:00
at91_initialize ( 18432000 ) ;
2010-07-07 00:48:53 +04:00
}
static struct at91_usbh_data __initdata snapper9260_usbh_data = {
. ports = 2 ,
2011-11-24 21:51:06 +04:00
. vbus_pin = { - EINVAL , - EINVAL } ,
. overcurrent_pin = { - EINVAL , - EINVAL } ,
2010-07-07 00:48:53 +04:00
} ;
static struct at91_udc_data __initdata snapper9260_udc_data = {
. vbus_pin = SNAPPER9260_IO_EXP_GPIO ( 5 ) ,
. vbus_active_low = 1 ,
. vbus_polled = 1 ,
2011-11-24 21:51:06 +04:00
. pullup_pin = - EINVAL ,
2010-07-07 00:48:53 +04:00
} ;
2011-03-08 23:17:06 +03:00
static struct macb_platform_data snapper9260_macb_data = {
2011-11-24 21:51:06 +04:00
. phy_irq_pin = - EINVAL ,
2010-07-07 00:48:53 +04:00
. is_rmii = 1 ,
} ;
static struct mtd_partition __initdata snapper9260_nand_partitions [ ] = {
{
. name = " Preboot " ,
. offset = 0 ,
. size = SZ_128K ,
} ,
{
. name = " Bootloader " ,
. offset = MTDPART_OFS_APPEND ,
. size = SZ_256K ,
} ,
{
. name = " Environment " ,
. offset = MTDPART_OFS_APPEND ,
. size = SZ_128K ,
} ,
{
. name = " Kernel " ,
. offset = MTDPART_OFS_APPEND ,
. size = SZ_4M ,
} ,
{
. name = " Filesystem " ,
. offset = MTDPART_OFS_APPEND ,
. size = MTDPART_SIZ_FULL ,
} ,
} ;
static struct atmel_nand_data __initdata snapper9260_nand_data = {
. ale = 21 ,
. cle = 22 ,
. rdy_pin = AT91_PIN_PC13 ,
2011-05-29 17:49:22 +04:00
. parts = snapper9260_nand_partitions ,
. num_parts = ARRAY_SIZE ( snapper9260_nand_partitions ) ,
2010-07-07 00:48:53 +04:00
. bus_width_16 = 0 ,
2011-11-24 21:51:06 +04:00
. enable_pin = - EINVAL ,
. det_pin = - EINVAL ,
2011-12-29 10:43:24 +04:00
. ecc_mode = NAND_ECC_SOFT ,
2010-07-07 00:48:53 +04:00
} ;
static struct sam9_smc_config __initdata snapper9260_nand_smc_config = {
. ncs_read_setup = 0 ,
. nrd_setup = 0 ,
. ncs_write_setup = 0 ,
. nwe_setup = 0 ,
. ncs_read_pulse = 5 ,
. nrd_pulse = 2 ,
. ncs_write_pulse = 5 ,
. nwe_pulse = 2 ,
. read_cycle = 7 ,
. write_cycle = 7 ,
. mode = ( AT91_SMC_READMODE | AT91_SMC_WRITEMODE |
AT91_SMC_EXNWMODE_DISABLE ) ,
. tdf_cycles = 1 ,
} ;
static struct pca953x_platform_data snapper9260_io_expander_data = {
. gpio_base = SNAPPER9260_IO_EXP_GPIO ( 0 ) ,
} ;
static struct i2c_board_info __initdata snapper9260_i2c_devices [ ] = {
{
/* IO expander */
I2C_BOARD_INFO ( " max7312 " , 0x28 ) ,
. platform_data = & snapper9260_io_expander_data ,
} ,
{
/* Audio codec */
I2C_BOARD_INFO ( " tlv320aic23 " , 0x1a ) ,
} ,
2012-02-11 23:48:52 +04:00
} ;
static struct i2c_board_info __initdata snapper9260_i2c_isl1208 = {
2010-07-07 00:48:53 +04:00
/* RTC */
I2C_BOARD_INFO ( " isl1208 " , 0x6f ) ,
} ;
static void __init snapper9260_add_device_nand ( void )
{
at91_set_A_periph ( AT91_PIN_PC14 , 0 ) ;
2011-10-13 21:37:09 +04:00
sam9_smc_configure ( 0 , 3 , & snapper9260_nand_smc_config ) ;
2010-07-07 00:48:53 +04:00
at91_add_device_nand ( & snapper9260_nand_data ) ;
}
static void __init snapper9260_board_init ( void )
{
at91_add_device_i2c ( snapper9260_i2c_devices ,
ARRAY_SIZE ( snapper9260_i2c_devices ) ) ;
2012-02-11 23:48:52 +04:00
snapper9260_i2c_isl1208 . irq = gpio_to_irq ( AT91_PIN_PA31 ) ;
i2c_register_board_info ( 0 , & snapper9260_i2c_isl1208 , 1 ) ;
2012-04-05 10:14:28 +04:00
/* Debug on ttyS0 */
at91_register_uart ( 0 , 0 , 0 ) ;
at91_register_uart ( AT91SAM9260_ID_US0 , 1 ,
ATMEL_UART_CTS | ATMEL_UART_RTS ) ;
at91_register_uart ( AT91SAM9260_ID_US1 , 2 ,
ATMEL_UART_CTS | ATMEL_UART_RTS ) ;
at91_register_uart ( AT91SAM9260_ID_US2 , 3 , 0 ) ;
2010-07-07 00:48:53 +04:00
at91_add_device_serial ( ) ;
at91_add_device_usbh ( & snapper9260_usbh_data ) ;
at91_add_device_udc ( & snapper9260_udc_data ) ;
at91_add_device_eth ( & snapper9260_macb_data ) ;
at91_add_device_ssc ( AT91SAM9260_ID_SSC , ( ATMEL_SSC_TF | ATMEL_SSC_TK |
ATMEL_SSC_TD | ATMEL_SSC_RD ) ) ;
snapper9260_add_device_nand ( ) ;
}
MACHINE_START ( SNAPPER_9260 , " Bluewater Systems Snapper 9260/9G20 module " )
2012-11-08 23:40:59 +04:00
. init_time = at91sam926x_pit_init ,
2011-04-23 11:28:34 +04:00
. map_io = at91_map_io ,
2012-06-11 17:38:03 +04:00
. handle_irq = at91_aic_handle_irq ,
2011-04-28 16:19:32 +04:00
. init_early = snapper9260_init_early ,
2011-04-23 11:28:34 +04:00
. init_irq = at91_init_irq_default ,
2010-07-07 00:48:53 +04:00
. init_machine = snapper9260_board_init ,
MACHINE_END