2 * (C) Copyright 2010-2013
3 * NVIDIA Corporation <www.nvidia.com>
5 * SPDX-License-Identifier: GPL-2.0+
10 #include <asm/arch/pinmux.h>
11 #include <asm/arch/gp_padctrl.h>
12 #include <asm/arch/gpio.h>
14 #include "pinmux-config-cardhu.h"
17 #define PMU_I2C_ADDRESS 0x2D
18 #define MAX_I2C_RETRY 3
21 * Routine: pinmux_init
22 * Description: Do individual peripheral pinmux configs
24 void pinmux_init(void)
26 pinmux_config_pingrp_table(tegra3_pinmux_common,
27 ARRAY_SIZE(tegra3_pinmux_common));
29 pinmux_config_pingrp_table(unused_pins_lowpower,
30 ARRAY_SIZE(unused_pins_lowpower));
32 /* Initialize any non-default pad configs (APB_MISC_GP regs) */
33 pinmux_config_drvgrp_table(cardhu_padctrl, ARRAY_SIZE(cardhu_padctrl));
36 #if defined(CONFIG_TEGRA_MMC)
38 * Do I2C/PMU writes to bring up SD card bus power
41 void board_sdmmc_voltage_init(void)
44 uchar reg, data_buffer[1];
48 ret = i2c_get_chip_for_busnum(0, PMU_I2C_ADDRESS, 1, &dev);
50 debug("%s: Cannot find PMIC I2C chip\n", __func__);
54 /* TPS659110: LDO5_REG = 3.3v, ACTIVE to SDMMC1 */
55 data_buffer[0] = 0x65;
58 for (i = 0; i < MAX_I2C_RETRY; ++i) {
59 if (dm_i2c_write(dev, reg, data_buffer, 1))
63 /* TPS659110: GPIO7_REG = PDEN, output a 1 to EN_3V3_SYS */
64 data_buffer[0] = 0x09;
67 for (i = 0; i < MAX_I2C_RETRY; ++i) {
68 if (dm_i2c_write(dev, reg, data_buffer, 1))
74 * Routine: pin_mux_mmc
75 * Description: setup the MMC muxes, power rails, etc.
77 void pin_mux_mmc(void)
80 * NOTE: We don't do mmc-specific pin muxes here.
81 * They were done globally in pinmux_init().
84 /* Bring up the SDIO1 power rail */
85 board_sdmmc_voltage_init();
89 #ifdef CONFIG_PCI_TEGRA
90 int tegra_pcie_board_init(void)
96 err = i2c_get_chip_for_busnum(0, PMU_I2C_ADDRESS, 1, &dev);
98 debug("failed to find PMU bus\n");
102 /* TPS659110: LDO1_REG = 1.05V, ACTIVE */
106 err = dm_i2c_write(dev, addr, data, 1);
108 debug("failed to set VDD supply\n");
112 /* GPIO: PEX = 3.3V */
113 err = gpio_request(TEGRA_GPIO(L, 7), "PEX");
117 gpio_direction_output(TEGRA_GPIO(L, 7), 1);
119 /* TPS659110: LDO2_REG = 1.05V, ACTIVE */
123 err = dm_i2c_write(dev, addr, data, 1);
125 debug("failed to set AVDD supply\n");