linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* NAND support for Armada 370
@ 2014-01-02 12:44 Rodolfo Giometti
  2014-01-02 13:42 ` Thomas Petazzoni
  0 siblings, 1 reply; 10+ messages in thread
From: Rodolfo Giometti @ 2014-01-02 12:44 UTC (permalink / raw)
  To: linux-arm-kernel

Hello Gregory,

I'm working on vanilla kernel 3.13-rc6 and an Armada-370 based board
(compatible with armada-370-db) and I'm trying to get NAND support
working.

I noticed that on my kernel is missing your patch named "[PATCH v2
01/27] clk: mvebu: Add Core Divider clock", however after applying it
I get:

   pxa3xx-nand f10d0000.nand: This platform can't do DMA on this device
   pxa3xx-nand f10d0000.nand: Wait time out!!!
   pxa3xx-nand f10d0000.nand: Wait time out!!!
   pxa3xx-nand f10d0000.nand: Wait time out!!!
   No NAND device found

Do I still miss something? And what about DMA support?

Thanks in advance,

Rodolfo

-- 

GNU/Linux Solutions                  e-mail: giometti at enneenne.com
Linux Device Driver                          giometti at linux.it
Embedded Systems                     phone:  +39 349 2432127
UNIX programming                     skype:  rodolfo.giometti
Freelance ICT Italia - Consulente ICT Italia - www.consulenti-ict.it

^ permalink raw reply	[flat|nested] 10+ messages in thread

* NAND support for Armada 370
  2014-01-02 12:44 NAND support for Armada 370 Rodolfo Giometti
@ 2014-01-02 13:42 ` Thomas Petazzoni
  2014-01-02 13:50   ` Rodolfo Giometti
  2014-01-03 11:29   ` Rodolfo Giometti
  0 siblings, 2 replies; 10+ messages in thread
From: Thomas Petazzoni @ 2014-01-02 13:42 UTC (permalink / raw)
  To: linux-arm-kernel

Dear Rodolfo Giometti,

The e-mail address you used for Gregory is wrong. Also, for NAND
questions, you should Cc Ezequiel Garcia (I added him), as he is our
NAND driver developer.

On Thu, 2 Jan 2014 13:44:07 +0100, Rodolfo Giometti wrote:

> I'm working on vanilla kernel 3.13-rc6 and an Armada-370 based board
> (compatible with armada-370-db) and I'm trying to get NAND support
> working.
> 
> I noticed that on my kernel is missing your patch named "[PATCH v2
> 01/27] clk: mvebu: Add Core Divider clock", however after applying it
> I get:
> 
>    pxa3xx-nand f10d0000.nand: This platform can't do DMA on this device
>    pxa3xx-nand f10d0000.nand: Wait time out!!!
>    pxa3xx-nand f10d0000.nand: Wait time out!!!
>    pxa3xx-nand f10d0000.nand: Wait time out!!!
>    No NAND device found
> 
> Do I still miss something? And what about DMA support?

The 3.13-rc kernels do not have NAND support for Armada 370/XP. The
NAND support will only arrive in 3.14. You can try the linux-next tree,
but I'm not sure it has absolutely all of the patches that are needed
(I see at least one potentially missing).

Alternatively, you can use the backport-3.10 branch at
https://github.com/MISL-EBU-System-SW/mainline-public/commits/backport-3.10.
It is based on 3.10, and has a good number of backported patches,
including NAND support.

Best regards,

Thomas
-- 
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com

^ permalink raw reply	[flat|nested] 10+ messages in thread

* NAND support for Armada 370
  2014-01-02 13:42 ` Thomas Petazzoni
@ 2014-01-02 13:50   ` Rodolfo Giometti
  2014-01-03 11:29   ` Rodolfo Giometti
  1 sibling, 0 replies; 10+ messages in thread
From: Rodolfo Giometti @ 2014-01-02 13:50 UTC (permalink / raw)
  To: linux-arm-kernel

On Thu, Jan 02, 2014 at 02:42:36PM +0100, Thomas Petazzoni wrote:
> Dear Rodolfo Giometti,
> 
> The e-mail address you used for Gregory is wrong.

I see... sorry! I did too much cut&paste! :-P

> Also, for NAND questions, you should Cc Ezequiel Garcia (I added
> him), as he is our NAND driver developer.

Thanks a lot for your help!

Rodolfo

-- 

GNU/Linux Solutions                  e-mail: giometti at enneenne.com
Linux Device Driver                          giometti at linux.it
Embedded Systems                     phone:  +39 349 2432127
UNIX programming                     skype:  rodolfo.giometti
Freelance ICT Italia - Consulente ICT Italia - www.consulenti-ict.it

^ permalink raw reply	[flat|nested] 10+ messages in thread

* NAND support for Armada 370
  2014-01-02 13:42 ` Thomas Petazzoni
  2014-01-02 13:50   ` Rodolfo Giometti
@ 2014-01-03 11:29   ` Rodolfo Giometti
  2014-01-03 14:53     ` Ezequiel Garcia
  1 sibling, 1 reply; 10+ messages in thread
From: Rodolfo Giometti @ 2014-01-03 11:29 UTC (permalink / raw)
  To: linux-arm-kernel

On Thu, Jan 02, 2014 at 02:42:36PM +0100, Thomas Petazzoni wrote:
> 
> The 3.13-rc kernels do not have NAND support for Armada 370/XP. The
> NAND support will only arrive in 3.14. You can try the linux-next tree,
> but I'm not sure it has absolutely all of the patches that are needed
> (I see at least one potentially missing).
> 
> Alternatively, you can use the backport-3.10 branch at
> https://github.com/MISL-EBU-System-SW/mainline-public/commits/backport-3.10.
> It is based on 3.10, and has a good number of backported patches,
> including NAND support.

I got several patches from here:

   https://github.com/MISL-EBU-System-SW/mainline-public.git

and now I have:

   pxa3xx-nand f10d0000.nand: This platform can't do DMA on this device
   NAND device: Manufacturer ID: 0x2c, Chip ID: 0xf1 (Micron MT29F1G08ABADAWP)
   NAND device: 128MiB, SLC, page size: 2048, OOB size: 64
   pxa3xx-nand f10d0000.nand: ECC strength 4 at page size 2048 is not supported
   pxa3xx-nand f10d0000.nand: failed to scan nand at cs 0

So I suppose I should modify function pxa_ecc_init() in file
drivers/mtd/nand/pxa3xx_nand.c in order to support my NAND chip, is
that right? Have you any advice for me about it? :)

Thanks a lot,

Rodolfo

-- 

GNU/Linux Solutions                  e-mail: giometti at enneenne.com
Linux Device Driver                          giometti at linux.it
Embedded Systems                     phone:  +39 349 2432127
UNIX programming                     skype:  rodolfo.giometti
Freelance ICT Italia - Consulente ICT Italia - www.consulenti-ict.it

^ permalink raw reply	[flat|nested] 10+ messages in thread

* NAND support for Armada 370
  2014-01-03 11:29   ` Rodolfo Giometti
@ 2014-01-03 14:53     ` Ezequiel Garcia
  2014-01-03 15:32       ` Rodolfo Giometti
  2014-01-06 15:34       ` Rodolfo Giometti
  0 siblings, 2 replies; 10+ messages in thread
From: Ezequiel Garcia @ 2014-01-03 14:53 UTC (permalink / raw)
  To: linux-arm-kernel

On Fri, Jan 03, 2014 at 12:29:27PM +0100, Rodolfo Giometti wrote:
> On Thu, Jan 02, 2014 at 02:42:36PM +0100, Thomas Petazzoni wrote:
> > 
> > The 3.13-rc kernels do not have NAND support for Armada 370/XP. The
> > NAND support will only arrive in 3.14. You can try the linux-next tree,
> > but I'm not sure it has absolutely all of the patches that are needed
> > (I see at least one potentially missing).
> > 
> > Alternatively, you can use the backport-3.10 branch at
> > https://github.com/MISL-EBU-System-SW/mainline-public/commits/backport-3.10.
> > It is based on 3.10, and has a good number of backported patches,
> > including NAND support.
> 
> I got several patches from here:
> 
>    https://github.com/MISL-EBU-System-SW/mainline-public.git
> 
> and now I have:
> 
>    pxa3xx-nand f10d0000.nand: This platform can't do DMA on this device
>    NAND device: Manufacturer ID: 0x2c, Chip ID: 0xf1 (Micron MT29F1G08ABADAWP)
>    NAND device: 128MiB, SLC, page size: 2048, OOB size: 64

Great! Your NAND is now detected...

>    pxa3xx-nand f10d0000.nand: ECC strength 4 at page size 2048 is not supported
>    pxa3xx-nand f10d0000.nand: failed to scan nand at cs 0
> 
> So I suppose I should modify function pxa_ecc_init() in file
> drivers/mtd/nand/pxa3xx_nand.c in order to support my NAND chip, is
> that right? Have you any advice for me about it? :)
> 

Can you modify the above message so the ECC step size is also printed?
I'll help you prepare a suitable fix to support your NAND.

Thanks!
-- 
Ezequiel Garc?a, Free Electrons
Embedded Linux, Kernel and Android Engineering
http://free-electrons.com

^ permalink raw reply	[flat|nested] 10+ messages in thread

* NAND support for Armada 370
  2014-01-03 14:53     ` Ezequiel Garcia
@ 2014-01-03 15:32       ` Rodolfo Giometti
  2014-01-06 15:34       ` Rodolfo Giometti
  1 sibling, 0 replies; 10+ messages in thread
From: Rodolfo Giometti @ 2014-01-03 15:32 UTC (permalink / raw)
  To: linux-arm-kernel

On Fri, Jan 03, 2014 at 11:53:37AM -0300, Ezequiel Garcia wrote:
> >    pxa3xx-nand f10d0000.nand: This platform can't do DMA on this device
> >    NAND device: Manufacturer ID: 0x2c, Chip ID: 0xf1 (Micron MT29F1G08ABADAWP)
> >    NAND device: 128MiB, SLC, page size: 2048, OOB size: 64
> 
> Great! Your NAND is now detected...
> 
> >    pxa3xx-nand f10d0000.nand: ECC strength 4 at page size 2048 is not supported
> >    pxa3xx-nand f10d0000.nand: failed to scan nand at cs 0
> > 
> > So I suppose I should modify function pxa_ecc_init() in file
> > drivers/mtd/nand/pxa3xx_nand.c in order to support my NAND chip, is
> > that right? Have you any advice for me about it? :)
> > 
> 
> Can you modify the above message so the ECC step size is also printed?

Here my modification:

   diff --git a/drivers/mtd/nand/pxa3xx_nand.c b/drivers/mtd/nand/pxa3xx_nand.c
   index 31aae53..3e4519f 100644
   --- a/drivers/mtd/nand/pxa3xx_nand.c
   +++ b/drivers/mtd/nand/pxa3xx_nand.c
   @@ -1498,6 +1508,8 @@ KEEP_CONFIG:
    
           ecc_strength = chip->ecc_strength_ds;
           ecc_step = chip->ecc_step_ds;
   +       dev_info(&info->pdev->dev, "ECC strength %d, ECC step size %d\n",
   +                       ecc_strength, ecc_step);
    
           /* Set default ECC strength requirements on non-ONFI devices */
           if (ecc_strength < 1 && ecc_step < 1) {

and the corresponding output:

   pxa3xx-nand f10d0000.nand: ECC strength 4, ECC step size 512

> I'll help you prepare a suitable fix to support your NAND.

Great. Thanks! :-)

Ciao,

Rodolfo

-- 

GNU/Linux Solutions                  e-mail: giometti at enneenne.com
Linux Device Driver                          giometti at linux.it
Embedded Systems                     phone:  +39 349 2432127
UNIX programming                     skype:  rodolfo.giometti
Freelance ICT Italia - Consulente ICT Italia - www.consulenti-ict.it

^ permalink raw reply	[flat|nested] 10+ messages in thread

* NAND support for Armada 370
  2014-01-03 14:53     ` Ezequiel Garcia
  2014-01-03 15:32       ` Rodolfo Giometti
@ 2014-01-06 15:34       ` Rodolfo Giometti
  2014-01-08 23:36         ` Ezequiel Garcia
  2014-01-13 11:10         ` Ezequiel Garcia
  1 sibling, 2 replies; 10+ messages in thread
From: Rodolfo Giometti @ 2014-01-06 15:34 UTC (permalink / raw)
  To: linux-arm-kernel

On Fri, Jan 03, 2014 at 11:53:37AM -0300, Ezequiel Garcia wrote:
> 
> Can you modify the above message so the ECC step size is also printed?
> I'll help you prepare a suitable fix to support your NAND.

After some attemps I found this configuration... however I'd like to
have your opinion about it since I'm not so sure that I correctly
understood what each parameter means. :-)

Thanks in advance,

Rodolfo

-- 

GNU/Linux Solutions                  e-mail: giometti at enneenne.com
Linux Device Driver                          giometti at linux.it
Embedded Systems                     phone:  +39 349 2432127
UNIX programming                     skype:  rodolfo.giometti
Freelance ICT Italia - Consulente ICT Italia - www.consulenti-ict.it
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-mtd-pxa3xx_nand.c-add-support-for-2048-bytes-page-si.patch
Type: text/x-diff
Size: 1656 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20140106/af46e3dc/attachment.bin>

^ permalink raw reply	[flat|nested] 10+ messages in thread

* NAND support for Armada 370
  2014-01-06 15:34       ` Rodolfo Giometti
@ 2014-01-08 23:36         ` Ezequiel Garcia
  2014-01-09 16:33           ` Rodolfo Giometti
  2014-01-13 11:10         ` Ezequiel Garcia
  1 sibling, 1 reply; 10+ messages in thread
From: Ezequiel Garcia @ 2014-01-08 23:36 UTC (permalink / raw)
  To: linux-arm-kernel

Hi Rodolfo,

(Ccing MTD list so they can review this as well)

On Mon, Jan 06, 2014 at 04:34:38PM +0100, Rodolfo Giometti wrote:
> On Fri, Jan 03, 2014 at 11:53:37AM -0300, Ezequiel Garcia wrote:
> > 
> > Can you modify the above message so the ECC step size is also printed?
> > I'll help you prepare a suitable fix to support your NAND.
> 
> After some attemps I found this configuration... however I'd like to
> have your opinion about it since I'm not so sure that I correctly
> understood what each parameter means. :-)
> 

Sorry for being so unresponsive these days, I've been on vacation.
I'll review your patch on Monday.

In fact, already took a quick look and it looks good. I have a few
doubts:

1. Do we need the ECC layout? (MTD already provides defaults)

2. Is this compatible with Marvell's U-Boot? (can you write from U-Boot,
and read from Linux, and viceversa?)

Regards and thanks a lot for your contribution!
Ezequiel

> From 8fc320506e1573dbff4844f4d98e20ff91c43ffd Mon Sep 17 00:00:00 2001
> From: Rodolfo Giometti <giometti@linux.it>
> Date: Mon, 6 Jan 2014 16:18:49 +0100
> Subject: [PATCH] mtd pxa3xx_nand.c: add support for 2048 bytes page size
>  layout
> 
> Signed-off-by: Rodolfo Giometti <giometti@linux.it>
> ---
>  drivers/mtd/nand/pxa3xx_nand.c | 21 +++++++++++++++++++++
>  1 file changed, 21 insertions(+)
> 
> diff --git a/drivers/mtd/nand/pxa3xx_nand.c b/drivers/mtd/nand/pxa3xx_nand.c
> index 31aae53..2a7a0b2 100644
> --- a/drivers/mtd/nand/pxa3xx_nand.c
> +++ b/drivers/mtd/nand/pxa3xx_nand.c
> @@ -286,6 +286,16 @@ static struct nand_bbt_descr bbt_mirror_descr = {
>  	.pattern = bbt_mirror_pattern
>  };
>  
> +static struct nand_ecclayout ecc_layout_2KB_bch4bit = {
> +	.eccbytes = 32,
> +	.eccpos = {
> +		32, 33, 34, 35, 36, 37, 38, 39,
> +		40, 41, 42, 43, 44, 45, 46, 47,
> +		48, 49, 50, 51, 52, 53, 54, 55,
> +		56, 57, 58, 59, 60, 61, 62, 63},
> +	.oobfree = { {2, 30} }
> +};
> +
>  static struct nand_ecclayout ecc_layout_4KB_bch4bit = {
>  	.eccbytes = 64,
>  	.eccpos = {
> @@ -1360,6 +1370,17 @@ static int pxa_ecc_init(struct pxa3xx_nand_info *info,
>  	 * Required ECC: 4-bit correction per 512 bytes
>  	 * Select: 16-bit correction per 2048 bytes
>  	 */
> +	} else if (strength == 4 && ecc_stepsize == 512 && page_size == 2048) {
> +		info->ecc_bch = 1;
> +		info->chunk_size = 2048;
> +		info->spare_size = 32;
> +		info->ecc_size = 32;
> +		ecc->mode = NAND_ECC_HW;
> +		ecc->size = info->chunk_size;
> +		ecc->layout = &ecc_layout_2KB_bch4bit;
> +		ecc->strength = 16;
> +		return 1;
> +
>  	} else if (strength == 4 && ecc_stepsize == 512 && page_size == 4096) {
>  		info->ecc_bch = 1;
>  		info->chunk_size = 2048;
> -- 
> 1.8.1.2
> 


-- 
Ezequiel Garc?a, Free Electrons
Embedded Linux, Kernel and Android Engineering
http://free-electrons.com

^ permalink raw reply	[flat|nested] 10+ messages in thread

* NAND support for Armada 370
  2014-01-08 23:36         ` Ezequiel Garcia
@ 2014-01-09 16:33           ` Rodolfo Giometti
  0 siblings, 0 replies; 10+ messages in thread
From: Rodolfo Giometti @ 2014-01-09 16:33 UTC (permalink / raw)
  To: linux-arm-kernel

On Wed, Jan 08, 2014 at 08:36:03PM -0300, Ezequiel Garcia wrote:
> Hi Rodolfo,
> 
> Sorry for being so unresponsive these days, I've been on vacation.
> I'll review your patch on Monday.

Ok.

> In fact, already took a quick look and it looks good. I have a few
> doubts:
> 
> 1. Do we need the ECC layout? (MTD already provides defaults)

Ok, I did some testes and we can safely remove it! :)

> 2. Is this compatible with Marvell's U-Boot? (can you write from U-Boot,
> and read from Linux, and viceversa?)

Till now all our tests are ok! :)

Attached is the new patch release.

Ciao,

Rodolfo

-- 

GNU/Linux Solutions                  e-mail: giometti at enneenne.com
Linux Device Driver                          giometti at linux.it
Embedded Systems                     phone:  +39 349 2432127
UNIX programming                     skype:  rodolfo.giometti
Freelance ICT Italia - Consulente ICT Italia - www.consulenti-ict.it
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-mtd-pxa3xx_nand.c-add-support-for-2048-bytes-page-si.patch
Type: text/x-diff
Size: 1192 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20140109/2c993927/attachment.bin>

^ permalink raw reply	[flat|nested] 10+ messages in thread

* NAND support for Armada 370
  2014-01-06 15:34       ` Rodolfo Giometti
  2014-01-08 23:36         ` Ezequiel Garcia
@ 2014-01-13 11:10         ` Ezequiel Garcia
  1 sibling, 0 replies; 10+ messages in thread
From: Ezequiel Garcia @ 2014-01-13 11:10 UTC (permalink / raw)
  To: linux-arm-kernel

Rodolfo,

After reviewing the driver and the NAND kernel core, I think we should
use your first version of the patch (with the custom ECC layout).

The default ECC layout provided by Linux for 64-byte OOB is different from
the actual layout used by the ECC BCH "16-bit over 2048B" that we use.

IIRC, this ECC layout is not really in use so that's why you didn't spot
any issues while removing. Nevertheless, we should try to have it right.

Can you please re-submit the quoted patch (see below) to the MTD mailing list?
(don't forget to add me on Cc)

Thanks a lot!

> From 8fc320506e1573dbff4844f4d98e20ff91c43ffd Mon Sep 17 00:00:00 2001
> From: Rodolfo Giometti <giometti@linux.it>
> Date: Mon, 6 Jan 2014 16:18:49 +0100
> Subject: [PATCH] mtd pxa3xx_nand.c: add support for 2048 bytes page size
>  layout
> 
> Signed-off-by: Rodolfo Giometti <giometti@linux.it>
> ---
>  drivers/mtd/nand/pxa3xx_nand.c | 21 +++++++++++++++++++++
>  1 file changed, 21 insertions(+)
> 
> diff --git a/drivers/mtd/nand/pxa3xx_nand.c b/drivers/mtd/nand/pxa3xx_nand.c
> index 31aae53..2a7a0b2 100644
> --- a/drivers/mtd/nand/pxa3xx_nand.c
> +++ b/drivers/mtd/nand/pxa3xx_nand.c
> @@ -286,6 +286,16 @@ static struct nand_bbt_descr bbt_mirror_descr = {
>  	.pattern = bbt_mirror_pattern
>  };
>  
> +static struct nand_ecclayout ecc_layout_2KB_bch4bit = {
> +	.eccbytes = 32,
> +	.eccpos = {
> +		32, 33, 34, 35, 36, 37, 38, 39,
> +		40, 41, 42, 43, 44, 45, 46, 47,
> +		48, 49, 50, 51, 52, 53, 54, 55,
> +		56, 57, 58, 59, 60, 61, 62, 63},
> +	.oobfree = { {2, 30} }
> +};
> +
>  static struct nand_ecclayout ecc_layout_4KB_bch4bit = {
>  	.eccbytes = 64,
>  	.eccpos = {
> @@ -1360,6 +1370,17 @@ static int pxa_ecc_init(struct pxa3xx_nand_info *info,
>  	 * Required ECC: 4-bit correction per 512 bytes
>  	 * Select: 16-bit correction per 2048 bytes
>  	 */
> +	} else if (strength == 4 && ecc_stepsize == 512 && page_size == 2048) {
> +		info->ecc_bch = 1;
> +		info->chunk_size = 2048;
> +		info->spare_size = 32;
> +		info->ecc_size = 32;
> +		ecc->mode = NAND_ECC_HW;
> +		ecc->size = info->chunk_size;
> +		ecc->layout = &ecc_layout_2KB_bch4bit;
> +		ecc->strength = 16;
> +		return 1;
> +
>  	} else if (strength == 4 && ecc_stepsize == 512 && page_size == 4096) {
>  		info->ecc_bch = 1;
>  		info->chunk_size = 2048;
> -- 
> 1.8.1.2
> 


-- 
Ezequiel Garc?a, Free Electrons
Embedded Linux, Kernel and Android Engineering
http://free-electrons.com

^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2014-01-13 11:10 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-01-02 12:44 NAND support for Armada 370 Rodolfo Giometti
2014-01-02 13:42 ` Thomas Petazzoni
2014-01-02 13:50   ` Rodolfo Giometti
2014-01-03 11:29   ` Rodolfo Giometti
2014-01-03 14:53     ` Ezequiel Garcia
2014-01-03 15:32       ` Rodolfo Giometti
2014-01-06 15:34       ` Rodolfo Giometti
2014-01-08 23:36         ` Ezequiel Garcia
2014-01-09 16:33           ` Rodolfo Giometti
2014-01-13 11:10         ` Ezequiel Garcia

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).