ttc_dkb.c 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162
  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 "common.h"
  26. #define TTCDKB_GPIO_EXT0(x) (NR_BUILTIN_GPIO + ((x < 0) ? 0 : \
  27. ((x < 16) ? x : 15)))
  28. #define TTCDKB_GPIO_EXT1(x) (NR_BUILTIN_GPIO + 16 + ((x < 0) ? 0 : \
  29. ((x < 16) ? x : 15)))
  30. /*
  31. * 16 board interrupts -- MAX7312 GPIO expander
  32. * 16 board interrupts -- PCA9575 GPIO expander
  33. * 24 board interrupts -- 88PM860x PMIC
  34. */
  35. #define TTCDKB_NR_IRQS (IRQ_BOARD_START + 16 + 16 + 24)
  36. static unsigned long ttc_dkb_pin_config[] __initdata = {
  37. /* UART2 */
  38. GPIO47_UART2_RXD,
  39. GPIO48_UART2_TXD,
  40. /* DFI */
  41. DF_IO0_ND_IO0,
  42. DF_IO1_ND_IO1,
  43. DF_IO2_ND_IO2,
  44. DF_IO3_ND_IO3,
  45. DF_IO4_ND_IO4,
  46. DF_IO5_ND_IO5,
  47. DF_IO6_ND_IO6,
  48. DF_IO7_ND_IO7,
  49. DF_IO8_ND_IO8,
  50. DF_IO9_ND_IO9,
  51. DF_IO10_ND_IO10,
  52. DF_IO11_ND_IO11,
  53. DF_IO12_ND_IO12,
  54. DF_IO13_ND_IO13,
  55. DF_IO14_ND_IO14,
  56. DF_IO15_ND_IO15,
  57. DF_nCS0_SM_nCS2_nCS0,
  58. DF_ALE_SM_WEn_ND_ALE,
  59. DF_CLE_SM_OEn_ND_CLE,
  60. DF_WEn_DF_WEn,
  61. DF_REn_DF_REn,
  62. DF_RDY0_DF_RDY0,
  63. };
  64. static struct mtd_partition ttc_dkb_onenand_partitions[] = {
  65. {
  66. .name = "bootloader",
  67. .offset = 0,
  68. .size = SZ_1M,
  69. .mask_flags = MTD_WRITEABLE,
  70. }, {
  71. .name = "reserved",
  72. .offset = MTDPART_OFS_APPEND,
  73. .size = SZ_128K,
  74. .mask_flags = MTD_WRITEABLE,
  75. }, {
  76. .name = "reserved",
  77. .offset = MTDPART_OFS_APPEND,
  78. .size = SZ_8M,
  79. .mask_flags = MTD_WRITEABLE,
  80. }, {
  81. .name = "kernel",
  82. .offset = MTDPART_OFS_APPEND,
  83. .size = (SZ_2M + SZ_1M),
  84. .mask_flags = 0,
  85. }, {
  86. .name = "filesystem",
  87. .offset = MTDPART_OFS_APPEND,
  88. .size = SZ_48M,
  89. .mask_flags = 0,
  90. }
  91. };
  92. static struct onenand_platform_data ttc_dkb_onenand_info = {
  93. .parts = ttc_dkb_onenand_partitions,
  94. .nr_parts = ARRAY_SIZE(ttc_dkb_onenand_partitions),
  95. };
  96. static struct resource ttc_dkb_resource_onenand[] = {
  97. [0] = {
  98. .start = SMC_CS0_PHYS_BASE,
  99. .end = SMC_CS0_PHYS_BASE + SZ_1M,
  100. .flags = IORESOURCE_MEM,
  101. },
  102. };
  103. static struct platform_device ttc_dkb_device_onenand = {
  104. .name = "onenand-flash",
  105. .id = -1,
  106. .resource = ttc_dkb_resource_onenand,
  107. .num_resources = ARRAY_SIZE(ttc_dkb_resource_onenand),
  108. .dev = {
  109. .platform_data = &ttc_dkb_onenand_info,
  110. },
  111. };
  112. static struct platform_device *ttc_dkb_devices[] = {
  113. &ttc_dkb_device_onenand,
  114. };
  115. static struct pca953x_platform_data max7312_data[] = {
  116. {
  117. .gpio_base = TTCDKB_GPIO_EXT0(0),
  118. .irq_base = IRQ_BOARD_START,
  119. },
  120. };
  121. static struct i2c_board_info ttc_dkb_i2c_info[] = {
  122. {
  123. .type = "max7312",
  124. .addr = 0x23,
  125. .irq = IRQ_GPIO(80),
  126. .platform_data = &max7312_data,
  127. },
  128. };
  129. static void __init ttc_dkb_init(void)
  130. {
  131. mfp_config(ARRAY_AND_SIZE(ttc_dkb_pin_config));
  132. /* on-chip devices */
  133. pxa910_add_uart(1);
  134. /* off-chip devices */
  135. pxa910_add_twsi(0, NULL, ARRAY_AND_SIZE(ttc_dkb_i2c_info));
  136. platform_add_devices(ARRAY_AND_SIZE(ttc_dkb_devices));
  137. }
  138. MACHINE_START(TTC_DKB, "PXA910-based TTC_DKB Development Platform")
  139. .map_io = mmp_map_io,
  140. .nr_irqs = TTCDKB_NR_IRQS,
  141. .init_irq = pxa910_init_irq,
  142. .timer = &pxa910_timer,
  143. .init_machine = ttc_dkb_init,
  144. MACHINE_END