Skip to content

Commit d85a069

Browse files
committed
mmc: sdhci-of-at91: add compatible to sama7g5 SoC
Add compatible and support for sama7g5 SDMMC block. Signed-off-by: Eugen Hristev <eugen.hristev@microchip.com>
1 parent 84fc1b2 commit d85a069

1 file changed

Lines changed: 16 additions & 3 deletions

File tree

drivers/mmc/host/sdhci-of-at91.c

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,8 @@ struct sdhci_at91_soc_data {
4040
const struct sdhci_pltfm_data *pdata;
4141
bool baseclk_is_generated_internally;
4242
unsigned int divider_for_baseclk;
43+
unsigned int max_sdr104_clk;
44+
bool hs200_broken;
4345
};
4446

4547
struct sdhci_at91_priv {
@@ -188,6 +190,8 @@ static const struct sdhci_pltfm_data sdhci_sama5d2_pdata = {
188190
static const struct sdhci_at91_soc_data soc_data_sama5d2 = {
189191
.pdata = &sdhci_sama5d2_pdata,
190192
.baseclk_is_generated_internally = false,
193+
.max_sdr104_clk = 120000000,
194+
.hs200_broken = true,
191195
};
192196

193197
static const struct sdhci_at91_soc_data soc_data_sam9x60 = {
@@ -196,9 +200,17 @@ static const struct sdhci_at91_soc_data soc_data_sam9x60 = {
196200
.divider_for_baseclk = 2,
197201
};
198202

203+
static const struct sdhci_at91_soc_data soc_data_sama7g5 = {
204+
.pdata = &sdhci_sama5d2_pdata,
205+
.baseclk_is_generated_internally = true,
206+
.divider_for_baseclk = 2,
207+
.max_sdr104_clk = 200000000,
208+
};
209+
199210
static const struct of_device_id sdhci_at91_dt_match[] = {
200211
{ .compatible = "atmel,sama5d2-sdhci", .data = &soc_data_sama5d2 },
201212
{ .compatible = "microchip,sam9x60-sdhci", .data = &soc_data_sam9x60 },
213+
{ .compatible = "microchip,sama7g5-sdhci", .data = &soc_data_sama7g5 },
202214
{}
203215
};
204216
MODULE_DEVICE_TABLE(of, sdhci_at91_dt_match);
@@ -255,7 +267,7 @@ static int sdhci_at91_set_clks_presets(struct device *dev)
255267
preset_div = DIV_ROUND_UP(gck_rate, 100000000) - 1;
256268
writew(SDHCI_AT91_PRESET_COMMON_CONF | preset_div,
257269
host->ioaddr + SDHCI_PRESET_FOR_SDR50);
258-
preset_div = DIV_ROUND_UP(gck_rate, 120000000) - 1;
270+
preset_div = DIV_ROUND_UP(gck_rate, priv->soc_data->max_sdr104_clk) - 1;
259271
writew(SDHCI_AT91_PRESET_COMMON_CONF | preset_div,
260272
host->ioaddr + SDHCI_PRESET_FOR_SDR104);
261273
preset_div = DIV_ROUND_UP(gck_rate, 50000000) - 1;
@@ -426,8 +438,9 @@ static int sdhci_at91_probe(struct platform_device *pdev)
426438
pm_runtime_set_autosuspend_delay(&pdev->dev, 50);
427439
pm_runtime_use_autosuspend(&pdev->dev);
428440

429-
/* HS200 is broken at this moment */
430-
host->quirks2 |= SDHCI_QUIRK2_BROKEN_HS200;
441+
/* check if HS200 is broken on this platform */
442+
if (priv->soc_data->hs200_broken)
443+
host->quirks2 |= SDHCI_QUIRK2_BROKEN_HS200;
431444

432445
ret = sdhci_add_host(host);
433446
if (ret)

0 commit comments

Comments
 (0)