[U-Boot-Users] Support for the ML507 Xilinx Board

Hi List:
<Sorry for the multiple submitions, but I think that this will safe a lot of time for our main developers. BTW: This is the first time I use git>
This is my first contribution to u-boot. I have ported u-boot to the ML507 Board by Xilinx. http://www.xilinx.com/products/devkits/HW-V5-ML507-UNI-G.htm
This boards includes an FPGA Virtex 5 FX with an embedded PowerPC 440.
The port supports: -Virtex 5 ppc440x5 -XIlinx Interrupt Controller -Xilinx I2C Controller (Interrupted mode) -Xilinx Uart Lite (simple port) -Xilinx LL_TEMA (Interrupted and SGDMA) -Save environment on board eeprom -DTT support for the ADT sensor on board (new hwmon driver) -Dummy I2C driver (for testing purposes)
This patch works against the last commit to the p4xx branch.
I am a researcher of the Universidad Autonoma de Madrid, and this work has been supported by Q-Technology ( http://qtec.com ) under a Research Agreement.
Any comment will be very welcomed.

Signed-off-by: Ricardo Ribalda Delgado ricardo.ribalda@uam.es --- drivers/hwmon/Makefile | 1 + drivers/hwmon/adt7460.c | 89 +++++++++++++++++++++++++++++++++++++++++++++++ drivers/hwmon/adt7460.h | 49 ++++++++++++++++++++++++++ include/dtt.h | 2 +- 4 files changed, 140 insertions(+), 1 deletions(-) create mode 100644 drivers/hwmon/adt7460.c create mode 100644 drivers/hwmon/adt7460.h
diff --git a/drivers/hwmon/Makefile b/drivers/hwmon/Makefile index 065433a..83aa297 100644 --- a/drivers/hwmon/Makefile +++ b/drivers/hwmon/Makefile @@ -34,6 +34,7 @@ COBJS-y += adm1021.o COBJS-y += ds1621.o COBJS-y += ds1722.o COBJS-y += ds1775.o +COBJS-y += adt7460.o COBJS-$(CONFIG_DTT_LM73) += lm73.o COBJS-y += lm75.o COBJS-y += lm81.o diff --git a/drivers/hwmon/adt7460.c b/drivers/hwmon/adt7460.c new file mode 100644 index 0000000..255d6ed --- /dev/null +++ b/drivers/hwmon/adt7460.c @@ -0,0 +1,89 @@ +/* + (C) Copyright 2008 + Ricado Ribalda, Universidad Autonoma de Madrid, ricardo.ribalda<at>uam.es , ricardo.ribalda<at>gmail.com + 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 3 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> + +#ifdef CONFIG_DTT_ADT7460 + +#include <i2c.h> +#include <dtt.h> +#include "adt7460.h" + +#define ADT7460_ADDRESS 0x2c + + +int dtt_read(int sensor, int reg) +{ + u8 dir=reg; + u8 data; + + if (-1==i2c_read(ADT7460_ADDRESS,dir,1,&data,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 (-1==i2c_write(ADT7460_ADDRESS,dir,1,&data,1)) + return -1; + + return 0; +} + + + +int dtt_init (void) +{ + printf("ADT7460 at I2C address 0x%2x\n",ADT7460_ADDRESS); + if (-1==dtt_write(0,ADT7460_CONFIG,1)){ + printf("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){ + printf("DTT sensor does not exist\n"); + return -1; + } + + aux=dtt_read(0,table[sensor]); + + if (-1==aux){ + printf("DTT temperature read failed\n"); + return -1; + + } + return aux; +} +#endif diff --git a/drivers/hwmon/adt7460.h b/drivers/hwmon/adt7460.h new file mode 100644 index 0000000..48666f7 --- /dev/null +++ b/drivers/hwmon/adt7460.h @@ -0,0 +1,49 @@ +/* + (C) Copyright 2008 + Ricado Ribalda, Universidad Autonoma de Madrid, ricardo.ribalda<at>uam.es , ricardo.ribalda<at>gmail.com + 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 3 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/. +*/ +#ifndef ADT7460 +#define ADT7460 + + +#define ADT7460_INVALID 128 + +#define ADT7460_2_5V 0x20 +#define ADT7460_VCCP 0x21 +#define ADT7460_VCC 0x22 +#define ADT7460_V5 0x23 +#define ADT7460_V12 0x24 +#define ADT7460_REM1_TEMP 0x25 +#define ADT7460_LOCAL_TEMP 0x26 +#define ADT7460_REM2_TEMP 0x27 +#define ADT7460_TACH1L 0x28 +#define ADT7460_TACH1H 0x29 +#define ADT7460_TACH2L 0x2a +#define ADT7460_TACH2H 0x2b +#define ADT7460_TACH3L 0x2c +#define ADT7460_TACH3H 0x2d +#define ADT7460_TACH4L 0x2e +#define ADT7460_TACH4H 0x2f +#define ADT7460_TACH5L 0xa9 +#define ADT7460_TACH5H 0xaa +#define ADT7460_TACH6L 0xab +#define ADT7460_TACH6H 0xac +#define ADT7460_REVISION 0x3f +#define ADT7460_CONFIG 0x40 + + +#endif diff --git a/include/dtt.h b/include/dtt.h index 4e8aaad..73d7547 100644 --- a/include/dtt.h +++ b/include/dtt.h @@ -32,7 +32,7 @@ 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 */

Signed-off-by: Ricardo Ribalda Delgado ricardo.ribalda@uam.es --- drivers/i2c/Makefile | 1 + drivers/i2c/dummy_i2c.c | 84 +++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 85 insertions(+), 0 deletions(-) create mode 100644 drivers/i2c/dummy_i2c.c
diff --git a/drivers/i2c/Makefile b/drivers/i2c/Makefile index 534c015..322c822 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-y += 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..04f6edb --- /dev/null +++ b/drivers/i2c/dummy_i2c.c @@ -0,0 +1,84 @@ +/* + (C) Copyright 2008 + Ricado Ribalda, Universidad Autonoma de Madrid, ricardo.ribalda<at>uam.es , ricardo.ribalda<at>gmail.com + 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 3 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> + +#if defined(CONFIG_DUMMY_I2C) + + +#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; +} + + + + + +#endif +

Ricardo Ribalda Delgado wrote:
Signed-off-by: Ricardo Ribalda Delgado ricardo.ribalda@uam.es
drivers/i2c/Makefile | 1 + drivers/i2c/dummy_i2c.c | 84 +++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 85 insertions(+), 0 deletions(-) create mode 100644 drivers/i2c/dummy_i2c.c
diff --git a/drivers/i2c/Makefile b/drivers/i2c/Makefile index 534c015..322c822 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-y += 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..04f6edb --- /dev/null +++ b/drivers/i2c/dummy_i2c.c @@ -0,0 +1,84 @@ +/*
- (C) Copyright 2008
- Ricado Ribalda, Universidad Autonoma de Madrid, ricardo.ribalda<at>uam.es , ricardo.ribalda<at>gmail.com
- 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 3 of the License, or
Ditto: GPLv3 is a problem because most of u-boot is licensed at GPLv2 (possibly with an upgrade clause). The problem is, GPLv3 is not backward compatible with GPLv2 because it adds restrictions. http://www.fsf.org/licensing/licenses/
If you wish to have this added to u-boot, you will need to change the licensing to GPLv2 (note that you can still keep the "any later" upgrade clause).
Best regards, gvb

In message 1215712408-23567-3-git-send-email-ricardo.ribalda@uam.es you wrote:
Signed-off-by: Ricardo Ribalda Delgado ricardo.ribalda@uam.es
What is the intention or practical use of this dummy driver?
--- a/drivers/i2c/Makefile +++ b/drivers/i2c/Makefile @@ -30,6 +30,7 @@ COBJS-y += omap1510_i2c.o
...
+COBJS-y += dummy_i2c.o
Please make "COBJS-$(CONFIG_DUMMY_I2C) += dummy_i2c.o" and ...
diff --git a/drivers/i2c/dummy_i2c.c b/drivers/i2c/dummy_i2c.c new file mode 100644 index 0000000..04f6edb --- /dev/null +++ b/drivers/i2c/dummy_i2c.c @@ -0,0 +1,84 @@
...
- (C) Copyright 2008
- Ricado Ribalda, Universidad Autonoma de Madrid, ricardo.ribalda<at>uam.es , ricardo.ribalda<at>gmail.com
[Line too long]
- 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 3 of the License, or
- (at your option) any later version.
[ GPLv2 needed]
+#if defined(CONFIG_DUMMY_I2C)
... drop this #ifdef / #endif
+#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};
Line way too long.
Maybe you also want to explain where these magic data is coming from or what it means?
- if (alen!=1)
if (alen != 1)
return -1;
- if (addr+len>0xff)
if (addr+len > 0xff)
return -1;
- for(i=0;i<len;i++){
for (i=0; i<len; i++) {
buffer[i]=i2c_dummy_buffer[i+addr];
buffer[i] = i2c_dummy_buffer[i+addr];
etc., please.
Best regards,
Wolfgang Denk

Hi Wolfgang
What is the intention or practical use of this dummy driver?
I developed this driver for two reasons,
I wanted a dummy driver to test the i2c subsystem I wanted a way of use the ddr2 autoconfiguration for ppc440 without i2c.
+#if defined(CONFIG_DUMMY_I2C) +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};
Line way too long.
Maybe you also want to explain where these magic data is coming from or what it means?
It is the identification data of my ddr2 memory.
I will redo this patch and sent it again if you consider it useful for the mainline.
Best Regards and thanks for your comments
-- 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@denx.de "Plan to throw one away. You will anyway." - Fred Brooks, "The Mythical Man Month"

Hi Ricardo,
Hi Wolfgang
What is the intention or practical use of this dummy driver?
I developed this driver for two reasons,
I wanted a dummy driver to test the i2c subsystem I wanted a way of use the ddr2 autoconfiguration for ppc440 without i2c.
+#if defined(CONFIG_DUMMY_I2C) +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};
Line way too long.
Maybe you also want to explain where these magic data is coming from or what it means?
It is the identification data of my ddr2 memory.
I think you will have to recoded it for better understanding.
M
I will redo this patch and sent it again if you consider it useful for the mainline.
Best Regards and thanks for your comments
-- 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@denx.de "Plan to throw one away. You will anyway." - Fred Brooks, "The Mythical Man Month"

Wolfgang Denk schrieb:
In message 1215712408-23567-3-git-send-email-ricardo.ribalda@uam.es you wrote:
Signed-off-by: Ricardo Ribalda Delgado ricardo.ribalda@uam.es
What is the intention or practical use of this dummy driver?
I think we could use it well for mounting different memory configurations on the same base board. This happens frequently due to different size requests from customers or chip-replacement. Actually I'll have to compile u-boot for each memory config ... very bad.
Getting the data out of flash (environment or small dedicated sector) would be fine.
Creating valid eeprom entries for use as SPD is another thing of ocurse.
--- a/drivers/i2c/Makefile +++ b/drivers/i2c/Makefile @@ -30,6 +30,7 @@ COBJS-y += omap1510_i2c.o
...
+COBJS-y += dummy_i2c.o
Please make "COBJS-$(CONFIG_DUMMY_I2C) += dummy_i2c.o" and ...
diff --git a/drivers/i2c/dummy_i2c.c b/drivers/i2c/dummy_i2c.c new file mode 100644 index 0000000..04f6edb --- /dev/null +++ b/drivers/i2c/dummy_i2c.c @@ -0,0 +1,84 @@
...
- (C) Copyright 2008
- Ricado Ribalda, Universidad Autonoma de Madrid, ricardo.ribalda<at>uam.es , ricardo.ribalda<at>gmail.com
[Line too long]
- 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 3 of the License, or
- (at your option) any later version.
[ GPLv2 needed]
+#if defined(CONFIG_DUMMY_I2C)
... drop this #ifdef / #endif
+#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};
Line way too long.
Maybe you also want to explain where these magic data is coming from or what it means?
- if (alen!=1)
if (alen != 1)
return -1;
- if (addr+len>0xff)
if (addr+len > 0xff)
return -1;
- for(i=0;i<len;i++){
for (i=0; i<len; i++) {
buffer[i]=i2c_dummy_buffer[i+addr];
buffer[i] = i2c_dummy_buffer[i+addr];
etc., please.
Best regards,
Wolfgang Denk
MATRIX VISION GmbH, Talstraße 16, DE-71570 Oppenweiler - Registergericht: Amtsgericht Stuttgart, HRB 271090 Geschäftsführer: Gerhard Thullner, Werner Armingeon, Uwe Furtner

Clean coding style. http://www.denx.de/wiki/UBoot/CodingStyle
Signed-off-by: Ricardo Ribalda Delgado ricardo.ribalda@uam.es
drivers/i2c/Makefile | 1 + drivers/i2c/dummy_i2c.c | 84 +++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 85 insertions(+), 0 deletions(-) create mode 100644 drivers/i2c/dummy_i2c.c
diff --git a/drivers/i2c/Makefile b/drivers/i2c/Makefile index 534c015..322c822 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-y += 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..04f6edb --- /dev/null +++ b/drivers/i2c/dummy_i2c.c @@ -0,0 +1,84 @@ +/*
- (C) Copyright 2008
- Ricado Ribalda, Universidad Autonoma de Madrid, ricardo.ribalda<at>uam.es , ricardo.ribalda<at>gmail.com
- 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 3 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>
+#if defined(CONFIG_DUMMY_I2C)
+#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;
+}
+#endif

Ricardo Ribalda Delgado wrote:
Signed-off-by: Ricardo Ribalda Delgado ricardo.ribalda@uam.es
drivers/hwmon/Makefile | 1 + drivers/hwmon/adt7460.c | 89 +++++++++++++++++++++++++++++++++++++++++++++++ drivers/hwmon/adt7460.h | 49 ++++++++++++++++++++++++++ include/dtt.h | 2 +- 4 files changed, 140 insertions(+), 1 deletions(-) create mode 100644 drivers/hwmon/adt7460.c create mode 100644 drivers/hwmon/adt7460.h
[snip]
+++ b/drivers/hwmon/adt7460.c @@ -0,0 +1,89 @@ +/*
- (C) Copyright 2008
- Ricado Ribalda, Universidad Autonoma de Madrid, ricardo.ribalda<at>uam.es , ricardo.ribalda<at>gmail.com
- 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 3 of the License, or
Hi Ricardo,
GPLv3 is a problem because most of u-boot is licensed at GPLv2 (possibly with an upgrade clause). The problem is, GPLv3 is not backward compatible with GPLv2 because it adds restrictions. http://www.fsf.org/licensing/licenses/
If you wish to have this added to u-boot, you will need to change the licensing to GPLv2 (note that you can still keep the "any later" upgrade clause).
[snip]
diff --git a/drivers/hwmon/adt7460.h b/drivers/hwmon/adt7460.h new file mode 100644 index 0000000..48666f7 --- /dev/null +++ b/drivers/hwmon/adt7460.h @@ -0,0 +1,49 @@ +/*
- (C) Copyright 2008
- Ricado Ribalda, Universidad Autonoma de Madrid, ricardo.ribalda<at>uam.es , ricardo.ribalda<at>gmail.com
- 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 3 of the License, or
Ditto.
Best regards, gvb

Hello Jerry
I didn't know that.... I will change the license and resend the patches as soon as I get more feedback to keep the mailing list as silent as possible.
Again: Thanks
On Thu, Jul 10, 2008 at 8:10 PM, Jerry Van Baren gerald.vanbaren@ge.com wrote:
Ricardo Ribalda Delgado wrote:
Signed-off-by: Ricardo Ribalda Delgado ricardo.ribalda@uam.es
drivers/hwmon/Makefile | 1 + drivers/hwmon/adt7460.c | 89 +++++++++++++++++++++++++++++++++++++++++++++++ drivers/hwmon/adt7460.h | 49 ++++++++++++++++++++++++++ include/dtt.h | 2 +- 4 files changed, 140 insertions(+), 1 deletions(-) create mode 100644 drivers/hwmon/adt7460.c create mode 100644 drivers/hwmon/adt7460.h
[snip]
+++ b/drivers/hwmon/adt7460.c @@ -0,0 +1,89 @@ +/* + (C) Copyright 2008
- Ricado Ribalda, Universidad Autonoma de Madrid,
ricardo.ribalda<at>uam.es , ricardo.ribalda<at>gmail.com
- 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 3 of the License, or
Hi Ricardo,
GPLv3 is a problem because most of u-boot is licensed at GPLv2 (possibly with an upgrade clause). The problem is, GPLv3 is not backward compatible with GPLv2 because it adds restrictions. http://www.fsf.org/licensing/licenses/
If you wish to have this added to u-boot, you will need to change the licensing to GPLv2 (note that you can still keep the "any later" upgrade clause).
[snip]
diff --git a/drivers/hwmon/adt7460.h b/drivers/hwmon/adt7460.h new file mode 100644 index 0000000..48666f7 --- /dev/null +++ b/drivers/hwmon/adt7460.h @@ -0,0 +1,49 @@ +/* + (C) Copyright 2008
- Ricado Ribalda, Universidad Autonoma de Madrid,
ricardo.ribalda<at>uam.es , ricardo.ribalda<at>gmail.com
- 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 3 of the License, or
Ditto.
Best regards, gvb

Hello again
I have modified the license of all the patches, and they are now located at: http://www.ii.uam.es/~rribalda/ml507.tgz Waiting for more comments
Thanks for your time and comments
On Thu, Jul 10, 2008 at 8:16 PM, Ricardo Ribalda Delgado ricardo.ribalda@uam.es wrote:
Hello Jerry
I didn't know that.... I will change the license and resend the patches as soon as I get more feedback to keep the mailing list as silent as possible.
Again: Thanks
On Thu, Jul 10, 2008 at 8:10 PM, Jerry Van Baren gerald.vanbaren@ge.com wrote:
Ricardo Ribalda Delgado wrote:
Signed-off-by: Ricardo Ribalda Delgado ricardo.ribalda@uam.es
drivers/hwmon/Makefile | 1 + drivers/hwmon/adt7460.c | 89 +++++++++++++++++++++++++++++++++++++++++++++++ drivers/hwmon/adt7460.h | 49 ++++++++++++++++++++++++++ include/dtt.h | 2 +- 4 files changed, 140 insertions(+), 1 deletions(-) create mode 100644 drivers/hwmon/adt7460.c create mode 100644 drivers/hwmon/adt7460.h
[snip]
+++ b/drivers/hwmon/adt7460.c @@ -0,0 +1,89 @@ +/* + (C) Copyright 2008
- Ricado Ribalda, Universidad Autonoma de Madrid,
ricardo.ribalda<at>uam.es , ricardo.ribalda<at>gmail.com
- 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 3 of the License, or
Hi Ricardo,
GPLv3 is a problem because most of u-boot is licensed at GPLv2 (possibly with an upgrade clause). The problem is, GPLv3 is not backward compatible with GPLv2 because it adds restrictions. http://www.fsf.org/licensing/licenses/
If you wish to have this added to u-boot, you will need to change the licensing to GPLv2 (note that you can still keep the "any later" upgrade clause).
[snip]
diff --git a/drivers/hwmon/adt7460.h b/drivers/hwmon/adt7460.h new file mode 100644 index 0000000..48666f7 --- /dev/null +++ b/drivers/hwmon/adt7460.h @@ -0,0 +1,49 @@ +/* + (C) Copyright 2008
- Ricado Ribalda, Universidad Autonoma de Madrid,
ricardo.ribalda<at>uam.es , ricardo.ribalda<at>gmail.com
- 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 3 of the License, or
Ditto.
Best regards, gvb
-- Ricardo Ribalda http://www.eps.uam.es/~rribalda/

In message aa76a2be0807101132i2256d905vd449a3bea9cbd367@mail.gmail.com you wrote:
I have modified the license of all the patches, and they are now located at: http://www.ii.uam.es/~rribalda/ml507.tgz Waiting for more comments
There will not be any comments from me this way. Please post the pathces on the list.
Best regards,
Wolfgang Denk

In message 1215712408-23567-2-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 | 89 +++++++++++++++++++++++++++++++++++++++++++++++ drivers/hwmon/adt7460.h | 49 ++++++++++++++++++++++++++ include/dtt.h | 2 +- 4 files changed, 140 insertions(+), 1 deletions(-) create mode 100644 drivers/hwmon/adt7460.c create mode 100644 drivers/hwmon/adt7460.h
diff --git a/drivers/hwmon/Makefile b/drivers/hwmon/Makefile index 065433a..83aa297 100644 --- a/drivers/hwmon/Makefile +++ b/drivers/hwmon/Makefile @@ -34,6 +34,7 @@ COBJS-y += adm1021.o COBJS-y += ds1621.o COBJS-y += ds1722.o COBJS-y += ds1775.o +COBJS-y += adt7460.o
Please make this
COBJS-$(CONFIG_DTT_ADT7460) += adt7460.o
instead,
COBJS-$(CONFIG_DTT_LM73) += lm73.o COBJS-y += lm75.o COBJS-y += lm81.o diff --git a/drivers/hwmon/adt7460.c b/drivers/hwmon/adt7460.c new file mode 100644 index 0000000..255d6ed --- /dev/null +++ b/drivers/hwmon/adt7460.c @@ -0,0 +1,89 @@
...
+#ifdef CONFIG_DTT_ADT7460
...and then drop this #ifdef / #endif
+#include <i2c.h> +#include <dtt.h> +#include "adt7460.h"
+#define ADT7460_ADDRESS 0x2c
+int dtt_read(int sensor, int reg) +{
- u8 dir=reg;
- u8 data;
- if (-1==i2c_read(ADT7460_ADDRESS,dir,1,&data,1))
Please write
if (i2c_read(ADT7460_ADDRESS,dir,1,&data,1) == -1)
here and everywhere else.
+int dtt_write(int sensor, int reg, int val) +{
- u8 dir=reg;
- u8 data=val;
- if (-1==i2c_write(ADT7460_ADDRESS,dir,1,&data,1))
return -1;
- return 0;
Maybe this could be simplyfied as
return i2c_write(ADT7460_ADDRESS,dir,1,&data,1);
?
- 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 3 of the License, or
- (at your option) any later version.
Please make GPLv2 (or later).
...
--- a/include/dtt.h +++ b/include/dtt.h @@ -32,7 +32,7 @@ defined(CONFIG_DTT_DS1775) || \ defined(CONFIG_DTT_LM81) || \ defined(CONFIG_DTT_ADM1021) || \
- defined(CONFIG_DTT_LM73)
- defined(CONFIG_DTT_LM73)||defined(CONFIG_DTT_ADT7460)
Please split on separate line.
Best regards,
Wolfgang Denk

Hello
All the comments are right, I will resend it tomorrow.
Best regards and thanks
-- 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@denx.de Earth -- mother of the most beautiful women in the universe. -- Apollo, "Who Mourns for Adonais?" stardate 3468.1

Clean coding style especially long lines, free lines and please choose only one email address.
Michal
Signed-off-by: Ricardo Ribalda Delgado ricardo.ribalda@uam.es
drivers/hwmon/Makefile | 1 + drivers/hwmon/adt7460.c | 89 +++++++++++++++++++++++++++++++++++++++++++++++ drivers/hwmon/adt7460.h | 49 ++++++++++++++++++++++++++ include/dtt.h | 2 +- 4 files changed, 140 insertions(+), 1 deletions(-) create mode 100644 drivers/hwmon/adt7460.c create mode 100644 drivers/hwmon/adt7460.h
diff --git a/drivers/hwmon/Makefile b/drivers/hwmon/Makefile index 065433a..83aa297 100644 --- a/drivers/hwmon/Makefile +++ b/drivers/hwmon/Makefile @@ -34,6 +34,7 @@ COBJS-y += adm1021.o COBJS-y += ds1621.o COBJS-y += ds1722.o COBJS-y += ds1775.o +COBJS-y += adt7460.o
look at line below to proper style.
COBJS-$(CONFIG_DTT_LM73) += lm73.o
COBJS-y += lm75.o COBJS-y += lm81.o diff --git a/drivers/hwmon/adt7460.c b/drivers/hwmon/adt7460.c new file mode 100644 index 0000000..255d6ed --- /dev/null +++ b/drivers/hwmon/adt7460.c @@ -0,0 +1,89 @@ +/*
- (C) Copyright 2008
- Ricado Ribalda, Universidad Autonoma de Madrid, ricardo.ribalda<at>uam.es , ricardo.ribalda<at>gmail.com
long line
- 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 3 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>
+#ifdef CONFIG_DTT_ADT7460
why is this ifdef here?
+#include <i2c.h> +#include <dtt.h> +#include "adt7460.h"
+#define ADT7460_ADDRESS 0x2c
+int dtt_read(int sensor, int reg) +{
- u8 dir=reg;
- u8 data;
- if (-1==i2c_read(ADT7460_ADDRESS,dir,1,&data,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 (-1==i2c_write(ADT7460_ADDRESS,dir,1,&data,1))
return -1;
- return 0;
+}
+int dtt_init (void) +{
- printf("ADT7460 at I2C address 0x%2x\n",ADT7460_ADDRESS);
- if (-1==dtt_write(0,ADT7460_CONFIG,1)){
printf("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){
printf("DTT sensor does not exist\n");
return -1;
- }
- aux=dtt_read(0,table[sensor]);
- if (-1==aux){
printf("DTT temperature read failed\n");
return -1;
- }
- return aux;
+} +#endif diff --git a/drivers/hwmon/adt7460.h b/drivers/hwmon/adt7460.h new file mode 100644 index 0000000..48666f7 --- /dev/null +++ b/drivers/hwmon/adt7460.h @@ -0,0 +1,49 @@ +/*
- (C) Copyright 2008
- Ricado Ribalda, Universidad Autonoma de Madrid, ricardo.ribalda<at>uam.es , ricardo.ribalda<at>gmail.com
- 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 3 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/.
+*/ +#ifndef ADT7460 +#define ADT7460
+#define ADT7460_INVALID 128
+#define ADT7460_2_5V 0x20 +#define ADT7460_VCCP 0x21 +#define ADT7460_VCC 0x22 +#define ADT7460_V5 0x23 +#define ADT7460_V12 0x24 +#define ADT7460_REM1_TEMP 0x25 +#define ADT7460_LOCAL_TEMP 0x26 +#define ADT7460_REM2_TEMP 0x27 +#define ADT7460_TACH1L 0x28 +#define ADT7460_TACH1H 0x29 +#define ADT7460_TACH2L 0x2a +#define ADT7460_TACH2H 0x2b +#define ADT7460_TACH3L 0x2c +#define ADT7460_TACH3H 0x2d +#define ADT7460_TACH4L 0x2e +#define ADT7460_TACH4H 0x2f +#define ADT7460_TACH5L 0xa9 +#define ADT7460_TACH5H 0xaa +#define ADT7460_TACH6L 0xab +#define ADT7460_TACH6H 0xac +#define ADT7460_REVISION 0x3f +#define ADT7460_CONFIG 0x40
+#endif diff --git a/include/dtt.h b/include/dtt.h index 4e8aaad..73d7547 100644 --- a/include/dtt.h +++ b/include/dtt.h @@ -32,7 +32,7 @@ defined(CONFIG_DTT_DS1775) || \ defined(CONFIG_DTT_LM81) || \ defined(CONFIG_DTT_ADM1021) || \
- defined(CONFIG_DTT_LM73)
- defined(CONFIG_DTT_LM73)||defined(CONFIG_DTT_ADT7460)
follow the same style
#define CONFIG_DTT /* We have a DTT */
participants (5)
-
Andre Schwarz
-
Jerry Van Baren
-
Michal Simek
-
Ricardo Ribalda Delgado
-
Wolfgang Denk