Tom Warren | 7a3fa01 | 2013-01-28 13:32:13 +0000 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (c) 2010-2013, NVIDIA CORPORATION. All rights reserved. |
| 3 | * |
| 4 | * This program is free software; you can redistribute it and/or modify it |
| 5 | * under the terms and conditions of the GNU General Public License, |
| 6 | * version 2, as published by the Free Software Foundation. |
| 7 | * |
| 8 | * This program is distributed in the hope it will be useful, but WITHOUT |
| 9 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
| 10 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for |
| 11 | * more details. |
| 12 | * |
| 13 | * You should have received a copy of the GNU General Public License |
| 14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. |
| 15 | */ |
| 16 | |
| 17 | #include <common.h> |
| 18 | #include <asm/arch/pinmux.h> |
Tom Warren | 3086f6a | 2013-03-18 14:47:55 -0700 | [diff] [blame] | 19 | #include <asm/arch/gp_padctrl.h> |
Tom Warren | 7a3fa01 | 2013-01-28 13:32:13 +0000 | [diff] [blame] | 20 | #include "pinmux-config-dalmore.h" |
Tom Warren | 35a1d09 | 2013-03-18 14:51:20 -0700 | [diff] [blame] | 21 | #include <i2c.h> |
| 22 | |
| 23 | #define BAT_I2C_ADDRESS 0x48 /* TPS65090 charger */ |
| 24 | #define PMU_I2C_ADDRESS 0x58 /* TPS65913 PMU */ |
Tom Warren | 7a3fa01 | 2013-01-28 13:32:13 +0000 | [diff] [blame] | 25 | |
| 26 | /* |
| 27 | * Routine: pinmux_init |
| 28 | * Description: Do individual peripheral pinmux configs |
| 29 | */ |
| 30 | void pinmux_init(void) |
| 31 | { |
Stephen Warren | f4df605 | 2014-03-21 12:28:56 -0600 | [diff] [blame] | 32 | pinmux_config_pingrp_table(tegra114_pinmux_set_nontristate, |
Tom Warren | 8495b22 | 2013-03-01 14:38:20 -0700 | [diff] [blame] | 33 | ARRAY_SIZE(tegra114_pinmux_set_nontristate)); |
| 34 | |
Stephen Warren | f4df605 | 2014-03-21 12:28:56 -0600 | [diff] [blame] | 35 | pinmux_config_pingrp_table(tegra114_pinmux_common, |
Tom Warren | 7a3fa01 | 2013-01-28 13:32:13 +0000 | [diff] [blame] | 36 | ARRAY_SIZE(tegra114_pinmux_common)); |
| 37 | |
Stephen Warren | f4df605 | 2014-03-21 12:28:56 -0600 | [diff] [blame] | 38 | pinmux_config_pingrp_table(unused_pins_lowpower, |
Tom Warren | 7a3fa01 | 2013-01-28 13:32:13 +0000 | [diff] [blame] | 39 | ARRAY_SIZE(unused_pins_lowpower)); |
Tom Warren | 3086f6a | 2013-03-18 14:47:55 -0700 | [diff] [blame] | 40 | |
| 41 | /* Initialize any non-default pad configs (APB_MISC_GP regs) */ |
Stephen Warren | f4df605 | 2014-03-21 12:28:56 -0600 | [diff] [blame] | 42 | pinmux_config_drvgrp_table(dalmore_padctrl, |
| 43 | ARRAY_SIZE(dalmore_padctrl)); |
Tom Warren | 7a3fa01 | 2013-01-28 13:32:13 +0000 | [diff] [blame] | 44 | } |
Tom Warren | 35a1d09 | 2013-03-18 14:51:20 -0700 | [diff] [blame] | 45 | |
| 46 | #if defined(CONFIG_TEGRA_MMC) |
| 47 | /* |
| 48 | * Do I2C/PMU writes to bring up SD card bus power |
| 49 | * |
| 50 | */ |
| 51 | void board_sdmmc_voltage_init(void) |
| 52 | { |
| 53 | uchar reg, data_buffer[1]; |
| 54 | int ret; |
| 55 | |
| 56 | ret = i2c_set_bus_num(0);/* PMU is on bus 0 */ |
| 57 | if (ret) |
| 58 | printf("%s: i2c_set_bus_num returned %d\n", __func__, ret); |
| 59 | |
| 60 | /* TPS65913: LDO9_VOLTAGE = 3.3V */ |
| 61 | data_buffer[0] = 0x31; |
| 62 | reg = 0x61; |
| 63 | |
| 64 | ret = i2c_write(PMU_I2C_ADDRESS, reg, 1, data_buffer, 1); |
| 65 | if (ret) |
| 66 | printf("%s: PMU i2c_write %02X<-%02X returned %d\n", |
| 67 | __func__, reg, data_buffer[0], ret); |
| 68 | |
| 69 | /* TPS65913: LDO9_CTRL = Active */ |
| 70 | data_buffer[0] = 0x01; |
| 71 | reg = 0x60; |
| 72 | |
| 73 | ret = i2c_write(PMU_I2C_ADDRESS, reg, 1, data_buffer, 1); |
| 74 | if (ret) |
| 75 | printf("%s: PMU i2c_write %02X<-%02X returned %d\n", |
| 76 | __func__, reg, data_buffer[0], ret); |
| 77 | |
| 78 | /* TPS65090: FET6_CTRL = enable output auto discharge, enable FET6 */ |
| 79 | data_buffer[0] = 0x03; |
| 80 | reg = 0x14; |
| 81 | |
| 82 | ret = i2c_write(BAT_I2C_ADDRESS, reg, 1, data_buffer, 1); |
| 83 | if (ret) |
| 84 | printf("%s: BAT i2c_write %02X<-%02X returned %d\n", |
| 85 | __func__, reg, data_buffer[0], ret); |
| 86 | } |
| 87 | |
| 88 | /* |
| 89 | * Routine: pin_mux_mmc |
| 90 | * Description: setup the MMC muxes, power rails, etc. |
| 91 | */ |
| 92 | void pin_mux_mmc(void) |
| 93 | { |
| 94 | /* |
| 95 | * NOTE: We don't do mmc-specific pin muxes here. |
| 96 | * They were done globally in pinmux_init(). |
| 97 | */ |
| 98 | |
| 99 | /* Bring up the SDIO3 power rail */ |
| 100 | board_sdmmc_voltage_init(); |
| 101 | } |
| 102 | #endif /* MMC */ |