Path: blob/master/arch/arm/mach-at91/board-afeb-9260v1.c
10817 views
/*1* linux/arch/arm/mach-at91/board-afeb-9260v1.c2*3* Copyright (C) 2005 SAN People4* Copyright (C) 2006 Atmel5* Copyright (C) 2008 Sergey Lapin6*7* A custom board designed as open hardware; PCBs and various information8* is available at http://groups.google.com/group/arm9fpga-evolution-board/9* Subversion repository: svn://194.85.238.22/home/users/george/svn/arm9eb10*11* This program is free software; you can redistribute it and/or modify12* it under the terms of the GNU General Public License as published by13* the Free Software Foundation; either version 2 of the License, or14* (at your option) any later version.15*16* This program is distributed in the hope that it will be useful,17* but WITHOUT ANY WARRANTY; without even the implied warranty of18* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the19* GNU General Public License for more details.20*21* You should have received a copy of the GNU General Public License22* along with this program; if not, write to the Free Software23* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA24*/2526#include <linux/types.h>27#include <linux/init.h>28#include <linux/mm.h>29#include <linux/module.h>30#include <linux/platform_device.h>31#include <linux/spi/spi.h>32#include <linux/clk.h>33#include <linux/dma-mapping.h>3435#include <mach/hardware.h>36#include <asm/setup.h>37#include <asm/mach-types.h>38#include <asm/irq.h>3940#include <asm/mach/arch.h>41#include <asm/mach/map.h>42#include <asm/mach/irq.h>4344#include <mach/board.h>45#include <mach/gpio.h>4647#include "generic.h"484950static void __init afeb9260_init_early(void)51{52/* Initialize processor: 18.432 MHz crystal */53at91sam9260_initialize(18432000);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,60ATMEL_UART_CTS | ATMEL_UART_RTS61| ATMEL_UART_DTR | ATMEL_UART_DSR62| ATMEL_UART_DCD | ATMEL_UART_RI);6364/* USART1 on ttyS2. (Rx, Tx, RTS, CTS) */65at91_register_uart(AT91SAM9260_ID_US1, 2,66ATMEL_UART_CTS | ATMEL_UART_RTS);6768/* set serial console to ttyS0 (ie, DBGU) */69at91_set_serial_console(0);70}7172static void __init afeb9260_init_irq(void)73{74at91sam9260_init_interrupts(NULL);75}767778/*79* USB Host port80*/81static struct at91_usbh_data __initdata afeb9260_usbh_data = {82.ports = 1,83};8485/*86* USB Device port87*/88static struct at91_udc_data __initdata afeb9260_udc_data = {89.vbus_pin = AT91_PIN_PC5,90.pullup_pin = 0, /* pull-up driven by UDC */91};92939495/*96* SPI devices.97*/98static struct spi_board_info afeb9260_spi_devices[] = {99{ /* DataFlash chip */100.modalias = "mtd_dataflash",101.chip_select = 1,102.max_speed_hz = 15 * 1000 * 1000,103.bus_num = 0,104},105};106107108/*109* MACB Ethernet device110*/111static struct at91_eth_data __initdata afeb9260_macb_data = {112.phy_irq_pin = AT91_PIN_PA9,113.is_rmii = 0,114};115116117/*118* NAND flash119*/120static struct mtd_partition __initdata afeb9260_nand_partition[] = {121{122.name = "bootloader",123.offset = 0,124.size = (640 * SZ_1K),125},126{127.name = "kernel",128.offset = MTDPART_OFS_NXTBLK,129.size = SZ_2M,130},131{132.name = "rootfs",133.offset = MTDPART_OFS_NXTBLK,134.size = MTDPART_SIZ_FULL,135},136};137138static struct mtd_partition * __init nand_partitions(int size, int *num_partitions)139{140*num_partitions = ARRAY_SIZE(afeb9260_nand_partition);141return afeb9260_nand_partition;142}143144static struct atmel_nand_data __initdata afeb9260_nand_data = {145.ale = 21,146.cle = 22,147.rdy_pin = AT91_PIN_PC13,148.enable_pin = AT91_PIN_PC14,149.partition_info = nand_partitions,150.bus_width_16 = 0,151};152153154/*155* MCI (SD/MMC)156*/157static struct at91_mmc_data __initdata afeb9260_mmc_data = {158.det_pin = AT91_PIN_PC9,159.wp_pin = AT91_PIN_PC4,160.slot_b = 1,161.wire4 = 1,162};163164165166static struct i2c_board_info __initdata afeb9260_i2c_devices[] = {167{168I2C_BOARD_INFO("tlv320aic23", 0x1a),169}, {170I2C_BOARD_INFO("fm3130", 0x68),171}, {172I2C_BOARD_INFO("24c64", 0x50),173},174};175176/*177* IDE (CF True IDE mode)178*/179static struct at91_cf_data afeb9260_cf_data = {180.chipselect = 4,181.irq_pin = AT91_PIN_PA6,182.rst_pin = AT91_PIN_PA7,183.flags = AT91_CF_TRUE_IDE,184};185186static void __init afeb9260_board_init(void)187{188/* Serial */189at91_add_device_serial();190/* USB Host */191at91_add_device_usbh(&afeb9260_usbh_data);192/* USB Device */193at91_add_device_udc(&afeb9260_udc_data);194/* SPI */195at91_add_device_spi(afeb9260_spi_devices,196ARRAY_SIZE(afeb9260_spi_devices));197/* NAND */198at91_add_device_nand(&afeb9260_nand_data);199/* Ethernet */200at91_add_device_eth(&afeb9260_macb_data);201202/* Standard function's pin assignments are not203* appropriate for us and generic code provide204* no API to configure these pins any other way */205at91_set_B_periph(AT91_PIN_PA10, 0); /* ETX2 */206at91_set_B_periph(AT91_PIN_PA11, 0); /* ETX3 */207/* MMC */208at91_add_device_mmc(0, &afeb9260_mmc_data);209/* I2C */210at91_add_device_i2c(afeb9260_i2c_devices,211ARRAY_SIZE(afeb9260_i2c_devices));212/* Audio */213at91_add_device_ssc(AT91SAM9260_ID_SSC, ATMEL_SSC_TX);214/* IDE */215at91_add_device_cf(&afeb9260_cf_data);216}217218MACHINE_START(AFEB9260, "Custom afeb9260 board")219/* Maintainer: Sergey Lapin <[email protected]> */220.timer = &at91sam926x_timer,221.map_io = at91sam9260_map_io,222.init_early = afeb9260_init_early,223.init_irq = afeb9260_init_irq,224.init_machine = afeb9260_board_init,225MACHINE_END226227228229