MMC core:
- Add SD card quirk for broken discard MMC host: - renesas_sdhi: Fix clock rounding errors - sdhci-sprd: Fix minimum clock limit to detect cards - sdhci-tegra: Use actual clock rate for SW tuning correction -----BEGIN PGP SIGNATURE----- iQJLBAABCgA1FiEEugLDXPmKSktSkQsV/iaEJXNYjCkFAmNIHAsXHHVsZi5oYW5z c29uQGxpbmFyby5vcmcACgkQ/iaEJXNYjCk0rg//SO+Tcm/w8kdxPbXLzKMzr+WW fBeYIUsju1rd/qxWkiOol3yqeYYTBJy4q2/KWamghb0/actOFfhtl1Fthprewe7O G75s2jZcRJsTgqke03a8ON+qwmM8AtGaoEROr32QN6z3lgYNXQEeiQXRAji/x4Uw a1f1+5eBbiAs3Q+6brgF86F7bsbJ4z7EXbl72E2V3IfK+v6YeIfRFaW3ATBOMLtE gKBNIwF1GuPFlCIXFfSXtO7X5Lm5KirscLSz9wzlyL1sUUEDBFpedEgXc7azt98a bK24Pz5UE+Qds+u3mz2jK1gmnvEYIgpZqamWRsuk8UYOwlmsL1wTkYNCfP8sVyKg 3EbE3hMnFMLVbCCgSO8WgBiJfc5rq7QfzG1L3WUyYjyZjYMTwdHA8OK6tJGkyHSU gm45L74LuHxFc3PItOj5A2Q13ZT/NhSeyd7SJizv7YPNj1IKPuHMVrr+rNl6bBBz liznVdwxClPdRUCHeviZXIsV4If63ZV4FHRnq7Geq9IFiGs4/pTOOFpXoZR4jP+q yEsom5Z31sQ+bYUGqwxC79k3XMjQ9A07VBQB9R9IUhrpSDHrFDPEIfVkF4mQgOfu scjAAwqsxQw7ooGf30v8F6KdCTcNmVd6xY9Ux+8fiIcSZWqX5GVdG/eP6jMhLoQM dT20hZPj+5mnlMBoCFM= =Il/n -----END PGP SIGNATURE----- Merge tag 'mmc-v6.1-2' of git://git.kernel.org/pub/scm/linux/kernel/git/ulfh/mmc Pull MMC fixes from Ulf Hansson: "MMC core: - Add SD card quirk for broken discard MMC host: - renesas_sdhi: Fix clock rounding errors - sdhci-sprd: Fix minimum clock limit to detect cards - sdhci-tegra: Use actual clock rate for SW tuning correction" * tag 'mmc-v6.1-2' of git://git.kernel.org/pub/scm/linux/kernel/git/ulfh/mmc: mmc: sdhci-sprd: Fix minimum clock limit mmc: sdhci-tegra: Use actual clock rate for SW tuning correction mmc: renesas_sdhi: Fix rounding errors mmc: core: Add SD card quirk for broken discard
This commit is contained in:
commit
098179413d
@ -1140,8 +1140,12 @@ static void mmc_blk_issue_discard_rq(struct mmc_queue *mq, struct request *req)
|
||||
{
|
||||
struct mmc_blk_data *md = mq->blkdata;
|
||||
struct mmc_card *card = md->queue.card;
|
||||
unsigned int arg = card->erase_arg;
|
||||
|
||||
mmc_blk_issue_erase_rq(mq, req, MMC_BLK_DISCARD, card->erase_arg);
|
||||
if (mmc_card_broken_sd_discard(card))
|
||||
arg = SD_ERASE_ARG;
|
||||
|
||||
mmc_blk_issue_erase_rq(mq, req, MMC_BLK_DISCARD, arg);
|
||||
}
|
||||
|
||||
static void mmc_blk_issue_secdiscard_rq(struct mmc_queue *mq,
|
||||
|
@ -73,6 +73,7 @@ struct mmc_fixup {
|
||||
#define EXT_CSD_REV_ANY (-1u)
|
||||
|
||||
#define CID_MANFID_SANDISK 0x2
|
||||
#define CID_MANFID_SANDISK_SD 0x3
|
||||
#define CID_MANFID_ATP 0x9
|
||||
#define CID_MANFID_TOSHIBA 0x11
|
||||
#define CID_MANFID_MICRON 0x13
|
||||
@ -258,4 +259,9 @@ static inline int mmc_card_broken_hpi(const struct mmc_card *c)
|
||||
return c->quirks & MMC_QUIRK_BROKEN_HPI;
|
||||
}
|
||||
|
||||
static inline int mmc_card_broken_sd_discard(const struct mmc_card *c)
|
||||
{
|
||||
return c->quirks & MMC_QUIRK_BROKEN_SD_DISCARD;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
@ -100,6 +100,12 @@ static const struct mmc_fixup __maybe_unused mmc_blk_fixups[] = {
|
||||
MMC_FIXUP("V10016", CID_MANFID_KINGSTON, CID_OEMID_ANY, add_quirk_mmc,
|
||||
MMC_QUIRK_TRIM_BROKEN),
|
||||
|
||||
/*
|
||||
* Some SD cards reports discard support while they don't
|
||||
*/
|
||||
MMC_FIXUP(CID_NAME_ANY, CID_MANFID_SANDISK_SD, 0x5344, add_quirk_sd,
|
||||
MMC_QUIRK_BROKEN_SD_DISCARD),
|
||||
|
||||
END_FIXUP
|
||||
};
|
||||
|
||||
|
@ -128,6 +128,7 @@ static unsigned int renesas_sdhi_clk_update(struct tmio_mmc_host *host,
|
||||
struct clk *ref_clk = priv->clk;
|
||||
unsigned int freq, diff, best_freq = 0, diff_min = ~0;
|
||||
unsigned int new_clock, clkh_shift = 0;
|
||||
unsigned int new_upper_limit;
|
||||
int i;
|
||||
|
||||
/*
|
||||
@ -153,13 +154,20 @@ static unsigned int renesas_sdhi_clk_update(struct tmio_mmc_host *host,
|
||||
* greater than, new_clock. As we can divide by 1 << i for
|
||||
* any i in [0, 9] we want the input clock to be as close as
|
||||
* possible, but no greater than, new_clock << i.
|
||||
*
|
||||
* Add an upper limit of 1/1024 rate higher to the clock rate to fix
|
||||
* clk rate jumping to lower rate due to rounding error (eg: RZ/G2L has
|
||||
* 3 clk sources 533.333333 MHz, 400 MHz and 266.666666 MHz. The request
|
||||
* for 533.333333 MHz will selects a slower 400 MHz due to rounding
|
||||
* error (533333333 Hz / 4 * 4 = 533333332 Hz < 533333333 Hz)).
|
||||
*/
|
||||
for (i = min(9, ilog2(UINT_MAX / new_clock)); i >= 0; i--) {
|
||||
freq = clk_round_rate(ref_clk, new_clock << i);
|
||||
if (freq > (new_clock << i)) {
|
||||
new_upper_limit = (new_clock << i) + ((new_clock << i) >> 10);
|
||||
if (freq > new_upper_limit) {
|
||||
/* Too fast; look for a slightly slower option */
|
||||
freq = clk_round_rate(ref_clk, (new_clock << i) / 4 * 3);
|
||||
if (freq > (new_clock << i))
|
||||
if (freq > new_upper_limit)
|
||||
continue;
|
||||
}
|
||||
|
||||
@ -181,6 +189,7 @@ static unsigned int renesas_sdhi_clk_update(struct tmio_mmc_host *host,
|
||||
static void renesas_sdhi_set_clock(struct tmio_mmc_host *host,
|
||||
unsigned int new_clock)
|
||||
{
|
||||
unsigned int clk_margin;
|
||||
u32 clk = 0, clock;
|
||||
|
||||
sd_ctrl_write16(host, CTL_SD_CARD_CLK_CTL, ~CLK_CTL_SCLKEN &
|
||||
@ -194,7 +203,13 @@ static void renesas_sdhi_set_clock(struct tmio_mmc_host *host,
|
||||
host->mmc->actual_clock = renesas_sdhi_clk_update(host, new_clock);
|
||||
clock = host->mmc->actual_clock / 512;
|
||||
|
||||
for (clk = 0x80000080; new_clock >= (clock << 1); clk >>= 1)
|
||||
/*
|
||||
* Add a margin of 1/1024 rate higher to the clock rate in order
|
||||
* to avoid clk variable setting a value of 0 due to the margin
|
||||
* provided for actual_clock in renesas_sdhi_clk_update().
|
||||
*/
|
||||
clk_margin = new_clock >> 10;
|
||||
for (clk = 0x80000080; new_clock + clk_margin >= (clock << 1); clk >>= 1)
|
||||
clock <<= 1;
|
||||
|
||||
/* 1/1 clock is option */
|
||||
|
@ -309,7 +309,7 @@ static unsigned int sdhci_sprd_get_max_clock(struct sdhci_host *host)
|
||||
|
||||
static unsigned int sdhci_sprd_get_min_clock(struct sdhci_host *host)
|
||||
{
|
||||
return 400000;
|
||||
return 100000;
|
||||
}
|
||||
|
||||
static void sdhci_sprd_set_uhs_signaling(struct sdhci_host *host,
|
||||
|
@ -773,7 +773,7 @@ static void tegra_sdhci_set_clock(struct sdhci_host *host, unsigned int clock)
|
||||
dev_err(dev, "failed to set clk rate to %luHz: %d\n",
|
||||
host_clk, err);
|
||||
|
||||
tegra_host->curr_clk_rate = host_clk;
|
||||
tegra_host->curr_clk_rate = clk_get_rate(pltfm_host->clk);
|
||||
if (tegra_host->ddr_signaling)
|
||||
host->max_clk = host_clk;
|
||||
else
|
||||
|
@ -293,6 +293,7 @@ struct mmc_card {
|
||||
#define MMC_QUIRK_BROKEN_IRQ_POLLING (1<<11) /* Polling SDIO_CCCR_INTx could create a fake interrupt */
|
||||
#define MMC_QUIRK_TRIM_BROKEN (1<<12) /* Skip trim */
|
||||
#define MMC_QUIRK_BROKEN_HPI (1<<13) /* Disable broken HPI support */
|
||||
#define MMC_QUIRK_BROKEN_SD_DISCARD (1<<14) /* Disable broken SD discard support */
|
||||
|
||||
bool reenable_cmdq; /* Re-enable Command Queue */
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user