mb/google/nissa/var/riven: add fw_config probe for storage devices
1. Add STORAGE_UNKNOWN fw_config to enable all storage devices, this is used for the first boot in factory. 2. Add fw_config probe to enable/disable devices in devicetree instead of variant.c, it can avoid suspend(s0ix) fail issue. BUG=b:328580882 TEST=On riven eMMC and UFS SKUs, boot to OS and run `suspend_stress_test -c 10` pass. Change-Id: I518f1a5955fb88f304663112f1e3d4c744bde183 Signed-off-by: David Wu <david_wu@quanta.corp-partner.google.com> Reviewed-on: https://review.coreboot.org/c/coreboot/+/83405 Reviewed-by: Subrata Banik <subratabanik@google.com> Reviewed-by: Eric Lai <ericllai@google.com> Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
This commit is contained in:
		| @@ -11,6 +11,7 @@ fw_config | |||||||
| 		option STORAGE_EMMC		0 | 		option STORAGE_EMMC		0 | ||||||
| 		option STORAGE_NVME		1 | 		option STORAGE_NVME		1 | ||||||
| 		option STORAGE_UFS		2 | 		option STORAGE_UFS		2 | ||||||
|  | 		option STORAGE_UNKNOWN		3 | ||||||
| 	end | 	end | ||||||
| end | end | ||||||
|  |  | ||||||
|   | |||||||
| @@ -4,5 +4,4 @@ bootblock-y += gpio.c | |||||||
| romstage-y += gpio.c | romstage-y += gpio.c | ||||||
|  |  | ||||||
| ramstage-$(CONFIG_FW_CONFIG) += fw_config.c | ramstage-$(CONFIG_FW_CONFIG) += fw_config.c | ||||||
| ramstage-$(CONFIG_FW_CONFIG) += variant.c |  | ||||||
| ramstage-y += gpio.c | ramstage-y += gpio.c | ||||||
|   | |||||||
| @@ -90,9 +90,11 @@ void fw_config_gpio_padbased_override(struct pad_config *padbased_table) | |||||||
| 						ARRAY_SIZE(stylus_disable_pads)); | 						ARRAY_SIZE(stylus_disable_pads)); | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
|  | 	if (!fw_config_probe(FW_CONFIG(STORAGE, STORAGE_UNKNOWN))) { | ||||||
| 		if (!fw_config_probe(FW_CONFIG(STORAGE, STORAGE_EMMC))) { | 		if (!fw_config_probe(FW_CONFIG(STORAGE, STORAGE_EMMC))) { | ||||||
| 			printk(BIOS_INFO, "Disable eMMC GPIO pins.\n"); | 			printk(BIOS_INFO, "Disable eMMC GPIO pins.\n"); | ||||||
| 			gpio_padbased_override(padbased_table, emmc_disable_pads, | 			gpio_padbased_override(padbased_table, emmc_disable_pads, | ||||||
| 						ARRAY_SIZE(emmc_disable_pads)); | 						ARRAY_SIZE(emmc_disable_pads)); | ||||||
| 		} | 		} | ||||||
| 	} | 	} | ||||||
|  | } | ||||||
|   | |||||||
| @@ -478,14 +478,22 @@ chip soc/intel/alderlake | |||||||
| 			end | 			end | ||||||
| 		end | 		end | ||||||
| 		device ref pcie_rp7 off end # PCIE7 no SD card | 		device ref pcie_rp7 off end # PCIE7 no SD card | ||||||
| 		device ref emmc on end | 		device ref emmc on | ||||||
|  | 			probe STORAGE STORAGE_UNKNOWN | ||||||
|  | 			probe STORAGE STORAGE_EMMC | ||||||
|  | 		end | ||||||
| 		device ref ish on | 		device ref ish on | ||||||
| 			chip drivers/intel/ish | 			chip drivers/intel/ish | ||||||
| 				register "add_acpi_dma_property" = "true" | 				register "add_acpi_dma_property" = "true" | ||||||
| 				device generic 0 on end | 				device generic 0 on end | ||||||
| 			end | 			end | ||||||
|  | 			probe STORAGE STORAGE_UNKNOWN | ||||||
|  | 			probe STORAGE STORAGE_UFS | ||||||
|  | 		end | ||||||
|  | 		device ref ufs on | ||||||
|  | 			probe STORAGE STORAGE_UNKNOWN | ||||||
|  | 			probe STORAGE STORAGE_UFS | ||||||
| 		end | 		end | ||||||
| 		device ref ufs on end |  | ||||||
| 		device ref pch_espi on | 		device ref pch_espi on | ||||||
| 			chip ec/google/chromeec | 			chip ec/google/chromeec | ||||||
| 				use conn0 as mux_conn[0] | 				use conn0 as mux_conn[0] | ||||||
|   | |||||||
| @@ -1,29 +0,0 @@ | |||||||
| /* SPDX-License-Identifier: GPL-2.0-only */ |  | ||||||
|  |  | ||||||
| #include <baseboard/variants.h> |  | ||||||
| #include <console/console.h> |  | ||||||
| #include <device/device.h> |  | ||||||
| #include <fw_config.h> |  | ||||||
|  |  | ||||||
| void variant_devtree_update(void) |  | ||||||
| { |  | ||||||
| 	struct device *emmc = DEV_PTR(emmc); |  | ||||||
| 	struct device *ufs = DEV_PTR(ufs); |  | ||||||
| 	struct device *ish = DEV_PTR(ish); |  | ||||||
|  |  | ||||||
| 	if (!fw_config_is_provisioned()) { |  | ||||||
| 		printk(BIOS_INFO, "fw_config unprovisioned so enable all storage devices\n"); |  | ||||||
| 		return; |  | ||||||
| 	} |  | ||||||
|  |  | ||||||
| 	if (!fw_config_probe(FW_CONFIG(STORAGE, STORAGE_EMMC))) { |  | ||||||
| 		printk(BIOS_INFO, "eMMC disabled by fw_config\n"); |  | ||||||
| 		emmc->enabled = 0; |  | ||||||
| 	} |  | ||||||
|  |  | ||||||
| 	if (!fw_config_probe(FW_CONFIG(STORAGE, STORAGE_UFS))) { |  | ||||||
| 		printk(BIOS_INFO, "UFS disabled by fw_config\n"); |  | ||||||
| 		ufs->enabled = 0; |  | ||||||
| 		ish->enabled = 0; |  | ||||||
| 	} |  | ||||||
| } |  | ||||||
		Reference in New Issue
	
	Block a user