Message ID | 20201209035104.22679-2-han.xu@nxp.com |
---|---|
State | Accepted |
Headers | show |
Series | fix some gpmi nand driver bugs | expand |
On Tue, Dec 08, 2020 at 09:51:03PM -0600, Han Xu wrote: > set the GPMI CTRL1 GANGED_RDYBUSY bit so dirver can sense the R/B signal > from all CS. > > For the NAND chip MT29F64G08AFAAAWP, only the first chip detected > without the patch. > > [ 3.764118] nand: device found, Manufacturer ID: 0x2c, Chip ID: 0x68 > [ 3.770613] nand: Micron MT29F64G08AFAAAWP > [ 3.774752] nand: 4096 MiB, SLC, erase size: 1024 KiB, page size: 8192, OOB size: 448 > [ 3.786421] Bad block table found at page 524160, version 0x01 > [ 3.792730] Bad block table found at page 524032, version 0x01 > > After applying the patch > > [ 3.764445] nand: device found, Manufacturer ID: 0x2c, Chip ID: 0x68 > [ 3.770941] nand: Micron MT29F64G08AFAAAWP > [ 3.775080] nand: 4096 MiB, SLC, erase size: 1024 KiB, page size: 8192, OOB size: 448 > [ 3.784390] nand: 2 chips detected > [ 3.790900] Bad block table found at page 524160, version 0x01 > [ 3.796776] Bad block table found at page 1048448, version 0x01 > > Signed-off-by: Han Xu <han.xu@nxp.com> Acked-by: Sascha Hauer <s.hauer@pengutronix.de> Sascha > --- > drivers/mtd/nand/raw/gpmi-nand/gpmi-nand.c | 6 ++++-- > drivers/mtd/nand/raw/gpmi-nand/gpmi-regs.h | 1 + > 2 files changed, 5 insertions(+), 2 deletions(-) > > diff --git a/drivers/mtd/nand/raw/gpmi-nand/gpmi-nand.c b/drivers/mtd/nand/raw/gpmi-nand/gpmi-nand.c > index 0d30f3fbb045..b06e202cdd0d 100644 > --- a/drivers/mtd/nand/raw/gpmi-nand/gpmi-nand.c > +++ b/drivers/mtd/nand/raw/gpmi-nand/gpmi-nand.c > @@ -181,9 +181,11 @@ static int gpmi_init(struct gpmi_nand_data *this) > > /* > * Decouple the chip select from dma channel. We use dma0 for all > - * the chips. > + * the chips, force all NAND RDY_BUSY inputs to be sourced from > + * RDY_BUSY0. > */ > - writel(BM_GPMI_CTRL1_DECOUPLE_CS, r->gpmi_regs + HW_GPMI_CTRL1_SET); > + writel(BM_GPMI_CTRL1_DECOUPLE_CS | BM_GPMI_CTRL1_GANGED_RDYBUSY, > + r->gpmi_regs + HW_GPMI_CTRL1_SET); > > err_out: > pm_runtime_mark_last_busy(this->dev); > diff --git a/drivers/mtd/nand/raw/gpmi-nand/gpmi-regs.h b/drivers/mtd/nand/raw/gpmi-nand/gpmi-regs.h > index f5e4f26c34da..fc31fd084dcf 100644 > --- a/drivers/mtd/nand/raw/gpmi-nand/gpmi-regs.h > +++ b/drivers/mtd/nand/raw/gpmi-nand/gpmi-regs.h > @@ -107,6 +107,7 @@ > #define BV_GPMI_CTRL1_WRN_DLY_SEL_7_TO_12NS 0x2 > #define BV_GPMI_CTRL1_WRN_DLY_SEL_NO_DELAY 0x3 > > +#define BM_GPMI_CTRL1_GANGED_RDYBUSY (1 << 19) > #define BM_GPMI_CTRL1_BCH_MODE (1 << 18) > > #define BP_GPMI_CTRL1_DLL_ENABLE 17 > -- > 2.17.1 > >
On Wed, Dec 9, 2020 at 12:52 AM Han Xu <han.xu@nxp.com> wrote: > > set the GPMI CTRL1 GANGED_RDYBUSY bit so dirver can sense the R/B signal > from all CS. s/dirver/driver. Reviewed-by: Fabio Estevam <festevam@gmail.com>
On Wed, 2020-12-09 at 03:51:03 UTC, Han Xu wrote: > set the GPMI CTRL1 GANGED_RDYBUSY bit so dirver can sense the R/B signal > from all CS. > > For the NAND chip MT29F64G08AFAAAWP, only the first chip detected > without the patch. > > [ 3.764118] nand: device found, Manufacturer ID: 0x2c, Chip ID: 0x68 > [ 3.770613] nand: Micron MT29F64G08AFAAAWP > [ 3.774752] nand: 4096 MiB, SLC, erase size: 1024 KiB, page size: 8192, OOB size: 448 > [ 3.786421] Bad block table found at page 524160, version 0x01 > [ 3.792730] Bad block table found at page 524032, version 0x01 > > After applying the patch > > [ 3.764445] nand: device found, Manufacturer ID: 0x2c, Chip ID: 0x68 > [ 3.770941] nand: Micron MT29F64G08AFAAAWP > [ 3.775080] nand: 4096 MiB, SLC, erase size: 1024 KiB, page size: 8192, OOB size: 448 > [ 3.784390] nand: 2 chips detected > [ 3.790900] Bad block table found at page 524160, version 0x01 > [ 3.796776] Bad block table found at page 1048448, version 0x01 > > Signed-off-by: Han Xu <han.xu@nxp.com> > Acked-by: Sascha Hauer <s.hauer@pengutronix.de> > Reviewed-by: Fabio Estevam <festevam@gmail.com> Applied to https://git.kernel.org/pub/scm/linux/kernel/git/mtd/linux.git nand/next, thanks. Miquel
diff --git a/drivers/mtd/nand/raw/gpmi-nand/gpmi-nand.c b/drivers/mtd/nand/raw/gpmi-nand/gpmi-nand.c index 0d30f3fbb045..b06e202cdd0d 100644 --- a/drivers/mtd/nand/raw/gpmi-nand/gpmi-nand.c +++ b/drivers/mtd/nand/raw/gpmi-nand/gpmi-nand.c @@ -181,9 +181,11 @@ static int gpmi_init(struct gpmi_nand_data *this) /* * Decouple the chip select from dma channel. We use dma0 for all - * the chips. + * the chips, force all NAND RDY_BUSY inputs to be sourced from + * RDY_BUSY0. */ - writel(BM_GPMI_CTRL1_DECOUPLE_CS, r->gpmi_regs + HW_GPMI_CTRL1_SET); + writel(BM_GPMI_CTRL1_DECOUPLE_CS | BM_GPMI_CTRL1_GANGED_RDYBUSY, + r->gpmi_regs + HW_GPMI_CTRL1_SET); err_out: pm_runtime_mark_last_busy(this->dev); diff --git a/drivers/mtd/nand/raw/gpmi-nand/gpmi-regs.h b/drivers/mtd/nand/raw/gpmi-nand/gpmi-regs.h index f5e4f26c34da..fc31fd084dcf 100644 --- a/drivers/mtd/nand/raw/gpmi-nand/gpmi-regs.h +++ b/drivers/mtd/nand/raw/gpmi-nand/gpmi-regs.h @@ -107,6 +107,7 @@ #define BV_GPMI_CTRL1_WRN_DLY_SEL_7_TO_12NS 0x2 #define BV_GPMI_CTRL1_WRN_DLY_SEL_NO_DELAY 0x3 +#define BM_GPMI_CTRL1_GANGED_RDYBUSY (1 << 19) #define BM_GPMI_CTRL1_BCH_MODE (1 << 18) #define BP_GPMI_CTRL1_DLL_ENABLE 17
set the GPMI CTRL1 GANGED_RDYBUSY bit so dirver can sense the R/B signal from all CS. For the NAND chip MT29F64G08AFAAAWP, only the first chip detected without the patch. [ 3.764118] nand: device found, Manufacturer ID: 0x2c, Chip ID: 0x68 [ 3.770613] nand: Micron MT29F64G08AFAAAWP [ 3.774752] nand: 4096 MiB, SLC, erase size: 1024 KiB, page size: 8192, OOB size: 448 [ 3.786421] Bad block table found at page 524160, version 0x01 [ 3.792730] Bad block table found at page 524032, version 0x01 After applying the patch [ 3.764445] nand: device found, Manufacturer ID: 0x2c, Chip ID: 0x68 [ 3.770941] nand: Micron MT29F64G08AFAAAWP [ 3.775080] nand: 4096 MiB, SLC, erase size: 1024 KiB, page size: 8192, OOB size: 448 [ 3.784390] nand: 2 chips detected [ 3.790900] Bad block table found at page 524160, version 0x01 [ 3.796776] Bad block table found at page 1048448, version 0x01 Signed-off-by: Han Xu <han.xu@nxp.com> --- drivers/mtd/nand/raw/gpmi-nand/gpmi-nand.c | 6 ++++-- drivers/mtd/nand/raw/gpmi-nand/gpmi-regs.h | 1 + 2 files changed, 5 insertions(+), 2 deletions(-)