Attention is currently required from: Raul Rangel, Martin Roth, Paul Menzel, Karthik Ramasubramanian. Furquan Shaikh has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/54639 )
Change subject: mb/google/guybrush: Add helpers for cbi fw_config settings. ......................................................................
Patch Set 5:
(2 comments)
File src/mainboard/google/guybrush/variants/guybrush/helpers.c:
https://review.coreboot.org/c/coreboot/+/54639/comment/be814d1d_a94302e2 PS4, Line 32: if (config == UNDEFINED_FW_CONFIG || ! fw_config_probe(FW_CONFIG(FP, FP_PRESENT)))
For now I'm going to keep just doing the manual probe. […]
We don't really need the manual probing using fw_config at variant level. See my comment here: https://review.coreboot.org/c/coreboot/+/54639/comment/3edfe9fa_89d983e1/. With that, we can achieve reuse of helpers at baseboard level without having to define a global fw_config space.
https://review.coreboot.org/c/coreboot/+/54639/comment/67cbfeaf_47d399a3 PS4, Line 44: get_variant_wwan_type
You mention having this live in guybrush baseboard, but I don't see how that works if not every plat […]
The helper functions at the baseboard level don't need to use fw_config at all. fw_config can be used at the override tree level to enable/disable appropriate devices. That allows use of common helper functions without having to define a global fw_config space. For both FPMCU and WWAN there are already devices present in the device tree.
`variant_has_fpmcu()` was already written with that in mind.
For WWAN, similar support is required. Guybrush uses WWAN on gpp_bridge_2. Thus, gpp_bridge_2 is the device that needs to be enabled/disabled using appropriate fw_config (which in this case is WWAN_FM350GL). And the baseboard function only needs to check the state of that device. In fact, it needs exactly the same code that `variant_has_fpmcu()` has implemented, but with a different device_path. This can be achieved with a helper function as follows:
``` bool variant_has_device_enabled(const struct *device_path, size_t path_length) { » const struct device *dev = find_dev_nested_path(all_devices->link_list, device_path, path_length);
» return is_dev_enabled(dev); }
bool variant_has_fpmcu(void) { » static const struct device_path fpmcu_path[] = { » » { » » » .type = DEVICE_PATH_MMIO, » » » .mmio.addr = APU_UART1_BASE » » }, » » { » » » .type = DEVICE_PATH_GENERIC, » » » .generic.id = 0, » » » .generic.subid = 0 » » }, » };
» return variant_has_device_enabled(fpmcu_path, ARRAY_SIZE(fpmcu_path)); }
bool variant_has_pcie_wwan(void) { » static const struct device_path pcie_wwan_path[] = { » » { » » » .type = DEVICE_PATH_PCI, » » » .pci.devfn = PCIE_GPP_2_2_DEVFN, » » }, » };
» return variant_has_device_enabled(pcie_wwan_path, ARRAY_SIZE(pcie_wwan_path)); } ```
At the override tree level you only need this in guybrush/overridetree.cb:
``` device ref gpp_bridge_2 on » probe WWAN WWAN_FM350GL end # WWAN ```
In the future if there are any variants that use a mix of PCIe and non-PCIe WWAN cards, they would need a similar probe statement for gpp_bridge_2. If there are variants that use only PCIe WWAN cards, they don't need to define fw_config for it and the override tree would look like this: ``` device ref gpp_bridge_2 on end # WWAN ```
With the support in baseboard implemented using device state rather than fw_config, there will not be any changes required to helpers.c for any variants and the fw_config defined at variant level also works fine. It allows for reuse as well as limited work at variant level for partners to support this.