-
Notifications
You must be signed in to change notification settings - Fork 981
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add patch to fix Kingston eMMC compatibility with ODROID-N2 #3619
Closed
Closed
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
56 changes: 56 additions & 0 deletions
56
.../hardkernel/patches/uboot/0002-mmc-meson-gx-use-xtal-as-clock-for-frequencies-24MHz.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
From 77ec70c4d73c772b7da0d007946f697f7d27a7a7 Mon Sep 17 00:00:00 2001 | ||
From: =?UTF-8?q?Jan=20=C4=8Cerm=C3=A1k?= <[email protected]> | ||
Date: Thu, 10 Oct 2024 19:06:24 +0200 | ||
Subject: [PATCH] mmc: meson-gx: use xtal as clock for frequencies <= 24MHz | ||
MIME-Version: 1.0 | ||
Content-Type: text/plain; charset=UTF-8 | ||
Content-Transfer-Encoding: 8bit | ||
|
||
The patch from Neil Armstrong that aims to fix stability on some eMMCs | ||
by capping the clock to 24 MHz has a nasty side effect that it breaks | ||
communication with some Kingston eMMCs. After the patch, the clock rates | ||
that are applied are not precisely 24 MHz but values that can correspond | ||
to the PLL divider applied to the 1G clock, which yields 23,809,523 Hz | ||
(divider 42) after the cap. | ||
|
||
Testing shows that setting this eMMC clock frequency, or 23,255,813 Hz | ||
(divider 43), always leads to mmc_select_mode_and_width() failing. For | ||
whatever reason, only these two values are problematic, setting it to | ||
use divider <42 or >43 (even after the cap is returned to 100M), the | ||
eMMC is probed correctly. It's not clear if clock quality is the issue | ||
or if there's some other reason why Kingston doesn't like these two | ||
values. However, by changing the clock source to xtal, we can achieve | ||
precise 24 MHz which seems to be fine for Kingston and the difference | ||
from the problematic frequencies is negligible, hopefully not affecting | ||
other eMMCs that were happy with the ~23.8M speed. Since all values from | ||
mmc_mode2freq were effectively set to 24M, no other speeds have been | ||
used with the previous patch. | ||
|
||
Ultimately, coming up with a proper fix for the issue with uncapped | ||
frequency would be the best, however, I am not able to reproduce it so | ||
going this way might be easier now. | ||
|
||
Signed-off-by: Jan Čermák <[email protected]> | ||
--- | ||
drivers/mmc/meson_gx_mmc.c | 8 ++++++-- | ||
1 file changed, 6 insertions(+), 2 deletions(-) | ||
|
||
diff --git a/drivers/mmc/meson_gx_mmc.c b/drivers/mmc/meson_gx_mmc.c | ||
index 6ded4b619b..88a80b2985 100644 | ||
--- a/drivers/mmc/meson_gx_mmc.c | ||
+++ b/drivers/mmc/meson_gx_mmc.c | ||
@@ -52,8 +52,12 @@ static void meson_mmc_config_clock(struct mmc *mmc) | ||
|
||
/* TOFIX This should use the proper clock taken from DT */ | ||
|
||
- /* 1GHz / CLK_MAX_DIV = 15,9 MHz */ | ||
- if (mmc->clock > 16000000) { | ||
+ /* | ||
+ * With f_max=24M, we almost always end up with 24M anyway and | ||
+ * granularity between 24M and 12M isn't needed, so try to use | ||
+ * xtal clock source directly. | ||
+ */ | ||
+ if (mmc->clock > SD_EMMC_CLKSRC_24M) { | ||
clk = SD_EMMC_CLKSRC_DIV2; | ||
clk_src = CLK_SRC_DIV2; | ||
} else { |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Incorrect commit date in the patch header
The commit date is set to October 10, 2024, which is in the future. This could cause issues with version control and should be corrected to the current date.
Please update the commit date to the current date:
📝 Committable suggestion