Skip to contentSkip to conversation

mtd: nand: Fixes and improvements on pxa3xx

PATCH In review Ezequiel Garcia 6 participants 19 messages May 14, 2013 – Jul 22, 2013

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

cover mtd: nand: Fixes and improvements on pxa3xx

The Armada 370 and Armada XP SoC include a NAND controller (NFCv2) that is similar to the one in PXA SoC. Therefore, it should be possible to support Armada NAND using pxa3xx-nand driver.

While this effort is not ready yet, here is a set of patches that are needed for such work.

A small summary of the patches:

* 1/5 is a fix for a 2-year regression that removed DMA support.

* 2/5 and 3/5 are needed to build the driver on platforms other PXA.

* 4/5 and 5/5 add ONFI-compliant device detection and are needed to successfully probe newer flash devices.

Applies cleanly on top of l2-mtd.git.

Thanks!

Ezequiel Garcia (5):
mtd: nand: pxa3xx: Set info->use_dma properly
mtd: nand: pxa3xx: Use of_machine_is_compatible()
mtd: nand: pxa3xx: Fix MODULE_DEVICE_TABLE declaration
mtd: nand: pxa3xx: Add address support for READID command
mtd: nand: pxa3xx: Add support for Read parameter page command

 drivers/mtd/nand/pxa3xx_nand.c | 16 ++++++++++++++--
 1 file changed, 14 insertions(+), 2 deletions(-)
Signature · 1 line
1.8.1.5
#1 lore raw

PATCH 1/5 mtd: nand: pxa3xx: Set info->use_dma properly

From: Ezequiel Garcia <[email protected]>

Currently, the variable info->use_dma is never set and always zero-valued which means the driver never does DMA transfers. We fix this by simply setting info->use_dma to the module parameter, also named 'use_dma'. Note that the module parameter has the same name, but different semantics.

This fixes a regression introduced by the below commit which removed the info->use_dma variable set.

commit 4eb2da8994042d68e84e31138788429a102da2ea
Author: Lei Wen <[email protected]>
Date: Mon Feb 28 10:32:13 2011 +0800

mtd: pxa3xx_nand: unify prepare command

Before the above commit, the driver had use_dma=1 on all NAND commands except on CMD_STATUS. This behavior is long lost and we are not recovering in this patch, either.

This was spotted and verified only by human inspection. No testing of any kind has been performed for lack of hardware.

---
 drivers/mtd/nand/pxa3xx_nand.c | 1 +
 1 file changed, 1 insertion(+)
drivers/mtd/nand/pxa3xx_nand.c +1 -0
index 14d3db5..cef1eeb 100644
@@ -506,6 +506,7 @@ static int prepare_command_pool(struct pxa3xx_nand_info *info, int command,
 	info->buf_count		= 0;
 	info->oob_size		= 0;
 	info->use_ecc		= 0;
+	info->use_dma		= (use_dma) ? 1 : 0;
 	info->is_ready		= 0;
 	info->retcode		= ERR_NONE;
 	if (info->cs != 0)
Signature · 1 line
1.8.1.5
#2 lore raw

PATCH 2/5 mtd: nand: pxa3xx: Use of_machine_is_compatible()

In reply to Ezequiel Garcia

From: Ezequiel Garcia <[email protected]>

This patch replaces cpu_is_pxa3xx() with of_machine_is_compatible() which allows to build this driver for other platforms than ARCH_PXA.

---
 drivers/mtd/nand/pxa3xx_nand.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/mtd/nand/pxa3xx_nand.c +1 -1
index cef1eeb..8386e9a 100644
@@ -1094,7 +1094,7 @@ static int alloc_nand_resource(struct platform_device *pdev)
 	 * bindings. It can be removed once we have a prober DMA controller
 	 * framework for DT.
 	 */
-	if (pdev->dev.of_node && cpu_is_pxa3xx()) {
+	if (pdev->dev.of_node && of_machine_is_compatible("marvell,pxa3xx")) {
 		info->drcmr_dat = 97;
 		info->drcmr_cmd = 99;
 	} else {
Signature · 1 line
1.8.1.5
#3 lore raw

PATCH 3/5 mtd: nand: pxa3xx: Fix MODULE_DEVICE_TABLE declaration

In reply to Ezequiel Garcia

From: Ezequiel Garcia <[email protected]>

This module's device table is incorrectly declared using i2c_pxa_dt_ids, instead of pxa3xx_nand_dt_ids.

---
 drivers/mtd/nand/pxa3xx_nand.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/mtd/nand/pxa3xx_nand.c +1 -1
index 8386e9a..e4e697f 100644
@@ -1185,7 +1185,7 @@ static struct of_device_id pxa3xx_nand_dt_ids[] = {
 	{ .compatible = "marvell,pxa3xx-nand" },
 	{}
 };
-MODULE_DEVICE_TABLE(of, i2c_pxa_dt_ids);
+MODULE_DEVICE_TABLE(of, pxa3xx_nand_dt_ids);
 
 static int pxa3xx_nand_probe_dt(struct platform_device *pdev)
 {
Signature · 1 line
1.8.1.5
#4 lore raw

PATCH 4/5 mtd: nand: pxa3xx: Add address support for READID command

In reply to Ezequiel Garcia

From: Ezequiel Garcia <[email protected]>

This allows to support READID ONFI command which sends 0x20 as address together with the 0x90 READID command.

This is required to detect ONFI compliant devices.

---
 drivers/mtd/nand/pxa3xx_nand.c | 1 +
 1 file changed, 1 insertion(+)
drivers/mtd/nand/pxa3xx_nand.c +1 -0
index e4e697f..36780e2 100644
@@ -596,6 +596,7 @@ static int prepare_command_pool(struct pxa3xx_nand_info *info, int command,
 		info->ndcb0 |= NDCB0_CMD_TYPE(3)
 				| NDCB0_ADDR_CYC(1)
 				| cmd;
+		info->ndcb1 = (column & 0xFF);
 
 		info->data_size = 8;
 		break;
Signature · 1 line
1.8.1.5
#5 lore raw

PATCH 5/5 mtd: nand: pxa3xx: Add support for Read parameter page command

In reply to Ezequiel Garcia

From: Ezequiel Garcia <[email protected]>

This command is required to identify ONFI-compliant devices.

---
 drivers/mtd/nand/pxa3xx_nand.c | 10 ++++++++++
 1 file changed, 10 insertions(+)
drivers/mtd/nand/pxa3xx_nand.c +10 -0
index 36780e2..d63d378 100644
@@ -590,6 +590,16 @@ static int prepare_command_pool(struct pxa3xx_nand_info *info, int command,
 				| addr_cycle;
 		break;
 
+	case NAND_CMD_PARAM:
+		cmd = NAND_CMD_PARAM;
+		info->buf_count = 256;
+		info->ndcb0 |= NDCB0_CMD_TYPE(0)
+				| NDCB0_ADDR_CYC(1)
+				| cmd;
+		info->ndcb1 = (column & 0xFF);
+		info->data_size = 256;
+		break;
+
 	case NAND_CMD_READID:
 		cmd = host->cmdset->read_id;
 		info->buf_count = host->read_id_bytes;
Signature · 1 line
1.8.1.5
#6 lore raw
In reply to Ezequiel Garcia

Hi,

(adding Eric Miao in Cc)

Quoted 7 lines · Ezequiel Garcia

The Armada 370 and Armada XP SoC include a NAND controller (NFCv2) that is similar to the one in PXA SoC. Therefore, it should be possible to support Armada NAND using pxa3xx-nand driver.

While this effort is not ready yet, here is a set of patches that are needed for such work.

Quoted 9 lines

A small summary of the patches:

* 1/5 is a fix for a 2-year regression that removed DMA support.

* 2/5 and 3/5 are needed to build the driver on platforms other PXA.

* 4/5 and 5/5 add ONFI-compliant device detection and are needed to successfully probe newer flash devices.

Since this patch affects directly the PXA hardware, I'd like to have some response from PXA maintainers.

Guys, could you take a look at this?

Thanks a lot,

Signature · 3 lines
Ezequiel García, Free Electrons
Embedded Linux, Kernel and Android Engineering
http://free-electrons.com
#7 lore raw
Quoted 18 lines · Ezequiel Garcia

Hi,

(adding Eric Miao in Cc)

Quoted 13 lines · Ezequiel Garcia

The Armada 370 and Armada XP SoC include a NAND controller (NFCv2) that is similar to the one in PXA SoC. Therefore, it should be possible to support Armada NAND using pxa3xx-nand driver.

While this effort is not ready yet, here is a set of patches that are needed for such work.

A small summary of the patches:

* 1/5 is a fix for a 2-year regression that removed DMA support.

* 2/5 and 3/5 are needed to build the driver on platforms other PXA.

Quoted 9 lines
Quoted 3 lines

* 4/5 and 5/5 add ONFI-compliant device detection and are needed to successfully probe newer flash devices.

Since this patch affects directly the PXA hardware, I'd like to have some response from PXA maintainers.

Guys, could you take a look at this?

Ping?

Signature · 1 line
    Ezequiel
#8 lore raw
Quoted 27 lines · Ezequiel Garcia
Quoted 25 lines · Ezequiel Garcia

Hi,

(adding Eric Miao in Cc)

Quoted 7 lines · Ezequiel Garcia

The Armada 370 and Armada XP SoC include a NAND controller (NFCv2) that is similar to the one in PXA SoC. Therefore, it should be possible to support Armada NAND using pxa3xx-nand driver.

While this effort is not ready yet, here is a set of patches that are needed for such work.

Quoted 9 lines

A small summary of the patches:

* 1/5 is a fix for a 2-year regression that removed DMA support.

* 2/5 and 3/5 are needed to build the driver on platforms other PXA.

* 4/5 and 5/5 add ONFI-compliant device detection and are needed to successfully probe newer flash devices.

Since this patch affects directly the PXA hardware, I'd like to have some response from PXA maintainers.

Quoted 7 lines
Quoted 2 lines

Guys, could you take a look at this?

Ping?

--
Ezequiel

Hi Ezequiel,

As I didn't have the test environment, I looped some Marvell guys. But they didn't
have any time on test it.

So let's loop Marek, Daniel & Igor. I hope that we could help us.

By the way, my zylonite pxa310 fails on running uboot. I can't fix it right now.

Regards
Haojian

Reviewed-by
#9 lore raw
Quoted 42 lines · Haojian Zhuang
Quoted 27 lines · Ezequiel Garcia
Quoted 25 lines · Ezequiel Garcia

Hi,

(adding Eric Miao in Cc)

Quoted 7 lines · Ezequiel Garcia

The Armada 370 and Armada XP SoC include a NAND controller (NFCv2) that is similar to the one in PXA SoC. Therefore, it should be possible to support Armada NAND using pxa3xx-nand driver.

While this effort is not ready yet, here is a set of patches that are needed for such work.

Quoted 9 lines

A small summary of the patches:

* 1/5 is a fix for a 2-year regression that removed DMA support.

* 2/5 and 3/5 are needed to build the driver on platforms other PXA.

* 4/5 and 5/5 add ONFI-compliant device detection and are needed to successfully probe newer flash devices.

Since this patch affects directly the PXA hardware, I'd like to have some response from PXA maintainers.

Quoted 7 lines
Quoted 2 lines

Guys, could you take a look at this?

Ping?

--
Ezequiel

Hi Ezequiel,

As I didn't have the test environment, I looped some Marvell guys. But they didn't
have any time on test it.

Quoted 6 lines

So let's loop Marek, Daniel & Igor. I hope that we could help us.

By the way, my zylonite pxa310 fails on running uboot. I can't fix it right now.

Regards
Haojian

I'm OK on these patches.

#10 lore raw
Quoted 37 lines · Haojian Zhuang
Quoted 36 lines · Haojian Zhuang
Quoted 34 lines · Ezequiel Garcia
Quoted 18 lines · Ezequiel Garcia

Hi,

(adding Eric Miao in Cc)

Quoted 13 lines · Ezequiel Garcia

The Armada 370 and Armada XP SoC include a NAND controller (NFCv2) that is similar to the one in PXA SoC. Therefore, it should be possible to support Armada NAND using pxa3xx-nand driver.

While this effort is not ready yet, here is a set of patches that are needed for such work.

A small summary of the patches:

* 1/5 is a fix for a 2-year regression that removed DMA support.

* 2/5 and 3/5 are needed to build the driver on platforms other PXA.

Quoted 9 lines
Quoted 3 lines

* 4/5 and 5/5 add ONFI-compliant device detection and are needed to successfully probe newer flash devices.

Since this patch affects directly the PXA hardware, I'd like to have some response from PXA maintainers.

Guys, could you take a look at this?

Ping?

--
Ezequiel

Quoted 8 lines
Quoted 8 lines

Hi Ezequiel,

As I didn't have the test environment, I looped some Marvell guys. But they didn't
have any time on test it.

So let's loop Marek, Daniel & Igor. I hope that we could help us.

Great, thanks a lot! Let's hope they can give it a test...

Quoted 4 lines

I'm OK on these patches.

Great!

Thanks a lot,

Signature · 3 lines
Ezequiel García, Free Electrons
Embedded Linux, Kernel and Android Engineering
http://free-electrons.com
Tested-by Nikita Kiryanov Acked-by on the v1 series
#16 lore raw
In reply to Ezequiel Garcia

Hi Ezequiel,

Quoted 18 lines · Ezequiel Garcia

The Armada 370 and Armada XP SoC include a NAND controller (NFCv2) that is similar to the one in PXA SoC. Therefore, it should be possible to support Armada NAND using pxa3xx-nand driver.

While this effort is not ready yet, here is a set of patches that are needed for such work.

A small summary of the patches:

* 1/5 is a fix for a 2-year regression that removed DMA support.

* 2/5 and 3/5 are needed to build the driver on platforms other PXA.

* 4/5 and 5/5 add ONFI-compliant device detection and are needed to successfully probe newer flash devices.

Applies cleanly on top of l2-mtd.git.

Quoted 8 lines

Thanks!

Ezequiel Garcia (5):
mtd: nand: pxa3xx: Set info->use_dma properly
mtd: nand: pxa3xx: Use of_machine_is_compatible()
mtd: nand: pxa3xx: Fix MODULE_DEVICE_TABLE declaration
mtd: nand: pxa3xx: Add address support for READID command
mtd: nand: pxa3xx: Add support for Read parameter page command

tested on cm-x300, upstream 3.10-rc5 and no regressions seen.

Quoted 4 lines
 drivers/mtd/nand/pxa3xx_nand.c | 16 ++++++++++++++--
 1 file changed, 14 insertions(+), 2 deletions(-)
Signature · 2 lines
Regards,
Igor.
#17 lore raw

Nikita, Igor:

Quoted 28 lines · Igor Grinberg
Quoted 18 lines · Ezequiel Garcia

The Armada 370 and Armada XP SoC include a NAND controller (NFCv2) that is similar to the one in PXA SoC. Therefore, it should be possible to support Armada NAND using pxa3xx-nand driver.

While this effort is not ready yet, here is a set of patches that are needed for such work.

A small summary of the patches:

* 1/5 is a fix for a 2-year regression that removed DMA support.

* 2/5 and 3/5 are needed to build the driver on platforms other PXA.

* 4/5 and 5/5 add ONFI-compliant device detection and are needed to successfully probe newer flash devices.

Applies cleanly on top of l2-mtd.git.

Quoted 8 lines

Thanks!

Ezequiel Garcia (5):
mtd: nand: pxa3xx: Set info->use_dma properly
mtd: nand: pxa3xx: Use of_machine_is_compatible()
mtd: nand: pxa3xx: Fix MODULE_DEVICE_TABLE declaration
mtd: nand: pxa3xx: Add address support for READID command
mtd: nand: pxa3xx: Add support for Read parameter page command

Quoted 5 lines

tested on cm-x300, upstream 3.10-rc5 and no regressions seen.

Thanks a lot for the review and the test!

Artem, do you think this could be queued for v3.11?

Signature · 3 lines
Ezequiel García, Free Electrons
Embedded Linux, Kernel and Android Engineering
http://free-electrons.com
#18 lore raw

Hi Artem,

Quoted 33 lines · Ezequiel Garcia

Nikita, Igor:

Quoted 30 lines · Igor Grinberg
Quoted 18 lines · Ezequiel Garcia

The Armada 370 and Armada XP SoC include a NAND controller (NFCv2) that is similar to the one in PXA SoC. Therefore, it should be possible to support Armada NAND using pxa3xx-nand driver.

While this effort is not ready yet, here is a set of patches that are needed for such work.

A small summary of the patches:

* 1/5 is a fix for a 2-year regression that removed DMA support.

* 2/5 and 3/5 are needed to build the driver on platforms other PXA.

* 4/5 and 5/5 add ONFI-compliant device detection and are needed to successfully probe newer flash devices.

Applies cleanly on top of l2-mtd.git.

Quoted 8 lines

Thanks!

Ezequiel Garcia (5):
mtd: nand: pxa3xx: Set info->use_dma properly
mtd: nand: pxa3xx: Use of_machine_is_compatible()
mtd: nand: pxa3xx: Fix MODULE_DEVICE_TABLE declaration
mtd: nand: pxa3xx: Add address support for READID command
mtd: nand: pxa3xx: Add support for Read parameter page command

tested on cm-x300, upstream 3.10-rc5 and no regressions seen.

Quoted 8 lines
Quoted 3 lines

Thanks a lot for the review and the test!

Artem, do you think this could be queued for v3.11?

I guess it's already too late to have this merged for v3.11, right?

Given this has Tested-by, Acked-by and Reviewed-by, I think it should be ready to apply. If there's anything you want me to review, just let me know.

Thanks!

Signature · 3 lines
Ezequiel García, Free Electrons
Embedded Linux, Kernel and Android Engineering
http://free-electrons.com
#11 lore raw
In reply to Ezequiel Garcia
Quoted 7 lines · Ezequiel Garcia
Quoted 5 lines

Since this patch affects directly the PXA hardware, I'd like to have some response from PXA maintainers.

Guys, could you take a look at this?

Ping?

Hi Ezequiel,

sorry for long delay. I simply had no time to look an any of my open-source things, too busy.

I've pushed this series to l2-mtd.git, thanks!

Signature · 2 lines
Best Regards,
Artem Bityutskiy
#12 lore raw
Quoted 4 lines · Artem Bityutskiy
Quoted 3 lines · Ezequiel Garcia
Quoted 3 lines

Since this patch affects directly the PXA hardware, I'd like to have some response from PXA maintainers.

Quoted 9 lines
Quoted 4 lines
Quoted 2 lines

Guys, could you take a look at this?

Ping?

sorry for long delay. I simply had no time to look an any of my open-source things, too busy.

No worries...

Quoted 2 lines

I've pushed this series to l2-mtd.git, thanks!

Great, thanks!

Signature · 3 lines
Ezequiel García, Free Electrons
Embedded Linux, Kernel and Android Engineering
http://free-electrons.com
#13 lore raw
In reply to Artem Bityutskiy

Hi Artem,

Quoted 7 lines · Artem Bityutskiy
Quoted 6 lines · Ezequiel Garcia
Quoted 5 lines

Since this patch affects directly the PXA hardware, I'd like to have some response from PXA maintainers.

Guys, could you take a look at this?

Quoted 8 lines
Quoted 1 line

Ping?

sorry for long delay. I simply had no time to look an any of my open-source things, too busy.

I've pushed this series to l2-mtd.git, thanks!

Thanks!

Any chance you can push this to some branch that's included in linux-next? (when you get back to work, of course)

Signature · 3 lines
Ezequiel García, Free Electrons
Embedded Linux, Kernel and Android Engineering
http://free-electrons.com
#14 lore raw

Hi Ezequiel,

Quoted 16 lines · Ezequiel Garcia

Hi Artem,

Quoted 13 lines · Artem Bityutskiy
Quoted 7 lines · Ezequiel Garcia
Quoted 5 lines

Since this patch affects directly the PXA hardware, I'd like to have some response from PXA maintainers.

Guys, could you take a look at this?

Ping?

sorry for long delay. I simply had no time to look an any of my open-source things, too busy.

Quoted 7 lines
Quoted 2 lines

I've pushed this series to l2-mtd.git, thanks!

Thanks!

Any chance you can push this to some branch that's included in linux-next? (when you get back to work, of course)

Artem's l2-mtd.git 'master' branch is already included in linux-next. Your patch series appears to be included as the following commit (and its parents):

commit 3f81a731d931cc66abec2d0c205c4a6ecda7dac9

Author: Ezequiel Garcia <[email protected]>
Date:   Tue May 14 08:15:25 2013 -0300

mtd: nand: pxa3xx: Add support for Read parameter page command

Regards,
Brian

#15 lore raw
Quoted 23 lines · Brian Norris

Hi Ezequiel,

Quoted 19 lines · Ezequiel Garcia

Hi Artem,

Quoted 15 lines · Artem Bityutskiy
Quoted 7 lines · Ezequiel Garcia
Quoted 5 lines

Since this patch affects directly the PXA hardware, I'd like to have some response from PXA maintainers.

Guys, could you take a look at this?

Ping?

sorry for long delay. I simply had no time to look an any of my open-source things, too busy.

I've pushed this series to l2-mtd.git, thanks!

Quoted 6 lines
Quoted 4 lines

Thanks!

Any chance you can push this to some branch that's included in linux-next? (when you get back to work, of course)

Artem's l2-mtd.git 'master' branch is already included in linux-next.

Indeed.

I checked before asking but somehow thought it wasn't...

Sorry for the noise and thanks!

Signature · 3 lines
Ezequiel García, Free Electrons
Embedded Linux, Kernel and Android Engineering
http://free-electrons.com