Skip to content

Commit bdd7e03

Browse files
author
Roger Quadros
committed
memory: omap-gpmc: Prevent mapping into 1st 16MB
We have been preventing mapping GPMC children in the first 1MB but really it has to be the first 16MB as the minimum GPMC partition size is 16MB. Also print an error message if CS mapping fails due to DT requesting address outside the GPMC map. Signed-off-by: Roger Quadros <rogerq@ti.com> Acked-by: Tony Lindgren <tony@atomide.com>
1 parent 51735ca commit bdd7e03

1 file changed

Lines changed: 18 additions & 6 deletions

File tree

‎drivers/memory/omap-gpmc.c‎

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,14 @@
9494
#define GPMC_CS_SIZE 0x30
9595
#define GPMC_BCH_SIZE 0x10
9696

97+
/*
98+
* The first 1MB of GPMC address space is typically mapped to
99+
* the internal ROM. Never allocate the first page, to
100+
* facilitate bug detection; even if we didn't boot from ROM.
101+
* As GPMC minimum partition size is 16MB we can only start from
102+
* there.
103+
*/
104+
#define GPMC_MEM_START 0x1000000
97105
#define GPMC_MEM_END 0x3FFFFFFF
98106

99107
#define GPMC_CHUNK_SHIFT 24 /* 16 MB */
@@ -1297,12 +1305,7 @@ static void gpmc_mem_init(void)
12971305
{
12981306
int cs;
12991307

1300-
/*
1301-
* The first 1MB of GPMC address space is typically mapped to
1302-
* the internal ROM. Never allocate the first page, to
1303-
* facilitate bug detection; even if we didn't boot from ROM.
1304-
*/
1305-
gpmc_mem_root.start = SZ_1M;
1308+
gpmc_mem_root.start = GPMC_MEM_START;
13061309
gpmc_mem_root.end = GPMC_MEM_END;
13071310

13081311
/* Reserve all regions that has been set up by bootloader */
@@ -1966,6 +1969,15 @@ static int gpmc_probe_generic_child(struct platform_device *pdev,
19661969
if (ret < 0) {
19671970
dev_err(&pdev->dev, "cannot remap GPMC CS %d to %pa\n",
19681971
cs, &res.start);
1972+
if (res.start < GPMC_MEM_START) {
1973+
dev_info(&pdev->dev,
1974+
"GPMC CS %d start cannot be lesser than 0x%x\n",
1975+
cs, GPMC_MEM_START);
1976+
} else if (res.end > GPMC_MEM_END) {
1977+
dev_info(&pdev->dev,
1978+
"GPMC CS %d end cannot be greater than 0x%x\n",
1979+
cs, GPMC_MEM_END);
1980+
}
19691981
goto err;
19701982
}
19711983

0 commit comments

Comments
 (0)