blob: 4a9abee0f1697c7bb0c38636381321f624efcb95 [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 *
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
25#include <common.h>
26#include <mvmfp.h>
Lei Wen19d3dbe2011-10-03 20:33:42 +000027#include <i2c.h>
Lei Wenea4bc122011-02-09 18:17:47 +053028#include <asm/arch/mfp.h>
29#include <asm/arch/cpu.h>
Lei Wen19d3dbe2011-10-03 20:33:42 +000030#ifdef CONFIG_GENERIC_MMC
31#include <sdhci.h>
32#endif
Lei Wenea4bc122011-02-09 18:17:47 +053033
34DECLARE_GLOBAL_DATA_PTR;
35
36int board_early_init_f(void)
37{
38 u32 mfp_cfg[] = {
39 /* Enable Console on UART2 */
40 MFP47_UART2_RXD,
41 MFP48_UART2_TXD,
42
Lei Wenaa3b1682011-04-13 23:48:34 +053043 /* I2C */
44 MFP53_CI2C_SCL,
45 MFP54_CI2C_SDA,
46
Lei Wen19d3dbe2011-10-03 20:33:42 +000047 /* MMC1 */
48 MFP_MMC1_DAT7,
49 MFP_MMC1_DAT6,
50 MFP_MMC1_DAT5,
51 MFP_MMC1_DAT4,
52 MFP_MMC1_DAT3,
53 MFP_MMC1_DAT2,
54 MFP_MMC1_DAT1,
55 MFP_MMC1_DAT0,
56 MFP_MMC1_CMD,
57 MFP_MMC1_CLK,
58 MFP_MMC1_CD,
59 MFP_MMC1_WP,
60
Lei Wenea4bc122011-02-09 18:17:47 +053061 MFP_EOC /*End of configureation*/
62 };
63 /* configure MFP's */
64 mfp_config(mfp_cfg);
65
66 return 0;
67}
68
69int board_init(void)
70{
71 /* arch number of Board */
72 gd->bd->bi_arch_number = MACH_TYPE_TTC_DKB;
73 /* adress of boot parameters */
74 gd->bd->bi_boot_params = panth_sdram_base(0) + 0x100;
75 return 0;
76}
Lei Wen19d3dbe2011-10-03 20:33:42 +000077
78#ifdef CONFIG_GENERIC_MMC
79#define I2C_SLAVE_ADDR 0x34
80#define LDO13_REG 0x28
81#define LDO_V30 0x6
82#define LDO_VOLTAGE(x) ((x & 0x7) << 1)
83#define LDO_EN 0x1
84int board_mmc_init(bd_t *bd)
85{
86 ulong mmc_base_address[CONFIG_SYS_MMC_NUM] = CONFIG_SYS_MMC_BASE;
87 u8 i, data;
88
89 /* set LDO 13 to 3.0v */
90 data = LDO_VOLTAGE(LDO_V30) | LDO_EN;
91 i2c_write(I2C_SLAVE_ADDR, LDO13_REG, 1, &data, 1);
92
93 for (i = 0; i < CONFIG_SYS_MMC_NUM; i++) {
94 if (mv_sdh_init(mmc_base_address[i], 0, 0,
95 SDHCI_QUIRK_32BIT_DMA_ADDR))
96 return 1;
97 }
98
99 return 0;
100}
101#endif