2 * Copyright (c) 2015 Google, Inc
3 * Written by Simon Glass <sjg@chromium.org>
5 * SPDX-License-Identifier: GPL-2.0+
13 #include <power/pmic.h>
14 #include <power/tps65090.h>
16 DECLARE_GLOBAL_DATA_PTR;
18 static const struct pmic_child_info pmic_children_info[] = {
19 { .prefix = "fet", .driver = TPS65090_FET_DRIVER },
23 static int tps65090_reg_count(struct udevice *dev)
25 return TPS65090_NUM_REGS;
28 static int tps65090_write(struct udevice *dev, uint reg, const uint8_t *buff,
31 if (dm_i2c_write(dev, reg, buff, len)) {
32 error("write error to device: %p register: %#x!", dev, reg);
39 static int tps65090_read(struct udevice *dev, uint reg, uint8_t *buff, int len)
43 ret = dm_i2c_read(dev, reg, buff, len);
45 error("read error %d from device: %p register: %#x!", ret, dev,
53 static int tps65090_bind(struct udevice *dev)
55 ofnode regulators_node;
58 regulators_node = dev_read_subnode(dev, "regulators");
59 if (!ofnode_valid(regulators_node)) {
60 debug("%s: %s regulators subnode not found!", __func__,
65 debug("%s: '%s' - found regulators subnode\n", __func__, dev->name);
67 children = pmic_bind_children(dev, regulators_node, pmic_children_info);
69 debug("%s: %s - no child found\n", __func__, dev->name);
71 /* Always return success for this device */
75 static struct dm_pmic_ops tps65090_ops = {
76 .reg_count = tps65090_reg_count,
77 .read = tps65090_read,
78 .write = tps65090_write,
81 static const struct udevice_id tps65090_ids[] = {
82 { .compatible = "ti,tps65090" },
86 U_BOOT_DRIVER(pmic_tps65090) = {
87 .name = "tps65090 pmic",
89 .of_match = tps65090_ids,
90 .bind = tps65090_bind,