mach-anubis.c 6.3 KB

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