Skip to contentSkip to conversation

Enable ecc-mode selection in the driver

PATCH Jason Cooper 4 participants 6 messages Jan 15, 2013 – Jan 18, 2013 2 messages not in the archive Memory technology devices (MTD)

lore
Share & tools
lore
#2 lore raw
In reply to a message not in the archive

Stefan,

This is a good-looking patch series, nice and small! A few comments:

Quoted 2 lines · Stefan Peter

In order to be able to use the ecc-mode, add the bch module to the default settings for the kirwood boards and enable the activation in orin-nand.c

s/orin-nand/orion-nand/

Quoted 8 lines

---

arch/arm/configs/kirkwood_defconfig +0 -0
index 93f3794..4a9d3f7 100644

arch/arm/configs/kirkwood_defconfig CONFIG_MTD_CFI_STAA=y · line 90

Quoted 7 lines
arch/arm/configs/kirkwood_defconfig +1 -0
@@ -84,6 +84,7 @@ CONFIG_MTD_CFI_STAA=y
 CONFIG_MTD_PHYSMAP=y
 CONFIG_MTD_M25P80=y
 CONFIG_MTD_NAND=y
+CONFIG_MTD_NAND_ECC_BCH=y
 CONFIG_MTD_NAND_ORION=y
 CONFIG_BLK_DEV_LOOP=y
 # CONFIG_SCSI_PROC_FS is not set

Please make the defconfig change a separate patch.

As a general note (this series shouldn't be a problem), please sort the series so that you add the driver feature first, then enable it in defconfig, then use it in DT. This way, a future bisection won't run into any nasty surprises, other than what they're looking for. ;-)

thx,

Jason.

#4 lore raw
In reply to a message not in the archive
Quoted 39 lines · Stefan Peter

In order to be able to use the ecc-mode, add the bch module to the default settings for the kirwood boards and enable the activation in orin-nand.c

---

arch/arm/configs/kirkwood_defconfig +1 -0
index 93f3794..4a9d3f7 100644
@@ -84,6 +84,7 @@ CONFIG_MTD_CFI_STAA=y
 CONFIG_MTD_PHYSMAP=y
 CONFIG_MTD_M25P80=y
 CONFIG_MTD_NAND=y
+CONFIG_MTD_NAND_ECC_BCH=y
 CONFIG_MTD_NAND_ORION=y
 CONFIG_BLK_DEV_LOOP=y
 # CONFIG_SCSI_PROC_FS is not set
drivers/mtd/nand/orion_nand.c +2 -0
index cd72b92..1a35257 100644
@@ -14,6 +14,7 @@
 #include <linux/module.h>
 #include <linux/platform_device.h>
 #include <linux/of.h>
+#include <linux/of_mtd.h>
 #include <linux/mtd/mtd.h>
 #include <linux/mtd/nand.h>
 #include <linux/mtd/partitions.h>
@@ -130,6 +131,7 @@ static int __init orion_nand_probe(struct platform_device *pdev)
 		if (!of_property_read_u32(pdev->dev.of_node,
 						"chip-delay", &val))
 			board->chip_delay = (u8)val;
+		board->ecc_mode = of_get_nand_ecc_mode(pdev->dev.of_node);
 
 	} else
 		board = pdev->dev.platform_data;

drivers/mtd/nand/orion_nand.c static int __init orion_nand_probe(struct platform_device *pdev) · line 146

Quoted 6 lines
drivers/mtd/nand/orion_nand.c +2 -1
@@ -140,7 +142,8 @@ static int __init orion_nand_probe(struct platform_device *pdev)
 	nc->IO_ADDR_R = nc->IO_ADDR_W = io_base;
 	nc->cmd_ctrl = orion_nand_cmd_ctrl;
 	nc->read_buf = orion_nand_read_buf;
-	nc->ecc.mode = NAND_ECC_SOFT;
+	nc->ecc.mode = board->ecc_mode == NAND_ECC_SOFT_BCH ?
+		NAND_ECC_SOFT_BCH : NAND_ECC_SOFT;

Hi Stefan

What about a user that wants one of the other valid values? NAND_ECC_OOB_FIRST, NAND_ECC_HW_SYNDROME, etc.

Would:

	if (IS_ERR(board->ecc_mode)) {
		nc->ecc.mode = NAND_ECC_SOFT;
		dev_info(&pdev->dev, "Defaulting to NAND_ECC_SOFT");
	} else
		nc->ecc.mode = board->ecc_mode

be better?

Andrew

#5 lore raw

Hi Andrew

Quoted 49 lines · Andrew Lunn
Quoted 39 lines · Stefan Peter

In order to be able to use the ecc-mode, add the bch module to the default settings for the kirwood boards and enable the activation in orin-nand.c

---

arch/arm/configs/kirkwood_defconfig +1 -0
index 93f3794..4a9d3f7 100644
@@ -84,6 +84,7 @@ CONFIG_MTD_CFI_STAA=y
 CONFIG_MTD_PHYSMAP=y
 CONFIG_MTD_M25P80=y
 CONFIG_MTD_NAND=y
+CONFIG_MTD_NAND_ECC_BCH=y
 CONFIG_MTD_NAND_ORION=y
 CONFIG_BLK_DEV_LOOP=y
 # CONFIG_SCSI_PROC_FS is not set
drivers/mtd/nand/orion_nand.c +2 -0
index cd72b92..1a35257 100644
@@ -14,6 +14,7 @@
 #include <linux/module.h>
 #include <linux/platform_device.h>
 #include <linux/of.h>
+#include <linux/of_mtd.h>
 #include <linux/mtd/mtd.h>
 #include <linux/mtd/nand.h>
 #include <linux/mtd/partitions.h>
@@ -130,6 +131,7 @@ static int __init orion_nand_probe(struct platform_device *pdev)
 		if (!of_property_read_u32(pdev->dev.of_node,
 						"chip-delay", &val))
 			board->chip_delay = (u8)val;
+		board->ecc_mode = of_get_nand_ecc_mode(pdev->dev.of_node);
 
 	} else
 		board = pdev->dev.platform_data;

drivers/mtd/nand/orion_nand.c static int __init orion_nand_probe(struct platform_device *pdev) · line 146

Quoted 6 lines
drivers/mtd/nand/orion_nand.c +2 -1
@@ -140,7 +142,8 @@ static int __init orion_nand_probe(struct platform_device *pdev)
 	nc->IO_ADDR_R = nc->IO_ADDR_W = io_base;
 	nc->cmd_ctrl = orion_nand_cmd_ctrl;
 	nc->read_buf = orion_nand_read_buf;
-	nc->ecc.mode = NAND_ECC_SOFT;
+	nc->ecc.mode = board->ecc_mode == NAND_ECC_SOFT_BCH ?
+		NAND_ECC_SOFT_BCH : NAND_ECC_SOFT;

Hi Stefan

Quoted 2 lines

What about a user that wants one of the other valid values? NAND_ECC_OOB_FIRST, NAND_ECC_HW_SYNDROME, etc.

As far as I understand, NAND_ECC_NONE, NAND_ECC_SOFT and NAND_ECC_SOFT_BCH are the only ECC modes that do not require corresponding hardware support which is missing in the marvell 88F6180/88F619x/88F628x. From my point of view, NAND_ECC_NONE does not make sense, too, because MLC NAND Flash requires ECC to be usable.

Quoted 10 lines

Would:

	if (IS_ERR(board->ecc_mode)) {
		nc->ecc.mode = NAND_ECC_SOFT;
		dev_info(&pdev->dev, "Defaulting to NAND_ECC_SOFT");
	} else
		nc->ecc.mode = board->ecc_mode

be better?

I feel safer by limiting the modes to what I could test.

Regards

Stefan Peter

Signature · 2 lines
MPL AG, Switzerland                     http://www.mpl.ch
Tel. +41 (0)56 483 34 34          Fax: +41(0)56 493 30 20
#3 lore raw
In reply to Jason Cooper

Hi Jason

Quoted 9 lines · Jason Cooper

Stefan,

This is a good-looking patch series, nice and small! A few comments:

Quoted 2 lines · Stefan Peter

In order to be able to use the ecc-mode, add the bch module to the default settings for the kirwood boards and enable the activation in orin-nand.c

s/orin-nand/orion-nand/

Will fix.

Quoted 18 lines
Quoted 9 lines

---

arch/arm/configs/kirkwood_defconfig +0 -0
index 93f3794..4a9d3f7 100644

arch/arm/configs/kirkwood_defconfig CONFIG_MTD_CFI_STAA=y · line 90

Quoted 7 lines
arch/arm/configs/kirkwood_defconfig +1 -0
@@ -84,6 +84,7 @@ CONFIG_MTD_CFI_STAA=y
 CONFIG_MTD_PHYSMAP=y
 CONFIG_MTD_M25P80=y
 CONFIG_MTD_NAND=y
+CONFIG_MTD_NAND_ECC_BCH=y
 CONFIG_MTD_NAND_ORION=y
 CONFIG_BLK_DEV_LOOP=y
 # CONFIG_SCSI_PROC_FS is not set

Please make the defconfig change a separate patch.

Will do.

Quoted 5 lines

As a general note (this series shouldn't be a problem), please sort the series so that you add the driver feature first, then enable it in defconfig, then use it in DT. This way, a future bisection won't run into any nasty surprises, other than what they're looking for. ;-)

Will do.

Thank you very much for your review.

Stefan Peter

Signature · 2 lines
MPL AG, Switzerland                     http://www.mpl.ch
Tel. +41 (0)56 483 34 34          Fax: +41(0)56 493 30 20
#6 lore raw
In reply to Stefan Peter
Quoted 70 lines · Stefan Peter

Hi Andrew

Quoted 49 lines · Andrew Lunn
Quoted 39 lines · Stefan Peter

In order to be able to use the ecc-mode, add the bch module to the default settings for the kirwood boards and enable the activation in orin-nand.c

---

arch/arm/configs/kirkwood_defconfig +1 -0
index 93f3794..4a9d3f7 100644
@@ -84,6 +84,7 @@ CONFIG_MTD_CFI_STAA=y
 CONFIG_MTD_PHYSMAP=y
 CONFIG_MTD_M25P80=y
 CONFIG_MTD_NAND=y
+CONFIG_MTD_NAND_ECC_BCH=y
 CONFIG_MTD_NAND_ORION=y
 CONFIG_BLK_DEV_LOOP=y
 # CONFIG_SCSI_PROC_FS is not set
drivers/mtd/nand/orion_nand.c +2 -0
index cd72b92..1a35257 100644
@@ -14,6 +14,7 @@
 #include <linux/module.h>
 #include <linux/platform_device.h>
 #include <linux/of.h>
+#include <linux/of_mtd.h>
 #include <linux/mtd/mtd.h>
 #include <linux/mtd/nand.h>
 #include <linux/mtd/partitions.h>
@@ -130,6 +131,7 @@ static int __init orion_nand_probe(struct platform_device *pdev)
 		if (!of_property_read_u32(pdev->dev.of_node,
 						"chip-delay", &val))
 			board->chip_delay = (u8)val;
+		board->ecc_mode = of_get_nand_ecc_mode(pdev->dev.of_node);
 
 	} else
 		board = pdev->dev.platform_data;

drivers/mtd/nand/orion_nand.c static int __init orion_nand_probe(struct platform_device *pdev) · line 146

Quoted 6 lines
drivers/mtd/nand/orion_nand.c +2 -1
@@ -140,7 +142,8 @@ static int __init orion_nand_probe(struct platform_device *pdev)
 	nc->IO_ADDR_R = nc->IO_ADDR_W = io_base;
 	nc->cmd_ctrl = orion_nand_cmd_ctrl;
 	nc->read_buf = orion_nand_read_buf;
-	nc->ecc.mode = NAND_ECC_SOFT;
+	nc->ecc.mode = board->ecc_mode == NAND_ECC_SOFT_BCH ?
+		NAND_ECC_SOFT_BCH : NAND_ECC_SOFT;

Hi Stefan

Quoted 2 lines

What about a user that wants one of the other valid values? NAND_ECC_OOB_FIRST, NAND_ECC_HW_SYNDROME, etc.

As far as I understand, NAND_ECC_NONE, NAND_ECC_SOFT and NAND_ECC_SOFT_BCH are the only ECC modes that do not require corresponding hardware support which is missing in the marvell 88F6180/88F619x/88F628x. From my point of view, NAND_ECC_NONE does not make sense, too, because MLC NAND Flash requires ECC to be usable.

Quoted 9 lines

Would:

	if (IS_ERR(board->ecc_mode)) {
		nc->ecc.mode = NAND_ECC_SOFT;
		dev_info(&pdev->dev, "Defaulting to NAND_ECC_SOFT");
	} else
		nc->ecc.mode = board->ecc_mode
Quoted 3 lines
Quoted 1 line

be better?

I feel safer by limiting the modes to what I could test.

Hi Stefan

O.K, but i still think a warning message would be useful when board->ecc_mode is an error code.

Andrew

#7 lore raw
In reply to Stefan Peter
Quoted 1 line · Stefan Peter

Hi Andrew

For some reasons I do not see your patches in the mailing lists which are in CC.

Signature · 2 lines
Best Regards,
Artem Bityutskiy