board: fix ioremap call fail issue

PD#169652: board: fix ioremap call fail issue

for arm 32, ioremap will check if page is mapped

Change-Id: Icb5dda1b9de06d32e47c82a6bc45b62873332487
Signed-off-by: Ao Xu <ao.xu@amlogic.com>
This commit is contained in:
Ao Xu
2018-08-02 15:42:02 +08:00
committed by Jianxin Pan
parent c2c2825f0b
commit 73cde5ceaf
2 changed files with 33 additions and 9 deletions

View File

@@ -37,7 +37,7 @@ static long phy_out_base;
#ifdef CONFIG_ARM64
#define IN_SIZE 0x1000
#else
#define IN_SIZE 0x8000
#define IN_SIZE 0x1000
#endif
#define OUT_SIZE 0x1000
static DEFINE_MUTEX(sharemem_mutex);
@@ -87,12 +87,22 @@ static int secmon_probe(struct platform_device *pdev)
}
pr_info("get page:%p, %lx\n", page, page_to_pfn(page));
sharemem_in_base = ioremap_cache(phy_in_base, IN_SIZE);
if (pfn_valid(__phys_to_pfn(phy_in_base)))
sharemem_in_base = (void __iomem *)__phys_to_virt(phy_in_base);
else
sharemem_in_base = ioremap_cache(phy_in_base, IN_SIZE);
if (!sharemem_in_base) {
pr_info("secmon share mem in buffer remap fail!\n");
return -ENOMEM;
}
sharemem_out_base = ioremap_cache(phy_out_base, OUT_SIZE);
if (pfn_valid(__phys_to_pfn(phy_out_base)))
sharemem_out_base = (void __iomem *)
__phys_to_virt(phy_out_base);
else
sharemem_out_base = ioremap_cache(phy_out_base, OUT_SIZE);
if (!sharemem_out_base) {
pr_info("secmon share mem out buffer remap fail!\n");
return -ENOMEM;

View File

@@ -370,12 +370,26 @@ static int storage_probe(struct platform_device *pdev)
storage_out_base = NULL;
storage_block_base = NULL;
} else {
storage_in_base = ioremap_cache(phy_storage_in_base,
storage_block_size);
storage_out_base = ioremap_cache(phy_storage_out_base,
storage_block_size);
storage_block_base = ioremap_cache(phy_storage_block_base,
storage_block_size);
if (pfn_valid(__phys_to_pfn(phy_storage_in_base)))
storage_in_base = (void __iomem *)
__phys_to_virt(phy_storage_in_base);
else
storage_in_base = ioremap_cache(
phy_storage_in_base, storage_block_size);
if (pfn_valid(__phys_to_pfn(phy_storage_out_base)))
storage_out_base = (void __iomem *)
__phys_to_virt(phy_storage_out_base);
else
storage_out_base = ioremap_cache(
phy_storage_out_base, storage_block_size);
if (pfn_valid(__phys_to_pfn(phy_storage_block_base)))
storage_block_base = (void __iomem *)
__phys_to_virt(phy_storage_block_base);
else
storage_block_base = ioremap_cache(
phy_storage_block_base, storage_block_size);
}
pr_info("storage in base: 0x%lx\n", (long)storage_in_base);