Tom Warren | 23d7fe9 | 2012-12-11 13:34:18 +0000 | [diff] [blame] | 1 | /* |
Tom Warren | 7110b95 | 2013-03-06 16:16:22 -0700 | [diff] [blame] | 2 | * (C) Copyright 2010-2013 |
Tom Warren | 23d7fe9 | 2012-12-11 13:34:18 +0000 | [diff] [blame] | 3 | * NVIDIA Corporation <www.nvidia.com> |
| 4 | * |
Wolfgang Denk | d79de1d | 2013-07-08 09:37:19 +0200 | [diff] [blame] | 5 | * SPDX-License-Identifier: GPL-2.0+ |
Tom Warren | 23d7fe9 | 2012-12-11 13:34:18 +0000 | [diff] [blame] | 6 | */ |
| 7 | |
| 8 | #include <common.h> |
| 9 | #include <asm/arch/pinmux.h> |
Tom Warren | 7110b95 | 2013-03-06 16:16:22 -0700 | [diff] [blame] | 10 | #include <asm/arch/gp_padctrl.h> |
Tom Warren | 23d7fe9 | 2012-12-11 13:34:18 +0000 | [diff] [blame] | 11 | #include "pinmux-config-cardhu.h" |
Tom Warren | f5d874d | 2013-02-26 12:26:55 -0700 | [diff] [blame] | 12 | #include <i2c.h> |
| 13 | |
| 14 | #define PMU_I2C_ADDRESS 0x2D |
| 15 | #define MAX_I2C_RETRY 3 |
Tom Warren | 23d7fe9 | 2012-12-11 13:34:18 +0000 | [diff] [blame] | 16 | |
| 17 | /* |
| 18 | * Routine: pinmux_init |
| 19 | * Description: Do individual peripheral pinmux configs |
| 20 | */ |
| 21 | void pinmux_init(void) |
| 22 | { |
Stephen Warren | f4df605 | 2014-03-21 12:28:56 -0600 | [diff] [blame] | 23 | pinmux_config_pingrp_table(tegra3_pinmux_common, |
Tom Warren | 23d7fe9 | 2012-12-11 13:34:18 +0000 | [diff] [blame] | 24 | ARRAY_SIZE(tegra3_pinmux_common)); |
| 25 | |
Stephen Warren | f4df605 | 2014-03-21 12:28:56 -0600 | [diff] [blame] | 26 | pinmux_config_pingrp_table(unused_pins_lowpower, |
Tom Warren | 23d7fe9 | 2012-12-11 13:34:18 +0000 | [diff] [blame] | 27 | ARRAY_SIZE(unused_pins_lowpower)); |
Tom Warren | 7110b95 | 2013-03-06 16:16:22 -0700 | [diff] [blame] | 28 | |
| 29 | /* Initialize any non-default pad configs (APB_MISC_GP regs) */ |
Stephen Warren | f4df605 | 2014-03-21 12:28:56 -0600 | [diff] [blame] | 30 | pinmux_config_drvgrp_table(cardhu_padctrl, ARRAY_SIZE(cardhu_padctrl)); |
Tom Warren | 23d7fe9 | 2012-12-11 13:34:18 +0000 | [diff] [blame] | 31 | } |
Tom Warren | f5d874d | 2013-02-26 12:26:55 -0700 | [diff] [blame] | 32 | |
| 33 | #if defined(CONFIG_TEGRA_MMC) |
| 34 | /* |
| 35 | * Do I2C/PMU writes to bring up SD card bus power |
| 36 | * |
| 37 | */ |
| 38 | void board_sdmmc_voltage_init(void) |
| 39 | { |
| 40 | uchar reg, data_buffer[1]; |
| 41 | int i; |
| 42 | |
| 43 | i2c_set_bus_num(0); /* PMU is on bus 0 */ |
| 44 | |
| 45 | /* TPS659110: LDO5_REG = 3.3v, ACTIVE to SDMMC1 */ |
| 46 | data_buffer[0] = 0x65; |
| 47 | reg = 0x32; |
| 48 | |
| 49 | for (i = 0; i < MAX_I2C_RETRY; ++i) { |
| 50 | if (i2c_write(PMU_I2C_ADDRESS, reg, 1, data_buffer, 1)) |
| 51 | udelay(100); |
| 52 | } |
| 53 | |
| 54 | /* TPS659110: GPIO7_REG = PDEN, output a 1 to EN_3V3_SYS */ |
| 55 | data_buffer[0] = 0x09; |
| 56 | reg = 0x67; |
| 57 | |
| 58 | for (i = 0; i < MAX_I2C_RETRY; ++i) { |
| 59 | if (i2c_write(PMU_I2C_ADDRESS, reg, 1, data_buffer, 1)) |
| 60 | udelay(100); |
| 61 | } |
| 62 | } |
| 63 | |
| 64 | /* |
| 65 | * Routine: pin_mux_mmc |
| 66 | * Description: setup the MMC muxes, power rails, etc. |
| 67 | */ |
| 68 | void pin_mux_mmc(void) |
| 69 | { |
| 70 | /* |
| 71 | * NOTE: We don't do mmc-specific pin muxes here. |
| 72 | * They were done globally in pinmux_init(). |
| 73 | */ |
| 74 | |
| 75 | /* Bring up the SDIO1 power rail */ |
| 76 | board_sdmmc_voltage_init(); |
| 77 | } |
| 78 | #endif /* MMC */ |