All of lore.kernel.org
 help / color / mirror / Atom feed
* macronix ONFI nand flash OTP support
@ 2017-11-22 13:13 Belisko Marek
  2017-11-23  8:57 ` Miquel RAYNAL
  0 siblings, 1 reply; 5+ messages in thread
From: Belisko Marek @ 2017-11-22 13:13 UTC (permalink / raw)
  To: linux-mtd

Hi,

I'm trying to add find out how to use OTP area in Macronix MX30LF4G18AC flash.
AFAIU it is ONFI based flash and I did some quick hack and I can
set/reset flash to go to OTP mode via get/set_features function
available in nand_base.c. But for read page I need to send according
datasheet:
To use the PAGE READ command for reading data from the OTP area, issue
the 00h command, and then issue five address cycles: for the first two
cycles, the column address; and for the remaining address cycles,
select a page in the range of 02h-00h-00h through 1Fh-00h-00h. Lastly,
issue the 30h command. The PAGE READ CACHE MODE command is not
supported on OTP pages.

I did check nand_do_read_ops function but it's not sending e.g. 0x30
which should be at the end of command. I'm using 4.1 kernel but
checked also 4.14 and no such functionality is added even there.
Nobody is using OTP area in nand flashes ;) ? Thanks for any pointers.

BR,

marek

-- 
as simple and primitive as possible
-------------------------------------------------
Marek Belisko - OPEN-NANDRA
Freelance Developer

Ruska Nova Ves 219 | Presov, 08005 Slovak Republic
Tel: +421 915 052 184
skype: marekwhite
twitter: #opennandra
web: http://open-nandra.com

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

* Re: macronix ONFI nand flash OTP support
  2017-11-22 13:13 macronix ONFI nand flash OTP support Belisko Marek
@ 2017-11-23  8:57 ` Miquel RAYNAL
  2017-11-23  9:11   ` Belisko Marek
  0 siblings, 1 reply; 5+ messages in thread
From: Miquel RAYNAL @ 2017-11-23  8:57 UTC (permalink / raw)
  To: Belisko Marek; +Cc: linux-mtd, Richard Weinberger, Boris Brezillon

Hi Marek,

+CC: NAND maintainers Boris and Richard

> Hi,
> 
> I'm trying to add find out how to use OTP area in Macronix
> MX30LF4G18AC flash. AFAIU it is ONFI based flash and I did some quick
> hack and I can set/reset flash to go to OTP mode via get/set_features
> function available in nand_base.c.

Ok, so until now you can enter/leave OTP mode with get/set_features(),
right ?

> But for read page I need to send
> according datasheet:
> To use the PAGE READ command for reading data from the OTP area, issue
> the 00h command, and then issue five address cycles: for the first two
> cycles, the column address; and for the remaining address cycles,
> select a page in the range of 02h-00h-00h through 1Fh-00h-00h. Lastly,
> issue the 30h command. The PAGE READ CACHE MODE command is not
> supported on OTP pages.

This is the description of a normal READ operation, there is nothing
specific to OTP.

> 
> I did check nand_do_read_ops function but it's not sending e.g. 0x30
> which should be at the end of command. I'm using 4.1 kernel but
> checked also 4.14 and no such functionality is added even there.
> Nobody is using OTP area in nand flashes ;) ? Thanks for any pointers.

I suppose you added some tweaks to enable OTP and use nand_do_read_ops,
because there is currently no implementation for that in the NAND
framework (I think there is something in MTD layer though). But must
importantly, nand_do_read_ops basically calls chip->ecc.read*() which
is handled by the controller driver, so what driver are you using ?

How (where) did you trace the commands sent to the NAND chip ? For
instance, if you just looked at the arguments of ->cmdfunc(), it is
normal not to see any READSTART (0x30) command as it should be added
automatically later in the function. If the driver implements
->cmd_ctrl(), you may see there what exactly is sent to the device.

Thanks,
Miquèl

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

* Re: macronix ONFI nand flash OTP support
  2017-11-23  8:57 ` Miquel RAYNAL
@ 2017-11-23  9:11   ` Belisko Marek
  2017-11-23  9:30     ` Miquel RAYNAL
  0 siblings, 1 reply; 5+ messages in thread
From: Belisko Marek @ 2017-11-23  9:11 UTC (permalink / raw)
  To: Miquel RAYNAL; +Cc: linux-mtd, Richard Weinberger, Boris Brezillon

Hi Miquel,

On Thu, Nov 23, 2017 at 9:57 AM, Miquel RAYNAL
<miquel.raynal@free-electrons.com> wrote:
> Hi Marek,
>
> +CC: NAND maintainers Boris and Richard
>
>> Hi,
>>
>> I'm trying to add find out how to use OTP area in Macronix
>> MX30LF4G18AC flash. AFAIU it is ONFI based flash and I did some quick
>> hack and I can set/reset flash to go to OTP mode via get/set_features
>> function available in nand_base.c.
>
> Ok, so until now you can enter/leave OTP mode with get/set_features(),
> right ?
Yes exactly. Yesterday I make otp write/read working. Problem was that
otp pages for flash start at offset 0x2 up to 0x1f (at least mine
flash does have such range - 30 pages for otp).
>
>> But for read page I need to send
>> according datasheet:
>> To use the PAGE READ command for reading data from the OTP area, issue
>> the 00h command, and then issue five address cycles: for the first two
>> cycles, the column address; and for the remaining address cycles,
>> select a page in the range of 02h-00h-00h through 1Fh-00h-00h. Lastly,
>> issue the 30h command. The PAGE READ CACHE MODE command is not
>> supported on OTP pages.
>
> This is the description of a normal READ operation, there is nothing
> specific to OTP.
OH ok I did't see it in code I was looking at but from my above
comment it seems that it is because it's working :).
>
>>
>> I did check nand_do_read_ops function but it's not sending e.g. 0x30
>> which should be at the end of command. I'm using 4.1 kernel but
>> checked also 4.14 and no such functionality is added even there.
>> Nobody is using OTP area in nand flashes ;) ? Thanks for any pointers.
>
> I suppose you added some tweaks to enable OTP and use nand_do_read_ops,
> because there is currently no implementation for that in the NAND
> framework (I think there is something in MTD layer though). But must
> importantly, nand_do_read_ops basically calls chip->ecc.read*() which
> is handled by the controller driver, so what driver are you using ?
>
> How (where) did you trace the commands sent to the NAND chip ? For
> instance, if you just looked at the arguments of ->cmdfunc(), it is
> normal not to see any READSTART (0x30) command as it should be added
> automatically later in the function. If the driver implements
> ->cmd_ctrl(), you may see there what exactly is sent to the device.
Yes I checked ->cmdfunc() output. I think my changes would be
beneficial for other so I'll cook some patches and post for review
here.
>
> Thanks,
> Miquèl

thanks and BR,

marek

-- 
as simple and primitive as possible
-------------------------------------------------
Marek Belisko - OPEN-NANDRA
Freelance Developer

Ruska Nova Ves 219 | Presov, 08005 Slovak Republic
Tel: +421 915 052 184
skype: marekwhite
twitter: #opennandra
web: http://open-nandra.com

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

* Re: macronix ONFI nand flash OTP support
  2017-11-23  9:11   ` Belisko Marek
@ 2017-11-23  9:30     ` Miquel RAYNAL
  2017-11-23  9:40       ` Belisko Marek
  0 siblings, 1 reply; 5+ messages in thread
From: Miquel RAYNAL @ 2017-11-23  9:30 UTC (permalink / raw)
  To: Belisko Marek; +Cc: linux-mtd, Richard Weinberger, Boris Brezillon

Hi Marek,

> >>
> >> I did check nand_do_read_ops function but it's not sending e.g.
> >> 0x30 which should be at the end of command. I'm using 4.1 kernel
> >> but checked also 4.14 and no such functionality is added even
> >> there. Nobody is using OTP area in nand flashes ;) ? Thanks for
> >> any pointers.  
> >
> > I suppose you added some tweaks to enable OTP and use
> > nand_do_read_ops, because there is currently no implementation for
> > that in the NAND framework (I think there is something in MTD layer
> > though). But must importantly, nand_do_read_ops basically calls
> > chip->ecc.read*() which is handled by the controller driver, so
> > what driver are you using ?
> >
> > How (where) did you trace the commands sent to the NAND chip ? For
> > instance, if you just looked at the arguments of ->cmdfunc(), it is
> > normal not to see any READSTART (0x30) command as it should be added
> > automatically later in the function. If the driver implements  
> > ->cmd_ctrl(), you may see there what exactly is sent to the
> > device.  
> Yes I checked ->cmdfunc() output. I think my changes would be
> beneficial for other so I'll cook some patches and post for review
> here.

Can you just tell us what controller driver are you using ?

You may want to have a look at [1], which hare the MTD hooks that I
guess you could fill with you OTP related read/writes. I think you
will also need some tweaks in nanddump (or a nandotpdump thing) to
ease the validation of the implementation.

[1]
http://elixir.free-electrons.com/linux/latest/source/include/linux/mtd/mtd.h#L314

Thank you,
Miquèl

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

* Re: macronix ONFI nand flash OTP support
  2017-11-23  9:30     ` Miquel RAYNAL
@ 2017-11-23  9:40       ` Belisko Marek
  0 siblings, 0 replies; 5+ messages in thread
From: Belisko Marek @ 2017-11-23  9:40 UTC (permalink / raw)
  To: Miquel RAYNAL; +Cc: linux-mtd, Richard Weinberger, Boris Brezillon

Hi Miquel,

On Thu, Nov 23, 2017 at 10:30 AM, Miquel RAYNAL
<miquel.raynal@free-electrons.com> wrote:
> Hi Marek,
>
>> >>
>> >> I did check nand_do_read_ops function but it's not sending e.g.
>> >> 0x30 which should be at the end of command. I'm using 4.1 kernel
>> >> but checked also 4.14 and no such functionality is added even
>> >> there. Nobody is using OTP area in nand flashes ;) ? Thanks for
>> >> any pointers.
>> >
>> > I suppose you added some tweaks to enable OTP and use
>> > nand_do_read_ops, because there is currently no implementation for
>> > that in the NAND framework (I think there is something in MTD layer
>> > though). But must importantly, nand_do_read_ops basically calls
>> > chip->ecc.read*() which is handled by the controller driver, so
>> > what driver are you using ?
>> >
>> > How (where) did you trace the commands sent to the NAND chip ? For
>> > instance, if you just looked at the arguments of ->cmdfunc(), it is
>> > normal not to see any READSTART (0x30) command as it should be added
>> > automatically later in the function. If the driver implements
>> > ->cmd_ctrl(), you may see there what exactly is sent to the
>> > device.
>> Yes I checked ->cmdfunc() output. I think my changes would be
>> beneficial for other so I'll cook some patches and post for review
>> here.
>
> Can you just tell us what controller driver are you using ?
I'm using omap2 controller (hope that is right answer :))
>
> You may want to have a look at [1], which hare the MTD hooks that I
> guess you could fill with you OTP related read/writes. I think you
> will also need some tweaks in nanddump (or a nandotpdump thing) to
> ease the validation of the implementation.
Yes I know about that. I saw that but implementation for NAND is
missing so maybe make sense to fill it so it will work out of the box?
>
> [1]
> http://elixir.free-electrons.com/linux/latest/source/include/linux/mtd/mtd.h#L314
>
> Thank you,
> Miquèl
>

BR,

marek

-- 
as simple and primitive as possible
-------------------------------------------------
Marek Belisko - OPEN-NANDRA
Freelance Developer

Ruska Nova Ves 219 | Presov, 08005 Slovak Republic
Tel: +421 915 052 184
skype: marekwhite
twitter: #opennandra
web: http://open-nandra.com

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

end of thread, other threads:[~2017-11-23  9:40 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-11-22 13:13 macronix ONFI nand flash OTP support Belisko Marek
2017-11-23  8:57 ` Miquel RAYNAL
2017-11-23  9:11   ` Belisko Marek
2017-11-23  9:30     ` Miquel RAYNAL
2017-11-23  9:40       ` Belisko Marek

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.