mach-smdk2440.c 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180
  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 <[email protected]>
  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 <asm/irq.h>
  24. #include <asm/mach-types.h>
  25. #include "regs-gpio.h"
  26. #include "gpio-samsung.h"
  27. #include "gpio-cfg.h"
  28. #include <linux/platform_data/fb-s3c2410.h>
  29. #include <linux/platform_data/i2c-s3c2410.h>
  30. #include "devs.h"
  31. #include "cpu.h"
  32. #include "s3c24xx.h"
  33. #include "common-smdk-s3c24xx.h"
  34. static struct map_desc smdk2440_iodesc[] __initdata = {
  35. /* ISA IO Space map (memory space selected by A24) */
  36. {
  37. .virtual = (u32)S3C24XX_VA_ISA_BYTE,
  38. .pfn = __phys_to_pfn(S3C2410_CS2),
  39. .length = 0x10000,
  40. .type = MT_DEVICE,
  41. }, {
  42. .virtual = (u32)S3C24XX_VA_ISA_BYTE + 0x10000,
  43. .pfn = __phys_to_pfn(S3C2410_CS2 + (1<<24)),
  44. .length = SZ_4M,
  45. .type = MT_DEVICE,
  46. }
  47. };
  48. #define UCON S3C2410_UCON_DEFAULT | S3C2410_UCON_UCLK
  49. #define ULCON S3C2410_LCON_CS8 | S3C2410_LCON_PNONE | S3C2410_LCON_STOPB
  50. #define UFCON S3C2410_UFCON_RXTRIG8 | S3C2410_UFCON_FIFOMODE
  51. static struct s3c2410_uartcfg smdk2440_uartcfgs[] __initdata = {
  52. [0] = {
  53. .hwport = 0,
  54. .flags = 0,
  55. .ucon = 0x3c5,
  56. .ulcon = 0x03,
  57. .ufcon = 0x51,
  58. },
  59. [1] = {
  60. .hwport = 1,
  61. .flags = 0,
  62. .ucon = 0x3c5,
  63. .ulcon = 0x03,
  64. .ufcon = 0x51,
  65. },
  66. /* IR port */
  67. [2] = {
  68. .hwport = 2,
  69. .flags = 0,
  70. .ucon = 0x3c5,
  71. .ulcon = 0x43,
  72. .ufcon = 0x51,
  73. }
  74. };
  75. /* LCD driver info */
  76. static struct s3c2410fb_display smdk2440_lcd_cfg __initdata = {
  77. .lcdcon5 = S3C2410_LCDCON5_FRM565 |
  78. S3C2410_LCDCON5_INVVLINE |
  79. S3C2410_LCDCON5_INVVFRAME |
  80. S3C2410_LCDCON5_PWREN |
  81. S3C2410_LCDCON5_HWSWP,
  82. .type = S3C2410_LCDCON1_TFT,
  83. .width = 240,
  84. .height = 320,
  85. .pixclock = 166667, /* HCLK 60 MHz, divisor 10 */
  86. .xres = 240,
  87. .yres = 320,
  88. .bpp = 16,
  89. .left_margin = 20,
  90. .right_margin = 8,
  91. .hsync_len = 4,
  92. .upper_margin = 8,
  93. .lower_margin = 7,
  94. .vsync_len = 4,
  95. };
  96. static struct s3c2410fb_mach_info smdk2440_fb_info __initdata = {
  97. .displays = &smdk2440_lcd_cfg,
  98. .num_displays = 1,
  99. .default_display = 0,
  100. #if 0
  101. /* currently setup by downloader */
  102. .gpccon = 0xaa940659,
  103. .gpccon_mask = 0xffffffff,
  104. .gpcup = 0x0000ffff,
  105. .gpcup_mask = 0xffffffff,
  106. .gpdcon = 0xaa84aaa0,
  107. .gpdcon_mask = 0xffffffff,
  108. .gpdup = 0x0000faff,
  109. .gpdup_mask = 0xffffffff,
  110. .gpccon_reg = S3C2410_GPCCON,
  111. .gpcup_reg = S3C2410_GPCUP,
  112. .gpdcon_reg = S3C2410_GPDCON,
  113. .gpdup_reg = S3C2410_GPDUP,
  114. #endif
  115. .lpcsel = ((0xCE6) & ~7) | 1<<4,
  116. };
  117. static struct platform_device *smdk2440_devices[] __initdata = {
  118. &s3c_device_ohci,
  119. &s3c_device_lcd,
  120. &s3c_device_wdt,
  121. &s3c_device_i2c0,
  122. &s3c_device_iis,
  123. };
  124. static void __init smdk2440_map_io(void)
  125. {
  126. s3c24xx_init_io(smdk2440_iodesc, ARRAY_SIZE(smdk2440_iodesc));
  127. s3c24xx_init_uarts(smdk2440_uartcfgs, ARRAY_SIZE(smdk2440_uartcfgs));
  128. s3c24xx_set_timer_source(S3C24XX_PWM3, S3C24XX_PWM4);
  129. }
  130. static void __init smdk2440_init_time(void)
  131. {
  132. s3c2440_init_clocks(16934400);
  133. s3c24xx_timer_init();
  134. }
  135. static void __init smdk2440_machine_init(void)
  136. {
  137. s3c24xx_fb_set_platdata(&smdk2440_fb_info);
  138. s3c_i2c0_set_platdata(NULL);
  139. /* Configure the I2S pins (GPE0...GPE4) in correct mode */
  140. s3c_gpio_cfgall_range(S3C2410_GPE(0), 5, S3C_GPIO_SFN(2),
  141. S3C_GPIO_PULL_NONE);
  142. platform_add_devices(smdk2440_devices, ARRAY_SIZE(smdk2440_devices));
  143. smdk_machine_init();
  144. }
  145. MACHINE_START(S3C2440, "SMDK2440")
  146. /* Maintainer: Ben Dooks <[email protected]> */
  147. .atag_offset = 0x100,
  148. .nr_irqs = NR_IRQS_S3C2440,
  149. .init_irq = s3c2440_init_irq,
  150. .map_io = smdk2440_map_io,
  151. .init_machine = smdk2440_machine_init,
  152. .init_time = smdk2440_init_time,
  153. MACHINE_END