public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
* [U-Boot] Adding support for SPI-attached MR25H256 MRAM with Device Tree
@ 2015-11-20 13:43 Simon Falsig
  2015-11-21 12:23 ` Jagan Teki
  0 siblings, 1 reply; 4+ messages in thread
From: Simon Falsig @ 2015-11-20 13:43 UTC (permalink / raw)
  To: u-boot

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

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

* [U-Boot] Adding support for SPI-attached MR25H256 MRAM with Device Tree
  2015-11-20 13:43 [U-Boot] Adding support for SPI-attached MR25H256 MRAM with Device Tree Simon Falsig
@ 2015-11-21 12:23 ` Jagan Teki
  2015-11-24  9:29   ` Simon Falsig
  0 siblings, 1 reply; 4+ messages in thread
From: Jagan Teki @ 2015-11-21 12:23 UTC (permalink / raw)
  To: u-boot

On 20 November 2015 at 19:13, Simon Falsig <simon@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

-- 
Jagan | openedev.

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

* [U-Boot] Adding support for SPI-attached MR25H256 MRAM with Device Tree
  2015-11-21 12:23 ` Jagan Teki
@ 2015-11-24  9:29   ` Simon Falsig
  2016-02-15  9:38     ` Jagan Teki
  0 siblings, 1 reply; 4+ messages in thread
From: Simon Falsig @ 2015-11-24  9:29 UTC (permalink / raw)
  To: u-boot

>On 20 November 2015 at 19:13, Simon Falsig <simon@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
>
>--
>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.

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

* [U-Boot] Adding support for SPI-attached MR25H256 MRAM with Device Tree
  2015-11-24  9:29   ` Simon Falsig
@ 2016-02-15  9:38     ` Jagan Teki
  0 siblings, 0 replies; 4+ messages in thread
From: Jagan Teki @ 2016-02-15  9:38 UTC (permalink / raw)
  To: u-boot

On 24 November 2015 at 14:59, Simon Falsig <simon@newtec.dk> wrote:
>>On 20 November 2015 at 19:13, Simon Falsig <simon@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.

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

end of thread, other threads:[~2016-02-15  9:38 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-11-20 13:43 [U-Boot] Adding support for SPI-attached MR25H256 MRAM with Device Tree Simon Falsig
2015-11-21 12:23 ` Jagan Teki
2015-11-24  9:29   ` Simon Falsig
2016-02-15  9:38     ` Jagan Teki

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox