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