Lei Wen | ea4bc12 | 2011-02-09 18:17:47 +0530 | [diff] [blame] | 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 | |
| 25 | #include <common.h> |
| 26 | #include <mvmfp.h> |
Lei Wen | 19d3dbe | 2011-10-03 20:33:42 +0000 | [diff] [blame] | 27 | #include <i2c.h> |
Lei Wen | ea4bc12 | 2011-02-09 18:17:47 +0530 | [diff] [blame] | 28 | #include <asm/arch/mfp.h> |
| 29 | #include <asm/arch/cpu.h> |
Lei Wen | 19d3dbe | 2011-10-03 20:33:42 +0000 | [diff] [blame] | 30 | #ifdef CONFIG_GENERIC_MMC |
| 31 | #include <sdhci.h> |
| 32 | #endif |
Lei Wen | ea4bc12 | 2011-02-09 18:17:47 +0530 | [diff] [blame] | 33 | |
| 34 | DECLARE_GLOBAL_DATA_PTR; |
| 35 | |
| 36 | int 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 Wen | aa3b168 | 2011-04-13 23:48:34 +0530 | [diff] [blame] | 43 | /* I2C */ |
| 44 | MFP53_CI2C_SCL, |
| 45 | MFP54_CI2C_SDA, |
| 46 | |
Lei Wen | 19d3dbe | 2011-10-03 20:33:42 +0000 | [diff] [blame] | 47 | /* 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 Wen | ea4bc12 | 2011-02-09 18:17:47 +0530 | [diff] [blame] | 61 | MFP_EOC /*End of configureation*/ |
| 62 | }; |
| 63 | /* configure MFP's */ |
| 64 | mfp_config(mfp_cfg); |
| 65 | |
| 66 | return 0; |
| 67 | } |
| 68 | |
| 69 | int 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 Wen | 19d3dbe | 2011-10-03 20:33:42 +0000 | [diff] [blame] | 77 | |
| 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 |
| 84 | int 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 |