From 8315622ff1bd898d839144abf0310524a35f8e1a Mon Sep 17 00:00:00 2001 From: Tom Warren Date: Thu, 13 Nov 2014 13:16:28 -0700 Subject: google/rush: Add I2C1 init and audio clock enable/resets This should allow the max98090 codec to play beeps via AHUB/I2S1 thru the depthcharge sound driver. BUG=none BRANCH=none TEST=Saw max98090 codec init signon and register dump. No sound yet. Change-Id: I1ee0b61f5cbfe587ebd16b7dd9dce08d9d62c2c5 Signed-off-by: Patrick Georgi Original-Commit-Id: f4ee2ce3704711a9e00531b7599a1bcf194203ec Original-Change-Id: I0bc8401e76b2c80a01083ac933a39f6cd4d1b78a Original-Signed-off-by: Tom Warren Original-Reviewed-on: https://chromium-review.googlesource.com/229496 Original-Reviewed-by: Aaron Durbin Original-Commit-Queue: Mike Frysinger Reviewed-on: http://review.coreboot.org/9429 Tested-by: build bot (Jenkins) Reviewed-by: Stefan Reinauer --- src/mainboard/google/rush/mainboard.c | 41 ++++++++++++++++++++++++++++++++--- 1 file changed, 38 insertions(+), 3 deletions(-) (limited to 'src/mainboard/google/rush') diff --git a/src/mainboard/google/rush/mainboard.c b/src/mainboard/google/rush/mainboard.c index 8ea3f4eb3d..bb4da19154 100644 --- a/src/mainboard/google/rush/mainboard.c +++ b/src/mainboard/google/rush/mainboard.c @@ -25,6 +25,7 @@ #include #include #include +#include #include #include #include @@ -67,9 +68,16 @@ static const struct pad_config padcfgs[] = { PAD_CFG_GPIO_INPUT(USB_VBUS_EN1, PINMUX_PULL_UP), }; +static const struct pad_config i2c1_pad[] = { + /* GEN1 I2C */ + PAD_CFG_SFIO(GEN1_I2C_SCL, PINMUX_INPUT_ENABLE, I2C1), + PAD_CFG_SFIO(GEN1_I2C_SDA, PINMUX_INPUT_ENABLE, I2C1), +}; + static const struct funit_cfg funitcfgs[] = { FUNIT_CFG(SDMMC3, PLLP, 48000, sdmmc3_pad, ARRAY_SIZE(sdmmc3_pad)), FUNIT_CFG(SDMMC4, PLLP, 48000, sdmmc4_pad, ARRAY_SIZE(sdmmc4_pad)), + FUNIT_CFG(I2C1, PLLP, 100, i2c1_pad, ARRAY_SIZE(i2c1_pad)), }; static void setup_ec_spi(void) @@ -87,6 +95,30 @@ static void setup_usb(void) usb_setup_utmip((void *)TEGRA_USB3_BASE); } +/* Audio init: clocks and enables/resets */ +static void setup_audio(void) +{ + /* External peripheral 1: audio codec (max98090) using 12MHz CLK1 */ + clock_configure_source(extperiph1, CLK_M, 12000); + + /* + * We need 1.5MHz for I2S1. So, we use CLK_M. CLK_DIVIDER macro + * returns a divisor (0xe) a little bit off from the ideal value (0xd), + * but it's good enough for beeps. + */ + clock_configure_source(i2s1, CLK_M, 1500); + + clock_external_output(1); /* For external MAX98090 audio codec. */ + + /* + * Confirmed by NVIDIA hardware team, we need to take ALL audio devices + * connected to AHUB (AUDIO, APBIF, I2S, DAM, AMX, ADX, SPDIF, AFC) out + * of reset and clock-enabled, otherwise reading AHUB devices (in our + * case, I2S/APBIF/AUDIO) will hang. + */ + clock_enable_audio(); +} + static void mainboard_init(device_t dev) { soc_configure_pads(padcfgs, ARRAY_SIZE(padcfgs)); @@ -94,14 +126,17 @@ static void mainboard_init(device_t dev) setup_ec_spi(); setup_usb(); + + setup_audio(); + i2c_init(I2C1_BUS); /* for max98090 codec */ } static void mainboard_enable(device_t dev) { - dev->ops->init = &mainboard_init; + dev->ops->init = &mainboard_init; } struct chip_operations mainboard_ops = { - .name = "rush", - .enable_dev = mainboard_enable, + .name = "rush", + .enable_dev = mainboard_enable, }; -- cgit v1.2.3