mach-amlm5900.c 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260
  1. /* linux/arch/arm/mach-s3c2410/mach-amlm5900.c
  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 <linux/serial_core.h>
  37. #include <asm/mach/arch.h>
  38. #include <asm/mach/map.h>
  39. #include <asm/mach/irq.h>
  40. #include <asm/mach/flash.h>
  41. #include <asm/hardware.h>
  42. #include <asm/io.h>
  43. #include <asm/irq.h>
  44. #include <asm/mach-types.h>
  45. #include <asm/arch/fb.h>
  46. #include <asm/arch/regs-serial.h>
  47. #include <asm/arch/regs-lcd.h>
  48. #include <asm/arch/regs-gpio.h>
  49. #include <asm/plat-s3c24xx/devs.h>
  50. #include <asm/plat-s3c24xx/cpu.h>
  51. #ifdef CONFIG_MTD_PARTITIONS
  52. #include <linux/mtd/mtd.h>
  53. #include <linux/mtd/partitions.h>
  54. #include <linux/mtd/map.h>
  55. #include <linux/mtd/physmap.h>
  56. static struct resource amlm5900_nor_resource = {
  57. .start = 0x00000000,
  58. .end = 0x01000000 - 1,
  59. .flags = IORESOURCE_MEM,
  60. };
  61. static struct mtd_partition amlm5900_mtd_partitions[] = {
  62. {
  63. .name = "System",
  64. .size = 0x240000,
  65. .offset = 0,
  66. .mask_flags = MTD_WRITEABLE, /* force read-only */
  67. }, {
  68. .name = "Kernel",
  69. .size = 0x100000,
  70. .offset = MTDPART_OFS_APPEND,
  71. }, {
  72. .name = "Ramdisk",
  73. .size = 0x300000,
  74. .offset = MTDPART_OFS_APPEND,
  75. }, {
  76. .name = "JFFS2",
  77. .size = 0x9A0000,
  78. .offset = MTDPART_OFS_APPEND,
  79. }, {
  80. .name = "Settings",
  81. .size = MTDPART_SIZ_FULL,
  82. .offset = MTDPART_OFS_APPEND,
  83. }
  84. };
  85. static struct physmap_flash_data amlm5900_flash_data = {
  86. .width = 2,
  87. .parts = amlm5900_mtd_partitions,
  88. .nr_parts = ARRAY_SIZE(amlm5900_mtd_partitions),
  89. };
  90. static struct platform_device amlm5900_device_nor = {
  91. .name = "physmap-flash",
  92. .id = 0,
  93. .dev = {
  94. .platform_data = &amlm5900_flash_data,
  95. },
  96. .num_resources = 1,
  97. .resource = &amlm5900_nor_resource,
  98. };
  99. #endif
  100. static struct map_desc amlm5900_iodesc[] __initdata = {
  101. };
  102. #define UCON S3C2410_UCON_DEFAULT
  103. #define ULCON S3C2410_LCON_CS8 | S3C2410_LCON_PNONE | S3C2410_LCON_STOPB
  104. #define UFCON S3C2410_UFCON_RXTRIG8 | S3C2410_UFCON_FIFOMODE
  105. static struct s3c2410_uartcfg amlm5900_uartcfgs[] = {
  106. [0] = {
  107. .hwport = 0,
  108. .flags = 0,
  109. .ucon = UCON,
  110. .ulcon = ULCON,
  111. .ufcon = UFCON,
  112. },
  113. [1] = {
  114. .hwport = 1,
  115. .flags = 0,
  116. .ucon = UCON,
  117. .ulcon = ULCON,
  118. .ufcon = UFCON,
  119. },
  120. [2] = {
  121. .hwport = 2,
  122. .flags = 0,
  123. .ucon = UCON,
  124. .ulcon = ULCON,
  125. .ufcon = UFCON,
  126. }
  127. };
  128. static struct platform_device *amlm5900_devices[] __initdata = {
  129. #ifdef CONFIG_FB_S3C2410
  130. &s3c_device_lcd,
  131. #endif
  132. &s3c_device_adc,
  133. &s3c_device_wdt,
  134. &s3c_device_i2c,
  135. &s3c_device_usb,
  136. &s3c_device_rtc,
  137. &s3c_device_usbgadget,
  138. &s3c_device_sdi,
  139. #ifdef CONFIG_MTD_PARTITIONS
  140. &amlm5900_device_nor,
  141. #endif
  142. };
  143. static struct s3c24xx_board amlm5900_board __initdata = {
  144. .devices = amlm5900_devices,
  145. .devices_count = ARRAY_SIZE(amlm5900_devices)
  146. };
  147. void __init amlm5900_map_io(void)
  148. {
  149. s3c24xx_init_io(amlm5900_iodesc, ARRAY_SIZE(amlm5900_iodesc));
  150. s3c24xx_init_clocks(0);
  151. s3c24xx_init_uarts(amlm5900_uartcfgs, ARRAY_SIZE(amlm5900_uartcfgs));
  152. s3c24xx_set_board(&amlm5900_board);
  153. }
  154. #ifdef CONFIG_FB_S3C2410
  155. static struct s3c2410fb_mach_info __initdata amlm5900_lcd_info = {
  156. .width = 160,
  157. .height = 160,
  158. /* commented out until stn patch is submitted
  159. * .type = S3C2410_LCDCON1_STN4,
  160. */
  161. .gpccon = 0xaaaaaaaa,
  162. .gpccon_mask = 0xffffffff,
  163. .gpcup = 0x0000ffff,
  164. .gpcup_mask = 0xffffffff,
  165. .gpdcon = 0xaaaaaaaa,
  166. .gpdcon_mask = 0xffffffff,
  167. .gpdup = 0x0000ffff,
  168. .gpdup_mask = 0xffffffff,
  169. .xres = {
  170. .min = 160,
  171. .max = 160,
  172. .defval = 160,
  173. },
  174. .yres = {
  175. .min = 160,
  176. .max = 160,
  177. .defval = 160,
  178. },
  179. .bpp = {
  180. .min = 4,
  181. .max = 4,
  182. .defval = 4,
  183. },
  184. .regs = {
  185. .lcdcon1 = 0x00008225,
  186. .lcdcon2 = 0x0027c000,
  187. .lcdcon3 = 0x00182708,
  188. .lcdcon4 = 0x00000002,
  189. .lcdcon5 = 0x00000001,
  190. }
  191. };
  192. #endif
  193. static irqreturn_t
  194. amlm5900_wake_interrupt(int irq, void *ignored)
  195. {
  196. return IRQ_HANDLED;
  197. }
  198. static void amlm5900_init_pm(void)
  199. {
  200. int ret = 0;
  201. ret = request_irq(IRQ_EINT9, &amlm5900_wake_interrupt,
  202. IRQF_TRIGGER_RISING | IRQF_SHARED,
  203. "amlm5900_wakeup", &amlm5900_wake_interrupt);
  204. if (ret != 0) {
  205. printk(KERN_ERR "AML-M5900: no wakeup irq, %d?\n", ret);
  206. } else {
  207. enable_irq_wake(IRQ_EINT9);
  208. /* configure the suspend/resume status pin */
  209. s3c2410_gpio_cfgpin(S3C2410_GPF2, S3C2410_GPF2_OUTP);
  210. s3c2410_gpio_pullup(S3C2410_GPF2, 0);
  211. }
  212. }
  213. static void __init amlm5900_init(void)
  214. {
  215. amlm5900_init_pm();
  216. #ifdef CONFIG_FB_S3C2410
  217. s3c24xx_fb_set_platdata(&amlm5900_lcd_info);
  218. #endif
  219. }
  220. MACHINE_START(AML_M5900, "AML_M5900")
  221. .phys_io = S3C2410_PA_UART,
  222. .io_pg_offst = (((u32)S3C24XX_VA_UART) >> 18) & 0xfffc,
  223. .boot_params = S3C2410_SDRAM_PA + 0x100,
  224. .map_io = amlm5900_map_io,
  225. .init_irq = s3c24xx_init_irq,
  226. .init_machine = amlm5900_init,
  227. .timer = &s3c24xx_timer,
  228. MACHINE_END