diff options
author | Simon Glass <sjg@chromium.org> | 2016-07-04 11:58:00 -0600 |
---|---|---|
committer | Simon Glass <sjg@chromium.org> | 2016-07-14 20:40:24 -0600 |
commit | 04ecf36ba60f41f695095226e53310b4acaebf1e (patch) | |
tree | 1ff3310987f63694b65d5b7bd99348e8099faf03 /drivers/core/syscon-uclass.c | |
parent | 3b2a29e0971397085c616c89a3a09f2609f50ca4 (diff) | |
download | u-boot-04ecf36ba60f41f695095226e53310b4acaebf1e.tar.gz |
dm: syscon: Add support for of-platdata
Provide a new function which can cope with obtaining information from
of-platdata instead of the device tree.
Signed-off-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'drivers/core/syscon-uclass.c')
-rw-r--r-- | drivers/core/syscon-uclass.c | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/drivers/core/syscon-uclass.c b/drivers/core/syscon-uclass.c index e03f46af57..01bd9683a7 100644 --- a/drivers/core/syscon-uclass.c +++ b/drivers/core/syscon-uclass.c @@ -29,7 +29,20 @@ static int syscon_pre_probe(struct udevice *dev) { struct syscon_uc_info *priv = dev_get_uclass_priv(dev); + /* + * With OF_PLATDATA we really have no way of knowing the format of + * the device-specific platform data. So we assume that it starts with + * a 'reg' member, and this holds a single address and size. Drivers + * using OF_PLATDATA will need to ensure that this is true. + */ +#if CONFIG_IS_ENABLED(OF_PLATDATA) + struct syscon_base_platdata *plat = dev_get_platdata(dev); + + return regmap_init_mem_platdata(dev, plat->reg, ARRAY_SIZE(plat->reg), + &priv->regmap); +#else return regmap_init_mem(dev, &priv->regmap); +#endif } int syscon_get_by_driver_data(ulong driver_data, struct udevice **devp) |