summaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
authorSimon Glass <sjg@chromium.org>2018-11-18 08:14:34 -0700
committerSimon Glass <sjg@chromium.org>2018-11-29 09:30:05 -0700
commit031a650e1309a086f6794cde35b1b1b851a9e926 (patch)
treea2b6743e36597b2aec9411144028943b254e85ac /drivers
parentb7c25b11b6a1e3f840464224309b72a91b65bc56 (diff)
dm: sandbox: i2c: Use new emulator parent uclass
Update the device tree, sandbox i2c driver and tests to use the new emulation parent to hold emulators. Signed-off-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/i2c/sandbox_i2c.c20
-rw-r--r--drivers/power/pmic/i2c_pmic_emul.c2
2 files changed, 2 insertions, 20 deletions
diff --git a/drivers/i2c/sandbox_i2c.c b/drivers/i2c/sandbox_i2c.c
index 6657851084..0dbbaa0c44 100644
--- a/drivers/i2c/sandbox_i2c.c
+++ b/drivers/i2c/sandbox_i2c.c
@@ -21,33 +21,15 @@ static int get_emul(struct udevice *dev, struct udevice **devp,
struct dm_i2c_ops **opsp)
{
struct dm_i2c_chip *plat;
- struct udevice *child;
int ret;
*devp = NULL;
*opsp = NULL;
plat = dev_get_parent_platdata(dev);
if (!plat->emul) {
- ret = dm_scan_fdt_dev(dev);
+ ret = i2c_emul_find(dev, &plat->emul);
if (ret)
return ret;
-
- for (device_find_first_child(dev, &child); child;
- device_find_next_child(&child)) {
- if (device_get_uclass_id(child) != UCLASS_I2C_EMUL)
- continue;
-
- ret = device_probe(child);
- if (ret)
- return ret;
-
- break;
- }
-
- if (child)
- plat->emul = child;
- else
- return -ENODEV;
}
*devp = plat->emul;
*opsp = i2c_get_ops(plat->emul);
diff --git a/drivers/power/pmic/i2c_pmic_emul.c b/drivers/power/pmic/i2c_pmic_emul.c
index 61fa76a561..80efc0265d 100644
--- a/drivers/power/pmic/i2c_pmic_emul.c
+++ b/drivers/power/pmic/i2c_pmic_emul.c
@@ -104,7 +104,7 @@ static int sandbox_i2c_pmic_xfer(struct udevice *emul, struct i2c_msg *msg,
static int sandbox_i2c_pmic_ofdata_to_platdata(struct udevice *emul)
{
struct sandbox_i2c_pmic_plat_data *plat = dev_get_platdata(emul);
- struct udevice *pmic_dev = dev_get_parent(emul);
+ struct udevice *pmic_dev = i2c_emul_get_device(emul);
struct uc_pmic_priv *priv = dev_get_uclass_priv(pmic_dev);
const u8 *reg_defaults;