board-sam9rlek.c 4.3 KB

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