1
2
3
4
5
6
7
8#include <common.h>
9#include <asm/arch/gp_padctrl.h>
10#include <asm/arch/pinmux.h>
11#include <asm/arch-tegra/ap.h>
12#include <asm/arch-tegra/tegra.h>
13#include <asm/gpio.h>
14#include <asm/io.h>
15#include <dm.h>
16#include <i2c.h>
17
18#include "pinmux-config-apalis_t30.h"
19
20#define PMU_I2C_ADDRESS 0x2D
21#define MAX_I2C_RETRY 3
22
23int arch_misc_init(void)
24{
25 if (readl(NV_PA_BASE_SRAM + NVBOOTINFOTABLE_BOOTTYPE) ==
26 NVBOOTTYPE_RECOVERY)
27 printf("USB recovery mode\n");
28
29 return 0;
30}
31
32
33
34
35
36void pinmux_init(void)
37{
38 pinmux_config_pingrp_table(tegra3_pinmux_common,
39 ARRAY_SIZE(tegra3_pinmux_common));
40
41 pinmux_config_pingrp_table(unused_pins_lowpower,
42 ARRAY_SIZE(unused_pins_lowpower));
43
44
45 pinmux_config_drvgrp_table(apalis_t30_padctrl,
46 ARRAY_SIZE(apalis_t30_padctrl));
47}
48
49#ifdef CONFIG_PCI_TEGRA
50int tegra_pcie_board_init(void)
51{
52 struct udevice *dev;
53 u8 addr, data[1];
54 int err;
55
56 err = i2c_get_chip_for_busnum(0, PMU_I2C_ADDRESS, 1, &dev);
57 if (err) {
58 debug("%s: Cannot find PMIC I2C chip\n", __func__);
59 return err;
60 }
61
62
63 data[0] = 0x27;
64 addr = 0x25;
65
66 err = dm_i2c_write(dev, addr, data, 1);
67 if (err) {
68 debug("failed to set VDD supply\n");
69 return err;
70 }
71
72
73 data[0] = 0x0D;
74 addr = 0x24;
75
76 err = dm_i2c_write(dev, addr, data, 1);
77 if (err) {
78 debug("failed to enable VDD supply\n");
79 return err;
80 }
81
82
83 data[0] = 0x0D;
84 addr = 0x35;
85
86 err = dm_i2c_write(dev, addr, data, 1);
87 if (err) {
88 debug("failed to set AVDD supply\n");
89 return err;
90 }
91
92 return 0;
93}
94#endif
95