Skip to content

Commit c11a012

Browse files
jannaumarcan
authored andcommitted
nvme: t6022: Derive die from nvme_base address
For some reason the ans node for t602x devices has an empty "clock-gates" property. Use the MMIO address instead to determine on which die the device is. Fixes: 34f49a5 ("nvme: assume die 0 if clock-gates not set") Signed-off-by: Janne Grunau <[email protected]>
1 parent 7112506 commit c11a012

1 file changed

Lines changed: 7 additions & 7 deletions

File tree

src/nvme.c

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -302,19 +302,19 @@ bool nvme_init(void)
302302
return NULL;
303303
}
304304

305+
if (adt_get_reg(adt, adt_path, "reg", 3, &nvme_base, NULL) < 0) {
306+
printf("nvme: Error getting NVMe base address.\n");
307+
return NULL;
308+
}
305309
u32 cg;
306310
if (ADT_GETPROP(adt, node, "clock-gates", &cg) < 0) {
307311
printf("nvme: clock-gates not set\n");
308-
cg = 0;
312+
nvme_die = (nvme_base >> 37) & 3;
313+
} else {
314+
nvme_die = FIELD_GET(PMGR_DIE_ID, cg);
309315
}
310-
nvme_die = FIELD_GET(PMGR_DIE_ID, cg);
311316
printf("nvme: ANS is on die %d\n", nvme_die);
312317

313-
if (adt_get_reg(adt, adt_path, "reg", 3, &nvme_base, NULL) < 0) {
314-
printf("nvme: Error getting NVMe base address.\n");
315-
return NULL;
316-
}
317-
318318
if (!alloc_queue(&adminq)) {
319319
printf("nvme: Error allocating admin queue\n");
320320
return NULL;

0 commit comments

Comments
 (0)