MLK-18590 pmic: bd71837: Change to use new fdt API

Changed to use dev_read_subnode to get the ofnode type of the bd71837 device node.
Because the pmic_bind_children is changed to use ofnode.

Signed-off-by: Ye Li <ye.li@nxp.com>
This commit is contained in:
Ye Li 2018-06-12 19:14:29 -07:00
parent 03ecdaefd3
commit acdc5c297a
1 changed files with 5 additions and 7 deletions

View File

@ -31,7 +31,7 @@ static int bd71837_write(struct udevice *dev, uint reg, const uint8_t *buff,
int len) int len)
{ {
if (dm_i2c_write(dev, reg, buff, len)) { if (dm_i2c_write(dev, reg, buff, len)) {
error("write error to device: %p register: %#x!", dev, reg); pr_err("write error to device: %p register: %#x!", dev, reg);
return -EIO; return -EIO;
} }
@ -41,7 +41,7 @@ static int bd71837_write(struct udevice *dev, uint reg, const uint8_t *buff,
static int bd71837_read(struct udevice *dev, uint reg, uint8_t *buff, int len) static int bd71837_read(struct udevice *dev, uint reg, uint8_t *buff, int len)
{ {
if (dm_i2c_read(dev, reg, buff, len)) { if (dm_i2c_read(dev, reg, buff, len)) {
error("read error from device: %p register: %#x!", dev, reg); pr_err("read error from device: %p register: %#x!", dev, reg);
return -EIO; return -EIO;
} }
@ -51,12 +51,10 @@ static int bd71837_read(struct udevice *dev, uint reg, uint8_t *buff, int len)
static int bd71837_bind(struct udevice *dev) static int bd71837_bind(struct udevice *dev)
{ {
int children; int children;
int regulators_node; ofnode regulators_node;
const void *blob = gd->fdt_blob;
regulators_node = fdt_subnode_offset(blob, dev_of_offset(dev), regulators_node = dev_read_subnode(dev, "regulators");
"regulators"); if (!ofnode_valid(regulators_node)) {
if (regulators_node <= 0) {
debug("%s: %s regulators subnode not found!", __func__, debug("%s: %s regulators subnode not found!", __func__,
dev->name); dev->name);
return -ENXIO; return -ENXIO;