mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Sascha Hauer <s.hauer@pengutronix.de>
To: barebox@lists.infradead.org
Subject: [PATCH] ARM i.MX27: initialize MAX
Date: Thu,  8 Dec 2011 10:17:44 +0100	[thread overview]
Message-ID: <1323335864-27895-1-git-send-email-s.hauer@pengutronix.de> (raw)

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
 arch/arm/mach-imx/imx27.c                   |   43 +++++++++++++++++++++++++++
 arch/arm/mach-imx/include/mach/imx27-regs.h |    1 +
 2 files changed, 44 insertions(+), 0 deletions(-)

diff --git a/arch/arm/mach-imx/imx27.c b/arch/arm/mach-imx/imx27.c
index 86039c4..1af291d 100644
--- a/arch/arm/mach-imx/imx27.c
+++ b/arch/arm/mach-imx/imx27.c
@@ -19,6 +19,7 @@
 #include <mach/imx-regs.h>
 #include <sizes.h>
 #include <init.h>
+#include <io.h>
 
 #include "gpio.h"
 
@@ -38,11 +39,53 @@ void *imx_gpio_base[] = {
 
 int imx_gpio_count = ARRAY_SIZE(imx_gpio_base) * 32;
 
+/*
+ * Initialize MAX on i.MX27. necessary to give the DMA engine
+ * higher priority to the memory than the CPU. Needed for proper
+ * audio support
+ */
+#define MAX_SLAVE_MPR_OFFSET	0x0	/* Master Priority register */
+#define MAX_SLAVE_AMPR_OFFSET	0x4	/* Alternate Master Priority register */
+#define MAX_SLAVE_PORT0_OFFSET	0x0
+#define MAX_SLAVE_PORT1_OFFSET	0x100
+#define MAX_SLAVE_PORT2_OFFSET	0x200
+#define MAX_MASTER_PRIO(master, prio)	(((prio) << (master) * 4))
+
+#define MASTER_IAHB	0
+#define MASTER_DAHB	1
+#define MASTER_EMMA	2
+#define MASTER_DMA	3
+#define MASTER_SLDC	4
+#define MASTER_CODEC	5
+
+static void imx27_init_max(void)
+{
+	void __iomem *max_base = (void *)IMX_MAX_BASE;
+	u32 val;
+
+	/* 0 is the highest priority */
+	val = MAX_MASTER_PRIO(MASTER_IAHB, 5) |
+		MAX_MASTER_PRIO(MASTER_DAHB, 4) |
+		MAX_MASTER_PRIO(MASTER_EMMA, 1) |
+		MAX_MASTER_PRIO(MASTER_DMA, 2) |
+		MAX_MASTER_PRIO(MASTER_SLDC, 0) |
+		MAX_MASTER_PRIO(MASTER_CODEC, 3);
+
+	writel(val, max_base + MAX_SLAVE_PORT0_OFFSET + MAX_SLAVE_MPR_OFFSET);
+	writel(val, max_base + MAX_SLAVE_PORT1_OFFSET + MAX_SLAVE_MPR_OFFSET);
+	writel(val, max_base + MAX_SLAVE_PORT2_OFFSET + MAX_SLAVE_MPR_OFFSET);
+	writel(val, max_base + MAX_SLAVE_PORT0_OFFSET + MAX_SLAVE_AMPR_OFFSET);
+	writel(val, max_base + MAX_SLAVE_PORT1_OFFSET + MAX_SLAVE_AMPR_OFFSET);
+	writel(val, max_base + MAX_SLAVE_PORT2_OFFSET + MAX_SLAVE_AMPR_OFFSET);
+}
+
 static int imx27_init(void)
 {
 	add_generic_device("imx_iim", 0, NULL, IMX_IIM_BASE, SZ_4K,
 			IORESOURCE_MEM, NULL);
 
+	imx27_init_max();
+
 	return 0;
 }
 coredevice_initcall(imx27_init);
diff --git a/arch/arm/mach-imx/include/mach/imx27-regs.h b/arch/arm/mach-imx/include/mach/imx27-regs.h
index 6754c5a..3a4325e 100644
--- a/arch/arm/mach-imx/include/mach/imx27-regs.h
+++ b/arch/arm/mach-imx/include/mach/imx27-regs.h
@@ -33,6 +33,7 @@
 #define IMX_IIM_BASE               (0x28000 + IMX_IO_BASE)
 #define IMX_OTG_BASE               (0x24000 + IMX_IO_BASE)
 #define IMX_FEC_BASE               (0x2b000 + IMX_IO_BASE)
+#define IMX_MAX_BASE               (0x3f000 + IMX_IO_BASE)
 
 #define IMX_NFC_BASE               (0xd8000000)
 #define IMX_ESD_BASE               (0xd8001000)
-- 
1.7.7.3


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

             reply	other threads:[~2011-12-08  9:17 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-12-08  9:17 Sascha Hauer [this message]
2011-12-08 14:24 ` Jean-Christophe PLAGNIOL-VILLARD
2011-12-09  8:06   ` Sascha Hauer
2011-12-09 10:46     ` Jean-Christophe PLAGNIOL-VILLARD
2011-12-09 11:29       ` Sascha Hauer

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=1323335864-27895-1-git-send-email-s.hauer@pengutronix.de \
    --to=s.hauer@pengutronix.de \
    --cc=barebox@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