mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Robert Jarzmik <robert.jarzmik@free.fr>
To: barebox@lists.infradead.org
Subject: [PATCH] arch/arm: mmu: add map_io_range()
Date: Mon, 19 Dec 2011 10:17:21 +0100	[thread overview]
Message-ID: <1324286241-23083-5-git-send-email-robert.jarzmik@free.fr> (raw)
In-Reply-To: <1324286241-23083-1-git-send-email-robert.jarzmik@free.fr>

Add a function to remap an IO range into a virtual addresses
range. This is particulary usefull for the few devices
mapped at physical address 0, as the MTD boot devices.

Signed-off-by: Robert Jarzmik <robert.jarzmik@free.fr>
---
 arch/arm/cpu/mmu.c         |   12 ++++++++++++
 arch/arm/include/asm/mmu.h |    6 ++++++
 2 files changed, 18 insertions(+), 0 deletions(-)

diff --git a/arch/arm/cpu/mmu.c b/arch/arm/cpu/mmu.c
index 8e4e81a..c6c91df 100644
--- a/arch/arm/cpu/mmu.c
+++ b/arch/arm/cpu/mmu.c
@@ -111,6 +111,18 @@ static void remap_range(void *_start, size_t size, uint32_t flags)
 	tlb_invalidate();
 }
 
+void *map_io_sections(unsigned long phys, void *_start, size_t size)
+{
+	unsigned long start = (unsigned long)_start, sec;
+
+	phys >>= 20;
+	for (sec = start; sec < start + size; sec += (1 << 20))
+		ttb[sec >> 20] = (phys++ << 20) | PMD_SECT_DEF_UNCACHED;
+
+	tlb_invalidate();
+	return _start;
+}
+
 /*
  * remap the memory bank described by mem cachable and
  * bufferable
diff --git a/arch/arm/include/asm/mmu.h b/arch/arm/include/asm/mmu.h
index 9ca5e2a..f5ae7a8 100644
--- a/arch/arm/include/asm/mmu.h
+++ b/arch/arm/include/asm/mmu.h
@@ -32,6 +32,7 @@ void dma_flush_range(unsigned long, unsigned long);
 void dma_inv_range(unsigned long, unsigned long);
 unsigned long virt_to_phys(void *virt);
 void *phys_to_virt(unsigned long phys);
+void *map_io_sections(unsigned long physaddr, void *start, size_t size);
 
 #else
 static inline void *dma_alloc_coherent(size_t size)
@@ -66,6 +67,11 @@ static inline void dma_inv_range(unsigned long s, unsigned long e)
 {
 }
 
+static inline void *map_io_sections(unsigned long phys, void *start, size_t size)
+{
+	return (void *)phys;
+}
+
 #endif
 
 #ifdef CONFIG_CACHE_L2X0
-- 
1.7.5.4


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

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

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-12-19  9:17 [PATCH] usb/gadget: add special treatment for PXA cpus Robert Jarzmik
2011-12-19  9:17 ` [PATCH] drivers/mci: pxa writedata timeout Robert Jarzmik
2011-12-19  9:17 ` [PATCH] drivers/mci: pxa read data performance boost Robert Jarzmik
2011-12-19  9:17 ` [PATCH] commands: add hexdump command Robert Jarzmik
2011-12-19 11:29   ` Antony Pavlov
2011-12-19 12:15     ` Robert Jarzmik
2011-12-19  9:17 ` Robert Jarzmik [this message]

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=1324286241-23083-5-git-send-email-robert.jarzmik@free.fr \
    --to=robert.jarzmik@free.fr \
    --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