]> git.kernelconcepts.de Git - karo-tx-uboot.git/blobdiff - arch/powerpc/cpu/mpc8xxx/law.c
Merge branch 'u-boot-imx/master' into 'u-boot-arm/master'
[karo-tx-uboot.git] / arch / powerpc / cpu / mpc8xxx / law.c
index ce1d71e307a02f081e8222392a5bc53b845f574b..a401083107794cc3dd218cf88e7edc58c7858063 100644 (file)
@@ -4,23 +4,7 @@
  * (C) Copyright 2000
  * Wolfgang Denk, DENX Software Engineering, wd@denx.de.
  *
- * 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
+ * SPDX-License-Identifier:    GPL-2.0+
  */
 
 #include <common.h>
@@ -69,7 +53,7 @@ static inline void set_law_base_addr(int idx, phys_addr_t addr)
 
 void set_law(u8 idx, phys_addr_t addr, enum law_size sz, enum law_trgt_if id)
 {
-       gd->used_laws |= (1 << idx);
+       gd->arch.used_laws |= (1 << idx);
 
        out_be32(LAWAR_ADDR(idx), 0);
        set_law_base_addr(idx, addr);
@@ -81,7 +65,7 @@ void set_law(u8 idx, phys_addr_t addr, enum law_size sz, enum law_trgt_if id)
 
 void disable_law(u8 idx)
 {
-       gd->used_laws &= ~(1 << idx);
+       gd->arch.used_laws &= ~(1 << idx);
 
        out_be32(LAWAR_ADDR(idx), 0);
        set_law_base_addr(idx, 0);
@@ -92,7 +76,8 @@ void disable_law(u8 idx)
        return;
 }
 
-#if !defined(CONFIG_NAND_SPL) && !defined(CONFIG_SPL_BUILD)
+#if !defined(CONFIG_NAND_SPL) && \
+       (!defined(CONFIG_SPL_BUILD) || !defined(CONFIG_SPL_INIT_MINIMAL))
 static int get_law_entry(u8 i, struct law_entry *e)
 {
        u32 lawar;
@@ -112,7 +97,7 @@ static int get_law_entry(u8 i, struct law_entry *e)
 
 int set_next_law(phys_addr_t addr, enum law_size sz, enum law_trgt_if id)
 {
-       u32 idx = ffz(gd->used_laws);
+       u32 idx = ffz(gd->arch.used_laws);
 
        if (idx >= FSL_HW_NUM_LAWS)
                return -1;
@@ -122,17 +107,18 @@ int set_next_law(phys_addr_t addr, enum law_size sz, enum law_trgt_if id)
        return idx;
 }
 
-#if !defined(CONFIG_NAND_SPL) && !defined(CONFIG_SPL_BUILD)
+#if !defined(CONFIG_NAND_SPL) && \
+       (!defined(CONFIG_SPL_BUILD) || !defined(CONFIG_SPL_INIT_MINIMAL))
 int set_last_law(phys_addr_t addr, enum law_size sz, enum law_trgt_if id)
 {
        u32 idx;
 
        /* we have no LAWs free */
-       if (gd->used_laws == -1)
+       if (gd->arch.used_laws == -1)
                return -1;
 
        /* grab the last free law */
-       idx = __ilog2(~(gd->used_laws));
+       idx = __ilog2(~(gd->arch.used_laws));
 
        if (idx >= FSL_HW_NUM_LAWS)
                return -1;
@@ -240,9 +226,9 @@ void init_laws(void)
        int i;
 
 #if FSL_HW_NUM_LAWS < 32
-       gd->used_laws = ~((1 << FSL_HW_NUM_LAWS) - 1);
+       gd->arch.used_laws = ~((1 << FSL_HW_NUM_LAWS) - 1);
 #elif FSL_HW_NUM_LAWS == 32
-       gd->used_laws = 0;
+       gd->arch.used_laws = 0;
 #else
 #error FSL_HW_NUM_LAWS can not be greater than 32 w/o code changes
 #endif
@@ -255,7 +241,7 @@ void init_laws(void)
                u32 lawar = in_be32(LAWAR_ADDR(i));
 
                if (lawar & LAW_EN)
-                       gd->used_laws |= (1 << i);
+                       gd->arch.used_laws |= (1 << i);
        }
 
 #if (defined(CONFIG_NAND_U_BOOT) && !defined(CONFIG_NAND_SPL)) || \