mach-tct_hammer.c 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157
  1. // SPDX-License-Identifier: GPL-2.0+
  2. //
  3. // Copyright (c) 2007 TinCanTools
  4. // David Anders <[email protected]>
  5. //
  6. // @History:
  7. // derived from linux/arch/arm/mach-s3c2410/mach-bast.c, written by
  8. // Ben Dooks <[email protected]>
  9. #include <linux/gpio/machine.h>
  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/device.h>
  17. #include <linux/platform_device.h>
  18. #include <linux/serial_core.h>
  19. #include <linux/serial_s3c.h>
  20. #include <linux/io.h>
  21. #include <asm/mach/arch.h>
  22. #include <asm/mach/map.h>
  23. #include <asm/mach/irq.h>
  24. #include <asm/mach/flash.h>
  25. #include <asm/irq.h>
  26. #include <asm/mach-types.h>
  27. #include <linux/platform_data/i2c-s3c2410.h>
  28. #include "devs.h"
  29. #include "cpu.h"
  30. #include <linux/mtd/mtd.h>
  31. #include <linux/mtd/partitions.h>
  32. #include <linux/mtd/map.h>
  33. #include <linux/mtd/physmap.h>
  34. #include "s3c24xx.h"
  35. static struct resource tct_hammer_nor_resource =
  36. DEFINE_RES_MEM(0x00000000, SZ_16M);
  37. static struct mtd_partition tct_hammer_mtd_partitions[] = {
  38. {
  39. .name = "System",
  40. .size = 0x240000,
  41. .offset = 0,
  42. .mask_flags = MTD_WRITEABLE, /* force read-only */
  43. }, {
  44. .name = "JFFS2",
  45. .size = MTDPART_SIZ_FULL,
  46. .offset = MTDPART_OFS_APPEND,
  47. }
  48. };
  49. static struct physmap_flash_data tct_hammer_flash_data = {
  50. .width = 2,
  51. .parts = tct_hammer_mtd_partitions,
  52. .nr_parts = ARRAY_SIZE(tct_hammer_mtd_partitions),
  53. };
  54. static struct platform_device tct_hammer_device_nor = {
  55. .name = "physmap-flash",
  56. .id = 0,
  57. .dev = {
  58. .platform_data = &tct_hammer_flash_data,
  59. },
  60. .num_resources = 1,
  61. .resource = &tct_hammer_nor_resource,
  62. };
  63. static struct map_desc tct_hammer_iodesc[] __initdata = {
  64. };
  65. #define UCON S3C2410_UCON_DEFAULT
  66. #define ULCON S3C2410_LCON_CS8 | S3C2410_LCON_PNONE | S3C2410_LCON_STOPB
  67. #define UFCON S3C2410_UFCON_RXTRIG8 | S3C2410_UFCON_FIFOMODE
  68. static struct s3c2410_uartcfg tct_hammer_uartcfgs[] = {
  69. [0] = {
  70. .hwport = 0,
  71. .flags = 0,
  72. .ucon = UCON,
  73. .ulcon = ULCON,
  74. .ufcon = UFCON,
  75. },
  76. [1] = {
  77. .hwport = 1,
  78. .flags = 0,
  79. .ucon = UCON,
  80. .ulcon = ULCON,
  81. .ufcon = UFCON,
  82. },
  83. [2] = {
  84. .hwport = 2,
  85. .flags = 0,
  86. .ucon = UCON,
  87. .ulcon = ULCON,
  88. .ufcon = UFCON,
  89. }
  90. };
  91. static struct gpiod_lookup_table tct_hammer_mmc_gpio_table = {
  92. .dev_id = "s3c2410-sdi",
  93. .table = {
  94. /* bus pins */
  95. GPIO_LOOKUP_IDX("GPIOE", 5, "bus", 0, GPIO_ACTIVE_HIGH),
  96. GPIO_LOOKUP_IDX("GPIOE", 6, "bus", 1, GPIO_ACTIVE_HIGH),
  97. GPIO_LOOKUP_IDX("GPIOE", 7, "bus", 2, GPIO_ACTIVE_HIGH),
  98. GPIO_LOOKUP_IDX("GPIOE", 8, "bus", 3, GPIO_ACTIVE_HIGH),
  99. GPIO_LOOKUP_IDX("GPIOE", 9, "bus", 4, GPIO_ACTIVE_HIGH),
  100. GPIO_LOOKUP_IDX("GPIOE", 10, "bus", 5, GPIO_ACTIVE_HIGH),
  101. { },
  102. },
  103. };
  104. static struct platform_device *tct_hammer_devices[] __initdata = {
  105. &s3c_device_adc,
  106. &s3c_device_wdt,
  107. &s3c_device_i2c0,
  108. &s3c_device_ohci,
  109. &s3c_device_rtc,
  110. &s3c_device_usbgadget,
  111. &s3c_device_sdi,
  112. &tct_hammer_device_nor,
  113. };
  114. static void __init tct_hammer_map_io(void)
  115. {
  116. s3c24xx_init_io(tct_hammer_iodesc, ARRAY_SIZE(tct_hammer_iodesc));
  117. s3c24xx_init_uarts(tct_hammer_uartcfgs, ARRAY_SIZE(tct_hammer_uartcfgs));
  118. s3c24xx_set_timer_source(S3C24XX_PWM3, S3C24XX_PWM4);
  119. }
  120. static void __init tct_hammer_init_time(void)
  121. {
  122. s3c2410_init_clocks(12000000);
  123. s3c24xx_timer_init();
  124. }
  125. static void __init tct_hammer_init(void)
  126. {
  127. s3c_i2c0_set_platdata(NULL);
  128. gpiod_add_lookup_table(&tct_hammer_mmc_gpio_table);
  129. platform_add_devices(tct_hammer_devices, ARRAY_SIZE(tct_hammer_devices));
  130. }
  131. MACHINE_START(TCT_HAMMER, "TCT_HAMMER")
  132. .atag_offset = 0x100,
  133. .nr_irqs = NR_IRQS_S3C2410,
  134. .map_io = tct_hammer_map_io,
  135. .init_irq = s3c2410_init_irq,
  136. .init_machine = tct_hammer_init,
  137. .init_time = tct_hammer_init_time,
  138. MACHINE_END