mirror of
git://projects.qi-hardware.com/openwrt-xburst.git
synced 2024-11-29 00:05:54 +02:00
fc54b9bf15
(stable-branch of Openmoko) git-svn-id: svn://svn.openwrt.org/openwrt/trunk@13613 3c298f89-4303-0410-b956-a3cf2f4a3e73
134 lines
3.3 KiB
Diff
134 lines
3.3 KiB
Diff
From dda4110e4b365da5a520e8c2e3964d556206881d Mon Sep 17 00:00:00 2001
|
|
From: warmcat <andy@warmcat.com>
|
|
Date: Sun, 13 Apr 2008 07:25:52 +0100
|
|
Subject: [PATCH] debug-glamo-dump-regs.patch
|
|
From: Andy Green <andy@openmoko.com>
|
|
|
|
Sigend-off-by: Andy Green <andy@openmoko.com>
|
|
---
|
|
drivers/mfd/glamo/glamo-core.c | 91 +++++++++++++++++++++++++++++++++++++++-
|
|
1 files changed, 90 insertions(+), 1 deletions(-)
|
|
|
|
diff --git a/drivers/mfd/glamo/glamo-core.c b/drivers/mfd/glamo/glamo-core.c
|
|
index 4d8e47f..accd933 100644
|
|
--- a/drivers/mfd/glamo/glamo-core.c
|
|
+++ b/drivers/mfd/glamo/glamo-core.c
|
|
@@ -977,10 +977,92 @@ static int glamo_supported(struct glamo_core *glamo)
|
|
return 1;
|
|
}
|
|
|
|
+static ssize_t regs_write(struct device *dev, struct device_attribute *attr,
|
|
+ const char *buf, size_t count)
|
|
+{
|
|
+ unsigned long reg = simple_strtoul(buf, NULL, 10);
|
|
+ struct glamo_core *glamo = dev_get_drvdata(dev);
|
|
+
|
|
+ while (*buf && (*buf != ' '))
|
|
+ buf++;
|
|
+ if (*buf != ' ')
|
|
+ return -EINVAL;
|
|
+ while (*buf && (*buf == ' '))
|
|
+ buf++;
|
|
+ if (!*buf)
|
|
+ return -EINVAL;
|
|
+
|
|
+ printk(KERN_INFO"reg 0x%02lX <-- 0x%04lX\n",
|
|
+ reg, simple_strtoul(buf, NULL, 10));
|
|
+
|
|
+ __reg_write(glamo, reg, simple_strtoul(buf, NULL, 10));
|
|
+
|
|
+ return count;
|
|
+}
|
|
+
|
|
+static ssize_t regs_read(struct device *dev, struct device_attribute *attr,
|
|
+ char *buf)
|
|
+{
|
|
+ struct glamo_core *glamo = dev_get_drvdata(dev);
|
|
+ int n, n1 = 0, r;
|
|
+ char * end = buf;
|
|
+ struct reg_range {
|
|
+ int start;
|
|
+ int count;
|
|
+ char * name;
|
|
+ };
|
|
+ struct reg_range reg_range[] = {
|
|
+ { 0x0000, 0x200, "General" },
|
|
+ { 0x0200, 0x100, "Host Bus" },
|
|
+ { 0x0300, 0x100, "Memory" },
|
|
+/* { 0x0400, 0x100, "Sensor" },
|
|
+ { 0x0500, 0x300, "ISP" },
|
|
+ { 0x0800, 0x400, "JPEG" },
|
|
+ { 0x0c00, 0x500, "MPEG" },
|
|
+ { 0x1100, 0x400, "LCD" },
|
|
+ { 0x1500, 0x080, "MPU 0" },
|
|
+ { 0x1580, 0x080, "MPU 1" },
|
|
+ { 0x1600, 0x080, "Command Queue" },
|
|
+ { 0x1680, 0x080, "RISC CPU" },
|
|
+ { 0x1700, 0x400, "2D Unit" },
|
|
+ { 0x1b00, 0x900, "3D Unit" },
|
|
+*/
|
|
+ };
|
|
+
|
|
+ spin_lock(&glamo->lock);
|
|
+
|
|
+ for (r = 0; r < ARRAY_SIZE(reg_range); r++) {
|
|
+ n1 = 0;
|
|
+ end += sprintf(end, "\n%s\n\n", reg_range[r].name);
|
|
+ for (n = reg_range[r].start;
|
|
+ n < reg_range[r].start + reg_range[r].count; n += 2) {
|
|
+ if (((n1++) & 7) == 0)
|
|
+ end += sprintf(end, "\n%04X: ",
|
|
+ n + reg_range[r].start);
|
|
+ end += sprintf(end, "%04x ", __reg_read(glamo, n));
|
|
+ }
|
|
+ end += sprintf(end, "\n");
|
|
+ }
|
|
+ spin_unlock(&glamo->lock);
|
|
+
|
|
+ return end - buf;
|
|
+}
|
|
+
|
|
+static DEVICE_ATTR(regs, 0644, regs_read, regs_write);
|
|
+static struct attribute *glamo_sysfs_entries[] = {
|
|
+ &dev_attr_regs.attr,
|
|
+ NULL
|
|
+};
|
|
+static struct attribute_group glamo_attr_group = {
|
|
+ .name = NULL,
|
|
+ .attrs = glamo_sysfs_entries,
|
|
+};
|
|
+
|
|
+
|
|
|
|
static int __init glamo_probe(struct platform_device *pdev)
|
|
{
|
|
- int rc, irq;
|
|
+ int rc = 0, irq;
|
|
struct glamo_core *glamo;
|
|
|
|
if (glamo_handle) {
|
|
@@ -1080,6 +1162,12 @@ static int __init glamo_probe(struct platform_device *pdev)
|
|
goto out_free;
|
|
}
|
|
|
|
+ rc = sysfs_create_group(&pdev->dev.kobj, &glamo_attr_group);
|
|
+ if (rc < 0) {
|
|
+ dev_err(&pdev->dev, "cannot create sysfs group\n");
|
|
+ goto out_free;
|
|
+ }
|
|
+
|
|
platform_set_drvdata(pdev, glamo);
|
|
|
|
dev_dbg(&glamo->pdev->dev, "running init script\n");
|
|
@@ -1103,6 +1191,7 @@ static int __init glamo_probe(struct platform_device *pdev)
|
|
glamo->irq_works = 1;
|
|
} else
|
|
glamo->irq_works = 0;
|
|
+
|
|
return 0;
|
|
|
|
out_free:
|
|
--
|
|
1.5.6.5
|
|
|