lkml.org 
[lkml]   [2011]   [Dec]   [18]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH] at25: DeviceTree support added
Hi,

please also CC devicetree-discuss@lists.ozlabs.org when adding new bindings.

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

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/ |
[unhandled content-type:application/pgp-signature]
\
 
 \ /
  Last update: 2011-12-18 19:55    [W:0.042 / U:0.632 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site