mach-rx3715.c 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213
  1. // SPDX-License-Identifier: GPL-2.0
  2. //
  3. // Copyright (c) 2003-2004 Simtec Electronics
  4. // Ben Dooks <[email protected]>
  5. //
  6. // https://www.handhelds.org/projects/rx3715.html
  7. #include <linux/kernel.h>
  8. #include <linux/types.h>
  9. #include <linux/interrupt.h>
  10. #include <linux/list.h>
  11. #include <linux/memblock.h>
  12. #include <linux/timer.h>
  13. #include <linux/init.h>
  14. #include <linux/tty.h>
  15. #include <linux/console.h>
  16. #include <linux/device.h>
  17. #include <linux/platform_device.h>
  18. #include <linux/serial_core.h>
  19. #include <linux/serial_s3c.h>
  20. #include <linux/serial.h>
  21. #include <linux/io.h>
  22. #include <linux/mtd/mtd.h>
  23. #include <linux/mtd/rawnand.h>
  24. #include <linux/mtd/nand-ecc-sw-hamming.h>
  25. #include <linux/mtd/partitions.h>
  26. #include <asm/mach/arch.h>
  27. #include <asm/mach/irq.h>
  28. #include <asm/mach/map.h>
  29. #include <linux/platform_data/mtd-nand-s3c2410.h>
  30. #include <linux/platform_data/fb-s3c2410.h>
  31. #include <asm/irq.h>
  32. #include <asm/mach-types.h>
  33. #include "regs-gpio.h"
  34. #include "gpio-samsung.h"
  35. #include "gpio-cfg.h"
  36. #include "cpu.h"
  37. #include "devs.h"
  38. #include "pm.h"
  39. #include "s3c24xx.h"
  40. #include "h1940.h"
  41. static struct map_desc rx3715_iodesc[] __initdata = {
  42. /* dump ISA space somewhere unused */
  43. {
  44. .virtual = (u32)S3C24XX_VA_ISA_BYTE,
  45. .pfn = __phys_to_pfn(S3C2410_CS3),
  46. .length = SZ_1M,
  47. .type = MT_DEVICE,
  48. },
  49. };
  50. static struct s3c2410_uartcfg rx3715_uartcfgs[] = {
  51. [0] = {
  52. .hwport = 0,
  53. .flags = 0,
  54. .ucon = 0x3c5,
  55. .ulcon = 0x03,
  56. .ufcon = 0x51,
  57. .clk_sel = S3C2410_UCON_CLKSEL3,
  58. },
  59. [1] = {
  60. .hwport = 1,
  61. .flags = 0,
  62. .ucon = 0x3c5,
  63. .ulcon = 0x03,
  64. .ufcon = 0x00,
  65. .clk_sel = S3C2410_UCON_CLKSEL3,
  66. },
  67. /* IR port */
  68. [2] = {
  69. .hwport = 2,
  70. .uart_flags = UPF_CONS_FLOW,
  71. .ucon = 0x3c5,
  72. .ulcon = 0x43,
  73. .ufcon = 0x51,
  74. .clk_sel = S3C2410_UCON_CLKSEL3,
  75. }
  76. };
  77. /* framebuffer lcd controller information */
  78. static struct s3c2410fb_display rx3715_lcdcfg __initdata = {
  79. .lcdcon5 = S3C2410_LCDCON5_INVVLINE |
  80. S3C2410_LCDCON5_FRM565 |
  81. S3C2410_LCDCON5_HWSWP,
  82. .type = S3C2410_LCDCON1_TFT,
  83. .width = 240,
  84. .height = 320,
  85. .pixclock = 260000,
  86. .xres = 240,
  87. .yres = 320,
  88. .bpp = 16,
  89. .left_margin = 36,
  90. .right_margin = 36,
  91. .hsync_len = 8,
  92. .upper_margin = 6,
  93. .lower_margin = 7,
  94. .vsync_len = 3,
  95. };
  96. static struct s3c2410fb_mach_info rx3715_fb_info __initdata = {
  97. .displays = &rx3715_lcdcfg,
  98. .num_displays = 1,
  99. .default_display = 0,
  100. .lpcsel = 0xf82,
  101. .gpccon = 0xaa955699,
  102. .gpccon_mask = 0xffc003cc,
  103. .gpccon_reg = S3C2410_GPCCON,
  104. .gpcup = 0x0000ffff,
  105. .gpcup_mask = 0xffffffff,
  106. .gpcup_reg = S3C2410_GPCUP,
  107. .gpdcon = 0xaa95aaa1,
  108. .gpdcon_mask = 0xffc0fff0,
  109. .gpdcon_reg = S3C2410_GPDCON,
  110. .gpdup = 0x0000faff,
  111. .gpdup_mask = 0xffffffff,
  112. .gpdup_reg = S3C2410_GPDUP,
  113. };
  114. static struct mtd_partition __initdata rx3715_nand_part[] = {
  115. [0] = {
  116. .name = "Whole Flash",
  117. .offset = 0,
  118. .size = MTDPART_SIZ_FULL,
  119. .mask_flags = MTD_WRITEABLE,
  120. }
  121. };
  122. static struct s3c2410_nand_set __initdata rx3715_nand_sets[] = {
  123. [0] = {
  124. .name = "Internal",
  125. .nr_chips = 1,
  126. .nr_partitions = ARRAY_SIZE(rx3715_nand_part),
  127. .partitions = rx3715_nand_part,
  128. },
  129. };
  130. static struct s3c2410_platform_nand __initdata rx3715_nand_info = {
  131. .tacls = 25,
  132. .twrph0 = 50,
  133. .twrph1 = 15,
  134. .nr_sets = ARRAY_SIZE(rx3715_nand_sets),
  135. .sets = rx3715_nand_sets,
  136. .engine_type = NAND_ECC_ENGINE_TYPE_SOFT,
  137. };
  138. static struct platform_device *rx3715_devices[] __initdata = {
  139. &s3c_device_ohci,
  140. &s3c_device_lcd,
  141. &s3c_device_wdt,
  142. &s3c_device_i2c0,
  143. &s3c_device_iis,
  144. &s3c_device_nand,
  145. };
  146. static void __init rx3715_map_io(void)
  147. {
  148. s3c24xx_init_io(rx3715_iodesc, ARRAY_SIZE(rx3715_iodesc));
  149. s3c24xx_init_uarts(rx3715_uartcfgs, ARRAY_SIZE(rx3715_uartcfgs));
  150. s3c24xx_set_timer_source(S3C24XX_PWM3, S3C24XX_PWM4);
  151. }
  152. static void __init rx3715_init_time(void)
  153. {
  154. s3c2440_init_clocks(16934000);
  155. s3c24xx_timer_init();
  156. }
  157. /* H1940 and RX3715 need to reserve this for suspend */
  158. static void __init rx3715_reserve(void)
  159. {
  160. memblock_reserve(0x30003000, 0x1000);
  161. memblock_reserve(0x30081000, 0x1000);
  162. }
  163. static void __init rx3715_init_machine(void)
  164. {
  165. #ifdef CONFIG_PM_H1940
  166. memcpy(phys_to_virt(H1940_SUSPEND_RESUMEAT), h1940_pm_return, 1024);
  167. #endif
  168. s3c_pm_init();
  169. s3c_nand_set_platdata(&rx3715_nand_info);
  170. s3c24xx_fb_set_platdata(&rx3715_fb_info);
  171. /* Configure the I2S pins (GPE0...GPE4) in correct mode */
  172. s3c_gpio_cfgall_range(S3C2410_GPE(0), 5, S3C_GPIO_SFN(2),
  173. S3C_GPIO_PULL_NONE);
  174. platform_add_devices(rx3715_devices, ARRAY_SIZE(rx3715_devices));
  175. }
  176. MACHINE_START(RX3715, "IPAQ-RX3715")
  177. /* Maintainer: Ben Dooks <[email protected]> */
  178. .atag_offset = 0x100,
  179. .nr_irqs = NR_IRQS_S3C2440,
  180. .map_io = rx3715_map_io,
  181. .reserve = rx3715_reserve,
  182. .init_irq = s3c2440_init_irq,
  183. .init_machine = rx3715_init_machine,
  184. .init_time = rx3715_init_time,
  185. MACHINE_END