capc7117.c 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159
  1. // SPDX-License-Identifier: GPL-2.0-only
  2. /*
  3. * linux/arch/arm/mach-pxa/capc7117.c
  4. *
  5. * Support for the Embedian CAPC-7117 Evaluation Kit
  6. * based on the Embedian MXM-8x10 Computer on Module
  7. *
  8. * Copyright (C) 2009 Embedian Inc.
  9. * Copyright (C) 2009 TMT Services & Supplies (Pty) Ltd.
  10. *
  11. * 2007-09-04: eric miao <[email protected]>
  12. * rewrite to align with latest kernel
  13. *
  14. * 2010-01-09: Edwin Peer <[email protected]>
  15. * Hennie van der Merwe <[email protected]>
  16. * rework for upstream merge
  17. */
  18. #include <linux/irq.h>
  19. #include <linux/platform_device.h>
  20. #include <linux/ata_platform.h>
  21. #include <linux/serial_8250.h>
  22. #include <linux/gpio.h>
  23. #include <linux/regulator/machine.h>
  24. #include <asm/mach-types.h>
  25. #include <asm/mach/arch.h>
  26. #include "pxa320.h"
  27. #include "mxm8x10.h"
  28. #include "generic.h"
  29. /* IDE (PATA) Support */
  30. static struct pata_platform_info pata_platform_data = {
  31. .ioport_shift = 1
  32. };
  33. static struct resource capc7117_ide_resources[] = {
  34. [0] = {
  35. .start = 0x11000020,
  36. .end = 0x1100003f,
  37. .flags = IORESOURCE_MEM
  38. },
  39. [1] = {
  40. .start = 0x1100001c,
  41. .end = 0x1100001c,
  42. .flags = IORESOURCE_MEM
  43. },
  44. [2] = {
  45. .start = PXA_GPIO_TO_IRQ(mfp_to_gpio(MFP_PIN_GPIO76)),
  46. .end = PXA_GPIO_TO_IRQ(mfp_to_gpio(MFP_PIN_GPIO76)),
  47. .flags = IORESOURCE_IRQ | IRQF_TRIGGER_RISING
  48. }
  49. };
  50. static struct platform_device capc7117_ide_device = {
  51. .name = "pata_platform",
  52. .num_resources = ARRAY_SIZE(capc7117_ide_resources),
  53. .resource = capc7117_ide_resources,
  54. .dev = {
  55. .platform_data = &pata_platform_data,
  56. .coherent_dma_mask = ~0 /* grumble */
  57. }
  58. };
  59. static void __init capc7117_ide_init(void)
  60. {
  61. platform_device_register(&capc7117_ide_device);
  62. }
  63. /* TI16C752 UART support */
  64. #define TI16C752_FLAGS (UPF_BOOT_AUTOCONF | \
  65. UPF_IOREMAP | \
  66. UPF_BUGGY_UART | \
  67. UPF_SKIP_TEST)
  68. #define TI16C752_UARTCLK (22118400)
  69. static struct plat_serial8250_port ti16c752_platform_data[] = {
  70. [0] = {
  71. .mapbase = 0x14000000,
  72. .irq = PXA_GPIO_TO_IRQ(mfp_to_gpio(MFP_PIN_GPIO78)),
  73. .irqflags = IRQF_TRIGGER_RISING,
  74. .flags = TI16C752_FLAGS,
  75. .iotype = UPIO_MEM,
  76. .regshift = 1,
  77. .uartclk = TI16C752_UARTCLK
  78. },
  79. [1] = {
  80. .mapbase = 0x14000040,
  81. .irq = PXA_GPIO_TO_IRQ(mfp_to_gpio(MFP_PIN_GPIO79)),
  82. .irqflags = IRQF_TRIGGER_RISING,
  83. .flags = TI16C752_FLAGS,
  84. .iotype = UPIO_MEM,
  85. .regshift = 1,
  86. .uartclk = TI16C752_UARTCLK
  87. },
  88. [2] = {
  89. .mapbase = 0x14000080,
  90. .irq = PXA_GPIO_TO_IRQ(mfp_to_gpio(MFP_PIN_GPIO80)),
  91. .irqflags = IRQF_TRIGGER_RISING,
  92. .flags = TI16C752_FLAGS,
  93. .iotype = UPIO_MEM,
  94. .regshift = 1,
  95. .uartclk = TI16C752_UARTCLK
  96. },
  97. [3] = {
  98. .mapbase = 0x140000c0,
  99. .irq = PXA_GPIO_TO_IRQ(mfp_to_gpio(MFP_PIN_GPIO81)),
  100. .irqflags = IRQF_TRIGGER_RISING,
  101. .flags = TI16C752_FLAGS,
  102. .iotype = UPIO_MEM,
  103. .regshift = 1,
  104. .uartclk = TI16C752_UARTCLK
  105. },
  106. [4] = {
  107. /* end of array */
  108. }
  109. };
  110. static struct platform_device ti16c752_device = {
  111. .name = "serial8250",
  112. .id = PLAT8250_DEV_PLATFORM,
  113. .dev = {
  114. .platform_data = ti16c752_platform_data
  115. }
  116. };
  117. static void __init capc7117_uarts_init(void)
  118. {
  119. platform_device_register(&ti16c752_device);
  120. }
  121. static void __init capc7117_init(void)
  122. {
  123. /* Init CoM */
  124. mxm_8x10_barebones_init();
  125. /* Init evaluation board peripherals */
  126. mxm_8x10_ac97_init();
  127. mxm_8x10_usb_host_init();
  128. mxm_8x10_mmc_init();
  129. capc7117_uarts_init();
  130. capc7117_ide_init();
  131. regulator_has_full_constraints();
  132. }
  133. MACHINE_START(CAPC7117,
  134. "Embedian CAPC-7117 evaluation kit based on the MXM-8x10 CoM")
  135. .atag_offset = 0x100,
  136. .map_io = pxa3xx_map_io,
  137. .nr_irqs = PXA_NR_IRQS,
  138. .init_irq = pxa3xx_init_irq,
  139. .handle_irq = pxa3xx_handle_irq,
  140. .init_time = pxa_timer_init,
  141. .init_machine = capc7117_init,
  142. .restart = pxa_restart,
  143. MACHINE_END