aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-omap2
diff options
context:
space:
mode:
Diffstat (limited to 'arch/arm/mach-omap2')
-rw-r--r--arch/arm/mach-omap2/Kconfig1
-rw-r--r--arch/arm/mach-omap2/common.h8
-rw-r--r--arch/arm/mach-omap2/id.c65
-rw-r--r--arch/arm/mach-omap2/io.c1
4 files changed, 75 insertions, 0 deletions
diff --git a/arch/arm/mach-omap2/Kconfig b/arch/arm/mach-omap2/Kconfig
index 8111cd9ff3e5..68b1802879e2 100644
--- a/arch/arm/mach-omap2/Kconfig
+++ b/arch/arm/mach-omap2/Kconfig
@@ -15,6 +15,7 @@ config ARCH_OMAP2PLUS
15 select OMAP_DM_TIMER 15 select OMAP_DM_TIMER
16 select PINCTRL 16 select PINCTRL
17 select PROC_DEVICETREE if PROC_FS 17 select PROC_DEVICETREE if PROC_FS
18 select SOC_BUS
18 select SPARSE_IRQ 19 select SPARSE_IRQ
19 select USE_OF 20 select USE_OF
20 help 21 help
diff --git a/arch/arm/mach-omap2/common.h b/arch/arm/mach-omap2/common.h
index d6ba13e1c540..1ddd0cb5fab9 100644
--- a/arch/arm/mach-omap2/common.h
+++ b/arch/arm/mach-omap2/common.h
@@ -110,6 +110,14 @@ void am35xx_init_late(void);
110void ti81xx_init_late(void); 110void ti81xx_init_late(void);
111int omap2_common_pm_late_init(void); 111int omap2_common_pm_late_init(void);
112 112
113#ifdef CONFIG_SOC_BUS
114void omap_soc_device_init(void);
115#else
116static inline void omap_soc_device_init(void)
117{
118}
119#endif
120
113#if defined(CONFIG_SOC_OMAP2420) || defined(CONFIG_SOC_OMAP2430) 121#if defined(CONFIG_SOC_OMAP2420) || defined(CONFIG_SOC_OMAP2430)
114void omap2xxx_restart(char mode, const char *cmd); 122void omap2xxx_restart(char mode, const char *cmd);
115#else 123#else
diff --git a/arch/arm/mach-omap2/id.c b/arch/arm/mach-omap2/id.c
index 3737700529fe..098e94e31336 100644
--- a/arch/arm/mach-omap2/id.c
+++ b/arch/arm/mach-omap2/id.c
@@ -18,6 +18,11 @@
18#include <linux/kernel.h> 18#include <linux/kernel.h>
19#include <linux/init.h> 19#include <linux/init.h>
20#include <linux/io.h> 20#include <linux/io.h>
21#include <linux/slab.h>
22
23#ifdef CONFIG_SOC_BUS
24#include <linux/sys_soc.h>
25#endif
21 26
22#include <asm/cputype.h> 27#include <asm/cputype.h>
23 28
@@ -583,3 +588,63 @@ void __init omap2_set_globals_tap(u32 class, void __iomem *tap)
583 else 588 else
584 tap_prod_id = 0x0208; 589 tap_prod_id = 0x0208;
585} 590}
591
592#ifdef CONFIG_SOC_BUS
593
594static const char const *omap_types[] = {
595 [OMAP2_DEVICE_TYPE_TEST] = "TST",
596 [OMAP2_DEVICE_TYPE_EMU] = "EMU",
597 [OMAP2_DEVICE_TYPE_SEC] = "HS",
598 [OMAP2_DEVICE_TYPE_GP] = "GP",
599 [OMAP2_DEVICE_TYPE_BAD] = "BAD",
600};
601
602static const char * __init omap_get_family(void)
603{
604 if (cpu_is_omap24xx())
605 return kasprintf(GFP_KERNEL, "OMAP2");
606 else if (cpu_is_omap34xx())
607 return kasprintf(GFP_KERNEL, "OMAP3");
608 else if (cpu_is_omap44xx())
609 return kasprintf(GFP_KERNEL, "OMAP4");
610 else if (soc_is_omap54xx())
611 return kasprintf(GFP_KERNEL, "OMAP5");
612 else
613 return kasprintf(GFP_KERNEL, "Unknown");
614}
615
616static ssize_t omap_get_type(struct device *dev,
617 struct device_attribute *attr,
618 char *buf)
619{
620 return sprintf(buf, "%s\n", omap_types[omap_type()]);
621}
622
623static struct device_attribute omap_soc_attr =
624 __ATTR(type, S_IRUGO, omap_get_type, NULL);
625
626void __init omap_soc_device_init(void)
627{
628 struct device *parent;
629 struct soc_device *soc_dev;
630 struct soc_device_attribute *soc_dev_attr;
631
632 soc_dev_attr = kzalloc(sizeof(*soc_dev_attr), GFP_KERNEL);
633 if (!soc_dev_attr)
634 return;
635
636 soc_dev_attr->machine = soc_name;
637 soc_dev_attr->family = omap_get_family();
638 soc_dev_attr->revision = soc_rev;
639
640 soc_dev = soc_device_register(soc_dev_attr);
641 if (IS_ERR_OR_NULL(soc_dev)) {
642 kfree(soc_dev_attr);
643 return;
644 }
645
646 parent = soc_device_to_device(soc_dev);
647 if (!IS_ERR_OR_NULL(parent))
648 device_create_file(parent, &omap_soc_attr);
649}
650#endif /* CONFIG_SOC_BUS */
diff --git a/arch/arm/mach-omap2/io.c b/arch/arm/mach-omap2/io.c
index 865688e69330..3241f23afe09 100644
--- a/arch/arm/mach-omap2/io.c
+++ b/arch/arm/mach-omap2/io.c
@@ -389,6 +389,7 @@ static void __init omap_common_late_init(void)
389{ 389{
390 omap_mux_late_init(); 390 omap_mux_late_init();
391 omap2_common_pm_late_init(); 391 omap2_common_pm_late_init();
392 omap_soc_device_init();
392} 393}
393 394
394#ifdef CONFIG_SOC_OMAP2420 395#ifdef CONFIG_SOC_OMAP2420