* [PATCH] ARM i.MX27: initialize MAX
@ 2011-12-08 9:17 Sascha Hauer
2011-12-08 14:24 ` Jean-Christophe PLAGNIOL-VILLARD
0 siblings, 1 reply; 5+ messages in thread
From: Sascha Hauer @ 2011-12-08 9:17 UTC (permalink / raw)
To: barebox
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
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] ARM i.MX27: initialize MAX
2011-12-08 9:17 [PATCH] ARM i.MX27: initialize MAX Sascha Hauer
@ 2011-12-08 14:24 ` Jean-Christophe PLAGNIOL-VILLARD
2011-12-09 8:06 ` Sascha Hauer
0 siblings, 1 reply; 5+ messages in thread
From: Jean-Christophe PLAGNIOL-VILLARD @ 2011-12-08 14:24 UTC (permalink / raw)
To: Sascha Hauer; +Cc: barebox
On 10:17 Thu 08 Dec , Sascha Hauer wrote:
> 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(-)
do we really need this in barebox?
Best Regards,
J.
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] ARM i.MX27: initialize MAX
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
0 siblings, 1 reply; 5+ messages in thread
From: Sascha Hauer @ 2011-12-09 8:06 UTC (permalink / raw)
To: Jean-Christophe PLAGNIOL-VILLARD; +Cc: barebox
On Thu, Dec 08, 2011 at 03:24:33PM +0100, Jean-Christophe PLAGNIOL-VILLARD wrote:
> On 10:17 Thu 08 Dec , Sascha Hauer wrote:
> > 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(-)
> do we really need this in barebox?
Why not? It's basically just a handfull of register accesses which are
normally hidden in lowlevel_init without anybody noticing it. The fact
that I created defines for them just makes it slightly more visible.
Sascha
--
Pengutronix e.K. | |
Industrial Linux Solutions | http://www.pengutronix.de/ |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] ARM i.MX27: initialize MAX
2011-12-09 8:06 ` Sascha Hauer
@ 2011-12-09 10:46 ` Jean-Christophe PLAGNIOL-VILLARD
2011-12-09 11:29 ` Sascha Hauer
0 siblings, 1 reply; 5+ messages in thread
From: Jean-Christophe PLAGNIOL-VILLARD @ 2011-12-09 10:46 UTC (permalink / raw)
To: Sascha Hauer; +Cc: barebox
On 09:06 Fri 09 Dec , Sascha Hauer wrote:
> On Thu, Dec 08, 2011 at 03:24:33PM +0100, Jean-Christophe PLAGNIOL-VILLARD wrote:
> > On 10:17 Thu 08 Dec , Sascha Hauer wrote:
> > > 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(-)
> > do we really need this in barebox?
>
> Why not? It's basically just a handfull of register accesses which are
> normally hidden in lowlevel_init without anybody noticing it. The fact
> that I created defines for them just makes it slightly more visible.
can we have a small comment when they are needed at list
Best Regards,
J.
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] ARM i.MX27: initialize MAX
2011-12-09 10:46 ` Jean-Christophe PLAGNIOL-VILLARD
@ 2011-12-09 11:29 ` Sascha Hauer
0 siblings, 0 replies; 5+ messages in thread
From: Sascha Hauer @ 2011-12-09 11:29 UTC (permalink / raw)
To: Jean-Christophe PLAGNIOL-VILLARD; +Cc: barebox
On Fri, Dec 09, 2011 at 11:46:31AM +0100, Jean-Christophe PLAGNIOL-VILLARD wrote:
> On 09:06 Fri 09 Dec , Sascha Hauer wrote:
> > On Thu, Dec 08, 2011 at 03:24:33PM +0100, Jean-Christophe PLAGNIOL-VILLARD wrote:
> > > On 10:17 Thu 08 Dec , Sascha Hauer wrote:
> > > > 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(-)
> > > do we really need this in barebox?
> >
> > Why not? It's basically just a handfull of register accesses which are
> > normally hidden in lowlevel_init without anybody noticing it. The fact
> > that I created defines for them just makes it slightly more visible.
> can we have a small comment when they are needed at list
What do you mean? The patch has this:
> +/*
> + * Initialize MAX on i.MX27. necessary to give the DMA engine
> + * higher priority to the memory than the CPU. Needed for proper
> + * audio support
> + */
(I agree that this does not necessarily has to be done in barebox, but
my plan is to send a patch for the kernel aswell. This increases the
chance that it is done at least once somewhere)
Sascha
--
Pengutronix e.K. | |
Industrial Linux Solutions | http://www.pengutronix.de/ |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2011-12-09 11:29 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-12-08 9:17 [PATCH] ARM i.MX27: initialize MAX Sascha Hauer
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
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox