From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 91FDA4C97; Tue, 11 Nov 2025 00:58:56 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1762822736; cv=none; b=nZsV2BqTQm+yTIDs7ydHw/cgfWYf7hzfkruirWG9SEhwRObuJpInqAxNv+BMcf+tfwvFgamhlIBxx43XI21Ad0nsA38ZxQQE2oRw8L44JHbDHWRM4/caMmmh/mEyKat4ypRC5G0GhapOlU805ZztKVtrjD2PdFqwa5nK49hplaY= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1762822736; c=relaxed/simple; bh=eU+Sn1uNReDFnokonjkwcJ4ngYO06jwxC94K7NZ70w4=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=JIAvGVur8QNsugAUODWmzvQFI0eFP+a9krp7uSPGIVWQ+OdONZTv2+JoDp+dZS9mUPhCBmnLbu4Qjqsgbyyqqa3ZgPoBPyN4s1+aHdpjk59kgP/ajAUd1FBdI2FszCFRHXFmgjgYRKVPNnhgLM5NT0AJNXPacLwKVRkcJKd+xrw= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=xNRPHZgt; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="xNRPHZgt" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 20DFBC4CEFB; Tue, 11 Nov 2025 00:58:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1762822736; bh=eU+Sn1uNReDFnokonjkwcJ4ngYO06jwxC94K7NZ70w4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=xNRPHZgtWck97foA980/xNZKwuiBe5vD4FvkoBfdI5Wlr2d+hBDytDC0cwHleRiEH 89i9BT/hkuvYenSKVxcvNr11aq4UbYVHY2z5BC+xow2EvGBqclNgNDvvFLwTPCpn64 gOhdY5UaEeTj+LnsX+/IUcOWRxM/dngFapKGnF9Q= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Biju Das , Ulf Hansson , Sasha Levin Subject: [PATCH 6.12 095/565] mmc: host: renesas_sdhi: Fix the actual clock Date: Tue, 11 Nov 2025 09:39:11 +0900 Message-ID: <20251111004529.099191057@linuxfoundation.org> X-Mailer: git-send-email 2.51.2 In-Reply-To: <20251111004526.816196597@linuxfoundation.org> References: <20251111004526.816196597@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: patches@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.12-stable review patch. If anyone has any objections, please let me know. ------------------ From: Biju Das [ Upstream commit 9c174e4dacee9fb2014a4ffc953d79a5707b77e4 ] Wrong actual clock reported, if the SD clock division ratio is other than 1:1(bits DIV[7:0] in SD_CLK_CTRL are set to 11111111). On high speed mode, cat /sys/kernel/debug/mmc1/ios Without the patch: clock: 50000000 Hz actual clock: 200000000 Hz After the fix: clock: 50000000 Hz actual clock: 50000000 Hz Signed-off-by: Biju Das Link: https://lore.kernel.org/r/20250629203859.170850-1-biju.das.jz@bp.renesas.com Signed-off-by: Ulf Hansson Signed-off-by: Sasha Levin --- drivers/mmc/host/renesas_sdhi_core.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/drivers/mmc/host/renesas_sdhi_core.c b/drivers/mmc/host/renesas_sdhi_core.c index 6ebb3d1eeb4d6..73e9c50968e1d 100644 --- a/drivers/mmc/host/renesas_sdhi_core.c +++ b/drivers/mmc/host/renesas_sdhi_core.c @@ -220,7 +220,11 @@ static void renesas_sdhi_set_clock(struct tmio_mmc_host *host, clk &= ~0xff; } - sd_ctrl_write16(host, CTL_SD_CARD_CLK_CTL, clk & CLK_CTL_DIV_MASK); + clock = clk & CLK_CTL_DIV_MASK; + if (clock != 0xff) + host->mmc->actual_clock /= (1 << (ffs(clock) + 1)); + + sd_ctrl_write16(host, CTL_SD_CARD_CLK_CTL, clock); if (!(host->pdata->flags & TMIO_MMC_MIN_RCAR2)) usleep_range(10000, 11000); -- 2.51.0