From ddea8baf47bfb99e1bcb8ad59ddbf542706bcab9 Mon Sep 17 00:00:00 2001 From: Janne Grunau Date: Mon, 11 Dec 2023 23:37:43 +0100 Subject: [PATCH] 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 --- src/nvme.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/nvme.c b/src/nvme.c index 30634cda0..a98353f19 100644 --- a/src/nvme.c +++ b/src/nvme.c @@ -302,19 +302,19 @@ bool nvme_init(void) return NULL; } + if (adt_get_reg(adt, adt_path, "reg", 3, &nvme_base, NULL) < 0) { + printf("nvme: Error getting NVMe base address.\n"); + return NULL; + } u32 cg; if (ADT_GETPROP(adt, node, "clock-gates", &cg) < 0) { printf("nvme: clock-gates not set\n"); - cg = 0; + nvme_die = (nvme_base >> 37) & 3; + } else { + nvme_die = FIELD_GET(PMGR_DIE_ID, cg); } - nvme_die = FIELD_GET(PMGR_DIE_ID, cg); printf("nvme: ANS is on die %d\n", nvme_die); - if (adt_get_reg(adt, adt_path, "reg", 3, &nvme_base, NULL) < 0) { - printf("nvme: Error getting NVMe base address.\n"); - return NULL; - } - if (!alloc_queue(&adminq)) { printf("nvme: Error allocating admin queue\n"); return NULL;