summaryrefslogtreecommitdiff
path: root/drivers/i2c/designware_i2c_pci.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/i2c/designware_i2c_pci.c')
-rw-r--r--drivers/i2c/designware_i2c_pci.c28
1 files changed, 7 insertions, 21 deletions
diff --git a/drivers/i2c/designware_i2c_pci.c b/drivers/i2c/designware_i2c_pci.c
index d0d869c81a..ec0cdf6220 100644
--- a/drivers/i2c/designware_i2c_pci.c
+++ b/drivers/i2c/designware_i2c_pci.c
@@ -34,7 +34,7 @@ static struct dw_scl_sda_cfg byt_config = {
/* Have a weak function for now - possibly should be a new uclass */
__weak void lpss_reset_release(void *regs);
-static int designware_i2c_pci_ofdata_to_platdata(struct udevice *dev)
+static int designware_i2c_pci_of_to_plat(struct udevice *dev)
{
struct dw_i2c *priv = dev_get_priv(dev);
@@ -71,7 +71,7 @@ static int designware_i2c_pci_ofdata_to_platdata(struct udevice *dev)
if (dev_get_driver_data(dev) == INTEL_APL)
priv->has_spk_cnt = true;
- return designware_i2c_ofdata_to_platdata(dev);
+ return designware_i2c_of_to_plat(dev);
}
static int designware_i2c_pci_probe(struct udevice *dev)
@@ -92,24 +92,10 @@ static int designware_i2c_pci_bind(struct udevice *dev)
{
char name[20];
- if (dev_of_valid(dev))
+ if (dev_has_ofnode(dev))
return 0;
- /*
- * Create a unique device name for PCI type devices
- * ToDo:
- * Setting req_seq in the driver is probably not recommended.
- * But without a DT alias the number is not configured. And
- * using this driver is impossible for PCIe I2C devices.
- * This can be removed, once a better (correct) way for this
- * is found and implemented.
- *
- * TODO(sjg@chromium.org): Perhaps if uclasses had platdata this would
- * be possible. We cannot use static data in drivers since they may be
- * used in SPL or before relocation.
- */
- dev->req_seq = uclass_find_next_free_req_seq(UCLASS_I2C);
- sprintf(name, "i2c_designware#%u", dev->req_seq);
+ sprintf(name, "i2c_designware#%u", dev_seq(dev));
device_set_name(dev, name);
return 0;
@@ -166,7 +152,7 @@ static int dw_i2c_acpi_fill_ssdt(const struct udevice *dev,
int ret;
/* If no device-tree node, ignore this since we assume it isn't used */
- if (!dev_of_valid(dev))
+ if (!dev_has_ofnode(dev))
return 0;
ret = acpi_device_path(dev, path, sizeof(path));
@@ -211,9 +197,9 @@ U_BOOT_DRIVER(i2c_designware_pci) = {
.id = UCLASS_I2C,
.of_match = designware_i2c_pci_ids,
.bind = designware_i2c_pci_bind,
- .ofdata_to_platdata = designware_i2c_pci_ofdata_to_platdata,
+ .of_to_plat = designware_i2c_pci_of_to_plat,
.probe = designware_i2c_pci_probe,
- .priv_auto_alloc_size = sizeof(struct dw_i2c),
+ .priv_auto = sizeof(struct dw_i2c),
.remove = designware_i2c_remove,
.flags = DM_FLAG_OS_PREPARE,
.ops = &designware_i2c_ops,