ttc_dkb.c 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166
  1. /*
  2. * linux/arch/arm/mach-mmp/ttc_dkb.c
  3. *
  4. * Support for the Marvell PXA910-based TTC_DKB Development Platform.
  5. *
  6. * This program is free software; you can redistribute it and/or modify
  7. * it under the terms of the GNU General Public License version 2 as
  8. * publishhed by the Free Software Foundation.
  9. */
  10. #include <linux/init.h>
  11. #include <linux/kernel.h>
  12. #include <linux/platform_device.h>
  13. #include <linux/mtd/mtd.h>
  14. #include <linux/mtd/partitions.h>
  15. #include <linux/mtd/onenand.h>
  16. #include <linux/interrupt.h>
  17. #include <linux/i2c/pca953x.h>
  18. #include <linux/gpio.h>
  19. #include <asm/mach-types.h>
  20. #include <asm/mach/arch.h>
  21. #include <asm/mach/flash.h>
  22. #include <mach/addr-map.h>
  23. #include <mach/mfp-pxa910.h>
  24. #include <mach/pxa910.h>
  25. #include <mach/irqs.h>
  26. #include "common.h"
  27. #define TTCDKB_GPIO_EXT0(x) (MMP_NR_BUILTIN_GPIO + ((x < 0) ? 0 : \
  28. ((x < 16) ? x : 15)))
  29. #define TTCDKB_GPIO_EXT1(x) (MMP_NR_BUILTIN_GPIO + 16 + ((x < 0) ? 0 : \
  30. ((x < 16) ? x : 15)))
  31. /*
  32. * 16 board interrupts -- MAX7312 GPIO expander
  33. * 16 board interrupts -- PCA9575 GPIO expander
  34. * 24 board interrupts -- 88PM860x PMIC
  35. */
  36. #define TTCDKB_NR_IRQS (MMP_NR_IRQS + 16 + 16 + 24)
  37. static unsigned long ttc_dkb_pin_config[] __initdata = {
  38. /* UART2 */
  39. GPIO47_UART2_RXD,
  40. GPIO48_UART2_TXD,
  41. /* DFI */
  42. DF_IO0_ND_IO0,
  43. DF_IO1_ND_IO1,
  44. DF_IO2_ND_IO2,
  45. DF_IO3_ND_IO3,
  46. DF_IO4_ND_IO4,
  47. DF_IO5_ND_IO5,
  48. DF_IO6_ND_IO6,
  49. DF_IO7_ND_IO7,
  50. DF_IO8_ND_IO8,
  51. DF_IO9_ND_IO9,
  52. DF_IO10_ND_IO10,
  53. DF_IO11_ND_IO11,
  54. DF_IO12_ND_IO12,
  55. DF_IO13_ND_IO13,
  56. DF_IO14_ND_IO14,
  57. DF_IO15_ND_IO15,
  58. DF_nCS0_SM_nCS2_nCS0,
  59. DF_ALE_SM_WEn_ND_ALE,
  60. DF_CLE_SM_OEn_ND_CLE,
  61. DF_WEn_DF_WEn,
  62. DF_REn_DF_REn,
  63. DF_RDY0_DF_RDY0,
  64. };
  65. static struct mtd_partition ttc_dkb_onenand_partitions[] = {
  66. {
  67. .name = "bootloader",
  68. .offset = 0,
  69. .size = SZ_1M,
  70. .mask_flags = MTD_WRITEABLE,
  71. }, {
  72. .name = "reserved",
  73. .offset = MTDPART_OFS_APPEND,
  74. .size = SZ_128K,
  75. .mask_flags = MTD_WRITEABLE,
  76. }, {
  77. .name = "reserved",
  78. .offset = MTDPART_OFS_APPEND,
  79. .size = SZ_8M,
  80. .mask_flags = MTD_WRITEABLE,
  81. }, {
  82. .name = "kernel",
  83. .offset = MTDPART_OFS_APPEND,
  84. .size = (SZ_2M + SZ_1M),
  85. .mask_flags = 0,
  86. }, {
  87. .name = "filesystem",
  88. .offset = MTDPART_OFS_APPEND,
  89. .size = SZ_32M + SZ_16M,
  90. .mask_flags = 0,
  91. }
  92. };
  93. static struct onenand_platform_data ttc_dkb_onenand_info = {
  94. .parts = ttc_dkb_onenand_partitions,
  95. .nr_parts = ARRAY_SIZE(ttc_dkb_onenand_partitions),
  96. };
  97. static struct resource ttc_dkb_resource_onenand[] = {
  98. [0] = {
  99. .start = SMC_CS0_PHYS_BASE,
  100. .end = SMC_CS0_PHYS_BASE + SZ_1M,
  101. .flags = IORESOURCE_MEM,
  102. },
  103. };
  104. static struct platform_device ttc_dkb_device_onenand = {
  105. .name = "onenand-flash",
  106. .id = -1,
  107. .resource = ttc_dkb_resource_onenand,
  108. .num_resources = ARRAY_SIZE(ttc_dkb_resource_onenand),
  109. .dev = {
  110. .platform_data = &ttc_dkb_onenand_info,
  111. },
  112. };
  113. static struct platform_device *ttc_dkb_devices[] = {
  114. &pxa910_device_gpio,
  115. &pxa910_device_rtc,
  116. &ttc_dkb_device_onenand,
  117. };
  118. static struct pca953x_platform_data max7312_data[] = {
  119. {
  120. .gpio_base = TTCDKB_GPIO_EXT0(0),
  121. .irq_base = MMP_NR_IRQS,
  122. },
  123. };
  124. static struct i2c_board_info ttc_dkb_i2c_info[] = {
  125. {
  126. .type = "max7312",
  127. .addr = 0x23,
  128. .irq = MMP_GPIO_TO_IRQ(80),
  129. .platform_data = &max7312_data,
  130. },
  131. };
  132. static void __init ttc_dkb_init(void)
  133. {
  134. mfp_config(ARRAY_AND_SIZE(ttc_dkb_pin_config));
  135. /* on-chip devices */
  136. pxa910_add_uart(1);
  137. /* off-chip devices */
  138. pxa910_add_twsi(0, NULL, ARRAY_AND_SIZE(ttc_dkb_i2c_info));
  139. platform_add_devices(ARRAY_AND_SIZE(ttc_dkb_devices));
  140. }
  141. MACHINE_START(TTC_DKB, "PXA910-based TTC_DKB Development Platform")
  142. .map_io = mmp_map_io,
  143. .nr_irqs = TTCDKB_NR_IRQS,
  144. .init_irq = pxa910_init_irq,
  145. .timer = &pxa910_timer,
  146. .init_machine = ttc_dkb_init,
  147. .restart = mmp_restart,
  148. MACHINE_END