soc/amd/stoneyridge: replace get_soc_config with config_of_soc
get_soc_config was a reimplementation of config_of_soc. Change-Id: I73c6a84703e22d6778b830f4bb82419361c85ff7 Signed-off-by: Felix Held <felix-coreboot@felixheld.de> Reviewed-on: https://review.coreboot.org/c/coreboot/+/40257 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Marshall Dawson <marshalldawson3rd@gmail.com>
This commit is contained in:
parent
e0b41fd12e
commit
72e987d540
|
@ -5,6 +5,7 @@
|
||||||
#include <arch/acpi.h>
|
#include <arch/acpi.h>
|
||||||
#include <console/console.h>
|
#include <console/console.h>
|
||||||
#include <delay.h>
|
#include <delay.h>
|
||||||
|
#include <device/device.h>
|
||||||
#include <drivers/i2c/designware/dw_i2c.h>
|
#include <drivers/i2c/designware/dw_i2c.h>
|
||||||
#include <amdblocks/acpimmio.h>
|
#include <amdblocks/acpimmio.h>
|
||||||
#include <soc/iomap.h>
|
#include <soc/iomap.h>
|
||||||
|
@ -34,19 +35,6 @@ uintptr_t dw_i2c_base_address(unsigned int bus)
|
||||||
return bus < I2C_DEVICE_COUNT ? i2c_bus_address[bus] : 0;
|
return bus < I2C_DEVICE_COUNT ? i2c_bus_address[bus] : 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static const struct soc_amd_stoneyridge_config *get_soc_config(void)
|
|
||||||
{
|
|
||||||
const struct device *dev = pcidev_path_on_root(GNB_DEVFN);
|
|
||||||
|
|
||||||
if (!dev || !dev->chip_info) {
|
|
||||||
printk(BIOS_ERR, "%s: Could not find SoC devicetree config!\n",
|
|
||||||
__func__);
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
return dev->chip_info;
|
|
||||||
}
|
|
||||||
|
|
||||||
const struct dw_i2c_bus_config *dw_i2c_get_soc_cfg(unsigned int bus)
|
const struct dw_i2c_bus_config *dw_i2c_get_soc_cfg(unsigned int bus)
|
||||||
{
|
{
|
||||||
const struct soc_amd_stoneyridge_config *config;
|
const struct soc_amd_stoneyridge_config *config;
|
||||||
|
@ -54,9 +42,8 @@ const struct dw_i2c_bus_config *dw_i2c_get_soc_cfg(unsigned int bus)
|
||||||
if (bus >= ARRAY_SIZE(i2c_bus_address))
|
if (bus >= ARRAY_SIZE(i2c_bus_address))
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
config = get_soc_config();
|
/* config is not NULL; if it was, config_of_soc calls die() internally */
|
||||||
if (config == NULL)
|
config = config_of_soc();
|
||||||
return NULL;
|
|
||||||
|
|
||||||
return &config->i2c[bus];
|
return &config->i2c[bus];
|
||||||
}
|
}
|
||||||
|
@ -97,10 +84,8 @@ static void dw_i2c_soc_init(bool is_early_init)
|
||||||
size_t i;
|
size_t i;
|
||||||
const struct soc_amd_stoneyridge_config *config;
|
const struct soc_amd_stoneyridge_config *config;
|
||||||
|
|
||||||
config = get_soc_config();
|
/* config is not NULL; if it was, config_of_soc calls die() internally */
|
||||||
|
config = config_of_soc();
|
||||||
if (config == NULL)
|
|
||||||
return;
|
|
||||||
|
|
||||||
for (i = 0; i < ARRAY_SIZE(config->i2c); i++) {
|
for (i = 0; i < ARRAY_SIZE(config->i2c); i++) {
|
||||||
const struct dw_i2c_bus_config *cfg = &config->i2c[i];
|
const struct dw_i2c_bus_config *cfg = &config->i2c[i];
|
||||||
|
|
Loading…
Reference in New Issue