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
)
56 const void *blob
= gd
->fdt_blob
;
59 regulators_node
= fdt_subnode_offset(blob
, dev
->of_offset
,
61 if (regulators_node
<= 0) {
62 debug("%s: %s regulators subnode not found!", __func__
,
67 debug("%s: '%s' - found regulators subnode\n", __func__
, dev
->name
);
69 children
= pmic_bind_children(dev
, regulators_node
, pmic_children_info
);
71 debug("%s: %s - no child found\n", __func__
, dev
->name
);
73 /* Always return success for this device */
77 static struct dm_pmic_ops tps65090_ops
= {
78 .reg_count
= tps65090_reg_count
,
79 .read
= tps65090_read
,
80 .write
= tps65090_write
,
83 static const struct udevice_id tps65090_ids
[] = {
84 { .compatible
= "ti,tps65090" },
88 U_BOOT_DRIVER(pmic_tps65090
) = {
89 .name
= "tps65090 pmic",
91 .of_match
= tps65090_ids
,
92 .bind
= tps65090_bind
,