I2C EEPROM simulator (Resubmit) (Lindent)
PATCH 1/1 I2C EEPROM simulator (Resubmit) (Lindent)
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
---
-Lident run over the source to solve coding style issues remarked by Michal Simek
drivers/i2c/Makefile | 1 + drivers/i2c/eeprom_simul.c | 69 ++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 70 insertions(+), 0 deletions(-) create mode 100644 drivers/i2c/eeprom_simul.c
drivers/i2c/Makefile +1 -0
@@ -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)
drivers/i2c/eeprom_simul.c new file +69 -0
69 lines not on this page · raw message
Signature · 1 line
1.5.6.3
PATCH 1/1 I2C EEPROM simulator (Resubmit) (Lindent)
Quoted 10 lines · Ricardo Ribalda Delgado
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_LENandCONFIG_EEPROM_SIMUL_DATAto define the content of the simulated eeprom
I know I'm coming in quite late to this discussion, but I really don't like this approach. I don't like that non-human readable, pre-encoded data is getting linked into the u-boot build so that the ddr2 driver can be used for static DDR configuration without change the ddr2 driver.
I'd much rather see the ddr2 driver refactored to separate the i2c reading and decoding from the configuration of the DDR controller (which may already be the case, I don't know). Then I'd like to see the DDR controller export an API to allow it to be configured from code or from a static structure. I think that would be a far cleaner way to accomplish what you are trying to do.
g.
Quoted 110 lines
Signed-off-by Ricardo Ribalda Delgado <[email protected]>---
(quoted diff) +0
-1-Lident run over the source to solve coding style issues remarked by Michal Simek drivers/i2c/Makefile | 1 + drivers/i2c/eeprom_simul.c | 69 ++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 70 insertions(+), 0 deletions(-) create mode 100644 drivers/i2c/eeprom_simul.cdrivers/i2c/Makefile +1
-0@@ -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)drivers/i2c/eeprom_simul.c new file +69
-0@@ -0,0 +1,69 @@ +/* +(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 ; +}Signature · 12 lines
1.5.6.3 ------------------------------------------------------------------------- This SF.Net email is sponsored by the Moblin Your Move Developer's challenge Build the coolest Linux based applications with Moblin SDK & win great prizes Grand prize is a trip for two to an Open Source event anywhere in the world http://moblin-contest.org/redirect.php?banner_id=100&url=/ _______________________________________________ U-Boot-Users mailing list U-Boot-Users at lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/u-boot-users
PATCH 1/1 I2C EEPROM simulator (Resubmit)(Lindent)
Hello Grant
Thanks for your comment. The use for the ddr2 is just an example...
I did developed it for that reason, but you can use it for anything else. I sent the patch just because I thought it will be useful for other people and the mail list response in that way. It was my first patch to the u-boot and I had problems to fit the rules. It is also my first time with git....
Best Regards.
Signature · 2 lines
Ricardo Ribalda http://www.eps.uam.es/~rribalda/
PATCH 1/1 I2C EEPROM simulator (Resubmit)(Lindent)
Quoted 8 lines · Ricardo Ribalda Delgado
Hello Grant
Thanks for your comment. The use for the ddr2 is just an example...
I did developed it for that reason, but you can use it for anything else. I sent the patch just because I thought it will be useful for other people and the mail list response in that way. It was my first patch to the u-boot and I had problems to fit the rules. It is also my first time with git....
Okay, that is fine. Until there is a user of this, I recommend not merging it into mainline.
g.
Signature · 2 lines
Grant Likely, B.Sc., P.Eng. Secret Lab Technologies Ltd.