From: tony@atomide.com (Tony Lindgren)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 05/12] omap: mailbox: Execute softreset at startup
Date: Thu, 24 Sep 2009 16:38:04 -0700 [thread overview]
Message-ID: <20090924233804.6065.32615.stgit@localhost> (raw)
In-Reply-To: <20090924233027.6065.95725.stgit@localhost>
From: Hiroshi DOYU <Hiroshi.DOYU@nokia.com>
The softreset at startup is introduced as TRM describes and also some
register bit definitions are added instead of magic number.
Signed-off-by: Hiroshi DOYU <Hiroshi.DOYU@nokia.com>
Signed-off-by: Tony Lindgren <tony@atomide.com>
---
arch/arm/mach-omap2/mailbox.c | 30 +++++++++++++++++++++++++-----
1 files changed, 25 insertions(+), 5 deletions(-)
diff --git a/arch/arm/mach-omap2/mailbox.c b/arch/arm/mach-omap2/mailbox.c
index 6f71f37..5bf9a2f 100644
--- a/arch/arm/mach-omap2/mailbox.c
+++ b/arch/arm/mach-omap2/mailbox.c
@@ -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);
next prev parent reply other threads:[~2009-09-24 23:38 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-09-24 23:31 [PATCH 00/12] Omap fixes for 2.6.32-rc1 Tony Lindgren
2009-09-24 23:32 ` [PATCH 01/12] omap: Fix compile for arch/arm/mach-omap2 Tony Lindgren
2009-09-24 23:34 ` [PATCH 02/12] omap: Fix mcspi compile for 2420 Tony Lindgren
2009-09-24 23:35 ` [PATCH 03/12] omap: Fix 44xx compile Tony Lindgren
2009-09-24 23:36 ` [PATCH 04/12] omap: Add missing mux pin for EHCI phy reset line Tony Lindgren
2009-09-24 23:38 ` Tony Lindgren [this message]
2009-09-24 23:39 ` [PATCH 06/12] omap: mailbox: Flush posted write when acking mailbox irq Tony Lindgren
2009-09-25 7:12 ` Artem Bityutskiy
2009-09-25 15:51 ` Tony Lindgren
2009-09-24 23:40 ` [PATCH 07/12] omap: iovmm: Fix compiler warning Tony Lindgren
2009-09-24 23:41 ` [PATCH 08/12] omap: Fix wrong jtag_id for 850 Tony Lindgren
2009-09-24 23:43 ` [PATCH 09/12] omap: Fix a OMAP_MPUIO_VBASE typo " Tony Lindgren
2009-09-24 23:44 ` [PATCH 10/12] omap: Fix matrix_keymap_data usage Tony Lindgren
2009-09-24 23:45 ` [PATCH 11/12] omap: Fix MMC gpio_wp for BeagleBoard C2 and above Tony Lindgren
2009-09-24 23:47 ` [PATCH 12/12] omap: rng: Use resource_size instead of manual calculation Tony Lindgren
2009-09-28 16:26 ` [PATCH 13/12] omap: mailbox: Fix wrong condition check in while loop Tony Lindgren
2009-09-28 16:39 ` [PATCH 13/12] omap: Fix wrong condition check in while loop for mailbox and iommu2 Tony Lindgren
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20090924233804.6065.32615.stgit@localhost \
--to=tony@atomide.com \
--cc=linux-arm-kernel@lists.infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).