* [U-Boot-Users] [PATCH] Allow negative offset in command loads
@ 2008-07-23 17:10 Ricardo Ribalda Delgado
2008-07-23 17:10 ` [U-Boot-Users] [PATCH] I2C EEPROM simulator (Resubmit) Ricardo Ribalda Delgado
0 siblings, 1 reply; 7+ messages in thread
From: Ricardo Ribalda Delgado @ 2008-07-23 17:10 UTC (permalink / raw)
To: u-boot
Comand loads only allows positive offset for relocating the .srec files,
this patch allows negative offsets
Signed-off-by: Ricardo Ribalda Delgado <ricardo.ribalda@uam.es>
---
common/cmd_load.c | 8 ++++----
1 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/common/cmd_load.c b/common/cmd_load.c
index 89f6403..ae56543 100644
--- a/common/cmd_load.c
+++ b/common/cmd_load.c
@@ -53,7 +53,7 @@ static int do_echo = 1;
#if defined(CONFIG_CMD_LOADS)
int do_load_serial (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
{
- ulong offset = 0;
+ long offset = 0;
ulong addr;
int i;
char *env_echo;
@@ -72,7 +72,7 @@ int do_load_serial (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
#ifdef CFG_LOADS_BAUD_CHANGE
if (argc >= 2) {
- offset = simple_strtoul(argv[1], NULL, 16);
+ offset = simple_strtol(argv[1], NULL, 16);
}
if (argc == 3) {
load_baudrate = (int)simple_strtoul(argv[2], NULL, 10);
@@ -95,7 +95,7 @@ int do_load_serial (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
}
#else /* ! CFG_LOADS_BAUD_CHANGE */
if (argc == 2) {
- offset = simple_strtoul(argv[1], NULL, 16);
+ offset = simple_strtol(argv[1], NULL, 16);
}
#endif /* CFG_LOADS_BAUD_CHANGE */
@@ -141,7 +141,7 @@ int do_load_serial (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
}
static ulong
-load_serial (ulong offset)
+load_serial (long offset)
{
char record[SREC_MAXRECLEN + 1]; /* buffer for one S-Record */
char binbuf[SREC_MAXBINLEN]; /* buffer for binary data */
--
1.5.6.3
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [U-Boot-Users] [PATCH] I2C EEPROM simulator (Resubmit)
2008-07-23 17:10 [U-Boot-Users] [PATCH] Allow negative offset in command loads Ricardo Ribalda Delgado
@ 2008-07-23 17:10 ` Ricardo Ribalda Delgado
2008-07-23 17:10 ` [U-Boot-Users] [PATCH] I2C Monitor chip ADT7460 support (Resubmit) Ricardo Ribalda Delgado
2008-07-25 7:37 ` [U-Boot-Users] [PATCH] I2C EEPROM simulator (Resubmit) Michal Simek
0 siblings, 2 replies; 7+ messages in thread
From: Ricardo Ribalda Delgado @ 2008-07-23 17:10 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..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.3
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [U-Boot-Users] [PATCH] I2C Monitor chip ADT7460 support (Resubmit)
2008-07-23 17:10 ` [U-Boot-Users] [PATCH] I2C EEPROM simulator (Resubmit) Ricardo Ribalda Delgado
@ 2008-07-23 17:10 ` Ricardo Ribalda Delgado
2008-08-18 21:48 ` [U-Boot] " Wolfgang Denk
2008-07-25 7:37 ` [U-Boot-Users] [PATCH] I2C EEPROM simulator (Resubmit) Michal Simek
1 sibling, 1 reply; 7+ messages in thread
From: Ricardo Ribalda Delgado @ 2008-07-23 17:10 UTC (permalink / raw)
To: u-boot
Signed-off-by: Ricardo Ribalda Delgado <ricardo.ribalda@uam.es>
---
drivers/hwmon/Makefile | 1 +
drivers/hwmon/adt7460.c | 83 +++++++++++++++++++++++++++++++++++++++++++++++
include/dtt.h | 3 +-
3 files changed, 86 insertions(+), 1 deletions(-)
create mode 100644 drivers/hwmon/adt7460.c
diff --git a/drivers/hwmon/Makefile b/drivers/hwmon/Makefile
index f09f145..7342b91 100644
--- a/drivers/hwmon/Makefile
+++ b/drivers/hwmon/Makefile
@@ -37,6 +37,7 @@ COBJS-$(CONFIG_DTT_DS1775) += ds1775.o
COBJS-$(CONFIG_DTT_LM73) += lm73.o
COBJS-$(CONFIG_DTT_LM75) += lm75.o
COBJS-$(CONFIG_DTT_LM81) += lm81.o
+COBJS-$(CONFIG_DTT_ADT7460) += adt7460.o
COBJS := $(COBJS-y)
SRCS := $(COBJS:.o=.c)
diff --git a/drivers/hwmon/adt7460.c b/drivers/hwmon/adt7460.c
new file mode 100644
index 0000000..caef70a
--- /dev/null
+++ b/drivers/hwmon/adt7460.c
@@ -0,0 +1,83 @@
+/*
+ * (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>
+#include <dtt.h>
+
+#define ADT7460_ADDRESS 0x2c
+#define ADT7460_INVALID 128
+#define ADT7460_CONFIG 0x40
+#define ADT7460_REM1_TEMP 0x25
+#define ADT7460_LOCAL_TEMP 0x26
+#define ADT7460_REM2_TEMP 0x27
+
+int dtt_read(int sensor, int reg)
+{
+ u8 dir = reg;
+ u8 data;
+
+ if (i2c_read(ADT7460_ADDRESS, dir, 1, &data, 1) == -1)
+ return -1;
+ if (data == ADT7460_INVALID)
+ return -1;
+
+ return data;
+}
+
+int dtt_write(int sensor, int reg, int val)
+{
+ u8 dir = reg;
+ u8 data = val;
+
+ if (i2c_write(ADT7460_ADDRESS, dir, 1, &data, 1) == -1)
+ return -1;
+
+ return 0;
+}
+
+int dtt_init(void)
+{
+ printf("ADT7460 at I2C address 0x%2x\n", ADT7460_ADDRESS);
+
+ if (dtt_write(0, ADT7460_CONFIG, 1) == -1) {
+ puts("Error initialiting ADT7460\n");
+ return -1;
+ }
+
+ return 0;
+}
+
+int dtt_get_temp(int sensor)
+{
+ int aux;
+ u8 table[] =
+ { ADT7460_REM1_TEMP, ADT7460_LOCAL_TEMP, ADT7460_REM2_TEMP };
+
+ if (sensor > 2) {
+ puts("DTT sensor does not exist\n");
+ return -1;
+ }
+
+ aux = dtt_read(0, table[sensor]);
+ if (aux == -1) {
+ puts("DTT temperature read failed\n");
+ return -1;
+ }
+
+ return aux;
+}
diff --git a/include/dtt.h b/include/dtt.h
index 34053d1..ce0fdfa 100644
--- a/include/dtt.h
+++ b/include/dtt.h
@@ -32,7 +32,8 @@
defined(CONFIG_DTT_DS1775) || \
defined(CONFIG_DTT_LM81) || \
defined(CONFIG_DTT_ADM1021) || \
- defined(CONFIG_DTT_LM73)
+ defined(CONFIG_DTT_LM73) || \
+ defined(CONFIG_DTT_ADT7460)
#define CONFIG_DTT /* We have a DTT */
--
1.5.6.3
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [U-Boot-Users] [PATCH] I2C EEPROM simulator (Resubmit)
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-07-25 7:37 ` Michal Simek
2008-07-25 8:55 ` Ricardo Ribalda Delgado
1 sibling, 1 reply; 7+ messages in thread
From: Michal Simek @ 2008-07-25 7:37 UTC (permalink / raw)
To: u-boot
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;
> +}
> +
^ permalink raw reply [flat|nested] 7+ messages in thread
* [U-Boot-Users] [PATCH] I2C EEPROM simulator (Resubmit)
2008-07-25 7:37 ` [U-Boot-Users] [PATCH] I2C EEPROM simulator (Resubmit) Michal Simek
@ 2008-07-25 8:55 ` Ricardo Ribalda Delgado
2008-07-26 8:09 ` Michal Simek
0 siblings, 1 reply; 7+ messages in thread
From: Ricardo Ribalda Delgado @ 2008-07-25 8:55 UTC (permalink / raw)
To: u-boot
Hello Michal
No hints about where are this codyng style issues?
Best regards
--
Ricardo Ribalda
http://www.eps.uam.es/~rribalda/
^ permalink raw reply [flat|nested] 7+ messages in thread
* [U-Boot-Users] [PATCH] I2C EEPROM simulator (Resubmit)
2008-07-25 8:55 ` Ricardo Ribalda Delgado
@ 2008-07-26 8:09 ` Michal Simek
0 siblings, 0 replies; 7+ messages in thread
From: Michal Simek @ 2008-07-26 8:09 UTC (permalink / raw)
To: u-boot
for, if
M
> Hello Michal
>
> No hints about where are this codyng style issues?
>
> Best regards
>
>
>
>
^ permalink raw reply [flat|nested] 7+ messages in thread
* [U-Boot] [U-Boot-Users] [PATCH] I2C Monitor chip ADT7460 support (Resubmit)
2008-07-23 17:10 ` [U-Boot-Users] [PATCH] I2C Monitor chip ADT7460 support (Resubmit) Ricardo Ribalda Delgado
@ 2008-08-18 21:48 ` Wolfgang Denk
0 siblings, 0 replies; 7+ messages in thread
From: Wolfgang Denk @ 2008-08-18 21:48 UTC (permalink / raw)
To: u-boot
Dear Ricardo Ribalda Delgado,
In message <1216833014-7483-3-git-send-email-ricardo.ribalda@uam.es> you wrote:
> Signed-off-by: Ricardo Ribalda Delgado <ricardo.ribalda@uam.es>
> ---
> drivers/hwmon/Makefile | 1 +
> drivers/hwmon/adt7460.c | 83 +++++++++++++++++++++++++++++++++++++++++++++++
> include/dtt.h | 3 +-
> 3 files changed, 86 insertions(+), 1 deletions(-)
> create mode 100644 drivers/hwmon/adt7460.c
Applies, thanks.
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
Q: How do you spell "onomatopoeia"?
A: The way it sounds.
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2008-08-18 21:48 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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 ` [U-Boot-Users] [PATCH] I2C EEPROM simulator (Resubmit) Michal Simek
2008-07-25 8:55 ` Ricardo Ribalda Delgado
2008-07-26 8:09 ` Michal Simek
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox