Re: [PATCH] at25: DeviceTree support added

From: Wolfram Sang
Date: Sun Dec 18 2011 - 13:53:39 EST


Hi,

please also CC devicetree-discuss@xxxxxxxxxxxxxxxx when adding new bindings.

On Sun, Dec 18, 2011 at 07:13:55PM +0100, Frederic LAMBERT wrote:
> From: Frederic Lambert <frdrc66@xxxxxxxxx>
>
> Signed-off-by: Frederic Lambert <frdrc66@xxxxxxxxx>
> Signed-off-by: Frederic LAMBERT <frdrc66@xxxxxxxxx>

One is enough :)

> ---
> Documentation/devicetree/bindings/spi/spi-bus.txt | 19 ++++++
> drivers/misc/eeprom/at25.c | 62 ++++++++++++++++----
> 2 files changed, 68 insertions(+), 13 deletions(-)
>
> diff --git a/Documentation/devicetree/bindings/spi/spi-bus.txt b/Documentation/devicetree/bindings/spi/spi-bus.txt
> index e782add..168ac87 100644
> --- a/Documentation/devicetree/bindings/spi/spi-bus.txt
> +++ b/Documentation/devicetree/bindings/spi/spi-bus.txt
> @@ -33,6 +33,16 @@ contain the following properties.
> shifted clock phase (CPHA) mode
> - spi-cs-high - (optional) Empty property indicating device requires
> chip select active high
> +For SPI eeprom using driver 'at25', slave nodes shall also contain the
> +following properties.
> +- byte_len - device RAM size
> +- dev_name - device name
> +- pagesize - for writes (see at25.c)
> +- flags - adressing mode and R/O flag
> + - bit 0: 8 bits addrs (EE_ADDR1)
> + - bit 1: 16 bits addrs (EE_ADDR2)
> + - bit 2: 24 bits addrs (EE_ADDR3)
> + - bit 3: disallow writes (EE_READONLY)
>
> SPI example for an MPC5200 SPI bus:
> spi@f00 {
> @@ -54,4 +64,13 @@ SPI example for an MPC5200 SPI bus:
> spi-max-frequency = <100000>;
> reg = <1>;
> };
> + at25@0 {
> + compatible = "eeprom,at25";

No, you can't map the platform data 1:1 to the device tree.
The compatible should specify the actual device, for example
"atmel,25320". And from that information you can derive...

> + byte_len = <131072>;
> + dev_name = "CY14B101P";

those two and the EE_ADDR.

> + pagesize = <128>;

This is indeed a valid property, "read-only" would be another one of interest.

Check at24.c and see how it is done there.

Thanks,

Wolfram

--
Pengutronix e.K. | Wolfram Sang |
Industrial Linux Solutions | http://www.pengutronix.de/ |

Attachment: signature.asc
Description: Digital signature