1 // SPDX-License-Identifier: GPL-2.0+
7 #include <power/pmic.h>
10 #if CONFIG_IS_ENABLED(SYSRESET)
11 static int axp_sysreset_request(struct udevice *dev, enum sysreset_t type)
15 if (type != SYSRESET_POWER_OFF)
16 return -EPROTONOSUPPORT;
18 ret = pmic_clrsetbits(dev->parent, AXP152_SHUTDOWN, 0, AXP152_POWEROFF);
25 static struct sysreset_ops axp_sysreset_ops = {
26 .request = axp_sysreset_request,
29 U_BOOT_DRIVER(axp_sysreset) = {
30 .name = "axp_sysreset",
31 .id = UCLASS_SYSRESET,
32 .ops = &axp_sysreset_ops,
36 static int axp_pmic_reg_count(struct udevice *dev)
38 /* TODO: Get the specific value from driver data. */
42 static struct dm_pmic_ops axp_pmic_ops = {
43 .reg_count = axp_pmic_reg_count,
45 .write = dm_i2c_write,
48 static int axp_pmic_bind(struct udevice *dev)
52 ret = dm_scan_fdt_dev(dev);
56 if (CONFIG_IS_ENABLED(SYSRESET)) {
57 ret = device_bind_driver_to_node(dev, "axp_sysreset", "axp_sysreset",
58 dev_ofnode(dev), NULL);
66 static const struct udevice_id axp_pmic_ids[] = {
67 { .compatible = "x-powers,axp152" },
68 { .compatible = "x-powers,axp202" },
69 { .compatible = "x-powers,axp209" },
70 { .compatible = "x-powers,axp221" },
71 { .compatible = "x-powers,axp223" },
72 { .compatible = "x-powers,axp803" },
73 { .compatible = "x-powers,axp806" },
74 { .compatible = "x-powers,axp809" },
75 { .compatible = "x-powers,axp813" },
79 U_BOOT_DRIVER(axp_pmic) = {
82 .of_match = axp_pmic_ids,
83 .bind = axp_pmic_bind,