Path: blob/master/arch/arm/mach-at91/board-ecbat91.c
10817 views
/*1* linux/arch/arm/mach-at91rm9200/board-ecbat91.c2* Copyright (C) 2007 emQbit.com.3*4* We started from board-dk.c, which is Copyright (C) 2005 SAN People.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/flash.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/cpu.h>4142#include "generic.h"434445static void __init ecb_at91init_early(void)46{47/* Set cpu type: PQFP */48at91rm9200_set_type(ARCH_REVISON_9200_PQFP);4950/* Initialize processor: 18.432 MHz crystal */51at91rm9200_initialize(18432000);5253/* Setup the LEDs */54at91_init_leds(AT91_PIN_PC7, AT91_PIN_PC7);5556/* DBGU on ttyS0. (Rx & Tx only) */57at91_register_uart(0, 0, 0);5859/* USART0 on ttyS1. (Rx & Tx only) */60at91_register_uart(AT91RM9200_ID_US0, 1, 0);6162/* set serial console to ttyS0 (ie, DBGU) */63at91_set_serial_console(0);64}6566static void __init ecb_at91init_irq(void)67{68at91rm9200_init_interrupts(NULL);69}7071static struct at91_eth_data __initdata ecb_at91eth_data = {72.phy_irq_pin = AT91_PIN_PC4,73.is_rmii = 0,74};7576static struct at91_usbh_data __initdata ecb_at91usbh_data = {77.ports = 1,78};7980static struct at91_mmc_data __initdata ecb_at91mmc_data = {81.slot_b = 0,82.wire4 = 1,83};848586#if defined(CONFIG_MTD_DATAFLASH)87static struct mtd_partition __initdata my_flash0_partitions[] =88{89{ /* 0x8400 */90.name = "Darrell-loader",91.offset = 0,92.size = 12 * 1056,93},94{95.name = "U-boot",96.offset = MTDPART_OFS_NXTBLK,97.size = 110 * 1056,98},99{ /* 1336 (167 blocks) pages * 1056 bytes = 0x158700 bytes */100.name = "UBoot-env",101.offset = MTDPART_OFS_NXTBLK,102.size = 8 * 1056,103},104{ /* 1336 (167 blocks) pages * 1056 bytes = 0x158700 bytes */105.name = "Kernel",106.offset = MTDPART_OFS_NXTBLK,107.size = 1534 * 1056,108},109{ /* 190200 - jffs2 root filesystem */110.name = "Filesystem",111.offset = MTDPART_OFS_NXTBLK,112.size = MTDPART_SIZ_FULL, /* 26 sectors */113}114};115116static struct flash_platform_data __initdata my_flash0_platform = {117.name = "Removable flash card",118.parts = my_flash0_partitions,119.nr_parts = ARRAY_SIZE(my_flash0_partitions)120};121122#endif123124static struct spi_board_info __initdata ecb_at91spi_devices[] = {125{ /* DataFlash chip */126.modalias = "mtd_dataflash",127.chip_select = 0,128.max_speed_hz = 10 * 1000 * 1000,129.bus_num = 0,130#if defined(CONFIG_MTD_DATAFLASH)131.platform_data = &my_flash0_platform,132#endif133},134{ /* User accessible spi - cs1 (250KHz) */135.modalias = "spi-cs1",136.chip_select = 1,137.max_speed_hz = 250 * 1000,138},139{ /* User accessible spi - cs2 (1MHz) */140.modalias = "spi-cs2",141.chip_select = 2,142.max_speed_hz = 1 * 1000 * 1000,143},144{ /* User accessible spi - cs3 (10MHz) */145.modalias = "spi-cs3",146.chip_select = 3,147.max_speed_hz = 10 * 1000 * 1000,148},149};150151static void __init ecb_at91board_init(void)152{153/* Serial */154at91_add_device_serial();155156/* Ethernet */157at91_add_device_eth(&ecb_at91eth_data);158159/* USB Host */160at91_add_device_usbh(&ecb_at91usbh_data);161162/* I2C */163at91_add_device_i2c(NULL, 0);164165/* MMC */166at91_add_device_mmc(0, &ecb_at91mmc_data);167168/* SPI */169at91_add_device_spi(ecb_at91spi_devices, ARRAY_SIZE(ecb_at91spi_devices));170}171172MACHINE_START(ECBAT91, "emQbit's ECB_AT91")173/* Maintainer: emQbit.com */174.timer = &at91rm9200_timer,175.map_io = at91rm9200_map_io,176.init_early = ecb_at91init_early,177.init_irq = ecb_at91init_irq,178.init_machine = ecb_at91board_init,179MACHINE_END180181182