[U-Boot] U-Boot: Enhancement request to get flash device specific information

Wolfgang Denk wd at denx.de
Thu Jul 10 13:47:28 CEST 2014


Dear Heera,

In message <CANiu2MrgDg8zmHK8Dm90TJn1SgsRTe2juXScgGq11M=JEDKZYQ at mail.gmail.com> you wrote:
> 
> I am avoiding to use regular expression to extract the information. It has
> two reasons,
> 1) In future realise of u-boot if string format is changed, my regular
> expression will fail. So I need to track the format change in this message.
> 2) It is possible that current message does not carry all informations of
> Flash device. For example,this message does not specify the kind of spi
> flash it is (dual or single). So we may need to enhance message to provide
> flash type. So for any new property, we need to change this message and as
> a result it would break scripts/tools for those people who have been used
> regular expression on this message.

I think you are taking a wrong approach to solve the task you actually
have in mind.  Instead of trying to get all kinds if deeply low-leven
information out of U-Boot, you should try to find an abstraction level
that allows you to perform your task without knowledge about these
details.

Normally you do not really want to have to bother about details like
page size or erase size - you want to store some data on your device,
and the low-level internal organization of the storage device is not
really important here.  The usual approach to abstract away from such
lowlevel details is to use command formats that do not refer to such
data.

One approach that allows this is the structuring of your storage
device into logical units, like for example MTD partitions.  This has
the added benefit that you can pass the information about this
partitioning to the Linux kernel, so both U-Boot and Linux use the
same data layout.

I am aware that current mainline does not support "mtdparts" for
SPI-NOR flash devices, but patches have been posted before, and it
should be not too difficult to rebase these against current code (and
fix the issues that prevented their inclusion into mainline).

Such an approach that abstracts away the internal complexity of the
storage device and provides higher level access methods looks much
more promising to me, especially when you think about including it
into mainline.

Frankly, I don;t think your original proposal has much chance for
being included into mainline.  It is way too complex and fragile.

Best regards,

Wolfgang Denk

-- 
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
You can love it, change it, or leave it.    There is NO other option.
But do not complain - it is your own choice...                  -- wd


More information about the U-Boot mailing list