soc/amd/picasso: add eMMC MMIO device to devicetree

Add the eMMC MMIO device to the devicetree and make it use the common
AMD eMMC driver. Since there is now a device for this in the devicetree,
also use this device to determine if the FSP should be told if the eMMC
controller is supposed to be disabled.

TEST=On Mandolin the eMMC controller both disappears in the Windows 10
     device manager and in dmesg on Ubuntu 2022.04 LTS
TEST=Morphius with NVMe SSD still works

Signed-off-by: Felix Held <felix-coreboot@felixheld.de>
Change-Id: I5453b69df776d2ce1f3be11e37cd26c8c64f0cd5
Reviewed-on: https://review.coreboot.org/c/coreboot/+/77990
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Matt DeVillier <matt.devillier@amd.corp-partner.google.com>
This commit is contained in:
Felix Held
2023-09-07 16:33:26 +02:00
parent 8c17891022
commit 850b6c6254
14 changed files with 20 additions and 29 deletions

View File

@ -8,10 +8,6 @@ chip soc/amd/picasso
register "common_config.fadt_boot_arch" = "ACPI_FADT_LEGACY_DEVICES | ACPI_FADT_8042" register "common_config.fadt_boot_arch" = "ACPI_FADT_LEGACY_DEVICES | ACPI_FADT_8042"
register "common_config.fadt_flags" = "ACPI_FADT_SLEEP_BUTTON" # See table 5-34 ACPI 6.3 spec register "common_config.fadt_flags" = "ACPI_FADT_SLEEP_BUTTON" # See table 5-34 ACPI 6.3 spec
register "emmc_config" = "{
.timing = SD_EMMC_DISABLE,
}"
register "has_usb2_phy_tune_params" = "1" register "has_usb2_phy_tune_params" = "1"
# Controller0 Port0 Default # Controller0 Port0 Default

View File

@ -8,10 +8,6 @@ chip soc/amd/picasso
register "common_config.fadt_boot_arch" = "ACPI_FADT_LEGACY_DEVICES | ACPI_FADT_8042" register "common_config.fadt_boot_arch" = "ACPI_FADT_LEGACY_DEVICES | ACPI_FADT_8042"
register "common_config.fadt_flags" = "ACPI_FADT_SLEEP_BUTTON" # See table 5-34 ACPI 6.3 spec register "common_config.fadt_flags" = "ACPI_FADT_SLEEP_BUTTON" # See table 5-34 ACPI 6.3 spec
register "emmc_config" = "{
.timing = SD_EMMC_DISABLE,
}"
register "has_usb2_phy_tune_params" = "1" register "has_usb2_phy_tune_params" = "1"
# Controller0 Port0 Default # Controller0 Port0 Default

View File

@ -8,10 +8,6 @@ chip soc/amd/picasso
register "common_config.fadt_boot_arch" = "ACPI_FADT_LEGACY_DEVICES | ACPI_FADT_8042" register "common_config.fadt_boot_arch" = "ACPI_FADT_LEGACY_DEVICES | ACPI_FADT_8042"
register "common_config.fadt_flags" = "ACPI_FADT_SLEEP_BUTTON" # See table 5-34 ACPI 6.3 spec register "common_config.fadt_flags" = "ACPI_FADT_SLEEP_BUTTON" # See table 5-34 ACPI 6.3 spec
register "emmc_config" = "{
.timing = SD_EMMC_DISABLE,
}"
register "has_usb2_phy_tune_params" = "1" register "has_usb2_phy_tune_params" = "1"
# Controller0 Port0 Default # Controller0 Port0 Default

View File

@ -388,4 +388,6 @@ chip soc/amd/picasso
device ref uart_0 on end # console device ref uart_0 on end # console
device ref emmc on end
end # chip soc/amd/picasso end # chip soc/amd/picasso

View File

@ -436,4 +436,6 @@ chip soc/amd/picasso
device ref uart_0 on end # console device ref uart_0 on end # console
device ref emmc on end
end # chip soc/amd/picasso end # chip soc/amd/picasso

View File

@ -4,13 +4,9 @@
void variant_devtree_update(void) void variant_devtree_update(void)
{ {
struct soc_amd_picasso_config *cfg;
cfg = config_of_soc();
/* /*
* Enable eMMC if eMMC bit is set in FW_CONFIG or device is unprovisioned. * Enable eMMC if eMMC bit is set in FW_CONFIG or device is unprovisioned.
*/ */
if (!(variant_has_emmc() || boot_is_factory_unprovisioned())) if (!(variant_has_emmc() || boot_is_factory_unprovisioned()))
cfg->emmc_config.timing = SD_EMMC_DISABLE; DEV_PTR(emmc)->enabled = 0;
} }

View File

@ -59,7 +59,7 @@ void variant_devtree_update(void)
cfg->emmc_config.timing = SD_EMMC_EMMC_HS200; cfg->emmc_config.timing = SD_EMMC_EMMC_HS200;
} }
} else { } else {
cfg->emmc_config.timing = SD_EMMC_DISABLE; DEV_PTR(emmc)->enabled = 0;
} }
update_audio_configuration(); update_audio_configuration();

View File

@ -7,13 +7,9 @@
void variant_devtree_update(void) void variant_devtree_update(void)
{ {
struct soc_amd_picasso_config *cfg;
cfg = config_of_soc();
/* /*
* Enable eMMC if eMMC bit is set in FW_CONFIG or device is unprovisioned. * Enable eMMC if eMMC bit is set in FW_CONFIG or device is unprovisioned.
*/ */
if (!(variant_has_emmc() || boot_is_factory_unprovisioned())) if (!(variant_has_emmc() || boot_is_factory_unprovisioned()))
cfg->emmc_config.timing = SD_EMMC_DISABLE; DEV_PTR(emmc)->enabled = 0;
} }

View File

@ -4,13 +4,9 @@
void variant_devtree_update(void) void variant_devtree_update(void)
{ {
struct soc_amd_picasso_config *cfg;
cfg = config_of_soc();
/* /*
* Enable eMMC if eMMC bit is set in FW_CONFIG or device is unprovisioned. * Enable eMMC if eMMC bit is set in FW_CONFIG or device is unprovisioned.
*/ */
if (!(variant_has_emmc() || boot_is_factory_unprovisioned())) if (!(variant_has_emmc() || boot_is_factory_unprovisioned()))
cfg->emmc_config.timing = SD_EMMC_DISABLE; DEV_PTR(emmc)->enabled = 0;
} }

View File

@ -37,6 +37,7 @@ config SOC_AMD_PICASSO
select SOC_AMD_COMMON_BLOCK_DATA_FABRIC select SOC_AMD_COMMON_BLOCK_DATA_FABRIC
select SOC_AMD_COMMON_BLOCK_DATA_FABRIC_DOMAIN select SOC_AMD_COMMON_BLOCK_DATA_FABRIC_DOMAIN
select SOC_AMD_COMMON_BLOCK_DATA_FABRIC_NP_REGION select SOC_AMD_COMMON_BLOCK_DATA_FABRIC_NP_REGION
select SOC_AMD_COMMON_BLOCK_EMMC
select SOC_AMD_COMMON_BLOCK_GRAPHICS select SOC_AMD_COMMON_BLOCK_GRAPHICS
select SOC_AMD_COMMON_BLOCK_HAS_ESPI select SOC_AMD_COMMON_BLOCK_HAS_ESPI
select SOC_AMD_COMMON_BLOCK_HDA select SOC_AMD_COMMON_BLOCK_HDA

View File

@ -87,9 +87,10 @@ Device (MMC0)
} }
} }
Name (STAT, 0x0)
Method (_STA, 0x0, NotSerialized) Method (_STA, 0x0, NotSerialized)
{ {
Return (0x0F) Return (STAT)
} }
} }

View File

@ -177,6 +177,9 @@ struct soc_amd_picasso_config {
* HS400 -> NONE (0x05) * HS400 -> NONE (0x05)
* *
* The kernel driver uses a heuristic to determine if HS400 is supported. * The kernel driver uses a heuristic to determine if HS400 is supported.
*
* If the eMMC MMIO device is disabled in the devicetree,
* fsps_update_emmc_config will set timing to SD_EMMC_DISABLE.
*/ */
enum { enum {
SD_EMMC_DISABLE, SD_EMMC_DISABLE,

View File

@ -57,4 +57,5 @@ chip soc/amd/picasso
device mmio 0xfedca000 alias uart_1 off ops amd_uart_mmio_ops end device mmio 0xfedca000 alias uart_1 off ops amd_uart_mmio_ops end
device mmio 0xfedce000 alias uart_2 off ops amd_uart_mmio_ops end device mmio 0xfedce000 alias uart_2 off ops amd_uart_mmio_ops end
device mmio 0xfedcf000 alias uart_3 off ops amd_uart_mmio_ops end device mmio 0xfedcf000 alias uart_3 off ops amd_uart_mmio_ops end
device mmio 0xfedd5000 alias emmc off ops amd_emmc_mmio_ops end
end end

View File

@ -56,6 +56,11 @@ static void fsps_update_emmc_config(FSP_S_CONFIG *scfg,
break; break;
} }
/* Make sure that the FSP knows that the EMMC controller should be disabled when the
corresponding MMIO device is disabled */
if (!DEV_PTR(emmc)->enabled)
val = SD_DISABLE;
scfg->emmc0_mode = val; scfg->emmc0_mode = val;
scfg->emmc0_sdr104_hs400_driver_strength = scfg->emmc0_sdr104_hs400_driver_strength =
cfg->emmc_config.sdr104_hs400_driver_strength; cfg->emmc_config.sdr104_hs400_driver_strength;