All of lore.kernel.org
 help / color / mirror / Atom feed
From: Michal Simek <monstr@seznam.cz>
To: u-boot@lists.denx.de
Subject: [U-Boot-Users] [PATCH] I2C EEPROM simulator (Resubmit)
Date: Fri, 25 Jul 2008 09:37:04 +0200	[thread overview]
Message-ID: <488982A0.9090404@seznam.cz> (raw)
In-Reply-To: <1216833014-7483-2-git-send-email-ricardo.ribalda@uam.es>

still coding style issues.

M

> This driver provides access to a simulated i2c eeprom.
> This simulated eeprom could be very useful in boards with
> ddr2 memories and no i2c interfaces.
> 
> Using this driver the user can simulate a spd eeprom
> of a ddr2 memory and use the ddr2 auto config.
> 
> User can use the macros CONFIG_EEPROM_SIMUL_LEN
> and CONFIG_EEPROM_SIMUL_DATA to define the content
> of the simulated eeprom
> 
> Signed-off-by: Ricardo Ribalda Delgado <ricardo.ribalda@uam.es>
> ---
>  drivers/i2c/Makefile       |    1 +
>  drivers/i2c/eeprom_simul.c |   68 ++++++++++++++++++++++++++++++++++++++++++++
>  2 files changed, 69 insertions(+), 0 deletions(-)
>  create mode 100644 drivers/i2c/eeprom_simul.c
> 
> diff --git a/drivers/i2c/Makefile b/drivers/i2c/Makefile
> index 534c015..2aeabe5 100644
> --- a/drivers/i2c/Makefile
> +++ b/drivers/i2c/Makefile
> @@ -30,6 +30,7 @@ COBJS-y += omap1510_i2c.o
>  COBJS-y += omap24xx_i2c.o
>  COBJS-y += tsi108_i2c.o
>  COBJS-y += mxc_i2c.o
> +COBJS-$(CONFIG_EEPROM_SIMUL) += eeprom_simul.o
>  
>  COBJS	:= $(COBJS-y)
>  SRCS	:= $(COBJS:.o=.c)
> diff --git a/drivers/i2c/eeprom_simul.c b/drivers/i2c/eeprom_simul.c
> new file mode 100644
> index 0000000..d8dbb3b
> --- /dev/null
> +++ b/drivers/i2c/eeprom_simul.c
> @@ -0,0 +1,68 @@
> +/*
> +    (C) Copyright 2008
> +    Ricado Ribalda-Universidad Autonoma de Madrid-ricardo.ribalda at uam.es
> +    This work has been supported by: QTechnology  http://qtec.com/
> +
> +    This program is free software: you can redistribute it and/or modify
> +    it under the terms of the GNU General Public License as published by
> +    the Free Software Foundation, either version 2 of the License, or
> +    (at your option) any later version.
> +
> +    This program is distributed in the hope that it will be useful,
> +    but WITHOUT ANY WARRANTY; without even the implied warranty of
> +    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
> +    GNU General Public License for more details.
> +
> +    You should have received a copy of the GNU General Public License
> +    along with this program.  If not, see <http://www.gnu.org/licenses/>.
> +*/
> +
> +#include <common.h>
> +#include <i2c.h>
> +
> +#ifndef CONFIG_EEPROM_SIMUL_LEN
> +#define CONFIG_EEPROM_SIMUL_LEN 256
> +#endif
> +
> +u8 eeprom_simul_buffer[CONFIG_EEPROM_SIMUL_LEN]
> +#ifdef CONFIG_EEPROM_SIMUL_DATA
> +       = CONFIG_EEPROM_SIMUL_DATA
> +#endif
> +;
> +
> +void i2c_init(int speed, int slaveaddr){
> +       return ;
> +}
> +
> +int i2c_read(uchar chip, uint addr, int alen, uchar * buffer, int len)
> +{
> +       int i;
> +
> +       if (addr+len>CONFIG_EEPROM_SIMUL_LEN)
> +               return -1;
> +
> +       for(i=0;i<len;i++){
> +               buffer[i]=eeprom_simul_buffer[i+addr];
> +       }
> +
> +       return 0;
> +}
> +int i2c_write(uchar chip, uint addr, int alen, uchar * buffer, int len)
> +{
> +       int i;
> +
> +       if (addr+len>CONFIG_EEPROM_SIMUL_LEN)
> +               return -1;
> +
> +       for(i=0;i<len;i++){
> +               eeprom_simul_buffer[i+addr]=buffer[i];
> +       }
> +
> +       return 0;
> +}
> +
> +int i2c_probe(uchar chip)
> +{
> +       return 0;
> +}
> +

  parent reply	other threads:[~2008-07-25  7:37 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-07-23 17:10 [U-Boot-Users] [PATCH] Allow negative offset in command loads Ricardo Ribalda Delgado
2008-07-23 17:10 ` [U-Boot-Users] [PATCH] I2C EEPROM simulator (Resubmit) Ricardo Ribalda Delgado
2008-07-23 17:10   ` [U-Boot-Users] [PATCH] I2C Monitor chip ADT7460 support (Resubmit) Ricardo Ribalda Delgado
2008-08-18 21:48     ` [U-Boot] " Wolfgang Denk
2008-07-25  7:37   ` Michal Simek [this message]
2008-07-25  8:55     ` [U-Boot-Users] [PATCH] I2C EEPROM simulator (Resubmit) Ricardo Ribalda Delgado
2008-07-26  8:09       ` Michal Simek

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=488982A0.9090404@seznam.cz \
    --to=monstr@seznam.cz \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.