board-sam9rlek.c 4.4 KB

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