drivers/i2c/designware: namespace soc functions
Rename the following functions to ensure it's clear that the designware i2c host controller driver is the one that these functions are associated with: i2c_get_soc_cfg() -> dw_i2c_get_soc_cfg() i2c_get_soc_early_base() -> dw_i2c_get_soc_early_base() i2c_soc_devfn_to_bus() -> dw_i2c_soc_devfn_to_bus() i2c_soc_bus_to_devfn() -> dw_i2c_soc_bus_to_devfn() BUG=b:72121803 Change-Id: Idb7633b45a0bb7cb7433ef5f6b154e28474a7b6d Signed-off-by: Aaron Durbin <adurbin@chromium.org> Reviewed-on: https://review.coreboot.org/23371 Reviewed-by: Justin TerAvest <teravest@chromium.org> Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Furquan Shaikh <furquan@google.com>
This commit is contained in:
parent
439cee9098
commit
9aee8194c4
|
@ -79,7 +79,7 @@ struct dw_i2c_bus_config {
|
|||
/* Functions to be implemented by SoC code */
|
||||
|
||||
/* Get base address for early init of I2C controllers. */
|
||||
uintptr_t i2c_get_soc_early_base(unsigned int bus);
|
||||
uintptr_t dw_i2c_get_soc_early_base(unsigned int bus);
|
||||
|
||||
/*
|
||||
* Map given I2C bus number to devfn.
|
||||
|
@ -87,7 +87,7 @@ uintptr_t i2c_get_soc_early_base(unsigned int bus);
|
|||
* -1 = error
|
||||
* otherwise, devfn(>=0) corresponding to I2C bus number.
|
||||
*/
|
||||
int i2c_soc_devfn_to_bus(unsigned int devfn);
|
||||
int dw_i2c_soc_devfn_to_bus(unsigned int devfn);
|
||||
|
||||
/*
|
||||
* Map given bus number to a I2C Controller.
|
||||
|
@ -95,14 +95,14 @@ int i2c_soc_devfn_to_bus(unsigned int devfn);
|
|||
* -1 = error
|
||||
* otherwise, devfn(>=0) corresponding to I2C bus number.
|
||||
*/
|
||||
int i2c_soc_bus_to_devfn(unsigned int bus);
|
||||
int dw_i2c_soc_bus_to_devfn(unsigned int bus);
|
||||
|
||||
/*
|
||||
* SoC implemented callback for getting I2C bus configuration.
|
||||
*
|
||||
* Returns NULL if i2c config is not found
|
||||
*/
|
||||
const struct dw_i2c_bus_config *i2c_get_soc_cfg(unsigned int bus,
|
||||
const struct dw_i2c_bus_config *dw_i2c_get_soc_cfg(unsigned int bus,
|
||||
const struct device *dev);
|
||||
|
||||
/* Get I2C controller base address */
|
||||
|
|
|
@ -21,7 +21,7 @@
|
|||
#include <soc/pci_devs.h>
|
||||
#include "chip.h"
|
||||
|
||||
const struct dw_i2c_bus_config *i2c_get_soc_cfg(unsigned int bus,
|
||||
const struct dw_i2c_bus_config *dw_i2c_get_soc_cfg(unsigned int bus,
|
||||
const struct device *dev)
|
||||
{
|
||||
const struct soc_intel_apollolake_config *config;
|
||||
|
@ -36,13 +36,13 @@ const struct dw_i2c_bus_config *i2c_get_soc_cfg(unsigned int bus,
|
|||
return &config->i2c[bus];
|
||||
}
|
||||
|
||||
uintptr_t i2c_get_soc_early_base(unsigned int bus)
|
||||
uintptr_t dw_i2c_get_soc_early_base(unsigned int bus)
|
||||
{
|
||||
return PRERAM_I2C_BASE_ADDRESS(bus);
|
||||
}
|
||||
|
||||
/* Convert I2C bus number to PCI device and function */
|
||||
int i2c_soc_bus_to_devfn(unsigned int bus)
|
||||
int dw_i2c_soc_bus_to_devfn(unsigned int bus)
|
||||
{
|
||||
if (bus <= 3)
|
||||
return PCI_DEVFN(PCH_DEV_SLOT_SIO1, bus);
|
||||
|
@ -53,7 +53,7 @@ int i2c_soc_bus_to_devfn(unsigned int bus)
|
|||
}
|
||||
|
||||
/* Convert PCI device and function to I2C bus number */
|
||||
int i2c_soc_devfn_to_bus(unsigned int devfn)
|
||||
int dw_i2c_soc_devfn_to_bus(unsigned int devfn)
|
||||
{
|
||||
if (PCI_SLOT(devfn) == PCH_DEV_SLOT_SIO1)
|
||||
return PCI_FUNC(devfn);
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
#include <soc/pci_devs.h>
|
||||
#include "chip.h"
|
||||
|
||||
const struct dw_i2c_bus_config *i2c_get_soc_cfg(unsigned int bus,
|
||||
const struct dw_i2c_bus_config *dw_i2c_get_soc_cfg(unsigned int bus,
|
||||
const struct device *dev)
|
||||
{
|
||||
const struct soc_intel_cannonlake_config *config;
|
||||
|
@ -37,12 +37,12 @@ const struct dw_i2c_bus_config *i2c_get_soc_cfg(unsigned int bus,
|
|||
return &config->i2c[bus];
|
||||
}
|
||||
|
||||
uintptr_t i2c_get_soc_early_base(unsigned int bus)
|
||||
uintptr_t dw_i2c_get_soc_early_base(unsigned int bus)
|
||||
{
|
||||
return EARLY_I2C_BASE(bus);
|
||||
}
|
||||
|
||||
int i2c_soc_devfn_to_bus(unsigned int devfn)
|
||||
int dw_i2c_soc_devfn_to_bus(unsigned int devfn)
|
||||
{
|
||||
switch (devfn) {
|
||||
case PCH_DEVFN_I2C0:
|
||||
|
@ -61,7 +61,7 @@ int i2c_soc_devfn_to_bus(unsigned int devfn)
|
|||
return -1;
|
||||
}
|
||||
|
||||
int i2c_soc_bus_to_devfn(unsigned int bus)
|
||||
int dw_i2c_soc_bus_to_devfn(unsigned int bus)
|
||||
{
|
||||
switch (bus) {
|
||||
case 0:
|
||||
|
|
|
@ -27,7 +27,7 @@ uintptr_t dw_i2c_base_address(unsigned int bus)
|
|||
struct resource *res;
|
||||
|
||||
/* bus -> devfn */
|
||||
devfn = i2c_soc_bus_to_devfn(bus);
|
||||
devfn = dw_i2c_soc_bus_to_devfn(bus);
|
||||
|
||||
if (devfn < 0)
|
||||
return (uintptr_t)NULL;
|
||||
|
@ -48,7 +48,7 @@ uintptr_t dw_i2c_base_address(unsigned int bus)
|
|||
static int lpss_i2c_dev_to_bus(struct device *dev)
|
||||
{
|
||||
pci_devfn_t devfn = dev->path.pci.devfn;
|
||||
return i2c_soc_devfn_to_bus(devfn);
|
||||
return dw_i2c_soc_devfn_to_bus(devfn);
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -98,7 +98,7 @@ static void lpss_i2c_dev_init(struct device *dev)
|
|||
if (bus < 0)
|
||||
return;
|
||||
|
||||
config = i2c_get_soc_cfg(bus, dev);
|
||||
config = dw_i2c_get_soc_cfg(bus, dev);
|
||||
|
||||
if (!config)
|
||||
return;
|
||||
|
@ -132,7 +132,7 @@ static void lpss_i2c_acpi_fill_ssdt(struct device *dev)
|
|||
if (bus < 0)
|
||||
return;
|
||||
|
||||
bcfg = i2c_get_soc_cfg(bus, dev);
|
||||
bcfg = dw_i2c_get_soc_cfg(bus, dev);
|
||||
|
||||
if (!bcfg)
|
||||
return;
|
||||
|
|
|
@ -32,7 +32,7 @@ static int lpss_i2c_early_init_bus(unsigned int bus)
|
|||
uintptr_t base;
|
||||
|
||||
/* Find the PCI device for this bus controller */
|
||||
devfn = i2c_soc_bus_to_devfn(bus);
|
||||
devfn = dw_i2c_soc_bus_to_devfn(bus);
|
||||
if (devfn < 0) {
|
||||
printk(BIOS_ERR, "I2C%u device not found\n", bus);
|
||||
return -1;
|
||||
|
@ -47,14 +47,14 @@ static int lpss_i2c_early_init_bus(unsigned int bus)
|
|||
}
|
||||
|
||||
/* Skip if not enabled for early init */
|
||||
config = i2c_get_soc_cfg(bus, tree_dev);
|
||||
config = dw_i2c_get_soc_cfg(bus, tree_dev);
|
||||
if (!config || !config->early_init) {
|
||||
printk(BIOS_DEBUG, "I2C%u not enabled for early init\n", bus);
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* Prepare early base address for access before memory */
|
||||
base = i2c_get_soc_early_base(bus);
|
||||
base = dw_i2c_get_soc_early_base(bus);
|
||||
pci_write_config32(dev, PCI_BASE_ADDRESS_0, base);
|
||||
pci_write_config32(dev, PCI_COMMAND,
|
||||
PCI_COMMAND_MEMORY | PCI_COMMAND_MASTER);
|
||||
|
@ -78,7 +78,7 @@ uintptr_t dw_i2c_base_address(unsigned int bus)
|
|||
uintptr_t base;
|
||||
|
||||
/* Find device+function for this controller */
|
||||
devfn = i2c_soc_bus_to_devfn(bus);
|
||||
devfn = dw_i2c_soc_bus_to_devfn(bus);
|
||||
if (devfn < 0)
|
||||
return (uintptr_t)NULL;
|
||||
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
#include <soc/pci_devs.h>
|
||||
#include "chip.h"
|
||||
|
||||
const struct dw_i2c_bus_config *i2c_get_soc_cfg(unsigned int bus,
|
||||
const struct dw_i2c_bus_config *dw_i2c_get_soc_cfg(unsigned int bus,
|
||||
const struct device *dev)
|
||||
{
|
||||
const struct soc_intel_skylake_config *config;
|
||||
|
@ -35,12 +35,12 @@ const struct dw_i2c_bus_config *i2c_get_soc_cfg(unsigned int bus,
|
|||
return &config->i2c[bus];
|
||||
}
|
||||
|
||||
uintptr_t i2c_get_soc_early_base(unsigned int bus)
|
||||
uintptr_t dw_i2c_get_soc_early_base(unsigned int bus)
|
||||
{
|
||||
return EARLY_I2C_BASE(bus);
|
||||
}
|
||||
|
||||
int i2c_soc_devfn_to_bus(unsigned int devfn)
|
||||
int dw_i2c_soc_devfn_to_bus(unsigned int devfn)
|
||||
{
|
||||
switch (devfn) {
|
||||
case PCH_DEVFN_I2C0:
|
||||
|
@ -59,7 +59,7 @@ int i2c_soc_devfn_to_bus(unsigned int devfn)
|
|||
return -1;
|
||||
}
|
||||
|
||||
int i2c_soc_bus_to_devfn(unsigned int bus)
|
||||
int dw_i2c_soc_bus_to_devfn(unsigned int bus)
|
||||
{
|
||||
switch (bus) {
|
||||
case 0:
|
||||
|
|
Loading…
Reference in New Issue