Path: blob/master/arch/arm/mach-at91/board-foxg20.c
10817 views
/*1* Copyright (C) 2005 SAN People2* Copyright (C) 2008 Atmel3* Copyright (C) 2010 Lee McLoughlin - [email protected]4* Copyright (C) 2010 Sergio Tanzilli - [email protected]5*6* This program is free software; you can redistribute it and/or modify7* it under the terms of the GNU General Public License as published by8* the Free Software Foundation; either version 2 of the License, or9* (at your option) any later version.10*11* This program is distributed in the hope that it will be useful,12* but WITHOUT ANY WARRANTY; without even the implied warranty of13* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the14* GNU General Public License for more details.15*16* You should have received a copy of the GNU General Public License17* along with this program; if not, write to the Free Software18* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA19*/2021#include <linux/types.h>22#include <linux/init.h>23#include <linux/mm.h>24#include <linux/module.h>25#include <linux/platform_device.h>26#include <linux/spi/spi.h>27#include <linux/spi/at73c213.h>28#include <linux/gpio.h>29#include <linux/gpio_keys.h>30#include <linux/input.h>31#include <linux/clk.h>32#include <linux/w1-gpio.h>3334#include <mach/hardware.h>35#include <asm/setup.h>36#include <asm/mach-types.h>37#include <asm/irq.h>3839#include <asm/mach/arch.h>40#include <asm/mach/map.h>41#include <asm/mach/irq.h>4243#include <mach/board.h>44#include <mach/at91sam9_smc.h>4546#include "sam9_smc.h"47#include "generic.h"4849/*50* The FOX Board G20 hardware comes as the "Netus G20" board with51* just the cpu, ram, dataflash and two header connectors.52* This is plugged into the FOX Board which provides the ethernet,53* usb, rtc, leds, switch, ...54*55* For more info visit: http://www.acmesystems.it/foxg2056*/575859static void __init foxg20_init_early(void)60{61/* Initialize processor: 18.432 MHz crystal */62at91sam9260_initialize(18432000);6364/* DBGU on ttyS0. (Rx & Tx only) */65at91_register_uart(0, 0, 0);6667/* USART0 on ttyS1. (Rx, Tx, CTS, RTS, DTR, DSR, DCD, RI) */68at91_register_uart(AT91SAM9260_ID_US0, 1,69ATMEL_UART_CTS70| ATMEL_UART_RTS71| ATMEL_UART_DTR72| ATMEL_UART_DSR73| ATMEL_UART_DCD74| ATMEL_UART_RI);7576/* USART1 on ttyS2. (Rx, Tx, RTS, CTS) */77at91_register_uart(AT91SAM9260_ID_US1, 2,78ATMEL_UART_CTS79| ATMEL_UART_RTS);8081/* USART2 on ttyS3. (Rx & Tx only) */82at91_register_uart(AT91SAM9260_ID_US2, 3, 0);8384/* USART3 on ttyS4. (Rx, Tx, RTS, CTS) */85at91_register_uart(AT91SAM9260_ID_US3, 4,86ATMEL_UART_CTS87| ATMEL_UART_RTS);8889/* USART4 on ttyS5. (Rx & Tx only) */90at91_register_uart(AT91SAM9260_ID_US4, 5, 0);9192/* USART5 on ttyS6. (Rx & Tx only) */93at91_register_uart(AT91SAM9260_ID_US5, 6, 0);9495/* set serial console to ttyS0 (ie, DBGU) */96at91_set_serial_console(0);9798/* Set the internal pull-up resistor on DRXD */99at91_set_A_periph(AT91_PIN_PB14, 1);100101}102103static void __init foxg20_init_irq(void)104{105at91sam9260_init_interrupts(NULL);106}107108109/*110* USB Host port111*/112static struct at91_usbh_data __initdata foxg20_usbh_data = {113.ports = 2,114};115116/*117* USB Device port118*/119static struct at91_udc_data __initdata foxg20_udc_data = {120.vbus_pin = AT91_PIN_PC6,121.pullup_pin = 0, /* pull-up driven by UDC */122};123124125/*126* SPI devices.127*/128static struct spi_board_info foxg20_spi_devices[] = {129#if !defined(CONFIG_MMC_AT91)130{131.modalias = "mtd_dataflash",132.chip_select = 1,133.max_speed_hz = 15 * 1000 * 1000,134.bus_num = 0,135},136#endif137};138139140/*141* MACB Ethernet device142*/143static struct at91_eth_data __initdata foxg20_macb_data = {144.phy_irq_pin = AT91_PIN_PA7,145.is_rmii = 1,146};147148/*149* MCI (SD/MMC)150* det_pin, wp_pin and vcc_pin are not connected151*/152static struct at91_mmc_data __initdata foxg20_mmc_data = {153.slot_b = 1,154.wire4 = 1,155};156157158/*159* LEDs160*/161static struct gpio_led foxg20_leds[] = {162{ /* user led, red */163.name = "user_led",164.gpio = AT91_PIN_PC7,165.active_low = 0,166.default_trigger = "heartbeat",167},168};169170171/*172* GPIO Buttons173*/174#if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE)175static struct gpio_keys_button foxg20_buttons[] = {176{177.gpio = AT91_PIN_PC4,178.code = BTN_1,179.desc = "Button 1",180.active_low = 1,181.wakeup = 1,182},183};184185static struct gpio_keys_platform_data foxg20_button_data = {186.buttons = foxg20_buttons,187.nbuttons = ARRAY_SIZE(foxg20_buttons),188};189190static struct platform_device foxg20_button_device = {191.name = "gpio-keys",192.id = -1,193.num_resources = 0,194.dev = {195.platform_data = &foxg20_button_data,196}197};198199static void __init foxg20_add_device_buttons(void)200{201at91_set_gpio_input(AT91_PIN_PC4, 1); /* btn1 */202at91_set_deglitch(AT91_PIN_PC4, 1);203204platform_device_register(&foxg20_button_device);205}206#else207static void __init foxg20_add_device_buttons(void) {}208#endif209210211#if defined(CONFIG_W1_MASTER_GPIO) || defined(CONFIG_W1_MASTER_GPIO_MODULE)212static struct w1_gpio_platform_data w1_gpio_pdata = {213/* If you choose to use a pin other than PB16 it needs to be 3.3V */214.pin = AT91_PIN_PB16,215.is_open_drain = 1,216};217218static struct platform_device w1_device = {219.name = "w1-gpio",220.id = -1,221.dev.platform_data = &w1_gpio_pdata,222};223224static void __init at91_add_device_w1(void)225{226at91_set_GPIO_periph(w1_gpio_pdata.pin, 1);227at91_set_multi_drive(w1_gpio_pdata.pin, 1);228platform_device_register(&w1_device);229}230231#endif232233234static struct i2c_board_info __initdata foxg20_i2c_devices[] = {235{236I2C_BOARD_INFO("24c512", 0x50),237},238};239240241static void __init foxg20_board_init(void)242{243/* Serial */244at91_add_device_serial();245/* USB Host */246at91_add_device_usbh(&foxg20_usbh_data);247/* USB Device */248at91_add_device_udc(&foxg20_udc_data);249/* SPI */250at91_add_device_spi(foxg20_spi_devices, ARRAY_SIZE(foxg20_spi_devices));251/* Ethernet */252at91_add_device_eth(&foxg20_macb_data);253/* MMC */254at91_add_device_mmc(0, &foxg20_mmc_data);255/* I2C */256at91_add_device_i2c(foxg20_i2c_devices, ARRAY_SIZE(foxg20_i2c_devices));257/* LEDs */258at91_gpio_leds(foxg20_leds, ARRAY_SIZE(foxg20_leds));259/* Push Buttons */260foxg20_add_device_buttons();261#if defined(CONFIG_W1_MASTER_GPIO) || defined(CONFIG_W1_MASTER_GPIO_MODULE)262at91_add_device_w1();263#endif264}265266MACHINE_START(ACMENETUSFOXG20, "Acme Systems srl FOX Board G20")267/* Maintainer: Sergio Tanzilli */268.timer = &at91sam926x_timer,269.map_io = at91sam9260_map_io,270.init_early = foxg20_init_early,271.init_irq = foxg20_init_irq,272.init_machine = foxg20_board_init,273MACHINE_END274275276