]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - arch/arm/plat-omap/fb.c
OMAPFB: fix printing of reserved memory
[linux-2.6-omap-h63xx.git] / arch / arm / plat-omap / fb.c
index 8441e5057597b22ede8c576971e9b4b14ed1111d..7af9e91ee677c46fb24e8d76a58751491ff0b3ba 100644 (file)
 
 #include <linux/module.h>
 #include <linux/kernel.h>
+#include <linux/mm.h>
 #include <linux/init.h>
 #include <linux/platform_device.h>
 #include <linux/bootmem.h>
 
-#include <asm/hardware.h>
+#include <mach/hardware.h>
 #include <asm/io.h>
-#include <asm/mach-types.h>
 #include <asm/mach/map.h>
 
-#include <asm/arch/board.h>
-#include <asm/arch/sram.h>
-#include <asm/arch/omapfb.h>
+#include <mach/board.h>
+#include <mach/sram.h>
+#include <mach/omapfb.h>
 
 #if defined(CONFIG_FB_OMAP) || defined(CONFIG_FB_OMAP_MODULE)
 
@@ -86,7 +86,8 @@ static int fbmem_region_reserved(unsigned long start, size_t size)
        return 0;
 }
 
-/* Get the region_idx`th region from board config/ATAG and convert it to
+/*
+ * Get the region_idx`th region from board config/ATAG and convert it to
  * our internal format.
  */
 static int get_fbmem_region(int region_idx, struct omapfb_mem_region *rg)
@@ -100,7 +101,8 @@ static int get_fbmem_region(int region_idx, struct omapfb_mem_region *rg)
                return -ENOENT;
 
        paddr = conf->start;
-       /* Low bits encode the page allocation mode, if high bits
+       /*
+        * Low bits encode the page allocation mode, if high bits
         * are zero. Otherwise we need a page aligned fixed
         * address.
         */
@@ -115,7 +117,8 @@ static int set_fbmem_region_type(struct omapfb_mem_region *rg, int mem_type,
                                  unsigned long mem_start,
                                  unsigned long mem_size)
 {
-       /* Check if the configuration specifies the type explicitly.
+       /*
+        * Check if the configuration specifies the type explicitly.
         * type = 0 && paddr = 0, a default don't care case maps to
         * the SDRAM type.
         */
@@ -150,7 +153,8 @@ static int check_fbmem_region(int region_idx, struct omapfb_mem_region *rg,
                /* Allocate this dynamically, leave paddr 0 for now. */
                return 0;
 
-       /* Fixed region for the given RAM range. Check if it's already
+       /*
+        * Fixed region for the given RAM range. Check if it's already
         * reserved by the FB code or someone else.
         */
        if (fbmem_region_reserved(paddr, size) ||
@@ -163,10 +167,11 @@ static int check_fbmem_region(int region_idx, struct omapfb_mem_region *rg,
        return 0;
 }
 
-/* Called from map_io. We need to call to this early enough so that we
+/*
+ * Called from map_io. We need to call to this early enough so that we
  * can reserve the fixed SDRAM regions before VM could get hold of them.
  */
-void omapfb_reserve_sdram(void)
+void __init omapfb_reserve_sdram(void)
 {
        struct bootmem_data     *bdata;
        unsigned long           sdram_start, sdram_size;
@@ -177,7 +182,7 @@ void omapfb_reserve_sdram(void)
                return;
 
        bdata = NODE_DATA(0)->bdata;
-       sdram_start = bdata->node_boot_start;
+       sdram_start = bdata->node_min_pfn << PAGE_SHIFT;
        sdram_size = (bdata->node_low_pfn << PAGE_SHIFT) - sdram_start;
        reserved = 0;
        for (i = 0; ; i++) {
@@ -201,9 +206,10 @@ void omapfb_reserve_sdram(void)
                        config_invalid = 1;
                        return;
                }
-               if (rg.paddr)
-                       reserve_bootmem(rg.paddr, rg.size);
-               reserved += rg.size;
+               if (rg.paddr) {
+                       reserve_bootmem(rg.paddr, rg.size, BOOTMEM_DEFAULT);
+                       reserved += rg.size;
+               }
                omapfb_config.mem_desc.region[i] = rg;
                configured_regions++;
        }
@@ -213,7 +219,8 @@ void omapfb_reserve_sdram(void)
                         reserved);
 }
 
-/* Called at sram init time, before anything is pushed to the SRAM stack.
+/*
+ * Called at sram init time, before anything is pushed to the SRAM stack.
  * Because of the stack scheme, we will allocate everything from the
  * start of the lowest address region to the end of SRAM. This will also
  * include padding for page alignment and possible holes between regions.
@@ -271,13 +278,13 @@ unsigned long omapfb_reserve_sram(unsigned long sram_pstart,
                        size_avail = (size_avail - rg.size) & PAGE_MASK;
                        rg.paddr = pstart_avail + size_avail;
                }
-               /* Reserve everything above the start of the region.
-                */
+               /* Reserve everything above the start of the region. */
                if (pend_avail - rg.paddr > reserved)
                        reserved = pend_avail - rg.paddr;
                size_avail = pend_avail - reserved - pstart_avail;
 
-               /* We have a kernel mapping for this already, so the
+               /*
+                * We have a kernel mapping for this already, so the
                 * driver won't have to make one.
                 */
                rg.vaddr = (void *)(sram_vstart + rg.paddr - sram_pstart);
@@ -327,9 +334,10 @@ unsigned long omapfb_reserve_sram(unsigned long sram_pstart,
                                  unsigned long sram_vstart,
                                  unsigned long sram_size,
                                  unsigned long start_avail,
-                                 unsigned long size_avail) {}
+                                 unsigned long size_avail)
+{
+       return 0;
+}
 
 
 #endif
-
-