mirror of
https://github.com/AsahiLinux/u-boot
synced 2025-02-17 22:49:02 +00:00
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>
This commit is contained in:
parent
ac206a0f4e
commit
5e1ff6480f
3 changed files with 10 additions and 14 deletions
|
@ -6,7 +6,6 @@
|
||||||
|
|
||||||
#include <common.h>
|
#include <common.h>
|
||||||
#include <dm.h>
|
#include <dm.h>
|
||||||
#include <fdtdec.h>
|
|
||||||
#include <mailbox.h>
|
#include <mailbox.h>
|
||||||
#include <mailbox-uclass.h>
|
#include <mailbox-uclass.h>
|
||||||
|
|
||||||
|
@ -18,7 +17,7 @@ static inline struct mbox_ops *mbox_dev_ops(struct udevice *dev)
|
||||||
}
|
}
|
||||||
|
|
||||||
static int mbox_of_xlate_default(struct mbox_chan *chan,
|
static int mbox_of_xlate_default(struct mbox_chan *chan,
|
||||||
struct fdtdec_phandle_args *args)
|
struct ofnode_phandle_args *args)
|
||||||
{
|
{
|
||||||
debug("%s(chan=%p)\n", __func__, chan);
|
debug("%s(chan=%p)\n", __func__, chan);
|
||||||
|
|
||||||
|
@ -34,24 +33,22 @@ static int mbox_of_xlate_default(struct mbox_chan *chan,
|
||||||
|
|
||||||
int mbox_get_by_index(struct udevice *dev, int index, struct mbox_chan *chan)
|
int mbox_get_by_index(struct udevice *dev, int index, struct mbox_chan *chan)
|
||||||
{
|
{
|
||||||
struct fdtdec_phandle_args args;
|
struct ofnode_phandle_args args;
|
||||||
int ret;
|
int ret;
|
||||||
struct udevice *dev_mbox;
|
struct udevice *dev_mbox;
|
||||||
struct mbox_ops *ops;
|
struct mbox_ops *ops;
|
||||||
|
|
||||||
debug("%s(dev=%p, index=%d, chan=%p)\n", __func__, dev, index, chan);
|
debug("%s(dev=%p, index=%d, chan=%p)\n", __func__, dev, index, chan);
|
||||||
|
|
||||||
ret = fdtdec_parse_phandle_with_args(gd->fdt_blob, dev_of_offset(dev),
|
ret = dev_read_phandle_with_args(dev, "mboxes", "#mbox-cells", 0, index,
|
||||||
"mboxes", "#mbox-cells", 0,
|
&args);
|
||||||
index, &args);
|
|
||||||
if (ret) {
|
if (ret) {
|
||||||
debug("%s: fdtdec_parse_phandle_with_args failed: %d\n",
|
debug("%s: dev_read_phandle_with_args failed: %d\n", __func__,
|
||||||
__func__, ret);
|
ret);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = uclass_get_device_by_of_offset(UCLASS_MAILBOX, args.node,
|
ret = uclass_get_device_by_ofnode(UCLASS_MAILBOX, args.node, &dev_mbox);
|
||||||
&dev_mbox);
|
|
||||||
if (ret) {
|
if (ret) {
|
||||||
debug("%s: uclass_get_device_by_of_offset failed: %d\n",
|
debug("%s: uclass_get_device_by_of_offset failed: %d\n",
|
||||||
__func__, ret);
|
__func__, ret);
|
||||||
|
@ -85,8 +82,7 @@ int mbox_get_by_name(struct udevice *dev, const char *name,
|
||||||
|
|
||||||
debug("%s(dev=%p, name=%s, chan=%p)\n", __func__, dev, name, chan);
|
debug("%s(dev=%p, name=%s, chan=%p)\n", __func__, dev, name, chan);
|
||||||
|
|
||||||
index = fdt_stringlist_search(gd->fdt_blob, dev_of_offset(dev),
|
index = dev_read_stringlist_search(dev, "mbox-names", name);
|
||||||
"mbox-names", name);
|
|
||||||
if (index < 0) {
|
if (index < 0) {
|
||||||
debug("fdt_stringlist_search() failed: %d\n", index);
|
debug("fdt_stringlist_search() failed: %d\n", index);
|
||||||
return index;
|
return index;
|
||||||
|
|
|
@ -72,7 +72,7 @@ static int tegra_hsp_db_id(ulong chan_id)
|
||||||
}
|
}
|
||||||
|
|
||||||
static int tegra_hsp_of_xlate(struct mbox_chan *chan,
|
static int tegra_hsp_of_xlate(struct mbox_chan *chan,
|
||||||
struct fdtdec_phandle_args *args)
|
struct ofnode_phandle_args *args)
|
||||||
{
|
{
|
||||||
debug("%s(chan=%p)\n", __func__, chan);
|
debug("%s(chan=%p)\n", __func__, chan);
|
||||||
|
|
||||||
|
|
|
@ -36,7 +36,7 @@ struct mbox_ops {
|
||||||
* @return 0 if OK, or a negative error code.
|
* @return 0 if OK, or a negative error code.
|
||||||
*/
|
*/
|
||||||
int (*of_xlate)(struct mbox_chan *chan,
|
int (*of_xlate)(struct mbox_chan *chan,
|
||||||
struct fdtdec_phandle_args *args);
|
struct ofnode_phandle_args *args);
|
||||||
/**
|
/**
|
||||||
* request - Request a translated channel.
|
* request - Request a translated channel.
|
||||||
*
|
*
|
||||||
|
|
Loading…
Add table
Reference in a new issue