diff options
author | Felix Held <felix-coreboot@felixheld.de> | 2022-10-13 20:58:47 +0200 |
---|---|---|
committer | Felix Held <felix-coreboot@felixheld.de> | 2022-10-14 20:18:29 +0000 |
commit | 65d73cc4573a23b4d98e3156cc1c4d0a1b09cb96 (patch) | |
tree | f8567513da4a2532131b94a574b35be89cf42349 /src/soc/amd/common/block/emmc/emmc.c | |
parent | 5e2f1b1e646da2e2333252f1f798dff419df0309 (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/amd/common/block/emmc/emmc.c')
-rw-r--r-- | src/soc/amd/common/block/emmc/emmc.c | 23 |
1 files changed, 23 insertions, 0 deletions
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, +}; |