1/* 2 * Copyright (C) 2005 SAN People 3 * Copyright (C) 2007 Atmel Corporation 4 * 5 * This file is subject to the terms and conditions of the GNU General Public 6 * License. See the file COPYING in the main directory of this archive for 7 * more details. 8 */ 9 10#include <linux/types.h> 11#include <linux/init.h> 12#include <linux/mm.h> 13#include <linux/module.h> 14#include <linux/platform_device.h> 15#include <linux/spi/spi.h> 16#include <linux/fb.h> 17#include <linux/clk.h> 18 19#include <video/atmel_lcdc.h> 20 21#include <asm/hardware.h> 22#include <asm/setup.h> 23#include <asm/mach-types.h> 24#include <asm/irq.h> 25 26#include <asm/mach/arch.h> 27#include <asm/mach/map.h> 28#include <asm/mach/irq.h> 29 30#include <asm/arch/board.h> 31#include <asm/arch/gpio.h> 32#include <asm/arch/at91sam926x_mc.h> 33 34#include "generic.h" 35 36 37/* 38 * Serial port configuration. 39 * 0 .. 3 = USART0 .. USART3 40 * 4 = DBGU 41 */ 42static struct at91_uart_config __initdata ek_uart_config = { 43 .console_tty = 0, /* ttyS0 */ 44 .nr_tty = 2, 45 .tty_map = { 4, 0, -1, -1, -1 } /* ttyS0, ..., ttyS4 */ 46}; 47 48static void __init ek_map_io(void) 49{ 50 /* Initialize processor: 12.000 MHz crystal */ 51 at91sam9rl_initialize(12000000); 52 53 /* Setup the serial ports and console */ 54 at91_init_serial(&ek_uart_config); 55} 56 57static void __init ek_init_irq(void) 58{ 59 at91sam9rl_init_interrupts(NULL); 60} 61 62 63/* 64 * MCI (SD/MMC) 65 */ 66static struct at91_mmc_data __initdata ek_mmc_data = { 67 .wire4 = 1, 68 .det_pin = AT91_PIN_PA15, 69// .wp_pin = ... not connected 70// .vcc_pin = ... not connected 71}; 72 73 74/* 75 * NAND flash 76 */ 77static struct mtd_partition __initdata ek_nand_partition[] = { 78 { 79 .name = "Partition 1", 80 .offset = 0, 81 .size = 256 * 1024, 82 }, 83 { 84 .name = "Partition 2", 85 .offset = 256 * 1024 , 86 .size = MTDPART_SIZ_FULL, 87 }, 88}; 89 90static struct mtd_partition * __init nand_partitions(int size, int *num_partitions) 91{ 92 *num_partitions = ARRAY_SIZE(ek_nand_partition); 93 return ek_nand_partition; 94} 95 96static struct at91_nand_data __initdata ek_nand_data = { 97 .ale = 21, 98 .cle = 22, 99// .det_pin = ... not connected 100 .rdy_pin = AT91_PIN_PD17, 101 .enable_pin = AT91_PIN_PB6, 102 .partition_info = nand_partitions, 103 .bus_width_16 = 0, 104}; 105 106 107/* 108 * SPI devices 109 */ 110static struct spi_board_info ek_spi_devices[] = { 111 { /* DataFlash chip */ 112 .modalias = "mtd_dataflash", 113 .chip_select = 0, 114 .max_speed_hz = 15 * 1000 * 1000, 115 .bus_num = 0, 116 }, 117}; 118 119 120/* 121 * LCD Controller 122 */ 123#if defined(CONFIG_FB_ATMEL) || defined(CONFIG_FB_ATMEL_MODULE) 124static struct fb_videomode at91_tft_vga_modes[] = { 125 { 126 .name = "TX09D50VM1CCA @ 60", 127 .refresh = 60, 128 .xres = 240, .yres = 320, 129 .pixclock = KHZ2PICOS(4965), 130 131 .left_margin = 1, .right_margin = 33, 132 .upper_margin = 1, .lower_margin = 0, 133 .hsync_len = 5, .vsync_len = 1, 134 135 .sync = FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT, 136 .vmode = FB_VMODE_NONINTERLACED, 137 }, 138}; 139 140static struct fb_monspecs at91fb_default_monspecs = { 141 .manufacturer = "HIT", 142 .monitor = "TX09D50VM1CCA", 143 144 .modedb = at91_tft_vga_modes, 145 .modedb_len = ARRAY_SIZE(at91_tft_vga_modes), 146 .hfmin = 15000, 147 .hfmax = 64000, 148 .vfmin = 50, 149 .vfmax = 150, 150}; 151 152#define AT91SAM9RL_DEFAULT_LCDCON2 (ATMEL_LCDC_MEMOR_LITTLE \ 153 | ATMEL_LCDC_DISTYPE_TFT \ 154 | ATMEL_LCDC_CLKMOD_ALWAYSACTIVE) 155 156static void at91_lcdc_power_control(int on) 157{ 158 if (on) 159 at91_set_gpio_value(AT91_PIN_PA30, 0); /* power up */ 160 else 161 at91_set_gpio_value(AT91_PIN_PA30, 1); /* power down */ 162} 163 164/* Driver datas */ 165static struct atmel_lcdfb_info __initdata ek_lcdc_data = { 166 .default_bpp = 16, 167 .default_dmacon = ATMEL_LCDC_DMAEN, 168 .default_lcdcon2 = AT91SAM9RL_DEFAULT_LCDCON2, 169 .default_monspecs = &at91fb_default_monspecs, 170 .atmel_lcdfb_power_control = at91_lcdc_power_control, 171 .guard_time = 1, 172}; 173 174#else 175static struct atmel_lcdfb_info __initdata ek_lcdc_data; 176#endif 177 178 179static void __init ek_board_init(void) 180{ 181 /* Serial */ 182 at91_add_device_serial(); 183 /* I2C */ 184 at91_add_device_i2c(); 185 /* NAND */ 186 at91_add_device_nand(&ek_nand_data); 187 /* SPI */ 188 at91_add_device_spi(ek_spi_devices, ARRAY_SIZE(ek_spi_devices)); 189 /* MMC */ 190 at91_add_device_mmc(0, &ek_mmc_data); 191 /* LCD Controller */ 192 at91_add_device_lcdc(&ek_lcdc_data); 193} 194 195MACHINE_START(AT91SAM9RLEK, "Atmel AT91SAM9RL-EK") 196 /* Maintainer: Atmel */ 197 .phys_io = AT91_BASE_SYS, 198 .io_pg_offst = (AT91_VA_BASE_SYS >> 18) & 0xfffc, 199 .boot_params = AT91_SDRAM_BASE + 0x100, 200 .timer = &at91sam926x_timer, 201 .map_io = ek_map_io, 202 .init_irq = ek_init_irq, 203 .init_machine = ek_board_init, 204MACHINE_END 205