| 1 |
|
| 2 |
|
| 3 |
#include <gpio.h> |
| 4 |
#include <soc/addressmap.h> |
| 5 |
#include <soc/clock.h> |
| 6 |
#include <soc/early_configs.h> |
| 7 |
#include <soc/nvidia/tegra/i2c.h> |
| 8 |
|
| 9 |
static struct clk_rst_ctlr *clk_rst = (void *)TEGRA_CLK_RST_BASE; |
| 10 |
|
| 11 |
static void setup_pinmux(void) |
| 12 |
{ |
| 13 |
|
| 14 |
gpio_input_pullup(GPIO(R1)); |
| 15 |
|
| 16 |
gpio_input_pullup(GPIO(Q7)); |
| 17 |
|
| 18 |
gpio_input_pullup(GPIO(R4)); |
| 19 |
|
| 20 |
gpio_input_pullup(GPIO(Q0)); |
| 21 |
|
| 22 |
gpio_input_pullup(GPIO(Q6)); |
| 23 |
|
| 24 |
gpio_input_pullup(GPIO(U4)); |
| 25 |
|
| 26 |
|
| 27 |
pinmux_set_config(PINMUX_GPIO_PU4_INDEX, |
| 28 |
PINMUX_GPIO_PU4_FUNC_NOR); |
| 29 |
pinmux_set_config(PINMUX_GPIO_PU5_INDEX, |
| 30 |
PINMUX_GPIO_PU5_FUNC_NOR); |
| 31 |
|
| 32 |
|
| 33 |
gpio_output(GPIO(I5), 1); |
| 34 |
|
| 35 |
|
| 36 |
pinmux_set_config(PINMUX_ULPI_CLK_INDEX, PINMUX_ULPI_CLK_FUNC_SPI1 | |
| 37 |
PINMUX_PULL_NONE | |
| 38 |
PINMUX_INPUT_ENABLE); |
| 39 |
|
| 40 |
pinmux_set_config(PINMUX_ULPI_DIR_INDEX, PINMUX_ULPI_DIR_FUNC_SPI1 | |
| 41 |
PINMUX_PULL_NONE | |
| 42 |
PINMUX_INPUT_ENABLE); |
| 43 |
|
| 44 |
pinmux_set_config(PINMUX_ULPI_NXT_INDEX, PINMUX_ULPI_NXT_FUNC_SPI1 | |
| 45 |
PINMUX_PULL_NONE | |
| 46 |
PINMUX_INPUT_ENABLE); |
| 47 |
|
| 48 |
pinmux_set_config(PINMUX_ULPI_STP_INDEX, PINMUX_ULPI_STP_FUNC_SPI1 | |
| 49 |
PINMUX_PULL_NONE | |
| 50 |
PINMUX_INPUT_ENABLE); |
| 51 |
|
| 52 |
|
| 53 |
pinmux_set_config(PINMUX_CAM_I2C_SCL_INDEX, |
| 54 |
PINMUX_CAM_I2C_SCL_FUNC_I2C3 | PINMUX_INPUT_ENABLE); |
| 55 |
|
| 56 |
pinmux_set_config(PINMUX_CAM_I2C_SDA_INDEX, |
| 57 |
PINMUX_CAM_I2C_SDA_FUNC_I2C3 | PINMUX_INPUT_ENABLE); |
| 58 |
|
| 59 |
|
| 60 |
gpio_set_mode(GPIO(X3), GPIO_MODE_GPIO); |
| 61 |
gpio_set_mode(GPIO(X4), GPIO_MODE_GPIO); |
| 62 |
gpio_set_mode(GPIO(X5), GPIO_MODE_GPIO); |
| 63 |
gpio_set_mode(GPIO(X6), GPIO_MODE_GPIO); |
| 64 |
gpio_set_mode(GPIO(X7), GPIO_MODE_GPIO); |
| 65 |
gpio_set_mode(GPIO(W3), GPIO_MODE_GPIO); |
| 66 |
} |
| 67 |
|
| 68 |
static void configure_ec_spi_bus(void) |
| 69 |
{ |
| 70 |
clock_configure_source(sbc1, CLK_M, 3000); |
| 71 |
} |
| 72 |
|
| 73 |
static void configure_tpm_i2c_bus(void) |
| 74 |
{ |
| 75 |
clock_configure_i2c_scl_freq(i2c3, PLLP, 400); |
| 76 |
|
| 77 |
i2c_init(2); |
| 78 |
} |
| 79 |
|
| 80 |
void early_mainboard_init(void) |
| 81 |
{ |
| 82 |
clock_enable_clear_reset(0, CLK_H_SBC1, CLK_U_I2C3, 0, 0, 0); |
| 83 |
setup_pinmux(); |
| 84 |
configure_ec_spi_bus(); |
| 85 |
configure_tpm_i2c_bus(); |
| 86 |
} |