pmos/device/testing/linux-samsung-i927/0005-mmc-core-Add-a-quirk-for-NVIDIA-Tegra-EMMC.patch
Oliver Smith 64035ac463
device/*: move to device/testing/* ()
Prepare for better device categorization by moving everything to testing
subdir first.

[skip-ci]: chicken-egg problem: passing pmaports CI depends on pmbootstrap MR
				depends on this MR

Related: postmarketos#16
2020-03-14 08:35:32 +01:00

39 lines
1.4 KiB
Diff

From 5a3ef17a66c43fc996d77d90f68f25af221c9b40 Mon Sep 17 00:00:00 2001
From: Dmitry Osipenko <digetx@gmail.com>
Date: Tue, 6 Oct 2015 19:27:48 +0300
Subject: [PATCH] mmc: core: Add a quirk for NVIDIA Tegra EMMC
Signed-off-by: Dmitry Osipenko <digetx@gmail.com>
(cherry picked from commit ab6cd574c16380931529501c367ae50a3ee96b3e)
Signed-off-by: Sergey Larin <cerg2010cerg2010@mail.ru>
---
drivers/mmc/core/mmc.c | 11 ++++++++++-
1 file changed, 10 insertions(+), 1 deletion(-)
diff --git a/drivers/mmc/core/mmc.c b/drivers/mmc/core/mmc.c
index c8804895595f..d4c5592aa22b 100644
--- a/drivers/mmc/core/mmc.c
+++ b/drivers/mmc/core/mmc.c
@@ -405,8 +405,17 @@ static int mmc_decode_ext_csd(struct mmc_card *card, u8 *ext_csd)
ext_csd[EXT_CSD_SEC_CNT + 3] << 24;
/* Cards with density > 2GiB are sector addressed */
- if (card->ext_csd.sectors > (2u * 1024 * 1024 * 1024) / 512)
+ if (card->ext_csd.sectors > (2u * 1024 * 1024 * 1024) / 512) {
+ if (card->host->caps & MMC_CAP_NONREMOVABLE) {
+ /*
+ * Size is in 256K chunks, i.e. 512 sectors each.
+ * This algorithm is defined and used by NVIDIA,
+ * according to eMMC 4.41, size is in 128K chunks.
+ */
+ card->ext_csd.sectors -= ext_csd[EXT_CSD_BOOT_MULT] * 512;
+ }
mmc_card_set_blockaddr(card);
+ }
}
card->ext_csd.strobe_support = ext_csd[EXT_CSD_STROBE_SUPPORT];
--
2.22.0