dkb.c 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101
  1. /*
  2. * (C) Copyright 2011
  3. * Marvell Semiconductor <www.marvell.com>
  4. * Written-by: Lei Wen <leiwen@marvell.com>
  5. *
  6. * See file CREDITS for list of people who contributed to this
  7. * project.
  8. *
  9. * This program is free software; you can redistribute it and/or
  10. * modify it under the terms of the GNU General Public License as
  11. * published by the Free Software Foundation; either version 2 of
  12. * the License, or (at your option) any later version.
  13. *
  14. * This program is distributed in the hope that it will be useful,
  15. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  16. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  17. * GNU General Public License for more details.
  18. *
  19. * You should have received a copy of the GNU General Public License
  20. * along with this program; if not, write to the Free Software
  21. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
  22. * MA 02110-1301 USA
  23. */
  24. #include <common.h>
  25. #include <mvmfp.h>
  26. #include <i2c.h>
  27. #include <asm/arch/mfp.h>
  28. #include <asm/arch/cpu.h>
  29. #ifdef CONFIG_GENERIC_MMC
  30. #include <sdhci.h>
  31. #endif
  32. DECLARE_GLOBAL_DATA_PTR;
  33. int board_early_init_f(void)
  34. {
  35. u32 mfp_cfg[] = {
  36. /* Enable Console on UART2 */
  37. MFP47_UART2_RXD,
  38. MFP48_UART2_TXD,
  39. /* I2C */
  40. MFP53_CI2C_SCL,
  41. MFP54_CI2C_SDA,
  42. /* MMC1 */
  43. MFP_MMC1_DAT7,
  44. MFP_MMC1_DAT6,
  45. MFP_MMC1_DAT5,
  46. MFP_MMC1_DAT4,
  47. MFP_MMC1_DAT3,
  48. MFP_MMC1_DAT2,
  49. MFP_MMC1_DAT1,
  50. MFP_MMC1_DAT0,
  51. MFP_MMC1_CMD,
  52. MFP_MMC1_CLK,
  53. MFP_MMC1_CD,
  54. MFP_MMC1_WP,
  55. MFP_EOC /*End of configureation*/
  56. };
  57. /* configure MFP's */
  58. mfp_config(mfp_cfg);
  59. return 0;
  60. }
  61. int board_init(void)
  62. {
  63. /* arch number of Board */
  64. gd->bd->bi_arch_number = MACH_TYPE_TTC_DKB;
  65. /* adress of boot parameters */
  66. gd->bd->bi_boot_params = panth_sdram_base(0) + 0x100;
  67. return 0;
  68. }
  69. #ifdef CONFIG_GENERIC_MMC
  70. #define I2C_SLAVE_ADDR 0x34
  71. #define LDO13_REG 0x28
  72. #define LDO_V30 0x6
  73. #define LDO_VOLTAGE(x) ((x & 0x7) << 1)
  74. #define LDO_EN 0x1
  75. int board_mmc_init(bd_t *bd)
  76. {
  77. ulong mmc_base_address[CONFIG_SYS_MMC_NUM] = CONFIG_SYS_MMC_BASE;
  78. u8 i, data;
  79. /* set LDO 13 to 3.0v */
  80. data = LDO_VOLTAGE(LDO_V30) | LDO_EN;
  81. i2c_write(I2C_SLAVE_ADDR, LDO13_REG, 1, &data, 1);
  82. for (i = 0; i < CONFIG_SYS_MMC_NUM; i++) {
  83. if (mv_sdh_init(mmc_base_address[i], 0, 0,
  84. SDHCI_QUIRK_32BIT_DMA_ADDR))
  85. return 1;
  86. }
  87. return 0;
  88. }
  89. #endif