]> git.openfabrics.org - ~emulex/infiniband.git/commitdiff
sh: Handle early ioremaps through fixed mappings.
authorPaul Mundt <lethal@linux-sh.org>
Mon, 18 Jan 2010 12:08:32 +0000 (21:08 +0900)
committerPaul Mundt <lethal@linux-sh.org>
Mon, 18 Jan 2010 12:08:32 +0000 (21:08 +0900)
This adds in a mem_init_done to work out when a standard ioremap() is
possible, falling back to the fixmap based ioremap otherwise.

Signed-off-by: Paul Mundt <lethal@linux-sh.org>
arch/sh/include/asm/processor.h
arch/sh/mm/init.c
arch/sh/mm/ioremap_32.c

index 017e0c1807b263fe864a04d775e0eef502c59985..a522e5d8f44ffa88d6e99aeee2630b2b0d51a81b 100644 (file)
@@ -101,6 +101,9 @@ struct seq_operations;
 
 extern struct pt_regs fake_swapper_regs;
 
+/* arch/sh/mm/init.c */
+extern unsigned int mem_init_done;
+
 /* arch/sh/kernel/setup.c */
 const char *get_cpu_subtype(struct sh_cpuinfo *c);
 extern const struct seq_operations cpuinfo_op;
index 30a9b530d4568802a81149732031cb67db3d2dc0..fe578a286fdd7fdb0930b9e139c5c35817640f11 100644 (file)
@@ -237,6 +237,8 @@ static void __init iommu_init(void)
        no_iommu_init();
 }
 
+unsigned int mem_init_done = 0;
+
 void __init mem_init(void)
 {
        int codesize, datasize, initsize;
@@ -287,6 +289,8 @@ void __init mem_init(void)
 
        /* Initialize the vDSO */
        vsyscall_init();
+
+       mem_init_done = 1;
 }
 
 void free_initmem(void)
index c80a8166fbb0fcf75204c2d0056658f35d399bbe..24f6ba6bff715d4233a5e04dedaea584621db0b3 100644 (file)
@@ -1,13 +1,13 @@
 /*
  * arch/sh/mm/ioremap.c
  *
+ * (C) Copyright 1995 1996 Linus Torvalds
+ * (C) Copyright 2005 - 2010  Paul Mundt
+ *
  * Re-map IO memory to kernel address space so that we can access it.
  * This is needed for high PCI addresses that aren't mapped in the
  * 640k-1MB IO memory area on PC's
  *
- * (C) Copyright 1995 1996 Linus Torvalds
- * (C) Copyright 2005, 2006 Paul Mundt
- *
  * This file is subject to the terms and conditions of the GNU General
  * Public License. See the file "COPYING" in the main directory of this
  * archive for more details.
@@ -64,6 +64,12 @@ void __iomem *__ioremap_caller(unsigned long phys_addr, unsigned long size,
        phys_addr &= PAGE_MASK;
        size = PAGE_ALIGN(last_addr+1) - phys_addr;
 
+       /*
+        * If we can't yet use the regular approach, go the fixmap route.
+        */
+       if (!mem_init_done)
+               return ioremap_fixed(phys_addr, size, __pgprot(flags));
+
        /*
         * Ok, go for it..
         */