global: Migrate CONFIG_SYS_FSL* symbols to the CFG_SYS namespace
[platform/kernel/u-boot.git] / arch / arm / lib / cache-pl310.c
index 36c629c..bbaaaa4 100644 (file)
@@ -1,31 +1,15 @@
+// SPDX-License-Identifier: GPL-2.0+
 /*
  * (C) Copyright 2010
  * Texas Instruments, <www.ti.com>
  * Aneesh V <aneesh@ti.com>
- *
- * See file CREDITS for list of people who contributed to this
- * project.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
- * MA 02111-1307 USA
  */
 #include <linux/types.h>
 #include <asm/io.h>
 #include <asm/armv7.h>
 #include <asm/pl310.h>
 #include <config.h>
+#include <common.h>
 
 struct pl310_regs *const pl310 = (struct pl310_regs *)CONFIG_SYS_PL310_BASE;
 
@@ -49,7 +33,7 @@ static void pl310_background_op_all_ways(u32 *op_reg)
        /* Invalidate all ways */
        writel(way_mask, op_reg);
        /* Wait for all ways to be invalidated */
-       while (readl(op_reg) && way_mask)
+       while (readl(op_reg) & way_mask)
                ;
        pl310_cache_sync();
 }
@@ -89,21 +73,23 @@ void v7_outer_cache_inval_range(u32 start, u32 stop)
        u32 pa, line_size = 32;
 
        /*
-        * If start address is not aligned to cache-line flush the first
-        * line to prevent affecting somebody else's buffer
+        * If start address is not aligned to cache-line do not
+        * invalidate the first cache-line
         */
        if (start & (line_size - 1)) {
-               v7_outer_cache_flush_range(start, start + 1);
+               printf("ERROR: %s - start address is not aligned - 0x%08x\n",
+                       __func__, start);
                /* move to next cache line */
                start = (start + line_size - 1) & ~(line_size - 1);
        }
 
        /*
-        * If stop address is not aligned to cache-line flush the last
-        * line to prevent affecting somebody else's buffer
+        * If stop address is not aligned to cache-line do not
+        * invalidate the last cache-line
         */
        if (stop & (line_size - 1)) {
-               v7_outer_cache_flush_range(stop, stop + 1);
+               printf("ERROR: %s - stop address is not aligned - 0x%08x\n",
+                       __func__, stop);
                /* align to the beginning of this cache line */
                stop &= ~(line_size - 1);
        }