public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
* [U-Boot] [PATCH] powerpc/c29xpcie: Getting DDR SPD image from 16-bit sub-address EEPROM
@ 2013-08-21  6:26 Po Liu
  2013-09-20 19:03 ` York Sun
  2013-09-22  1:31 ` [U-Boot] [PATCH v2] " Po Liu
  0 siblings, 2 replies; 6+ messages in thread
From: Po Liu @ 2013-08-21  6:26 UTC (permalink / raw)
  To: u-boot

Currently, there is only one EEPROM on c29xpcie board which isAT24C1024.
We program the SPD data at beginning of the AT24C1024.But the AT24C1024
has a 16-bit sub-address mode. This patch is tomake it work when getting
SPD in a 16-bit sub-address EEPROM.

Signed-off-by: Po Liu <Po.Liu@freescale.com>
---
 board/freescale/c29xpcie/ddr.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/board/freescale/c29xpcie/ddr.c b/board/freescale/c29xpcie/ddr.c
index 3337d6c..28f1bd2 100644
--- a/board/freescale/c29xpcie/ddr.c
+++ b/board/freescale/c29xpcie/ddr.c
@@ -84,3 +84,15 @@ void fsl_ddr_board_options(memctl_options_t *popts,
 		popts->cs_local_opts[i].odt_wr_cfg = FSL_DDR_ODT_CS;
 	}
 }
+
+void get_spd(generic_spd_eeprom_t *spd, u8 i2c_address)
+{
+	int ret = i2c_read(i2c_address, 0, 2, (uchar *)spd,
+				sizeof(generic_spd_eeprom_t));
+
+	if (ret) {
+		printf("DDR: failed to read SPD from address %u\n",
+				i2c_address);
+		memset(spd, 0, sizeof(generic_spd_eeprom_t));
+	}
+}
-- 
1.8.0

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

* [U-Boot] [PATCH] powerpc/c29xpcie: Getting DDR SPD image from 16-bit sub-address EEPROM
  2013-08-21  6:26 [U-Boot] [PATCH] powerpc/c29xpcie: Getting DDR SPD image from 16-bit sub-address EEPROM Po Liu
@ 2013-09-20 19:03 ` York Sun
  2013-09-22  1:31 ` [U-Boot] [PATCH v2] " Po Liu
  1 sibling, 0 replies; 6+ messages in thread
From: York Sun @ 2013-09-20 19:03 UTC (permalink / raw)
  To: u-boot

On 08/20/2013 11:26 PM, Po Liu wrote:
> Currently, there is only one EEPROM on c29xpcie board which isAT24C1024.
> We program the SPD data at beginning of the AT24C1024.But the AT24C1024
> has a 16-bit sub-address mode. This patch is tomake it work when getting
> SPD in a 16-bit sub-address EEPROM.
> 
> Signed-off-by: Po Liu <Po.Liu@freescale.com>
> ---
>  board/freescale/c29xpcie/ddr.c | 12 ++++++++++++
>  1 file changed, 12 insertions(+)
> 
> diff --git a/board/freescale/c29xpcie/ddr.c b/board/freescale/c29xpcie/ddr.c
> index 3337d6c..28f1bd2 100644
> --- a/board/freescale/c29xpcie/ddr.c
> +++ b/board/freescale/c29xpcie/ddr.c
> @@ -84,3 +84,15 @@ void fsl_ddr_board_options(memctl_options_t *popts,
>  		popts->cs_local_opts[i].odt_wr_cfg = FSL_DDR_ODT_CS;
>  	}
>  }
> +
> +void get_spd(generic_spd_eeprom_t *spd, u8 i2c_address)
> +{
> +	int ret = i2c_read(i2c_address, 0, 2, (uchar *)spd,
> +				sizeof(generic_spd_eeprom_t));
> +
> +	if (ret) {
> +		printf("DDR: failed to read SPD from address %u\n",
> +				i2c_address);
> +		memset(spd, 0, sizeof(generic_spd_eeprom_t));
> +	}
> +}
> 

Please fix the compiling warning. You need to include i2c.h, per
internal review.

York

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

* [U-Boot] [PATCH v2] powerpc/c29xpcie: Getting DDR SPD image from 16-bit sub-address EEPROM
  2013-08-21  6:26 [U-Boot] [PATCH] powerpc/c29xpcie: Getting DDR SPD image from 16-bit sub-address EEPROM Po Liu
  2013-09-20 19:03 ` York Sun
@ 2013-09-22  1:31 ` Po Liu
  2013-09-22 12:55   ` Timur Tabi
  2013-11-26  6:34   ` [U-Boot] [PATCH v3] " Po Liu
  1 sibling, 2 replies; 6+ messages in thread
From: Po Liu @ 2013-09-22  1:31 UTC (permalink / raw)
  To: u-boot

Currently, there is only one EEPROM on c29xpcie board which isAT24C1024.
We program the SPD data at beginning of the AT24C1024.But the AT24C1024
has a 16-bit sub-address mode. This patch is tomake it work when getting
SPD in a 16-bit sub-address EEPROM.

Signed-off-by: Po Liu <Po.Liu@freescale.com>
---
Changes for V2:
	- add #include <i2c.h>

 board/freescale/c29xpcie/ddr.c | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/board/freescale/c29xpcie/ddr.c b/board/freescale/c29xpcie/ddr.c
index b017cfd..614944b 100644
--- a/board/freescale/c29xpcie/ddr.c
+++ b/board/freescale/c29xpcie/ddr.c
@@ -5,6 +5,7 @@
  */
 
 #include <common.h>
+#include <i2c.h>
 #include <asm/fsl_law.h>
 #include <asm/fsl_ddr_sdram.h>
 #include <asm/fsl_ddr_dimm_params.h>
@@ -84,3 +85,15 @@ void fsl_ddr_board_options(memctl_options_t *popts,
 		popts->cs_local_opts[i].odt_wr_cfg = FSL_DDR_ODT_CS;
 	}
 }
+
+void get_spd(generic_spd_eeprom_t *spd, u8 i2c_address)
+{
+	int ret = i2c_read(i2c_address, 0, 2, (uchar *)spd,
+				sizeof(generic_spd_eeprom_t));
+
+	if (ret) {
+		printf("DDR: failed to read SPD from address %u\n",
+				i2c_address);
+		memset(spd, 0, sizeof(generic_spd_eeprom_t));
+	}
+}
-- 
1.8.0

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

* [U-Boot] [PATCH v2] powerpc/c29xpcie: Getting DDR SPD image from 16-bit sub-address EEPROM
  2013-09-22  1:31 ` [U-Boot] [PATCH v2] " Po Liu
@ 2013-09-22 12:55   ` Timur Tabi
  2013-11-26  6:34   ` [U-Boot] [PATCH v3] " Po Liu
  1 sibling, 0 replies; 6+ messages in thread
From: Timur Tabi @ 2013-09-22 12:55 UTC (permalink / raw)
  To: u-boot

On Sat, Sep 21, 2013 at 8:31 PM, Po Liu <Po.Liu@freescale.com> wrote:

> +void get_spd(generic_spd_eeprom_t *spd, u8 i2c_address)
> +{
> +       int ret = i2c_read(i2c_address, 0, 2, (uchar *)spd,

(uchar) is wrong.

int i2c_read(uint8_t chip, unsigned int addr, int alen,
                                 uint8_t *buffer, int len);

The type for this parameter is uint8_t.

The proper fix is to change the i2c_read() function should be changed
to take a void*.

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

* [U-Boot] [PATCH v3] powerpc/c29xpcie: Getting DDR SPD image from 16-bit sub-address EEPROM
  2013-09-22  1:31 ` [U-Boot] [PATCH v2] " Po Liu
  2013-09-22 12:55   ` Timur Tabi
@ 2013-11-26  6:34   ` Po Liu
  2013-12-04 23:39     ` York Sun
  1 sibling, 1 reply; 6+ messages in thread
From: Po Liu @ 2013-11-26  6:34 UTC (permalink / raw)
  To: u-boot

Currently, there is only one EEPROM on c29xpcie board which is AT24C1024.
We program the SPD data at beginning of the AT24C1024.But the AT24C1024
has a 16-bit sub-address mode. This patch is tomake it work when getting
SPD in a 16-bit sub-address EEPROM.

Signed-off-by: Po Liu <Po.Liu@freescale.com>
---
Changes for V2:
	- add #include <i2c.h>
Changes for V3:
	- change spd type to uint8_t according to the define

 board/freescale/c29xpcie/ddr.c | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/board/freescale/c29xpcie/ddr.c b/board/freescale/c29xpcie/ddr.c
index 57a9b61..ff7989a 100644
--- a/board/freescale/c29xpcie/ddr.c
+++ b/board/freescale/c29xpcie/ddr.c
@@ -5,6 +5,7 @@
  */
 
 #include <common.h>
+#include <i2c.h>
 #include <asm/fsl_law.h>
 #include <asm/fsl_ddr_sdram.h>
 #include <asm/fsl_ddr_dimm_params.h>
@@ -92,3 +93,15 @@ void fsl_ddr_board_options(memctl_options_t *popts,
 		popts->cs_local_opts[i].odt_wr_cfg = FSL_DDR_ODT_CS;
 	}
 }
+
+void get_spd(generic_spd_eeprom_t *spd, u8 i2c_address)
+{
+	int ret = i2c_read(i2c_address, 0, 2, (uint8_t *)spd,
+				sizeof(generic_spd_eeprom_t));
+
+	if (ret) {
+		printf("DDR: failed to read SPD from address %u\n",
+				i2c_address);
+		memset(spd, 0, sizeof(generic_spd_eeprom_t));
+	}
+}
-- 
1.8.0

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

* [U-Boot] [PATCH v3] powerpc/c29xpcie: Getting DDR SPD image from 16-bit sub-address EEPROM
  2013-11-26  6:34   ` [U-Boot] [PATCH v3] " Po Liu
@ 2013-12-04 23:39     ` York Sun
  0 siblings, 0 replies; 6+ messages in thread
From: York Sun @ 2013-12-04 23:39 UTC (permalink / raw)
  To: u-boot

On 11/25/2013 10:34 PM, Po Liu wrote:
> Currently, there is only one EEPROM on c29xpcie board which is AT24C1024.
> We program the SPD data at beginning of the AT24C1024.But the AT24C1024
> has a 16-bit sub-address mode. This patch is tomake it work when getting
> SPD in a 16-bit sub-address EEPROM.
> 
> Signed-off-by: Po Liu <Po.Liu@freescale.com>
> ---
> Changes for V2:
> 	- add #include <i2c.h>
> Changes for V3:
> 	- change spd type to uint8_t according to the define

Applied to u-boot-mpc85xx/master. Thanks.

York

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

end of thread, other threads:[~2013-12-04 23:39 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-08-21  6:26 [U-Boot] [PATCH] powerpc/c29xpcie: Getting DDR SPD image from 16-bit sub-address EEPROM Po Liu
2013-09-20 19:03 ` York Sun
2013-09-22  1:31 ` [U-Boot] [PATCH v2] " Po Liu
2013-09-22 12:55   ` Timur Tabi
2013-11-26  6:34   ` [U-Boot] [PATCH v3] " Po Liu
2013-12-04 23:39     ` York Sun

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox