]> git.kernelconcepts.de Git - karo-tx-uboot.git/blob - board/Marvell/dkb/dkb.c
Merge git://git.denx.de/u-boot-arm
[karo-tx-uboot.git] / board / Marvell / dkb / dkb.c
1 /*
2  * (C) Copyright 2011
3  * Marvell Semiconductor <www.marvell.com>
4  * Written-by: Lei Wen <leiwen@marvell.com>
5  *
6  * SPDX-License-Identifier:     GPL-2.0+
7  */
8
9 #include <common.h>
10 #include <mvmfp.h>
11 #include <i2c.h>
12 #include <asm/arch/mfp.h>
13 #include <asm/arch/cpu.h>
14 #ifdef CONFIG_GENERIC_MMC
15 #include <sdhci.h>
16 #endif
17
18 DECLARE_GLOBAL_DATA_PTR;
19
20 int board_early_init_f(void)
21 {
22         u32 mfp_cfg[] = {
23                 /* Enable Console on UART2 */
24                 MFP47_UART2_RXD,
25                 MFP48_UART2_TXD,
26
27                 /* I2C */
28                 MFP53_CI2C_SCL,
29                 MFP54_CI2C_SDA,
30
31                 /* 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
45                 MFP_EOC         /*End of configureation*/
46         };
47         /* configure MFP's */
48         mfp_config(mfp_cfg);
49
50         return 0;
51 }
52
53 int 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 }
61
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
68 int 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