Path: blob/master/arch/arm/mach-at91/board-sam9-l9260.c
10817 views
/*1* linux/arch/arm/mach-at91/board-sam9-l9260.c2*3* Copyright (C) 2005 SAN People4* Copyright (C) 2006 Atmel5* Copyright (C) 2007 Olimex Ltd6*7* This program is free software; you can redistribute it and/or modify8* it under the terms of the GNU General Public License as published by9* the Free Software Foundation; either version 2 of the License, or10* (at your option) any later version.11*12* This program is distributed in the hope that it will be useful,13* but WITHOUT ANY WARRANTY; without even the implied warranty of14* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the15* GNU General Public License for more details.16*17* You should have received a copy of the GNU General Public License18* along with this program; if not, write to the Free Software19* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA20*/2122#include <linux/types.h>23#include <linux/init.h>24#include <linux/mm.h>25#include <linux/module.h>26#include <linux/platform_device.h>27#include <linux/spi/spi.h>2829#include <mach/hardware.h>30#include <asm/setup.h>31#include <asm/mach-types.h>32#include <asm/irq.h>3334#include <asm/mach/arch.h>35#include <asm/mach/map.h>36#include <asm/mach/irq.h>3738#include <mach/board.h>39#include <mach/gpio.h>40#include <mach/at91sam9_smc.h>4142#include "sam9_smc.h"43#include "generic.h"444546static void __init ek_init_early(void)47{48/* Initialize processor: 18.432 MHz crystal */49at91sam9260_initialize(18432000);5051/* Setup the LEDs */52at91_init_leds(AT91_PIN_PA9, AT91_PIN_PA6);5354/* DBGU on ttyS0. (Rx & Tx only) */55at91_register_uart(0, 0, 0);5657/* USART0 on ttyS1. (Rx, Tx, CTS, RTS, DTR, DSR, DCD, RI) */58at91_register_uart(AT91SAM9260_ID_US0, 1, ATMEL_UART_CTS | ATMEL_UART_RTS59| ATMEL_UART_DTR | ATMEL_UART_DSR | ATMEL_UART_DCD60| ATMEL_UART_RI);6162/* USART1 on ttyS2. (Rx, Tx, CTS, RTS) */63at91_register_uart(AT91SAM9260_ID_US1, 2, ATMEL_UART_CTS | ATMEL_UART_RTS);6465/* set serial console to ttyS0 (ie, DBGU) */66at91_set_serial_console(0);67}6869static void __init ek_init_irq(void)70{71at91sam9260_init_interrupts(NULL);72}737475/*76* USB Host port77*/78static struct at91_usbh_data __initdata ek_usbh_data = {79.ports = 2,80};8182/*83* USB Device port84*/85static struct at91_udc_data __initdata ek_udc_data = {86.vbus_pin = AT91_PIN_PC5,87.pullup_pin = 0, /* pull-up driven by UDC */88};899091/*92* SPI devices.93*/94static struct spi_board_info ek_spi_devices[] = {95#if !defined(CONFIG_MMC_AT91)96{ /* DataFlash chip */97.modalias = "mtd_dataflash",98.chip_select = 1,99.max_speed_hz = 15 * 1000 * 1000,100.bus_num = 0,101},102#if defined(CONFIG_MTD_AT91_DATAFLASH_CARD)103{ /* DataFlash card */104.modalias = "mtd_dataflash",105.chip_select = 0,106.max_speed_hz = 15 * 1000 * 1000,107.bus_num = 0,108},109#endif110#endif111};112113114/*115* MACB Ethernet device116*/117static struct at91_eth_data __initdata ek_macb_data = {118.phy_irq_pin = AT91_PIN_PA7,119.is_rmii = 0,120};121122123/*124* NAND flash125*/126static struct mtd_partition __initdata ek_nand_partition[] = {127{128.name = "Bootloader Area",129.offset = 0,130.size = 10 * SZ_1M,131},132{133.name = "User Area",134.offset = MTDPART_OFS_NXTBLK,135.size = MTDPART_SIZ_FULL,136},137};138139static struct mtd_partition * __init nand_partitions(int size, int *num_partitions)140{141*num_partitions = ARRAY_SIZE(ek_nand_partition);142return ek_nand_partition;143}144145static struct atmel_nand_data __initdata ek_nand_data = {146.ale = 21,147.cle = 22,148// .det_pin = ... not connected149.rdy_pin = AT91_PIN_PC13,150.enable_pin = AT91_PIN_PC14,151.partition_info = nand_partitions,152};153154static struct sam9_smc_config __initdata ek_nand_smc_config = {155.ncs_read_setup = 0,156.nrd_setup = 1,157.ncs_write_setup = 0,158.nwe_setup = 1,159160.ncs_read_pulse = 3,161.nrd_pulse = 3,162.ncs_write_pulse = 3,163.nwe_pulse = 3,164165.read_cycle = 5,166.write_cycle = 5,167168.mode = AT91_SMC_READMODE | AT91_SMC_WRITEMODE | AT91_SMC_EXNWMODE_DISABLE | AT91_SMC_DBW_8,169.tdf_cycles = 2,170};171172static void __init ek_add_device_nand(void)173{174/* configure chip-select 3 (NAND) */175sam9_smc_configure(3, &ek_nand_smc_config);176177at91_add_device_nand(&ek_nand_data);178}179180181/*182* MCI (SD/MMC)183*/184static struct at91_mmc_data __initdata ek_mmc_data = {185.slot_b = 1,186.wire4 = 1,187.det_pin = AT91_PIN_PC8,188.wp_pin = AT91_PIN_PC4,189// .vcc_pin = ... not connected190};191192static void __init ek_board_init(void)193{194/* Serial */195at91_add_device_serial();196/* USB Host */197at91_add_device_usbh(&ek_usbh_data);198/* USB Device */199at91_add_device_udc(&ek_udc_data);200/* SPI */201at91_add_device_spi(ek_spi_devices, ARRAY_SIZE(ek_spi_devices));202/* NAND */203ek_add_device_nand();204/* Ethernet */205at91_add_device_eth(&ek_macb_data);206/* MMC */207at91_add_device_mmc(0, &ek_mmc_data);208/* I2C */209at91_add_device_i2c(NULL, 0);210}211212MACHINE_START(SAM9_L9260, "Olimex SAM9-L9260")213/* Maintainer: Olimex */214.timer = &at91sam926x_timer,215.map_io = at91sam9260_map_io,216.init_early = ek_init_early,217.init_irq = ek_init_irq,218.init_machine = ek_board_init,219MACHINE_END220221222