115685c480618e0e632d1ff1bfc69c25918c9635
[openwrt/staging/noltari.git] /
1 From 7872505a2194c9766c7986e761c0ae9bdd6e5e57 Mon Sep 17 00:00:00 2001
2 From: Calvin Johnson <calvin.johnson@nxp.com>
3 Date: Tue, 26 Mar 2019 16:52:22 +0530
4 Subject: [PATCH] staging: fsl_ppfe/eth: use memremap() to map RAM area used by
5 PFE
6
7 RAM area used by PFE should be mapped using memremap() instead of
8 directly traslating physical addr to virtual. This will ensure proper
9 checks are done before the area is used.
10
11 Signed-off-by: Calvin Johnson <calvin.johnson@nxp.com>
12 ---
13 drivers/staging/fsl_ppfe/pfe_ls1012a_platform.c | 10 ++++++----
14 1 file changed, 6 insertions(+), 4 deletions(-)
15
16 --- a/drivers/staging/fsl_ppfe/pfe_ls1012a_platform.c
17 +++ b/drivers/staging/fsl_ppfe/pfe_ls1012a_platform.c
18 @@ -148,9 +148,10 @@ static int pfe_platform_probe(struct pla
19 pfe->ddr_phys_baseaddr = res.start;
20 pfe->ddr_size = resource_size(&res);
21
22 - pfe->ddr_baseaddr = phys_to_virt(res.start);
23 + pfe->ddr_baseaddr = memremap(res.start, resource_size(&res),
24 + MEMREMAP_WB);
25 if (!pfe->ddr_baseaddr) {
26 - pr_err("ioremap() ddr failed\n");
27 + pr_err("memremap() ddr failed\n");
28 rc = -ENOMEM;
29 goto err_ddr;
30 }
31 @@ -240,7 +241,7 @@ err_hif_irq:
32 iounmap(pfe->cbus_baseaddr);
33
34 err_axi:
35 - iounmap(pfe->ddr_baseaddr);
36 + memunmap(pfe->ddr_baseaddr);
37
38 err_ddr:
39 platform_set_drvdata(pdev, NULL);
40 @@ -264,7 +265,8 @@ static int pfe_platform_remove(struct pl
41 rc = pfe_remove(pfe);
42
43 iounmap(pfe->cbus_baseaddr);
44 - iounmap(pfe->ddr_baseaddr);
45 +
46 + memunmap(pfe->ddr_baseaddr);
47
48 platform_set_drvdata(pdev, NULL);
49