Skip to content

Commit e116d3e

Browse files
teikhengtienfong
authored andcommitted
HSD #15014505415: ddr: altera: iossm: Poll emif ready signal for second port
Poll emif ready signal for second port when dual port is set Signed-off-by: Teik Heng Chong <[email protected]>
1 parent df1d63e commit e116d3e

File tree

4 files changed

+35
-14
lines changed

4 files changed

+35
-14
lines changed

drivers/ddr/altera/iossm_mailbox.c

Lines changed: 20 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ static const char *ddr_type_list[7] = {
2121
"DDR4", "DDR5", "DDR5_RDIMM", "LPDDR4", "LPDDR5", "QDRIV", "UNKNOWN"
2222
};
2323

24-
static int is_ddr_csr_clkgen_locked(u32 clkgen_mask)
24+
static int is_ddr_csr_clkgen_locked(u32 clkgen_mask, u8 num_port)
2525
{
2626
int ret;
2727

@@ -33,12 +33,14 @@ static int is_ddr_csr_clkgen_locked(u32 clkgen_mask)
3333
return ret;
3434
}
3535

36-
ret = wait_for_bit_le32((const void *)(ECC_INISTATUS_DERR)
37-
, clkgen_mask, true, TIMEOUT, false);
36+
if (num_port == 3) {
37+
ret = wait_for_bit_le32((const void *)(ECC_INISTATUS_DERR)
38+
, clkgen_mask, true, TIMEOUT, false);
3839

39-
if (ret) {
40-
debug("%s: ddr csr clkgenb locked is timeout\n", __func__);
41-
return ret;
40+
if (ret) {
41+
debug("%s: ddr csr clkgenb locked is timeout\n", __func__);
42+
return ret;
43+
}
4244
}
4345

4446
return 0;
@@ -308,10 +310,12 @@ void init_mem_cal(struct io96b_info *io96b_ctrl)
308310
for (i = 0; i < io96b_ctrl->num_instance; i++) {
309311
switch (i) {
310312
case 0:
311-
ret = is_ddr_csr_clkgen_locked(DDR_CSR_CLKGEN_LOCKED_IO96B0_MASK);
312-
if (ret) {
313-
printf("%s: ckgena_lock iossm IO96B_0 is not locked\n", __func__);
314-
hang();
313+
if(io96b_ctrl->ckgen_lock) {
314+
ret = is_ddr_csr_clkgen_locked(DDR_CSR_CLKGEN_LOCKED_IO96B0_MASK, io96b_ctrl->num_port);
315+
if (ret) {
316+
printf("%s: ckgena_lock iossm IO96B_0 is not locked\n", __func__);
317+
hang();
318+
}
315319
}
316320
ret = io96b_cal_status(io96b_ctrl->io96b_0.io96b_csr_addr);
317321
if (ret) {
@@ -325,10 +329,12 @@ void init_mem_cal(struct io96b_info *io96b_ctrl)
325329
count++;
326330
break;
327331
case 1:
328-
ret = is_ddr_csr_clkgen_locked(DDR_CSR_CLKGEN_LOCKED_IO96B1_MASK);
329-
if (ret) {
330-
printf("%s: ckgena_lock iossm IO96B_1 is not locked\n", __func__);
331-
hang();
332+
if(io96b_ctrl->ckgen_lock) {
333+
ret = is_ddr_csr_clkgen_locked(DDR_CSR_CLKGEN_LOCKED_IO96B1_MASK, io96b_ctrl->num_port);
334+
if (ret) {
335+
printf("%s: ckgena_lock iossm IO96B_1 is not locked\n", __func__);
336+
hang();
337+
}
332338
}
333339
ret = io96b_cal_status(io96b_ctrl->io96b_1.io96b_csr_addr);
334340
if (ret) {

drivers/ddr/altera/iossm_mailbox.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,8 @@ struct io96b_instance {
113113
* @overall_size: Total DDR memory size
114114
* @io96b_0: IO96B 0 instance specific information
115115
* @io96b_1: IO96B 1 instance specific information
116+
* @ckgen_lock: IO96B GEN PLL lock (false = not locked, true = locked)
117+
* @num_port: Number of IO96B port. Example bit 0 represent port 0, bit 1 represent port 1, and so on
116118
*/
117119
struct io96b_info {
118120
u8 num_instance;
@@ -122,6 +124,8 @@ struct io96b_info {
122124
u16 overall_size;
123125
struct io96b_instance io96b_0;
124126
struct io96b_instance io96b_1;
127+
bool ckgen_lock;
128+
u8 num_port;
125129
};
126130

127131
int io96b_mb_req(phys_addr_t io96b_csr_addr, u32 ip_type, u32 instance_id

drivers/ddr/altera/sdram_agilex5.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,11 @@ int populate_ddr_handoff(struct udevice *dev, struct io96b_info *io96b_ctrl)
9898
plat->dualport = handoff_table[0] & BIT(0);
9999
debug("%s: dualport from handoff: 0x%x\n", __func__, plat->dualport);
100100

101+
if (plat->dualport)
102+
io96b_ctrl->num_port = 3;
103+
else
104+
io96b_ctrl->num_port = 1;
105+
101106
/* Read handoff - dual EMIF */
102107
plat->dualemif = handoff_table[0] & BIT(1);
103108
debug("%s: dualemif from handoff: 0x%x\n", __func__, plat->dualemif);
@@ -212,6 +217,9 @@ int sdram_mmr_init_full(struct udevice *dev)
212217
return ret;
213218
}
214219

220+
/* Configure if polling is needed for IO96B GEN PLL locked */
221+
io96b_ctrl->ckgen_lock = true;
222+
215223
/* Ensure calibration status passing */
216224
init_mem_cal(io96b_ctrl);
217225

drivers/ddr/altera/sdram_agilex7.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -235,6 +235,9 @@ int sdram_mmr_init_full(struct udevice *dev)
235235

236236
printf("DDR: Checking calibration...\n");
237237

238+
/* Configure if polling is needed for IO96B GEN PLL locked */
239+
io96b_ctrl->ckgen_lock = false;
240+
238241
/* Ensure calibration status passing */
239242
init_mem_cal(io96b_ctrl);
240243

0 commit comments

Comments
 (0)