ttc_dkb.c 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224
  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 <linux/mfd/88pm860x.h>
  20. #include <linux/platform_data/mv_usb.h>
  21. #include <asm/mach-types.h>
  22. #include <asm/mach/arch.h>
  23. #include <asm/mach/flash.h>
  24. #include <mach/addr-map.h>
  25. #include <mach/mfp-pxa910.h>
  26. #include <mach/pxa910.h>
  27. #include <mach/irqs.h>
  28. #include <mach/regs-usb.h>
  29. #include "common.h"
  30. #define TTCDKB_GPIO_EXT0(x) (MMP_NR_BUILTIN_GPIO + ((x < 0) ? 0 : \
  31. ((x < 16) ? x : 15)))
  32. #define TTCDKB_GPIO_EXT1(x) (MMP_NR_BUILTIN_GPIO + 16 + ((x < 0) ? 0 : \
  33. ((x < 16) ? x : 15)))
  34. /*
  35. * 16 board interrupts -- MAX7312 GPIO expander
  36. * 16 board interrupts -- PCA9575 GPIO expander
  37. * 24 board interrupts -- 88PM860x PMIC
  38. */
  39. #define TTCDKB_NR_IRQS (MMP_NR_IRQS + 16 + 16 + 24)
  40. static unsigned long ttc_dkb_pin_config[] __initdata = {
  41. /* UART2 */
  42. GPIO47_UART2_RXD,
  43. GPIO48_UART2_TXD,
  44. /* DFI */
  45. DF_IO0_ND_IO0,
  46. DF_IO1_ND_IO1,
  47. DF_IO2_ND_IO2,
  48. DF_IO3_ND_IO3,
  49. DF_IO4_ND_IO4,
  50. DF_IO5_ND_IO5,
  51. DF_IO6_ND_IO6,
  52. DF_IO7_ND_IO7,
  53. DF_IO8_ND_IO8,
  54. DF_IO9_ND_IO9,
  55. DF_IO10_ND_IO10,
  56. DF_IO11_ND_IO11,
  57. DF_IO12_ND_IO12,
  58. DF_IO13_ND_IO13,
  59. DF_IO14_ND_IO14,
  60. DF_IO15_ND_IO15,
  61. DF_nCS0_SM_nCS2_nCS0,
  62. DF_ALE_SM_WEn_ND_ALE,
  63. DF_CLE_SM_OEn_ND_CLE,
  64. DF_WEn_DF_WEn,
  65. DF_REn_DF_REn,
  66. DF_RDY0_DF_RDY0,
  67. };
  68. static struct mtd_partition ttc_dkb_onenand_partitions[] = {
  69. {
  70. .name = "bootloader",
  71. .offset = 0,
  72. .size = SZ_1M,
  73. .mask_flags = MTD_WRITEABLE,
  74. }, {
  75. .name = "reserved",
  76. .offset = MTDPART_OFS_APPEND,
  77. .size = SZ_128K,
  78. .mask_flags = MTD_WRITEABLE,
  79. }, {
  80. .name = "reserved",
  81. .offset = MTDPART_OFS_APPEND,
  82. .size = SZ_8M,
  83. .mask_flags = MTD_WRITEABLE,
  84. }, {
  85. .name = "kernel",
  86. .offset = MTDPART_OFS_APPEND,
  87. .size = (SZ_2M + SZ_1M),
  88. .mask_flags = 0,
  89. }, {
  90. .name = "filesystem",
  91. .offset = MTDPART_OFS_APPEND,
  92. .size = SZ_32M + SZ_16M,
  93. .mask_flags = 0,
  94. }
  95. };
  96. static struct onenand_platform_data ttc_dkb_onenand_info = {
  97. .parts = ttc_dkb_onenand_partitions,
  98. .nr_parts = ARRAY_SIZE(ttc_dkb_onenand_partitions),
  99. };
  100. static struct resource ttc_dkb_resource_onenand[] = {
  101. [0] = {
  102. .start = SMC_CS0_PHYS_BASE,
  103. .end = SMC_CS0_PHYS_BASE + SZ_1M,
  104. .flags = IORESOURCE_MEM,
  105. },
  106. };
  107. static struct platform_device ttc_dkb_device_onenand = {
  108. .name = "onenand-flash",
  109. .id = -1,
  110. .resource = ttc_dkb_resource_onenand,
  111. .num_resources = ARRAY_SIZE(ttc_dkb_resource_onenand),
  112. .dev = {
  113. .platform_data = &ttc_dkb_onenand_info,
  114. },
  115. };
  116. static struct platform_device *ttc_dkb_devices[] = {
  117. &pxa910_device_gpio,
  118. &pxa910_device_rtc,
  119. &ttc_dkb_device_onenand,
  120. };
  121. static struct pca953x_platform_data max7312_data[] = {
  122. {
  123. .gpio_base = TTCDKB_GPIO_EXT0(0),
  124. .irq_base = MMP_NR_IRQS,
  125. },
  126. };
  127. static struct pm860x_platform_data ttc_dkb_pm8607_info = {
  128. .irq_base = IRQ_BOARD_START,
  129. };
  130. static struct i2c_board_info ttc_dkb_i2c_info[] = {
  131. {
  132. .type = "88PM860x",
  133. .addr = 0x34,
  134. .platform_data = &ttc_dkb_pm8607_info,
  135. .irq = IRQ_PXA910_PMIC_INT,
  136. },
  137. {
  138. .type = "max7312",
  139. .addr = 0x23,
  140. .irq = MMP_GPIO_TO_IRQ(80),
  141. .platform_data = &max7312_data,
  142. },
  143. };
  144. #ifdef CONFIG_USB_SUPPORT
  145. #if defined(CONFIG_USB_MV_UDC) || defined(CONFIG_USB_EHCI_MV_U2O)
  146. static char *pxa910_usb_clock_name[] = {
  147. [0] = "U2OCLK",
  148. };
  149. static struct mv_usb_platform_data ttc_usb_pdata = {
  150. .clknum = 1,
  151. .clkname = pxa910_usb_clock_name,
  152. .vbus = NULL,
  153. .mode = MV_USB_MODE_OTG,
  154. .otg_force_a_bus_req = 1,
  155. .phy_init = pxa_usb_phy_init,
  156. .phy_deinit = pxa_usb_phy_deinit,
  157. .set_vbus = NULL,
  158. };
  159. #endif
  160. #endif
  161. #ifdef CONFIG_MTD_NAND_PXA3xx
  162. static struct pxa3xx_nand_platform_data dkb_nand_info = {
  163. .enable_arbiter = 1,
  164. .num_cs = 1,
  165. };
  166. #endif
  167. static void __init ttc_dkb_init(void)
  168. {
  169. mfp_config(ARRAY_AND_SIZE(ttc_dkb_pin_config));
  170. /* on-chip devices */
  171. pxa910_add_uart(1);
  172. #ifdef CONFIG_MTD_NAND_PXA3xx
  173. pxa910_add_nand(&dkb_nand_info);
  174. #endif
  175. /* off-chip devices */
  176. pxa910_add_twsi(0, NULL, ARRAY_AND_SIZE(ttc_dkb_i2c_info));
  177. platform_add_devices(ARRAY_AND_SIZE(ttc_dkb_devices));
  178. #ifdef CONFIG_USB_MV_UDC
  179. pxa168_device_u2o.dev.platform_data = &ttc_usb_pdata;
  180. platform_device_register(&pxa168_device_u2o);
  181. #endif
  182. #ifdef CONFIG_USB_EHCI_MV_U2O
  183. pxa168_device_u2oehci.dev.platform_data = &ttc_usb_pdata;
  184. platform_device_register(&pxa168_device_u2oehci);
  185. #endif
  186. #ifdef CONFIG_USB_MV_OTG
  187. pxa168_device_u2ootg.dev.platform_data = &ttc_usb_pdata;
  188. platform_device_register(&pxa168_device_u2ootg);
  189. #endif
  190. }
  191. MACHINE_START(TTC_DKB, "PXA910-based TTC_DKB Development Platform")
  192. .map_io = mmp_map_io,
  193. .nr_irqs = TTCDKB_NR_IRQS,
  194. .init_irq = pxa910_init_irq,
  195. .timer = &pxa910_timer,
  196. .init_machine = ttc_dkb_init,
  197. .restart = mmp_restart,
  198. MACHINE_END