blob: a581a1f6dc15018eec284f1990bde8b79303a669 [file] [log] [blame]
Paul Barkerda981cc2024-02-27 20:40:31 +00001// SPDX-License-Identifier: GPL-2.0+
2/*
3 * Copyright (C) 2023 Renesas Electronics Corporation
4 */
5
6#include <dm.h>
7#include <dm/device-internal.h>
8#include <dm/lists.h>
9#include <i2c.h>
10#include <power/pmic.h>
11
12#define RAA215300_REG_COUNT 0x80
13
14static int raa215300_reg_count(struct udevice *dev)
15{
16 return RAA215300_REG_COUNT;
17}
18
19static struct dm_pmic_ops raa215300_ops = {
20 .reg_count = raa215300_reg_count,
21 .read = dm_i2c_read,
22 .write = dm_i2c_write,
23};
24
25static const struct udevice_id raa215300_ids[] = {
26 { .compatible = "renesas,raa215300" },
27 { /* sentinel */ }
28};
29
30static int raa215300_bind(struct udevice *dev)
31{
Paul Barker647032792024-02-27 20:40:34 +000032 if (IS_ENABLED(CONFIG_SYSRESET_RAA215300)) {
33 struct driver *drv = lists_driver_lookup_name("raa215300_sysreset");
34 if (!drv)
35 return -ENOENT;
36
37 return device_bind(dev, drv, dev->name, NULL, dev_ofnode(dev),
38 NULL);
39 }
40
Paul Barkerda981cc2024-02-27 20:40:31 +000041 return 0;
42}
43
44U_BOOT_DRIVER(raa215300_pmic) = {
45 .name = "raa215300_pmic",
46 .id = UCLASS_PMIC,
47 .of_match = raa215300_ids,
48 .bind = raa215300_bind,
49 .ops = &raa215300_ops,
50};