Add qemu 2.4.0
[kvmfornfv.git] / qemu / roms / u-boot / board / nvidia / whistler / whistler.c
1 /*
2  *  (C) Copyright 2010-2012
3  *  NVIDIA Corporation <www.nvidia.com>
4  *
5  * SPDX-License-Identifier:     GPL-2.0+
6  */
7
8 #include <common.h>
9 #include <asm/io.h>
10 #include <asm/arch/tegra.h>
11 #include <asm/arch/clock.h>
12 #include <asm/arch/funcmux.h>
13 #include <asm/arch/pinmux.h>
14 #include <asm/gpio.h>
15 #include <i2c.h>
16
17 #ifdef CONFIG_TEGRA_MMC
18 /*
19  * Routine: pin_mux_mmc
20  * Description: setup the pin muxes/tristate values for the SDMMC(s)
21  */
22 void pin_mux_mmc(void)
23 {
24         uchar val;
25         int ret;
26
27         /* Turn on MAX8907B LDO12 to 2.8V for J40 power */
28         ret = i2c_set_bus_num(0);
29         if (ret)
30                 printf("i2c_set_bus_num failed: %d\n", ret);
31         val = 0x29;
32         ret = i2c_write(0x3c, 0x46, 1, &val, 1);
33         if (ret)
34                 printf("i2c_write 0 0x3c 0x46 failed: %d\n", ret);
35         val = 0x00;
36         ret = i2c_write(0x3c, 0x45, 1, &val, 1);
37         if (ret)
38                 printf("i2c_write 0 0x3c 0x45 failed: %d\n", ret);
39         val = 0x1f;
40         ret = i2c_write(0x3c, 0x44, 1, &val, 1);
41         if (ret)
42                 printf("i2c_write 0 0x3c 0x44 failed: %d\n", ret);
43
44         funcmux_select(PERIPH_ID_SDMMC3, FUNCMUX_SDMMC3_SDB_SLXA_8BIT);
45         funcmux_select(PERIPH_ID_SDMMC4, FUNCMUX_SDMMC4_ATC_ATD_8BIT);
46 }
47 #endif
48
49 /* this is a weak define that we are overriding */
50 void pin_mux_usb(void)
51 {
52         uchar val;
53         int ret;
54
55         /*
56          * This is a hack. This should be represented in DT using the
57          * vbus-gpio property. However, U-Boot's DT support doesn't
58          * support any GPIO controller other than the Tegra's yet.
59          */
60
61         /* Turn on TAC6416's GPIO 0+1 for USB1/3's VBUS */
62         ret = i2c_set_bus_num(0);
63         if (ret)
64                 printf("i2c_set_bus_num failed: %d\n", ret);
65         val = 0x03;
66         ret = i2c_write(0x20, 2, 1, &val, 1);
67         if (ret)
68                 printf("i2c_write 0 0x20 2 failed: %d\n", ret);
69         val = 0xfc;
70         ret = i2c_write(0x20, 6, 1, &val, 1);
71         if (ret)
72                 printf("i2c_write 0 0x20 6 failed: %d\n", ret);
73 }