brownstone.c 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232
  1. /*
  2. * linux/arch/arm/mach-mmp/brownstone.c
  3. *
  4. * Support for the Marvell Brownstone Development Platform.
  5. *
  6. * Copyright (C) 2009-2010 Marvell International Ltd.
  7. *
  8. * This program is free software; you can redistribute it and/or modify
  9. * it under the terms of the GNU General Public License version 2 as
  10. * publishhed by the Free Software Foundation.
  11. */
  12. #include <linux/init.h>
  13. #include <linux/kernel.h>
  14. #include <linux/platform_device.h>
  15. #include <linux/io.h>
  16. #include <linux/gpio-pxa.h>
  17. #include <linux/regulator/machine.h>
  18. #include <linux/regulator/max8649.h>
  19. #include <linux/regulator/fixed.h>
  20. #include <linux/mfd/max8925.h>
  21. #include <asm/mach-types.h>
  22. #include <asm/mach/arch.h>
  23. #include "addr-map.h"
  24. #include "mfp-mmp2.h"
  25. #include "mmp2.h"
  26. #include "irqs.h"
  27. #include "common.h"
  28. #define BROWNSTONE_NR_IRQS (MMP_NR_IRQS + 40)
  29. #define GPIO_5V_ENABLE (89)
  30. static unsigned long brownstone_pin_config[] __initdata = {
  31. /* UART1 */
  32. GPIO29_UART1_RXD,
  33. GPIO30_UART1_TXD,
  34. /* UART3 */
  35. GPIO51_UART3_RXD,
  36. GPIO52_UART3_TXD,
  37. /* DFI */
  38. GPIO168_DFI_D0,
  39. GPIO167_DFI_D1,
  40. GPIO166_DFI_D2,
  41. GPIO165_DFI_D3,
  42. GPIO107_DFI_D4,
  43. GPIO106_DFI_D5,
  44. GPIO105_DFI_D6,
  45. GPIO104_DFI_D7,
  46. GPIO111_DFI_D8,
  47. GPIO164_DFI_D9,
  48. GPIO163_DFI_D10,
  49. GPIO162_DFI_D11,
  50. GPIO161_DFI_D12,
  51. GPIO110_DFI_D13,
  52. GPIO109_DFI_D14,
  53. GPIO108_DFI_D15,
  54. GPIO143_ND_nCS0,
  55. GPIO144_ND_nCS1,
  56. GPIO147_ND_nWE,
  57. GPIO148_ND_nRE,
  58. GPIO150_ND_ALE,
  59. GPIO149_ND_CLE,
  60. GPIO112_ND_RDY0,
  61. GPIO160_ND_RDY1,
  62. /* PMIC */
  63. PMIC_PMIC_INT | MFP_LPM_EDGE_FALL,
  64. /* MMC0 */
  65. GPIO131_MMC1_DAT3 | MFP_PULL_HIGH,
  66. GPIO132_MMC1_DAT2 | MFP_PULL_HIGH,
  67. GPIO133_MMC1_DAT1 | MFP_PULL_HIGH,
  68. GPIO134_MMC1_DAT0 | MFP_PULL_HIGH,
  69. GPIO136_MMC1_CMD | MFP_PULL_HIGH,
  70. GPIO139_MMC1_CLK,
  71. GPIO140_MMC1_CD | MFP_PULL_LOW,
  72. GPIO141_MMC1_WP | MFP_PULL_LOW,
  73. /* MMC1 */
  74. GPIO37_MMC2_DAT3 | MFP_PULL_HIGH,
  75. GPIO38_MMC2_DAT2 | MFP_PULL_HIGH,
  76. GPIO39_MMC2_DAT1 | MFP_PULL_HIGH,
  77. GPIO40_MMC2_DAT0 | MFP_PULL_HIGH,
  78. GPIO41_MMC2_CMD | MFP_PULL_HIGH,
  79. GPIO42_MMC2_CLK,
  80. /* MMC2 */
  81. GPIO165_MMC3_DAT7 | MFP_PULL_HIGH,
  82. GPIO162_MMC3_DAT6 | MFP_PULL_HIGH,
  83. GPIO166_MMC3_DAT5 | MFP_PULL_HIGH,
  84. GPIO163_MMC3_DAT4 | MFP_PULL_HIGH,
  85. GPIO167_MMC3_DAT3 | MFP_PULL_HIGH,
  86. GPIO164_MMC3_DAT2 | MFP_PULL_HIGH,
  87. GPIO168_MMC3_DAT1 | MFP_PULL_HIGH,
  88. GPIO111_MMC3_DAT0 | MFP_PULL_HIGH,
  89. GPIO112_MMC3_CMD | MFP_PULL_HIGH,
  90. GPIO151_MMC3_CLK,
  91. /* 5V regulator */
  92. GPIO89_GPIO,
  93. };
  94. static struct pxa_gpio_platform_data mmp2_gpio_pdata = {
  95. .irq_base = MMP_GPIO_TO_IRQ(0),
  96. };
  97. static struct regulator_consumer_supply max8649_supply[] = {
  98. REGULATOR_SUPPLY("vcc_core", NULL),
  99. };
  100. static struct regulator_init_data max8649_init_data = {
  101. .constraints = {
  102. .name = "vcc_core range",
  103. .min_uV = 1150000,
  104. .max_uV = 1280000,
  105. .always_on = 1,
  106. .boot_on = 1,
  107. .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE,
  108. },
  109. .num_consumer_supplies = 1,
  110. .consumer_supplies = &max8649_supply[0],
  111. };
  112. static struct max8649_platform_data brownstone_max8649_info = {
  113. .mode = 2, /* VID1 = 1, VID0 = 0 */
  114. .extclk = 0,
  115. .ramp_timing = MAX8649_RAMP_32MV,
  116. .regulator = &max8649_init_data,
  117. };
  118. static struct regulator_consumer_supply brownstone_v_5vp_supplies[] = {
  119. REGULATOR_SUPPLY("v_5vp", NULL),
  120. };
  121. static struct regulator_init_data brownstone_v_5vp_data = {
  122. .constraints = {
  123. .valid_ops_mask = REGULATOR_CHANGE_STATUS,
  124. },
  125. .num_consumer_supplies = ARRAY_SIZE(brownstone_v_5vp_supplies),
  126. .consumer_supplies = brownstone_v_5vp_supplies,
  127. };
  128. static struct fixed_voltage_config brownstone_v_5vp = {
  129. .supply_name = "v_5vp",
  130. .microvolts = 5000000,
  131. .gpio = GPIO_5V_ENABLE,
  132. .enable_high = 1,
  133. .enabled_at_boot = 1,
  134. .init_data = &brownstone_v_5vp_data,
  135. };
  136. static struct platform_device brownstone_v_5vp_device = {
  137. .name = "reg-fixed-voltage",
  138. .id = 1,
  139. .dev = {
  140. .platform_data = &brownstone_v_5vp,
  141. },
  142. };
  143. static struct max8925_platform_data brownstone_max8925_info = {
  144. .irq_base = MMP_NR_IRQS,
  145. };
  146. static struct i2c_board_info brownstone_twsi1_info[] = {
  147. [0] = {
  148. .type = "max8649",
  149. .addr = 0x60,
  150. .platform_data = &brownstone_max8649_info,
  151. },
  152. [1] = {
  153. .type = "max8925",
  154. .addr = 0x3c,
  155. .irq = IRQ_MMP2_PMIC,
  156. .platform_data = &brownstone_max8925_info,
  157. },
  158. };
  159. static struct sdhci_pxa_platdata mmp2_sdh_platdata_mmc0 = {
  160. .clk_delay_cycles = 0x1f,
  161. };
  162. static struct sdhci_pxa_platdata mmp2_sdh_platdata_mmc2 = {
  163. .clk_delay_cycles = 0x1f,
  164. .flags = PXA_FLAG_CARD_PERMANENT
  165. | PXA_FLAG_SD_8_BIT_CAPABLE_SLOT,
  166. };
  167. static struct sram_platdata mmp2_asram_platdata = {
  168. .pool_name = "asram",
  169. .granularity = SRAM_GRANULARITY,
  170. };
  171. static struct sram_platdata mmp2_isram_platdata = {
  172. .pool_name = "isram",
  173. .granularity = SRAM_GRANULARITY,
  174. };
  175. static void __init brownstone_init(void)
  176. {
  177. mfp_config(ARRAY_AND_SIZE(brownstone_pin_config));
  178. /* on-chip devices */
  179. mmp2_add_uart(1);
  180. mmp2_add_uart(3);
  181. platform_device_add_data(&mmp2_device_gpio, &mmp2_gpio_pdata,
  182. sizeof(struct pxa_gpio_platform_data));
  183. platform_device_register(&mmp2_device_gpio);
  184. mmp2_add_twsi(1, NULL, ARRAY_AND_SIZE(brownstone_twsi1_info));
  185. mmp2_add_sdhost(0, &mmp2_sdh_platdata_mmc0); /* SD/MMC */
  186. mmp2_add_sdhost(2, &mmp2_sdh_platdata_mmc2); /* eMMC */
  187. mmp2_add_asram(&mmp2_asram_platdata);
  188. mmp2_add_isram(&mmp2_isram_platdata);
  189. /* enable 5v regulator */
  190. platform_device_register(&brownstone_v_5vp_device);
  191. }
  192. MACHINE_START(BROWNSTONE, "Brownstone Development Platform")
  193. /* Maintainer: Haojian Zhuang <haojian.zhuang@marvell.com> */
  194. .map_io = mmp_map_io,
  195. .nr_irqs = BROWNSTONE_NR_IRQS,
  196. .init_irq = mmp2_init_irq,
  197. .init_time = mmp2_timer_init,
  198. .init_machine = brownstone_init,
  199. .restart = mmp_restart,
  200. MACHINE_END