Linux-MIPS Archive on lore.kernel.org
 help / color / Atom feed
* [PATCH RESEND] memory: jz4780_nemc: Only request IO memory the driver will use
@ 2020-07-23  9:04 Paul Cercueil
  2020-07-25 12:40 ` Paul Cercueil
  0 siblings, 1 reply; 2+ messages in thread
From: Paul Cercueil @ 2020-07-23  9:04 UTC (permalink / raw)
  To: Greg Kroah-Hartman, Thomas Bogendoerfer
  Cc: od, 周琰杰,
	linux-mips, linux-kernel, Paul Cercueil, H . Nikolaus Schaller

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>
---

Notes:
    Thomas:
    
    drivers/memory/ has no dedicated maintainer, so sending this
    patch upstream is like sending a bottle to the sea. Since it
    touches a driver for a Ingenic SoC, if Greg doesn't take it
    (I don't blame him - he's a busy man), could you take it in
    your tree?
    
    Thanks,
    -Paul

 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.27.0


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH RESEND] memory: jz4780_nemc: Only request IO memory the driver will use
  2020-07-23  9:04 [PATCH RESEND] memory: jz4780_nemc: Only request IO memory the driver will use Paul Cercueil
@ 2020-07-25 12:40 ` Paul Cercueil
  0 siblings, 0 replies; 2+ messages in thread
From: Paul Cercueil @ 2020-07-25 12:40 UTC (permalink / raw)
  To: Greg Kroah-Hartman, Thomas Bogendoerfer
  Cc: od, 周琰杰,
	linux-mips, linux-kernel, H . Nikolaus Schaller

Thomas, Greg,

Nevermind the previous note, it turns out a new maintainer (Krzysztof) 
just appeared for drivers/memory/, I will upstream this patch through 
him.

Cheers,
-Paul


Le jeu. 23 juil. 2020 à 11:04, Paul Cercueil <paul@crapouillou.net> a 
écrit :
> 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>
> ---
> 
> Notes:
>     Thomas:
> 
>     drivers/memory/ has no dedicated maintainer, so sending this
>     patch upstream is like sending a bottle to the sea. Since it
>     touches a driver for a Ingenic SoC, if Greg doesn't take it
>     (I don't blame him - he's a busy man), could you take it in
>     your tree?
> 
>     Thanks,
>     -Paul
> 
>  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.27.0
> 



^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, back to index

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-07-23  9:04 [PATCH RESEND] memory: jz4780_nemc: Only request IO memory the driver will use Paul Cercueil
2020-07-25 12:40 ` Paul Cercueil

Linux-MIPS Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/linux-mips/0 linux-mips/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 linux-mips linux-mips/ https://lore.kernel.org/linux-mips \
		linux-mips@vger.kernel.org
	public-inbox-index linux-mips

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.linux-mips


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git