Skip to contentSkip to conversation

omap mailbox: execute softreset at startup

PATCH In review Hiroshi DOYU 2 participants 3 messages Aug 27, 2009 – Sep 22, 2009

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 omap mailbox: execute softreset at startup

From: Hiroshi DOYU <[email protected]>

The softreset at startup is introduced as TRM describes and also some register bit definitions are added instead of magic number.

---
 arch/arm/mach-omap2/mailbox.c |   30 +++++++++++++++++++++++++-----
 1 files changed, 25 insertions(+), 5 deletions(-)
arch/arm/mach-omap2/mailbox.c +25 -5
index 6f71f37..5bf9a2f 100644
@@ -30,6 +30,14 @@
 #define MAILBOX_IRQ_NEWMSG(u)		(1 << (2 * (u)))
 #define MAILBOX_IRQ_NOTFULL(u)		(1 << (2 * (u) + 1))
 
+/* SYSCONFIG: register bit definition */
+#define AUTOIDLE	(1 << 0)
+#define SOFTRESET	(1 << 1)
+#define SMARTIDLE	(2 << 3)
+
+/* SYSSTATUS: register bit definition */
+#define RESETDONE	(1 << 0)
+
 #define MBOX_REG_SIZE			0x120
 #define MBOX_NR_REGS			(MBOX_REG_SIZE / sizeof(u32))
 
@@ -69,21 +77,33 @@ static inline void mbox_write_reg(u32 val, size_t ofs)
 /* Mailbox H/W preparations */
 static int omap2_mbox_startup(struct omap_mbox *mbox)
 {
-	unsigned int l;
+	u32 l;
+	unsigned long timeout;
 
 	mbox_ick_handle = clk_get(NULL, "mailboxes_ick");
 	if (IS_ERR(mbox_ick_handle)) {
-		printk("Could not get mailboxes_ick\n");
+		pr_err("Can't get mailboxes_ick\n");
 		return -ENODEV;
 	}
 	clk_enable(mbox_ick_handle);
 
+	mbox_write_reg(SOFTRESET, MAILBOX_SYSCONFIG);
+	timeout = jiffies + msecs_to_jiffies(20);
+	do {
+		l = mbox_read_reg(MAILBOX_SYSSTATUS);
+		if (l & RESETDONE)
+			break;
+	} while (time_after(jiffies, timeout));
+
+	if (!(l & RESETDONE)) {
+		pr_err("Can't take mmu out of reset\n");
+		return -ENODEV;
+	}
+
 	l = mbox_read_reg(MAILBOX_REVISION);
 	pr_info("omap mailbox rev %d.%d\n", (l & 0xf0) >> 4, (l & 0x0f));
 
-	/* set smart-idle & autoidle */
-	l = mbox_read_reg(MAILBOX_SYSCONFIG);
-	l |= 0x00000011;
+	l = SMARTIDLE | AUTOIDLE;
 	mbox_write_reg(l, MAILBOX_SYSCONFIG);
 
 	omap2_mbox_enable_irq(mbox, IRQ_RX);
Signature · 1 line
1.6.0.4
#1 lore raw

Hi Tony,

From: "Doyu Hiroshi (Nokia-D/Helsinki)" <[email protected]>
Subject: [PATCH 1/1] omap mailbox: execute softreset at startup
Date: Thu, 27 Aug 2009 11:33:32 +0200

Quoted 7 lines

From: Hiroshi DOYU <[email protected]>

The softreset at startup is introduced as TRM describes and also some register bit definitions are added instead of magic number.

---

It seems that this was missing in for-next. Please put this in if there's no problem.

maintainer
#2 lore raw

PATCH 1/1 omap mailbox: execute softreset at startup

In reply to Hiroshi DOYU

This patch has been applied to the linux-omap
by youw fwiendly patch wobot.

Branch in linux-omap: omap-fixes

Initial commit ID (Likely to change): 59e17c93309afd8ee7151d3ff5569e20c3e7367e

PatchWorks
http://patchwork.kernel.org/patch/44224/

Git (Likely to change, and takes a while to get mirrored)
http://git.kernel.org/?p=linux/kernel/git/tmlind/linux-omap-2.6.git;a=commit;h=59e17c93309afd8ee7151d3ff5569e20c3e7367e