summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorRaul E Rangel <rrangel@chromium.org>2020-09-03 14:30:33 -0600
committerPatrick Georgi <pgeorgi@google.com>2020-09-14 07:09:23 +0000
commit7c79d8302b7361a11a204131d5661d768feb82ac (patch)
tree8d233bf36810d7ea8af038e3b8317bb7dbff6e3e /src
parent73cd3e704fde61e287f6fbdd6d371ed19e41f15d (diff)
soc/amd/picasso: Move sd_emmc_config into emmc_config struct
I plan on adding another eMMC parameter. This refactor keeps the config contained in a single struct. BUG=b:159823235 TEST=Build test Signed-off-by: Raul E Rangel <rrangel@chromium.org> Change-Id: I4b57d651ab44d6c1cad661d620bffd4207dfebd4 Reviewed-on: https://review.coreboot.org/c/coreboot/+/45095 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Marshall Dawson <marshalldawson3rd@gmail.com> Reviewed-by: Furquan Shaikh <furquan@google.com> Reviewed-by: Aaron Durbin <adurbin@chromium.org>
Diffstat (limited to 'src')
-rw-r--r--src/mainboard/amd/mandolin/mainboard.c2
-rw-r--r--src/mainboard/amd/mandolin/variants/mandolin/devicetree.cb4
-rw-r--r--src/mainboard/google/zork/variants/baseboard/devicetree_dalboz.cb4
-rw-r--r--src/mainboard/google/zork/variants/baseboard/devicetree_trembyle.cb4
-rw-r--r--src/mainboard/google/zork/variants/dalboz/variant.c4
-rw-r--r--src/mainboard/google/zork/variants/ezkinil/variant.c2
-rw-r--r--src/soc/amd/picasso/chip.h42
-rw-r--r--src/soc/amd/picasso/fsp_params.c2
8 files changed, 42 insertions, 22 deletions
diff --git a/src/mainboard/amd/mandolin/mainboard.c b/src/mainboard/amd/mandolin/mainboard.c
index c22ed34849..247616cff7 100644
--- a/src/mainboard/amd/mandolin/mainboard.c
+++ b/src/mainboard/amd/mandolin/mainboard.c
@@ -112,7 +112,7 @@ static void mainboard_init(void *chip_info)
struct soc_amd_picasso_config *cfg = config_of_soc();
if (!CONFIG(PICASSO_LPC_IOMUX))
- cfg->sd_emmc_config = SD_EMMC_EMMC_HS400;
+ cfg->emmc_config.timing = SD_EMMC_EMMC_HS400;
mainboard_program_gpios();
diff --git a/src/mainboard/amd/mandolin/variants/mandolin/devicetree.cb b/src/mainboard/amd/mandolin/variants/mandolin/devicetree.cb
index c6031302cc..7ccec278c3 100644
--- a/src/mainboard/amd/mandolin/variants/mandolin/devicetree.cb
+++ b/src/mainboard/amd/mandolin/variants/mandolin/devicetree.cb
@@ -7,7 +7,9 @@ chip soc/amd/picasso
register "fadt_boot_arch" = "ACPI_FADT_LEGACY_DEVICES | ACPI_FADT_8042"
register "fadt_flags" = "ACPI_FADT_SLEEP_BUTTON" # See table 5-34 ACPI 6.3 spec
- register "sd_emmc_config" = "SD_EMMC_DISABLE"
+ register "emmc_config" = "{
+ .timing = SD_EMMC_DISABLE,
+ }"
register "has_usb2_phy_tune_params" = "1"
diff --git a/src/mainboard/google/zork/variants/baseboard/devicetree_dalboz.cb b/src/mainboard/google/zork/variants/baseboard/devicetree_dalboz.cb
index a0f6636b7f..40042436d3 100644
--- a/src/mainboard/google/zork/variants/baseboard/devicetree_dalboz.cb
+++ b/src/mainboard/google/zork/variants/baseboard/devicetree_dalboz.cb
@@ -40,7 +40,9 @@ chip soc/amd/picasso
# End : OPN Performance Configuration
- register "sd_emmc_config" = "SD_EMMC_EMMC_HS400"
+ register "emmc_config" = "{
+ .timing = SD_EMMC_EMMC_HS400,
+ }"
register "xhci0_force_gen1" = "0"
diff --git a/src/mainboard/google/zork/variants/baseboard/devicetree_trembyle.cb b/src/mainboard/google/zork/variants/baseboard/devicetree_trembyle.cb
index 169451931d..8d475e956e 100644
--- a/src/mainboard/google/zork/variants/baseboard/devicetree_trembyle.cb
+++ b/src/mainboard/google/zork/variants/baseboard/devicetree_trembyle.cb
@@ -40,7 +40,9 @@ chip soc/amd/picasso
# End : OPN Performance Configuration
- register "sd_emmc_config" = "SD_EMMC_EMMC_HS400"
+ register "emmc_config" = "{
+ .timing = SD_EMMC_EMMC_HS400,
+ }"
register "xhci0_force_gen1" = "0"
diff --git a/src/mainboard/google/zork/variants/dalboz/variant.c b/src/mainboard/google/zork/variants/dalboz/variant.c
index 5138782e5c..21aaec829a 100644
--- a/src/mainboard/google/zork/variants/dalboz/variant.c
+++ b/src/mainboard/google/zork/variants/dalboz/variant.c
@@ -134,10 +134,10 @@ void variant_devtree_update(void)
* So we keep the speed low here, with the intent that
* other variants implement these corrections.
*/
- cfg->sd_emmc_config = SD_EMMC_EMMC_HS200;
+ cfg->emmc_config.timing = SD_EMMC_EMMC_HS200;
}
} else {
- cfg->sd_emmc_config = SD_EMMC_DISABLE;
+ cfg->emmc_config.timing = SD_EMMC_DISABLE;
}
update_audio_configuration();
diff --git a/src/mainboard/google/zork/variants/ezkinil/variant.c b/src/mainboard/google/zork/variants/ezkinil/variant.c
index 29a50bcbeb..f76ab62035 100644
--- a/src/mainboard/google/zork/variants/ezkinil/variant.c
+++ b/src/mainboard/google/zork/variants/ezkinil/variant.c
@@ -15,5 +15,5 @@ void variant_devtree_update(void)
* Enable eMMC if eMMC bit is set in FW_CONFIG or device is unprovisioned.
*/
if (!(variant_has_emmc() || boot_is_factory_unprovisioned()))
- cfg->sd_emmc_config = SD_EMMC_DISABLE;
+ cfg->emmc_config.timing = SD_EMMC_DISABLE;
}
diff --git a/src/soc/amd/picasso/chip.h b/src/soc/amd/picasso/chip.h
index ad492e0353..e3da2553b9 100644
--- a/src/soc/amd/picasso/chip.h
+++ b/src/soc/amd/picasso/chip.h
@@ -126,20 +126,34 @@ struct soc_amd_picasso_config {
uint32_t telemetry_vddcr_soc_slope;
uint32_t telemetry_vddcr_soc_offset;
- enum {
- SD_EMMC_DISABLE,
- SD_EMMC_SD_LOW_SPEED,
- SD_EMMC_SD_HIGH_SPEED,
- SD_EMMC_SD_UHS_I_SDR_50,
- SD_EMMC_SD_UHS_I_DDR_50,
- SD_EMMC_SD_UHS_I_SDR_104,
- SD_EMMC_EMMC_SDR_26,
- SD_EMMC_EMMC_SDR_52,
- SD_EMMC_EMMC_DDR_52,
- SD_EMMC_EMMC_HS200,
- SD_EMMC_EMMC_HS400,
- SD_EMMC_EMMC_HS300,
- } sd_emmc_config;
+ struct {
+ /*
+ * SDHCI doesn't directly support eMMC. There is an implicit mapping between
+ * eMMC timing modes and SDHCI UHS-I timing modes defined in the linux
+ * kernel.
+ *
+ * HS -> UHS_SDR12 (0x00)
+ * DDR52 -> UHS_DDR50 (0x04)
+ * HS200 -> UHS_SDR104 (0x03)
+ * HS400 -> NONE (0x05)
+ *
+ * The kernel driver uses a heuristic to determine if HS400 is supported.
+ */
+ enum {
+ SD_EMMC_DISABLE,
+ SD_EMMC_SD_LOW_SPEED,
+ SD_EMMC_SD_HIGH_SPEED,
+ SD_EMMC_SD_UHS_I_SDR_50,
+ SD_EMMC_SD_UHS_I_DDR_50,
+ SD_EMMC_SD_UHS_I_SDR_104,
+ SD_EMMC_EMMC_SDR_26,
+ SD_EMMC_EMMC_SDR_52,
+ SD_EMMC_EMMC_DDR_52,
+ SD_EMMC_EMMC_HS200,
+ SD_EMMC_EMMC_HS400,
+ SD_EMMC_EMMC_HS300,
+ } timing;
+ } emmc_config;
uint8_t xhci0_force_gen1;
diff --git a/src/soc/amd/picasso/fsp_params.c b/src/soc/amd/picasso/fsp_params.c
index f7f23b512e..b21f237c32 100644
--- a/src/soc/amd/picasso/fsp_params.c
+++ b/src/soc/amd/picasso/fsp_params.c
@@ -13,7 +13,7 @@ static void fsps_update_emmc_config(FSP_S_CONFIG *scfg,
{
int val = SD_DISABLE;
- switch (cfg->sd_emmc_config) {
+ switch (cfg->emmc_config.timing) {
case SD_EMMC_DISABLE:
val = SD_DISABLE;
break;