aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm
diff options
context:
space:
mode:
authorAndrew Lunn <andrew@lunn.ch>2014-03-04 12:51:47 -0500
committerJason Cooper <jason@lakedaemon.net>2014-04-24 00:31:03 -0400
commit56a705a48eae9c474ba7f82af5c4ff5cf306f654 (patch)
tree7b9b4715e54e694240650ad57da14469af3700cf /arch/arm
parentc9eaa447e77efe77b7fa4c953bd62de8297fd6c5 (diff)
ARM: mvebu: Add a SOC bus device entry
Add the SoC Family, device ID and revision to /sys/bus/soc. Signed-off-by: Andrew Lunn <andrew@lunn.ch> Link: https://lkml.kernel.org/r/1393955507-26436-1-git-send-email-andrew@lunn.ch Signed-off-by: Jason Cooper <jason@lakedaemon.net>
Diffstat (limited to 'arch/arm')
-rw-r--r--arch/arm/mach-mvebu/Kconfig1
-rw-r--r--arch/arm/mach-mvebu/mvebu-soc-id.c30
2 files changed, 31 insertions, 0 deletions
diff --git a/arch/arm/mach-mvebu/Kconfig b/arch/arm/mach-mvebu/Kconfig
index 3f73eecbcfb0..475cf8a6d165 100644
--- a/arch/arm/mach-mvebu/Kconfig
+++ b/arch/arm/mach-mvebu/Kconfig
@@ -6,6 +6,7 @@ config ARCH_MVEBU
6 select IRQ_DOMAIN 6 select IRQ_DOMAIN
7 select PINCTRL 7 select PINCTRL
8 select PLAT_ORION 8 select PLAT_ORION
9 select SOC_BUS
9 select MVEBU_MBUS 10 select MVEBU_MBUS
10 select ZONE_DMA if ARM_LPAE 11 select ZONE_DMA if ARM_LPAE
11 select ARCH_REQUIRE_GPIOLIB 12 select ARCH_REQUIRE_GPIOLIB
diff --git a/arch/arm/mach-mvebu/mvebu-soc-id.c b/arch/arm/mach-mvebu/mvebu-soc-id.c
index f3d4cf53f746..874a7504818e 100644
--- a/arch/arm/mach-mvebu/mvebu-soc-id.c
+++ b/arch/arm/mach-mvebu/mvebu-soc-id.c
@@ -23,6 +23,8 @@
23#include <linux/kernel.h> 23#include <linux/kernel.h>
24#include <linux/of.h> 24#include <linux/of.h>
25#include <linux/of_address.h> 25#include <linux/of_address.h>
26#include <linux/slab.h>
27#include <linux/sys_soc.h>
26#include "mvebu-soc-id.h" 28#include "mvebu-soc-id.h"
27 29
28#define PCIE_DEV_ID_OFF 0x0 30#define PCIE_DEV_ID_OFF 0x0
@@ -118,3 +120,31 @@ clk_err:
118} 120}
119core_initcall(mvebu_soc_id_init); 121core_initcall(mvebu_soc_id_init);
120 122
123static int __init mvebu_soc_device(void)
124{
125 struct soc_device_attribute *soc_dev_attr;
126 struct soc_device *soc_dev;
127
128 /* Also protects against running on non-mvebu systems */
129 if (!is_id_valid)
130 return 0;
131
132 soc_dev_attr = kzalloc(sizeof(*soc_dev_attr), GFP_KERNEL);
133 if (!soc_dev_attr)
134 return -ENOMEM;
135
136 soc_dev_attr->family = kasprintf(GFP_KERNEL, "Marvell");
137 soc_dev_attr->revision = kasprintf(GFP_KERNEL, "%X", soc_rev);
138 soc_dev_attr->soc_id = kasprintf(GFP_KERNEL, "%X", soc_dev_id);
139
140 soc_dev = soc_device_register(soc_dev_attr);
141 if (IS_ERR(soc_dev)) {
142 kfree(soc_dev_attr->family);
143 kfree(soc_dev_attr->revision);
144 kfree(soc_dev_attr->soc_id);
145 kfree(soc_dev_attr);
146 }
147
148 return 0;
149}
150postcore_initcall(mvebu_soc_device);