Message ID | 551a8560261543c1decb1d4d1671ec4b7fa52fdb.1582905653.git.hns@goldelico.com (mailing list archive) |
---|---|
State | Mainlined |
Headers | show |
Series | MIPS: CI20: Add efuse driver for Ingenic JZ4780 and attach to DM9000 for stable MAC addresses | expand |
Greg: Can you take this patch? Since there is no maintainer for drivers/memory/. It still applies fine on top of 5.7-rc1. Cheers, -Paul Le ven. 28 févr. 2020 à 17:00, H. Nikolaus Schaller <hns@goldelico.com> a écrit : > From: Paul Cercueil <paul@crapouillou.net> > > 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. > > Tested-by: H. Nikolaus Schaller <hns@goldelico.com> > Signed-off-by: Paul Cercueil <paul@crapouillou.net> > --- > drivers/memory/jz4780-nemc.c | 15 ++++++++++++++- > 1 file changed, 14 insertions(+), 1 deletion(-) > > diff --git a/drivers/memory/jz4780-nemc.c > b/drivers/memory/jz4780-nemc.c > index b232ed279fc3..647267ea8c63 100644 > --- a/drivers/memory/jz4780-nemc.c > +++ b/drivers/memory/jz4780-nemc.c > @@ -8,6 +8,7 @@ > > #include <linux/clk.h> > #include <linux/init.h> > +#include <linux/io.h> > #include <linux/math64.h> > #include <linux/of.h> > #include <linux/of_address.h> > @@ -288,7 +289,19 @@ static int jz4780_nemc_probe(struct > platform_device *pdev) > nemc->dev = dev; > > res = platform_get_resource(pdev, IORESOURCE_MEM, 0); > - nemc->base = devm_ioremap_resource(dev, res); > + > + /* > + * 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. > + */ > + if (!devm_request_mem_region(dev, res->start, 0x54, dev_name(dev))) > { > + dev_err(dev, "unable to request I/O memory region\n"); > + return -EBUSY; > + } > + > + nemc->base = devm_ioremap(dev, res->start, resource_size(res)); > if (IS_ERR(nemc->base)) { > dev_err(dev, "failed to get I/O memory\n"); > return PTR_ERR(nemc->base); > -- > 2.23.0 >
diff --git a/drivers/memory/jz4780-nemc.c b/drivers/memory/jz4780-nemc.c index b232ed279fc3..647267ea8c63 100644 --- a/drivers/memory/jz4780-nemc.c +++ b/drivers/memory/jz4780-nemc.c @@ -8,6 +8,7 @@ #include <linux/clk.h> #include <linux/init.h> +#include <linux/io.h> #include <linux/math64.h> #include <linux/of.h> #include <linux/of_address.h> @@ -288,7 +289,19 @@ static int jz4780_nemc_probe(struct platform_device *pdev) nemc->dev = dev; res = platform_get_resource(pdev, IORESOURCE_MEM, 0); - nemc->base = devm_ioremap_resource(dev, res); + + /* + * 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. + */ + if (!devm_request_mem_region(dev, res->start, 0x54, dev_name(dev))) { + dev_err(dev, "unable to request I/O memory region\n"); + return -EBUSY; + } + + nemc->base = devm_ioremap(dev, res->start, resource_size(res)); if (IS_ERR(nemc->base)) { dev_err(dev, "failed to get I/O memory\n"); return PTR_ERR(nemc->base);