From patchwork Fri Sep 6 10:20:37 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Victor Shih X-Patchwork-Id: 826166 Received: from mail-pf1-f172.google.com (mail-pf1-f172.google.com [209.85.210.172]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 74B0D1CC163; Fri, 6 Sep 2024 10:21:41 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.172 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1725618102; cv=none; b=dVUMlyp2NOxUJx8Dg018XjVgSofVmMUYWD30OlQSiW7/N2jFOVudmCX/xRu6W/HzxFYWpKlLGRszD20Jc5WJI718D7Q9gfNee1/6zVFY9pjiUBP2RImB6KwKu4wNOjiLZPpjIAsss58QC9hz0VES2qW5AgBQw8/VHbp8gKbWieM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1725618102; c=relaxed/simple; bh=SFCAPMYUToX959hW0aIShZQqJGkxYWPyMu4KNnD8Hbw=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=qIkL3nT1sYbR2x91ZQa2nV464qWkqyXqkrXC4Sf2dXyJb5zne3G7sqEjI2rZCe2LqmrCUX6yMKHRxK4zuqj498kGF9ZGojU9HN+zrS8V9U4rupOvqe0lNsI2ikDOnaqQGJTvLnuXla3fR9q5WrxMm4jqotXwoBTgywAXtoP4jy4= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=AHvCLb1j; arc=none smtp.client-ip=209.85.210.172 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="AHvCLb1j" Received: by mail-pf1-f172.google.com with SMTP id d2e1a72fcca58-71767ef16b3so1176772b3a.0; Fri, 06 Sep 2024 03:21:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1725618101; x=1726222901; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=HaGkQPCGzuVUjaXJrxV+hmji/yjfP4ceyoxn5sAqRnc=; b=AHvCLb1jUbUlrFhfqWgMM81stbETgiyFXeBWFCBaDKVST1Tr79CmWSJ8Y8Z5JpYtUV SPnNfswssi/y2P/yahG6l3wwAutMgVL1EIGilfidPU+8mmv0dfOoSG3049KUtD/WCzVm eO8h5EhIUhrXKa4JtlCVWaUalD84uHnuj6041RNUqxCg3M2du70iFSzAhIPqz+BUKJVN uG7wbAYHaoH0yA8iNv+ko1TuVI16aR/xKtdqQoPMLP1CspKO2MxmU+wXEapdJoNcZYl8 +Ng2p1xp5NxOE/gXay/RuS20pRNjVTCbBb5TAyCrFUVIfm2n0Wip+jn6gUL/GAPmq2Ha dBtA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1725618101; x=1726222901; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=HaGkQPCGzuVUjaXJrxV+hmji/yjfP4ceyoxn5sAqRnc=; b=maXiILjqupbm2cANlvKx/QL8/NkOAlDgDoh2URPGBRdPRfS+dSuVQq4E0rBGNs7XAj 6p6bYggDrNprfF7ZgCFsk/YT/NSKZQU5ocDLRIPTdn8i6/7Pm6buHtlIoEsgXbatZX+Z W96SJaB/ZluE7ZC9ZHlEhKnFB+M+iqbvF06dVIu/hCutzgdWJYbgkxP0ngljs7I1Nmvy JE34XUDqWN3ovldhWmcbGhuVRsmPOMpqogycrbd9yEKHy3ZW+FHQQfda3jqb3Ndrm2P5 JZ0anSzgZtFkegNeh6VY3bkr8+1xxOhE/3WS5G9QF9cM15sNW2ULj8WFVCfPRsh0V5+t bzeA== X-Forwarded-Encrypted: i=1; AJvYcCWhWalZJ0D7uyi/klmHmXRRfN4CkiG8l9FaW4+7P+RT83HP9+O4mulPh/X28sYUfASaD1tL+b+Y5ufzzMI=@vger.kernel.org X-Gm-Message-State: AOJu0YyrVKNFXE2ZMoYKE6uqHkE7/UWP317QyyRdTlCX2xqBujV3UJ0k s3N1ePAobJq3bZEjb3SmwBbiMxtjmYp6ay/LYhqaWc+8OkTNe/tf X-Google-Smtp-Source: AGHT+IEtjU+WrJQIH+eWxKgS5twtquF2P9srXSd5FKKg5VHnceSS/w5gyPBJoSzr1SiEiFtE360PXg== X-Received: by 2002:a05:6a00:2193:b0:714:1c0e:1336 with SMTP id d2e1a72fcca58-718d5df08c4mr2415929b3a.4.1725618100707; Fri, 06 Sep 2024 03:21:40 -0700 (PDT) Received: from localhost.localdomain ([2402:7500:569:244d:5f74:48c1:9f66:fb02]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-717931fca8csm2072611b3a.139.2024.09.06.03.21.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 06 Sep 2024 03:21:40 -0700 (PDT) From: Victor Shih To: ulf.hansson@linaro.org, adrian.hunter@intel.com Cc: linux-mmc@vger.kernel.org, linux-kernel@vger.kernel.org, benchuanggli@gmail.com, Lucas.Lai@genesyslogic.com.tw, HL.Liu@genesyslogic.com.tw, Greg.tu@genesyslogic.com.tw, dlunev@chromium.org, Victor Shih , Ben Chuang , AKASHI Takahiro , Victor Shih Subject: [PATCH V21 10/22] mmc: sdhci-uhs2: dump UHS-II registers Date: Fri, 6 Sep 2024 18:20:37 +0800 Message-Id: <20240906102049.7059-11-victorshihgli@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20240906102049.7059-1-victorshihgli@gmail.com> References: <20240906102049.7059-1-victorshihgli@gmail.com> Precedence: bulk X-Mailing-List: linux-mmc@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 From: Victor Shih Dump UHS-II specific registers, if available, in sdhci_dumpregs() for informative/debugging use. Signed-off-by: Ben Chuang Signed-off-by: AKASHI Takahiro Signed-off-by: Victor Shih --- Updates in V14: - Use mmc_card_uhs2() to stead sdhci_uhs2_mode() in the sdhci_uhs2_dump_regs(). Updates in V7: - Use sdhci_uhs2_mode() to simplify code. Updates in V6: - Remove unnecessary code. --- drivers/mmc/host/sdhci-uhs2.c | 30 ++++++++++++++++++++++++++++++ drivers/mmc/host/sdhci-uhs2.h | 4 ++++ drivers/mmc/host/sdhci.c | 3 +++ drivers/mmc/host/sdhci.h | 1 + 4 files changed, 38 insertions(+) diff --git a/drivers/mmc/host/sdhci-uhs2.c b/drivers/mmc/host/sdhci-uhs2.c index 608f8ad5aaed..9cb0f1b2a37d 100644 --- a/drivers/mmc/host/sdhci-uhs2.c +++ b/drivers/mmc/host/sdhci-uhs2.c @@ -18,6 +18,36 @@ #define DRIVER_NAME "sdhci_uhs2" #define DBG(f, x...) \ pr_debug(DRIVER_NAME " [%s()]: " f, __func__, ## x) +#define SDHCI_UHS2_DUMP(f, x...) \ + pr_err("%s: " DRIVER_NAME ": " f, mmc_hostname(host->mmc), ## x) + +void sdhci_uhs2_dump_regs(struct sdhci_host *host) +{ + if (!(mmc_card_uhs2(host->mmc))) + return; + + SDHCI_UHS2_DUMP("==================== UHS2 ==================\n"); + SDHCI_UHS2_DUMP("Blk Size: 0x%08x | Blk Cnt: 0x%08x\n", + sdhci_readw(host, SDHCI_UHS2_BLOCK_SIZE), + sdhci_readl(host, SDHCI_UHS2_BLOCK_COUNT)); + SDHCI_UHS2_DUMP("Cmd: 0x%08x | Trn mode: 0x%08x\n", + sdhci_readw(host, SDHCI_UHS2_CMD), + sdhci_readw(host, SDHCI_UHS2_TRANS_MODE)); + SDHCI_UHS2_DUMP("Int Stat: 0x%08x | Dev Sel : 0x%08x\n", + sdhci_readw(host, SDHCI_UHS2_DEV_INT_STATUS), + sdhci_readb(host, SDHCI_UHS2_DEV_SELECT)); + SDHCI_UHS2_DUMP("Dev Int Code: 0x%08x\n", + sdhci_readb(host, SDHCI_UHS2_DEV_INT_CODE)); + SDHCI_UHS2_DUMP("Reset: 0x%08x | Timer: 0x%08x\n", + sdhci_readw(host, SDHCI_UHS2_SW_RESET), + sdhci_readw(host, SDHCI_UHS2_TIMER_CTRL)); + SDHCI_UHS2_DUMP("ErrInt: 0x%08x | ErrIntEn: 0x%08x\n", + sdhci_readl(host, SDHCI_UHS2_INT_STATUS), + sdhci_readl(host, SDHCI_UHS2_INT_STATUS_ENABLE)); + SDHCI_UHS2_DUMP("ErrSigEn: 0x%08x\n", + sdhci_readl(host, SDHCI_UHS2_INT_SIGNAL_ENABLE)); +} +EXPORT_SYMBOL_GPL(sdhci_uhs2_dump_regs); /*****************************************************************************\ * * diff --git a/drivers/mmc/host/sdhci-uhs2.h b/drivers/mmc/host/sdhci-uhs2.h index e993f41ffb7f..2bfe18d29bca 100644 --- a/drivers/mmc/host/sdhci-uhs2.h +++ b/drivers/mmc/host/sdhci-uhs2.h @@ -174,4 +174,8 @@ #define SDHCI_UHS2_EMBED_CTRL_PTR 0xE6 #define SDHCI_UHS2_VENDOR_PTR 0xE8 +struct sdhci_host; + +void sdhci_uhs2_dump_regs(struct sdhci_host *host); + #endif /* __SDHCI_UHS2_H */ diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c index 4b91c9e96635..5a5fe3528bb4 100644 --- a/drivers/mmc/host/sdhci.c +++ b/drivers/mmc/host/sdhci.c @@ -110,6 +110,9 @@ void sdhci_dumpregs(struct sdhci_host *host) } } + if (host->ops->dump_uhs2_regs) + host->ops->dump_uhs2_regs(host); + if (host->ops->dump_vendor_regs) host->ops->dump_vendor_regs(host); diff --git a/drivers/mmc/host/sdhci.h b/drivers/mmc/host/sdhci.h index e1013925e91e..66ab90bd4017 100644 --- a/drivers/mmc/host/sdhci.h +++ b/drivers/mmc/host/sdhci.h @@ -719,6 +719,7 @@ struct sdhci_ops { void (*request_done)(struct sdhci_host *host, struct mmc_request *mrq); void (*dump_vendor_regs)(struct sdhci_host *host); + void (*dump_uhs2_regs)(struct sdhci_host *host); }; #ifdef CONFIG_MMC_SDHCI_IO_ACCESSORS