diff mbox

[U-Boot] fsl-ifc-nand : Corrected the programming of chip select

Message ID 1473169458-45521-1-git-send-email-matthew.weber@rockwellcollins.com
State Changes Requested
Delegated to: York Sun
Headers show

Commit Message

Matt Weber Sept. 6, 2016, 1:44 p.m. UTC
Corrected the chip selection in IFC_NAND_CSEL register. Due to this
issue in multi-chip nand use-case, IFC was always pointing to the last
probed chip even though the user select another device through "nand
device" command.

Signed-off-by: Ronak Desai <ronak.desai@rockwellcollins.com>
Signed-off-by: Matthew Weber <matthew.weber@rockwellcollins.com>
---
 drivers/mtd/nand/fsl_ifc_nand.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Scott Wood Sept. 6, 2016, 5:01 p.m. UTC | #1
On 09/06/2016 08:44 AM, Matt Weber wrote:
> Corrected the chip selection in IFC_NAND_CSEL register. Due to this
> issue in multi-chip nand use-case, IFC was always pointing to the last
> probed chip even though the user select another device through "nand
> device" command.
> 
> Signed-off-by: Ronak Desai <ronak.desai@rockwellcollins.com>
> Signed-off-by: Matthew Weber <matthew.weber@rockwellcollins.com>
> ---
>  drivers/mtd/nand/fsl_ifc_nand.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/mtd/nand/fsl_ifc_nand.c b/drivers/mtd/nand/fsl_ifc_nand.c
> index 7001cbd..2ce4a7d 100644
> --- a/drivers/mtd/nand/fsl_ifc_nand.c
> +++ b/drivers/mtd/nand/fsl_ifc_nand.c
> @@ -296,7 +296,7 @@ static int fsl_ifc_run_command(struct mtd_info *mtd)
>  	int i;
>  
>  	/* set the chip select for NAND Transaction */
> -	ifc_out32(&ifc->ifc_nand.nand_csel, ifc_ctrl->cs_nand);
> +	ifc_out32(&ifc->ifc_nand.nand_csel, priv->bank << IFC_NAND_CSEL_SHIFT);
>  
>  	/* start read/write seq */
>  	ifc_out32(&ifc->ifc_nand.nandseq_strt,

Ouch.  fsl_ifc_sram_init() should also be updated and cs_nand removed.

-Scott
Ronak Desai Sept. 6, 2016, 7:31 p.m. UTC | #2
We don't need to update fsl_ifc_sram_init() as fsl_ifc_sram_init is called
from the fsl_ifc_chip_init which configures the ifc_ctrl->cs_nand
with correct value based on the chip-select under initialization.

Best Regards,
Ronak Desai


On Tue, Sep 6, 2016 at 12:01 PM, Scott Wood <scott.wood@nxp.com> wrote:

> On 09/06/2016 08:44 AM, Matt Weber wrote:
> > Corrected the chip selection in IFC_NAND_CSEL register. Due to this
> > issue in multi-chip nand use-case, IFC was always pointing to the last
> > probed chip even though the user select another device through "nand
> > device" command.
> >
> > Signed-off-by: Ronak Desai <ronak.desai@rockwellcollins.com>
> > Signed-off-by: Matthew Weber <matthew.weber@rockwellcollins.com>
> > ---
> >  drivers/mtd/nand/fsl_ifc_nand.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/drivers/mtd/nand/fsl_ifc_nand.c b/drivers/mtd/nand/fsl_ifc_
> nand.c
> > index 7001cbd..2ce4a7d 100644
> > --- a/drivers/mtd/nand/fsl_ifc_nand.c
> > +++ b/drivers/mtd/nand/fsl_ifc_nand.c
> > @@ -296,7 +296,7 @@ static int fsl_ifc_run_command(struct mtd_info *mtd)
> >       int i;
> >
> >       /* set the chip select for NAND Transaction */
> > -     ifc_out32(&ifc->ifc_nand.nand_csel, ifc_ctrl->cs_nand);
> > +     ifc_out32(&ifc->ifc_nand.nand_csel, priv->bank <<
> IFC_NAND_CSEL_SHIFT);
> >
> >       /* start read/write seq */
> >       ifc_out32(&ifc->ifc_nand.nandseq_strt,
>
> Ouch.  fsl_ifc_sram_init() should also be updated and cs_nand removed.
>
> -Scott
>
>
Scott Wood Sept. 6, 2016, 8:37 p.m. UTC | #3
On 09/06/2016 02:31 PM, Ronak Desai wrote:
> We don't need to update fsl_ifc_sram_init() as fsl_ifc_sram_init is
> called from the fsl_ifc_chip_init which configures the ifc_ctrl->cs_nand
> with correct value based on the chip-select under initialization. 
> 
> Best Regards,
> Ronak Desai

We don't *need* to but we should.  Chipselect is a property of the chip,
not the controller, so it doesn't belong in the controller struct
(unless it's going to be updated per-transaction like page, column, etc.
but we already have priv->bank so let's just use it).

-Scott
diff mbox

Patch

diff --git a/drivers/mtd/nand/fsl_ifc_nand.c b/drivers/mtd/nand/fsl_ifc_nand.c
index 7001cbd..2ce4a7d 100644
--- a/drivers/mtd/nand/fsl_ifc_nand.c
+++ b/drivers/mtd/nand/fsl_ifc_nand.c
@@ -296,7 +296,7 @@  static int fsl_ifc_run_command(struct mtd_info *mtd)
 	int i;
 
 	/* set the chip select for NAND Transaction */
-	ifc_out32(&ifc->ifc_nand.nand_csel, ifc_ctrl->cs_nand);
+	ifc_out32(&ifc->ifc_nand.nand_csel, priv->bank << IFC_NAND_CSEL_SHIFT);
 
 	/* start read/write seq */
 	ifc_out32(&ifc->ifc_nand.nandseq_strt,