mach-anubis.c 6.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271
  1. /* linux/arch/arm/mach-s3c2410/mach-anubis.c
  2. *
  3. * Copyright (c) 2003-2005 Simtec Electronics
  4. * http://armlinux.simtec.co.uk/
  5. * Ben Dooks <ben@simtec.co.uk>
  6. *
  7. *
  8. *
  9. * This program is free software; you can redistribute it and/or modify
  10. * it under the terms of the GNU General Public License version 2 as
  11. * published by the Free Software Foundation.
  12. *
  13. * Modifications:
  14. * 02-May-2005 BJD Copied from mach-bast.c
  15. * 20-Sep-2005 BJD Added static to non-exported items
  16. */
  17. #include <linux/kernel.h>
  18. #include <linux/types.h>
  19. #include <linux/interrupt.h>
  20. #include <linux/list.h>
  21. #include <linux/timer.h>
  22. #include <linux/init.h>
  23. #include <linux/device.h>
  24. #include <asm/mach/arch.h>
  25. #include <asm/mach/map.h>
  26. #include <asm/mach/irq.h>
  27. #include <asm/arch/anubis-map.h>
  28. #include <asm/arch/anubis-irq.h>
  29. #include <asm/arch/anubis-cpld.h>
  30. #include <asm/hardware.h>
  31. #include <asm/io.h>
  32. #include <asm/irq.h>
  33. #include <asm/mach-types.h>
  34. #include <asm/arch/regs-serial.h>
  35. #include <asm/arch/regs-gpio.h>
  36. #include <asm/arch/regs-mem.h>
  37. #include <asm/arch/regs-lcd.h>
  38. #include <asm/arch/nand.h>
  39. #include <linux/mtd/mtd.h>
  40. #include <linux/mtd/nand.h>
  41. #include <linux/mtd/nand_ecc.h>
  42. #include <linux/mtd/partitions.h>
  43. #include "clock.h"
  44. #include "devs.h"
  45. #include "cpu.h"
  46. #define COPYRIGHT ", (c) 2005 Simtec Electronics"
  47. static struct map_desc anubis_iodesc[] __initdata = {
  48. /* ISA IO areas */
  49. { (u32)S3C24XX_VA_ISA_BYTE, 0x0, SZ_16M, MT_DEVICE },
  50. { (u32)S3C24XX_VA_ISA_WORD, 0x0, SZ_16M, MT_DEVICE },
  51. /* we could possibly compress the next set down into a set of smaller tables
  52. * pagetables, but that would mean using an L2 section, and it still means
  53. * we cannot actually feed the same register to an LDR due to 16K spacing
  54. */
  55. /* CPLD control registers */
  56. { (u32)ANUBIS_VA_CTRL1, ANUBIS_PA_CTRL1, SZ_4K, MT_DEVICE },
  57. { (u32)ANUBIS_VA_CTRL2, ANUBIS_PA_CTRL2, SZ_4K, MT_DEVICE },
  58. /* IDE drives */
  59. { (u32)ANUBIS_IDEPRI, S3C2410_CS3, SZ_1M, MT_DEVICE },
  60. { (u32)ANUBIS_IDEPRIAUX, S3C2410_CS3+(1<<26), SZ_1M, MT_DEVICE },
  61. { (u32)ANUBIS_IDESEC, S3C2410_CS4, SZ_1M, MT_DEVICE },
  62. { (u32)ANUBIS_IDESECAUX, S3C2410_CS4+(1<<26), SZ_1M, MT_DEVICE },
  63. };
  64. #define UCON S3C2410_UCON_DEFAULT | S3C2410_UCON_UCLK
  65. #define ULCON S3C2410_LCON_CS8 | S3C2410_LCON_PNONE | S3C2410_LCON_STOPB
  66. #define UFCON S3C2410_UFCON_RXTRIG8 | S3C2410_UFCON_FIFOMODE
  67. static struct s3c24xx_uart_clksrc anubis_serial_clocks[] = {
  68. [0] = {
  69. .name = "uclk",
  70. .divisor = 1,
  71. .min_baud = 0,
  72. .max_baud = 0,
  73. },
  74. [1] = {
  75. .name = "pclk",
  76. .divisor = 1,
  77. .min_baud = 0,
  78. .max_baud = 0.
  79. }
  80. };
  81. static struct s3c2410_uartcfg anubis_uartcfgs[] = {
  82. [0] = {
  83. .hwport = 0,
  84. .flags = 0,
  85. .ucon = UCON,
  86. .ulcon = ULCON,
  87. .ufcon = UFCON,
  88. .clocks = anubis_serial_clocks,
  89. .clocks_size = ARRAY_SIZE(anubis_serial_clocks)
  90. },
  91. [1] = {
  92. .hwport = 2,
  93. .flags = 0,
  94. .ucon = UCON,
  95. .ulcon = ULCON,
  96. .ufcon = UFCON,
  97. .clocks = anubis_serial_clocks,
  98. .clocks_size = ARRAY_SIZE(anubis_serial_clocks)
  99. },
  100. };
  101. /* NAND Flash on Anubis board */
  102. static int external_map[] = { 2 };
  103. static int chip0_map[] = { 0 };
  104. static int chip1_map[] = { 1 };
  105. static struct mtd_partition anubis_default_nand_part[] = {
  106. [0] = {
  107. .name = "Boot Agent",
  108. .size = SZ_16K,
  109. .offset = 0
  110. },
  111. [1] = {
  112. .name = "/boot",
  113. .size = SZ_4M - SZ_16K,
  114. .offset = SZ_16K,
  115. },
  116. [2] = {
  117. .name = "user1",
  118. .offset = SZ_4M,
  119. .size = SZ_32M - SZ_4M,
  120. },
  121. [3] = {
  122. .name = "user2",
  123. .offset = SZ_32M,
  124. .size = MTDPART_SIZ_FULL,
  125. }
  126. };
  127. /* the Anubis has 3 selectable slots for nand-flash, the two
  128. * on-board chip areas, as well as the external slot.
  129. *
  130. * Note, there is no current hot-plug support for the External
  131. * socket.
  132. */
  133. static struct s3c2410_nand_set anubis_nand_sets[] = {
  134. [1] = {
  135. .name = "External",
  136. .nr_chips = 1,
  137. .nr_map = external_map,
  138. .nr_partitions = ARRAY_SIZE(anubis_default_nand_part),
  139. .partitions = anubis_default_nand_part
  140. },
  141. [0] = {
  142. .name = "chip0",
  143. .nr_chips = 1,
  144. .nr_map = chip0_map,
  145. .nr_partitions = ARRAY_SIZE(anubis_default_nand_part),
  146. .partitions = anubis_default_nand_part
  147. },
  148. [2] = {
  149. .name = "chip1",
  150. .nr_chips = 1,
  151. .nr_map = chip1_map,
  152. .nr_partitions = ARRAY_SIZE(anubis_default_nand_part),
  153. .partitions = anubis_default_nand_part
  154. },
  155. };
  156. static void anubis_nand_select(struct s3c2410_nand_set *set, int slot)
  157. {
  158. unsigned int tmp;
  159. slot = set->nr_map[slot] & 3;
  160. pr_debug("anubis_nand: selecting slot %d (set %p,%p)\n",
  161. slot, set, set->nr_map);
  162. tmp = __raw_readb(ANUBIS_VA_CTRL1);
  163. tmp &= ~ANUBIS_CTRL1_NANDSEL;
  164. tmp |= slot;
  165. pr_debug("anubis_nand: ctrl1 now %02x\n", tmp);
  166. __raw_writeb(tmp, ANUBIS_VA_CTRL1);
  167. }
  168. static struct s3c2410_platform_nand anubis_nand_info = {
  169. .tacls = 25,
  170. .twrph0 = 80,
  171. .twrph1 = 80,
  172. .nr_sets = ARRAY_SIZE(anubis_nand_sets),
  173. .sets = anubis_nand_sets,
  174. .select_chip = anubis_nand_select,
  175. };
  176. /* Standard Anubis devices */
  177. static struct platform_device *anubis_devices[] __initdata = {
  178. &s3c_device_usb,
  179. &s3c_device_wdt,
  180. &s3c_device_adc,
  181. &s3c_device_i2c,
  182. &s3c_device_rtc,
  183. &s3c_device_nand,
  184. };
  185. static struct clk *anubis_clocks[] = {
  186. &s3c24xx_dclk0,
  187. &s3c24xx_dclk1,
  188. &s3c24xx_clkout0,
  189. &s3c24xx_clkout1,
  190. &s3c24xx_uclk,
  191. };
  192. static struct s3c24xx_board anubis_board __initdata = {
  193. .devices = anubis_devices,
  194. .devices_count = ARRAY_SIZE(anubis_devices),
  195. .clocks = anubis_clocks,
  196. .clocks_count = ARRAY_SIZE(anubis_clocks)
  197. };
  198. static void __init anubis_map_io(void)
  199. {
  200. /* initialise the clocks */
  201. s3c24xx_dclk0.parent = NULL;
  202. s3c24xx_dclk0.rate = 12*1000*1000;
  203. s3c24xx_dclk1.parent = NULL;
  204. s3c24xx_dclk1.rate = 24*1000*1000;
  205. s3c24xx_clkout0.parent = &s3c24xx_dclk0;
  206. s3c24xx_clkout1.parent = &s3c24xx_dclk1;
  207. s3c24xx_uclk.parent = &s3c24xx_clkout1;
  208. s3c_device_nand.dev.platform_data = &anubis_nand_info;
  209. s3c24xx_init_io(anubis_iodesc, ARRAY_SIZE(anubis_iodesc));
  210. s3c24xx_init_clocks(0);
  211. s3c24xx_init_uarts(anubis_uartcfgs, ARRAY_SIZE(anubis_uartcfgs));
  212. s3c24xx_set_board(&anubis_board);
  213. /* ensure that the GPIO is setup */
  214. s3c2410_gpio_setpin(S3C2410_GPA0, 1);
  215. }
  216. MACHINE_START(ANUBIS, "Simtec-Anubis")
  217. /* Maintainer: Ben Dooks <ben@simtec.co.uk> */
  218. .phys_ram = S3C2410_SDRAM_PA,
  219. .phys_io = S3C2410_PA_UART,
  220. .io_pg_offst = (((u32)S3C24XX_VA_UART) >> 18) & 0xfffc,
  221. .boot_params = S3C2410_SDRAM_PA + 0x100,
  222. .map_io = anubis_map_io,
  223. .init_irq = s3c24xx_init_irq,
  224. .timer = &s3c24xx_timer,
  225. MACHINE_END