Commit 5e1ff6480fbe7cf1b2be1f8a13086b217b2f8578

Authored by Simon Glass
1 parent ac206a0f4e

dm: mailbox: Update uclass to support livetree

Update the mailbox uclass to support livetree. Fix the xlate() method
in all callers.

Signed-off-by: Simon Glass <sjg@chromium.org>

Showing 3 changed files with 10 additions and 14 deletions Side-by-side Diff

drivers/mailbox/mailbox-uclass.c
... ... @@ -6,7 +6,6 @@
6 6  
7 7 #include <common.h>
8 8 #include <dm.h>
9   -#include <fdtdec.h>
10 9 #include <mailbox.h>
11 10 #include <mailbox-uclass.h>
12 11  
... ... @@ -18,7 +17,7 @@
18 17 }
19 18  
20 19 static int mbox_of_xlate_default(struct mbox_chan *chan,
21   - struct fdtdec_phandle_args *args)
  20 + struct ofnode_phandle_args *args)
22 21 {
23 22 debug("%s(chan=%p)\n", __func__, chan);
24 23  
25 24  
26 25  
27 26  
... ... @@ -34,24 +33,22 @@
34 33  
35 34 int mbox_get_by_index(struct udevice *dev, int index, struct mbox_chan *chan)
36 35 {
37   - struct fdtdec_phandle_args args;
  36 + struct ofnode_phandle_args args;
38 37 int ret;
39 38 struct udevice *dev_mbox;
40 39 struct mbox_ops *ops;
41 40  
42 41 debug("%s(dev=%p, index=%d, chan=%p)\n", __func__, dev, index, chan);
43 42  
44   - ret = fdtdec_parse_phandle_with_args(gd->fdt_blob, dev_of_offset(dev),
45   - "mboxes", "#mbox-cells", 0,
46   - index, &args);
  43 + ret = dev_read_phandle_with_args(dev, "mboxes", "#mbox-cells", 0, index,
  44 + &args);
47 45 if (ret) {
48   - debug("%s: fdtdec_parse_phandle_with_args failed: %d\n",
49   - __func__, ret);
  46 + debug("%s: dev_read_phandle_with_args failed: %d\n", __func__,
  47 + ret);
50 48 return ret;
51 49 }
52 50  
53   - ret = uclass_get_device_by_of_offset(UCLASS_MAILBOX, args.node,
54   - &dev_mbox);
  51 + ret = uclass_get_device_by_ofnode(UCLASS_MAILBOX, args.node, &dev_mbox);
55 52 if (ret) {
56 53 debug("%s: uclass_get_device_by_of_offset failed: %d\n",
57 54 __func__, ret);
... ... @@ -85,8 +82,7 @@
85 82  
86 83 debug("%s(dev=%p, name=%s, chan=%p)\n", __func__, dev, name, chan);
87 84  
88   - index = fdt_stringlist_search(gd->fdt_blob, dev_of_offset(dev),
89   - "mbox-names", name);
  85 + index = dev_read_stringlist_search(dev, "mbox-names", name);
90 86 if (index < 0) {
91 87 debug("fdt_stringlist_search() failed: %d\n", index);
92 88 return index;
drivers/mailbox/tegra-hsp.c
... ... @@ -72,7 +72,7 @@
72 72 }
73 73  
74 74 static int tegra_hsp_of_xlate(struct mbox_chan *chan,
75   - struct fdtdec_phandle_args *args)
  75 + struct ofnode_phandle_args *args)
76 76 {
77 77 debug("%s(chan=%p)\n", __func__, chan);
78 78  
include/mailbox-uclass.h
... ... @@ -36,7 +36,7 @@
36 36 * @return 0 if OK, or a negative error code.
37 37 */
38 38 int (*of_xlate)(struct mbox_chan *chan,
39   - struct fdtdec_phandle_args *args);
  39 + struct ofnode_phandle_args *args);
40 40 /**
41 41 * request - Request a translated channel.
42 42 *