Skip to content

Commit f046e4a

Browse files
pcercueikrzk
authored andcommitted
memory: jz4780_nemc: Only request IO memory the driver will use
The driver only uses the registers up to offset 0x54. Since the EFUSE registers are in the middle of the NEMC registers, we only request the registers we will use for now - that way the EFUSE driver can probe too. Signed-off-by: Paul Cercueil <[email protected]> Tested-by: H. Nikolaus Schaller <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Krzysztof Kozlowski <[email protected]>
1 parent 4cd87f5 commit f046e4a

File tree

1 file changed

+16
-1
lines changed

1 file changed

+16
-1
lines changed

drivers/memory/jz4780-nemc.c

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88

99
#include <linux/clk.h>
1010
#include <linux/init.h>
11+
#include <linux/io.h>
1112
#include <linux/math64.h>
1213
#include <linux/of.h>
1314
#include <linux/of_address.h>
@@ -22,6 +23,8 @@
2223
#define NEMC_SMCRn(n) (0x14 + (((n) - 1) * 4))
2324
#define NEMC_NFCSR 0x50
2425

26+
#define NEMC_REG_LEN 0x54
27+
2528
#define NEMC_SMCR_SMT BIT(0)
2629
#define NEMC_SMCR_BW_SHIFT 6
2730
#define NEMC_SMCR_BW_MASK (0x3 << NEMC_SMCR_BW_SHIFT)
@@ -288,7 +291,19 @@ static int jz4780_nemc_probe(struct platform_device *pdev)
288291
nemc->dev = dev;
289292

290293
res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
291-
nemc->base = devm_ioremap_resource(dev, res);
294+
295+
/*
296+
* The driver currently only uses the registers up to offset
297+
* NEMC_REG_LEN. Since the EFUSE registers are in the middle of the
298+
* NEMC registers, we only request the registers we will use for now;
299+
* that way the EFUSE driver can probe too.
300+
*/
301+
if (!devm_request_mem_region(dev, res->start, NEMC_REG_LEN, dev_name(dev))) {
302+
dev_err(dev, "unable to request I/O memory region\n");
303+
return -EBUSY;
304+
}
305+
306+
nemc->base = devm_ioremap(dev, res->start, NEMC_REG_LEN);
292307
if (IS_ERR(nemc->base)) {
293308
dev_err(dev, "failed to get I/O memory\n");
294309
return PTR_ERR(nemc->base);

0 commit comments

Comments
 (0)