blob: c0c31259a328d1e44b79adcd76d87bf4e457bc01 [file] [log] [blame]
Lei Wenea4bc122011-02-09 18:17:47 +05301/*
2 * (C) Copyright 2011
3 * Marvell Semiconductor <www.marvell.com>
4 * Written-by: Lei Wen <leiwen@marvell.com>
5 *
Wolfgang Denk1a459662013-07-08 09:37:19 +02006 * SPDX-License-Identifier: GPL-2.0+
Lei Wenea4bc122011-02-09 18:17:47 +05307 */
8
9#include <common.h>
10#include <mvmfp.h>
Lei Wen19d3dbe2011-10-03 20:33:42 +000011#include <i2c.h>
Lei Wenea4bc122011-02-09 18:17:47 +053012#include <asm/arch/mfp.h>
13#include <asm/arch/cpu.h>
Lei Wen19d3dbe2011-10-03 20:33:42 +000014#ifdef CONFIG_GENERIC_MMC
15#include <sdhci.h>
16#endif
Lei Wenea4bc122011-02-09 18:17:47 +053017
18DECLARE_GLOBAL_DATA_PTR;
19
20int board_early_init_f(void)
21{
22 u32 mfp_cfg[] = {
23 /* Enable Console on UART2 */
24 MFP47_UART2_RXD,
25 MFP48_UART2_TXD,
26
Lei Wenaa3b1682011-04-13 23:48:34 +053027 /* I2C */
28 MFP53_CI2C_SCL,
29 MFP54_CI2C_SDA,
30
Lei Wen19d3dbe2011-10-03 20:33:42 +000031 /* MMC1 */
32 MFP_MMC1_DAT7,
33 MFP_MMC1_DAT6,
34 MFP_MMC1_DAT5,
35 MFP_MMC1_DAT4,
36 MFP_MMC1_DAT3,
37 MFP_MMC1_DAT2,
38 MFP_MMC1_DAT1,
39 MFP_MMC1_DAT0,
40 MFP_MMC1_CMD,
41 MFP_MMC1_CLK,
42 MFP_MMC1_CD,
43 MFP_MMC1_WP,
44
Lei Wenea4bc122011-02-09 18:17:47 +053045 MFP_EOC /*End of configureation*/
46 };
47 /* configure MFP's */
48 mfp_config(mfp_cfg);
49
50 return 0;
51}
52
53int board_init(void)
54{
55 /* arch number of Board */
56 gd->bd->bi_arch_number = MACH_TYPE_TTC_DKB;
57 /* adress of boot parameters */
58 gd->bd->bi_boot_params = panth_sdram_base(0) + 0x100;
59 return 0;
60}
Lei Wen19d3dbe2011-10-03 20:33:42 +000061
62#ifdef CONFIG_GENERIC_MMC
63#define I2C_SLAVE_ADDR 0x34
64#define LDO13_REG 0x28
65#define LDO_V30 0x6
66#define LDO_VOLTAGE(x) ((x & 0x7) << 1)
67#define LDO_EN 0x1
68int board_mmc_init(bd_t *bd)
69{
70 ulong mmc_base_address[CONFIG_SYS_MMC_NUM] = CONFIG_SYS_MMC_BASE;
71 u8 i, data;
72
73 /* set LDO 13 to 3.0v */
74 data = LDO_VOLTAGE(LDO_V30) | LDO_EN;
75 i2c_write(I2C_SLAVE_ADDR, LDO13_REG, 1, &data, 1);
76
77 for (i = 0; i < CONFIG_SYS_MMC_NUM; i++) {
78 if (mv_sdh_init(mmc_base_address[i], 0, 0,
79 SDHCI_QUIRK_32BIT_DMA_ADDR))
80 return 1;
81 }
82
83 return 0;
84}
85#endif