mirror of
https://github.com/u-boot/u-boot.git
synced 2025-04-29 01:14:45 +00:00

If SYSRESET support is enabled for the RAA215300 PMIC, we need to bind the raa215300_sysreset driver as a child device of the PMIC. Signed-off-by: Paul Barker <paul.barker.ct@bp.renesas.com> Reviewed-by: Marek Vasut <marek.vasut+renesas@mailbox.org>
50 lines
1 KiB
C
50 lines
1 KiB
C
// SPDX-License-Identifier: GPL-2.0+
|
|
/*
|
|
* Copyright (C) 2023 Renesas Electronics Corporation
|
|
*/
|
|
|
|
#include <dm.h>
|
|
#include <dm/device-internal.h>
|
|
#include <dm/lists.h>
|
|
#include <i2c.h>
|
|
#include <power/pmic.h>
|
|
|
|
#define RAA215300_REG_COUNT 0x80
|
|
|
|
static int raa215300_reg_count(struct udevice *dev)
|
|
{
|
|
return RAA215300_REG_COUNT;
|
|
}
|
|
|
|
static struct dm_pmic_ops raa215300_ops = {
|
|
.reg_count = raa215300_reg_count,
|
|
.read = dm_i2c_read,
|
|
.write = dm_i2c_write,
|
|
};
|
|
|
|
static const struct udevice_id raa215300_ids[] = {
|
|
{ .compatible = "renesas,raa215300" },
|
|
{ /* sentinel */ }
|
|
};
|
|
|
|
static int raa215300_bind(struct udevice *dev)
|
|
{
|
|
if (IS_ENABLED(CONFIG_SYSRESET_RAA215300)) {
|
|
struct driver *drv = lists_driver_lookup_name("raa215300_sysreset");
|
|
if (!drv)
|
|
return -ENOENT;
|
|
|
|
return device_bind(dev, drv, dev->name, NULL, dev_ofnode(dev),
|
|
NULL);
|
|
}
|
|
|
|
return 0;
|
|
}
|
|
|
|
U_BOOT_DRIVER(raa215300_pmic) = {
|
|
.name = "raa215300_pmic",
|
|
.id = UCLASS_PMIC,
|
|
.of_match = raa215300_ids,
|
|
.bind = raa215300_bind,
|
|
.ops = &raa215300_ops,
|
|
};
|