summaryrefslogtreecommitdiff
path: root/src/soc
diff options
context:
space:
mode:
authorFelix Held <felix-coreboot@felixheld.de>2022-10-13 20:58:47 +0200
committerFelix Held <felix-coreboot@felixheld.de>2022-10-14 20:18:29 +0000
commit65d73cc4573a23b4d98e3156cc1c4d0a1b09cb96 (patch)
treef8567513da4a2532131b94a574b35be89cf42349 /src/soc
parent5e2f1b1e646da2e2333252f1f798dff419df0309 (diff)
soc/amd: factor out common eMMC code
Signed-off-by: Felix Held <felix-coreboot@felixheld.de> Change-Id: If5447f9272183f83bc422520ada93d3cfd96551e Reviewed-on: https://review.coreboot.org/c/coreboot/+/68415 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Martin Roth <martin.roth@amd.corp-partner.google.com>
Diffstat (limited to 'src/soc')
-rw-r--r--src/soc/amd/cezanne/Kconfig1
-rw-r--r--src/soc/amd/cezanne/Makefile.inc1
-rw-r--r--src/soc/amd/cezanne/chipset.cb2
-rw-r--r--src/soc/amd/common/block/emmc/Kconfig4
-rw-r--r--src/soc/amd/common/block/emmc/Makefile.inc1
-rw-r--r--src/soc/amd/common/block/emmc/emmc.c (renamed from src/soc/amd/cezanne/emmc.c)2
-rw-r--r--src/soc/amd/mendocino/Kconfig1
-rw-r--r--src/soc/amd/mendocino/Makefile.inc1
-rw-r--r--src/soc/amd/mendocino/chipset_mendocino.cb2
-rw-r--r--src/soc/amd/mendocino/chipset_rembrandt.cb2
-rw-r--r--src/soc/amd/mendocino/emmc.c23
-rw-r--r--src/soc/amd/morgana/Kconfig1
-rw-r--r--src/soc/amd/morgana/Makefile.inc1
-rw-r--r--src/soc/amd/morgana/chipset.cb2
-rw-r--r--src/soc/amd/morgana/emmc.c23
15 files changed, 13 insertions, 54 deletions
diff --git a/src/soc/amd/cezanne/Kconfig b/src/soc/amd/cezanne/Kconfig
index 35b9215586..b8209f83a9 100644
--- a/src/soc/amd/cezanne/Kconfig
+++ b/src/soc/amd/cezanne/Kconfig
@@ -46,6 +46,7 @@ config SOC_SPECIFIC_OPTIONS
select SOC_AMD_COMMON_BLOCK_APOB
select SOC_AMD_COMMON_BLOCK_BANKED_GPIOS
select SOC_AMD_COMMON_BLOCK_DATA_FABRIC
+ select SOC_AMD_COMMON_BLOCK_EMMC
select SOC_AMD_COMMON_BLOCK_GRAPHICS
select SOC_AMD_COMMON_BLOCK_HAS_ESPI
select SOC_AMD_COMMON_BLOCK_I2C
diff --git a/src/soc/amd/cezanne/Makefile.inc b/src/soc/amd/cezanne/Makefile.inc
index 95ab4edb4b..dc97c1ff4d 100644
--- a/src/soc/amd/cezanne/Makefile.inc
+++ b/src/soc/amd/cezanne/Makefile.inc
@@ -33,7 +33,6 @@ ramstage-y += agesa_acpi.c
ramstage-y += chip.c
ramstage-y += cpu.c
ramstage-y += data_fabric.c
-ramstage-y += emmc.c
ramstage-y += fch.c
ramstage-y += fsp_s_params.c
ramstage-y += gpio.c
diff --git a/src/soc/amd/cezanne/chipset.cb b/src/soc/amd/cezanne/chipset.cb
index a9bc2568a1..e717fd47c5 100644
--- a/src/soc/amd/cezanne/chipset.cb
+++ b/src/soc/amd/cezanne/chipset.cb
@@ -113,5 +113,5 @@ chip soc/amd/cezanne
device mmio 0xfedc5000 alias i2c_3 off ops soc_amd_i2c_mmio_ops end
device mmio 0xfedc9000 alias uart_0 off ops cezanne_uart_mmio_ops end
device mmio 0xfedca000 alias uart_1 off ops cezanne_uart_mmio_ops end
- device mmio 0xfedd5000 alias emmc off ops cezanne_emmc_mmio_ops end
+ device mmio 0xfedd5000 alias emmc off ops amd_emmc_mmio_ops end
end
diff --git a/src/soc/amd/common/block/emmc/Kconfig b/src/soc/amd/common/block/emmc/Kconfig
new file mode 100644
index 0000000000..96bbada13b
--- /dev/null
+++ b/src/soc/amd/common/block/emmc/Kconfig
@@ -0,0 +1,4 @@
+config SOC_AMD_COMMON_BLOCK_EMMC
+ bool
+ help
+ Select this option to use AMD common EMMC driver support.
diff --git a/src/soc/amd/common/block/emmc/Makefile.inc b/src/soc/amd/common/block/emmc/Makefile.inc
new file mode 100644
index 0000000000..ed68ab238d
--- /dev/null
+++ b/src/soc/amd/common/block/emmc/Makefile.inc
@@ -0,0 +1 @@
+ramstage-$(CONFIG_SOC_AMD_COMMON_BLOCK_EMMC) += emmc.c
diff --git a/src/soc/amd/cezanne/emmc.c b/src/soc/amd/common/block/emmc/emmc.c
index a699b20f51..ee612e4110 100644
--- a/src/soc/amd/cezanne/emmc.c
+++ b/src/soc/amd/common/block/emmc/emmc.c
@@ -15,7 +15,7 @@ static void emmc_enable(struct device *dev)
power_off_aoac_device(FCH_AOAC_DEV_EMMC);
}
-struct device_operations cezanne_emmc_mmio_ops = {
+struct device_operations amd_emmc_mmio_ops = {
.read_resources = emmc_read_resources,
.set_resources = noop_set_resources,
.scan_bus = scan_static_bus,
diff --git a/src/soc/amd/mendocino/Kconfig b/src/soc/amd/mendocino/Kconfig
index 9608e41ec4..d31b29dd43 100644
--- a/src/soc/amd/mendocino/Kconfig
+++ b/src/soc/amd/mendocino/Kconfig
@@ -61,6 +61,7 @@ config SOC_SPECIFIC_OPTIONS
select SOC_AMD_COMMON_BLOCK_APOB_HASH
select SOC_AMD_COMMON_BLOCK_BANKED_GPIOS # TODO: Check if this is still correct
select SOC_AMD_COMMON_BLOCK_DATA_FABRIC
+ select SOC_AMD_COMMON_BLOCK_EMMC
select SOC_AMD_COMMON_BLOCK_ESPI_EXTENDED_DECODE_RANGES
select SOC_AMD_COMMON_BLOCK_GRAPHICS # TODO: Check if this is still correct
select SOC_AMD_COMMON_BLOCK_HAS_ESPI
diff --git a/src/soc/amd/mendocino/Makefile.inc b/src/soc/amd/mendocino/Makefile.inc
index 2952d18c4e..9549426694 100644
--- a/src/soc/amd/mendocino/Makefile.inc
+++ b/src/soc/amd/mendocino/Makefile.inc
@@ -36,7 +36,6 @@ ramstage-y += agesa_acpi.c
ramstage-y += chip.c
ramstage-y += cpu.c
ramstage-y += data_fabric.c
-ramstage-y += emmc.c
ramstage-y += fch.c
ramstage-y += fsp_s_params.c
ramstage-y += gpio.c
diff --git a/src/soc/amd/mendocino/chipset_mendocino.cb b/src/soc/amd/mendocino/chipset_mendocino.cb
index 2a8d1877ff..5692d64563 100644
--- a/src/soc/amd/mendocino/chipset_mendocino.cb
+++ b/src/soc/amd/mendocino/chipset_mendocino.cb
@@ -93,5 +93,5 @@ chip soc/amd/mendocino
device mmio 0xfedce000 alias uart_2 off ops mendocino_uart_mmio_ops end
device mmio 0xfedcf000 alias uart_3 off ops mendocino_uart_mmio_ops end
device mmio 0xfedd1000 alias uart_4 off ops mendocino_uart_mmio_ops end
- device mmio 0xfedd5000 alias emmc off ops mendocino_emmc_mmio_ops end
+ device mmio 0xfedd5000 alias emmc off ops amd_emmc_mmio_ops end
end
diff --git a/src/soc/amd/mendocino/chipset_rembrandt.cb b/src/soc/amd/mendocino/chipset_rembrandt.cb
index 2a8d1877ff..5692d64563 100644
--- a/src/soc/amd/mendocino/chipset_rembrandt.cb
+++ b/src/soc/amd/mendocino/chipset_rembrandt.cb
@@ -93,5 +93,5 @@ chip soc/amd/mendocino
device mmio 0xfedce000 alias uart_2 off ops mendocino_uart_mmio_ops end
device mmio 0xfedcf000 alias uart_3 off ops mendocino_uart_mmio_ops end
device mmio 0xfedd1000 alias uart_4 off ops mendocino_uart_mmio_ops end
- device mmio 0xfedd5000 alias emmc off ops mendocino_emmc_mmio_ops end
+ device mmio 0xfedd5000 alias emmc off ops amd_emmc_mmio_ops end
end
diff --git a/src/soc/amd/mendocino/emmc.c b/src/soc/amd/mendocino/emmc.c
deleted file mode 100644
index ae01a1486b..0000000000
--- a/src/soc/amd/mendocino/emmc.c
+++ /dev/null
@@ -1,23 +0,0 @@
-/* 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,
-};
diff --git a/src/soc/amd/morgana/Kconfig b/src/soc/amd/morgana/Kconfig
index 8c7d87c4d2..f150d51175 100644
--- a/src/soc/amd/morgana/Kconfig
+++ b/src/soc/amd/morgana/Kconfig
@@ -51,6 +51,7 @@ config SOC_SPECIFIC_OPTIONS
select SOC_AMD_COMMON_BLOCK_APOB_HASH
select SOC_AMD_COMMON_BLOCK_BANKED_GPIOS
select SOC_AMD_COMMON_BLOCK_DATA_FABRIC
+ select SOC_AMD_COMMON_BLOCK_EMMC
select SOC_AMD_COMMON_BLOCK_ESPI_EXTENDED_DECODE_RANGES
select SOC_AMD_COMMON_BLOCK_GRAPHICS
select SOC_AMD_COMMON_BLOCK_HAS_ESPI
diff --git a/src/soc/amd/morgana/Makefile.inc b/src/soc/amd/morgana/Makefile.inc
index e99fa27088..6c80d237ba 100644
--- a/src/soc/amd/morgana/Makefile.inc
+++ b/src/soc/amd/morgana/Makefile.inc
@@ -37,7 +37,6 @@ ramstage-y += agesa_acpi.c
ramstage-y += chip.c
ramstage-y += cpu.c
ramstage-y += data_fabric.c
-ramstage-y += emmc.c
ramstage-y += fch.c
ramstage-y += fsp_s_params.c
ramstage-y += gpio.c
diff --git a/src/soc/amd/morgana/chipset.cb b/src/soc/amd/morgana/chipset.cb
index 8510981f4d..e710ffb2ff 100644
--- a/src/soc/amd/morgana/chipset.cb
+++ b/src/soc/amd/morgana/chipset.cb
@@ -95,5 +95,5 @@ chip soc/amd/morgana
device mmio 0xfedce000 alias uart_2 off ops morgana_uart_mmio_ops end
device mmio 0xfedcf000 alias uart_3 off ops morgana_uart_mmio_ops end
device mmio 0xfedd1000 alias uart_4 off ops morgana_uart_mmio_ops end
- device mmio 0xfedd5000 alias emmc off ops morgana_emmc_mmio_ops end
+ device mmio 0xfedd5000 alias emmc off ops amd_emmc_mmio_ops end
end
diff --git a/src/soc/amd/morgana/emmc.c b/src/soc/amd/morgana/emmc.c
deleted file mode 100644
index 4b43536ac0..0000000000
--- a/src/soc/amd/morgana/emmc.c
+++ /dev/null
@@ -1,23 +0,0 @@
-/* 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 morgana_emmc_mmio_ops = {
- .read_resources = emmc_read_resources,
- .set_resources = noop_set_resources,
- .scan_bus = scan_static_bus,
- .enable = emmc_enable,
-};