Skip to content
Snippets Groups Projects
Commit 04ecf36b authored by Simon Glass's avatar Simon Glass
Browse files

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: default avatarSimon Glass <sjg@chromium.org>
parent 3b2a29e0
No related branches found
No related tags found
No related merge requests found
...@@ -29,7 +29,20 @@ static int syscon_pre_probe(struct udevice *dev) ...@@ -29,7 +29,20 @@ static int syscon_pre_probe(struct udevice *dev)
{ {
struct syscon_uc_info *priv = dev_get_uclass_priv(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); return regmap_init_mem(dev, &priv->regmap);
#endif
} }
int syscon_get_by_driver_data(ulong driver_data, struct udevice **devp) int syscon_get_by_driver_data(ulong driver_data, struct udevice **devp)
......
...@@ -23,6 +23,17 @@ struct syscon_ops { ...@@ -23,6 +23,17 @@ struct syscon_ops {
#define syscon_get_ops(dev) ((struct syscon_ops *)(dev)->driver->ops) #define syscon_get_ops(dev) ((struct syscon_ops *)(dev)->driver->ops)
#if CONFIG_IS_ENABLED(OF_PLATDATA)
/*
* We don't support 64-bit machines. If they are so resource-contrained that
* they need to use OF_PLATDATA, something is horribly wrong with the
* education of our hardware engineers.
*/
struct syscon_base_platdata {
u32 reg[2];
};
#endif
/** /**
* syscon_get_regmap() - Get access to a register map * syscon_get_regmap() - Get access to a register map
* *
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment