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

Simon Falsig simon at newtec.dk
Fri Nov 20 14:43:40 CET 2015


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


More information about the U-Boot mailing list