From 29f9b6cf7bff6a118130163c848811e14f8022da Mon Sep 17 00:00:00 2001 From: Pawel Moll Date: Wed, 12 Feb 2014 10:47:10 +0000 Subject: mfd: syscon: Add platform data with a regmap config name Define syscon platform data structure that can be used to define a regmap config name. This is particularly useful in the regmap debugfs when there is more than one syscon device registered, to distinguish the register blocks. Signed-off-by: Pawel Moll Acked-by: Lee Jones --- drivers/mfd/syscon.c | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'drivers/mfd/syscon.c') diff --git a/drivers/mfd/syscon.c b/drivers/mfd/syscon.c index dbea55de439..e2a04bb8bc1 100644 --- a/drivers/mfd/syscon.c +++ b/drivers/mfd/syscon.c @@ -18,6 +18,7 @@ #include #include #include +#include #include #include #include @@ -119,6 +120,7 @@ static struct regmap_config syscon_regmap_config = { static int syscon_probe(struct platform_device *pdev) { struct device *dev = &pdev->dev; + struct syscon_platform_data *pdata = dev_get_platdata(dev); struct syscon *syscon; struct resource *res; void __iomem *base; @@ -136,6 +138,8 @@ static int syscon_probe(struct platform_device *pdev) return -ENOMEM; syscon_regmap_config.max_register = res->end - res->start - 3; + if (pdata) + syscon_regmap_config.name = pdata->label; syscon->regmap = devm_regmap_init_mmio(dev, base, &syscon_regmap_config); if (IS_ERR(syscon->regmap)) { -- cgit v1.2.3-70-g09d2 From 45330bb434214c83841171eb4c591da74367a589 Mon Sep 17 00:00:00 2001 From: Pankaj Dubey Date: Wed, 30 Apr 2014 11:14:26 +0900 Subject: mfd: syscon: Allow property as NULL in syscon_regmap_lookup_by_phandle If we pass syscon device node itself as first parameter to this function there is no need to parse and find syscon device node. So by allowing "property" parameter as NULL allow syscon_regmap_lookup_by_phandle to consider passed argument "np" itself as a syscon device node "syscon_np". This will help us in avoiding addition of "syscon" property in a device node which points back to same device node in device tree. Signed-off-by: Pankaj Dubey Signed-off-by: Lee Jones --- drivers/mfd/syscon.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'drivers/mfd/syscon.c') diff --git a/drivers/mfd/syscon.c b/drivers/mfd/syscon.c index dbea55de439..b30f94179f4 100644 --- a/drivers/mfd/syscon.c +++ b/drivers/mfd/syscon.c @@ -94,7 +94,11 @@ struct regmap *syscon_regmap_lookup_by_phandle(struct device_node *np, struct device_node *syscon_np; struct regmap *regmap; - syscon_np = of_parse_phandle(np, property, 0); + if (property) + syscon_np = of_parse_phandle(np, property, 0); + else + syscon_np = np; + if (!syscon_np) return ERR_PTR(-ENODEV); -- cgit v1.2.3-70-g09d2