mach-h1940.c 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206
  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. * Modifications:
  13. * 16-May-2003 BJD Created initial version
  14. * 16-Aug-2003 BJD Fixed header files and copyright, added URL
  15. * 05-Sep-2003 BJD Moved to v2.6 kernel
  16. * 06-Jan-2003 BJD Updates for <arch/map.h>
  17. * 18-Jan-2003 BJD Added serial port configuration
  18. * 17-Feb-2003 BJD Copied to mach-ipaq.c
  19. * 21-Aug-2004 BJD Added struct s3c2410_board
  20. * 04-Sep-2004 BJD Changed uart init, renamed ipaq_ -> h1940_
  21. * 18-Oct-2004 BJD Updated new board structure name
  22. * 04-Nov-2004 BJD Change for new serial clock
  23. * 04-Jan-2005 BJD Updated uart init call
  24. * 10-Jan-2005 BJD Removed include of s3c2410.h
  25. * 14-Jan-2005 BJD Added clock init
  26. * 10-Mar-2005 LCVR Changed S3C2410_VA to S3C24XX_VA
  27. * 20-Sep-2005 BJD Added static to non-exported items
  28. * 26-Oct-2005 BJD Changed name of fb init call
  29. */
  30. #include <linux/kernel.h>
  31. #include <linux/types.h>
  32. #include <linux/interrupt.h>
  33. #include <linux/list.h>
  34. #include <linux/timer.h>
  35. #include <linux/init.h>
  36. #include <linux/platform_device.h>
  37. #include <asm/mach/arch.h>
  38. #include <asm/mach/map.h>
  39. #include <asm/mach/irq.h>
  40. #include <asm/hardware.h>
  41. #include <asm/hardware/iomd.h>
  42. #include <asm/io.h>
  43. #include <asm/irq.h>
  44. #include <asm/mach-types.h>
  45. #include <asm/arch/regs-serial.h>
  46. #include <asm/arch/regs-lcd.h>
  47. #include <asm/arch/h1940-latch.h>
  48. #include <asm/arch/fb.h>
  49. #include <linux/serial_core.h>
  50. #include "clock.h"
  51. #include "devs.h"
  52. #include "cpu.h"
  53. static struct map_desc h1940_iodesc[] __initdata = {
  54. [0] = {
  55. .virtual = (unsigned long)H1940_LATCH,
  56. .pfn = __phys_to_pfn(H1940_PA_LATCH),
  57. .length = SZ_16K,
  58. .type = MT_DEVICE
  59. },
  60. };
  61. #define UCON S3C2410_UCON_DEFAULT | S3C2410_UCON_UCLK
  62. #define ULCON S3C2410_LCON_CS8 | S3C2410_LCON_PNONE | S3C2410_LCON_STOPB
  63. #define UFCON S3C2410_UFCON_RXTRIG8 | S3C2410_UFCON_FIFOMODE
  64. static struct s3c2410_uartcfg h1940_uartcfgs[] = {
  65. [0] = {
  66. .hwport = 0,
  67. .flags = 0,
  68. .ucon = 0x3c5,
  69. .ulcon = 0x03,
  70. .ufcon = 0x51,
  71. },
  72. [1] = {
  73. .hwport = 1,
  74. .flags = 0,
  75. .ucon = 0x245,
  76. .ulcon = 0x03,
  77. .ufcon = 0x00,
  78. },
  79. /* IR port */
  80. [2] = {
  81. .hwport = 2,
  82. .flags = 0,
  83. .uart_flags = UPF_CONS_FLOW,
  84. .ucon = 0x3c5,
  85. .ulcon = 0x43,
  86. .ufcon = 0x51,
  87. }
  88. };
  89. /* Board control latch control */
  90. static unsigned int latch_state = H1940_LATCH_DEFAULT;
  91. void h1940_latch_control(unsigned int clear, unsigned int set)
  92. {
  93. unsigned long flags;
  94. local_irq_save(flags);
  95. latch_state &= ~clear;
  96. latch_state |= set;
  97. __raw_writel(latch_state, H1940_LATCH);
  98. local_irq_restore(flags);
  99. }
  100. EXPORT_SYMBOL_GPL(h1940_latch_control);
  101. /**
  102. * Set lcd on or off
  103. **/
  104. static struct s3c2410fb_mach_info h1940_lcdcfg __initdata = {
  105. .fixed_syncs= 1,
  106. .regs={
  107. .lcdcon1= S3C2410_LCDCON1_TFT16BPP | \
  108. S3C2410_LCDCON1_TFT | \
  109. S3C2410_LCDCON1_CLKVAL(0x0C),
  110. .lcdcon2= S3C2410_LCDCON2_VBPD(7) | \
  111. S3C2410_LCDCON2_LINEVAL(319) | \
  112. S3C2410_LCDCON2_VFPD(6) | \
  113. S3C2410_LCDCON2_VSPW(0),
  114. .lcdcon3= S3C2410_LCDCON3_HBPD(19) | \
  115. S3C2410_LCDCON3_HOZVAL(239) | \
  116. S3C2410_LCDCON3_HFPD(7),
  117. .lcdcon4= S3C2410_LCDCON4_MVAL(0) | \
  118. S3C2410_LCDCON4_HSPW(3),
  119. .lcdcon5= S3C2410_LCDCON5_FRM565 | \
  120. S3C2410_LCDCON5_INVVLINE | \
  121. S3C2410_LCDCON5_HWSWP,
  122. },
  123. .lpcsel= 0x02,
  124. .gpccon= 0xaa940659,
  125. .gpccon_mask= 0xffffffff,
  126. .gpcup= 0x0000ffff,
  127. .gpcup_mask= 0xffffffff,
  128. .gpdcon= 0xaa84aaa0,
  129. .gpdcon_mask= 0xffffffff,
  130. .gpdup= 0x0000faff,
  131. .gpdup_mask= 0xffffffff,
  132. .width= 240,
  133. .height= 320,
  134. .xres= {240,240,240},
  135. .yres= {320,320,320},
  136. .bpp= {16,16,16},
  137. };
  138. static struct platform_device *h1940_devices[] __initdata = {
  139. &s3c_device_usb,
  140. &s3c_device_lcd,
  141. &s3c_device_wdt,
  142. &s3c_device_i2c,
  143. &s3c_device_iis,
  144. };
  145. static struct s3c24xx_board h1940_board __initdata = {
  146. .devices = h1940_devices,
  147. .devices_count = ARRAY_SIZE(h1940_devices)
  148. };
  149. static void __init h1940_map_io(void)
  150. {
  151. s3c24xx_init_io(h1940_iodesc, ARRAY_SIZE(h1940_iodesc));
  152. s3c24xx_init_clocks(0);
  153. s3c24xx_init_uarts(h1940_uartcfgs, ARRAY_SIZE(h1940_uartcfgs));
  154. s3c24xx_set_board(&h1940_board);
  155. }
  156. static void __init h1940_init_irq(void)
  157. {
  158. s3c24xx_init_irq();
  159. }
  160. static void __init h1940_init(void)
  161. {
  162. s3c24xx_fb_set_platdata(&h1940_lcdcfg);
  163. }
  164. MACHINE_START(H1940, "IPAQ-H1940")
  165. /* Maintainer: Ben Dooks <ben@fluff.org> */
  166. .phys_io = S3C2410_PA_UART,
  167. .io_pg_offst = (((u32)S3C24XX_VA_UART) >> 18) & 0xfffc,
  168. .boot_params = S3C2410_SDRAM_PA + 0x100,
  169. .map_io = h1940_map_io,
  170. .init_irq = h1940_init_irq,
  171. .init_machine = h1940_init,
  172. .timer = &s3c24xx_timer,
  173. MACHINE_END