2 * Copyright 2008 Freescale Semiconductor, Inc.
5 * Wolfgang Denk, DENX Software Engineering, wd@denx.de.
7 * See file CREDITS for list of people who contributed to this
10 * This program is free software; you can redistribute it and/or
11 * modify it under the terms of the GNU General Public License as
12 * published by the Free Software Foundation; either version 2 of
13 * the License, or (at your option) any later version.
15 * This program is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU General Public License for more details.
20 * You should have received a copy of the GNU General Public License
21 * along with this program; if not, write to the Free Software
22 * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
27 #include <asm/fsl_law.h>
30 #define LAWAR_EN 0x80000000
32 void set_law(u8 idx, phys_addr_t addr, enum law_size sz, enum law_trgt_if id)
34 volatile u32 *base = (volatile u32 *)(CFG_IMMR + 0xc08);
35 volatile u32 *lawbar = base + 8 * idx;
36 volatile u32 *lawar = base + 8 * idx + 2;
38 out_be32(lawbar, addr >> 12);
39 out_be32(lawar, LAWAR_EN | ((u32)id << 20) | (u32)sz);
44 void disable_law(u8 idx)
46 volatile u32 *base = (volatile u32 *)(CFG_IMMR + 0xc08);
47 volatile u32 *lawbar = base + 8 * idx;
48 volatile u32 *lawar = base + 8 * idx + 2;
61 for (i = 0; i < num_law_entries; i++) {
62 if (law_table[i].index != -1)
63 law_idx = law_table[i].index;
65 set_law(law_idx++, law_table[i].addr,
66 law_table[i].size, law_table[i].trgt_id);