Skip to contentSkip to conversation

x86: Fix RTC build error on ivybridge

PATCH New Bin Meng 3 participants 5 messages Jul 21, 2015 – Jul 22, 2015 x86

lore
Share & tools
lore

Bin Meng

author
#0 lore raw

PATCH 1/1 x86: Fix RTC build error on ivybridge

For some unknown reason, buildman does not report build error when building commit 06c4b7e. This commit is to correct the build error and needs to be squashed into commit 06c4b7e.

---

 arch/x86/cpu/ivybridge/lpc.c   |  1 -
 arch/x86/cpu/ivybridge/sdram.c | 32 ++++++++++++++++++++++++--------
 arch/x86/dts/rtc.dtsi          |  1 +
 3 files changed, 25 insertions(+), 9 deletions(-)
arch/x86/cpu/ivybridge/lpc.c +0 -1
index bc1a0f0..3efd3e8 100644
@@ -252,7 +252,6 @@ static void pch_rtc_init(pci_dev_t dev)
 	/* TODO: Handle power failure */
 	if (rtc_failed)
 		printf("RTC power failed\n");
-	rtc_init();
 }
 
 /* CougarPoint PCH Power Management init */
arch/x86/cpu/ivybridge/sdram.c +24 -8
index af907c5..7f3b13d 100644
@@ -128,6 +128,14 @@ static int get_mrc_entry(struct udevice **devp, struct fmap_entry *entry)
 static int read_seed_from_cmos(struct pei_data *pei_data)
 {
 	u16 c1, c2, checksum, seed_checksum;
+	struct udevice *dev;
+	int rcode = 0;
+
+	rcode = uclass_get_device(UCLASS_RTC, 0, &dev);
+	if (rcode) {
+		debug("Cannot find RTC: err=%d\n", rcode);
+		return -ENODEV;
+	}
 
 	/*
 	 * Read scrambler seeds from CMOS RAM. We don't want to store them in
@@ -135,11 +143,11 @@ static int read_seed_from_cmos(struct pei_data *pei_data)
 	 * the flash too much. So we store these in CMOS and the large MRC
 	 * data in SPI flash.
 	 */
-	pei_data->scrambler_seed = rtc_read32(CMOS_OFFSET_MRC_SEED);
+	rtc_read32(dev, CMOS_OFFSET_MRC_SEED, &pei_data->scrambler_seed);
 	debug("Read scrambler seed    0x%08x from CMOS 0x%02x\n",
 	      pei_data->scrambler_seed, CMOS_OFFSET_MRC_SEED);
 
-	pei_data->scrambler_seed_s3 = rtc_read32(CMOS_OFFSET_MRC_SEED_S3);
+	rtc_read32(dev, CMOS_OFFSET_MRC_SEED_S3, &pei_data->scrambler_seed_s3);
 	debug("Read S3 scrambler seed 0x%08x from CMOS 0x%02x\n",
 	      pei_data->scrambler_seed_s3, CMOS_OFFSET_MRC_SEED_S3);
 
@@ -150,8 +158,8 @@ static int read_seed_from_cmos(struct pei_data *pei_data)
 				 sizeof(u32));
 	checksum = add_ip_checksums(sizeof(u32), c1, c2);
 
-	seed_checksum = rtc_read8(CMOS_OFFSET_MRC_SEED_CHK);
-	seed_checksum |= rtc_read8(CMOS_OFFSET_MRC_SEED_CHK + 1) << 8;
+	seed_checksum = rtc_read8(dev, CMOS_OFFSET_MRC_SEED_CHK);
+	seed_checksum |= rtc_read8(dev, CMOS_OFFSET_MRC_SEED_CHK + 1) << 8;
 
 	if (checksum != seed_checksum) {
 		debug("%s: invalid seed checksum\n", __func__);
@@ -223,13 +231,21 @@ static int build_mrc_data(struct mrc_data_container **datap)
 static int write_seeds_to_cmos(struct pei_data *pei_data)
 {
 	u16 c1, c2, checksum;
+	struct udevice *dev;
+	int rcode = 0;
+
+	rcode = uclass_get_device(UCLASS_RTC, 0, &dev);
+	if (rcode) {
+		debug("Cannot find RTC: err=%d\n", rcode);
+		return -ENODEV;
+	}
 
 	/* Save the MRC seed values to CMOS */
-	rtc_write32(CMOS_OFFSET_MRC_SEED, pei_data->scrambler_seed);
+	rtc_write32(dev, CMOS_OFFSET_MRC_SEED, pei_data->scrambler_seed);
 	debug("Save scrambler seed    0x%08x to CMOS 0x%02x\n",
 	      pei_data->scrambler_seed, CMOS_OFFSET_MRC_SEED);
 
-	rtc_write32(CMOS_OFFSET_MRC_SEED_S3, pei_data->scrambler_seed_s3);
+	rtc_write32(dev, CMOS_OFFSET_MRC_SEED_S3, pei_data->scrambler_seed_s3);
 	debug("Save s3 scrambler seed 0x%08x to CMOS 0x%02x\n",
 	      pei_data->scrambler_seed_s3, CMOS_OFFSET_MRC_SEED_S3);
 
@@ -240,8 +256,8 @@ static int write_seeds_to_cmos(struct pei_data *pei_data)
 				 sizeof(u32));
 	checksum = add_ip_checksums(sizeof(u32), c1, c2);
 
-	rtc_write8(CMOS_OFFSET_MRC_SEED_CHK, checksum & 0xff);
-	rtc_write8(CMOS_OFFSET_MRC_SEED_CHK + 1, (checksum >> 8) & 0xff);
+	rtc_write8(dev, CMOS_OFFSET_MRC_SEED_CHK, checksum & 0xff);
+	rtc_write8(dev, CMOS_OFFSET_MRC_SEED_CHK + 1, (checksum >> 8) & 0xff);
 
 	return 0;
 }
arch/x86/dts/rtc.dtsi +1 -0
index 93dacd7..1797e04 100644
@@ -1,6 +1,7 @@
 / {
 	rtc {
 		compatible = "motorola,mc146818";
+		u-boot,dm-pre-reloc;
 		reg = <0x70 2>;
 	};
 };
Signature · 1 line
1.8.2.1
#1 lore raw

PATCH 1/1 x86: Fix RTC build error on ivybridge

Hello Bin,

Quoted 3 lines · Bin Meng

For some unknown reason, buildman does not report build error when building commit 06c4b7e. This commit is to correct the build error and needs to be squashed into commit 06c4b7e.

Which repository and branch contains this commit 06c4b7e? I cannot find it at all under u-boot/master.

Besides, fixes are not done by squashing commit.

Amicalement,

Signature · 1 line
Albert.
author
#2 lore raw

PATCH 1/1 x86: Fix RTC build error on ivybridge

Hi Albert,

Quoted 9 lines · Albert ARIBAUD

Hello Bin,

Quoted 3 lines · Bin Meng

For some unknown reason, buildman does not report build error when building commit 06c4b7e. This commit is to correct the build error and needs to be squashed into commit 06c4b7e.

Which repository and branch contains this commit 06c4b7e? I cannot find it at all under u-boot/master.

It is on the u-boot-x86/master.

Quoted 2 lines

Besides, fixes are not done by squashing commit.

Yep, I know that once something goes into mainline, it is not allowed to change any history. As this is on the u-boot-x86/master and Simon has not asked Tom to pull, I believe it is OK.

Regards,
Bin

#3 lore raw

PATCH 1/1 x86: Fix RTC build error on ivybridge

Hello Bin,

Quoted 7 lines · Bin Meng

Hi Albert,

Quoted 3 lines · Albert ARIBAUD

Hello Bin,

On Tue, 21 Jul 2015 00:55:13 -0700, Bin Meng <[email protected]> wrote:

Quoted 8 lines
Quoted 6 lines
Quoted 3 lines

For some unknown reason, buildman does not report build error when building commit 06c4b7e. This commit is to correct the build error and needs to be squashed into commit 06c4b7e.

Which repository and branch contains this commit 06c4b7e? I cannot find it at all under u-boot/master.

It is on the u-boot-x86/master.

Ok, thanks.

Quoted 6 lines
Quoted 2 lines

Besides, fixes are not done by squashing commit.

Yep, I know that once something goes into mainline, it is not allowed to change any history. As this is on the u-boot-x86/master and Simon has not asked Tom to pull, I believe it is OK.

Fine then.

Quoted 2 lines

Regards,
Bin

Amicalement,

Signature · 1 line
Albert.
#4 lore raw

PATCH 1/1 x86: Fix RTC build error on ivybridge

Hi Bin,

Quoted 13 lines · Albert ARIBAUD

Hello Bin,

Quoted 10 lines · Bin Meng

Hi Albert,

Quoted 6 lines · Albert ARIBAUD

Hello Bin,

Quoted 3 lines · Bin Meng

For some unknown reason, buildman does not report build error when building commit 06c4b7e. This commit is to correct the build error and needs to be squashed into commit 06c4b7e.

You can use -C to force a reconfigure after every build. Otherwise it defaults to an incremental build which will not reconfigure. It automatically reconfigures if it gets an error, but does not look for errors. This case is rare enough that I don't worry about it too much.

Quoted 15 lines
Quoted 5 lines
Quoted 3 lines

Which repository and branch contains this commit 06c4b7e? I cannot find it at all under u-boot/master.

It is on the u-boot-x86/master.

Ok, thanks.

Quoted 6 lines
Quoted 2 lines

Besides, fixes are not done by squashing commit.

Yep, I know that once something goes into mainline, it is not allowed to change any history. As this is on the u-boot-x86/master and Simon has not asked Tom to pull, I believe it is OK.

Quoted 8 lines

Fine then.

Quoted 2 lines

Regards,
Bin

Amicalement,
--
Albert.

Regards,
Simon