soc/intel/common/fast_spi: Add static bus scanning

Add scan_bus operation to fast_spi device operations to enable
discovery of statically defined child devices.

This allows device drivers such as drivers/pc80/tpm that are
physically connected to the fast_spi bus to be properly
enumerated and initialized during device tree scanning.

Without this change, child devices defined in devicetree under
fast_spi would not be discovered, preventing proper driver
binding and initialization.

Example devicetree configuration:
```
                device ref fast_spi on
                        chip drivers/pc80/tpm   # SPI TPM header
                                device pnp 0c31.0 on end
                        end
                end
```

Without a .scan_bus hook in fast_spi_dev_ops, coreboot's
BS_DEV_ENUMERATE phase never creates the pnp 0c31.0 device. As a
result, in BS_DEV_RESOURCES you see, that the device PNP 0c31.0
is missing its function "read_resources":

```
(in BS_DEV_ENUMERATE)

[DEBUG]  scan_bus: bus PCI: 00:00:1f.4 finished in 11 msecs
[DEBUG]  scan_bus: bus DOMAIN: 00000000 finished in 1510 msecs
[SPEW ]  scan_static_bus for Root Device done

... (in BS_DEV_RESOURCES)

[SPEW ]  PCI: 00:00:1f.5 read_resources segment group 0 bus 0
[ERROR]  PNP: 0c31.0 missing read_resources
[SPEW ]  PCI: 00:00:1f.5 read_resources segment group 0 bus 0 done
[SPEW ]  DOMAIN: 00000000 read_resources segment group 0 bus 0 done
[SPEW ]  Root Device read_resources segment group 0 bus 0 done
[INFO ]  Done reading resources.
```

With the implementation of scan_bus, the log shows that the resources
are allocated correctly:

```
(in BS_DEV_ENUMERATE)

[DEBUG]  scan_bus: bus PCI: 00:00:1f.4 finished in 11 msecs
[DEBUG]  PCI: 00:00:1f.5 scanning...
[SPEW ]  scan_static_bus for PCI: 00:00:1f.5
[DEBUG]  PNP: 0c31.0 enabled
[SPEW ]  scan_static_bus for PCI: 00:00:1f.5 done
[DEBUG]  scan_bus: bus PCI: 00:00:1f.5 finished in 14 msecs
[DEBUG]  scan_bus: bus DOMAIN: 00000000 finished in 1536 msecs
[SPEW ]  scan_static_bus for Root Device done

... (in BS_DEV_RESOURCES)

[SPEW ]  PCI: 00:00:1f.5 read_resources segment group 0 bus 0
[SPEW ]  dev: PNP: 0c31.0, index: 0x0, base: 0xfed40000, size: 0x5000
[SPEW ]  PCI: 00:00:1f.5 read_resources segment group 0 bus 0 done
[SPEW ]  DOMAIN: 00000000 read_resources segment group 0 bus 0 done
[SPEW ]  Root Device read_resources segment group 0 bus 0 done
[INFO ]  Done reading resources.
```

TEST=Verified on Siemens mc_rpl1 mainboard. TPM device properly
enumerated with scan_bus implementation.


Change-Id: I4049d2d3cd5132362a7efd551dc9dd78cd24b9eb
Signed-off-by: Kilian Krause <kilian.krause@siemens.com>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/88966
Reviewed-by: Paul Menzel <paulepanter@mailbox.org>
Reviewed-by: Mario Scheithauer <mario.scheithauer@siemens.com>
Reviewed-by: Jérémy Compostella <jeremy.compostella@intel.com>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Werner Zeh <werner.zeh@siemens.com>
This commit is contained in:
Kilian Krause 2025-08-13 16:58:47 +02:00 committed by Werner Zeh
commit c71071397f

View file

@ -558,6 +558,7 @@ static struct device_operations fast_spi_dev_ops = {
.acpi_fill_ssdt = fast_spi_fill_ssdt,
.acpi_name = fast_spi_acpi_name,
.ops_pci = &pci_dev_ops_pci,
.scan_bus = scan_static_bus,
};
static const unsigned short pci_device_ids[] = {