1
0
Fork 0

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)
pull/10/head
Richard Zhu 2015-08-18 08:34:15 +08:00 committed by Jason Liu
parent 608b8994d9
commit 1580c375a7
3 changed files with 26 additions and 4 deletions

View File

@ -52,11 +52,11 @@ config RPMSG_VIRTIO
select VIRTIO
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

View File

@ -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 int rpmsg_pingpong_cb(struct rpmsg_device *rpdev, void *data, int len,
err = rpmsg_sendto(rpdev->ept, (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);
return err;
}
@ -53,11 +54,21 @@ static int rpmsg_pingpong_probe(struct rpmsg_device *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->ept, 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->ept, (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;
}

View File

@ -35,6 +35,7 @@ static struct rpmsgtty_port rpmsg_tty_port;
/* this needs to be less then (RPMSG_BUF_SIZE - sizeof(struct rpmsg_hdr)) */
#define RPMSG_MAX_SIZE 256
#define MSG "hello world!"
static int rpmsg_tty_cb(struct rpmsg_device *rpdev, void *data, int len,
void *priv, u32 src)
@ -144,6 +145,16 @@ static int rpmsg_tty_probe(struct rpmsg_device *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->ept, 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);