Path: blob/master/arch/arm/mach-at91/board-cpuat91.c
10817 views
/*1* linux/arch/arm/mach-at91/board-cpuat91.c2*3* Copyright (C) 2009 Eric Benard - [email protected]4*5* This program is free software; you can redistribute it and/or modify6* it under the terms of the GNU General Public License as published by7* the Free Software Foundation; either version 2 of the License, or8* (at your option) any later version.9*10* This program is distributed in the hope that it will be useful,11* but WITHOUT ANY WARRANTY; without even the implied warranty of12* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the13* GNU General Public License for more details.14*15* You should have received a copy of the GNU General Public License16* along with this program; if not, write to the Free Software17* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA18*/1920#include <linux/types.h>21#include <linux/init.h>22#include <linux/mm.h>23#include <linux/module.h>24#include <linux/platform_device.h>25#include <linux/mtd/physmap.h>26#include <linux/mtd/plat-ram.h>2728#include <mach/hardware.h>29#include <asm/setup.h>30#include <asm/mach-types.h>31#include <asm/irq.h>3233#include <asm/mach/arch.h>34#include <asm/mach/map.h>35#include <asm/mach/irq.h>3637#include <mach/board.h>38#include <mach/gpio.h>39#include <mach/at91rm9200_mc.h>40#include <mach/cpu.h>4142#include "generic.h"4344static struct gpio_led cpuat91_leds[] = {45{46.name = "led1",47.default_trigger = "heartbeat",48.active_low = 1,49.gpio = AT91_PIN_PC0,50},51};5253static void __init cpuat91_init_early(void)54{55/* Set cpu type: PQFP */56at91rm9200_set_type(ARCH_REVISON_9200_PQFP);5758/* Initialize processor: 18.432 MHz crystal */59at91rm9200_initialize(18432000);6061/* DBGU on ttyS0. (Rx & Tx only) */62at91_register_uart(0, 0, 0);6364/* USART0 on ttyS1. (Rx, Tx, CTS, RTS) */65at91_register_uart(AT91RM9200_ID_US0, 1, ATMEL_UART_CTS |66ATMEL_UART_RTS);6768/* USART1 on ttyS2. (Rx, Tx, CTS, RTS, DTR, DSR, DCD, RI) */69at91_register_uart(AT91RM9200_ID_US1, 2, ATMEL_UART_CTS |70ATMEL_UART_RTS | ATMEL_UART_DTR | ATMEL_UART_DSR |71ATMEL_UART_DCD | ATMEL_UART_RI);7273/* USART2 on ttyS3 (Rx, Tx) */74at91_register_uart(AT91RM9200_ID_US2, 3, 0);7576/* USART3 on ttyS4 (Rx, Tx, CTS, RTS) */77at91_register_uart(AT91RM9200_ID_US3, 4, ATMEL_UART_CTS |78ATMEL_UART_RTS);7980/* set serial console to ttyS0 (ie, DBGU) */81at91_set_serial_console(0);82}8384static void __init cpuat91_init_irq(void)85{86at91rm9200_init_interrupts(NULL);87}8889static struct at91_eth_data __initdata cpuat91_eth_data = {90.is_rmii = 1,91};9293static struct at91_usbh_data __initdata cpuat91_usbh_data = {94.ports = 1,95};9697static struct at91_udc_data __initdata cpuat91_udc_data = {98.vbus_pin = AT91_PIN_PC15,99.pullup_pin = AT91_PIN_PC14,100};101102static struct at91_mmc_data __initdata cpuat91_mmc_data = {103.det_pin = AT91_PIN_PC2,104.wire4 = 1,105};106107static struct physmap_flash_data cpuat91_flash_data = {108.width = 2,109};110111static struct resource cpuat91_flash_resource = {112.start = AT91_CHIPSELECT_0,113.end = AT91_CHIPSELECT_0 + SZ_16M - 1,114.flags = IORESOURCE_MEM,115};116117static struct platform_device cpuat91_norflash = {118.name = "physmap-flash",119.id = 0,120.dev = {121.platform_data = &cpuat91_flash_data,122},123.resource = &cpuat91_flash_resource,124.num_resources = 1,125};126127#ifdef CONFIG_MTD_PLATRAM128struct platdata_mtd_ram at91_sram_pdata = {129.mapname = "SRAM",130.bankwidth = 2,131};132133static struct resource at91_sram_resource[] = {134[0] = {135.start = AT91RM9200_SRAM_BASE,136.end = AT91RM9200_SRAM_BASE + AT91RM9200_SRAM_SIZE - 1,137.flags = IORESOURCE_MEM,138},139};140141static struct platform_device at91_sram = {142.name = "mtd-ram",143.id = 0,144.resource = at91_sram_resource,145.num_resources = ARRAY_SIZE(at91_sram_resource),146.dev = {147.platform_data = &at91_sram_pdata,148},149};150#endif /* MTD_PLATRAM */151152static struct platform_device *platform_devices[] __initdata = {153&cpuat91_norflash,154#ifdef CONFIG_MTD_PLATRAM155&at91_sram,156#endif /* CONFIG_MTD_PLATRAM */157};158159static void __init cpuat91_board_init(void)160{161/* Serial */162at91_add_device_serial();163/* LEDs. */164at91_gpio_leds(cpuat91_leds, ARRAY_SIZE(cpuat91_leds));165/* Ethernet */166at91_add_device_eth(&cpuat91_eth_data);167/* USB Host */168at91_add_device_usbh(&cpuat91_usbh_data);169/* USB Device */170at91_add_device_udc(&cpuat91_udc_data);171/* MMC */172at91_add_device_mmc(0, &cpuat91_mmc_data);173/* I2C */174at91_add_device_i2c(NULL, 0);175/* Platform devices */176platform_add_devices(platform_devices, ARRAY_SIZE(platform_devices));177}178179MACHINE_START(CPUAT91, "Eukrea")180/* Maintainer: Eric Benard - EUKREA Electromatique */181.timer = &at91rm9200_timer,182.map_io = at91rm9200_map_io,183.init_early = cpuat91_init_early,184.init_irq = cpuat91_init_irq,185.init_machine = cpuat91_board_init,186MACHINE_END187188189