Commit 521f3970 authored by Linus Torvalds's avatar Linus Torvalds

Merge tag 'rpmsg-v4.9' of git://github.com/andersson/remoteproc

Pull rpmsg updates from Bjorn Andersson:
 "The bulk of these patches involve splitting the rpmsg implementation
  into a framework/API part and a virtio specific backend part. It then
  adds the Qualcomm Shared Memory Device (SMD) as an additional
  supported wire format.

  Also included is a set of code style cleanups that have been lingering
  for a while"

* tag 'rpmsg-v4.9' of git://github.com/andersson/remoteproc: (26 commits)
  rpmsg: smd: fix dependency on QCOM_SMD=n
  rpmsg: Introduce Qualcomm SMD backend
  rpmsg: Allow callback to return errors
  rpmsg: Move virtio specifics from public header
  rpmsg: virtio: Hide vrp pointer from the public API
  rpmsg: Hide rpmsg indirection tables
  rpmsg: Split rpmsg core and virtio backend
  rpmsg: Split off generic tail of create_channel()
  rpmsg: Move helper for finding rpmsg devices to core
  rpmsg: Move endpoint related interface to rpmsg core
  rpmsg: Indirection table for rpmsg_endpoint operations
  rpmsg: Move rpmsg_device API to new file
  rpmsg: Introduce indirection table for rpmsg_device operations
  rpmsg: Clean up rpmsg device vs channel naming
  rpmsg: Make rpmsg_create_ept() take channel_info struct
  rpmsg: rpmsg_send() operations takes rpmsg_endpoint
  rpmsg: Name rpmsg devices based on channel id
  rpmsg: Enable matching devices with drivers based on DT
  rpmsg: Drop prototypes for non-existing functions
  samples/rpmsg: add support for multiple instances
  ...
parents d880e5ad 395317bb
...@@ -17,7 +17,7 @@ config OMAP_REMOTEPROC ...@@ -17,7 +17,7 @@ config OMAP_REMOTEPROC
select REMOTEPROC select REMOTEPROC
select MAILBOX select MAILBOX
select OMAP2PLUS_MBOX select OMAP2PLUS_MBOX
select RPMSG select RPMSG_VIRTIO
help help
Say y here to support OMAP's remote processors (dual M3 Say y here to support OMAP's remote processors (dual M3
and DSP on OMAP4) via the remote processor framework. and DSP on OMAP4) via the remote processor framework.
...@@ -59,7 +59,7 @@ config DA8XX_REMOTEPROC ...@@ -59,7 +59,7 @@ config DA8XX_REMOTEPROC
depends on ARCH_DAVINCI_DA8XX depends on ARCH_DAVINCI_DA8XX
select CMA if MMU select CMA if MMU
select REMOTEPROC select REMOTEPROC
select RPMSG select RPMSG_VIRTIO
help help
Say y here to support DA8xx/OMAP-L13x remote processors via the Say y here to support DA8xx/OMAP-L13x remote processors via the
remote processor framework. remote processor framework.
......
...@@ -3,6 +3,20 @@ menu "Rpmsg drivers" ...@@ -3,6 +3,20 @@ menu "Rpmsg drivers"
# RPMSG always gets selected by whoever wants it # RPMSG always gets selected by whoever wants it
config RPMSG config RPMSG
tristate tristate
config RPMSG_QCOM_SMD
tristate "Qualcomm Shared Memory Driver (SMD)"
depends on QCOM_SMEM
depends on QCOM_SMD=n
select RPMSG
help
Say y here to enable support for the Qualcomm Shared Memory Driver
providing communication channels to remote processors in Qualcomm
platforms.
config RPMSG_VIRTIO
tristate
select RPMSG
select VIRTIO select VIRTIO
select VIRTUALIZATION select VIRTUALIZATION
......
obj-$(CONFIG_RPMSG) += virtio_rpmsg_bus.o obj-$(CONFIG_RPMSG) += rpmsg_core.o
obj-$(CONFIG_RPMSG_QCOM_SMD) += qcom_smd.o
obj-$(CONFIG_RPMSG_VIRTIO) += virtio_rpmsg_bus.o
This diff is collapsed.
This diff is collapsed.
/*
* remote processor messaging bus internals
*
* Copyright (C) 2011 Texas Instruments, Inc.
* Copyright (C) 2011 Google, Inc.
*
* Ohad Ben-Cohen <ohad@wizery.com>
* Brian Swetland <swetland@google.com>
*
* This software is licensed under the terms of the GNU General Public
* License version 2, as published by the Free Software Foundation, and
* may be copied, distributed, and modified under those terms.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*/
#ifndef __RPMSG_INTERNAL_H__
#define __RPMSG_INTERNAL_H__
#include <linux/rpmsg.h>
#define to_rpmsg_device(d) container_of(d, struct rpmsg_device, dev)
#define to_rpmsg_driver(d) container_of(d, struct rpmsg_driver, drv)
/**
* struct rpmsg_device_ops - indirection table for the rpmsg_device operations
* @create_ept: create backend-specific endpoint, requried
* @announce_create: announce presence of new channel, optional
* @announce_destroy: announce destruction of channel, optional
*
* Indirection table for the operations that a rpmsg backend should implement.
* @announce_create and @announce_destroy are optional as the backend might
* advertise new channels implicitly by creating the endpoints.
*/
struct rpmsg_device_ops {
struct rpmsg_endpoint *(*create_ept)(struct rpmsg_device *rpdev,
rpmsg_rx_cb_t cb, void *priv,
struct rpmsg_channel_info chinfo);
int (*announce_create)(struct rpmsg_device *ept);
int (*announce_destroy)(struct rpmsg_device *ept);
};
/**
* struct rpmsg_endpoint_ops - indirection table for rpmsg_endpoint operations
* @destroy_ept: destroy the given endpoint, required
* @send: see @rpmsg_send(), required
* @sendto: see @rpmsg_sendto(), optional
* @send_offchannel: see @rpmsg_send_offchannel(), optional
* @trysend: see @rpmsg_trysend(), required
* @trysendto: see @rpmsg_trysendto(), optional
* @trysend_offchannel: see @rpmsg_trysend_offchannel(), optional
*
* Indirection table for the operations that a rpmsg backend should implement.
* In addition to @destroy_ept, the backend must at least implement @send and
* @trysend, while the variants sending data off-channel are optional.
*/
struct rpmsg_endpoint_ops {
void (*destroy_ept)(struct rpmsg_endpoint *ept);
int (*send)(struct rpmsg_endpoint *ept, void *data, int len);
int (*sendto)(struct rpmsg_endpoint *ept, void *data, int len, u32 dst);
int (*send_offchannel)(struct rpmsg_endpoint *ept, u32 src, u32 dst,
void *data, int len);
int (*trysend)(struct rpmsg_endpoint *ept, void *data, int len);
int (*trysendto)(struct rpmsg_endpoint *ept, void *data, int len, u32 dst);
int (*trysend_offchannel)(struct rpmsg_endpoint *ept, u32 src, u32 dst,
void *data, int len);
};
int rpmsg_register_device(struct rpmsg_device *rpdev);
int rpmsg_unregister_device(struct device *parent,
struct rpmsg_channel_info *chinfo);
struct device *rpmsg_find_device(struct device *parent,
struct rpmsg_channel_info *chinfo);
#endif
This diff is collapsed.
This diff is collapsed.
...@@ -24,38 +24,52 @@ ...@@ -24,38 +24,52 @@
#define MSG "hello world!" #define MSG "hello world!"
#define MSG_LIMIT 100 #define MSG_LIMIT 100
static void rpmsg_sample_cb(struct rpmsg_channel *rpdev, void *data, int len, struct instance_data {
int rx_count;
};
static int rpmsg_sample_cb(struct rpmsg_device *rpdev, void *data, int len,
void *priv, u32 src) void *priv, u32 src)
{ {
int ret; int ret;
static int rx_count; struct instance_data *idata = dev_get_drvdata(&rpdev->dev);
dev_info(&rpdev->dev, "incoming msg %d (src: 0x%x)\n", ++rx_count, src); dev_info(&rpdev->dev, "incoming msg %d (src: 0x%x)\n",
++idata->rx_count, src);
print_hex_dump(KERN_DEBUG, __func__, DUMP_PREFIX_NONE, 16, 1, print_hex_dump(KERN_DEBUG, __func__, DUMP_PREFIX_NONE, 16, 1,
data, len, true); data, len, true);
/* samples should not live forever */ /* samples should not live forever */
if (rx_count >= MSG_LIMIT) { if (idata->rx_count >= MSG_LIMIT) {
dev_info(&rpdev->dev, "goodbye!\n"); dev_info(&rpdev->dev, "goodbye!\n");
return; return 0;
} }
/* send a new message now */ /* send a new message now */
ret = rpmsg_send(rpdev, MSG, strlen(MSG)); ret = rpmsg_send(rpdev->ept, MSG, strlen(MSG));
if (ret) if (ret)
dev_err(&rpdev->dev, "rpmsg_send failed: %d\n", ret); dev_err(&rpdev->dev, "rpmsg_send failed: %d\n", ret);
return 0;
} }
static int rpmsg_sample_probe(struct rpmsg_channel *rpdev) static int rpmsg_sample_probe(struct rpmsg_device *rpdev)
{ {
int ret; int ret;
struct instance_data *idata;
dev_info(&rpdev->dev, "new channel: 0x%x -> 0x%x!\n", dev_info(&rpdev->dev, "new channel: 0x%x -> 0x%x!\n",
rpdev->src, rpdev->dst); rpdev->src, rpdev->dst);
idata = devm_kzalloc(&rpdev->dev, sizeof(*idata), GFP_KERNEL);
if (!idata)
return -ENOMEM;
dev_set_drvdata(&rpdev->dev, idata);
/* send a message to our remote processor */ /* send a message to our remote processor */
ret = rpmsg_send(rpdev, MSG, strlen(MSG)); ret = rpmsg_send(rpdev->ept, MSG, strlen(MSG));
if (ret) { if (ret) {
dev_err(&rpdev->dev, "rpmsg_send failed: %d\n", ret); dev_err(&rpdev->dev, "rpmsg_send failed: %d\n", ret);
return ret; return ret;
...@@ -64,7 +78,7 @@ static int rpmsg_sample_probe(struct rpmsg_channel *rpdev) ...@@ -64,7 +78,7 @@ static int rpmsg_sample_probe(struct rpmsg_channel *rpdev)
return 0; return 0;
} }
static void rpmsg_sample_remove(struct rpmsg_channel *rpdev) static void rpmsg_sample_remove(struct rpmsg_device *rpdev)
{ {
dev_info(&rpdev->dev, "rpmsg sample client driver is removed\n"); dev_info(&rpdev->dev, "rpmsg sample client driver is removed\n");
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment