Debian Codegraph @

src/soc/amd/common/block/emmc/emmc.c

raw symbols SCIP
1 /* SPDX-License-Identifier: GPL-2.0-only */
2
3 #include <acpi/acpigen.h>
4 #include <amdblocks/aoac.h>
5 #include <device/device.h>
6 #include <soc/aoac_defs.h>
7
8 static void emmc_read_resources(struct device *dev)
9 {
10 mmio_range(dev, 0, dev->path.mmio.addr, 4 * KiB);
11 }
12
13 static void emmc_enable(struct device *dev)
14 {
15 if (!dev->enabled && !CONFIG(SOC_AMD_COMMON_BLOCK_EMMC_SKIP_POWEROFF))
16 power_off_aoac_device(FCH_AOAC_DEV_EMMC);
17 }
18
19 static const char *emmc_acpi_name(const struct device *dev)
20 {
21 return "MMC0";
22 }
23
24 static void emmc_acpi_fill_ssdt(const struct device *dev)
25 {
26 acpigen_write_scope(acpi_device_path(dev));
27 acpigen_write_store_int_to_namestr(acpi_device_status(dev), "STAT");
28 acpigen_pop_len(); /* Scope */
29 }
30
31 struct device_operations amd_emmc_mmio_ops = {
32 .read_resources = emmc_read_resources,
33 .set_resources = noop_set_resources,
34 .scan_bus = scan_static_bus,
35 .enable = emmc_enable,
36 .acpi_name = emmc_acpi_name,
37 .acpi_fill_ssdt = emmc_acpi_fill_ssdt,
38 };