summaryrefslogtreecommitdiff
path: root/src/soc/amd/common
diff options
context:
space:
mode:
Diffstat (limited to 'src/soc/amd/common')
-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.c23
3 files changed, 28 insertions, 0 deletions
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/common/block/emmc/emmc.c b/src/soc/amd/common/block/emmc/emmc.c
new file mode 100644
index 0000000000..ee612e4110
--- /dev/null
+++ b/src/soc/amd/common/block/emmc/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 amd_emmc_mmio_ops = {
+ .read_resources = emmc_read_resources,
+ .set_resources = noop_set_resources,
+ .scan_bus = scan_static_bus,
+ .enable = emmc_enable,
+};