aboutsummaryrefslogtreecommitdiff
path: root/drivers/core/syscon-uclass.c
diff options
context:
space:
mode:
authorTom Rini <trini@konsulko.com>2023-05-09 12:45:49 -0400
committerTom Rini <trini@konsulko.com>2023-05-09 12:45:49 -0400
commit0a9a4384c1483a88776bca38e28f09be51161034 (patch)
treec39e9bac9413c5c90f8da424865d67a7efdca315 /drivers/core/syscon-uclass.c
parentf1d33a44ca04fdca241c1d89fd79e2e56c930c7e (diff)
parent716ed2a8c0bba085372df0eb7edb580b11e8d94c (diff)
downloadu-boot-WIP/09May2023.zip
u-boot-WIP/09May2023.tar.gz
u-boot-WIP/09May2023.tar.bz2
Merge tag 'u-boot-rockchip-20230509' of https://source.denx.de/u-boot/custodians/u-boot-rockchipWIP/09May2023
- Rockchip NFC driver update and dev addr pointer api update; - use standard dr_mode for usb driver; - rock pi boards dts update; - Add rk3566 Anbernic boards; - Misc fixes for drivers;
Diffstat (limited to 'drivers/core/syscon-uclass.c')
-rw-r--r--drivers/core/syscon-uclass.c23
1 files changed, 18 insertions, 5 deletions
diff --git a/drivers/core/syscon-uclass.c b/drivers/core/syscon-uclass.c
index 25fdb66..a47b8bd 100644
--- a/drivers/core/syscon-uclass.c
+++ b/drivers/core/syscon-uclass.c
@@ -49,17 +49,30 @@ static int syscon_pre_probe(struct udevice *dev)
if (device_get_uclass_id(dev->parent) == UCLASS_PCI)
return 0;
+#if CONFIG_IS_ENABLED(OF_PLATDATA)
/*
* 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.
+ * a 'reg' member that holds a single address and size. Drivers
+ * using OF_PLATDATA will need to ensure that this is true. In case of
+ * odd reg structures other then the syscon_base_plat structure
+ * below the regmap must be defined in the individual syscon driver.
*/
-#if CONFIG_IS_ENABLED(OF_PLATDATA)
+ struct syscon_base_plat {
+ phys_addr_t reg[2];
+ };
+
struct syscon_base_plat *plat = dev_get_plat(dev);
- return regmap_init_mem_plat(dev, plat->reg, ARRAY_SIZE(plat->reg),
- &priv->regmap);
+ /*
+ * Return if the regmap is already defined in the individual
+ * syscon driver.
+ */
+ if (priv->regmap)
+ return 0;
+
+ return regmap_init_mem_plat(dev, plat->reg, sizeof(plat->reg[0]),
+ ARRAY_SIZE(plat->reg) / 2, &priv->regmap);
#else
return regmap_init_mem(dev_ofnode(dev), &priv->regmap);
#endif