* [PATCH 0/4] mtd: gpmi: support two nand chips at most
@ 2013-06-14 8:06 Huang Shijie
2013-06-14 8:06 ` [PATCH 1/4] mtd: gpmi: decouple the chip select from the DMA channel Huang Shijie
` (4 more replies)
0 siblings, 5 replies; 7+ messages in thread
From: Huang Shijie @ 2013-06-14 8:06 UTC (permalink / raw)
To: linux-arm-kernel
Current gpmi-nand driver only supports one chips. But we may meet
some embarrassing situation, such as Micron MT29F32G08QAA.
This nand chip has two DIEs internally. Each die has its own chip select pin,
so this chip acts as two nand chips.
If we only scan one chip, we may find that we only get 2G for this chip,
but in actually, this chip's size is 4G.
So scan two chips by default.
In order to support two nand chips, we have to do the following:
1.) We only have one dma channel now, so decouple the chip select
from the DMA channel, We can use the dma 0 to access all the nand chips.
2.) fix the wrong method of checking the ready/busy status.
In the imx6, all the ready/busy pins are binding together, we
should check ready/busy status of chip 0 for the all the chips.
Tested this patch set with MT29F32G08QAA.
Huang Shijie (4):
mtd: gpmi: decouple the chip select from the DMA channel
mtd: gpmi: use DMA channel 0 for all the nand chips
mtd: gpmi: scan two nand chips
mtd: gpmi: imx6: fix the wrong method for checking ready/busy
drivers/mtd/nand/gpmi-nand/gpmi-lib.c | 14 ++++++++++++++
drivers/mtd/nand/gpmi-nand/gpmi-nand.c | 7 +++----
drivers/mtd/nand/gpmi-nand/gpmi-regs.h | 3 +++
3 files changed, 20 insertions(+), 4 deletions(-)
^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH 1/4] mtd: gpmi: decouple the chip select from the DMA channel
2013-06-14 8:06 [PATCH 0/4] mtd: gpmi: support two nand chips at most Huang Shijie
@ 2013-06-14 8:06 ` Huang Shijie
2013-06-14 8:06 ` [PATCH 2/4] mtd: gpmi: use DMA channel 0 for all the nand chips Huang Shijie
` (3 subsequent siblings)
4 siblings, 0 replies; 7+ messages in thread
From: Huang Shijie @ 2013-06-14 8:06 UTC (permalink / raw)
To: linux-arm-kernel
Decouple the chip select from the DMA channel, we use the DMA channel 0
to accecc all the nand devices.
Signed-off-by: Huang Shijie <b32955@freescale.com>
---
drivers/mtd/nand/gpmi-nand/gpmi-lib.c | 6 ++++++
drivers/mtd/nand/gpmi-nand/gpmi-regs.h | 3 +++
2 files changed, 9 insertions(+), 0 deletions(-)
diff --git a/drivers/mtd/nand/gpmi-nand/gpmi-lib.c b/drivers/mtd/nand/gpmi-nand/gpmi-lib.c
index 4f8857f..7d56d87 100644
--- a/drivers/mtd/nand/gpmi-nand/gpmi-lib.c
+++ b/drivers/mtd/nand/gpmi-nand/gpmi-lib.c
@@ -187,6 +187,12 @@ int gpmi_init(struct gpmi_nand_data *this)
/* Select BCH ECC. */
writel(BM_GPMI_CTRL1_BCH_MODE, r->gpmi_regs + HW_GPMI_CTRL1_SET);
+ /*
+ * Decouple the chip select from dma channel. We use dma0 for all
+ * the chips.
+ */
+ writel(BM_GPMI_CTRL1_DECOUPLE_CS, r->gpmi_regs + HW_GPMI_CTRL1_SET);
+
gpmi_disable_clk(this);
return 0;
err_out:
diff --git a/drivers/mtd/nand/gpmi-nand/gpmi-regs.h b/drivers/mtd/nand/gpmi-nand/gpmi-regs.h
index 53397cc..82114cd 100644
--- a/drivers/mtd/nand/gpmi-nand/gpmi-regs.h
+++ b/drivers/mtd/nand/gpmi-nand/gpmi-regs.h
@@ -108,6 +108,9 @@
#define HW_GPMI_CTRL1_CLR 0x00000068
#define HW_GPMI_CTRL1_TOG 0x0000006c
+#define BP_GPMI_CTRL1_DECOUPLE_CS 24
+#define BM_GPMI_CTRL1_DECOUPLE_CS (1 << BP_GPMI_CTRL1_DECOUPLE_CS)
+
#define BP_GPMI_CTRL1_WRN_DLY_SEL 22
#define BM_GPMI_CTRL1_WRN_DLY_SEL (0x3 << BP_GPMI_CTRL1_WRN_DLY_SEL)
#define BF_GPMI_CTRL1_WRN_DLY_SEL(v) \
--
1.7.1
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH 2/4] mtd: gpmi: use DMA channel 0 for all the nand chips
2013-06-14 8:06 [PATCH 0/4] mtd: gpmi: support two nand chips at most Huang Shijie
2013-06-14 8:06 ` [PATCH 1/4] mtd: gpmi: decouple the chip select from the DMA channel Huang Shijie
@ 2013-06-14 8:06 ` Huang Shijie
2013-06-14 8:06 ` [PATCH 3/4] mtd: gpmi: scan two " Huang Shijie
` (2 subsequent siblings)
4 siblings, 0 replies; 7+ messages in thread
From: Huang Shijie @ 2013-06-14 8:06 UTC (permalink / raw)
To: linux-arm-kernel
We only have one DMA channel : the channel 0.
Use DMA channel 0 to access all the nand chips.
Signed-off-by: Huang Shijie <b32955@freescale.com>
---
drivers/mtd/nand/gpmi-nand/gpmi-nand.c | 5 ++---
1 files changed, 2 insertions(+), 3 deletions(-)
diff --git a/drivers/mtd/nand/gpmi-nand/gpmi-nand.c b/drivers/mtd/nand/gpmi-nand/gpmi-nand.c
index 25ecfa1..036e5e4 100644
--- a/drivers/mtd/nand/gpmi-nand/gpmi-nand.c
+++ b/drivers/mtd/nand/gpmi-nand/gpmi-nand.c
@@ -226,9 +226,8 @@ int common_nfc_set_geometry(struct gpmi_nand_data *this)
struct dma_chan *get_dma_chan(struct gpmi_nand_data *this)
{
- int chipnr = this->current_chip;
-
- return this->dma_chans[chipnr];
+ /* We use the DMA channel 0 to access all the nand chips. */
+ return this->dma_chans[0];
}
/* Can we use the upper's buffer directly for DMA? */
--
1.7.1
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH 3/4] mtd: gpmi: scan two nand chips
2013-06-14 8:06 [PATCH 0/4] mtd: gpmi: support two nand chips at most Huang Shijie
2013-06-14 8:06 ` [PATCH 1/4] mtd: gpmi: decouple the chip select from the DMA channel Huang Shijie
2013-06-14 8:06 ` [PATCH 2/4] mtd: gpmi: use DMA channel 0 for all the nand chips Huang Shijie
@ 2013-06-14 8:06 ` Huang Shijie
2013-06-14 8:06 ` [PATCH 4/4] mtd: gpmi: imx6: fix the wrong method for checking ready/busy Huang Shijie
2013-08-11 6:09 ` [PATCH 0/4] mtd: gpmi: support two nand chips at most Brian Norris
4 siblings, 0 replies; 7+ messages in thread
From: Huang Shijie @ 2013-06-14 8:06 UTC (permalink / raw)
To: linux-arm-kernel
Some nand chip has two DIEs in a single chip, such as Micron MT29F32G08QAA.
Each die has its own chip select pin, so this chip acts as two nand
chips.
If we only scan one chip, we may find that we only get 2G for this chip,
but in actually, this chip's size is 4G.
So scan two chips by default.
Signed-off-by: Huang Shijie <b32955@freescale.com>
---
drivers/mtd/nand/gpmi-nand/gpmi-nand.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/drivers/mtd/nand/gpmi-nand/gpmi-nand.c b/drivers/mtd/nand/gpmi-nand/gpmi-nand.c
index 036e5e4..bb8af93 100644
--- a/drivers/mtd/nand/gpmi-nand/gpmi-nand.c
+++ b/drivers/mtd/nand/gpmi-nand/gpmi-nand.c
@@ -1551,7 +1551,7 @@ static int gpmi_nfc_init(struct gpmi_nand_data *this)
if (ret)
goto err_out;
- ret = nand_scan(mtd, 1);
+ ret = nand_scan(mtd, 2);
if (ret) {
pr_err("Chip scan failed\n");
goto err_out;
--
1.7.1
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH 4/4] mtd: gpmi: imx6: fix the wrong method for checking ready/busy
2013-06-14 8:06 [PATCH 0/4] mtd: gpmi: support two nand chips at most Huang Shijie
` (2 preceding siblings ...)
2013-06-14 8:06 ` [PATCH 3/4] mtd: gpmi: scan two " Huang Shijie
@ 2013-06-14 8:06 ` Huang Shijie
2013-08-11 6:09 ` [PATCH 0/4] mtd: gpmi: support two nand chips at most Brian Norris
4 siblings, 0 replies; 7+ messages in thread
From: Huang Shijie @ 2013-06-14 8:06 UTC (permalink / raw)
To: linux-arm-kernel
In the imx6, all the ready/busy pins are binding togeter.
So we only need to check the chip 0 busy status.
For example, When the CS1 is enabled, we also should check the
ready/busy of chip 0, if we check the ready/busy of chip 1,
we will get the wrong result.
Signed-off-by: Huang Shijie <b32955@freescale.com>
---
drivers/mtd/nand/gpmi-nand/gpmi-lib.c | 8 ++++++++
1 files changed, 8 insertions(+), 0 deletions(-)
diff --git a/drivers/mtd/nand/gpmi-nand/gpmi-lib.c b/drivers/mtd/nand/gpmi-nand/gpmi-lib.c
index 7d56d87..660c5d7 100644
--- a/drivers/mtd/nand/gpmi-nand/gpmi-lib.c
+++ b/drivers/mtd/nand/gpmi-nand/gpmi-lib.c
@@ -1079,6 +1079,14 @@ int gpmi_is_ready(struct gpmi_nand_data *this, unsigned chip)
mask = MX23_BM_GPMI_DEBUG_READY0 << chip;
reg = readl(r->gpmi_regs + HW_GPMI_DEBUG);
} else if (GPMI_IS_MX28(this) || GPMI_IS_MX6Q(this)) {
+ /*
+ * In the imx6, all the ready/busy pins are binding
+ * togeter. So we only need to check the ready/busy status
+ * of chip 0.
+ */
+ if (GPMI_IS_MX6Q(this))
+ chip = 0;
+
/* MX28 shares the same R/B register as MX6Q. */
mask = MX28_BF_GPMI_STAT_READY_BUSY(1 << chip);
reg = readl(r->gpmi_regs + HW_GPMI_STAT);
--
1.7.1
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH 0/4] mtd: gpmi: support two nand chips at most
2013-06-14 8:06 [PATCH 0/4] mtd: gpmi: support two nand chips at most Huang Shijie
` (3 preceding siblings ...)
2013-06-14 8:06 ` [PATCH 4/4] mtd: gpmi: imx6: fix the wrong method for checking ready/busy Huang Shijie
@ 2013-08-11 6:09 ` Brian Norris
2013-08-11 19:52 ` Huang Shijie
4 siblings, 1 reply; 7+ messages in thread
From: Brian Norris @ 2013-08-11 6:09 UTC (permalink / raw)
To: linux-arm-kernel
On Fri, Jun 14, 2013 at 04:06:21PM +0800, Huang Shijie wrote:
> Current gpmi-nand driver only supports one chips. But we may meet
> some embarrassing situation, such as Micron MT29F32G08QAA.
> This nand chip has two DIEs internally. Each die has its own chip select pin,
> so this chip acts as two nand chips.
>
> If we only scan one chip, we may find that we only get 2G for this chip,
> but in actually, this chip's size is 4G.
>
> So scan two chips by default.
>
> In order to support two nand chips, we have to do the following:
> 1.) We only have one dma channel now, so decouple the chip select
> from the DMA channel, We can use the dma 0 to access all the nand chips.
>
> 2.) fix the wrong method of checking the ready/busy status.
> In the imx6, all the ready/busy pins are binding together, we
> should check ready/busy status of chip 0 for the all the chips.
>
> Tested this patch set with MT29F32G08QAA.
>
>
> Huang Shijie (4):
> mtd: gpmi: decouple the chip select from the DMA channel
> mtd: gpmi: use DMA channel 0 for all the nand chips
> mtd: gpmi: scan two nand chips
> mtd: gpmi: imx6: fix the wrong method for checking ready/busy
>
> drivers/mtd/nand/gpmi-nand/gpmi-lib.c | 14 ++++++++++++++
> drivers/mtd/nand/gpmi-nand/gpmi-nand.c | 7 +++----
> drivers/mtd/nand/gpmi-nand/gpmi-regs.h | 3 +++
> 3 files changed, 20 insertions(+), 4 deletions(-)
What's the status on this patch set? It doesn't look like it got merged.
Do you have any testing for this? It looks sane enough to me.
Brian
^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH 0/4] mtd: gpmi: support two nand chips at most
2013-08-11 6:09 ` [PATCH 0/4] mtd: gpmi: support two nand chips at most Brian Norris
@ 2013-08-11 19:52 ` Huang Shijie
0 siblings, 0 replies; 7+ messages in thread
From: Huang Shijie @ 2013-08-11 19:52 UTC (permalink / raw)
To: linux-arm-kernel
On Sat, Aug 10, 2013 at 11:09:21PM -0700, Brian Norris wrote:
> On Fri, Jun 14, 2013 at 04:06:21PM +0800, Huang Shijie wrote:
> >
> > drivers/mtd/nand/gpmi-nand/gpmi-lib.c | 14 ++++++++++++++
> > drivers/mtd/nand/gpmi-nand/gpmi-nand.c | 7 +++----
> > drivers/mtd/nand/gpmi-nand/gpmi-regs.h | 3 +++
> > 3 files changed, 20 insertions(+), 4 deletions(-)
>
> What's the status on this patch set? It doesn't look like it got merged.
> Do you have any testing for this? It looks sane enough to me.
Please ignore this patch set. I find a better solution to fix this
issue. I will send a new version of this patch set when it is ready.
thanks
Huang Shijie
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2013-08-11 19:52 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-06-14 8:06 [PATCH 0/4] mtd: gpmi: support two nand chips at most Huang Shijie
2013-06-14 8:06 ` [PATCH 1/4] mtd: gpmi: decouple the chip select from the DMA channel Huang Shijie
2013-06-14 8:06 ` [PATCH 2/4] mtd: gpmi: use DMA channel 0 for all the nand chips Huang Shijie
2013-06-14 8:06 ` [PATCH 3/4] mtd: gpmi: scan two " Huang Shijie
2013-06-14 8:06 ` [PATCH 4/4] mtd: gpmi: imx6: fix the wrong method for checking ready/busy Huang Shijie
2013-08-11 6:09 ` [PATCH 0/4] mtd: gpmi: support two nand chips at most Brian Norris
2013-08-11 19:52 ` Huang Shijie
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).