mfd: syscon: Add platform data with a regmap config name
authorPawel Moll <pawel.moll@arm.com>
Wed, 12 Feb 2014 10:47:10 +0000 (10:47 +0000)
committerPawel Moll <pawel.moll@arm.com>
Thu, 15 May 2014 16:02:19 +0000 (17:02 +0100)
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 <pawel.moll@arm.com>
Acked-by: Lee Jones <lee.jones@linaro.org>
drivers/mfd/syscon.c
include/linux/platform_data/syscon.h [new file with mode: 0644]

index dbea55de4397d5055da2b3fe39283fa36abea1f1..e2a04bb8bc1e7fb7b0948bf186ec2df8aa13b632 100644 (file)
@@ -18,6 +18,7 @@
 #include <linux/of.h>
 #include <linux/of_address.h>
 #include <linux/of_platform.h>
+#include <linux/platform_data/syscon.h>
 #include <linux/platform_device.h>
 #include <linux/regmap.h>
 #include <linux/mfd/syscon.h>
@@ -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)) {
diff --git a/include/linux/platform_data/syscon.h b/include/linux/platform_data/syscon.h
new file mode 100644 (file)
index 0000000..2354c6f
--- /dev/null
@@ -0,0 +1,8 @@
+#ifndef PLATFORM_DATA_SYSCON_H
+#define PLATFORM_DATA_SYSCON_H
+
+struct syscon_platform_data {
+       const char *label;
+};
+
+#endif