powerpc/c29xpcie: Getting DDR SPD image from 16-bit sub-address EEPROM
PATCH 1/1 powerpc/c29xpcie: Getting DDR SPD image from 16-bit sub-address EEPROM
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.
--- board/freescale/c29xpcie/ddr.c | 12 ++++++++++++ 1 file changed, 12 insertions(+)
board/freescale/c29xpcie/ddr.c +12 -0
@@ -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)); + } +}
Signature · 1 line
1.8.0
PATCH 1/1 powerpc/c29xpcie: Getting DDR SPD image from 16-bit sub-address EEPROM
Quoted 21 lines · Po Liu
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 <[email protected]>--- board/freescale/c29xpcie/ddr.c | 12 ++++++++++++ 1 file changed, 12 insertions(+)board/freescale/c29xpcie/ddr.c +2
-0@@ -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)
board/freescale/c29xpcie/ddr.c void fsl_ddr_board_options(memctl_options_t *popts, · line 98
Quoted 10 lines
board/freescale/c29xpcie/ddr.c +10
-0+{ +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
PATCH v2 1/1 powerpc/c29xpcie: Getting DDR SPD image from 16-bit sub-address EEPROM
In reply to Po LiuCurrently, 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.
---
Changes for V2:
- add #include <i2c.h>
board/freescale/c29xpcie/ddr.c | 13 +++++++++++++ 1 file changed, 13 insertions(+)
board/freescale/c29xpcie/ddr.c +13 -0
@@ -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)); + } +}
Signature · 1 line
1.8.0
PATCH v2 1/1 powerpc/c29xpcie: Getting DDR SPD image from 16-bit sub-address EEPROM
board/freescale/c29xpcie/ddr.c void fsl_ddr_board_options(memctl_options_t *popts, · line 91
Quoted 3 lines · Po Liu
board/freescale/c29xpcie/ddr.c +3
-0+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*.
PATCH v3 1/1 powerpc/c29xpcie: Getting DDR SPD image from 16-bit sub-address EEPROM
In reply to Po LiuCurrently, 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.
---
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(+)
board/freescale/c29xpcie/ddr.c +13 -0
@@ -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)); + } +}
Signature · 1 line
1.8.0
PATCH v3 1/1 powerpc/c29xpcie: Getting DDR SPD image from 16-bit sub-address EEPROM
Quoted 11 lines · Po Liu
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 <[email protected]>---
Changes for V2:
- add #include <i2c.h>
Changes for V3:
- change spd type touint8_taccording to the define
Applied to u-boot-mpc85xx/master. Thanks.
York