mach-amlm5900.c 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248
  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. #include <linux/mtd/mtd.h>
  55. #include <linux/mtd/partitions.h>
  56. #include <linux/mtd/map.h>
  57. #include <linux/mtd/physmap.h>
  58. #include "common.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. static struct map_desc amlm5900_iodesc[] __initdata = {
  103. };
  104. #define UCON S3C2410_UCON_DEFAULT
  105. #define ULCON S3C2410_LCON_CS8 | S3C2410_LCON_PNONE | S3C2410_LCON_STOPB
  106. #define UFCON S3C2410_UFCON_RXTRIG8 | S3C2410_UFCON_FIFOMODE
  107. static struct s3c2410_uartcfg amlm5900_uartcfgs[] = {
  108. [0] = {
  109. .hwport = 0,
  110. .flags = 0,
  111. .ucon = UCON,
  112. .ulcon = ULCON,
  113. .ufcon = UFCON,
  114. },
  115. [1] = {
  116. .hwport = 1,
  117. .flags = 0,
  118. .ucon = UCON,
  119. .ulcon = ULCON,
  120. .ufcon = UFCON,
  121. },
  122. [2] = {
  123. .hwport = 2,
  124. .flags = 0,
  125. .ucon = UCON,
  126. .ulcon = ULCON,
  127. .ufcon = UFCON,
  128. }
  129. };
  130. static struct platform_device *amlm5900_devices[] __initdata = {
  131. #ifdef CONFIG_FB_S3C2410
  132. &s3c_device_lcd,
  133. #endif
  134. &s3c_device_adc,
  135. &s3c_device_wdt,
  136. &s3c_device_i2c0,
  137. &s3c_device_ohci,
  138. &s3c_device_rtc,
  139. &s3c_device_usbgadget,
  140. &s3c_device_sdi,
  141. &amlm5900_device_nor,
  142. };
  143. static void __init amlm5900_map_io(void)
  144. {
  145. s3c24xx_init_io(amlm5900_iodesc, ARRAY_SIZE(amlm5900_iodesc));
  146. s3c24xx_init_clocks(0);
  147. s3c24xx_init_uarts(amlm5900_uartcfgs, ARRAY_SIZE(amlm5900_uartcfgs));
  148. }
  149. #ifdef CONFIG_FB_S3C2410
  150. static struct s3c2410fb_display __initdata amlm5900_lcd_info = {
  151. .width = 160,
  152. .height = 160,
  153. .type = S3C2410_LCDCON1_STN4,
  154. .pixclock = 680000, /* HCLK = 100MHz */
  155. .xres = 160,
  156. .yres = 160,
  157. .bpp = 4,
  158. .left_margin = 1 << (4 + 3),
  159. .right_margin = 8 << 3,
  160. .hsync_len = 48,
  161. .upper_margin = 0,
  162. .lower_margin = 0,
  163. .lcdcon5 = 0x00000001,
  164. };
  165. static struct s3c2410fb_mach_info __initdata amlm5900_fb_info = {
  166. .displays = &amlm5900_lcd_info,
  167. .num_displays = 1,
  168. .default_display = 0,
  169. .gpccon = 0xaaaaaaaa,
  170. .gpccon_mask = 0xffffffff,
  171. .gpcup = 0x0000ffff,
  172. .gpcup_mask = 0xffffffff,
  173. .gpdcon = 0xaaaaaaaa,
  174. .gpdcon_mask = 0xffffffff,
  175. .gpdup = 0x0000ffff,
  176. .gpdup_mask = 0xffffffff,
  177. };
  178. #endif
  179. static irqreturn_t
  180. amlm5900_wake_interrupt(int irq, void *ignored)
  181. {
  182. return IRQ_HANDLED;
  183. }
  184. static void amlm5900_init_pm(void)
  185. {
  186. int ret = 0;
  187. ret = request_irq(IRQ_EINT9, &amlm5900_wake_interrupt,
  188. IRQF_TRIGGER_RISING | IRQF_SHARED,
  189. "amlm5900_wakeup", &amlm5900_wake_interrupt);
  190. if (ret != 0) {
  191. printk(KERN_ERR "AML-M5900: no wakeup irq, %d?\n", ret);
  192. } else {
  193. enable_irq_wake(IRQ_EINT9);
  194. /* configure the suspend/resume status pin */
  195. s3c_gpio_cfgpin(S3C2410_GPF(2), S3C2410_GPIO_OUTPUT);
  196. s3c_gpio_setpull(S3C2410_GPF(2), S3C_GPIO_PULL_UP);
  197. }
  198. }
  199. static void __init amlm5900_init(void)
  200. {
  201. amlm5900_init_pm();
  202. #ifdef CONFIG_FB_S3C2410
  203. s3c24xx_fb_set_platdata(&amlm5900_fb_info);
  204. #endif
  205. s3c_i2c0_set_platdata(NULL);
  206. platform_add_devices(amlm5900_devices, ARRAY_SIZE(amlm5900_devices));
  207. }
  208. MACHINE_START(AML_M5900, "AML_M5900")
  209. .atag_offset = 0x100,
  210. .map_io = amlm5900_map_io,
  211. .init_irq = s3c24xx_init_irq,
  212. .init_machine = amlm5900_init,
  213. .timer = &s3c24xx_timer,
  214. .restart = s3c2410_restart,
  215. MACHINE_END