1 // SPDX-License-Identifier: GPL-2.0+
3 * Copyright 2012-2016 Freescale Semiconductor, Inc.
7 #include <asm/fsl_pamu.h>
8 #include <asm/global_data.h>
10 DECLARE_GLOBAL_DATA_PTR;
12 void construct_pamu_addr_table(struct pamu_addr_tbl *tbl, int *num_entries)
18 (uint64_t)virt_to_phys((void *)CFG_SYS_SDRAM_BASE);
19 tbl->size[i] = (phys_size_t)(min(gd->ram_size, CFG_MAX_MEM_MAPPED));
20 tbl->end_addr[i] = tbl->start_addr[i] + tbl->size[i] - 1;
23 #ifdef CFG_SYS_FLASH_BASE_PHYS
25 (uint64_t)virt_to_phys((void *)CFG_SYS_FLASH_BASE_PHYS);
26 tbl->size[i] = 256 * 1024 * 1024; /* 256MB flash */
27 tbl->end_addr[i] = tbl->start_addr[i] + tbl->size[i] - 1;
31 #if (defined(CONFIG_SPL_BUILD) && (CFG_SYS_INIT_L3_VADDR))
33 (uint64_t)virt_to_phys((void *)CFG_SYS_INIT_L3_VADDR);
34 tbl->size[i] = 256 * 1024; /* 256K CPC flash */
35 tbl->end_addr[i] = tbl->start_addr[i] + tbl->size[i] - 1;
39 debug("PAMU address\t\t\tsize\n");
40 for (j = 0; j < i ; j++)
41 debug("%llx \t\t\t%llx\n", tbl->start_addr[j], tbl->size[j]);
46 int sec_config_pamu_table(uint32_t liodn_ns, uint32_t liodn_s)
48 struct pamu_addr_tbl tbl;
52 construct_pamu_addr_table(&tbl, &num_entries);
54 ret = config_pamu(&tbl, num_entries, liodn_ns);
58 ret = config_pamu(&tbl, num_entries, liodn_s);