Adding support for SPI-attached MR25H256 MRAM with Device Tree
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.)
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?...
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,
Simon Falsig
simon at newtec.dk
Quoted 22 lines · Simon Falsig
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"; };
Quoted 9 lines
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 indrivers/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.
Quoted 6 lines
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 atspi_setup_slave_fdt(), which seems to be one of the necessary functions, I can only find it implemented indrivers/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.cdrivers/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.
Quoted 5 lines
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
Signature · 1 line
Jagan | openedev.
Quoted 55 lines · Simon Falsig
Quoted 22 lines
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"; };Quoted 9 lines
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 indrivers/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.
Quoted 6 lines
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 atspi_setup_slave_fdt(), which seems to be one of the necessary functions, I can only find it implemented indrivers/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.cdrivers/mtd/spi/sf_ops.care spi-flash related.If possible you can add non-jedec things to
sf_probe.csimilar 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.Quoted 4 lines
If anyone can help me with a few hints on how to get started adding support for this chip, it'd be much appreciated!
Quoted 7 lines
Quoted 1 line
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--
Jagan | openedev.
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.
Quoted 55 lines · Simon Falsig
Quoted 55 lines · Simon Falsig
Quoted 22 lines
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"; };Quoted 9 lines
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 indrivers/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.
Quoted 6 lines
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 atspi_setup_slave_fdt(), which seems to be one of the necessary functions, I can only find it implemented indrivers/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.cdrivers/mtd/spi/sf_ops.care spi-flash related.If possible you can add non-jedec things to
sf_probe.csimilar 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.Quoted 4 lines
If anyone can help me with a few hints on how to get started adding support for this chip, it'd be much appreciated!
Quoted 7 lines
Quoted 4 lines
Quoted 1 line
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-mtdThanks 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
Signature · 1 line
Jagan.