Path: blob/master/arch/arm/mach-at91/board-neocore926.c
10817 views
/*1* linux/arch/arm/mach-at91/board-neocore926.c2*3* Copyright (C) 2005 SAN People4* Copyright (C) 2007 Atmel Corporation5* Copyright (C) 2008 ADENEO.6*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/spi/ads7846.h>29#include <linux/fb.h>30#include <linux/gpio_keys.h>31#include <linux/input.h>3233#include <video/atmel_lcdc.h>3435#include <asm/setup.h>36#include <asm/mach-types.h>37#include <asm/irq.h>38#include <asm/sizes.h>3940#include <asm/mach/arch.h>41#include <asm/mach/map.h>42#include <asm/mach/irq.h>4344#include <mach/hardware.h>45#include <mach/board.h>46#include <mach/gpio.h>47#include <mach/at91sam9_smc.h>4849#include "sam9_smc.h"50#include "generic.h"515253static void __init neocore926_init_early(void)54{55/* Initialize processor: 20 MHz crystal */56at91sam9263_initialize(20000000);5758/* DBGU on ttyS0. (Rx & Tx only) */59at91_register_uart(0, 0, 0);6061/* USART0 on ttyS1. (Rx, Tx, RTS, CTS) */62at91_register_uart(AT91SAM9263_ID_US0, 1, ATMEL_UART_CTS | ATMEL_UART_RTS);6364/* set serial console to ttyS0 (ie, DBGU) */65at91_set_serial_console(0);66}6768static void __init neocore926_init_irq(void)69{70at91sam9263_init_interrupts(NULL);71}727374/*75* USB Host port76*/77static struct at91_usbh_data __initdata neocore926_usbh_data = {78.ports = 2,79.vbus_pin = { AT91_PIN_PA24, AT91_PIN_PA21 },80};8182/*83* USB Device port84*/85static struct at91_udc_data __initdata neocore926_udc_data = {86.vbus_pin = AT91_PIN_PA25,87.pullup_pin = 0, /* pull-up driven by UDC */88};899091/*92* ADS7846 Touchscreen93*/94#if defined(CONFIG_TOUCHSCREEN_ADS7846) || defined(CONFIG_TOUCHSCREEN_ADS7846_MODULE)95static int ads7843_pendown_state(void)96{97return !at91_get_gpio_value(AT91_PIN_PA15); /* Touchscreen PENIRQ */98}99100static struct ads7846_platform_data ads_info = {101.model = 7843,102.x_min = 150,103.x_max = 3830,104.y_min = 190,105.y_max = 3830,106.vref_delay_usecs = 100,107.x_plate_ohms = 450,108.y_plate_ohms = 250,109.pressure_max = 15000,110.debounce_max = 1,111.debounce_rep = 0,112.debounce_tol = (~0),113.get_pendown_state = ads7843_pendown_state,114};115116static void __init neocore926_add_device_ts(void)117{118at91_set_B_periph(AT91_PIN_PA15, 1); /* External IRQ1, with pullup */119at91_set_gpio_input(AT91_PIN_PC13, 1); /* Touchscreen BUSY signal */120}121#else122static void __init neocore926_add_device_ts(void) {}123#endif124125/*126* SPI devices.127*/128static struct spi_board_info neocore926_spi_devices[] = {129#if defined(CONFIG_MTD_AT91_DATAFLASH_CARD)130{ /* DataFlash card */131.modalias = "mtd_dataflash",132.chip_select = 0,133.max_speed_hz = 15 * 1000 * 1000,134.bus_num = 0,135},136#endif137#if defined(CONFIG_TOUCHSCREEN_ADS7846) || defined(CONFIG_TOUCHSCREEN_ADS7846_MODULE)138{139.modalias = "ads7846",140.chip_select = 1,141.max_speed_hz = 125000 * 16,142.bus_num = 0,143.platform_data = &ads_info,144.irq = AT91SAM9263_ID_IRQ1,145},146#endif147};148149150/*151* MCI (SD/MMC)152*/153static struct at91_mmc_data __initdata neocore926_mmc_data = {154.wire4 = 1,155.det_pin = AT91_PIN_PE18,156.wp_pin = AT91_PIN_PE19,157};158159160/*161* MACB Ethernet device162*/163static struct at91_eth_data __initdata neocore926_macb_data = {164.phy_irq_pin = AT91_PIN_PE31,165.is_rmii = 1,166};167168169/*170* NAND flash171*/172static struct mtd_partition __initdata neocore926_nand_partition[] = {173{174.name = "Linux Kernel", /* "Partition 1", */175.offset = 0,176.size = SZ_8M,177},178{179.name = "Filesystem", /* "Partition 2", */180.offset = MTDPART_OFS_NXTBLK,181.size = SZ_32M,182},183{184.name = "Free", /* "Partition 3", */185.offset = MTDPART_OFS_NXTBLK,186.size = MTDPART_SIZ_FULL,187},188};189190static struct mtd_partition * __init nand_partitions(int size, int *num_partitions)191{192*num_partitions = ARRAY_SIZE(neocore926_nand_partition);193return neocore926_nand_partition;194}195196static struct atmel_nand_data __initdata neocore926_nand_data = {197.ale = 21,198.cle = 22,199.rdy_pin = AT91_PIN_PB19,200.rdy_pin_active_low = 1,201.enable_pin = AT91_PIN_PD15,202.partition_info = nand_partitions,203};204205static struct sam9_smc_config __initdata neocore926_nand_smc_config = {206.ncs_read_setup = 0,207.nrd_setup = 1,208.ncs_write_setup = 0,209.nwe_setup = 1,210211.ncs_read_pulse = 4,212.nrd_pulse = 4,213.ncs_write_pulse = 4,214.nwe_pulse = 4,215216.read_cycle = 6,217.write_cycle = 6,218219.mode = AT91_SMC_READMODE | AT91_SMC_WRITEMODE | AT91_SMC_EXNWMODE_DISABLE | AT91_SMC_DBW_8,220.tdf_cycles = 2,221};222223static void __init neocore926_add_device_nand(void)224{225/* configure chip-select 3 (NAND) */226sam9_smc_configure(3, &neocore926_nand_smc_config);227228at91_add_device_nand(&neocore926_nand_data);229}230231232/*233* LCD Controller234*/235#if defined(CONFIG_FB_ATMEL) || defined(CONFIG_FB_ATMEL_MODULE)236static struct fb_videomode at91_tft_vga_modes[] = {237{238.name = "TX09D50VM1CCA @ 60",239.refresh = 60,240.xres = 240, .yres = 320,241.pixclock = KHZ2PICOS(5000),242243.left_margin = 1, .right_margin = 33,244.upper_margin = 1, .lower_margin = 0,245.hsync_len = 5, .vsync_len = 1,246247.sync = FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT,248.vmode = FB_VMODE_NONINTERLACED,249},250};251252static struct fb_monspecs at91fb_default_monspecs = {253.manufacturer = "HIT",254.monitor = "TX09D70VM1CCA",255256.modedb = at91_tft_vga_modes,257.modedb_len = ARRAY_SIZE(at91_tft_vga_modes),258.hfmin = 15000,259.hfmax = 64000,260.vfmin = 50,261.vfmax = 150,262};263264#define AT91SAM9263_DEFAULT_LCDCON2 (ATMEL_LCDC_MEMOR_LITTLE \265| ATMEL_LCDC_DISTYPE_TFT \266| ATMEL_LCDC_CLKMOD_ALWAYSACTIVE)267268static void at91_lcdc_power_control(int on)269{270at91_set_gpio_value(AT91_PIN_PA30, on);271}272273/* Driver datas */274static struct atmel_lcdfb_info __initdata neocore926_lcdc_data = {275.lcdcon_is_backlight = true,276.default_bpp = 16,277.default_dmacon = ATMEL_LCDC_DMAEN,278.default_lcdcon2 = AT91SAM9263_DEFAULT_LCDCON2,279.default_monspecs = &at91fb_default_monspecs,280.atmel_lcdfb_power_control = at91_lcdc_power_control,281.guard_time = 1,282.lcd_wiring_mode = ATMEL_LCDC_WIRING_RGB555,283};284285#else286static struct atmel_lcdfb_info __initdata neocore926_lcdc_data;287#endif288289290/*291* GPIO Buttons292*/293#if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE)294static struct gpio_keys_button neocore926_buttons[] = {295{ /* BP1, "leftclic" */296.code = BTN_LEFT,297.gpio = AT91_PIN_PC5,298.active_low = 1,299.desc = "left_click",300.wakeup = 1,301},302{ /* BP2, "rightclic" */303.code = BTN_RIGHT,304.gpio = AT91_PIN_PC4,305.active_low = 1,306.desc = "right_click",307.wakeup = 1,308},309};310311static struct gpio_keys_platform_data neocore926_button_data = {312.buttons = neocore926_buttons,313.nbuttons = ARRAY_SIZE(neocore926_buttons),314};315316static struct platform_device neocore926_button_device = {317.name = "gpio-keys",318.id = -1,319.num_resources = 0,320.dev = {321.platform_data = &neocore926_button_data,322}323};324325static void __init neocore926_add_device_buttons(void)326{327at91_set_GPIO_periph(AT91_PIN_PC5, 0); /* left button */328at91_set_deglitch(AT91_PIN_PC5, 1);329at91_set_GPIO_periph(AT91_PIN_PC4, 0); /* right button */330at91_set_deglitch(AT91_PIN_PC4, 1);331332platform_device_register(&neocore926_button_device);333}334#else335static void __init neocore926_add_device_buttons(void) {}336#endif337338339/*340* AC97341*/342static struct ac97c_platform_data neocore926_ac97_data = {343.reset_pin = AT91_PIN_PA13,344};345346347static void __init neocore926_board_init(void)348{349/* Serial */350at91_add_device_serial();351352/* USB Host */353at91_add_device_usbh(&neocore926_usbh_data);354355/* USB Device */356at91_add_device_udc(&neocore926_udc_data);357358/* SPI */359at91_set_gpio_output(AT91_PIN_PE20, 1); /* select spi0 clock */360at91_add_device_spi(neocore926_spi_devices, ARRAY_SIZE(neocore926_spi_devices));361362/* Touchscreen */363neocore926_add_device_ts();364365/* MMC */366at91_add_device_mmc(1, &neocore926_mmc_data);367368/* Ethernet */369at91_add_device_eth(&neocore926_macb_data);370371/* NAND */372neocore926_add_device_nand();373374/* I2C */375at91_add_device_i2c(NULL, 0);376377/* LCD Controller */378at91_add_device_lcdc(&neocore926_lcdc_data);379380/* Push Buttons */381neocore926_add_device_buttons();382383/* AC97 */384at91_add_device_ac97(&neocore926_ac97_data);385}386387MACHINE_START(NEOCORE926, "ADENEO NEOCORE 926")388/* Maintainer: ADENEO */389.timer = &at91sam926x_timer,390.map_io = at91sam9263_map_io,391.init_early = neocore926_init_early,392.init_irq = neocore926_init_irq,393.init_machine = neocore926_board_init,394MACHINE_END395396397