id.c (f9d41eefcfbb9168c94ae40f37f76828dcca088c) id.c (6770b211432564c562c856d612b43bbd42e4ab5e)
1/*
2 * linux/arch/arm/mach-omap2/id.c
3 *
4 * OMAP2 CPU identification code
5 *
6 * Copyright (C) 2005 Nokia Corporation
7 * Written by Tony Lindgren <tony@atomide.com>
8 *

--- 4 unchanged lines hidden (view full) ---

13 * it under the terms of the GNU General Public License version 2 as
14 * published by the Free Software Foundation.
15 */
16
17#include <linux/module.h>
18#include <linux/kernel.h>
19#include <linux/init.h>
20#include <linux/io.h>
1/*
2 * linux/arch/arm/mach-omap2/id.c
3 *
4 * OMAP2 CPU identification code
5 *
6 * Copyright (C) 2005 Nokia Corporation
7 * Written by Tony Lindgren <tony@atomide.com>
8 *

--- 4 unchanged lines hidden (view full) ---

13 * it under the terms of the GNU General Public License version 2 as
14 * published by the Free Software Foundation.
15 */
16
17#include <linux/module.h>
18#include <linux/kernel.h>
19#include <linux/init.h>
20#include <linux/io.h>
21#include <linux/slab.h>
21
22
23#ifdef CONFIG_SOC_BUS
24#include <linux/sys_soc.h>
25#endif
26
22#include <asm/cputype.h>
23
24#include "common.h"
25
26#include "id.h"
27
28#include "soc.h"
29#include "control.h"

--- 548 unchanged lines hidden (view full) ---

578 tap_base = tap;
579
580 /* XXX What is this intended to do? */
581 if (cpu_is_omap34xx())
582 tap_prod_id = 0x0210;
583 else
584 tap_prod_id = 0x0208;
585}
27#include <asm/cputype.h>
28
29#include "common.h"
30
31#include "id.h"
32
33#include "soc.h"
34#include "control.h"

--- 548 unchanged lines hidden (view full) ---

583 tap_base = tap;
584
585 /* XXX What is this intended to do? */
586 if (cpu_is_omap34xx())
587 tap_prod_id = 0x0210;
588 else
589 tap_prod_id = 0x0208;
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 */