* [PATCH 1/2] mtd: atmel_nand: introduce a new compatible string for sama5d4 chip
@ 2015-01-19 8:33 Josh Wu
2015-01-19 8:33 ` [PATCH 2/2] ARM: at91: sama5d4: dts: change the nand compatible string Josh Wu
2015-01-20 20:47 ` [PATCH 1/2] mtd: atmel_nand: introduce a new compatible string for sama5d4 chip Brian Norris
0 siblings, 2 replies; 9+ messages in thread
From: Josh Wu @ 2015-01-19 8:33 UTC (permalink / raw)
To: linux-arm-kernel
Since in SAMA5D4 chip, the PMECC can correct bit flips in erased page.
So we add a DT property to indicate this hardware character.
If the PMECC support correct bitflip erased page (all data are 0xff).
Then we can use the PMECC correct the page and skip the erased page
check.
Signed-off-by: Josh Wu <josh.wu@atmel.com>
---
.../devicetree/bindings/mtd/atmel-nand.txt | 2 +-
drivers/mtd/nand/atmel_nand.c | 25 +++++++++++++++++++++-
2 files changed, 25 insertions(+), 2 deletions(-)
diff --git a/Documentation/devicetree/bindings/mtd/atmel-nand.txt b/Documentation/devicetree/bindings/mtd/atmel-nand.txt
index 1fe6dde..7d4c8eb 100644
--- a/Documentation/devicetree/bindings/mtd/atmel-nand.txt
+++ b/Documentation/devicetree/bindings/mtd/atmel-nand.txt
@@ -1,7 +1,7 @@
Atmel NAND flash
Required properties:
-- compatible : "atmel,at91rm9200-nand".
+- compatible : should be "atmel,at91rm9200-nand" or "atmel,sama5d4-nand".
- reg : should specify localbus address and size used for the chip,
and hardware ECC controller if available.
If the hardware ECC is PMECC, it should contain address and size for
diff --git a/drivers/mtd/nand/atmel_nand.c b/drivers/mtd/nand/atmel_nand.c
index 044c9d1..8d5b008 100644
--- a/drivers/mtd/nand/atmel_nand.c
+++ b/drivers/mtd/nand/atmel_nand.c
@@ -63,6 +63,10 @@ module_param(on_flash_bbt, int, 0);
#include "atmel_nand_ecc.h" /* Hardware ECC registers */
#include "atmel_nand_nfc.h" /* Nand Flash Controller definition */
+struct atmel_nand_caps {
+ bool pmecc_correct_erase_page;
+};
+
/* oob layout for large page size
* bad block info is on bytes 0 and 1
* the bytes have to be consecutives to avoid
@@ -124,6 +128,7 @@ struct atmel_nand_host {
struct atmel_nfc *nfc;
+ struct atmel_nand_caps *caps;
bool has_pmecc;
u8 pmecc_corr_cap;
u16 pmecc_sector_size;
@@ -849,6 +854,10 @@ static int pmecc_correction(struct mtd_info *mtd, u32 pmecc_stat, uint8_t *buf,
uint8_t *buf_pos;
int max_bitflips = 0;
+ /* If can correct bitfilps from erased page, do the normal check */
+ if (host->caps->pmecc_correct_erase_page)
+ goto normal_check;
+
for (i = 0; i < nand_chip->ecc.total; i++)
if (ecc[i] != 0xff)
goto normal_check;
@@ -1474,6 +1483,8 @@ static void atmel_nand_hwctl(struct mtd_info *mtd, int mode)
ecc_writel(host->ecc, CR, ATMEL_ECC_RST);
}
+static const struct of_device_id atmel_nand_dt_ids[];
+
static int atmel_of_init_port(struct atmel_nand_host *host,
struct device_node *np)
{
@@ -1483,6 +1494,9 @@ static int atmel_of_init_port(struct atmel_nand_host *host,
struct atmel_nand_data *board = &host->board;
enum of_gpio_flags flags = 0;
+ host->caps = (struct atmel_nand_caps *)
+ of_match_device(atmel_nand_dt_ids, host->dev)->data;
+
if (of_property_read_u32(np, "atmel,nand-addr-offset", &val) == 0) {
if (val >= 32) {
dev_err(host->dev, "invalid addr-offset %u\n", val);
@@ -2287,8 +2301,17 @@ static int atmel_nand_remove(struct platform_device *pdev)
return 0;
}
+static struct atmel_nand_caps at91rm9200_caps = {
+ .pmecc_correct_erase_page = false,
+};
+
+static struct atmel_nand_caps sama5d4_caps = {
+ .pmecc_correct_erase_page = true,
+};
+
static const struct of_device_id atmel_nand_dt_ids[] = {
- { .compatible = "atmel,at91rm9200-nand" },
+ { .compatible = "atmel,at91rm9200-nand", .data = &at91rm9200_caps },
+ { .compatible = "atmel,sama5d4-nand", .data = &sama5d4_caps },
{ /* sentinel */ }
};
--
1.9.1
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCH 2/2] ARM: at91: sama5d4: dts: change the nand compatible string
2015-01-19 8:33 [PATCH 1/2] mtd: atmel_nand: introduce a new compatible string for sama5d4 chip Josh Wu
@ 2015-01-19 8:33 ` Josh Wu
2015-01-20 20:49 ` Brian Norris
2015-01-22 10:41 ` [PATCH v2] " Josh Wu
2015-01-20 20:47 ` [PATCH 1/2] mtd: atmel_nand: introduce a new compatible string for sama5d4 chip Brian Norris
1 sibling, 2 replies; 9+ messages in thread
From: Josh Wu @ 2015-01-19 8:33 UTC (permalink / raw)
To: linux-arm-kernel
As we introduce a new "atmel,sama5d4-nand" compatible string for sama5d4,
so we need to apply it for sama5d4 chip.
Signed-off-by: Josh Wu <josh.wu@atmel.com>
---
arch/arm/boot/dts/sama5d4.dtsi | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/arch/arm/boot/dts/sama5d4.dtsi b/arch/arm/boot/dts/sama5d4.dtsi
index 1b0f30c..02d67c2 100644
--- a/arch/arm/boot/dts/sama5d4.dtsi
+++ b/arch/arm/boot/dts/sama5d4.dtsi
@@ -267,7 +267,7 @@
};
nand0: nand at 80000000 {
- compatible = "atmel,at91rm9200-nand";
+ compatible = "atmel,sama5d4-nand";
#address-cells = <1>;
#size-cells = <1>;
ranges;
--
1.9.1
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCH 1/2] mtd: atmel_nand: introduce a new compatible string for sama5d4 chip
2015-01-19 8:33 [PATCH 1/2] mtd: atmel_nand: introduce a new compatible string for sama5d4 chip Josh Wu
2015-01-19 8:33 ` [PATCH 2/2] ARM: at91: sama5d4: dts: change the nand compatible string Josh Wu
@ 2015-01-20 20:47 ` Brian Norris
1 sibling, 0 replies; 9+ messages in thread
From: Brian Norris @ 2015-01-20 20:47 UTC (permalink / raw)
To: linux-arm-kernel
On Mon, Jan 19, 2015 at 04:33:06PM +0800, Josh Wu wrote:
> Since in SAMA5D4 chip, the PMECC can correct bit flips in erased page.
> So we add a DT property to indicate this hardware character.
>
> If the PMECC support correct bitflip erased page (all data are 0xff).
> Then we can use the PMECC correct the page and skip the erased page
> check.
>
> Signed-off-by: Josh Wu <josh.wu@atmel.com>
Pushed to l2-mtd.git.
Brian
^ permalink raw reply [flat|nested] 9+ messages in thread
* [PATCH 2/2] ARM: at91: sama5d4: dts: change the nand compatible string
2015-01-19 8:33 ` [PATCH 2/2] ARM: at91: sama5d4: dts: change the nand compatible string Josh Wu
@ 2015-01-20 20:49 ` Brian Norris
2015-01-21 3:55 ` Josh Wu
2015-01-22 10:41 ` [PATCH v2] " Josh Wu
1 sibling, 1 reply; 9+ messages in thread
From: Brian Norris @ 2015-01-20 20:49 UTC (permalink / raw)
To: linux-arm-kernel
On Mon, Jan 19, 2015 at 04:33:07PM +0800, Josh Wu wrote:
> As we introduce a new "atmel,sama5d4-nand" compatible string for sama5d4,
> so we need to apply it for sama5d4 chip.
>
> Signed-off-by: Josh Wu <josh.wu@atmel.com>
> ---
>
> arch/arm/boot/dts/sama5d4.dtsi | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/arch/arm/boot/dts/sama5d4.dtsi b/arch/arm/boot/dts/sama5d4.dtsi
> index 1b0f30c..02d67c2 100644
> --- a/arch/arm/boot/dts/sama5d4.dtsi
> +++ b/arch/arm/boot/dts/sama5d4.dtsi
> @@ -267,7 +267,7 @@
> };
>
> nand0: nand at 80000000 {
> - compatible = "atmel,at91rm9200-nand";
> + compatible = "atmel,sama5d4-nand";
Wouldn't it make sense to include both compatible strings, so that old
kernels can still bind to it? The newer IP only adds a new ECC feature,
but the driver still can work fine without handling it, right?
> #address-cells = <1>;
> #size-cells = <1>;
> ranges;
Brian
^ permalink raw reply [flat|nested] 9+ messages in thread
* [PATCH 2/2] ARM: at91: sama5d4: dts: change the nand compatible string
2015-01-20 20:49 ` Brian Norris
@ 2015-01-21 3:55 ` Josh Wu
0 siblings, 0 replies; 9+ messages in thread
From: Josh Wu @ 2015-01-21 3:55 UTC (permalink / raw)
To: linux-arm-kernel
Hi, Brain
On 1/21/2015 4:49 AM, Brian Norris wrote:
> On Mon, Jan 19, 2015 at 04:33:07PM +0800, Josh Wu wrote:
>> As we introduce a new "atmel,sama5d4-nand" compatible string for sama5d4,
>> so we need to apply it for sama5d4 chip.
>>
>> Signed-off-by: Josh Wu <josh.wu@atmel.com>
>> ---
>>
>> arch/arm/boot/dts/sama5d4.dtsi | 2 +-
>> 1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/arch/arm/boot/dts/sama5d4.dtsi b/arch/arm/boot/dts/sama5d4.dtsi
>> index 1b0f30c..02d67c2 100644
>> --- a/arch/arm/boot/dts/sama5d4.dtsi
>> +++ b/arch/arm/boot/dts/sama5d4.dtsi
>> @@ -267,7 +267,7 @@
>> };
>>
>> nand0: nand at 80000000 {
>> - compatible = "atmel,at91rm9200-nand";
>> + compatible = "atmel,sama5d4-nand";
> Wouldn't it make sense to include both compatible strings, so that old
> kernels can still bind to it?
yes, that make sense. I'll add it.
> The newer IP only adds a new ECC feature,
> but the driver still can work fine without handling it, right?
so far it works fine without this new feature. But I am not 100% sure
for this :-)
Best Regards,
Josh Wu
>
>> #address-cells = <1>;
>> #size-cells = <1>;
>> ranges;
> Brian
^ permalink raw reply [flat|nested] 9+ messages in thread
* [PATCH v2] ARM: at91: sama5d4: dts: change the nand compatible string
2015-01-19 8:33 ` [PATCH 2/2] ARM: at91: sama5d4: dts: change the nand compatible string Josh Wu
2015-01-20 20:49 ` Brian Norris
@ 2015-01-22 10:41 ` Josh Wu
2015-01-22 11:01 ` Nicolas Ferre
1 sibling, 1 reply; 9+ messages in thread
From: Josh Wu @ 2015-01-22 10:41 UTC (permalink / raw)
To: linux-arm-kernel
As we introduce a new "atmel,sama5d4-nand" compatible string for sama5d4,
so we need to apply it for sama5d4 chip.
Signed-off-by: Josh Wu <josh.wu@atmel.com>
---
Changes in v2:
- still keep the old rm9200 nand compatible string for compatible old driver.
arch/arm/boot/dts/sama5d4.dtsi | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/arch/arm/boot/dts/sama5d4.dtsi b/arch/arm/boot/dts/sama5d4.dtsi
index 1b0f30c..e40b1da 100644
--- a/arch/arm/boot/dts/sama5d4.dtsi
+++ b/arch/arm/boot/dts/sama5d4.dtsi
@@ -267,7 +267,7 @@
};
nand0: nand at 80000000 {
- compatible = "atmel,at91rm9200-nand";
+ compatible = "atmel,sama5d4-nand", "atmel,at91rm9200-nand";
#address-cells = <1>;
#size-cells = <1>;
ranges;
--
1.9.1
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCH v2] ARM: at91: sama5d4: dts: change the nand compatible string
2015-01-22 10:41 ` [PATCH v2] " Josh Wu
@ 2015-01-22 11:01 ` Nicolas Ferre
2015-01-26 15:07 ` Nicolas Ferre
0 siblings, 1 reply; 9+ messages in thread
From: Nicolas Ferre @ 2015-01-22 11:01 UTC (permalink / raw)
To: linux-arm-kernel
Le 22/01/2015 11:41, Josh Wu a ?crit :
> As we introduce a new "atmel,sama5d4-nand" compatible string for sama5d4,
> so we need to apply it for sama5d4 chip.
>
> Signed-off-by: Josh Wu <josh.wu@atmel.com>
Acked-by: Nicolas Ferre <nicolas.ferre@atmel.com>
Brian,
I suppose that it makes sense to keep this patch with the previous one.
So, can you take it in your tree?
Otherwise, it can take the at91 -> arm-soc route.
Bye,
> ---
>
> Changes in v2:
> - still keep the old rm9200 nand compatible string for compatible old driver.
>
> arch/arm/boot/dts/sama5d4.dtsi | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/arch/arm/boot/dts/sama5d4.dtsi b/arch/arm/boot/dts/sama5d4.dtsi
> index 1b0f30c..e40b1da 100644
> --- a/arch/arm/boot/dts/sama5d4.dtsi
> +++ b/arch/arm/boot/dts/sama5d4.dtsi
> @@ -267,7 +267,7 @@
> };
>
> nand0: nand at 80000000 {
> - compatible = "atmel,at91rm9200-nand";
> + compatible = "atmel,sama5d4-nand", "atmel,at91rm9200-nand";
> #address-cells = <1>;
> #size-cells = <1>;
> ranges;
>
--
Nicolas Ferre
^ permalink raw reply [flat|nested] 9+ messages in thread
* [PATCH v2] ARM: at91: sama5d4: dts: change the nand compatible string
2015-01-22 11:01 ` Nicolas Ferre
@ 2015-01-26 15:07 ` Nicolas Ferre
2015-01-26 17:12 ` Brian Norris
0 siblings, 1 reply; 9+ messages in thread
From: Nicolas Ferre @ 2015-01-26 15:07 UTC (permalink / raw)
To: linux-arm-kernel
Le 22/01/2015 12:01, Nicolas Ferre a ?crit :
> Le 22/01/2015 11:41, Josh Wu a ?crit :
>> As we introduce a new "atmel,sama5d4-nand" compatible string for sama5d4,
>> so we need to apply it for sama5d4 chip.
>>
>> Signed-off-by: Josh Wu <josh.wu@atmel.com>
>
> Acked-by: Nicolas Ferre <nicolas.ferre@atmel.com>
>
> Brian,
> I suppose that it makes sense to keep this patch with the previous one.
> So, can you take it in your tree?
>
> Otherwise, it can take the at91 -> arm-soc route.
Bryan,
I take it with me right now and try to send it to arm-soc for 3.20.
Best regards,
>> ---
>>
>> Changes in v2:
>> - still keep the old rm9200 nand compatible string for compatible old driver.
>>
>> arch/arm/boot/dts/sama5d4.dtsi | 2 +-
>> 1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/arch/arm/boot/dts/sama5d4.dtsi b/arch/arm/boot/dts/sama5d4.dtsi
>> index 1b0f30c..e40b1da 100644
>> --- a/arch/arm/boot/dts/sama5d4.dtsi
>> +++ b/arch/arm/boot/dts/sama5d4.dtsi
>> @@ -267,7 +267,7 @@
>> };
>>
>> nand0: nand at 80000000 {
>> - compatible = "atmel,at91rm9200-nand";
>> + compatible = "atmel,sama5d4-nand", "atmel,at91rm9200-nand";
>> #address-cells = <1>;
>> #size-cells = <1>;
>> ranges;
>>
>
>
--
Nicolas Ferre
^ permalink raw reply [flat|nested] 9+ messages in thread
* [PATCH v2] ARM: at91: sama5d4: dts: change the nand compatible string
2015-01-26 15:07 ` Nicolas Ferre
@ 2015-01-26 17:12 ` Brian Norris
0 siblings, 0 replies; 9+ messages in thread
From: Brian Norris @ 2015-01-26 17:12 UTC (permalink / raw)
To: linux-arm-kernel
On Mon, Jan 26, 2015 at 04:07:36PM +0100, Nicolas Ferre wrote:
> Le 22/01/2015 12:01, Nicolas Ferre a ?crit :
> > Le 22/01/2015 11:41, Josh Wu a ?crit :
> >> As we introduce a new "atmel,sama5d4-nand" compatible string for sama5d4,
> >> so we need to apply it for sama5d4 chip.
> >>
> >> Signed-off-by: Josh Wu <josh.wu@atmel.com>
> >
> > Acked-by: Nicolas Ferre <nicolas.ferre@atmel.com>
> >
> > Brian,
> > I suppose that it makes sense to keep this patch with the previous one.
> > So, can you take it in your tree?
> >
> > Otherwise, it can take the at91 -> arm-soc route.
I actually would prefer that. The changes are sane enough by themselves,
and I don't often touch the arch/arm DTS files.
> I take it with me right now and try to send it to arm-soc for 3.20.
That's fine. Thanks.
Brian
^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2015-01-26 17:12 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-01-19 8:33 [PATCH 1/2] mtd: atmel_nand: introduce a new compatible string for sama5d4 chip Josh Wu
2015-01-19 8:33 ` [PATCH 2/2] ARM: at91: sama5d4: dts: change the nand compatible string Josh Wu
2015-01-20 20:49 ` Brian Norris
2015-01-21 3:55 ` Josh Wu
2015-01-22 10:41 ` [PATCH v2] " Josh Wu
2015-01-22 11:01 ` Nicolas Ferre
2015-01-26 15:07 ` Nicolas Ferre
2015-01-26 17:12 ` Brian Norris
2015-01-20 20:47 ` [PATCH 1/2] mtd: atmel_nand: introduce a new compatible string for sama5d4 chip Brian Norris
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).