Attention is currently required from: Jason Glenesk, Raul Rangel, Matt DeVillier, Fred Reitberger, Felix Held.
Arthur Heymans has uploaded this change for review. ( https://review.coreboot.org/c/coreboot/+/68113 )
Change subject: soc/amd/*: Move emmc disabling to device ops ......................................................................
soc/amd/*: Move emmc disabling to device ops
This allows for reduced use of chip_operations in the followup patch and allows the allocator to skip over the used mmio.
Change-Id: I4052438185e7861792733b96a1298201c73fc3ff Signed-off-by: Arthur Heymans arthur@aheymans.xyz --- M src/soc/amd/cezanne/Makefile.inc M src/soc/amd/cezanne/chip.c A src/soc/amd/cezanne/emmc.c M src/soc/amd/mendocino/Makefile.inc M src/soc/amd/mendocino/chip.c A src/soc/amd/mendocino/emmc.c 6 files changed, 68 insertions(+), 8 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/13/68113/1
diff --git a/src/soc/amd/cezanne/Makefile.inc b/src/soc/amd/cezanne/Makefile.inc index 205b349..8c3227d 100644 --- a/src/soc/amd/cezanne/Makefile.inc +++ b/src/soc/amd/cezanne/Makefile.inc @@ -44,6 +44,7 @@ ramstage-y += root_complex.c ramstage-y += uart.c ramstage-y += xhci.c +ramstage-y += emmc.c
smm-y += gpio.c smm-y += smihandler.c diff --git a/src/soc/amd/cezanne/chip.c b/src/soc/amd/cezanne/chip.c index f184cb5..86aaf6c 100644 --- a/src/soc/amd/cezanne/chip.c +++ b/src/soc/amd/cezanne/chip.c @@ -1,12 +1,10 @@ /* SPDX-License-Identifier: GPL-2.0-only */
-#include <amdblocks/aoac.h> #include <console/console.h> #include <device/device.h> #include <device/pci.h> #include <fsp/api.h> #include <soc/acpi.h> -#include <soc/aoac_defs.h> #include <soc/cpu.h> #include <soc/data_fabric.h> #include <soc/pci_devs.h> @@ -18,6 +16,8 @@ extern struct device_operations soc_amd_i2c_mmio_ops; /* Supplied by uart.c */ extern struct device_operations cezanne_uart_mmio_ops; +/* Supplied by emmc.c */ +extern struct device_operations cezanne_emmc_mmio_ops;
struct device_operations cpu_bus_ops = { .read_resources = noop_read_resources, @@ -60,8 +60,7 @@ dev->ops = &cezanne_uart_mmio_ops; break; case APU_EMMC_BASE: - if (!dev->enabled) - power_off_aoac_device(FCH_AOAC_DEV_EMMC); + dev->ops = &cezanne_emmc_mmio_ops; break; } } diff --git a/src/soc/amd/cezanne/emmc.c b/src/soc/amd/cezanne/emmc.c new file mode 100644 index 0000000..a699b20 --- /dev/null +++ b/src/soc/amd/cezanne/emmc.c @@ -0,0 +1,23 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ + +#include <amdblocks/aoac.h> +#include <device/device.h> +#include <soc/aoac_defs.h> + +static void emmc_read_resources(struct device *dev) +{ + mmio_resource_kb(dev, 0, dev->path.mmio.addr / KiB, 4); +} + +static void emmc_enable(struct device *dev) +{ + if (!dev->enabled) + power_off_aoac_device(FCH_AOAC_DEV_EMMC); +} + +struct device_operations cezanne_emmc_mmio_ops = { + .read_resources = emmc_read_resources, + .set_resources = noop_set_resources, + .scan_bus = scan_static_bus, + .enable = emmc_enable, +}; diff --git a/src/soc/amd/mendocino/Makefile.inc b/src/soc/amd/mendocino/Makefile.inc index bdc1a7a..b81be8d 100644 --- a/src/soc/amd/mendocino/Makefile.inc +++ b/src/soc/amd/mendocino/Makefile.inc @@ -46,6 +46,7 @@ ramstage-y += root_complex.c ramstage-y += uart.c ramstage-y += xhci.c +ramstage-y += emmc.c
smm-y += gpio.c smm-y += smihandler.c diff --git a/src/soc/amd/mendocino/chip.c b/src/soc/amd/mendocino/chip.c index 41b2446..f71c285 100644 --- a/src/soc/amd/mendocino/chip.c +++ b/src/soc/amd/mendocino/chip.c @@ -2,13 +2,11 @@
/* TODO: Check if this is still correct */
-#include <amdblocks/aoac.h> #include <console/console.h> #include <device/device.h> #include <device/pci.h> #include <fsp/api.h> #include <soc/acpi.h> -#include <soc/aoac_defs.h> #include <soc/cpu.h> #include <soc/data_fabric.h> #include <soc/pci_devs.h> @@ -20,6 +18,9 @@ extern struct device_operations soc_amd_i2c_mmio_ops; /* Supplied by uart.c */ extern struct device_operations mendocino_uart_mmio_ops; +/* Supplied by emmc.c */ +extern struct device_operations mendocino_emmc_mmio_ops; +
struct device_operations cpu_bus_ops = { .read_resources = noop_read_resources, @@ -65,8 +66,7 @@ dev->ops = &mendocino_uart_mmio_ops; break; case APU_EMMC_BASE: - if (!dev->enabled) - power_off_aoac_device(FCH_AOAC_DEV_EMMC); + dev->ops = &mendocino_emmc_mmio_ops; break; } } diff --git a/src/soc/amd/mendocino/emmc.c b/src/soc/amd/mendocino/emmc.c new file mode 100644 index 0000000..ae01a14 --- /dev/null +++ b/src/soc/amd/mendocino/emmc.c @@ -0,0 +1,23 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ + +#include <amdblocks/aoac.h> +#include <device/device.h> +#include <soc/aoac_defs.h> + +static void emmc_read_resources(struct device *dev) +{ + mmio_resource_kb(dev, 0, dev->path.mmio.addr / KiB, 4); +} + +static void emmc_enable(struct device *dev) +{ + if (!dev->enabled) + power_off_aoac_device(FCH_AOAC_DEV_EMMC); +} + +struct device_operations mendocino_emmc_mmio_ops = { + .read_resources = emmc_read_resources, + .set_resources = noop_set_resources, + .scan_bus = scan_static_bus, + .enable = emmc_enable, +};