[U-Boot] Adding support for SPI-attached MR25H256 MRAM with Device Tree

Jagan Teki jteki at openedev.com
Mon Feb 15 10:38:12 CET 2016


On 24 November 2015 at 14:59, Simon Falsig <simon at newtec.dk> wrote:
>>On 20 November 2015 at 19:13, Simon Falsig <simon at newtec.dk> wrote:
>>> I have a custom board based on a TI AM3356 processor (quite similar to
>>> a BeagleBone) with an Everspin MR25H256 MRAM attached to the SPI bus,
>>> currently using U-Boot 2015.10 to boot a 3.18.9-rt5 Linux kernel.
>>>
>>> I'd like to use this MRAM to store the MAC address for one of the
>>> Ethernet interfaces, but I'm having a bit of trouble getting started
>>> on how support for this should be added.
>>>
>>> I can access the MRAM just fine from Linux (using the m25p80 driver
>>> and the MTD framework), so with the appropriate drivers compiled into
>>> the kernel, Linux picks the chip up without any issue by simply adding
>>> the following to the device tree:
>>>
>>>         mram: m25p80 at 0 {
>>>                 #address-cells = <1>;
>>>                 #size-cells = <1>;
>>>                 compatible = "mr25h256";
>>>                 reg = <0>;
>>>                 spi-max-frequency = <40000000>;
>>>                 status = "okay";
>>>         };
>>>
>>> I'd like U-Boot to do something similar, but there are a few issues:
>>>   1. The chip is not JEDEC compatible, so it cannot be probed like
>>>      the other chips currently listed in drivers/mtd/spi/sf_params.c
>>>   2. Since it's an MRAM, it doesn't need to be erased before being
>>>      written - Linux has a flag for this, but it doesn't seem as if
>>>      U-Boot has anything similar. (Not that I need this currently
>>>      though, as I only need to be able to read the chip for now - but
>>>      it'd be nice to have, and others might be able to use it too.)
>>>
>>
>>Thanks for your concerns, It's been very clear.
>>
>>> I've tried having a look at doc/driver-model/spi-howto.txt, hoping
>>> that this would have up-to-date information on how to implement/modify
>>> a SPI driver, but when I for instance look at spi_setup_slave_fdt(),
>>> which seems to be one of the necessary functions, I can only find it
>>> implemented in drivers/spi/spi-uclass.c, with a comment saying that it
>>> is only for compatibility, and that it is to be removed?...
>>
>>These are spi drivers not related to spi-flash.
>>drivers/mtd/spi/sf_probe.c
>>drivers/mtd/spi/sf_ops.c are spi-flash related.
>>
>>If possible you can add non-jedec things to sf_probe.c similar way as
>>Linux, BTW I'm >currently working spi-flash subsystem which should as
>>modular as Linux[1]. I hope we may >get that version coming releases, but
>>what ever is feasible to you just work on that I >would help you always.
>>
>>>
>>> If anyone can help me with a few hints on how to get started adding
>>> support for this chip, it'd be much appreciated!
>>>
>>> Thanks in advance and best regards,
>>
>>[1]
>>http://git.denx.de/?p=u-boot/u-boot-spi.git;a=shortlog;h=refs/heads/spi-nor-mtd
>
> Thanks for the hints! I'll have a look at the existing files and your tree,
> and see if I can find a good way to do this.

Try to add on top of this new tree [1] which is similar to Linux.

[1] http://git.denx.de/?p=u-boot/u-boot-spi.git;a=shortlog;h=refs/heads/spi-nor

-- 
Jagan.


More information about the U-Boot mailing list