public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Po Liu <Po.Liu@freescale.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH v3] powerpc/c29xpcie: Getting DDR SPD image from 16-bit sub-address EEPROM
Date: Tue, 26 Nov 2013 14:34:07 +0800	[thread overview]
Message-ID: <1385447647-1597-1-git-send-email-Po.Liu@freescale.com> (raw)
In-Reply-To: <1379813507-26800-1-git-send-email-Po.Liu@freescale.com>

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

  parent reply	other threads:[~2013-11-26  6:34 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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   ` Po Liu [this message]
2013-12-04 23:39     ` [U-Boot] [PATCH v3] " York Sun

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1385447647-1597-1-git-send-email-Po.Liu@freescale.com \
    --to=po.liu@freescale.com \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox