[U-Boot] [PATCH RESEND 6/9] eeprom: Add DS2431 support

Moritz Fischer moritz.fischer at ettus.com
Fri Nov 11 20:16:39 CET 2016


Hi Maxime,

On Tue, Nov 8, 2016 at 2:19 AM, Maxime Ripard
<maxime.ripard at free-electrons.com> wrote:
> Add a driver for the Maxim DS2431 1-Wire EEPROM
>
> Signed-off-by: Maxime Ripard <maxime.ripard at free-electrons.com>
> ---
>  drivers/eeprom/Kconfig  |  6 ++++++
>  drivers/eeprom/Makefile |  1 +
>  drivers/eeprom/ds2431.c | 38 ++++++++++++++++++++++++++++++++++++++
>  3 files changed, 45 insertions(+), 0 deletions(-)
>  create mode 100644 drivers/eeprom/ds2431.c
>
> diff --git a/drivers/eeprom/Kconfig b/drivers/eeprom/Kconfig
> index 8dc597a8d894..98bbd67ba579 100644
> --- a/drivers/eeprom/Kconfig
> +++ b/drivers/eeprom/Kconfig
> @@ -12,6 +12,12 @@ config EEPROM
>
>  if EEPROM
>
> +config EEPROM_DS2431
> +       bool "Enable Maxim DS2431 EEPROM support"
> +       depends on W1
> +       help
> +         Maxim DS2431 1-Wire EEPROM support
> +
>  endif
>
>  endmenu
> diff --git a/drivers/eeprom/Makefile b/drivers/eeprom/Makefile
> index 147dba5ec4b8..93dae0bf5d6d 100644
> --- a/drivers/eeprom/Makefile
> +++ b/drivers/eeprom/Makefile
> @@ -1,2 +1,3 @@
>  obj-$(CONFIG_EEPROM) += eeprom-uclass.o
>
> +obj-$(CONFIG_EEPROM_DS2431) += ds2431.o
> diff --git a/drivers/eeprom/ds2431.c b/drivers/eeprom/ds2431.c
> new file mode 100644
> index 000000000000..84c1a126c339
> --- /dev/null
> +++ b/drivers/eeprom/ds2431.c
> @@ -0,0 +1,38 @@
> +/*
> + * Copyright (c) 2015 Free Electrons
> + * Copyright (c) 2015 NextThing Co
> + *
> + * SPDX-License-Identifier:    GPL-2.0+
> + */
> +
> +#include <common.h>
> +#include <linux/err.h>
> +#include <dm.h>
> +#include <eeprom.h>
> +#include <w1.h>
> +
> +#define W1_F2D_READ_EEPROM     0xf0
> +
> +static int ds2431_read_buf(struct udevice *dev, unsigned offset,
> +                          u8 *buf, unsigned count)
> +{
> +       w1_reset_select(dev);
> +
> +       w1_write_byte(dev, W1_F2D_READ_EEPROM);
> +       w1_write_byte(dev, offset & 0xff);
> +       w1_write_byte(dev, offset >> 8);
> +
> +       return w1_read_buf(dev, buf, count);
> +}
> +
> +static const struct eeprom_ops ds2431_ops = {
> +       .read_buf       = ds2431_read_buf,
> +};
> +
> +U_BOOT_DRIVER(ds2431) = {
> +       .name           = "ds2431",
> +       .id             = UCLASS_EEPROM,
> +       .ops            = &ds2431_ops,

Do you want to add a .flags = DM_UC_FLAG_SEQ_ALIAS here?

> +};
> +
> +U_BOOT_W1_DEVICE(ds2431, W1_FAMILY_DS2431);
> --
> git-series 0.8.11
> _______________________________________________
> U-Boot mailing list
> U-Boot at lists.denx.de
> http://lists.denx.de/mailman/listinfo/u-boot

Cheers,

Moritz


More information about the U-Boot mailing list