Guest User

amd_emmc_patch

a guest
Oct 16th, 2018
115
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Diff 2.89 KB | None | 0 0
  1. diff --git a/sys/dev/sdhci/sdhci.c b/sys/dev/sdhci/sdhci.c
  2. index f117fb49c88..dd6e81d7f3e 100644
  3. --- a/sys/dev/sdhci/sdhci.c
  4. +++ b/sys/dev/sdhci/sdhci.c
  5. @@ -898,6 +898,8 @@ sdhci_init_slot(device_t dev, struct sdhci_slot *slot, int num)
  6.     if (slot->quirks & SDHCI_QUIRK_CAPS_BIT63_FOR_MMC_HS400 &&
  7.         caps2 & SDHCI_CAN_MMC_HS400)
  8.         host_caps |= MMC_CAP_MMC_HS400;
  9. +   if (slot->quirks & SDHCI_QUIRK_AMD_FOR_MMC_HS400 && caps2 & SDHCI_CAN_SDR104)
  10. +       host_caps |= MMC_CAP_MMC_HS400;
  11.  
  12.     /*
  13.      * Disable UHS-I and eMMC modes if the set_uhs_timing method is the
  14. @@ -1174,6 +1176,7 @@ sdhci_generic_set_uhs_timing(device_t brdev __unused, struct sdhci_slot *slot)
  15.  {
  16.     struct mmc_ios *ios;
  17.     uint16_t hostctrl2;
  18. +   uint16_t old_timing;
  19.  
  20.     if (slot->version < SDHCI_SPEC_300)
  21.         return;
  22. @@ -1182,6 +1185,7 @@ sdhci_generic_set_uhs_timing(device_t brdev __unused, struct sdhci_slot *slot)
  23.     ios = &slot->host.ios;
  24.     sdhci_set_clock(slot, 0);
  25.     hostctrl2 = RD2(slot, SDHCI_HOST_CONTROL2);
  26. +   old_timing = hostctrl2;
  27.     hostctrl2 &= ~SDHCI_CTRL2_UHS_MASK;
  28.     if (ios->clock > SD_SDR50_MAX) {
  29.         if (ios->timing == bus_timing_mmc_hs400 ||
  30. @@ -1202,6 +1206,15 @@ sdhci_generic_set_uhs_timing(device_t brdev __unused, struct sdhci_slot *slot)
  31.         hostctrl2 |= SDHCI_CTRL2_UHS_SDR12;
  32.     WR2(slot, SDHCI_HOST_CONTROL2, hostctrl2);
  33.     sdhci_set_clock(slot, ios->clock);
  34. +
  35. +   old_timing &= SDHCI_CTRL2_UHS_MASK;
  36. +
  37. +   if (slot->quirks & SDHCI_QUIRK_AMD_FOR_MMC_HS400 &&
  38. +       (old_timing == SDHCI_CTRL2_UHS_SDR104 &&
  39. +        ios->timing == bus_timing_hs)) {
  40. +           hostctrl2 = RD2(slot, SDHCI_HOST_CONTROL2);
  41. +           WR2(slot, SDHCI_HOST_CONTROL2, hostctrl2 & ~SDHCI_CTRL2_SAMPLING_CLOCK);
  42. +   }
  43.  }
  44.  
  45.  int
  46. diff --git a/sys/dev/sdhci/sdhci.h b/sys/dev/sdhci/sdhci.h
  47. index 76067280089..df02a854b2a 100644
  48. --- a/sys/dev/sdhci/sdhci.h
  49. +++ b/sys/dev/sdhci/sdhci.h
  50. @@ -93,6 +93,10 @@
  51.  #define    SDHCI_QUIRK_PRESET_VALUE_BROKEN         (1 << 27)
  52.  /* Controller does not support or the support for ACMD12 is broken. */
  53.  #define    SDHCI_QUIRK_BROKEN_AUTO_STOP            (1 << 28)
  54. +/* Controller requires disabling the tuning bit when transitioning from HS200 to HS mode*/
  55. +#define SDHCI_QUIRK_AMD_FOR_MMC_HS400          (1 << 29)
  56. +
  57. +
  58.  
  59.  /*
  60.   * Controller registers
  61. diff --git a/sys/dev/sdhci/sdhci_acpi.c b/sys/dev/sdhci/sdhci_acpi.c
  62. index 844be21d64b..544006442d7 100644
  63. --- a/sys/dev/sdhci/sdhci_acpi.c
  64. +++ b/sys/dev/sdhci/sdhci_acpi.c
  65. @@ -79,6 +79,11 @@ static const struct sdhci_acpi_device {
  66.         SDHCI_QUIRK_MMC_DDR52 |
  67.         SDHCI_QUIRK_CAPS_BIT63_FOR_MMC_HS400 |
  68.         SDHCI_QUIRK_PRESET_VALUE_BROKEN },
  69. +   { "AMDI0040", 0, "AMD eMMC 5.0 Controller",
  70. +       //SDHCI_QUIRK_MMC_DDR52 |
  71. +       SDHCI_QUIRK_CAPS_BIT63_FOR_MMC_HS400 |
  72. +       SDHCI_QUIRK_32BIT_DMA_SIZE |
  73. +       SDHCI_QUIRK_AMD_FOR_MMC_HS400 },
  74.     { NULL, 0, NULL, 0}
  75.  };
  76.  
  77. @@ -87,6 +92,7 @@ static char *sdhci_ids[] = {
  78.     "80860F16",
  79.     "80865ACA",
  80.     "80865ACC",
  81. +   "AMDI0040",
  82.     NULL
  83.  };
Add Comment
Please, Sign In to add comment