#include <soc/padconfig.h> #include <soc/verstage.h> #include <soc/nvidia/tegra/i2c.h> static const struct pad_config i2cpad[] = { /* TPM I2C */ PAD_CFG_SFIO(CAM_I2C_SCL, PINMUX_INPUT_ENABLE, I2C3), PAD_CFG_SFIO(CAM_I2C_SDA, PINMUX_INPUT_ENABLE, I2C3), }; static const struct pad_config spipad[] = { /* EC on SPI1: mosi, miso, clk, cs */ PAD_CFG_SFIO(ULPI_CLK, PINMUX_INPUT_ENABLE, SPI1), PAD_CFG_SFIO(ULPI_DIR, PINMUX_INPUT_ENABLE, SPI1), PAD_CFG_SFIO(ULPI_NXT, PINMUX_INPUT_ENABLE, SPI1), PAD_CFG_SFIO(ULPI_STP, PINMUX_INPUT_ENABLE, SPI1), }; static const struct funit_cfg funitcfgs[] = { FUNIT_CFG(SBC1, CLK_M, 3000, spipad, ARRAY_SIZE(spipad)), FUNIT_CFG(I2C3, PLLP, 400, i2cpad, ARRAY_SIZE(i2cpad)), }; void verstage_mainboard_init(void) { soc_configure_funits(funitcfgs, ARRAY_SIZE(funitcfgs)); /* TPM I2C bus */ i2c_init(2); }
static const struct pad_config pmic_pads[] = { PAD_CFG_SFIO(PWR_I2C_SCL, PINMUX_INPUT_ENABLE, I2CPMU), PAD_CFG_SFIO(PWR_I2C_SDA, PINMUX_INPUT_ENABLE, I2CPMU), }; static const struct pad_config spiflash_pads[] = { /* mosi, miso, clk, cs0 */ PAD_CFG_SFIO(GPIO_PG6, PINMUX_INPUT_ENABLE | PINMUX_PULL_UP, SPI4), PAD_CFG_SFIO(GPIO_PG7, PINMUX_INPUT_ENABLE | PINMUX_PULL_UP, SPI4), PAD_CFG_SFIO(GPIO_PG5, PINMUX_INPUT_ENABLE, SPI4), PAD_CFG_SFIO(GPIO_PI3, PINMUX_INPUT_ENABLE, SPI4), }; static const struct funit_cfg funits[] = { /* PMIC on I2C5 (PWR_I2C* pads) at 400kHz. */ FUNIT_CFG(I2C5, PLLP, 400, pmic_pads, ARRAY_SIZE(pmic_pads)), /* SPI flash at 33MHz on SPI4 controller. */ FUNIT_CFG(SBC4, PLLP, 33333, spiflash_pads, ARRAY_SIZE(spiflash_pads)), }; void bootblock_mainboard_early_init(void) { soc_configure_pads(uart_console_pads, ARRAY_SIZE(uart_console_pads)); } static void set_clock_sources(void) { /* UARTA gets PLLP, deactivate CLK_UART_DIV_OVERRIDE */ write32(CLK_RST_REG(clk_src_uarta), PLLP << CLK_SOURCE_SHIFT); }
#include <soc/nvidia/tegra/i2c.h> #include "gpio.h" #include "pmic.h" static const struct pad_config tpm_pads[] = { PAD_CFG_SFIO(CAM_I2C_SCL, PINMUX_INPUT_ENABLE, I2C3), PAD_CFG_SFIO(CAM_I2C_SDA, PINMUX_INPUT_ENABLE, I2C3), }; static const struct pad_config ec_i2c_pads[] = { PAD_CFG_SFIO(GEN2_I2C_SCL, PINMUX_OPEN_DRAIN|PINMUX_INPUT_ENABLE, I2C2), PAD_CFG_SFIO(GEN2_I2C_SDA, PINMUX_OPEN_DRAIN|PINMUX_INPUT_ENABLE, I2C2), }; static const struct funit_cfg funits[] = { /* TPM on I2C3 @ 400kHz */ FUNIT_CFG(I2C3, PLLP, 400, tpm_pads, ARRAY_SIZE(tpm_pads)), /* EC on I2C2 - pulled to 3.3V @ 100kHz */ FUNIT_CFG(I2C2, PLLP, 100, ec_i2c_pads, ARRAY_SIZE(ec_i2c_pads)), }; void verstage_mainboard_init(void) { soc_configure_funits(funits, ARRAY_SIZE(funits)); /* TPM */ i2c_init(I2C3_BUS); /* EC */ i2c_init(I2C2_BUS); }
static const struct pad_config i2cpad[] = { /* PMIC i2C bus */ PAD_CFG_SFIO(PWR_I2C_SCL, PINMUX_INPUT_ENABLE, I2CPMU), PAD_CFG_SFIO(PWR_I2C_SDA, PINMUX_INPUT_ENABLE, I2CPMU), }; static const struct pad_config spipad[] = { /* SPI fLash: mosi, miso, clk, cs0 */ PAD_CFG_SFIO(GPIO_PG6, PINMUX_INPUT_ENABLE | PINMUX_PULL_UP, SPI4), PAD_CFG_SFIO(GPIO_PG7, PINMUX_INPUT_ENABLE | PINMUX_PULL_UP, SPI4), PAD_CFG_SFIO(GPIO_PG5, PINMUX_INPUT_ENABLE, SPI4), PAD_CFG_SFIO(GPIO_PI3, PINMUX_INPUT_ENABLE, SPI4), }; static const struct funit_cfg funitcfgs[] = { FUNIT_CFG(I2C5, PLLP, 400, i2cpad, ARRAY_SIZE(i2cpad)), FUNIT_CFG(SBC4, PLLP, 33333, spipad, ARRAY_SIZE(spipad)), }; void bootblock_mainboard_early_init(void) { soc_configure_pads(uart_console_pads, ARRAY_SIZE(uart_console_pads)); } static void set_clock_sources(void) { /* UARTA gets PLLP, deactivate CLK_UART_DIV_OVERRIDE */ write32(CLK_RST_REG(clk_src_uarta), PLLP << CLK_SOURCE_SHIFT); } void bootblock_mainboard_init(void)
PAD_CFG_SFIO(GEN1_I2C_SDA, PINMUX_INPUT_ENABLE, I2C1), }; static const struct pad_config i2s1_pad[] = { /* I2S1 */ PAD_CFG_SFIO(DAP1_SCLK, PINMUX_INPUT_ENABLE, I2S1), PAD_CFG_SFIO(DAP1_FS, PINMUX_INPUT_ENABLE, I2S1), PAD_CFG_SFIO(DAP1_DOUT, PINMUX_INPUT_ENABLE, I2S1), PAD_CFG_SFIO(DAP1_DIN, PINMUX_INPUT_ENABLE | PINMUX_TRISTATE, I2S1), /* codec MCLK via AUD SFIO */ PAD_CFG_SFIO(AUD_MCLK, PINMUX_PULL_NONE, AUD), }; static const struct funit_cfg audio_funit[] = { /* We need 1.5MHz for I2S1. So we use CLK_M */ FUNIT_CFG(I2S1, CLK_M, 1500, i2s1_pad, ARRAY_SIZE(i2s1_pad)), }; static const struct funit_cfg funitcfgs[] = { FUNIT_CFG(SDMMC1, PLLP, 48000, sdmmc1_pad, ARRAY_SIZE(sdmmc1_pad)), FUNIT_CFG(SDMMC4, PLLP, 48000, NULL, 0), FUNIT_CFG(I2C1, PLLP, 100, i2c1_pad, ARRAY_SIZE(i2c1_pad)), FUNIT_CFG_USB(USBD), }; /* Audio init: clocks and enables/resets */ static void setup_audio(void) { /* Audio codec (ES755) uses OSC freq (via AUD_MCLK), s/b 38.4MHz */ soc_configure_funits(audio_funit, ARRAY_SIZE(audio_funit));
PAD_CFG_SFIO(QSPI_IO1, PINMUX_INPUT_ENABLE | PINMUX_PULL_UP, QSPI), PAD_CFG_SFIO(QSPI_SCK, PINMUX_INPUT_ENABLE, QSPI), PAD_CFG_SFIO(QSPI_CS_N, PINMUX_INPUT_ENABLE, QSPI), PAD_CFG_SFIO(QSPI_IO2, PINMUX_INPUT_ENABLE | PINMUX_PULL_UP, QSPI), PAD_CFG_SFIO(QSPI_IO3, PINMUX_INPUT_ENABLE | PINMUX_PULL_UP, QSPI), }; /********************* TPM ************************************/ static const struct pad_config tpm_pads[] = { PAD_CFG_SFIO(GEN3_I2C_SCL, PINMUX_INPUT_ENABLE, I2C3), PAD_CFG_SFIO(GEN3_I2C_SDA, PINMUX_INPUT_ENABLE, I2C3), }; static const struct funit_cfg funits[] = { /* PMIC on I2C5 (PWR_I2C* pads) at 400kHz. */ FUNIT_CFG(I2C5, PLLP, 400, pmic_pads, ARRAY_SIZE(pmic_pads)), /* SPI flash at 24MHz on QSPI controller. */ FUNIT_CFG(QSPI, PLLP, 24000, spiflash_pads, ARRAY_SIZE(spiflash_pads)), /* Foster has no TPM yet. This is for futurn TPM on I2C3 @ 400kHz. */ FUNIT_CFG(I2C3, PLLP, 400, tpm_pads, ARRAY_SIZE(tpm_pads)), }; static const struct pad_config uart_console_pads[] = { /* UARTA: tx, rx, rts, cts */ PAD_CFG_SFIO(UART1_TX, PINMUX_PULL_NONE, UARTA), PAD_CFG_SFIO(UART1_RX, PINMUX_INPUT_ENABLE | PINMUX_PULL_UP, UARTA), PAD_CFG_SFIO(UART1_RTS, PINMUX_PULL_UP, UARTA), PAD_CFG_SFIO(UART1_CTS, PINMUX_PULL_UP, UARTA), }; void bootblock_mainboard_early_init(void)
PAD_CFG_SFIO(SDMMC4_DAT3, PINMUX_INPUT_ENABLE|PINMUX_PULL_UP, SDMMC4), PAD_CFG_SFIO(SDMMC4_DAT4, PINMUX_INPUT_ENABLE|PINMUX_PULL_UP, SDMMC4), PAD_CFG_SFIO(SDMMC4_DAT5, PINMUX_INPUT_ENABLE|PINMUX_PULL_UP, SDMMC4), PAD_CFG_SFIO(SDMMC4_DAT6, PINMUX_INPUT_ENABLE|PINMUX_PULL_UP, SDMMC4), PAD_CFG_SFIO(SDMMC4_DAT7, PINMUX_INPUT_ENABLE|PINMUX_PULL_UP, SDMMC4), }; static const struct pad_config audio_codec_pads[] = { /* H1 is CODEC_RST_L and R2(ROW2) is AUDIO_ENABLE */ PAD_CFG_GPIO_OUT1(GPIO_PH1, PINMUX_PULL_DOWN), PAD_CFG_GPIO_OUT1(KB_ROW2, PINMUX_PULL_DOWN), }; static const struct funit_cfg funits[] = { /* MMC on SDMMC4 controller at 48MHz. */ FUNIT_CFG(SDMMC4, PLLP, 48000, mmcpads, ARRAY_SIZE(mmcpads)), /* I2C6 for audio, temp sensor, etc. Enable codec via GPIOs/muxes */ FUNIT_CFG(I2C6, PLLP, 400, audio_codec_pads, ARRAY_SIZE(audio_codec_pads)), FUNIT_CFG_USB(USBD), }; /* HACK: For proto boards before proto3, we want to disable ec sw sync */ static void fix_ec_sw_sync(void) { #if IS_ENABLED(CONFIG_CHROMEOS) struct vboot_handoff *vh; if (board_id() >= BOARD_ID_PROTO_3) return; vh = cbmem_find(CBMEM_ID_VBOOT_HANDOFF);
PAD_CFG_SFIO(GEN1_I2C_SDA, PINMUX_INPUT_ENABLE, I2C1), }; static const struct pad_config i2s1_pad[] = { /* I2S1 */ PAD_CFG_SFIO(DAP1_SCLK, PINMUX_INPUT_ENABLE, I2S1), PAD_CFG_SFIO(DAP1_FS, PINMUX_INPUT_ENABLE, I2S1), PAD_CFG_SFIO(DAP1_DOUT, PINMUX_INPUT_ENABLE, I2S1), PAD_CFG_SFIO(DAP1_DIN, PINMUX_INPUT_ENABLE | PINMUX_TRISTATE, I2S1), /* codec MCLK via AUD SFIO */ PAD_CFG_SFIO(AUD_MCLK, PINMUX_PULL_NONE, AUD), }; static const struct funit_cfg audio_funit[] = { /* We need 1.5MHz for I2S1. So we use CLK_M */ FUNIT_CFG(I2S1, CLK_M, 1500, i2s1_pad, ARRAY_SIZE(i2s1_pad)), }; static const struct funit_cfg funitcfgs[] = { FUNIT_CFG(SDMMC1, PLLP, 48000, sdmmc1_pad, ARRAY_SIZE(sdmmc1_pad)), FUNIT_CFG(SDMMC4, PLLP, 48000, NULL, 0), FUNIT_CFG(I2C1, PLLP, 100, i2c1_pad, ARRAY_SIZE(i2c1_pad)), FUNIT_CFG(I2C6, PLLP, 400, audio_codec_pads, ARRAY_SIZE(audio_codec_pads)), FUNIT_CFG_USB(USBD), }; /* Audio init: clocks and enables/resets */ static void setup_audio(void) { /* Audio codec (ES755) uses OSC freq (via AUD_MCLK), s/b 38.4MHz */ soc_configure_funits(audio_funit, ARRAY_SIZE(audio_funit));