summaryrefslogtreecommitdiff
path: root/src/soc/amd
diff options
context:
space:
mode:
Diffstat (limited to 'src/soc/amd')
-rw-r--r--src/soc/amd/cezanne/Makefile.inc1
-rw-r--r--src/soc/amd/cezanne/chip.c7
-rw-r--r--src/soc/amd/cezanne/emmc.c23
-rw-r--r--src/soc/amd/mendocino/Makefile.inc1
-rw-r--r--src/soc/amd/mendocino/chip.c8
-rw-r--r--src/soc/amd/mendocino/emmc.c23
-rw-r--r--src/soc/amd/morgana/Makefile.inc1
-rw-r--r--src/soc/amd/morgana/chip.c7
-rw-r--r--src/soc/amd/morgana/emmc.c23
9 files changed, 82 insertions, 12 deletions
diff --git a/src/soc/amd/cezanne/Makefile.inc b/src/soc/amd/cezanne/Makefile.inc
index dc97c1ff4d..95ab4edb4b 100644
--- a/src/soc/amd/cezanne/Makefile.inc
+++ b/src/soc/amd/cezanne/Makefile.inc
@@ -33,6 +33,7 @@ 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/chip.c b/src/soc/amd/cezanne/chip.c
index f184cb543b..86aaf6ced2 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 @@ static void set_mmio_dev_ops(struct device *dev)
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 0000000000..a699b20f51
--- /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 9549426694..2952d18c4e 100644
--- a/src/soc/amd/mendocino/Makefile.inc
+++ b/src/soc/amd/mendocino/Makefile.inc
@@ -36,6 +36,7 @@ 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/chip.c b/src/soc/amd/mendocino/chip.c
index 41b244669f..f71c28586f 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 @@ static void set_mmio_dev_ops(struct device *dev)
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 0000000000..ae01a1486b
--- /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,
+};
diff --git a/src/soc/amd/morgana/Makefile.inc b/src/soc/amd/morgana/Makefile.inc
index 6c80d237ba..e99fa27088 100644
--- a/src/soc/amd/morgana/Makefile.inc
+++ b/src/soc/amd/morgana/Makefile.inc
@@ -37,6 +37,7 @@ 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/chip.c b/src/soc/amd/morgana/chip.c
index 2b97c6cc74..09f15023d9 100644
--- a/src/soc/amd/morgana/chip.c
+++ b/src/soc/amd/morgana/chip.c
@@ -2,13 +2,11 @@
/* TODO: Update for Morgana */
-#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,8 @@
extern struct device_operations soc_amd_i2c_mmio_ops;
/* Supplied by uart.c */
extern struct device_operations morgana_uart_mmio_ops;
+/* Supplied by emmc.c */
+extern struct device_operations morgana_emmc_mmio_ops;
struct device_operations cpu_bus_ops = {
.read_resources = noop_read_resources,
@@ -65,8 +65,7 @@ static void set_mmio_dev_ops(struct device *dev)
dev->ops = &morgana_uart_mmio_ops;
break;
case APU_EMMC_BASE:
- if (!dev->enabled)
- power_off_aoac_device(FCH_AOAC_DEV_EMMC);
+ dev->ops = &morgana_emmc_mmio_ops;
break;
}
}
diff --git a/src/soc/amd/morgana/emmc.c b/src/soc/amd/morgana/emmc.c
new file mode 100644
index 0000000000..4b43536ac0
--- /dev/null
+++ b/src/soc/amd/morgana/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 morgana_emmc_mmio_ops = {
+ .read_resources = emmc_read_resources,
+ .set_resources = noop_set_resources,
+ .scan_bus = scan_static_bus,
+ .enable = emmc_enable,
+};