diff options
author | Richard Zhu <Richard.Zhu@freescale.com> | 2015-08-18 08:34:15 +0800 |
---|---|---|
committer | Nitin Garg <nitin.garg@nxp.com> | 2016-01-14 11:01:23 -0600 |
commit | e6c95c9a3b924dea0988aad012737179c8ba0254 (patch) | |
tree | 88820fafb33b3c25f2035a47f1f0fcc2c6451ff1 /drivers | |
parent | 7cf74bb6ef2b5f55f9b180d601244f5be8830957 (diff) |
MLK-11498 rpmsg: imx: tell remote process about the channel
send a message to our remote processor, and tell remote
processor about this channel
Signed-off-by: Richard Zhu <Richard.Zhu@freescale.com>
(cherry picked from commit 2708c004a60c5b6da020803ee9291b83984d4a65)
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/rpmsg/Kconfig | 4 | ||||
-rw-r--r-- | drivers/rpmsg/imx_rpmsg_pingpong.c | 15 | ||||
-rw-r--r-- | drivers/rpmsg/imx_rpmsg_tty.c | 11 |
3 files changed, 26 insertions, 4 deletions
diff --git a/drivers/rpmsg/Kconfig b/drivers/rpmsg/Kconfig index e8c6ea6642f9..b0e65472d709 100644 --- a/drivers/rpmsg/Kconfig +++ b/drivers/rpmsg/Kconfig @@ -7,11 +7,11 @@ config RPMSG select VIRTUALIZATION config IMX_RPMSG_PINGPONG - tristate "IMX RPMSG pingpong driver" + tristate "IMX RPMSG pingpong driver -- loadable modules only" depends on RPMSG && m config IMX_RPMSG_TTY - tristate "IMX RPMSG tty driver" + tristate "IMX RPMSG tty driver -- loadable modules only" depends on RPMSG && m endmenu diff --git a/drivers/rpmsg/imx_rpmsg_pingpong.c b/drivers/rpmsg/imx_rpmsg_pingpong.c index e00dc102a20a..2da42657e161 100644 --- a/drivers/rpmsg/imx_rpmsg_pingpong.c +++ b/drivers/rpmsg/imx_rpmsg_pingpong.c @@ -17,6 +17,7 @@ #include <linux/virtio.h> #include <linux/rpmsg.h> +#define MSG "hello world!" #define MSG_LIMIT 100000 static unsigned int rpmsg_pingpong; static int rx_count; @@ -41,7 +42,7 @@ static void rpmsg_pingpong_cb(struct rpmsg_channel *rpdev, void *data, int len, err = rpmsg_sendto(rpdev, (void *)(&rpmsg_pingpong), 4, src); if (err) - pr_err("rpmsg_send failed: %d\n", err); + dev_err(&rpdev->dev, "rpmsg_send failed: %d\n", err); } static int rpmsg_pingpong_probe(struct rpmsg_channel *rpdev) @@ -51,11 +52,21 @@ static int rpmsg_pingpong_probe(struct rpmsg_channel *rpdev) dev_info(&rpdev->dev, "new channel: 0x%x -> 0x%x!\n", rpdev->src, rpdev->dst); + /* + * send a message to our remote processor, and tell remote + * processor about this channel + */ + err = rpmsg_send(rpdev, MSG, strlen(MSG)); + if (err) { + dev_err(&rpdev->dev, "rpmsg_send failed: %d\n", err); + return err; + } + rpmsg_pingpong = 0; rx_count = 0; err = rpmsg_sendto(rpdev, (void *)(&rpmsg_pingpong), 4, rpdev->dst); if (err) { - pr_err("rpmsg_send failed: %d\n", err); + dev_err(&rpdev->dev, "rpmsg_send failed: %d\n", err); return err; } diff --git a/drivers/rpmsg/imx_rpmsg_tty.c b/drivers/rpmsg/imx_rpmsg_tty.c index d1321a809799..14904c7d517e 100644 --- a/drivers/rpmsg/imx_rpmsg_tty.c +++ b/drivers/rpmsg/imx_rpmsg_tty.c @@ -34,6 +34,7 @@ struct rpmsgtty_port { static struct rpmsgtty_port rpmsg_tty_port; #define RPMSG_MAX_SIZE (512 - sizeof(struct rpmsg_hdr)) +#define MSG "hello world!" static void rpmsg_tty_cb(struct rpmsg_channel *rpdev, void *data, int len, void *priv, u32 src) @@ -141,6 +142,16 @@ static int rpmsg_tty_probe(struct rpmsg_channel *rpdev) dev_info(&rpdev->dev, "new channel: 0x%x -> 0x%x!\n", rpdev->src, rpdev->dst); + /* + * send a message to our remote processor, and tell remote + * processor about this channel + */ + err = rpmsg_send(rpdev, MSG, strlen(MSG)); + if (err) { + dev_err(&rpdev->dev, "rpmsg_send failed: %d\n", err); + return err; + } + rpmsgtty_driver = tty_alloc_driver(1, TTY_DRIVER_UNNUMBERED_NODE); if (IS_ERR(rpmsgtty_driver)) return PTR_ERR(rpmsgtty_driver); |