mach-amlm5900.c 5.9 KB

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