From e0ea98258a81e09542cdbe239e839e9698e582dd Mon Sep 17 00:00:00 2001 From: Daniel Kurtz Date: Thu, 1 Feb 2018 15:18:38 -0700 Subject: soc/amd/stoneyridge: Add API to initialize non-early_init i2c buses Provide a method for initializing i2c buses that are not marked as early_init in the device tree. These i2c buses can be enabled in a mainboard's ramstage, for example. BUG=b:69407112 TEST=Boot depthcharge w/ CLI enabled on grunt. devbeep => plays beep BRANCH=None Change-Id: I6e49b0de9116138ba102377d283e22d7b50d7dca Signed-off-by: Daniel Kurtz Reviewed-on: https://review.coreboot.org/23553 Tested-by: build bot (Jenkins) Reviewed-by: Aaron Durbin Reviewed-by: Paul Menzel --- src/soc/amd/stoneyridge/i2c.c | 14 ++++++++++++-- src/soc/amd/stoneyridge/include/soc/southbridge.h | 3 +++ 2 files changed, 15 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/soc/amd/stoneyridge/i2c.c b/src/soc/amd/stoneyridge/i2c.c index 947c43f3b0..b90e5d7857 100644 --- a/src/soc/amd/stoneyridge/i2c.c +++ b/src/soc/amd/stoneyridge/i2c.c @@ -101,7 +101,7 @@ int dw_i2c_soc_dev_to_bus(struct device *dev) return -1; } -void i2c_soc_early_init(void) +static void dw_i2c_soc_init(bool is_early_init) { size_t i; const struct soc_amd_stoneyridge_config *config; @@ -114,7 +114,7 @@ void i2c_soc_early_init(void) for (i = 0; i < ARRAY_SIZE(config->i2c); i++) { const struct dw_i2c_bus_config *cfg = &config->i2c[i]; - if (!cfg->early_init) + if (cfg->early_init != is_early_init) continue; if (dw_i2c_init(i, cfg)) @@ -122,6 +122,16 @@ void i2c_soc_early_init(void) } } +void i2c_soc_early_init(void) +{ + dw_i2c_soc_init(true); +} + +void i2c_soc_init(void) +{ + dw_i2c_soc_init(false); +} + struct device_operations stoneyridge_i2c_mmio_ops = { /* TODO(teravest): Move I2C resource info here. */ .read_resources = DEVICE_NOOP, diff --git a/src/soc/amd/stoneyridge/include/soc/southbridge.h b/src/soc/amd/stoneyridge/include/soc/southbridge.h index 2f9d9f9e68..f4d6b17a03 100644 --- a/src/soc/amd/stoneyridge/include/soc/southbridge.h +++ b/src/soc/amd/stoneyridge/include/soc/southbridge.h @@ -392,4 +392,7 @@ int mainboard_get_ehci_oc_map(uint16_t *usb_oc_map); /* Initialize all the i2c buses that are marked with early init. */ void i2c_soc_early_init(void); +/* Initialize all the i2c buses that are not marked with early init. */ +void i2c_soc_init(void); + #endif /* __STONEYRIDGE_H__ */ -- cgit v1.2.3