generic: add driver for the RTL8367R/M switches
[openwrt.git] / target / linux / omap35xx / patches-2.6.36 / 001-expose_omap3_die_id.patch
1 diff --git a/arch/arm/mach-omap2/id.c b/arch/arm/mach-omap2/id.c
2 index 9a879f9..9cefef4 100644
3 --- a/arch/arm/mach-omap2/id.c
4 +++ b/arch/arm/mach-omap2/id.c
5 @@ -85,6 +85,9 @@ EXPORT_SYMBOL(omap_type);
6
7 #define read_tap_reg(reg) __raw_readl(tap_base + (reg))
8
9 +static ssize_t die_id_show(struct kobject *, struct kobj_attribute *, char *);
10 +static struct kobj_attribute die_id_attr = __ATTR(die_id, 0444, die_id_show, NULL);
11 +
12 struct omap_id {
13 u16 hawkeye; /* Silicon type (Hawkeye id) */
14 u8 dev; /* Device type from production_id reg */
15 @@ -104,6 +107,17 @@ static struct omap_id omap_ids[] __initdata = {
16 static void __iomem *tap_base;
17 static u16 tap_prod_id;
18
19 +static ssize_t die_id_show(struct kobject *kobj, struct kobj_attribute *attr,
20 + char *buf)
21 +{
22 + return sprintf(buf, "Die ID: %08x%08x%08x%08x\n",
23 + read_tap_reg(OMAP_TAP_DIE_ID_0),
24 + read_tap_reg(OMAP_TAP_DIE_ID_1),
25 + read_tap_reg(OMAP_TAP_DIE_ID_2),
26 + read_tap_reg(OMAP_TAP_DIE_ID_3));
27 +
28 +}
29 +
30 void omap_get_die_id(struct omap_die_id *odi)
31 {
32 odi->id_0 = read_tap_reg(OMAP_TAP_DIE_ID_0);
33 @@ -457,3 +471,15 @@ void __init omap2_set_globals_tap(struct omap_globals *omap2_globals)
34 else
35 tap_prod_id = 0x0208;
36 }
37 +
38 +int __init export_omap_die_id(void)
39 +{
40 + int error;
41 +
42 + error = sysfs_create_file(power_kobj, &die_id_attr.attr);
43 + if (error)
44 + printk(KERN_ERR "sysfs_create_file failed: %d\n", error);
45 + return error;
46 +}
47 +
48 +late_initcall(export_omap_die_id);
This page took 0.055192 seconds and 5 git commands to generate.