Path: blob/master/arch/arm/mach-at91/board-qil-a9260.c
10817 views
/*1* linux/arch/arm/mach-at91/board-qil-a9260.c2*3* Copyright (C) 2005 SAN People4* Copyright (C) 2006 Atmel5* Copyright (C) 2007 Calao-systems6*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>28#include <linux/gpio_keys.h>29#include <linux/input.h>30#include <linux/clk.h>3132#include <asm/setup.h>33#include <asm/mach-types.h>34#include <asm/irq.h>3536#include <asm/mach/arch.h>37#include <asm/mach/map.h>38#include <asm/mach/irq.h>3940#include <mach/hardware.h>41#include <mach/board.h>42#include <mach/gpio.h>43#include <mach/at91sam9_smc.h>44#include <mach/at91_shdwc.h>4546#include "sam9_smc.h"47#include "generic.h"484950static void __init ek_init_early(void)51{52/* Initialize processor: 12.000 MHz crystal */53at91sam9260_initialize(12000000);5455/* DBGU on ttyS0. (Rx & Tx only) */56at91_register_uart(0, 0, 0);5758/* USART0 on ttyS1. (Rx, Tx, CTS, RTS, DTR, DSR, DCD, RI) */59at91_register_uart(AT91SAM9260_ID_US0, 1, ATMEL_UART_CTS | ATMEL_UART_RTS60| ATMEL_UART_DTR | ATMEL_UART_DSR | ATMEL_UART_DCD61| ATMEL_UART_RI);6263/* USART1 on ttyS2. (Rx, Tx, CTS, RTS) */64at91_register_uart(AT91SAM9260_ID_US1, 2, ATMEL_UART_CTS | ATMEL_UART_RTS);6566/* USART2 on ttyS3. (Rx, Tx, CTS, RTS) */67at91_register_uart(AT91SAM9260_ID_US2, 3, ATMEL_UART_CTS | ATMEL_UART_RTS);6869/* set serial console to ttyS1 (ie, USART0) */70at91_set_serial_console(1);7172}7374static void __init ek_init_irq(void)75{76at91sam9260_init_interrupts(NULL);77}787980/*81* USB Host port82*/83static struct at91_usbh_data __initdata ek_usbh_data = {84.ports = 2,85};8687/*88* USB Device port89*/90static struct at91_udc_data __initdata ek_udc_data = {91.vbus_pin = AT91_PIN_PC5,92.pullup_pin = 0, /* pull-up driven by UDC */93};9495/*96* SPI devices.97*/98static struct spi_board_info ek_spi_devices[] = {99#if defined(CONFIG_RTC_DRV_M41T94)100{ /* M41T94 RTC */101.modalias = "m41t94",102.chip_select = 0,103.max_speed_hz = 1 * 1000 * 1000,104.bus_num = 0,105}106#endif107};108109/*110* MACB Ethernet device111*/112static struct at91_eth_data __initdata ek_macb_data = {113.phy_irq_pin = AT91_PIN_PA31,114.is_rmii = 1,115};116117/*118* NAND flash119*/120static struct mtd_partition __initdata ek_nand_partition[] = {121{122.name = "Uboot & Kernel",123.offset = 0,124.size = SZ_16M,125},126{127.name = "Root FS",128.offset = MTDPART_OFS_NXTBLK,129.size = 120 * SZ_1M,130},131{132.name = "FS",133.offset = MTDPART_OFS_NXTBLK,134.size = 120 * SZ_1M,135},136};137138static struct mtd_partition * __init nand_partitions(int size, int *num_partitions)139{140*num_partitions = ARRAY_SIZE(ek_nand_partition);141return ek_nand_partition;142}143144static struct atmel_nand_data __initdata ek_nand_data = {145.ale = 21,146.cle = 22,147// .det_pin = ... not connected148.rdy_pin = AT91_PIN_PC13,149.enable_pin = AT91_PIN_PC14,150.partition_info = nand_partitions,151};152153static struct sam9_smc_config __initdata ek_nand_smc_config = {154.ncs_read_setup = 0,155.nrd_setup = 1,156.ncs_write_setup = 0,157.nwe_setup = 1,158159.ncs_read_pulse = 3,160.nrd_pulse = 3,161.ncs_write_pulse = 3,162.nwe_pulse = 3,163164.read_cycle = 5,165.write_cycle = 5,166167.mode = AT91_SMC_READMODE | AT91_SMC_WRITEMODE | AT91_SMC_EXNWMODE_DISABLE | AT91_SMC_DBW_8,168.tdf_cycles = 2,169};170171static void __init ek_add_device_nand(void)172{173/* configure chip-select 3 (NAND) */174sam9_smc_configure(3, &ek_nand_smc_config);175176at91_add_device_nand(&ek_nand_data);177}178179/*180* MCI (SD/MMC)181*/182static struct at91_mmc_data __initdata ek_mmc_data = {183.slot_b = 0,184.wire4 = 1,185// .det_pin = ... not connected186// .wp_pin = ... not connected187// .vcc_pin = ... not connected188};189190/*191* GPIO Buttons192*/193#if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE)194static struct gpio_keys_button ek_buttons[] = {195{ /* USER PUSH BUTTON */196.code = KEY_ENTER,197.gpio = AT91_PIN_PB10,198.active_low = 1,199.desc = "user_pb",200.wakeup = 1,201}202};203204static struct gpio_keys_platform_data ek_button_data = {205.buttons = ek_buttons,206.nbuttons = ARRAY_SIZE(ek_buttons),207};208209static struct platform_device ek_button_device = {210.name = "gpio-keys",211.id = -1,212.num_resources = 0,213.dev = {214.platform_data = &ek_button_data,215}216};217218static void __init ek_add_device_buttons(void)219{220at91_set_GPIO_periph(AT91_PIN_PB10, 1); /* user push button, pull up enabled */221at91_set_deglitch(AT91_PIN_PB10, 1);222223platform_device_register(&ek_button_device);224}225#else226static void __init ek_add_device_buttons(void) {}227#endif228229/*230* LEDs231*/232static struct gpio_led ek_leds[] = {233{ /* user_led (green) */234.name = "user_led",235.gpio = AT91_PIN_PB21,236.active_low = 0,237.default_trigger = "heartbeat",238}239};240241static void __init ek_board_init(void)242{243/* Serial */244at91_add_device_serial();245/* USB Host */246at91_add_device_usbh(&ek_usbh_data);247/* USB Device */248at91_add_device_udc(&ek_udc_data);249/* SPI */250at91_add_device_spi(ek_spi_devices, ARRAY_SIZE(ek_spi_devices));251/* NAND */252ek_add_device_nand();253/* I2C */254at91_add_device_i2c(NULL, 0);255/* Ethernet */256at91_add_device_eth(&ek_macb_data);257/* MMC */258at91_add_device_mmc(0, &ek_mmc_data);259/* Push Buttons */260ek_add_device_buttons();261/* LEDs */262at91_gpio_leds(ek_leds, ARRAY_SIZE(ek_leds));263/* shutdown controller, wakeup button (5 msec low) */264at91_sys_write(AT91_SHDW_MR, AT91_SHDW_CPTWK0_(10) | AT91_SHDW_WKMODE0_LOW265| AT91_SHDW_RTTWKEN);266}267268MACHINE_START(QIL_A9260, "CALAO QIL_A9260")269/* Maintainer: calao-systems */270.timer = &at91sam926x_timer,271.map_io = at91sam9260_map_io,272.init_early = ek_init_early,273.init_irq = ek_init_irq,274.init_machine = ek_board_init,275MACHINE_END276277278