1
2
3
4
5
6
7#include <common.h>
8#include <dm.h>
9#include <log.h>
10#include <asm/arch/pinmux.h>
11#include <asm/arch/gp_padctrl.h>
12#include <asm/arch/gpio.h>
13#include <asm/gpio.h>
14#include "pinmux-config-tamonten-ng.h"
15#include <i2c.h>
16
17#define PMU_I2C_ADDRESS 0x2D
18
19#define PMU_REG_LDO5 0x32
20
21#define PMU_REG_LDO_HIGH_POWER 1
22
23
24#define PMU_REG_LDO_SEL_100(mV) ((((mV - 1000) / 100) + 2) << 2)
25
26#define PMU_REG_LDO_100(st, mV) (PMU_REG_LDO_##st | PMU_REG_LDO_SEL_100(mV))
27
28#define PMU_LDO5(st, mV) PMU_REG_LDO_100(st, mV)
29
30void pinmux_init(void)
31{
32 pinmux_config_pingrp_table(tamonten_ng_pinmux_common,
33 ARRAY_SIZE(tamonten_ng_pinmux_common));
34 pinmux_config_pingrp_table(unused_pins_lowpower,
35 ARRAY_SIZE(unused_pins_lowpower));
36
37
38 pinmux_config_drvgrp_table(tamonten_ng_padctrl,
39 ARRAY_SIZE(tamonten_ng_padctrl));
40}
41
42void gpio_early_init(void)
43{
44
45 gpio_request(TEGRA_GPIO(V, 2), "ALIVE");
46 gpio_direction_output(TEGRA_GPIO(V, 2), 1);
47
48
49 gpio_request(TEGRA_GPIO(I, 4), "nRST_PERIPH");
50 gpio_direction_output(TEGRA_GPIO(I, 4), 1);
51}
52
53void pmu_write(uchar reg, uchar data)
54{
55 struct udevice *dev;
56 int ret;
57
58 ret = i2c_get_chip_for_busnum(4, PMU_I2C_ADDRESS, 1, &dev);
59 if (ret) {
60 debug("%s: Cannot find PMIC I2C chip\n", __func__);
61 return;
62 }
63 dm_i2c_write(dev, reg, &data, 1);
64}
65
66
67
68
69
70void board_sdmmc_voltage_init(void)
71{
72
73 pmu_write(PMU_REG_LDO5, PMU_LDO5(HIGH_POWER, 3300));
74
75
76 gpio_request(TEGRA_GPIO(J, 2), "EN_3V3_EMMC");
77 gpio_direction_output(TEGRA_GPIO(J, 2), 1);
78}
79
80
81
82
83
84void pin_mux_mmc(void)
85{
86
87
88
89
90
91
92 board_sdmmc_voltage_init();
93}
94