common: Drop net.h from common header
[platform/kernel/u-boot.git] / arch / arm / cpu / pxa / pxa2xx.c
index c9a7d45..ecf85d2 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0+
 /*
  * (C) Copyright 2002
  * Sysgo Real-Time Solutions, GmbH <www.elinos.com>
@@ -6,15 +7,16 @@
  * (C) Copyright 2002
  * Sysgo Real-Time Solutions, GmbH <www.elinos.com>
  * Alex Zuepke <azu@sysgo.de>
- *
- * SPDX-License-Identifier:    GPL-2.0+
  */
 
+#include <common.h>
+#include <cpu_func.h>
+#include <irq_func.h>
+#include <asm/arch/pxa-regs.h>
+#include <asm/cache.h>
 #include <asm/io.h>
 #include <asm/system.h>
 #include <command.h>
-#include <common.h>
-#include <asm/arch/pxa-regs.h>
 
 /* Flush I/D-cache */
 static void cache_flush(void)
@@ -40,13 +42,6 @@ int cleanup_before_linux(void)
        return 0;
 }
 
-void pxa_wait_ticks(int ticks)
-{
-       writel(0, OSCR);
-       while (readl(OSCR) < ticks)
-               asm volatile("" : : : "memory");
-}
-
 inline void writelrb(uint32_t val, uint32_t addr)
 {
        writel(val, addr);
@@ -137,8 +132,11 @@ void pxa2xx_dram_init(void)
 
        writelrb(CONFIG_SYS_MDCNFG_VAL &
                ~(MDCNFG_DE0 | MDCNFG_DE1 | MDCNFG_DE2 | MDCNFG_DE3), MDCNFG);
+
        /* Wait for the clock to the SDRAMs to stabilize, 100..200 usec. */
-       pxa_wait_ticks(0x300);
+       writel(0, OSCR);
+       while (readl(OSCR) < 0x300)
+               asm volatile("" : : : "memory");
 
        /*
         * 8) Trigger a number (usually 8) refresh cycles by attempting
@@ -279,7 +277,18 @@ void reset_cpu(ulong ignored)
        tmp = readl(OSCR);
        tmp += 0x1000;
        writel(tmp, OSMR3);
+       writel(MDREFR_SLFRSH, MDREFR);
 
        for (;;)
                ;
 }
+
+void enable_caches(void)
+{
+#if !CONFIG_IS_ENABLED(SYS_ICACHE_OFF)
+       icache_enable();
+#endif
+#if !CONFIG_IS_ENABLED(SYS_DCACHE_OFF)
+       dcache_enable();
+#endif
+}