All of lore.kernel.org
 help / color / mirror / Atom feed
* [U-Boot-Users] [PATCH] New Dummy I2C Driver
@ 2008-07-11  8:38 Ricardo Ribalda Delgado
  2008-07-11  8:40 ` Ricardo Ribalda Delgado
  0 siblings, 1 reply; 12+ messages in thread
From: Ricardo Ribalda Delgado @ 2008-07-11  8:38 UTC (permalink / raw)
  To: u-boot


Signed-off-by: Ricardo Ribalda Delgado <ricardo.ribalda@uam.es>
---
 drivers/i2c/Makefile    |    1 +
 drivers/i2c/dummy_i2c.c |   74 +++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 75 insertions(+), 0 deletions(-)
 create mode 100644 drivers/i2c/dummy_i2c.c

diff --git a/drivers/i2c/Makefile b/drivers/i2c/Makefile
index 534c015..94a0791 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_DUMMY_I2C) += dummy_i2c.o
 
 COBJS	:= $(COBJS-y)
 SRCS	:= $(COBJS:.o=.c)
diff --git a/drivers/i2c/dummy_i2c.c b/drivers/i2c/dummy_i2c.c
new file mode 100644
index 0000000..92493e9
--- /dev/null
+++ b/drivers/i2c/dummy_i2c.c
@@ -0,0 +1,74 @@
+/*   
+    (C) Copyright 2008
+    Ricado Ribalda-Universidad Autonoma de Madrid-ricardo.ribalda at uam.es
+    This work has been supported by: Q-Technology  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>
+u8 i2c_dummy_buffer[256]={0x80,0x8,0x8,0x0D,0x0A,0x60,0x40,0x0,0x5,\
+	0x3D,0x50,0x0,0x82,0x10,0x0,0x0,0x0C,0x4,0x18,0x1,0x4,0x0,\
+	0x1,0x50,0x50,0x0,0x0,0x3C,0x28,0x3C,0x2D,0x40,0x25,0x37,\
+	0x10,0x22,0x3C,0x1E,0x1E,0x0,0x0,0x3C,0x69,0x80,0x1E,0x28,\
+	0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,\
+	0x0,0x12,0xC9,0x2C,'0','0','0','0','0','0','0',0x0,'4','H',\
+	'T','F','3','2','6','4','H','Y','-','5','3','E','D','3',\
+	0x3,0x0,0x0,0x0,0x0};
+	
+void i2c_init(int speed, int slaveaddr){
+	return ;
+}
+
+int i2c_read(uchar chip, uint addr, int alen, uchar * buffer, int len)
+{
+	int i;
+	if (alen!=1)
+		return -1;
+
+	if (addr+len>0xff)
+		return -1;
+
+	for(i=0;i<len;i++){
+		buffer[i]=i2c_dummy_buffer[i+addr];
+	}
+
+	return 0;
+}
+
+int i2c_write(uchar chip, uint addr, int alen, uchar * buffer, int len)
+{
+	int i;
+	if (alen!=1)
+		return -1;
+	
+	if (addr+len>0xff)
+		return -1;
+
+	for(i=0;i<len;i++){
+		i2c_dummy_buffer[i+addr]=buffer[i];
+	}
+
+	return 0;
+}
+
+
+int i2c_probe(uchar chip)
+{
+	return 0;
+}
+
-- 
1.5.6.2

^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [U-Boot-Users] [PATCH] New Dummy I2C Driver
  2008-07-11  8:38 [U-Boot-Users] [PATCH] New Dummy I2C Driver Ricardo Ribalda Delgado
@ 2008-07-11  8:40 ` Ricardo Ribalda Delgado
  2008-07-11  8:54   ` Stefan Roese
  0 siblings, 1 reply; 12+ messages in thread
From: Ricardo Ribalda Delgado @ 2008-07-11  8:40 UTC (permalink / raw)
  To: u-boot

I didn't add this to the description sorry:


 This driver provides access to a false i2c eeprom.
 This false eeprom could be very useful in boards with
 ddr2 memories and no i2c interfaces.
 Using this driver the user can simulate the spd interface
 of the ddr2 memory and use the ddr2 auto configuration


On Fri, Jul 11, 2008 at 10:38 AM, Ricardo Ribalda Delgado
<ricardo.ribalda@uam.es> wrote:
>
> Signed-off-by: Ricardo Ribalda Delgado <ricardo.ribalda@uam.es>
> ---
>  drivers/i2c/Makefile    |    1 +
>  drivers/i2c/dummy_i2c.c |   74 +++++++++++++++++++++++++++++++++++++++++++++++
>  2 files changed, 75 insertions(+), 0 deletions(-)
>  create mode 100644 drivers/i2c/dummy_i2c.c
>
> diff --git a/drivers/i2c/Makefile b/drivers/i2c/Makefile
> index 534c015..94a0791 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_DUMMY_I2C) += dummy_i2c.o
>
>  COBJS  := $(COBJS-y)
>  SRCS   := $(COBJS:.o=.c)
> diff --git a/drivers/i2c/dummy_i2c.c b/drivers/i2c/dummy_i2c.c
> new file mode 100644
> index 0000000..92493e9
> --- /dev/null
> +++ b/drivers/i2c/dummy_i2c.c
> @@ -0,0 +1,74 @@
> +/*
> +    (C) Copyright 2008
> +    Ricado Ribalda-Universidad Autonoma de Madrid-ricardo.ribalda at uam.es
> +    This work has been supported by: Q-Technology  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>
> +u8 i2c_dummy_buffer[256]={0x80,0x8,0x8,0x0D,0x0A,0x60,0x40,0x0,0x5,\
> +       0x3D,0x50,0x0,0x82,0x10,0x0,0x0,0x0C,0x4,0x18,0x1,0x4,0x0,\
> +       0x1,0x50,0x50,0x0,0x0,0x3C,0x28,0x3C,0x2D,0x40,0x25,0x37,\
> +       0x10,0x22,0x3C,0x1E,0x1E,0x0,0x0,0x3C,0x69,0x80,0x1E,0x28,\
> +       0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,\
> +       0x0,0x12,0xC9,0x2C,'0','0','0','0','0','0','0',0x0,'4','H',\
> +       'T','F','3','2','6','4','H','Y','-','5','3','E','D','3',\
> +       0x3,0x0,0x0,0x0,0x0};
> +
> +void i2c_init(int speed, int slaveaddr){
> +       return ;
> +}
> +
> +int i2c_read(uchar chip, uint addr, int alen, uchar * buffer, int len)
> +{
> +       int i;
> +       if (alen!=1)
> +               return -1;
> +
> +       if (addr+len>0xff)
> +               return -1;
> +
> +       for(i=0;i<len;i++){
> +               buffer[i]=i2c_dummy_buffer[i+addr];
> +       }
> +
> +       return 0;
> +}
> +
> +int i2c_write(uchar chip, uint addr, int alen, uchar * buffer, int len)
> +{
> +       int i;
> +       if (alen!=1)
> +               return -1;
> +
> +       if (addr+len>0xff)
> +               return -1;
> +
> +       for(i=0;i<len;i++){
> +               i2c_dummy_buffer[i+addr]=buffer[i];
> +       }
> +
> +       return 0;
> +}
> +
> +
> +int i2c_probe(uchar chip)
> +{
> +       return 0;
> +}
> +
> --
> 1.5.6.2
>
>



-- 
Ricardo Ribalda
http://www.eps.uam.es/~rribalda/

^ permalink raw reply	[flat|nested] 12+ messages in thread

* [U-Boot-Users] [PATCH] New Dummy I2C Driver
  2008-07-11  8:40 ` Ricardo Ribalda Delgado
@ 2008-07-11  8:54   ` Stefan Roese
  2008-07-11  9:00     ` Michal Simek
  0 siblings, 1 reply; 12+ messages in thread
From: Stefan Roese @ 2008-07-11  8:54 UTC (permalink / raw)
  To: u-boot

On Friday 11 July 2008, Ricardo Ribalda Delgado wrote:
> I didn't add this to the description sorry:
>
>  This driver provides access to a false i2c eeprom.
>  This false eeprom could be very useful in boards with
>  ddr2 memories and no i2c interfaces.
>  Using this driver the user can simulate the spd interface
>  of the ddr2 memory and use the ddr2 auto configuration

Problem is, that those SPD values in this driver are board specific. Other 
boards with other DIMM(s) would need other EEPROM values. So it doesn't make 
sense to add this in such a common file for me. And I really don't like the 
name "dummy_i2c.c".

Which SDRAM controller is used on your 440/Virtex SoC? Is it an IBM compatible 
one? Or an IP core from Xilinx? I suggest you take a look at the similar 
implementation selectable via CFG_SIMULATE_SPD_EEPROM (used on bamboo).

Best regards,
Stefan

=====================================================================
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-0 Fax: +49-8142-66989-80  Email: office at denx.de
=====================================================================

^ permalink raw reply	[flat|nested] 12+ messages in thread

* [U-Boot-Users] [PATCH] New Dummy I2C Driver
  2008-07-11  8:54   ` Stefan Roese
@ 2008-07-11  9:00     ` Michal Simek
  0 siblings, 0 replies; 12+ messages in thread
From: Michal Simek @ 2008-07-11  9:00 UTC (permalink / raw)
  To: u-boot

Hi Stefan and Ricardo,

>> I didn't add this to the description sorry:
>>
>>  This driver provides access to a false i2c eeprom.
>>  This false eeprom could be very useful in boards with
>>  ddr2 memories and no i2c interfaces.
>>  Using this driver the user can simulate the spd interface
>>  of the ddr2 memory and use the ddr2 auto configuration
>
>Problem is, that those SPD values in this driver are board specific. Other 
>boards with other DIMM(s) would need other EEPROM values. So it doesn't make 
>sense to add this in such a common file for me. And I really don't like the 
>name "dummy_i2c.c".

The dummy driver could be useful but without board specific values as Stefan wrote.
The name is awful. If is board specific setting you have to move it to board specific path.
(board/xilinx/ml507)

M

>Which SDRAM controller is used on your 440/Virtex SoC? Is it an IBM compatible 
>one? Or an IP core from Xilinx? I suggest you take a look at the similar 
>implementation selectable via CFG_SIMULATE_SPD_EEPROM (used on bamboo).


>Best regards,
>Stefan

=====================================================================
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-0 Fax: +49-8142-66989-80  Email: office at denx.de
=====================================================================

-------------------------------------------------------------------------
Sponsored by: SourceForge.net Community Choice Awards: VOTE NOW!
Studies have shown that voting for your favorite open source project,
along with a healthy diet, reduces your potential for chronic lameness
and boredom. Vote Now at http://www.sourceforge.net/community/cca08
_______________________________________________
U-Boot-Users mailing list
U-Boot-Users at lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/u-boot-users

^ permalink raw reply	[flat|nested] 12+ messages in thread

* [U-Boot-Users] [PATCH] New Dummy I2C Driver
@ 2008-07-11 10:26 Ricardo Ribalda Delgado
  2008-07-11 10:26 ` Ricardo Ribalda Delgado
                   ` (2 more replies)
  0 siblings, 3 replies; 12+ messages in thread
From: Ricardo Ribalda Delgado @ 2008-07-11 10:26 UTC (permalink / raw)
  To: u-boot

This driver provides access to a false i2c eeprom.
 This false eeprom could be very useful in boards with
 ddr2 memories and no i2c interfaces.
 Using this driver the user can simulate the spd interface
 of the ddr2 memory and use the ddr2 auto config

Signed-off-by: Ricardo Ribalda Delgado <ricardo.ribalda@uam.es>
---
 drivers/i2c/Makefile    |    1 +
 drivers/i2c/dummy_i2c.c |   65 +++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 66 insertions(+), 0 deletions(-)
 create mode 100644 drivers/i2c/dummy_i2c.c

diff --git a/drivers/i2c/Makefile b/drivers/i2c/Makefile
index 534c015..94a0791 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_DUMMY_I2C) += dummy_i2c.o
 
 COBJS	:= $(COBJS-y)
 SRCS	:= $(COBJS:.o=.c)
diff --git a/drivers/i2c/dummy_i2c.c b/drivers/i2c/dummy_i2c.c
new file mode 100644
index 0000000..ce859c3
--- /dev/null
+++ b/drivers/i2c/dummy_i2c.c
@@ -0,0 +1,65 @@
+/*   
+    (C) Copyright 2008
+    Ricado Ribalda-Universidad Autonoma de Madrid-ricardo.ribalda at uam.es
+    This work has been supported by: Q-Technology  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>
+
+#define DUMMY_I2C_LEN 256
+
+u8 i2c_dummy_buffer[DUMMY_I2C_LEN]= CONFIG_DUMMY_I2C_DATA;
+
+void i2c_init(int speed, int slaveaddr){
+	return ;
+}
+
+int i2c_read(uchar chip, uint addr, int alen, uchar * buffer, int len)
+{
+	int i;
+	if (alen!=1)
+		return -1;
+
+	if (addr+len>DUMMY_I2C_LEN)
+		return -1;
+
+	for(i=0;i<len;i++){
+		buffer[i]=i2c_dummy_buffer[i+addr];
+	}
+
+	return 0;
+}
+int i2c_write(uchar chip, uint addr, int alen, uchar * buffer, int len)
+{
+	int i;
+	if (alen!=1)
+		return -1;
+	if (addr+len>DUMMY_I2C_LEN)
+		return -1;
+
+	for(i=0;i<len;i++){
+		i2c_dummy_buffer[i+addr]=buffer[i];
+	}
+
+	return 0;
+}
+
+int i2c_probe(uchar chip)
+{
+	return 0;
+}
+
-- 
1.5.6.2

^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [U-Boot-Users] [PATCH] New Dummy I2C Driver
  2008-07-11 10:26 [U-Boot-Users] [PATCH] New Dummy I2C Driver Ricardo Ribalda Delgado
@ 2008-07-11 10:26 ` Ricardo Ribalda Delgado
  2008-07-11 12:45 ` Jerry Van Baren
  2008-07-13 13:33 ` Wolfgang Denk
  2 siblings, 0 replies; 12+ messages in thread
From: Ricardo Ribalda Delgado @ 2008-07-11 10:26 UTC (permalink / raw)
  To: u-boot

Version cleaned

On Fri, Jul 11, 2008 at 12:26 PM, Ricardo Ribalda Delgado
<ricardo.ribalda@uam.es> wrote:
> This driver provides access to a false i2c eeprom.
>  This false eeprom could be very useful in boards with
>  ddr2 memories and no i2c interfaces.
>  Using this driver the user can simulate the spd interface
>  of the ddr2 memory and use the ddr2 auto config
>
> Signed-off-by: Ricardo Ribalda Delgado <ricardo.ribalda@uam.es>
> ---
>  drivers/i2c/Makefile    |    1 +
>  drivers/i2c/dummy_i2c.c |   65 +++++++++++++++++++++++++++++++++++++++++++++++
>  2 files changed, 66 insertions(+), 0 deletions(-)
>  create mode 100644 drivers/i2c/dummy_i2c.c
>
> diff --git a/drivers/i2c/Makefile b/drivers/i2c/Makefile
> index 534c015..94a0791 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_DUMMY_I2C) += dummy_i2c.o
>
>  COBJS  := $(COBJS-y)
>  SRCS   := $(COBJS:.o=.c)
> diff --git a/drivers/i2c/dummy_i2c.c b/drivers/i2c/dummy_i2c.c
> new file mode 100644
> index 0000000..ce859c3
> --- /dev/null
> +++ b/drivers/i2c/dummy_i2c.c
> @@ -0,0 +1,65 @@
> +/*
> +    (C) Copyright 2008
> +    Ricado Ribalda-Universidad Autonoma de Madrid-ricardo.ribalda at uam.es
> +    This work has been supported by: Q-Technology  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>
> +
> +#define DUMMY_I2C_LEN 256
> +
> +u8 i2c_dummy_buffer[DUMMY_I2C_LEN]= CONFIG_DUMMY_I2C_DATA;
> +
> +void i2c_init(int speed, int slaveaddr){
> +       return ;
> +}
> +
> +int i2c_read(uchar chip, uint addr, int alen, uchar * buffer, int len)
> +{
> +       int i;
> +       if (alen!=1)
> +               return -1;
> +
> +       if (addr+len>DUMMY_I2C_LEN)
> +               return -1;
> +
> +       for(i=0;i<len;i++){
> +               buffer[i]=i2c_dummy_buffer[i+addr];
> +       }
> +
> +       return 0;
> +}
> +int i2c_write(uchar chip, uint addr, int alen, uchar * buffer, int len)
> +{
> +       int i;
> +       if (alen!=1)
> +               return -1;
> +       if (addr+len>DUMMY_I2C_LEN)
> +               return -1;
> +
> +       for(i=0;i<len;i++){
> +               i2c_dummy_buffer[i+addr]=buffer[i];
> +       }
> +
> +       return 0;
> +}
> +
> +int i2c_probe(uchar chip)
> +{
> +       return 0;
> +}
> +
> --
> 1.5.6.2
>
>



-- 
Ricardo Ribalda
http://www.eps.uam.es/~rribalda/

^ permalink raw reply	[flat|nested] 12+ messages in thread

* [U-Boot-Users] [PATCH] New Dummy I2C Driver
  2008-07-11 10:26 [U-Boot-Users] [PATCH] New Dummy I2C Driver Ricardo Ribalda Delgado
  2008-07-11 10:26 ` Ricardo Ribalda Delgado
@ 2008-07-11 12:45 ` Jerry Van Baren
  2008-07-11 13:45   ` Michal Simek
  2008-07-13 13:33 ` Wolfgang Denk
  2 siblings, 1 reply; 12+ messages in thread
From: Jerry Van Baren @ 2008-07-11 12:45 UTC (permalink / raw)
  To: u-boot

Ricardo Ribalda Delgado wrote:
> This driver provides access to a false i2c eeprom.
>  This false eeprom could be very useful in boards with
>  ddr2 memories and no i2c interfaces.
>  Using this driver the user can simulate the spd interface
>  of the ddr2 memory and use the ddr2 auto config

Hi Ricardo:

Nitpicking - "fake" would be a better word than "false" in this context. 
  I wouldn't reroll the patch for this, but if you reroll it for some 
other reason...

Thanks,
gvb

^ permalink raw reply	[flat|nested] 12+ messages in thread

* [U-Boot-Users] [PATCH] New Dummy I2C Driver
  2008-07-11 12:45 ` Jerry Van Baren
@ 2008-07-11 13:45   ` Michal Simek
  0 siblings, 0 replies; 12+ messages in thread
From: Michal Simek @ 2008-07-11 13:45 UTC (permalink / raw)
  To: u-boot


>> This driver provides access to a false i2c eeprom.
>>  This false eeprom could be very useful in boards with
>>  ddr2 memories and no i2c interfaces.
>>  Using this driver the user can simulate the spd interface
>>  of the ddr2 memory and use the ddr2 auto config
> 
> Hi Ricardo:
> 
> Nitpicking - "fake" would be a better word than "false" in this context. 
>   I wouldn't reroll the patch for this, but if you reroll it for some 
> other reason...
> 
> Thanks,
> gvb

:-)
M

^ permalink raw reply	[flat|nested] 12+ messages in thread

* [U-Boot-Users] [PATCH] New Dummy I2C Driver
  2008-07-11 10:26 [U-Boot-Users] [PATCH] New Dummy I2C Driver Ricardo Ribalda Delgado
  2008-07-11 10:26 ` Ricardo Ribalda Delgado
  2008-07-11 12:45 ` Jerry Van Baren
@ 2008-07-13 13:33 ` Wolfgang Denk
  2008-07-14 11:01   ` [U-Boot-Users] [PATCH] [PATCH] I2C EEPROM simulator Ricardo Ribalda Delgado
  2 siblings, 1 reply; 12+ messages in thread
From: Wolfgang Denk @ 2008-07-13 13:33 UTC (permalink / raw)
  To: u-boot

In message <1215771981-26784-1-git-send-email-ricardo.ribalda@uam.es> you wrote:
> This driver provides access to a false i2c eeprom.
>  This false eeprom could be very useful in boards with
>  ddr2 memories and no i2c interfaces.
>  Using this driver the user can simulate the spd interface
>  of the ddr2 memory and use the ddr2 auto config

As discussed before, please substitue "false" by "fake" or similar.

I also agree with previous comments tthat "dummy" is not a good name,
as your driver actually does something useful. Actually, it simulates
an  EEPROM  device,  so  maybe  "eeprom_simul.c"  might  be  a   more
descriptive name?

> --- /dev/null
> +++ b/drivers/i2c/dummy_i2c.c
> @@ -0,0 +1,65 @@
...
> +    (C) Copyright 2008
> +    Ricado Ribalda-Universidad Autonoma de Madrid-ricardo.ribalda at uam.es
> +    This work has been supported by: Q-Technology  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>
> +
> +#define DUMMY_I2C_LEN 256
> +
> +u8 i2c_dummy_buffer[DUMMY_I2C_LEN]= CONFIG_DUMMY_I2C_DATA;

I think it would also be useful in some cases to be able to use this
silulator without initialized content, so maybe you could change this
into

	u8 i2c_dummy_buffer[DUMMY_I2C_LEN]
	#ifdef CONFIG_DUMMY_I2C_DATA
		= CONFIG_DUMMY_I2C_DATA
	#endif
	;

or similar. And please also change the variable names as discussed
above for the driver name.

Thanks in advance.

Best regards,

Wolfgang Denk

-- 
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
But the only way of discovering the limits  of  the  possible  is  to
venture a little way past them into the impossible.
                         - _Profiles of the Future_ (1962; rev. 1973)
                  ``Hazards of Prophecy: The Failure of Imagination''

^ permalink raw reply	[flat|nested] 12+ messages in thread

* [U-Boot-Users] [PATCH] [PATCH] I2C EEPROM simulator
  2008-07-13 13:33 ` Wolfgang Denk
@ 2008-07-14 11:01   ` Ricardo Ribalda Delgado
  2008-07-16  1:06     ` [U-Boot-Users] " Ricardo Ribalda Delgado
  0 siblings, 1 reply; 12+ messages in thread
From: Ricardo Ribalda Delgado @ 2008-07-14 11:01 UTC (permalink / raw)
  To: u-boot

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..aecd0e5
--- /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: Q-Technology  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;
+}
+
-- 
1.5.6.2

^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [U-Boot-Users] [PATCH] I2C EEPROM simulator
  2008-07-14 11:01   ` [U-Boot-Users] [PATCH] [PATCH] I2C EEPROM simulator Ricardo Ribalda Delgado
@ 2008-07-16  1:06     ` Ricardo Ribalda Delgado
  2008-07-29 14:30       ` [U-Boot-Users] unassigned-patches/9: " u-boot at bugs.denx.de
  0 siblings, 1 reply; 12+ messages in thread
From: Ricardo Ribalda Delgado @ 2008-07-16  1:06 UTC (permalink / raw)
  To: u-boot

Minor Changes to previous patch

Signed-off-by: Ricardo Ribalda Delgado <ricardo.ribalda@uam.es>
---
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

 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;
+}
+
-- 
1.5.6.2

^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [U-Boot-Users] unassigned-patches/9: [PATCH] I2C EEPROM simulator
  2008-07-16  1:06     ` [U-Boot-Users] " Ricardo Ribalda Delgado
@ 2008-07-29 14:30       ` u-boot at bugs.denx.de
  0 siblings, 0 replies; 12+ messages in thread
From: u-boot at bugs.denx.de @ 2008-07-29 14:30 UTC (permalink / raw)
  To: u-boot

Minor Changes to previous patch

Signed-off-by: Ricardo Ribalda Delgado <ricardo.ribalda@uam.es>

---
Added to GNATS database as unassigned-patches/9
>Responsible:    patch-coord
>Message-Id:     <1216170409-13269-1-git-send-email-ricardo.ribalda@uam.es>
>In-Reply-To:    <1216033318-29449-1-git-send-email-ricardo.ribalda@uam.es>
>References:     <1216033318-29449-1-git-send-email-ricardo.ribalda@uam.es>
>Patch-Date:     Wed Jul 16 03:06:49 +0200 2008
---
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

 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;
+}
+
-- 
1.5.6.2


-------------------------------------------------------------------------
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@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/u-boot-users

^ permalink raw reply related	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2008-07-29 14:30 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-07-11 10:26 [U-Boot-Users] [PATCH] New Dummy I2C Driver Ricardo Ribalda Delgado
2008-07-11 10:26 ` Ricardo Ribalda Delgado
2008-07-11 12:45 ` Jerry Van Baren
2008-07-11 13:45   ` Michal Simek
2008-07-13 13:33 ` Wolfgang Denk
2008-07-14 11:01   ` [U-Boot-Users] [PATCH] [PATCH] I2C EEPROM simulator Ricardo Ribalda Delgado
2008-07-16  1:06     ` [U-Boot-Users] " Ricardo Ribalda Delgado
2008-07-29 14:30       ` [U-Boot-Users] unassigned-patches/9: " u-boot at bugs.denx.de
  -- strict thread matches above, loose matches on Subject: below --
2008-07-11  8:38 [U-Boot-Users] [PATCH] New Dummy I2C Driver Ricardo Ribalda Delgado
2008-07-11  8:40 ` Ricardo Ribalda Delgado
2008-07-11  8:54   ` Stefan Roese
2008-07-11  9:00     ` Michal Simek

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.