2 * Copyright (c) 2017 Google, Inc
3 * Written by Simon Glass <sjg@chromium.org>
5 * SPDX-License-Identifier: GPL-2.0+
10 #include <dm/of_addr.h>
12 #include <linux/ioport.h>
14 int dev_read_resource(struct udevice *dev, uint index, struct resource *res)
16 ofnode node = dev_ofnode(dev);
19 if (ofnode_is_np(node)) {
20 return of_address_to_resource(ofnode_to_np(node), index, res);
24 struct fdt_resource fres;
27 ret = fdt_get_resource(gd->fdt_blob, ofnode_to_offset(node),
31 memset(res, '\0', sizeof(*res));
32 res->start = fres.start;