aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
authorDanny Huang <dahuang@nvidia.com>2013-03-13 20:48:40 -0400
committerStephen Warren <swarren@nvidia.com>2013-03-15 14:49:15 -0400
commitd591fdf8e23ef2abf57bdfbc4b596bf1a43d15b4 (patch)
tree3921d5af81c0e6512a462ac731f59e789ac523b9 /arch
parente562b86581d2ccf3faaf55b1235b4e6438cb7712 (diff)
ARM: tegra: expose chip ID and revision
Expose Tegra chip ID and revision in /sys/devices/soc for user mode usage Signed-off-by: Danny Huang <dahuang@nvidia.com> Signed-off-by: Stephen Warren <swarren@nvidia.com>
Diffstat (limited to 'arch')
-rw-r--r--arch/arm/Kconfig1
-rw-r--r--arch/arm/mach-tegra/tegra.c29
2 files changed, 29 insertions, 1 deletions
diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
index 5b714695b01b..59b7be794582 100644
--- a/arch/arm/Kconfig
+++ b/arch/arm/Kconfig
@@ -675,6 +675,7 @@ config ARCH_TEGRA
675 select HAVE_CLK 675 select HAVE_CLK
676 select HAVE_SMP 676 select HAVE_SMP
677 select MIGHT_HAVE_CACHE_L2X0 677 select MIGHT_HAVE_CACHE_L2X0
678 select SOC_BUS
678 select SPARSE_IRQ 679 select SPARSE_IRQ
679 select USE_OF 680 select USE_OF
680 help 681 help
diff --git a/arch/arm/mach-tegra/tegra.c b/arch/arm/mach-tegra/tegra.c
index 27232c901a22..84deeab23ee7 100644
--- a/arch/arm/mach-tegra/tegra.c
+++ b/arch/arm/mach-tegra/tegra.c
@@ -33,6 +33,8 @@
33#include <linux/io.h> 33#include <linux/io.h>
34#include <linux/i2c.h> 34#include <linux/i2c.h>
35#include <linux/i2c-tegra.h> 35#include <linux/i2c-tegra.h>
36#include <linux/slab.h>
37#include <linux/sys_soc.h>
36#include <linux/usb/tegra_usb_phy.h> 38#include <linux/usb/tegra_usb_phy.h>
37 39
38#include <asm/mach-types.h> 40#include <asm/mach-types.h>
@@ -42,6 +44,7 @@
42 44
43#include "board.h" 45#include "board.h"
44#include "common.h" 46#include "common.h"
47#include "fuse.h"
45#include "iomap.h" 48#include "iomap.h"
46 49
47static struct tegra_ehci_platform_data tegra_ehci1_pdata = { 50static struct tegra_ehci_platform_data tegra_ehci1_pdata = {
@@ -80,12 +83,36 @@ static struct of_dev_auxdata tegra20_auxdata_lookup[] __initdata = {
80 83
81static void __init tegra_dt_init(void) 84static void __init tegra_dt_init(void)
82{ 85{
86 struct soc_device_attribute *soc_dev_attr;
87 struct soc_device *soc_dev;
88 struct device *parent = NULL;
89
90 soc_dev_attr = kzalloc(sizeof(*soc_dev_attr), GFP_KERNEL);
91 if (!soc_dev_attr)
92 goto out;
93
94 soc_dev_attr->family = kasprintf(GFP_KERNEL, "Tegra");
95 soc_dev_attr->revision = kasprintf(GFP_KERNEL, "%d", tegra_revision);
96 soc_dev_attr->soc_id = kasprintf(GFP_KERNEL, "%d", tegra_chip_id);
97
98 soc_dev = soc_device_register(soc_dev_attr);
99 if (IS_ERR(soc_dev)) {
100 kfree(soc_dev_attr->family);
101 kfree(soc_dev_attr->revision);
102 kfree(soc_dev_attr->soc_id);
103 kfree(soc_dev_attr);
104 goto out;
105 }
106
107 parent = soc_device_to_device(soc_dev);
108
83 /* 109 /*
84 * Finished with the static registrations now; fill in the missing 110 * Finished with the static registrations now; fill in the missing
85 * devices 111 * devices
86 */ 112 */
113out:
87 of_platform_populate(NULL, of_default_bus_match_table, 114 of_platform_populate(NULL, of_default_bus_match_table,
88 tegra20_auxdata_lookup, NULL); 115 tegra20_auxdata_lookup, parent);
89} 116}
90 117
91static void __init trimslice_init(void) 118static void __init trimslice_init(void)