all archs: consolidate init and exit sections in vmlinux.lds.h
[cascardo/linux.git] / arch / blackfin / kernel / setup.c
index 934234f..462cae8 100644 (file)
@@ -43,6 +43,7 @@
 #include <asm/cacheflush.h>
 #include <asm/blackfin.h>
 #include <asm/cplbinit.h>
+#include <asm/div64.h>
 #include <asm/fixed_code.h>
 #include <asm/early_printk.h>
 
@@ -237,7 +238,13 @@ void __init setup_arch(char **cmdline_p)
        memory_end = _ramend - DMA_UNCACHED_REGION;
 
        _ramstart = (unsigned long)__bss_stop;
+       _rambase = (unsigned long)_stext;
+#ifdef CONFIG_MPU
+       /* Round up to multiple of 4MB.  */
+       memory_start = (_ramstart + 0x3fffff) & ~0x3fffff;
+#else
        memory_start = PAGE_ALIGN(_ramstart);
+#endif
 
 #if defined(CONFIG_MTD_UCLINUX)
        /* generic memory mapped MTD driver */
@@ -306,6 +313,11 @@ void __init setup_arch(char **cmdline_p)
        printk(KERN_NOTICE "Warning: limiting memory to %liMB due to hardware anomaly 05000263\n", memory_end >> 20);
 #endif                         /* ANOMALY_05000263 */
 
+#ifdef CONFIG_MPU
+       page_mask_nelts = ((_ramend >> PAGE_SHIFT) + 31) / 32;
+       page_mask_order = get_order(3 * page_mask_nelts * sizeof(long));
+#endif
+
 #if !defined(CONFIG_MTD_UCLINUX)
        memory_end -= SIZE_4K; /*In case there is no valid CPLB behind memory_end make sure we don't get to close*/
 #endif
@@ -314,8 +326,6 @@ void __init setup_arch(char **cmdline_p)
        init_mm.end_data = (unsigned long)_edata;
        init_mm.brk = (unsigned long)0;
 
-       init_leds();
-
        _bfin_swrst = bfin_read_SWRST();
 
        if (_bfin_swrst & RESET_DOUBLE)
@@ -504,13 +514,17 @@ EXPORT_SYMBOL(get_sclk);
 
 unsigned long sclk_to_usecs(unsigned long sclk)
 {
-       return (USEC_PER_SEC * (u64)sclk) / get_sclk();
+       u64 tmp = USEC_PER_SEC * (u64)sclk;
+       do_div(tmp, get_sclk());
+       return tmp;
 }
 EXPORT_SYMBOL(sclk_to_usecs);
 
 unsigned long usecs_to_sclk(unsigned long usecs)
 {
-       return (get_sclk() * (u64)usecs) / USEC_PER_SEC;
+       u64 tmp = get_sclk() * (u64)usecs;
+       do_div(tmp, USEC_PER_SEC);
+       return tmp;
 }
 EXPORT_SYMBOL(usecs_to_sclk);