mach-h1940.c 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194
  1. /* linux/arch/arm/mach-s3c2410/mach-h1940.c
  2. *
  3. * Copyright (c) 2003-2005 Simtec Electronics
  4. * Ben Dooks <ben@simtec.co.uk>
  5. *
  6. * http://www.handhelds.org/projects/h1940.html
  7. *
  8. * This program is free software; you can redistribute it and/or modify
  9. * it under the terms of the GNU General Public License version 2 as
  10. * published by the Free Software Foundation.
  11. *
  12. */
  13. #include <linux/kernel.h>
  14. #include <linux/types.h>
  15. #include <linux/interrupt.h>
  16. #include <linux/list.h>
  17. #include <linux/timer.h>
  18. #include <linux/init.h>
  19. #include <linux/serial_core.h>
  20. #include <linux/platform_device.h>
  21. #include <asm/mach/arch.h>
  22. #include <asm/mach/map.h>
  23. #include <asm/mach/irq.h>
  24. #include <asm/hardware.h>
  25. #include <asm/hardware/iomd.h>
  26. #include <asm/io.h>
  27. #include <asm/irq.h>
  28. #include <asm/mach-types.h>
  29. #include <asm/arch/regs-serial.h>
  30. #include <asm/arch/regs-lcd.h>
  31. #include <asm/arch/h1940.h>
  32. #include <asm/arch/h1940-latch.h>
  33. #include <asm/arch/fb.h>
  34. #include "clock.h"
  35. #include "devs.h"
  36. #include "cpu.h"
  37. #include "pm.h"
  38. static struct map_desc h1940_iodesc[] __initdata = {
  39. [0] = {
  40. .virtual = (unsigned long)H1940_LATCH,
  41. .pfn = __phys_to_pfn(H1940_PA_LATCH),
  42. .length = SZ_16K,
  43. .type = MT_DEVICE
  44. },
  45. };
  46. #define UCON S3C2410_UCON_DEFAULT | S3C2410_UCON_UCLK
  47. #define ULCON S3C2410_LCON_CS8 | S3C2410_LCON_PNONE | S3C2410_LCON_STOPB
  48. #define UFCON S3C2410_UFCON_RXTRIG8 | S3C2410_UFCON_FIFOMODE
  49. static struct s3c2410_uartcfg h1940_uartcfgs[] __initdata = {
  50. [0] = {
  51. .hwport = 0,
  52. .flags = 0,
  53. .ucon = 0x3c5,
  54. .ulcon = 0x03,
  55. .ufcon = 0x51,
  56. },
  57. [1] = {
  58. .hwport = 1,
  59. .flags = 0,
  60. .ucon = 0x245,
  61. .ulcon = 0x03,
  62. .ufcon = 0x00,
  63. },
  64. /* IR port */
  65. [2] = {
  66. .hwport = 2,
  67. .flags = 0,
  68. .uart_flags = UPF_CONS_FLOW,
  69. .ucon = 0x3c5,
  70. .ulcon = 0x43,
  71. .ufcon = 0x51,
  72. }
  73. };
  74. /* Board control latch control */
  75. static unsigned int latch_state = H1940_LATCH_DEFAULT;
  76. void h1940_latch_control(unsigned int clear, unsigned int set)
  77. {
  78. unsigned long flags;
  79. local_irq_save(flags);
  80. latch_state &= ~clear;
  81. latch_state |= set;
  82. __raw_writel(latch_state, H1940_LATCH);
  83. local_irq_restore(flags);
  84. }
  85. EXPORT_SYMBOL_GPL(h1940_latch_control);
  86. /**
  87. * Set lcd on or off
  88. **/
  89. static struct s3c2410fb_mach_info h1940_lcdcfg __initdata = {
  90. .fixed_syncs= 1,
  91. .regs={
  92. .lcdcon1= S3C2410_LCDCON1_TFT16BPP | \
  93. S3C2410_LCDCON1_TFT | \
  94. S3C2410_LCDCON1_CLKVAL(0x0C),
  95. .lcdcon2= S3C2410_LCDCON2_VBPD(7) | \
  96. S3C2410_LCDCON2_LINEVAL(319) | \
  97. S3C2410_LCDCON2_VFPD(6) | \
  98. S3C2410_LCDCON2_VSPW(0),
  99. .lcdcon3= S3C2410_LCDCON3_HBPD(19) | \
  100. S3C2410_LCDCON3_HOZVAL(239) | \
  101. S3C2410_LCDCON3_HFPD(7),
  102. .lcdcon4= S3C2410_LCDCON4_MVAL(0) | \
  103. S3C2410_LCDCON4_HSPW(3),
  104. .lcdcon5= S3C2410_LCDCON5_FRM565 | \
  105. S3C2410_LCDCON5_INVVLINE | \
  106. S3C2410_LCDCON5_HWSWP,
  107. },
  108. .lpcsel= 0x02,
  109. .gpccon= 0xaa940659,
  110. .gpccon_mask= 0xffffffff,
  111. .gpcup= 0x0000ffff,
  112. .gpcup_mask= 0xffffffff,
  113. .gpdcon= 0xaa84aaa0,
  114. .gpdcon_mask= 0xffffffff,
  115. .gpdup= 0x0000faff,
  116. .gpdup_mask= 0xffffffff,
  117. .width= 240,
  118. .height= 320,
  119. .xres= {240,240,240},
  120. .yres= {320,320,320},
  121. .bpp= {16,16,16},
  122. };
  123. static struct platform_device *h1940_devices[] __initdata = {
  124. &s3c_device_usb,
  125. &s3c_device_lcd,
  126. &s3c_device_wdt,
  127. &s3c_device_i2c,
  128. &s3c_device_iis,
  129. };
  130. static struct s3c24xx_board h1940_board __initdata = {
  131. .devices = h1940_devices,
  132. .devices_count = ARRAY_SIZE(h1940_devices)
  133. };
  134. static void __init h1940_map_io(void)
  135. {
  136. s3c24xx_init_io(h1940_iodesc, ARRAY_SIZE(h1940_iodesc));
  137. s3c24xx_init_clocks(0);
  138. s3c24xx_init_uarts(h1940_uartcfgs, ARRAY_SIZE(h1940_uartcfgs));
  139. s3c24xx_set_board(&h1940_board);
  140. /* setup PM */
  141. memcpy(phys_to_virt(H1940_SUSPEND_RESUMEAT), h1940_pm_return, 1024);
  142. s3c2410_pm_init();
  143. }
  144. static void __init h1940_init_irq(void)
  145. {
  146. s3c24xx_init_irq();
  147. }
  148. static void __init h1940_init(void)
  149. {
  150. s3c24xx_fb_set_platdata(&h1940_lcdcfg);
  151. }
  152. MACHINE_START(H1940, "IPAQ-H1940")
  153. /* Maintainer: Ben Dooks <ben@fluff.org> */
  154. .phys_io = S3C2410_PA_UART,
  155. .io_pg_offst = (((u32)S3C24XX_VA_UART) >> 18) & 0xfffc,
  156. .boot_params = S3C2410_SDRAM_PA + 0x100,
  157. .map_io = h1940_map_io,
  158. .init_irq = h1940_init_irq,
  159. .init_machine = h1940_init,
  160. .timer = &s3c24xx_timer,
  161. MACHINE_END