+ sm501-check-sm501-id-register-on-initialisation.patch added to -mm tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



The patch titled
     SM501: Check SM501 ID register on initialisation
has been added to the -mm tree.  Its filename is
     sm501-check-sm501-id-register-on-initialisation.patch

*** Remember to use Documentation/SubmitChecklist when testing your code ***

See http://www.zip.com.au/~akpm/linux/patches/stuff/added-to-mm.txt to find
out what to do about this

------------------------------------------------------
Subject: SM501: Check SM501 ID register on initialisation
From: Ben Dooks <ben-linux@xxxxxxxxx>

When binding the driver, check the ID register for a valid identity, in case
the SM501 is not functioning correctly.

Signed-off-by: Ben Dooks <ben-linux@xxxxxxxxx>
Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx>
---

 drivers/mfd/sm501.c        |   14 ++++++++++----
 include/linux/sm501-regs.h |    3 +++
 2 files changed, 13 insertions(+), 4 deletions(-)

diff -puN drivers/mfd/sm501.c~sm501-check-sm501-id-register-on-initialisation drivers/mfd/sm501.c
--- a/drivers/mfd/sm501.c~sm501-check-sm501-id-register-on-initialisation
+++ a/drivers/mfd/sm501.c
@@ -893,6 +893,7 @@ static int sm501_init_dev(struct sm501_d
 {
 	resource_size_t mem_avail;
 	unsigned long dramctrl;
+	unsigned long devid;
 	int ret;
 
 	mutex_init(&sm->clock_lock);
@@ -900,13 +901,18 @@ static int sm501_init_dev(struct sm501_d
 
 	INIT_LIST_HEAD(&sm->devices);
 
-	dramctrl = readl(sm->regs + SM501_DRAM_CONTROL);
+	devid = readl(sm->regs + SM501_DEVICEID);
 
+	if ((devid & SM501_DEVICEID_IDMASK) != SM501_DEVICEID_SM501) {
+		dev_err(sm->dev, "incorrect device id %08lx\n", devid);
+		return -EINVAL;
+	}
+
+	dramctrl = readl(sm->regs + SM501_DRAM_CONTROL);
 	mem_avail = sm501_mem_local[(dramctrl >> 13) & 0x7];
 
-	dev_info(sm->dev, "SM501 At %p: Version %08x, %ld Mb, IRQ %d\n",
-		 sm->regs, readl(sm->regs + SM501_DEVICEID),
-		 (unsigned long)mem_avail >> 20, sm->irq);
+	dev_info(sm->dev, "SM501 At %p: Version %08lx, %ld Mb, IRQ %d\n",
+		 sm->regs, devid, (unsigned long)mem_avail >> 20, sm->irq);
 
 	sm501_dump_gate(sm);
 
diff -puN include/linux/sm501-regs.h~sm501-check-sm501-id-register-on-initialisation include/linux/sm501-regs.h
--- a/include/linux/sm501-regs.h~sm501-check-sm501-id-register-on-initialisation
+++ a/include/linux/sm501-regs.h
@@ -109,6 +109,9 @@
 #define SM501_DEVICEID			(0x000060)
 /* 0x050100A0 */
 
+#define SM501_DEVICEID_SM501		(0x05010000)
+#define SM501_DEVICEID_IDMASK		(0xffff0000)
+
 #define SM501_PLLCLOCK_COUNT		(0x000064)
 #define SM501_MISC_TIMING		(0x000068)
 #define SM501_CURRENT_SDRAM_CLOCK	(0x00006C)
_

Patches currently in -mm which might be from ben-linux@xxxxxxxxx are

spi-tle620x-power-switch-driver.patch
sm501-suspend-support.patch
sm501-suspend-support-fix.patch
sm501-initialise-sdram-clock-before-bus-clocks.patch
sm501-fix-sm501_init_reg-mask-set-order.patch
sm501-clock-updates-and-checks.patch
sm501-clock-updates-and-checks-fix.patch
sm501-add-documentation-sm501txt.patch
sm501-check-sm501-id-register-on-initialisation.patch

-
To unsubscribe from this list: send the line "unsubscribe mm-commits" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Kernel Newbies FAQ]     [Kernel Archive]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [Bugtraq]     [Photo]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]

  Powered by Linux