Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

mmc: sdhci-pci: Use ACPI to get max frequency for Intel NI byt sdio

On NI 9037 boards the max SDIO frequency is limited by trace lengths
and other layout choices. The max SDIO frequency is stored in an ACPI
table.

The driver reads the ACPI entry MXFQ during sdio_probe_slot and sets the
f_max field of the host.

Signed-off-by: Nathan Sullivan <nathan.sullivan@ni.com>
Reviewed-by: Jaeden Amero <jaeden.amero@ni.com>
Reviewed-by: Josh Cartwright <joshc@ni.com>
Signed-off-by: Zach Brown <zach.brown@ni.com>
Acked-by: Adrian Hunter <adrian.hunter@intel.com>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>

authored by

Zach Brown and committed by
Ulf Hansson
3f23df72 42b06496

+32
+32
drivers/mmc/host/sdhci-pci-core.c
··· 27 27 #include <linux/pm_runtime.h> 28 28 #include <linux/mmc/slot-gpio.h> 29 29 #include <linux/mmc/sdhci-pci-data.h> 30 + #include <linux/acpi.h> 30 31 31 32 #include "sdhci.h" 32 33 #include "sdhci-pci.h" ··· 376 375 return 0; 377 376 } 378 377 378 + #ifdef CONFIG_ACPI 379 + static int ni_set_max_freq(struct sdhci_pci_slot *slot) 380 + { 381 + acpi_status status; 382 + unsigned long long max_freq; 383 + 384 + status = acpi_evaluate_integer(ACPI_HANDLE(&slot->chip->pdev->dev), 385 + "MXFQ", NULL, &max_freq); 386 + if (ACPI_FAILURE(status)) { 387 + dev_err(&slot->chip->pdev->dev, 388 + "MXFQ not found in acpi table\n"); 389 + return -EINVAL; 390 + } 391 + 392 + slot->host->mmc->f_max = max_freq * 1000000; 393 + 394 + return 0; 395 + } 396 + #else 397 + static inline int ni_set_max_freq(struct sdhci_pci_slot *slot) 398 + { 399 + return 0; 400 + } 401 + #endif 402 + 379 403 static int ni_byt_sdio_probe_slot(struct sdhci_pci_slot *slot) 380 404 { 405 + int err; 406 + 407 + err = ni_set_max_freq(slot); 408 + if (err) 409 + return err; 410 + 381 411 slot->host->mmc->caps |= MMC_CAP_POWER_OFF_CARD | MMC_CAP_NONREMOVABLE | 382 412 MMC_CAP_WAIT_WHILE_BUSY; 383 413 return 0;