-
-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
soc/power9/istep_9_7.c: XBus link training validation
Change-Id: Idbb17e19ec3f36e7f7e64e7d90a27f8ea9e0fe95 Signed-off-by: Sergii Dmytruk <[email protected]>
- Loading branch information
1 parent
45436cd
commit bd2c55d
Showing
4 changed files
with
97 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,94 @@ | ||
/* SPDX-License-Identifier: GPL-2.0-only */ | ||
|
||
#include <cpu/power/istep_9.h> | ||
|
||
#include <console/console.h> | ||
#include <cpu/power/scom.h> | ||
#include <delay.h> | ||
#include <stdbool.h> | ||
|
||
#include "xbus.h" | ||
|
||
static void p9_fab_iovalid_link_validate(uint8_t chip) | ||
{ | ||
enum { | ||
XBUS_1_LL1_IOEL_FIR_REG = 0x06011C00, | ||
DL_FIR_LINK0_TRAINED_BIT = 0, | ||
DL_FIR_LINK1_TRAINED_BIT = 1, | ||
}; | ||
|
||
int i; | ||
|
||
for (i = 0; i < 100; ++i) { | ||
/* Only OBus seems to be retrained, so this XBus-only code is | ||
* much simpler compared to corresponding code in Hostboot's */ | ||
|
||
uint64_t dl_fir_reg = get_scom(chip, XBUS_1_LL1_IOEL_FIR_REG); | ||
|
||
bool dl_trained = (dl_fir_reg & PPC_BIT(DL_FIR_LINK0_TRAINED_BIT)) | ||
&& (dl_fir_reg & PPC_BIT(DL_FIR_LINK1_TRAINED_BIT)); | ||
if (dl_trained) | ||
break; | ||
|
||
udelay(1 * 1000); // 1ms | ||
} | ||
|
||
if (i == 100) | ||
die("XBus link DL training failed\n"); | ||
} | ||
|
||
static void p9_fab_iovalid(uint8_t chip) | ||
{ | ||
enum { | ||
PERV_XB_CPLT_CONF1_OR = 0x06000019, | ||
PERV_1_CPLT_CONF1_IOVALID_6D = 6, | ||
|
||
PU_PB_CENT_SM0_PB_CENT_FIR_REG = 0x05011C00, | ||
PU_PB_CENT_SM0_PB_CENT_FIR_MASK_REG_SPARE_13 = 13, | ||
|
||
PU_PB_CENT_SM1_EXTFIR_ACTION0_REG = 0x05011C34, | ||
PU_PB_CENT_SM1_EXTFIR_ACTION1_REG = 0x05011C35, | ||
|
||
PU_PB_CENT_SM1_EXTFIR_MASK_REG_AND = 0x05011C32, | ||
}; | ||
|
||
uint64_t fbc_cent_fir_data; | ||
|
||
/* Add delay for DD1.1+ procedure to compensate for lack of lane lock | ||
* polls */ | ||
udelay(100 * 1000); // 100ms | ||
|
||
p9_fab_iovalid_link_validate(chip); | ||
|
||
/* Clear RAS FIR mask for link if not already set up by SBE */ | ||
fbc_cent_fir_data = get_scom(chip, PU_PB_CENT_SM0_PB_CENT_FIR_REG); | ||
if (!(fbc_cent_fir_data & PPC_BIT(PU_PB_CENT_SM0_PB_CENT_FIR_MASK_REG_SPARE_13))) { | ||
and_scom(chip, PU_PB_CENT_SM1_EXTFIR_ACTION0_REG, | ||
~PPC_BIT(PERV_1_CPLT_CONF1_IOVALID_6D)); | ||
and_scom(chip, PU_PB_CENT_SM1_EXTFIR_ACTION1_REG, | ||
~PPC_BIT(PERV_1_CPLT_CONF1_IOVALID_6D)); | ||
put_scom(chip, PU_PB_CENT_SM1_EXTFIR_MASK_REG_AND, | ||
~PPC_BIT(PERV_1_CPLT_CONF1_IOVALID_6D)); | ||
} | ||
|
||
/* | ||
* Use AND/OR mask registers to atomically update link specific fields | ||
* in iovalid control register. | ||
*/ | ||
put_scom(chip, PERV_XB_CPLT_CONF1_OR, | ||
PPC_BIT(PERV_1_CPLT_CONF1_IOVALID_6D) | | ||
PPC_BIT(PERV_1_CPLT_CONF1_IOVALID_6D + 1)); | ||
} | ||
|
||
void istep_9_7(uint8_t chips) | ||
{ | ||
printk(BIOS_EMERG, "starting istep 9.7\n"); | ||
report_istep(9,7); | ||
|
||
if (chips != 0x01) { | ||
p9_fab_iovalid(/*chip=*/0); | ||
p9_fab_iovalid(/*chip=*/1); | ||
} | ||
|
||
printk(BIOS_EMERG, "ending istep 9.7\n"); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters