mach-smdk2440.c 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183
  1. // SPDX-License-Identifier: GPL-2.0
  2. // linux/arch/arm/mach-s3c2440/mach-smdk2440.c
  3. //
  4. // Copyright (c) 2004-2005 Simtec Electronics
  5. // Ben Dooks <ben@simtec.co.uk>
  6. //
  7. // http://www.fluff.org/ben/smdk2440/
  8. //
  9. // Thanks to Dimity Andric and TomTom for the loan of an SMDK2440.
  10. #include <linux/kernel.h>
  11. #include <linux/types.h>
  12. #include <linux/interrupt.h>
  13. #include <linux/list.h>
  14. #include <linux/timer.h>
  15. #include <linux/init.h>
  16. #include <linux/serial_core.h>
  17. #include <linux/serial_s3c.h>
  18. #include <linux/platform_device.h>
  19. #include <linux/io.h>
  20. #include <asm/mach/arch.h>
  21. #include <asm/mach/map.h>
  22. #include <asm/mach/irq.h>
  23. #include <mach/hardware.h>
  24. #include <asm/irq.h>
  25. #include <asm/mach-types.h>
  26. #include <mach/regs-gpio.h>
  27. #include <mach/regs-lcd.h>
  28. #include <mach/fb.h>
  29. #include <linux/platform_data/i2c-s3c2410.h>
  30. #include <plat/devs.h>
  31. #include <plat/cpu.h>
  32. #include <plat/samsung-time.h>
  33. #include "common.h"
  34. #include "common-smdk.h"
  35. static struct map_desc smdk2440_iodesc[] __initdata = {
  36. /* ISA IO Space map (memory space selected by A24) */
  37. {
  38. .virtual = (u32)S3C24XX_VA_ISA_WORD,
  39. .pfn = __phys_to_pfn(S3C2410_CS2),
  40. .length = 0x10000,
  41. .type = MT_DEVICE,
  42. }, {
  43. .virtual = (u32)S3C24XX_VA_ISA_WORD + 0x10000,
  44. .pfn = __phys_to_pfn(S3C2410_CS2 + (1<<24)),
  45. .length = SZ_4M,
  46. .type = MT_DEVICE,
  47. }, {
  48. .virtual = (u32)S3C24XX_VA_ISA_BYTE,
  49. .pfn = __phys_to_pfn(S3C2410_CS2),
  50. .length = 0x10000,
  51. .type = MT_DEVICE,
  52. }, {
  53. .virtual = (u32)S3C24XX_VA_ISA_BYTE + 0x10000,
  54. .pfn = __phys_to_pfn(S3C2410_CS2 + (1<<24)),
  55. .length = SZ_4M,
  56. .type = MT_DEVICE,
  57. }
  58. };
  59. #define UCON S3C2410_UCON_DEFAULT | S3C2410_UCON_UCLK
  60. #define ULCON S3C2410_LCON_CS8 | S3C2410_LCON_PNONE | S3C2410_LCON_STOPB
  61. #define UFCON S3C2410_UFCON_RXTRIG8 | S3C2410_UFCON_FIFOMODE
  62. static struct s3c2410_uartcfg smdk2440_uartcfgs[] __initdata = {
  63. [0] = {
  64. .hwport = 0,
  65. .flags = 0,
  66. .ucon = 0x3c5,
  67. .ulcon = 0x03,
  68. .ufcon = 0x51,
  69. },
  70. [1] = {
  71. .hwport = 1,
  72. .flags = 0,
  73. .ucon = 0x3c5,
  74. .ulcon = 0x03,
  75. .ufcon = 0x51,
  76. },
  77. /* IR port */
  78. [2] = {
  79. .hwport = 2,
  80. .flags = 0,
  81. .ucon = 0x3c5,
  82. .ulcon = 0x43,
  83. .ufcon = 0x51,
  84. }
  85. };
  86. /* LCD driver info */
  87. static struct s3c2410fb_display smdk2440_lcd_cfg __initdata = {
  88. .lcdcon5 = S3C2410_LCDCON5_FRM565 |
  89. S3C2410_LCDCON5_INVVLINE |
  90. S3C2410_LCDCON5_INVVFRAME |
  91. S3C2410_LCDCON5_PWREN |
  92. S3C2410_LCDCON5_HWSWP,
  93. .type = S3C2410_LCDCON1_TFT,
  94. .width = 240,
  95. .height = 320,
  96. .pixclock = 166667, /* HCLK 60 MHz, divisor 10 */
  97. .xres = 240,
  98. .yres = 320,
  99. .bpp = 16,
  100. .left_margin = 20,
  101. .right_margin = 8,
  102. .hsync_len = 4,
  103. .upper_margin = 8,
  104. .lower_margin = 7,
  105. .vsync_len = 4,
  106. };
  107. static struct s3c2410fb_mach_info smdk2440_fb_info __initdata = {
  108. .displays = &smdk2440_lcd_cfg,
  109. .num_displays = 1,
  110. .default_display = 0,
  111. #if 0
  112. /* currently setup by downloader */
  113. .gpccon = 0xaa940659,
  114. .gpccon_mask = 0xffffffff,
  115. .gpcup = 0x0000ffff,
  116. .gpcup_mask = 0xffffffff,
  117. .gpdcon = 0xaa84aaa0,
  118. .gpdcon_mask = 0xffffffff,
  119. .gpdup = 0x0000faff,
  120. .gpdup_mask = 0xffffffff,
  121. #endif
  122. .lpcsel = ((0xCE6) & ~7) | 1<<4,
  123. };
  124. static struct platform_device *smdk2440_devices[] __initdata = {
  125. &s3c_device_ohci,
  126. &s3c_device_lcd,
  127. &s3c_device_wdt,
  128. &s3c_device_i2c0,
  129. &s3c_device_iis,
  130. };
  131. static void __init smdk2440_map_io(void)
  132. {
  133. s3c24xx_init_io(smdk2440_iodesc, ARRAY_SIZE(smdk2440_iodesc));
  134. s3c24xx_init_uarts(smdk2440_uartcfgs, ARRAY_SIZE(smdk2440_uartcfgs));
  135. samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4);
  136. }
  137. static void __init smdk2440_init_time(void)
  138. {
  139. s3c2440_init_clocks(16934400);
  140. samsung_timer_init();
  141. }
  142. static void __init smdk2440_machine_init(void)
  143. {
  144. s3c24xx_fb_set_platdata(&smdk2440_fb_info);
  145. s3c_i2c0_set_platdata(NULL);
  146. platform_add_devices(smdk2440_devices, ARRAY_SIZE(smdk2440_devices));
  147. smdk_machine_init();
  148. }
  149. MACHINE_START(S3C2440, "SMDK2440")
  150. /* Maintainer: Ben Dooks <ben-linux@fluff.org> */
  151. .atag_offset = 0x100,
  152. .init_irq = s3c2440_init_irq,
  153. .map_io = smdk2440_map_io,
  154. .init_machine = smdk2440_machine_init,
  155. .init_time = smdk2440_init_time,
  156. MACHINE_END