Skip to contentSkip to conversation

at91: PMECC: enable PMECC in dt for at91sam9x5ek, at91sam9n12ek

PATCH Superseded Josh Wu 5 participants 12 messages Jan 23, 2013 – Feb 12, 2013

Subsystems (4)
lore
Share & tools
lore

Josh Wu

author
#0 lore raw

v3 cover at91: PMECC: enable PMECC in dt for at91sam9x5ek, at91sam9n12ek

Those patches will enable PMECC in dt parameters for at91sam9x5ek and at91sam9n12ek.

The PMECC driver will check minimum required ecc on ONFI parameter from NAND flash.

If pmecc-cap, pmecc-sector-size in dts file is specified, use those two. otherwise, set those according to NAND flash ONFI parameters.

If the pmecc-cap, pmecc-sector-size in dts are different with ecc requirement in ONFI, print out a warning.

For the following compile error:
ERROR (phandle_references): Reference to non-existent node or label "pinctrl_ssc0_tx"

ERROR: Input tree has errors, aborting (use -f to force output) make[2]: *** [arch/arm/boot/dts/at91sam9g20ek.dtb] Error 2

the fixes are already merged in Linux mainline in v3.8-rc4.
you can find in:
544ae6b2e676c3c37fb8c93ef9327932fc2e5bc2 (ARM: at91/dts: add pinctrl support for SSC peripheral) ea03c81521bde526570e1dec96eaa21fe5ac84a2 (ASoC: atmel-ssc: add pinctrl selection to driver)

Change logs:
v2: rebase to v3.8-rc3. And wrapped the commit message.

v3: big chages:
1. reduce the PMECC lookup table mapping. Just the lookup table not whole ROM code according to J.C's suggestion.
2. use simpler strategy to handle pmecc-cap, pmecc-sector-size:
* make pmecc-cap, pmecc-sector-size optional.
* If pmecc-cap, pmecc-sector-size are not set, use ONFI ecc parameters. otherwise, use those in DTS file.
* print out a warning if PMECC use different ecc bits or sector size from ONFI ecc parameters.

Josh Wu (5):
MTD: atmel_nand: avoid to report an error when lookup table offset is

    0.

ARM: at91: at91sam9x5: add DT parameters to enable PMECC
ARM: at91: at91sam9n12: add DT parameters to enable PMECC
MTD: atmel_nand: make pmecc-cap, pmecc-sector-size in dts is
optional.
MTD: at91: atmel_nand: for PMECC, add code to check the ONFI
parameter ECC requirement.

 arch/arm/boot/dts/at91sam9n12.dtsi  |    3 +-
 arch/arm/boot/dts/at91sam9n12ek.dts |    5 +-
 arch/arm/boot/dts/at91sam9x5.dtsi   |    4 +
 arch/arm/boot/dts/at91sam9x5cm.dtsi |    5 +-
 drivers/mtd/nand/atmel_nand.c       |  141 +++++++++++++++++++++++++++++------
 5 files changed, 131 insertions(+), 27 deletions(-)
Signature · 1 line
1.7.9.5
author
#1 lore raw

PATCH v3 1/5 MTD: atmel_nand: avoid to report an error when lookup table offset is 0.

Before this patch, we assume the whole ROM code are mapping to memory. So it is wrong if the lookup table offset is 0.

After this patch, we can map only the lookup table of ROM code to memory intead of the whole ROM code (about 1M). In this case, one lookup table offset can be 0.

---
 drivers/mtd/nand/atmel_nand.c |    9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)
drivers/mtd/nand/atmel_nand.c +4 -5
index c516a94..1d989db 100644
@@ -1215,7 +1215,7 @@ static void atmel_nand_hwctl(struct mtd_info *mtd, int mode)
 static int atmel_of_init_port(struct atmel_nand_host *host,
 			      struct device_node *np)
 {
-	u32 val, table_offset;
+	u32 val;
 	u32 offset[2];
 	int ecc_mode;
 	struct atmel_nand_data *board = &host->board;
@@ -1288,13 +1288,12 @@ static int atmel_of_init_port(struct atmel_nand_host *host,
 		dev_err(host->dev, "Cannot get PMECC lookup table offset\n");
 		return -EINVAL;
 	}
-	table_offset = host->pmecc_sector_size == 512 ? offset[0] : offset[1];
-
-	if (!table_offset) {
+	if (!offset[0] && !offset[1]) {
 		dev_err(host->dev, "Invalid PMECC lookup table offset\n");
 		return -EINVAL;
 	}
-	host->pmecc_lookup_table_offset = table_offset;
+	host->pmecc_lookup_table_offset =
+		(host->pmecc_sector_size == 512) ? offset[0] : offset[1];
 
 	return 0;
 }
Signature · 1 line
1.7.9.5
author
#2 lore raw

PATCH v3 2/5 ARM: at91: at91sam9x5: add DT parameters to enable PMECC

In reply to Josh Wu

Default ecc correctable setting is 2bits in 512 bytes.

---
 arch/arm/boot/dts/at91sam9x5.dtsi   |    4 ++++
 arch/arm/boot/dts/at91sam9x5cm.dtsi |    5 ++++-
 2 files changed, 8 insertions(+), 1 deletion(-)
arch/arm/boot/dts/at91sam9x5.dtsi +4 -0
index 3a47cf9..ecfafcf 100644
@@ -498,7 +498,11 @@
 			#address-cells = <1>;
 			#size-cells = <1>;
 			reg = <0x40000000 0x10000000
+			       0xffffe000 0x600		/* PMECC Registers */
+			       0xffffe600 0x200		/* PMECC Error Location Registers */
+			       0x00108000 0x18000	/* PMECC looup table in ROM code  */
 			      >;
+			atmel,pmecc-lookup-table-offset = <0x0 0x8000>;
 			atmel,nand-addr-offset = <21>;
 			atmel,nand-cmd-offset = <22>;
 			pinctrl-names = "default";
arch/arm/boot/dts/at91sam9x5cm.dtsi +4 -1
index 31e7be2..4027ac7 100644
@@ -26,7 +26,10 @@
 	ahb {
 		nand0: nand at 40000000 {
 			nand-bus-width = <8>;
-			nand-ecc-mode = "soft";
+			nand-ecc-mode = "hw";
+			atmel,has-pmecc;	/* Enable PMECC */
+			atmel,pmecc-cap = <2>;
+			atmel,pmecc-sector-size = <512>;
 			nand-on-flash-bbt;
 			status = "okay";
 
Signature · 1 line
1.7.9.5
author
#3 lore raw

PATCH v3 3/5 ARM: at91: at91sam9n12: add DT parameters to enable PMECC

In reply to Josh Wu

Default ecc correctable setting is 2bits in 512 bytes.

---
 arch/arm/boot/dts/at91sam9n12.dtsi  |    3 ++-
 arch/arm/boot/dts/at91sam9n12ek.dts |    5 ++++-
 2 files changed, 6 insertions(+), 2 deletions(-)
arch/arm/boot/dts/at91sam9n12.dtsi +2 -1
index 80e29c6..a3a3fdb 100644
@@ -390,8 +390,9 @@
 			reg = < 0x40000000 0x10000000
 				0xffffe000 0x00000600
 				0xffffe600 0x00000200
-				0x00100000 0x00100000
+				0x00108000 0x00018000
 			       >;
+			atmel,pmecc-lookup-table-offset = <0x0 0x8000>;
 			atmel,nand-addr-offset = <21>;
 			atmel,nand-cmd-offset = <22>;
 			pinctrl-names = "default";
arch/arm/boot/dts/at91sam9n12ek.dts +4 -1
index 0376bf4..d400f8d 100644
@@ -71,7 +71,10 @@
 
 		nand0: nand at 40000000 {
 			nand-bus-width = <8>;
-			nand-ecc-mode = "soft";
+			nand-ecc-mode = "hw";
+			atmel,has-pmecc;
+			atmel,pmecc-cap = <2>;
+			atmel,pmecc-sector-size = <512>;
 			nand-on-flash-bbt;
 			status = "okay";
 		};
Signature · 1 line
1.7.9.5
author
#4 lore raw

PATCH v3 4/5 MTD: atmel_nand: make pmecc-cap, pmecc-sector-size in dts is optional.

In reply to Josh Wu

If those two are not specified in dts file, driver will report an error.

TODO: in this case, driver will find ecc requirement in NAND ONFI parameters.

---
 drivers/mtd/nand/atmel_nand.c |   52 ++++++++++++++++++++++++-----------------
 1 file changed, 31 insertions(+), 21 deletions(-)
drivers/mtd/nand/atmel_nand.c +31 -21
index 1d989db..f186a37 100644
@@ -101,6 +101,8 @@ struct atmel_nand_host {
 	u8			pmecc_corr_cap;
 	u16			pmecc_sector_size;
 	u32			pmecc_lookup_table_offset;
+	u32			pmecc_lookup_table_offset_512;
+	u32			pmecc_lookup_table_offset_1024;
 
 	int			pmecc_bytes_per_sector;
 	int			pmecc_sector_number;
@@ -916,8 +918,16 @@ static int __init atmel_pmecc_nand_init_params(struct platform_device *pdev,
 	struct resource *regs, *regs_pmerr, *regs_rom;
 	int cap, sector_size, err_no;
 
+	if (host->pmecc_corr_cap == 0 || host->pmecc_sector_size == 0)
+		/* TODO: Should use ONFI ecc parameters. */
+		return -EINVAL;
+
 	cap = host->pmecc_corr_cap;
 	sector_size = host->pmecc_sector_size;
+	host->pmecc_lookup_table_offset = (sector_size == 512) ?
+			host->pmecc_lookup_table_offset_512 :
+			host->pmecc_lookup_table_offset_1024;
+
 	dev_info(host->dev, "Initialize PMECC params, cap: %d, sector: %d\n",
 		 cap, sector_size);
 
@@ -1259,29 +1269,29 @@ static int atmel_of_init_port(struct atmel_nand_host *host,
 
 	/* use PMECC, get correction capability, sector size and lookup
 	 * table offset.
+	 * If correction bits and sector size are not specified, then find
+	 * them from NAND ONFI parameters.
 	 */
-	if (of_property_read_u32(np, "atmel,pmecc-cap", &val) != 0) {
-		dev_err(host->dev, "Cannot decide PMECC Capability\n");
-		return -EINVAL;
-	} else if ((val != 2) && (val != 4) && (val != 8) && (val != 12) &&
-	    (val != 24)) {
-		dev_err(host->dev,
-			"Unsupported PMECC correction capability: %d; should be 2, 4, 8, 12 or 24\n",
-			val);
-		return -EINVAL;
+	if (of_property_read_u32(np, "atmel,pmecc-cap", &val) == 0) {
+		if ((val != 2) && (val != 4) && (val != 8) && (val != 12) &&
+				(val != 24)) {
+			dev_err(host->dev,
+				"Unsupported PMECC correction capability: %d; should be 2, 4, 8, 12 or 24\n",
+				val);
+			return -EINVAL;
+		}
+		host->pmecc_corr_cap = (u8)val;
 	}
-	host->pmecc_corr_cap = (u8)val;
 
-	if (of_property_read_u32(np, "atmel,pmecc-sector-size", &val) != 0) {
-		dev_err(host->dev, "Cannot decide PMECC Sector Size\n");
-		return -EINVAL;
-	} else if ((val != 512) && (val != 1024)) {
-		dev_err(host->dev,
-			"Unsupported PMECC sector size: %d; should be 512 or 1024 bytes\n",
-			val);
-		return -EINVAL;
+	if (of_property_read_u32(np, "atmel,pmecc-sector-size", &val) == 0) {
+		if ((val != 512) && (val != 1024)) {
+			dev_err(host->dev,
+				"Unsupported PMECC sector size: %d; should be 512 or 1024 bytes\n",
+				val);
+			return -EINVAL;
+		}
+		host->pmecc_sector_size = (u16)val;
 	}
-	host->pmecc_sector_size = (u16)val;
 
 	if (of_property_read_u32_array(np, "atmel,pmecc-lookup-table-offset",
 			offset, 2) != 0) {
@@ -1292,8 +1302,8 @@ static int atmel_of_init_port(struct atmel_nand_host *host,
 		dev_err(host->dev, "Invalid PMECC lookup table offset\n");
 		return -EINVAL;
 	}
-	host->pmecc_lookup_table_offset =
-		(host->pmecc_sector_size == 512) ? offset[0] : offset[1];
+	host->pmecc_lookup_table_offset_512 = offset[0];
+	host->pmecc_lookup_table_offset_1024 = offset[1];
 
 	return 0;
 }
Signature · 1 line
1.7.9.5
author
#5 lore raw

PATCH v3 5/5 MTD: at91: atmel_nand: for PMECC, add code to check the ONFI parameter ECC requirement.

In reply to Josh Wu

This patch will check NAND flash's ecc minimum requirement in ONFI parameter.

1. if pmecc-cap, pmecc-sector-size is set in dts. then use it. Driver will print out a WARNING if the values are different from ONFI parameters.
2. if pmecc-cap, pmecc-sector-size is not set in dts, then use the value from ONFI parameters.
* If ONFI ECC parameters are in ONFI extended parameter page, since we are not support it, so assume the minimum ecc requirement is 2 bits in 512 bytes.
* For non-ONFI support nand flash, also assume the minimum ecc requirement is 2 bits in 512 bytes.

---
 drivers/mtd/nand/atmel_nand.c |   90 +++++++++++++++++++++++++++++++++++++++--
 1 file changed, 87 insertions(+), 3 deletions(-)
drivers/mtd/nand/atmel_nand.c +87 -3
index f186a37..ffcbcca 100644
@@ -910,6 +910,84 @@ static void atmel_pmecc_core_init(struct mtd_info *mtd)
 	pmecc_writel(host->ecc, CTRL, PMECC_CTRL_ENABLE);
 }
 
+/*
+ * Get ECC requirement in ONFI parameters, returns -1 if ONFI
+ * parameters is not supported.
+ * return 0 if success to get the ECC requirement.
+ */
+static int get_onfi_ecc_param(struct nand_chip *chip,
+		int *ecc_bits, int *sector_size)
+{
+	*ecc_bits = *sector_size = 0;
+
+	if (chip->onfi_params.ecc_bits == 0xff)
+		/* TODO: the sector_size and ecc_bits need to be find in
+		 * extended ecc parameter, currently we don't support it.
+		 */
+		return -1;
+
+	*ecc_bits = chip->onfi_params.ecc_bits;
+
+	/* The default sector size (ecc codeword size) is 512 */
+	*sector_size = 512;
+
+	return 0;
+}
+
+/*
+ * Get ecc requirement from ONFI parameters ecc requirement.
+ * If pmecc-cap, pmecc-sector-size in DTS are not specified, this function
+ * will set them according to ONFI ecc requirement. Otherwise, use the
+ * value in DTS file.
+ * return 0 if success. otherwise return error code.
+ */
+static int pmecc_choose_ecc(struct atmel_nand_host *host,
+		int *cap, int *sector_size)
+{
+	/* Get ECC requirement from ONFI parameters */
+	*cap = *sector_size = 0;
+	if (host->nand_chip.onfi_version) {
+		if (!get_onfi_ecc_param(&host->nand_chip, cap, sector_size))
+			dev_info(host->dev, "ONFI params, minimum required ECC: %d bits in %d bytes\n",
+				*cap, *sector_size);
+		else
+			dev_info(host->dev, "NAND chip ECC reqirement is in Extended ONFI parameter, we don't support yet.\n");
+	} else {
+		dev_info(host->dev, "NAND chip is not ONFI compliant, assume ecc_bits is 2 in 512 bytes");
+	}
+	if (*cap == 0 && *sector_size == 0) {
+		*cap = 2;
+		*sector_size = 512;
+	}
+
+	/* If dts file doesn't specify then use the one in ONFI parameters */
+	if (host->pmecc_corr_cap == 0) {
+		/* use the most fitable ecc bits (the near bigger one ) */
+		if (*cap <= 2)
+			host->pmecc_corr_cap = 2;
+		else if (*cap <= 4)
+			host->pmecc_corr_cap = 4;
+		else if (*cap < 8)
+			host->pmecc_corr_cap = 8;
+		else if (*cap < 12)
+			host->pmecc_corr_cap = 12;
+		else if (*cap < 24)
+			host->pmecc_corr_cap = 24;
+		else
+			return -EINVAL;
+	}
+	if (host->pmecc_sector_size == 0) {
+		/* use the most fitable sector size (the near smaller one ) */
+		if (*sector_size >= 1024)
+			host->pmecc_sector_size = 1024;
+		else if (*sector_size >= 512)
+			host->pmecc_sector_size = 512;
+		else
+			return -EINVAL;
+	}
+	return 0;
+}
+
 static int __init atmel_pmecc_nand_init_params(struct platform_device *pdev,
 					 struct atmel_nand_host *host)
 {
@@ -918,9 +996,15 @@ static int __init atmel_pmecc_nand_init_params(struct platform_device *pdev,
 	struct resource *regs, *regs_pmerr, *regs_rom;
 	int cap, sector_size, err_no;
 
-	if (host->pmecc_corr_cap == 0 || host->pmecc_sector_size == 0)
-		/* TODO: Should use ONFI ecc parameters. */
-		return -EINVAL;
+	err_no = pmecc_choose_ecc(host, &cap, &sector_size);
+	if (err_no) {
+		dev_err(host->dev, "The NAND flash's ECC requirement are not support!");
+		return err_no;
+	}
+
+	if (cap != host->pmecc_corr_cap ||
+			sector_size != host->pmecc_sector_size)
+		dev_info(host->dev, "WARNING: Be Caution! Using different PMECC parameters from Nand ONFI ECC reqirement.\n");
 
 	cap = host->pmecc_corr_cap;
 	sector_size = host->pmecc_sector_size;
Signature · 1 line
1.7.9.5
author
#6 lore raw

v3 cover at91: PMECC: enable PMECC in dt for at91sam9x5ek, at91sam9n12ek

In reply to Josh Wu

Hi,

Just a ping. Any feedback for this v3 patch?

Best Regards,
Josh Wu

Quoted 55 lines · Josh Wu

Those patches will enable PMECC in dt parameters for at91sam9x5ek and at91sam9n12ek.

The PMECC driver will check minimum required ecc on ONFI parameter from NAND flash.

If pmecc-cap, pmecc-sector-size in dts file is specified, use those two. otherwise, set those according to NAND flash ONFI parameters.

If the pmecc-cap, pmecc-sector-size in dts are different with ecc requirement in ONFI, print out a warning.

For the following compile error:
ERROR (phandle_references): Reference to non-existent node or label "pinctrl_ssc0_tx"

ERROR: Input tree has errors, aborting (use -f to force output) make[2]: *** [arch/arm/boot/dts/at91sam9g20ek.dtb] Error 2

the fixes are already merged in Linux mainline in v3.8-rc4.
you can find in:
544ae6b2e676c3c37fb8c93ef9327932fc2e5bc2 (ARM: at91/dts: add pinctrl support for SSC peripheral) ea03c81521bde526570e1dec96eaa21fe5ac84a2 (ASoC: atmel-ssc: add pinctrl selection to driver)

Change logs:
v2: rebase to v3.8-rc3. And wrapped the commit message.

v3: big chages:
1. reduce the PMECC lookup table mapping. Just the lookup table not whole ROM code according to J.C's suggestion.
2. use simpler strategy to handle pmecc-cap, pmecc-sector-size:
* make pmecc-cap, pmecc-sector-size optional.
* If pmecc-cap, pmecc-sector-size are not set, use ONFI ecc parameters. otherwise, use those in DTS file.
* print out a warning if PMECC use different ecc bits or sector size from ONFI ecc parameters.

Josh Wu (5):
MTD: atmel_nand: avoid to report an error when lookup table offset is

     0.

ARM: at91: at91sam9x5: add DT parameters to enable PMECC
ARM: at91: at91sam9n12: add DT parameters to enable PMECC
MTD: atmel_nand: make pmecc-cap, pmecc-sector-size in dts is
optional.
MTD: at91: atmel_nand: for PMECC, add code to check the ONFI
parameter ECC requirement.

  arch/arm/boot/dts/at91sam9n12.dtsi  |    3 +-
  arch/arm/boot/dts/at91sam9n12ek.dts |    5 +-
  arch/arm/boot/dts/at91sam9x5.dtsi   |    4 +
  arch/arm/boot/dts/at91sam9x5cm.dtsi |    5 +-
  drivers/mtd/nand/atmel_nand.c       |  141 +++++++++++++++++++++++++++++------
  5 files changed, 131 insertions(+), 27 deletions(-)
#7 lore raw

v3 cover at91: PMECC: enable PMECC in dt for at91sam9x5ek, at91sam9n12ek

In reply to Josh Wu

On 01/23/2013 01:47 PM, Josh Wu :

Quoted 16 lines

Those patches will enable PMECC in dt parameters for at91sam9x5ek and at91sam9n12ek.

The PMECC driver will check minimum required ecc on ONFI parameter from NAND flash.

If pmecc-cap, pmecc-sector-size in dts file is specified, use those two. otherwise, set those according to NAND flash ONFI parameters.

If the pmecc-cap, pmecc-sector-size in dts are different with ecc requirement in ONFI, print out a warning.

For the following compile error:
ERROR (phandle_references): Reference to non-existent node or label "pinctrl_ssc0_tx"

Quoted 7 lines

ERROR: Input tree has errors, aborting (use -f to force output) make[2]: *** [arch/arm/boot/dts/at91sam9g20ek.dtb] Error 2

the fixes are already merged in Linux mainline in v3.8-rc4.
you can find in:
544ae6b2e676c3c37fb8c93ef9327932fc2e5bc2 (ARM: at91/dts: add pinctrl support for SSC peripheral) ea03c81521bde526570e1dec96eaa21fe5ac84a2 (ASoC: atmel-ssc: add pinctrl selection to driver)

Artem,

I propose to take patches 2 and 3/5 of this series via arm-soc git tree. I will specify to merge them at the end of the merge-window so that the Device Tree properties will not be out-of-sync with driver modifications (may not cause big issues anyway).

If it is needed, you can add my:

On the whole patch series.

Tell me if I have to rebase it for removing the 2nd and 3rd patches or if you can deal with this yourself.

Thanks for your help. best regards,

Quoted 30 lines

Change logs:
v2: rebase to v3.8-rc3. And wrapped the commit message.

v3: big chages:
1. reduce the PMECC lookup table mapping. Just the lookup table not whole ROM code according to J.C's suggestion.
2. use simpler strategy to handle pmecc-cap, pmecc-sector-size:
* make pmecc-cap, pmecc-sector-size optional.
* If pmecc-cap, pmecc-sector-size are not set, use ONFI ecc parameters. otherwise, use those in DTS file.
* print out a warning if PMECC use different ecc bits or sector size from ONFI ecc parameters.

Josh Wu (5):
MTD: atmel_nand: avoid to report an error when lookup table offset is

    0.

ARM: at91: at91sam9x5: add DT parameters to enable PMECC
ARM: at91: at91sam9n12: add DT parameters to enable PMECC
MTD: atmel_nand: make pmecc-cap, pmecc-sector-size in dts is
optional.
MTD: at91: atmel_nand: for PMECC, add code to check the ONFI
parameter ECC requirement.

 arch/arm/boot/dts/at91sam9n12.dtsi  |    3 +-
 arch/arm/boot/dts/at91sam9n12ek.dts |    5 +-
 arch/arm/boot/dts/at91sam9x5.dtsi   |    4 +
 arch/arm/boot/dts/at91sam9x5cm.dtsi |    5 +-
 drivers/mtd/nand/atmel_nand.c       |  141 +++++++++++++++++++++++++++++------
 5 files changed, 131 insertions(+), 27 deletions(-)
Signature · 1 line
Nicolas Ferre
#8 lore raw

v3 cover at91: PMECC: enable PMECC in dt for at91sam9x5ek, at91sam9n12ek

Quoted 27 lines · Nicolas Ferre

On 01/23/2013 01:47 PM, Josh Wu :

Quoted 16 lines

Those patches will enable PMECC in dt parameters for at91sam9x5ek and at91sam9n12ek.

The PMECC driver will check minimum required ecc on ONFI parameter from NAND flash.

If pmecc-cap, pmecc-sector-size in dts file is specified, use those two. otherwise, set those according to NAND flash ONFI parameters.

If the pmecc-cap, pmecc-sector-size in dts are different with ecc requirement in ONFI, print out a warning.

For the following compile error:
ERROR (phandle_references): Reference to non-existent node or label "pinctrl_ssc0_tx"

Quoted 7 lines

ERROR: Input tree has errors, aborting (use -f to force output) make[2]: *** [arch/arm/boot/dts/at91sam9g20ek.dtb] Error 2

the fixes are already merged in Linux mainline in v3.8-rc4.
you can find in:
544ae6b2e676c3c37fb8c93ef9327932fc2e5bc2 (ARM: at91/dts: add pinctrl support for SSC peripheral) ea03c81521bde526570e1dec96eaa21fe5ac84a2 (ASoC: atmel-ssc: add pinctrl selection to driver)

Artem,

Quoted 8 lines

I propose to take patches 2 and 3/5 of this series via arm-soc git tree. I will specify to merge them at the end of the merge-window so that the Device Tree properties will not be out-of-sync with driver modifications (may not cause big issues anyway).

If it is needed, you can add my:

too

Quoted 43 lines

On the whole patch series.

Tell me if I have to rebase it for removing the 2nd and 3rd patches or if you can deal with this yourself.

Thanks for your help. best regards,

Quoted 30 lines

Change logs:
v2: rebase to v3.8-rc3. And wrapped the commit message.

v3: big chages:
1. reduce the PMECC lookup table mapping. Just the lookup table not whole ROM code according to J.C's suggestion.
2. use simpler strategy to handle pmecc-cap, pmecc-sector-size:
* make pmecc-cap, pmecc-sector-size optional.
* If pmecc-cap, pmecc-sector-size are not set, use ONFI ecc parameters. otherwise, use those in DTS file.
* print out a warning if PMECC use different ecc bits or sector size from ONFI ecc parameters.

Josh Wu (5):
MTD: atmel_nand: avoid to report an error when lookup table offset is

    0.

ARM: at91: at91sam9x5: add DT parameters to enable PMECC
ARM: at91: at91sam9n12: add DT parameters to enable PMECC
MTD: atmel_nand: make pmecc-cap, pmecc-sector-size in dts is
optional.
MTD: at91: atmel_nand: for PMECC, add code to check the ONFI
parameter ECC requirement.

 arch/arm/boot/dts/at91sam9n12.dtsi  |    3 +-
 arch/arm/boot/dts/at91sam9n12ek.dts |    5 +-
 arch/arm/boot/dts/at91sam9x5.dtsi   |    4 +
 arch/arm/boot/dts/at91sam9x5cm.dtsi |    5 +-
 drivers/mtd/nand/atmel_nand.c       |  141 +++++++++++++++++++++++++++++------
 5 files changed, 131 insertions(+), 27 deletions(-)
Signature · 1 line
Nicolas Ferre
#9 lore raw

v3 cover at91: PMECC: enable PMECC in dt for at91sam9x5ek, at91sam9n12ek

In reply to Nicolas Ferre
Quoted 25 lines · Nicolas Ferre

On 01/23/2013 01:47 PM, Josh Wu :

Quoted 16 lines

Those patches will enable PMECC in dt parameters for at91sam9x5ek and at91sam9n12ek.

The PMECC driver will check minimum required ecc on ONFI parameter from NAND flash.

If pmecc-cap, pmecc-sector-size in dts file is specified, use those two. otherwise, set those according to NAND flash ONFI parameters.

If the pmecc-cap, pmecc-sector-size in dts are different with ecc requirement in ONFI, print out a warning.

For the following compile error:
ERROR (phandle_references): Reference to non-existent node or label "pinctrl_ssc0_tx"

Quoted 7 lines

ERROR: Input tree has errors, aborting (use -f to force output) make[2]: *** [arch/arm/boot/dts/at91sam9g20ek.dtb] Error 2

the fixes are already merged in Linux mainline in v3.8-rc4.
you can find in:
544ae6b2e676c3c37fb8c93ef9327932fc2e5bc2 (ARM: at91/dts: add pinctrl support for SSC peripheral) ea03c81521bde526570e1dec96eaa21fe5ac84a2 (ASoC: atmel-ssc: add pinctrl selection to driver)

Quoted 6 lines

Artem,

I propose to take patches 2 and 3/5 of this series via arm-soc git tree. I will specify to merge them at the end of the merge-window so that the Device Tree properties will not be out-of-sync with driver modifications (may not cause big issues anyway).

I'm not cc:d on the patches, but if it's just new properties then there's no reason to hold off to "late in the merge window". There's actually no way for you to hold that off yourself, since we won't accept new patches to arm-soc that late.

I don't see any cc to devicetree-discuss of the device tree bindings though, and no update of Documentation/device-tree/bindings/, so the patches are not ready to go in yet.

-Olof

author
#10 lore raw

v3 cover at91: PMECC: enable PMECC in dt for at91sam9x5ek, at91sam9n12ek

Hi, Olof

Quoted 31 lines · Olof Johansson
Quoted 24 lines · Nicolas Ferre

On 01/23/2013 01:47 PM, Josh Wu :

Quoted 16 lines

Those patches will enable PMECC in dt parameters for at91sam9x5ek and at91sam9n12ek.

The PMECC driver will check minimum required ecc on ONFI parameter from NAND flash.

If pmecc-cap, pmecc-sector-size in dts file is specified, use those two. otherwise, set those according to NAND flash ONFI parameters.

If the pmecc-cap, pmecc-sector-size in dts are different with ecc requirement in ONFI, print out a warning.

For the following compile error:
ERROR (phandle_references): Reference to non-existent node or label "pinctrl_ssc0_tx"

Quoted 7 lines

ERROR: Input tree has errors, aborting (use -f to force output) make[2]: *** [arch/arm/boot/dts/at91sam9g20ek.dtb] Error 2

the fixes are already merged in Linux mainline in v3.8-rc4.
you can find in:
544ae6b2e676c3c37fb8c93ef9327932fc2e5bc2 (ARM: at91/dts: add pinctrl support for SSC peripheral) ea03c81521bde526570e1dec96eaa21fe5ac84a2 (ASoC: atmel-ssc: add pinctrl selection to driver)

Quoted 6 lines

Artem,

I propose to take patches 2 and 3/5 of this series via arm-soc git tree. I will specify to merge them at the end of the merge-window so that the Device Tree properties will not be out-of-sync with driver modifications (may not cause big issues anyway).

Quoted 8 lines

I'm not cc:d on the patches, but if it's just new properties then there's no reason to hold off to "late in the merge window". There's actually no way for you to hold that off yourself, since we won't accept new patches to arm-soc that late.

I don't see any cc to devicetree-discuss of the device tree bindings though, and no update of Documentation/device-tree/bindings/, so the patches are not ready to go in yet.

Since in my commit: a41b51a1f7c15a1b00f30a3ad2d0373ad51b883d (mtd: at91:
add dt parameters for Atmel PMECC), it already added following properties to DT documentation:
atmel,pmecc-cap
atmel,pmecc-sector-size
atmel,pmecc-lookup-table-offset
so in this patches series, NO. 2 and 3 just add it to at91 board's dts file according to the DT documentation.

Indeed, this patch series make a little bit different from the DT documentation, that is: the ROM code mapping size are smaller than the DT documentation example.
But original DT documentation example still works.

So I think the DT documentation's explanation are proper for this patch series. It seems I don't have to update the DT documentation so far.

Quoted 3 lines

-Olof

Best Regards,
Josh Wu

#11 lore raw

v3 cover at91: PMECC: enable PMECC in dt for at91sam9x5ek, at91sam9n12ek

In reply to Nicolas Ferre
Quoted 25 lines · Nicolas Ferre

On 01/23/2013 01:47 PM, Josh Wu :

Quoted 16 lines

Those patches will enable PMECC in dt parameters for at91sam9x5ek and at91sam9n12ek.

The PMECC driver will check minimum required ecc on ONFI parameter from NAND flash.

If pmecc-cap, pmecc-sector-size in dts file is specified, use those two. otherwise, set those according to NAND flash ONFI parameters.

If the pmecc-cap, pmecc-sector-size in dts are different with ecc requirement in ONFI, print out a warning.

For the following compile error:
ERROR (phandle_references): Reference to non-existent node or label "pinctrl_ssc0_tx"

Quoted 7 lines

ERROR: Input tree has errors, aborting (use -f to force output) make[2]: *** [arch/arm/boot/dts/at91sam9g20ek.dtb] Error 2

the fixes are already merged in Linux mainline in v3.8-rc4.
you can find in:
544ae6b2e676c3c37fb8c93ef9327932fc2e5bc2 (ARM: at91/dts: add pinctrl support for SSC peripheral) ea03c81521bde526570e1dec96eaa21fe5ac84a2 (ASoC: atmel-ssc: add pinctrl selection to driver)

Quoted 6 lines

Artem,

I propose to take patches 2 and 3/5 of this series via arm-soc git tree. I will specify to merge them at the end of the merge-window so that the Device Tree properties will not be out-of-sync with driver modifications (may not cause big issues anyway).

Hi, just pushed patches 1, 3, and 4 to the l2-mtd.git tree, thanks!

Signature · 2 lines
Best Regards,
Artem Bityutskiy