Stephen Warren | 2791a0c | 2012-05-15 06:45:28 +0000 | [diff] [blame] | 1 | /* |
| 2 | * (C) Copyright 2010-2012 |
| 3 | * NVIDIA Corporation <www.nvidia.com> |
| 4 | * |
| 5 | * See file CREDITS for list of people who contributed to this |
| 6 | * project. |
| 7 | * |
| 8 | * This program is free software; you can redistribute it and/or |
| 9 | * modify it under the terms of the GNU General Public License as |
| 10 | * published by the Free Software Foundation; either version 2 of |
| 11 | * the License, or (at your option) any later version. |
| 12 | * |
| 13 | * This program is distributed in the hope that it will be useful, |
| 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 16 | * GNU General Public License for more details. |
| 17 | * |
| 18 | * You should have received a copy of the GNU General Public License |
| 19 | * along with this program; if not, write to the Free Software |
| 20 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, |
| 21 | * MA 02111-1307 USA |
| 22 | */ |
| 23 | |
| 24 | #include <common.h> |
Stephen Warren | 2791a0c | 2012-05-15 06:45:28 +0000 | [diff] [blame] | 25 | #include <asm/io.h> |
Tom Warren | ab37196 | 2012-09-19 15:50:56 -0700 | [diff] [blame] | 26 | #include <asm/arch/tegra.h> |
Stephen Warren | 2791a0c | 2012-05-15 06:45:28 +0000 | [diff] [blame] | 27 | #include <asm/arch/clock.h> |
| 28 | #include <asm/arch/funcmux.h> |
| 29 | #include <asm/arch/pinmux.h> |
Stephen Warren | 2791a0c | 2012-05-15 06:45:28 +0000 | [diff] [blame] | 30 | #include <asm/gpio.h> |
Tom Warren | ab37196 | 2012-09-19 15:50:56 -0700 | [diff] [blame] | 31 | #include <i2c.h> |
Stephen Warren | 2791a0c | 2012-05-15 06:45:28 +0000 | [diff] [blame] | 32 | |
Tom Warren | 9745cf8 | 2013-02-21 12:31:30 +0000 | [diff] [blame] | 33 | #ifdef CONFIG_TEGRA_MMC |
Stephen Warren | 2791a0c | 2012-05-15 06:45:28 +0000 | [diff] [blame] | 34 | /* |
| 35 | * Routine: pin_mux_mmc |
| 36 | * Description: setup the pin muxes/tristate values for the SDMMC(s) |
| 37 | */ |
Tom Warren | 9745cf8 | 2013-02-21 12:31:30 +0000 | [diff] [blame] | 38 | void pin_mux_mmc(void) |
Stephen Warren | 2791a0c | 2012-05-15 06:45:28 +0000 | [diff] [blame] | 39 | { |
| 40 | uchar val; |
| 41 | int ret; |
| 42 | |
Stephen Warren | 2791a0c | 2012-05-15 06:45:28 +0000 | [diff] [blame] | 43 | /* Turn on MAX8907B LDO12 to 2.8V for J40 power */ |
| 44 | ret = i2c_set_bus_num(0); |
| 45 | if (ret) |
| 46 | printf("i2c_set_bus_num failed: %d\n", ret); |
| 47 | val = 0x29; |
| 48 | ret = i2c_write(0x3c, 0x46, 1, &val, 1); |
| 49 | if (ret) |
| 50 | printf("i2c_write 0 0x3c 0x46 failed: %d\n", ret); |
| 51 | val = 0x00; |
| 52 | ret = i2c_write(0x3c, 0x45, 1, &val, 1); |
| 53 | if (ret) |
| 54 | printf("i2c_write 0 0x3c 0x45 failed: %d\n", ret); |
| 55 | val = 0x1f; |
| 56 | ret = i2c_write(0x3c, 0x44, 1, &val, 1); |
| 57 | if (ret) |
| 58 | printf("i2c_write 0 0x3c 0x44 failed: %d\n", ret); |
| 59 | |
Tom Warren | 9745cf8 | 2013-02-21 12:31:30 +0000 | [diff] [blame] | 60 | funcmux_select(PERIPH_ID_SDMMC3, FUNCMUX_SDMMC3_SDB_SLXA_8BIT); |
| 61 | funcmux_select(PERIPH_ID_SDMMC4, FUNCMUX_SDMMC4_ATC_ATD_8BIT); |
Stephen Warren | 2791a0c | 2012-05-15 06:45:28 +0000 | [diff] [blame] | 62 | } |
Tom Warren | 9745cf8 | 2013-02-21 12:31:30 +0000 | [diff] [blame] | 63 | #endif |
Stephen Warren | 2791a0c | 2012-05-15 06:45:28 +0000 | [diff] [blame] | 64 | |
| 65 | /* this is a weak define that we are overriding */ |
| 66 | void pin_mux_usb(void) |
| 67 | { |
| 68 | uchar val; |
| 69 | int ret; |
| 70 | |
| 71 | /* |
| 72 | * This is a hack. This should be represented in DT using the |
| 73 | * vbus-gpio property. However, U-Boot's DT support doesn't |
| 74 | * support any GPIO controller other than the Tegra's yet. |
| 75 | */ |
| 76 | |
| 77 | /* Turn on TAC6416's GPIO 0+1 for USB1/3's VBUS */ |
| 78 | ret = i2c_set_bus_num(0); |
| 79 | if (ret) |
| 80 | printf("i2c_set_bus_num failed: %d\n", ret); |
| 81 | val = 0x03; |
| 82 | ret = i2c_write(0x20, 2, 1, &val, 1); |
| 83 | if (ret) |
| 84 | printf("i2c_write 0 0x20 2 failed: %d\n", ret); |
| 85 | val = 0xfc; |
| 86 | ret = i2c_write(0x20, 6, 1, &val, 1); |
| 87 | if (ret) |
| 88 | printf("i2c_write 0 0x20 6 failed: %d\n", ret); |
| 89 | } |