All of lore.kernel.org
 help / color / mirror / Atom feed
From: Boris Brezillon <boris.brezillon@free-electrons.com>
To: Wenyou Yang <wenyou.yang@atmel.com>,
	Brian Norris <computersforpeace@gmail.com>,
	David Woodhouse <dwmw2@infradead.org>
Cc: Rob Herring <robh+dt@kernel.org>, Pawel Moll <pawel.moll@arm.com>,
	Mark Brown <broonie@kernel.org>,
	Ian Campbell <ijc+devicetree@hellion.org.uk>,
	Kumar Gala <galak@codeaurora.org>,
	devicetree@vger.kernel.org, Russell King <linux@arm.linux.org.uk>,
	Josh Wu <rainyfeeling@outlook.com>,
	Nicolas Ferre <nicolas.ferre@atmel.com>,
	linux-kernel@vger.kernel.org,
	Alexandre Belloni <alexandre.belloni@free-electrons.com>,
	linux-mtd@lists.infradead.org,
	Jean-Christophe Plagniol-Villard <plagnioj@jcrosoft.com>,
	linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH 1/2] Revert "mtd: atmel_nand: Support variable RB_EDGE interrupts"
Date: Mon, 23 May 2016 09:55:57 +0200	[thread overview]
Message-ID: <20160523095557.1efea63d@bbrezillon> (raw)
In-Reply-To: <1462776680-5284-2-git-send-email-wenyou.yang@atmel.com>

On Mon, 9 May 2016 14:51:18 +0800
Wenyou Yang <wenyou.yang@atmel.com> wrote:

> This reverts commit 5ddc7bd43ccc ("mtd: atmel_nand: Support variable
> RB_EDGE interrupts")
> 
> Because for current SoCs, the RB_EDGE3(i.e. bit 27) of HSMC_SR
> register does not exist, the RB_EDGE0 (i.e. bit 24) is the ready/busy
> line edge status bit. It is a datasheet bug.
> 
> Signed-off-by: Wenyou Yang <wenyou.yang@atmel.com>

Wenyou, I know you sent it before v4.6 was released, but now we should
probably add

Cc: <stable@vger.kernel.org>

Brian, can you apply this patch directly in your tree (as previously
discussed, I'm not sure creating a nand/fixes branch is really useful)?

Thanks,

Boris

> ---
> 
>  .../devicetree/bindings/mtd/atmel-nand.txt         |  2 +-
>  drivers/mtd/nand/atmel_nand.c                      | 35 +++++-----------------
>  drivers/mtd/nand/atmel_nand_nfc.h                  |  3 +-
>  3 files changed, 10 insertions(+), 30 deletions(-)
> 
> diff --git a/Documentation/devicetree/bindings/mtd/atmel-nand.txt b/Documentation/devicetree/bindings/mtd/atmel-nand.txt
> index d53aba9..3e7ee99 100644
> --- a/Documentation/devicetree/bindings/mtd/atmel-nand.txt
> +++ b/Documentation/devicetree/bindings/mtd/atmel-nand.txt
> @@ -39,7 +39,7 @@ Optional properties:
>  
>  Nand Flash Controller(NFC) is an optional sub-node
>  Required properties:
> -- compatible : "atmel,sama5d3-nfc" or "atmel,sama5d4-nfc".
> +- compatible : "atmel,sama5d3-nfc".
>  - reg : should specify the address and size used for NFC command registers,
>          NFC registers and NFC SRAM. NFC SRAM address and size can be absent
>          if don't want to use it.
> diff --git a/drivers/mtd/nand/atmel_nand.c b/drivers/mtd/nand/atmel_nand.c
> index efc8ea2..68b9160 100644
> --- a/drivers/mtd/nand/atmel_nand.c
> +++ b/drivers/mtd/nand/atmel_nand.c
> @@ -67,10 +67,6 @@ struct atmel_nand_caps {
>  	uint8_t pmecc_max_correction;
>  };
>  
> -struct atmel_nand_nfc_caps {
> -	uint32_t rb_mask;
> -};
> -
>  /*
>   * oob layout for large page size
>   * bad block info is on bytes 0 and 1
> @@ -129,7 +125,6 @@ struct atmel_nfc {
>  	/* Point to the sram bank which include readed data via NFC */
>  	void			*data_in_sram;
>  	bool			will_write_sram;
> -	const struct atmel_nand_nfc_caps *caps;
>  };
>  static struct atmel_nfc	nand_nfc;
>  
> @@ -1715,9 +1710,9 @@ static irqreturn_t hsmc_interrupt(int irq, void *dev_id)
>  		nfc_writel(host->nfc->hsmc_regs, IDR, NFC_SR_XFR_DONE);
>  		ret = IRQ_HANDLED;
>  	}
> -	if (pending & host->nfc->caps->rb_mask) {
> +	if (pending & NFC_SR_RB_EDGE) {
>  		complete(&host->nfc->comp_ready);
> -		nfc_writel(host->nfc->hsmc_regs, IDR, host->nfc->caps->rb_mask);
> +		nfc_writel(host->nfc->hsmc_regs, IDR, NFC_SR_RB_EDGE);
>  		ret = IRQ_HANDLED;
>  	}
>  	if (pending & NFC_SR_CMD_DONE) {
> @@ -1735,7 +1730,7 @@ static void nfc_prepare_interrupt(struct atmel_nand_host *host, u32 flag)
>  	if (flag & NFC_SR_XFR_DONE)
>  		init_completion(&host->nfc->comp_xfer_done);
>  
> -	if (flag & host->nfc->caps->rb_mask)
> +	if (flag & NFC_SR_RB_EDGE)
>  		init_completion(&host->nfc->comp_ready);
>  
>  	if (flag & NFC_SR_CMD_DONE)
> @@ -1753,7 +1748,7 @@ static int nfc_wait_interrupt(struct atmel_nand_host *host, u32 flag)
>  	if (flag & NFC_SR_XFR_DONE)
>  		comp[index++] = &host->nfc->comp_xfer_done;
>  
> -	if (flag & host->nfc->caps->rb_mask)
> +	if (flag & NFC_SR_RB_EDGE)
>  		comp[index++] = &host->nfc->comp_ready;
>  
>  	if (flag & NFC_SR_CMD_DONE)
> @@ -1821,7 +1816,7 @@ static int nfc_device_ready(struct mtd_info *mtd)
>  		dev_err(host->dev, "Lost the interrupt flags: 0x%08x\n",
>  				mask & status);
>  
> -	return status & host->nfc->caps->rb_mask;
> +	return status & NFC_SR_RB_EDGE;
>  }
>  
>  static void nfc_select_chip(struct mtd_info *mtd, int chip)
> @@ -1994,8 +1989,8 @@ static void nfc_nand_command(struct mtd_info *mtd, unsigned int command,
>  		}
>  		/* fall through */
>  	default:
> -		nfc_prepare_interrupt(host, host->nfc->caps->rb_mask);
> -		nfc_wait_interrupt(host, host->nfc->caps->rb_mask);
> +		nfc_prepare_interrupt(host, NFC_SR_RB_EDGE);
> +		nfc_wait_interrupt(host, NFC_SR_RB_EDGE);
>  	}
>  }
>  
> @@ -2426,11 +2421,6 @@ static int atmel_nand_nfc_probe(struct platform_device *pdev)
>  		}
>  	}
>  
> -	nfc->caps = (const struct atmel_nand_nfc_caps *)
> -		of_device_get_match_data(&pdev->dev);
> -	if (!nfc->caps)
> -		return -ENODEV;
> -
>  	nfc_writel(nfc->hsmc_regs, IDR, 0xffffffff);
>  	nfc_readl(nfc->hsmc_regs, SR);	/* clear the NFC_SR */
>  
> @@ -2459,17 +2449,8 @@ static int atmel_nand_nfc_remove(struct platform_device *pdev)
>  	return 0;
>  }
>  
> -static const struct atmel_nand_nfc_caps sama5d3_nfc_caps = {
> -	.rb_mask = NFC_SR_RB_EDGE0,
> -};
> -
> -static const struct atmel_nand_nfc_caps sama5d4_nfc_caps = {
> -	.rb_mask = NFC_SR_RB_EDGE3,
> -};
> -
>  static const struct of_device_id atmel_nand_nfc_match[] = {
> -	{ .compatible = "atmel,sama5d3-nfc", .data = &sama5d3_nfc_caps },
> -	{ .compatible = "atmel,sama5d4-nfc", .data = &sama5d4_nfc_caps },
> +	{ .compatible = "atmel,sama5d3-nfc" },
>  	{ /* sentinel */ }
>  };
>  MODULE_DEVICE_TABLE(of, atmel_nand_nfc_match);
> diff --git a/drivers/mtd/nand/atmel_nand_nfc.h b/drivers/mtd/nand/atmel_nand_nfc.h
> index 0bbc1fa..4d5d262 100644
> --- a/drivers/mtd/nand/atmel_nand_nfc.h
> +++ b/drivers/mtd/nand/atmel_nand_nfc.h
> @@ -42,8 +42,7 @@
>  #define		NFC_SR_UNDEF		(1 << 21)
>  #define		NFC_SR_AWB		(1 << 22)
>  #define		NFC_SR_ASE		(1 << 23)
> -#define		NFC_SR_RB_EDGE0		(1 << 24)
> -#define		NFC_SR_RB_EDGE3		(1 << 27)
> +#define		NFC_SR_RB_EDGE		(1 << 24)
>  
>  #define ATMEL_HSMC_NFC_IER	0x0c
>  #define ATMEL_HSMC_NFC_IDR	0x10



-- 
Boris Brezillon, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com

WARNING: multiple messages have this Message-ID (diff)
From: boris.brezillon@free-electrons.com (Boris Brezillon)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 1/2] Revert "mtd: atmel_nand: Support variable RB_EDGE interrupts"
Date: Mon, 23 May 2016 09:55:57 +0200	[thread overview]
Message-ID: <20160523095557.1efea63d@bbrezillon> (raw)
In-Reply-To: <1462776680-5284-2-git-send-email-wenyou.yang@atmel.com>

On Mon, 9 May 2016 14:51:18 +0800
Wenyou Yang <wenyou.yang@atmel.com> wrote:

> This reverts commit 5ddc7bd43ccc ("mtd: atmel_nand: Support variable
> RB_EDGE interrupts")
> 
> Because for current SoCs, the RB_EDGE3(i.e. bit 27) of HSMC_SR
> register does not exist, the RB_EDGE0 (i.e. bit 24) is the ready/busy
> line edge status bit. It is a datasheet bug.
> 
> Signed-off-by: Wenyou Yang <wenyou.yang@atmel.com>

Wenyou, I know you sent it before v4.6 was released, but now we should
probably add

Cc: <stable@vger.kernel.org>

Brian, can you apply this patch directly in your tree (as previously
discussed, I'm not sure creating a nand/fixes branch is really useful)?

Thanks,

Boris

> ---
> 
>  .../devicetree/bindings/mtd/atmel-nand.txt         |  2 +-
>  drivers/mtd/nand/atmel_nand.c                      | 35 +++++-----------------
>  drivers/mtd/nand/atmel_nand_nfc.h                  |  3 +-
>  3 files changed, 10 insertions(+), 30 deletions(-)
> 
> diff --git a/Documentation/devicetree/bindings/mtd/atmel-nand.txt b/Documentation/devicetree/bindings/mtd/atmel-nand.txt
> index d53aba9..3e7ee99 100644
> --- a/Documentation/devicetree/bindings/mtd/atmel-nand.txt
> +++ b/Documentation/devicetree/bindings/mtd/atmel-nand.txt
> @@ -39,7 +39,7 @@ Optional properties:
>  
>  Nand Flash Controller(NFC) is an optional sub-node
>  Required properties:
> -- compatible : "atmel,sama5d3-nfc" or "atmel,sama5d4-nfc".
> +- compatible : "atmel,sama5d3-nfc".
>  - reg : should specify the address and size used for NFC command registers,
>          NFC registers and NFC SRAM. NFC SRAM address and size can be absent
>          if don't want to use it.
> diff --git a/drivers/mtd/nand/atmel_nand.c b/drivers/mtd/nand/atmel_nand.c
> index efc8ea2..68b9160 100644
> --- a/drivers/mtd/nand/atmel_nand.c
> +++ b/drivers/mtd/nand/atmel_nand.c
> @@ -67,10 +67,6 @@ struct atmel_nand_caps {
>  	uint8_t pmecc_max_correction;
>  };
>  
> -struct atmel_nand_nfc_caps {
> -	uint32_t rb_mask;
> -};
> -
>  /*
>   * oob layout for large page size
>   * bad block info is on bytes 0 and 1
> @@ -129,7 +125,6 @@ struct atmel_nfc {
>  	/* Point to the sram bank which include readed data via NFC */
>  	void			*data_in_sram;
>  	bool			will_write_sram;
> -	const struct atmel_nand_nfc_caps *caps;
>  };
>  static struct atmel_nfc	nand_nfc;
>  
> @@ -1715,9 +1710,9 @@ static irqreturn_t hsmc_interrupt(int irq, void *dev_id)
>  		nfc_writel(host->nfc->hsmc_regs, IDR, NFC_SR_XFR_DONE);
>  		ret = IRQ_HANDLED;
>  	}
> -	if (pending & host->nfc->caps->rb_mask) {
> +	if (pending & NFC_SR_RB_EDGE) {
>  		complete(&host->nfc->comp_ready);
> -		nfc_writel(host->nfc->hsmc_regs, IDR, host->nfc->caps->rb_mask);
> +		nfc_writel(host->nfc->hsmc_regs, IDR, NFC_SR_RB_EDGE);
>  		ret = IRQ_HANDLED;
>  	}
>  	if (pending & NFC_SR_CMD_DONE) {
> @@ -1735,7 +1730,7 @@ static void nfc_prepare_interrupt(struct atmel_nand_host *host, u32 flag)
>  	if (flag & NFC_SR_XFR_DONE)
>  		init_completion(&host->nfc->comp_xfer_done);
>  
> -	if (flag & host->nfc->caps->rb_mask)
> +	if (flag & NFC_SR_RB_EDGE)
>  		init_completion(&host->nfc->comp_ready);
>  
>  	if (flag & NFC_SR_CMD_DONE)
> @@ -1753,7 +1748,7 @@ static int nfc_wait_interrupt(struct atmel_nand_host *host, u32 flag)
>  	if (flag & NFC_SR_XFR_DONE)
>  		comp[index++] = &host->nfc->comp_xfer_done;
>  
> -	if (flag & host->nfc->caps->rb_mask)
> +	if (flag & NFC_SR_RB_EDGE)
>  		comp[index++] = &host->nfc->comp_ready;
>  
>  	if (flag & NFC_SR_CMD_DONE)
> @@ -1821,7 +1816,7 @@ static int nfc_device_ready(struct mtd_info *mtd)
>  		dev_err(host->dev, "Lost the interrupt flags: 0x%08x\n",
>  				mask & status);
>  
> -	return status & host->nfc->caps->rb_mask;
> +	return status & NFC_SR_RB_EDGE;
>  }
>  
>  static void nfc_select_chip(struct mtd_info *mtd, int chip)
> @@ -1994,8 +1989,8 @@ static void nfc_nand_command(struct mtd_info *mtd, unsigned int command,
>  		}
>  		/* fall through */
>  	default:
> -		nfc_prepare_interrupt(host, host->nfc->caps->rb_mask);
> -		nfc_wait_interrupt(host, host->nfc->caps->rb_mask);
> +		nfc_prepare_interrupt(host, NFC_SR_RB_EDGE);
> +		nfc_wait_interrupt(host, NFC_SR_RB_EDGE);
>  	}
>  }
>  
> @@ -2426,11 +2421,6 @@ static int atmel_nand_nfc_probe(struct platform_device *pdev)
>  		}
>  	}
>  
> -	nfc->caps = (const struct atmel_nand_nfc_caps *)
> -		of_device_get_match_data(&pdev->dev);
> -	if (!nfc->caps)
> -		return -ENODEV;
> -
>  	nfc_writel(nfc->hsmc_regs, IDR, 0xffffffff);
>  	nfc_readl(nfc->hsmc_regs, SR);	/* clear the NFC_SR */
>  
> @@ -2459,17 +2449,8 @@ static int atmel_nand_nfc_remove(struct platform_device *pdev)
>  	return 0;
>  }
>  
> -static const struct atmel_nand_nfc_caps sama5d3_nfc_caps = {
> -	.rb_mask = NFC_SR_RB_EDGE0,
> -};
> -
> -static const struct atmel_nand_nfc_caps sama5d4_nfc_caps = {
> -	.rb_mask = NFC_SR_RB_EDGE3,
> -};
> -
>  static const struct of_device_id atmel_nand_nfc_match[] = {
> -	{ .compatible = "atmel,sama5d3-nfc", .data = &sama5d3_nfc_caps },
> -	{ .compatible = "atmel,sama5d4-nfc", .data = &sama5d4_nfc_caps },
> +	{ .compatible = "atmel,sama5d3-nfc" },
>  	{ /* sentinel */ }
>  };
>  MODULE_DEVICE_TABLE(of, atmel_nand_nfc_match);
> diff --git a/drivers/mtd/nand/atmel_nand_nfc.h b/drivers/mtd/nand/atmel_nand_nfc.h
> index 0bbc1fa..4d5d262 100644
> --- a/drivers/mtd/nand/atmel_nand_nfc.h
> +++ b/drivers/mtd/nand/atmel_nand_nfc.h
> @@ -42,8 +42,7 @@
>  #define		NFC_SR_UNDEF		(1 << 21)
>  #define		NFC_SR_AWB		(1 << 22)
>  #define		NFC_SR_ASE		(1 << 23)
> -#define		NFC_SR_RB_EDGE0		(1 << 24)
> -#define		NFC_SR_RB_EDGE3		(1 << 27)
> +#define		NFC_SR_RB_EDGE		(1 << 24)
>  
>  #define ATMEL_HSMC_NFC_IER	0x0c
>  #define ATMEL_HSMC_NFC_IDR	0x10



-- 
Boris Brezillon, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com

  parent reply	other threads:[~2016-05-23  7:55 UTC|newest]

Thread overview: 39+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-05-09  6:51 [PATCH 0/2] mtd: atmel_nand: remove compatible "atmel,sama5d4-nfc" Wenyou Yang
2016-05-09  6:51 ` Wenyou Yang
2016-05-09  6:51 ` Wenyou Yang
2016-05-09  6:51 ` [PATCH 1/2] Revert "mtd: atmel_nand: Support variable RB_EDGE interrupts" Wenyou Yang
2016-05-09  6:51   ` Wenyou Yang
2016-05-09  6:51   ` Wenyou Yang
2016-05-10  8:55   ` Boris Brezillon
2016-05-10  8:55     ` Boris Brezillon
2016-05-10  8:55     ` Boris Brezillon
2016-05-10  8:59     ` Yang, Wenyou
2016-05-10  8:59       ` Yang, Wenyou
2016-05-10  8:59       ` Yang, Wenyou
2016-05-10  9:59     ` Romain Izard
2016-05-10  9:59       ` Romain Izard
2016-05-23  7:55   ` Boris Brezillon [this message]
2016-05-23  7:55     ` Boris Brezillon
2016-05-26  3:10     ` Brian Norris
2016-05-26  3:10       ` Brian Norris
2016-05-26  3:10       ` Brian Norris
2016-05-26  3:16   ` Brian Norris
2016-05-26  3:16     ` Brian Norris
2016-05-26  3:16     ` Brian Norris
2016-05-26  6:36     ` Boris Brezillon
2016-05-26  6:36       ` Boris Brezillon
2016-05-09  6:51 ` [PATCH 2/2] ARM: at91/dt: use "atmel,sama5d3-nfc" compatible for nfc Wenyou Yang
2016-05-09  6:51   ` Wenyou Yang
2016-05-09  6:51   ` Wenyou Yang
2016-05-09 16:34   ` [PATCH] ARM: dts: at91: sama5d2: use "atmel, sama5d3-nfc" " Nicolas Ferre
2016-05-09 16:34     ` [PATCH] ARM: dts: at91: sama5d2: use "atmel,sama5d3-nfc" " Nicolas Ferre
2016-05-09 17:17     ` Romain Izard
2016-05-09 17:17       ` Romain Izard
2016-05-09 20:13 ` [PATCH 0/2] mtd: atmel_nand: remove compatible "atmel,sama5d4-nfc" Rob Herring
2016-05-09 20:13   ` Rob Herring
2016-05-10  4:50   ` Yang, Wenyou
2016-05-10  4:50     ` Yang, Wenyou
2016-05-10  4:50     ` Yang, Wenyou
2016-05-10 11:52     ` Alexandre Belloni
2016-05-10 11:52       ` Alexandre Belloni
2016-05-10 11:52       ` Alexandre Belloni

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20160523095557.1efea63d@bbrezillon \
    --to=boris.brezillon@free-electrons.com \
    --cc=alexandre.belloni@free-electrons.com \
    --cc=broonie@kernel.org \
    --cc=computersforpeace@gmail.com \
    --cc=devicetree@vger.kernel.org \
    --cc=dwmw2@infradead.org \
    --cc=galak@codeaurora.org \
    --cc=ijc+devicetree@hellion.org.uk \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mtd@lists.infradead.org \
    --cc=linux@arm.linux.org.uk \
    --cc=nicolas.ferre@atmel.com \
    --cc=pawel.moll@arm.com \
    --cc=plagnioj@jcrosoft.com \
    --cc=rainyfeeling@outlook.com \
    --cc=robh+dt@kernel.org \
    --cc=wenyou.yang@atmel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.