]>
Commit | Line | Data |
---|---|---|
07067145 TW |
1 | /* |
2 | * Copyright (c) 2010-2013, NVIDIA CORPORATION. All rights reserved. | |
3 | * | |
5b8031cc | 4 | * SPDX-License-Identifier: GPL-2.0 |
07067145 TW |
5 | */ |
6 | ||
7 | #include <common.h> | |
b0e6ef46 | 8 | #include <dm.h> |
07067145 | 9 | #include <asm/arch/pinmux.h> |
2a04a317 | 10 | #include <asm/arch/gp_padctrl.h> |
07067145 | 11 | #include "pinmux-config-dalmore.h" |
6d9ea159 TW |
12 | #include <i2c.h> |
13 | ||
14 | #define BAT_I2C_ADDRESS 0x48 /* TPS65090 charger */ | |
15 | #define PMU_I2C_ADDRESS 0x58 /* TPS65913 PMU */ | |
07067145 TW |
16 | |
17 | /* | |
18 | * Routine: pinmux_init | |
19 | * Description: Do individual peripheral pinmux configs | |
20 | */ | |
21 | void pinmux_init(void) | |
22 | { | |
dfb42fc9 | 23 | pinmux_config_pingrp_table(tegra114_pinmux_set_nontristate, |
8b7776b9 TW |
24 | ARRAY_SIZE(tegra114_pinmux_set_nontristate)); |
25 | ||
dfb42fc9 | 26 | pinmux_config_pingrp_table(tegra114_pinmux_common, |
07067145 TW |
27 | ARRAY_SIZE(tegra114_pinmux_common)); |
28 | ||
dfb42fc9 | 29 | pinmux_config_pingrp_table(unused_pins_lowpower, |
07067145 | 30 | ARRAY_SIZE(unused_pins_lowpower)); |
2a04a317 TW |
31 | |
32 | /* Initialize any non-default pad configs (APB_MISC_GP regs) */ | |
dfb42fc9 SW |
33 | pinmux_config_drvgrp_table(dalmore_padctrl, |
34 | ARRAY_SIZE(dalmore_padctrl)); | |
07067145 | 35 | } |
6d9ea159 TW |
36 | |
37 | #if defined(CONFIG_TEGRA_MMC) | |
38 | /* | |
39 | * Do I2C/PMU writes to bring up SD card bus power | |
40 | * | |
41 | */ | |
42 | void board_sdmmc_voltage_init(void) | |
43 | { | |
b0e6ef46 | 44 | struct udevice *dev; |
6d9ea159 TW |
45 | uchar reg, data_buffer[1]; |
46 | int ret; | |
47 | ||
25ab4b03 | 48 | ret = i2c_get_chip_for_busnum(0, PMU_I2C_ADDRESS, 1, &dev); |
b0e6ef46 SG |
49 | if (ret) { |
50 | debug("%s: Cannot find PMIC I2C chip\n", __func__); | |
51 | return; | |
52 | } | |
6d9ea159 TW |
53 | |
54 | /* TPS65913: LDO9_VOLTAGE = 3.3V */ | |
55 | data_buffer[0] = 0x31; | |
56 | reg = 0x61; | |
57 | ||
f9a4c2da | 58 | ret = dm_i2c_write(dev, reg, data_buffer, 1); |
6d9ea159 TW |
59 | if (ret) |
60 | printf("%s: PMU i2c_write %02X<-%02X returned %d\n", | |
61 | __func__, reg, data_buffer[0], ret); | |
62 | ||
63 | /* TPS65913: LDO9_CTRL = Active */ | |
64 | data_buffer[0] = 0x01; | |
65 | reg = 0x60; | |
66 | ||
f9a4c2da | 67 | ret = dm_i2c_write(dev, reg, data_buffer, 1); |
6d9ea159 TW |
68 | if (ret) |
69 | printf("%s: PMU i2c_write %02X<-%02X returned %d\n", | |
70 | __func__, reg, data_buffer[0], ret); | |
71 | ||
72 | /* TPS65090: FET6_CTRL = enable output auto discharge, enable FET6 */ | |
73 | data_buffer[0] = 0x03; | |
74 | reg = 0x14; | |
75 | ||
25ab4b03 | 76 | ret = i2c_get_chip_for_busnum(0, BAT_I2C_ADDRESS, 1, &dev); |
b0e6ef46 SG |
77 | if (ret) { |
78 | debug("%s: Cannot find charger I2C chip\n", __func__); | |
79 | return; | |
80 | } | |
f9a4c2da | 81 | ret = dm_i2c_write(dev, reg, data_buffer, 1); |
6d9ea159 TW |
82 | if (ret) |
83 | printf("%s: BAT i2c_write %02X<-%02X returned %d\n", | |
84 | __func__, reg, data_buffer[0], ret); | |
85 | } | |
86 | ||
87 | /* | |
88 | * Routine: pin_mux_mmc | |
89 | * Description: setup the MMC muxes, power rails, etc. | |
90 | */ | |
91 | void pin_mux_mmc(void) | |
92 | { | |
93 | /* | |
94 | * NOTE: We don't do mmc-specific pin muxes here. | |
95 | * They were done globally in pinmux_init(). | |
96 | */ | |
97 | ||
98 | /* Bring up the SDIO3 power rail */ | |
99 | board_sdmmc_voltage_init(); | |
100 | } | |
101 | #endif /* MMC */ |