From 316ded82f5f9b51333e96cd1d002e60a6c8ce8c7 Mon Sep 17 00:00:00 2001 From: "henryc.chen" Date: Fri, 11 Mar 2016 14:55:30 +0800 Subject: [PATCH] google/oak: Move external buck initialization to coreboot Remove the code which is passing parameters to ARMTF and move external buck initilizaton from ARMTF to coreboot. BRANCH=none BUG=none TEST=verified on Oak rev4/rev5 Change-Id: I4f4b30acbee9b42a202b326f2fe4517cb4b9d83c Signed-off-by: Patrick Georgi Original-Commit-Id: 37bec54b4d8a3bce38878e292e4821da3959026a Original-Change-Id: Ib81709812a064f6daf13c9b4d6525f1858c81393 Original-Signed-off-by: henryc.chen Original-Reviewed-on: https://chromium-review.googlesource.com/332343 Original-Commit-Ready: Yidi Lin Original-Tested-by: Yidi Lin Original-Reviewed-by: Julius Werner Reviewed-on: https://review.coreboot.org/14123 Tested-by: build bot (Jenkins) Reviewed-by: Stefan Reinauer --- src/mainboard/google/oak/mainboard.c | 72 +++++++--------------------- 1 file changed, 18 insertions(+), 54 deletions(-) diff --git a/src/mainboard/google/oak/mainboard.c b/src/mainboard/google/oak/mainboard.c index 192f4b3132..4208730d67 100644 --- a/src/mainboard/google/oak/mainboard.c +++ b/src/mainboard/google/oak/mainboard.c @@ -22,8 +22,9 @@ #include #include -#include +#include #include +#include #include #include #include @@ -31,67 +32,30 @@ #include #include -static void register_da9212_to_bl31(void) +enum { + CODEC_I2C_BUS = 0, + EXT_BUCK_I2C_BUS = 1, +}; + +static void configure_ext_buck(void) { -#if IS_ENABLED(CONFIG_ARM64_USE_ARM_TRUSTED_FIRMWARE) - static struct bl31_da9212_param param_da9212 = { - .h = { - .type = PARAM_CLUSTER1_DA9212, - }, - .i2c_bus = 1, - .ic_en = { - .type = PARAM_GPIO_MT6391, - .polarity = PARAM_GPIO_ACTIVE_HIGH, - .index = MT6391_KP_ROW3, - }, - .en_a = { - .type = PARAM_GPIO_MT6391, - .polarity = PARAM_GPIO_ACTIVE_HIGH, - .index = MT6391_KP_ROW4, - }, - .en_b = { - .type = PARAM_GPIO_NONE, - }, - }; - if (board_id() == 2) { - param_da9212.ic_en.type = PARAM_GPIO_SOC; - param_da9212.ic_en.index = PAD_UCTS2; - } - register_bl31_param(¶m_da9212.h); + mtk_i2c_bus_init(EXT_BUCK_I2C_BUS); - /* Init i2c bus Timing register for da9212 */ - mtk_i2c_bus_init(param_da9212.i2c_bus); -#endif -} - -static void register_mt6311_to_bl31(void) -{ -#if IS_ENABLED(CONFIG_ARM64_USE_ARM_TRUSTED_FIRMWARE) - static struct bl31_mt6311_param param_mt6311 = { - .h = { - .type = PARAM_CLUSTER1_MT6311, - }, - .i2c_bus = 1, - }; - register_bl31_param(¶m_mt6311.h); - - /* Init i2c bus Timing register for mt6311 */ - mtk_i2c_bus_init(param_mt6311.i2c_bus); -#endif -} - -static void configure_bl31(void) -{ switch (board_id()) { case 3: case 4: /* rev-3 and rev-4 use mt6311 as external buck */ - register_mt6311_to_bl31(); + gpio_output(PAD_EINT15, 1); + udelay(500); + mt6311_probe(EXT_BUCK_I2C_BUS); break; case 2: default: /* rev-2 and rev-5 use da9212 as external buck */ - register_da9212_to_bl31(); + mt6391_gpio_output(MT6391_KP_ROW3, 1); /* DA9212_IC_EN */ + mt6391_gpio_output(MT6391_KP_ROW4, 1); /* DA9212_EN_A */ + udelay(500); /* add 500us delay for powering on da9212 */ + da9212_probe(EXT_BUCK_I2C_BUS); break; } } @@ -125,7 +89,7 @@ static void configure_audio(void) mt6391_gpio_output(MT6391_KP_COL5, 1); /* Init i2c bus Timing register for audio codecs */ - mtk_i2c_bus_init(0); + mtk_i2c_bus_init(CODEC_I2C_BUS); /* set I2S clock to 48KHz */ mt_pll_set_aud_div(48 * KHz); @@ -197,7 +161,7 @@ static void mainboard_init(device_t dev) configure_backlight(); configure_usb(); configure_usb_hub(); - configure_bl31(); + configure_ext_buck(); elog_init(); elog_add_boot_reason();