mach-amlm5900.c 6.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266
  1. /***********************************************************************
  2. *
  3. * linux/arch/arm/mach-s3c2410/mach-amlm5900.c
  4. *
  5. * Copyright (c) 2006 American Microsystems Limited
  6. * David Anders <danders@amltd.com>
  7. * This program is free software; you can redistribute it and/or
  8. * modify it under the terms of the GNU General Public License as
  9. * published by the Free Software Foundation; either version 2 of
  10. * the License, or (at your option) any later version.
  11. *
  12. * This program is distributed in the hope that it will be useful,
  13. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  14. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  15. * GNU General Public License for more details.
  16. *
  17. * You should have received a copy of the GNU General Public License
  18. * along with this program; if not, write to the Free Software
  19. * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
  20. * MA 02111-1307 USA
  21. *
  22. * @History:
  23. * derived from linux/arch/arm/mach-s3c2410/mach-bast.c, written by
  24. * Ben Dooks <ben@simtec.co.uk>
  25. *
  26. ***********************************************************************/
  27. #include <linux/kernel.h>
  28. #include <linux/types.h>
  29. #include <linux/interrupt.h>
  30. #include <linux/list.h>
  31. #include <linux/timer.h>
  32. #include <linux/init.h>
  33. #include <linux/device.h>
  34. #include <linux/platform_device.h>
  35. #include <linux/proc_fs.h>
  36. #include <asm/mach/arch.h>
  37. #include <asm/mach/map.h>
  38. #include <asm/mach/irq.h>
  39. #include <asm/mach/flash.h>
  40. #include <asm/hardware.h>
  41. #include <asm/io.h>
  42. #include <asm/irq.h>
  43. #include <asm/mach-types.h>
  44. #include <asm/arch/fb.h>
  45. #include <asm/arch/regs-serial.h>
  46. #include <asm/arch/regs-lcd.h>
  47. #include <asm/arch/regs-gpio.h>
  48. #include "devs.h"
  49. #include "cpu.h"
  50. #ifdef CONFIG_MTD_PARTITIONS
  51. #include <linux/mtd/mtd.h>
  52. #include <linux/mtd/partitions.h>
  53. #include <linux/mtd/map.h>
  54. #include <linux/mtd/physmap.h>
  55. static struct resource amlm5900_nor_resource = {
  56. .start = 0x00000000,
  57. .end = 0x01000000 - 1,
  58. .flags = IORESOURCE_MEM,
  59. };
  60. static struct mtd_partition amlm5900_mtd_partitions[] = {
  61. {
  62. .name = "System",
  63. .size = 0x240000,
  64. .offset = 0,
  65. .mask_flags = MTD_WRITEABLE, /* force read-only */
  66. }, {
  67. .name = "Kernel",
  68. .size = 0x100000,
  69. .offset = MTDPART_OFS_APPEND,
  70. }, {
  71. .name = "Ramdisk",
  72. .size = 0x300000,
  73. .offset = MTDPART_OFS_APPEND,
  74. }, {
  75. .name = "JFFS2",
  76. .size = 0x9A0000,
  77. .offset = MTDPART_OFS_APPEND,
  78. }, {
  79. .name = "Settings",
  80. .size = MTDPART_SIZ_FULL,
  81. .offset = MTDPART_OFS_APPEND,
  82. }
  83. };
  84. static struct physmap_flash_data amlm5900_flash_data = {
  85. .width = 2,
  86. .parts = amlm5900_mtd_partitions,
  87. .nr_parts = ARRAY_SIZE(amlm5900_mtd_partitions),
  88. };
  89. static struct platform_device amlm5900_device_nor = {
  90. .name = "physmap-flash",
  91. .id = 0,
  92. .dev = {
  93. .platform_data = &amlm5900_flash_data,
  94. },
  95. .num_resources = 1,
  96. .resource = &amlm5900_nor_resource,
  97. };
  98. #endif
  99. static struct map_desc amlm5900_iodesc[] __initdata = {
  100. {
  101. .virtual = (u32)S3C24XX_VA_SPI,
  102. .pfn = __phys_to_pfn(S3C2410_PA_SPI),
  103. .length = SZ_1M,
  104. .type = MT_DEVICE
  105. }
  106. };
  107. #define UCON S3C2410_UCON_DEFAULT
  108. #define ULCON S3C2410_LCON_CS8 | S3C2410_LCON_PNONE | S3C2410_LCON_STOPB
  109. #define UFCON S3C2410_UFCON_RXTRIG8 | S3C2410_UFCON_FIFOMODE
  110. static struct s3c2410_uartcfg amlm5900_uartcfgs[] = {
  111. [0] = {
  112. .hwport = 0,
  113. .flags = 0,
  114. .ucon = UCON,
  115. .ulcon = ULCON,
  116. .ufcon = UFCON,
  117. },
  118. [1] = {
  119. .hwport = 1,
  120. .flags = 0,
  121. .ucon = UCON,
  122. .ulcon = ULCON,
  123. .ufcon = UFCON,
  124. },
  125. [2] = {
  126. .hwport = 2,
  127. .flags = 0,
  128. .ucon = UCON,
  129. .ulcon = ULCON,
  130. .ufcon = UFCON,
  131. }
  132. };
  133. static struct platform_device *amlm5900_devices[] __initdata = {
  134. #ifdef CONFIG_FB_S3C2410
  135. &s3c_device_lcd,
  136. #endif
  137. &s3c_device_adc,
  138. &s3c_device_wdt,
  139. &s3c_device_i2c,
  140. &s3c_device_usb,
  141. &s3c_device_rtc,
  142. &s3c_device_usbgadget,
  143. &s3c_device_sdi,
  144. #ifdef CONFIG_MTD_PARTITIONS
  145. &amlm5900_device_nor,
  146. #endif
  147. };
  148. static struct s3c24xx_board amlm5900_board __initdata = {
  149. .devices = amlm5900_devices,
  150. .devices_count = ARRAY_SIZE(amlm5900_devices)
  151. };
  152. void __init amlm5900_map_io(void)
  153. {
  154. s3c24xx_init_io(amlm5900_iodesc, ARRAY_SIZE(amlm5900_iodesc));
  155. s3c24xx_init_clocks(0);
  156. s3c24xx_init_uarts(amlm5900_uartcfgs, ARRAY_SIZE(amlm5900_uartcfgs));
  157. s3c24xx_set_board(&amlm5900_board);
  158. }
  159. #ifdef CONFIG_FB_S3C2410
  160. static struct s3c2410fb_mach_info __initdata amlm5900_lcd_info = {
  161. .width = 160,
  162. .height = 160,
  163. /* commented out until stn patch is submitted
  164. * .type = S3C2410_LCDCON1_STN4,
  165. */
  166. .gpccon = 0xaaaaaaaa,
  167. .gpccon_mask = 0xffffffff,
  168. .gpcup = 0x0000ffff,
  169. .gpcup_mask = 0xffffffff,
  170. .gpdcon = 0xaaaaaaaa,
  171. .gpdcon_mask = 0xffffffff,
  172. .gpdup = 0x0000ffff,
  173. .gpdup_mask = 0xffffffff,
  174. .xres = {
  175. .min = 160,
  176. .max = 160,
  177. .defval = 160,
  178. },
  179. .yres = {
  180. .min = 160,
  181. .max = 160,
  182. .defval = 160,
  183. },
  184. .bpp = {
  185. .min = 4,
  186. .max = 4,
  187. .defval = 4,
  188. },
  189. .regs = {
  190. .lcdcon1 = 0x00008225,
  191. .lcdcon2 = 0x0027c000,
  192. .lcdcon3 = 0x00182708,
  193. .lcdcon4 = 0x00000002,
  194. .lcdcon5 = 0x00000001,
  195. }
  196. };
  197. #endif
  198. static irqreturn_t
  199. amlm5900_wake_interrupt(int irq, void *ignored)
  200. {
  201. return IRQ_HANDLED;
  202. }
  203. static void amlm5900_init_pm(void)
  204. {
  205. int ret = 0;
  206. ret = request_irq(IRQ_EINT9, &amlm5900_wake_interrupt,
  207. IRQF_TRIGGER_RISING | IRQF_SHARED,
  208. "amlm5900_wakeup", &amlm5900_wake_interrupt);
  209. if (ret != 0) {
  210. printk(KERN_ERR "AML-M5900: no wakeup irq, %d?\n", ret);
  211. } else {
  212. enable_irq_wake(IRQ_EINT9);
  213. /* configure the suspend/resume status pin */
  214. s3c2410_gpio_cfgpin(S3C2410_GPF2, S3C2410_GPF2_OUTP);
  215. s3c2410_gpio_pullup(S3C2410_GPF2, 0);
  216. }
  217. }
  218. static void __init amlm5900_init(void)
  219. {
  220. amlm5900_init_pm();
  221. #ifdef CONFIG_FB_S3C2410
  222. s3c24xx_fb_set_platdata(&amlm5900_lcd_info);
  223. #endif
  224. }
  225. MACHINE_START(AML_M5900, "AML_M5900")
  226. .phys_io = S3C2410_PA_UART,
  227. .io_pg_offst = (((u32)S3C24XX_VA_UART) >> 18) & 0xfffc,
  228. .boot_params = S3C2410_SDRAM_PA + 0x100,
  229. .map_io = amlm5900_map_io,
  230. .init_irq = s3c24xx_init_irq,
  231. .init_machine = amlm5900_init,
  232. .timer = &s3c24xx_timer,
  233. MACHINE_END