mach-osiris.c 6.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294
  1. /* linux/arch/arm/mach-s3c2410/mach-osiris.c
  2. *
  3. * Copyright (c) 2005 Simtec Electronics
  4. * http://armlinux.simtec.co.uk/
  5. * Ben Dooks <ben@simtec.co.uk>
  6. *
  7. * This program is free software; you can redistribute it and/or modify
  8. * it under the terms of the GNU General Public License version 2 as
  9. * published by the Free Software Foundation.
  10. */
  11. #include <linux/kernel.h>
  12. #include <linux/types.h>
  13. #include <linux/interrupt.h>
  14. #include <linux/list.h>
  15. #include <linux/timer.h>
  16. #include <linux/init.h>
  17. #include <linux/device.h>
  18. #include <asm/mach/arch.h>
  19. #include <asm/mach/map.h>
  20. #include <asm/mach/irq.h>
  21. #include <asm/arch/osiris-map.h>
  22. #include <asm/arch/osiris-cpld.h>
  23. #include <asm/hardware.h>
  24. #include <asm/io.h>
  25. #include <asm/irq.h>
  26. #include <asm/mach-types.h>
  27. #include <asm/arch/regs-serial.h>
  28. #include <asm/arch/regs-gpio.h>
  29. #include <asm/arch/regs-mem.h>
  30. #include <asm/arch/regs-lcd.h>
  31. #include <asm/arch/nand.h>
  32. #include <linux/mtd/mtd.h>
  33. #include <linux/mtd/nand.h>
  34. #include <linux/mtd/nand_ecc.h>
  35. #include <linux/mtd/partitions.h>
  36. #include "clock.h"
  37. #include "devs.h"
  38. #include "cpu.h"
  39. /* onboard perihpheral map */
  40. static struct map_desc osiris_iodesc[] __initdata = {
  41. /* ISA IO areas (may be over-written later) */
  42. {
  43. .virtual = (u32)S3C24XX_VA_ISA_BYTE,
  44. .pfn = __phys_to_pfn(S3C2410_CS5),
  45. .length = SZ_16M,
  46. .type = MT_DEVICE,
  47. }, {
  48. .virtual = (u32)S3C24XX_VA_ISA_WORD,
  49. .pfn = __phys_to_pfn(S3C2410_CS5),
  50. .length = SZ_16M,
  51. .type = MT_DEVICE,
  52. },
  53. /* CPLD control registers */
  54. {
  55. .virtual = (u32)OSIRIS_VA_CTRL1,
  56. .pfn = __phys_to_pfn(OSIRIS_PA_CTRL1),
  57. .length = SZ_16K,
  58. .type = MT_DEVICE
  59. }, {
  60. .virtual = (u32)OSIRIS_VA_CTRL2,
  61. .pfn = __phys_to_pfn(OSIRIS_PA_CTRL2),
  62. .length = SZ_16K,
  63. .type = MT_DEVICE
  64. },
  65. };
  66. #define UCON S3C2410_UCON_DEFAULT | S3C2410_UCON_UCLK
  67. #define ULCON S3C2410_LCON_CS8 | S3C2410_LCON_PNONE | S3C2410_LCON_STOPB
  68. #define UFCON S3C2410_UFCON_RXTRIG8 | S3C2410_UFCON_FIFOMODE
  69. static struct s3c24xx_uart_clksrc osiris_serial_clocks[] = {
  70. [0] = {
  71. .name = "uclk",
  72. .divisor = 1,
  73. .min_baud = 0,
  74. .max_baud = 0,
  75. },
  76. [1] = {
  77. .name = "pclk",
  78. .divisor = 1,
  79. .min_baud = 0,
  80. .max_baud = 0.
  81. }
  82. };
  83. static struct s3c2410_uartcfg osiris_uartcfgs[] = {
  84. [0] = {
  85. .hwport = 0,
  86. .flags = 0,
  87. .ucon = UCON,
  88. .ulcon = ULCON,
  89. .ufcon = UFCON,
  90. .clocks = osiris_serial_clocks,
  91. .clocks_size = ARRAY_SIZE(osiris_serial_clocks)
  92. },
  93. [1] = {
  94. .hwport = 2,
  95. .flags = 0,
  96. .ucon = UCON,
  97. .ulcon = ULCON,
  98. .ufcon = UFCON,
  99. .clocks = osiris_serial_clocks,
  100. .clocks_size = ARRAY_SIZE(osiris_serial_clocks)
  101. },
  102. };
  103. /* NAND Flash on Osiris board */
  104. static int external_map[] = { 2 };
  105. static int chip0_map[] = { 0 };
  106. static int chip1_map[] = { 1 };
  107. static struct mtd_partition osiris_default_nand_part[] = {
  108. [0] = {
  109. .name = "Boot Agent",
  110. .size = SZ_16K,
  111. .offset = 0
  112. },
  113. [1] = {
  114. .name = "/boot",
  115. .size = SZ_4M - SZ_16K,
  116. .offset = SZ_16K,
  117. },
  118. [2] = {
  119. .name = "user1",
  120. .offset = SZ_4M,
  121. .size = SZ_32M - SZ_4M,
  122. },
  123. [3] = {
  124. .name = "user2",
  125. .offset = SZ_32M,
  126. .size = MTDPART_SIZ_FULL,
  127. }
  128. };
  129. /* the Osiris has 3 selectable slots for nand-flash, the two
  130. * on-board chip areas, as well as the external slot.
  131. *
  132. * Note, there is no current hot-plug support for the External
  133. * socket.
  134. */
  135. static struct s3c2410_nand_set osiris_nand_sets[] = {
  136. [1] = {
  137. .name = "External",
  138. .nr_chips = 1,
  139. .nr_map = external_map,
  140. .nr_partitions = ARRAY_SIZE(osiris_default_nand_part),
  141. .partitions = osiris_default_nand_part
  142. },
  143. [0] = {
  144. .name = "chip0",
  145. .nr_chips = 1,
  146. .nr_map = chip0_map,
  147. .nr_partitions = ARRAY_SIZE(osiris_default_nand_part),
  148. .partitions = osiris_default_nand_part
  149. },
  150. [2] = {
  151. .name = "chip1",
  152. .nr_chips = 1,
  153. .nr_map = chip1_map,
  154. .nr_partitions = ARRAY_SIZE(osiris_default_nand_part),
  155. .partitions = osiris_default_nand_part
  156. },
  157. };
  158. static void osiris_nand_select(struct s3c2410_nand_set *set, int slot)
  159. {
  160. unsigned int tmp;
  161. slot = set->nr_map[slot] & 3;
  162. pr_debug("osiris_nand: selecting slot %d (set %p,%p)\n",
  163. slot, set, set->nr_map);
  164. tmp = __raw_readb(OSIRIS_VA_CTRL1);
  165. tmp &= ~OSIRIS_CTRL1_NANDSEL;
  166. tmp |= slot;
  167. pr_debug("osiris_nand: ctrl1 now %02x\n", tmp);
  168. __raw_writeb(tmp, OSIRIS_VA_CTRL1);
  169. }
  170. static struct s3c2410_platform_nand osiris_nand_info = {
  171. .tacls = 25,
  172. .twrph0 = 60,
  173. .twrph1 = 60,
  174. .nr_sets = ARRAY_SIZE(osiris_nand_sets),
  175. .sets = osiris_nand_sets,
  176. .select_chip = osiris_nand_select,
  177. };
  178. /* PCMCIA control and configuration */
  179. static struct resource osiris_pcmcia_resource[] = {
  180. [0] = {
  181. .start = 0x0f000000,
  182. .end = 0x0f100000,
  183. .flags = IORESOURCE_MEM,
  184. },
  185. [1] = {
  186. .start = 0x0c000000,
  187. .end = 0x0c100000,
  188. .flags = IORESOURCE_MEM,
  189. }
  190. };
  191. static struct platform_device osiris_pcmcia = {
  192. .name = "osiris-pcmcia",
  193. .id = -1,
  194. .num_resources = ARRAY_SIZE(osiris_pcmcia_resource),
  195. .resource = osiris_pcmcia_resource,
  196. };
  197. /* Standard Osiris devices */
  198. static struct platform_device *osiris_devices[] __initdata = {
  199. &s3c_device_i2c,
  200. &s3c_device_nand,
  201. &osiris_pcmcia,
  202. };
  203. static struct clk *osiris_clocks[] = {
  204. &s3c24xx_dclk0,
  205. &s3c24xx_dclk1,
  206. &s3c24xx_clkout0,
  207. &s3c24xx_clkout1,
  208. &s3c24xx_uclk,
  209. };
  210. static struct s3c24xx_board osiris_board __initdata = {
  211. .devices = osiris_devices,
  212. .devices_count = ARRAY_SIZE(osiris_devices),
  213. .clocks = osiris_clocks,
  214. .clocks_count = ARRAY_SIZE(osiris_clocks)
  215. };
  216. static void __init osiris_map_io(void)
  217. {
  218. unsigned long flags;
  219. /* initialise the clocks */
  220. s3c24xx_dclk0.parent = NULL;
  221. s3c24xx_dclk0.rate = 12*1000*1000;
  222. s3c24xx_dclk1.parent = NULL;
  223. s3c24xx_dclk1.rate = 24*1000*1000;
  224. s3c24xx_clkout0.parent = &s3c24xx_dclk0;
  225. s3c24xx_clkout1.parent = &s3c24xx_dclk1;
  226. s3c24xx_uclk.parent = &s3c24xx_clkout1;
  227. s3c_device_nand.dev.platform_data = &osiris_nand_info;
  228. s3c24xx_init_io(osiris_iodesc, ARRAY_SIZE(osiris_iodesc));
  229. s3c24xx_init_clocks(0);
  230. s3c24xx_init_uarts(osiris_uartcfgs, ARRAY_SIZE(osiris_uartcfgs));
  231. s3c24xx_set_board(&osiris_board);
  232. /* fix bus configuration (nBE settings wrong on ABLE pre v2.20) */
  233. local_irq_save(flags);
  234. __raw_writel(__raw_readl(S3C2410_BWSCON) | S3C2410_BWSCON_ST1 | S3C2410_BWSCON_ST2 | S3C2410_BWSCON_ST3 | S3C2410_BWSCON_ST4 | S3C2410_BWSCON_ST5, S3C2410_BWSCON);
  235. local_irq_restore(flags);
  236. /* write-protect line to the NAND */
  237. s3c2410_gpio_setpin(S3C2410_GPA0, 1);
  238. }
  239. MACHINE_START(OSIRIS, "Simtec-OSIRIS")
  240. /* Maintainer: Ben Dooks <ben@simtec.co.uk> */
  241. .phys_io = S3C2410_PA_UART,
  242. .io_pg_offst = (((u32)S3C24XX_VA_UART) >> 18) & 0xfffc,
  243. .boot_params = S3C2410_SDRAM_PA + 0x100,
  244. .map_io = osiris_map_io,
  245. .init_irq = s3c24xx_init_irq,
  246. .timer = &s3c24xx_timer,
  247. MACHINE_END