diff mbox

OMAP3 PM export chip IDCODE, Production ID and Die ID

Message ID 1255359069-9621-1-git-send-email-peter.de-schrijver@nokia.com (mailing list archive)
State Changes Requested
Delegated to: Kevin Hilman
Headers show

Commit Message

Peter 'p2' De Schrijver Oct. 12, 2009, 2:51 p.m. UTC
None
diff mbox

Patch

diff --git a/arch/arm/mach-omap2/id.c b/arch/arm/mach-omap2/id.c
index 2c5e0a3..97670e2 100644
--- a/arch/arm/mach-omap2/id.c
+++ b/arch/arm/mach-omap2/id.c
@@ -70,6 +70,10 @@  EXPORT_SYMBOL(omap_type);
 /*----------------------------------------------------------------------------*/
 
 #define OMAP_TAP_IDCODE		0x0204
+#define OMAP_TAP_PROD_ID_0      0x0208
+#define OMAP_TAP_PROD_ID_1      0x020c
+#define OMAP_TAP_PROD_ID_2      0x0210
+#define OMAP_TAP_PROD_ID_3      0x0214
 #define OMAP_TAP_DIE_ID_0	0x0218
 #define OMAP_TAP_DIE_ID_1	0x021C
 #define OMAP_TAP_DIE_ID_2	0x0220
@@ -77,6 +81,10 @@  EXPORT_SYMBOL(omap_type);
 
 #define read_tap_reg(reg)	__raw_readl(tap_base  + (reg))
 
+static ssize_t idcode_show(struct kobject *, struct kobj_attribute *, char *);
+static struct kobj_attribute idcode_attr = __ATTR(idcode, 0444, idcode_show,
+							NULL);
+
 struct omap_id {
 	u16	hawkeye;	/* Silicon type (Hawkeye id) */
 	u8	dev;		/* Device type from production_id reg */
@@ -96,6 +104,23 @@  static struct omap_id omap_ids[] __initdata = {
 static void __iomem *tap_base;
 static u16 tap_prod_id;
 
+static ssize_t idcode_show(struct kobject *kobj, struct kobj_attribute *attr,
+				char *buf)
+{
+	return sprintf(buf, "IDCODE: %08x\nProduction ID: %08x %08x %08x %08x\n"
+				"Die ID: %08x %08x %08x %08x\n",
+			read_tap_reg(OMAP_TAP_IDCODE),
+			read_tap_reg(OMAP_TAP_PROD_ID_0),
+			read_tap_reg(OMAP_TAP_PROD_ID_1),
+			read_tap_reg(OMAP_TAP_PROD_ID_2),
+			read_tap_reg(OMAP_TAP_PROD_ID_3),
+			read_tap_reg(OMAP_TAP_DIE_ID_0),
+			read_tap_reg(OMAP_TAP_DIE_ID_1),
+			read_tap_reg(OMAP_TAP_DIE_ID_2),
+			read_tap_reg(OMAP_TAP_DIE_ID_3));
+
+}
+
 void __init omap24xx_check_revision(void)
 {
 	int i, j;
@@ -259,3 +284,14 @@  void __init omap2_set_globals_tap(struct omap_globals *omap2_globals)
 	else
 		tap_prod_id = 0x0208;
 }
+
+void __init export_omapid(void)
+{
+	int error;
+
+	error = sysfs_create_file(power_kobj, &idcode_attr.attr);
+	if (error)
+		printk(KERN_ERR "sysfs_create_file failed: %d\n", error);
+}
+
+late_initcall(export_omapid);