Skip to content

Commit

Permalink
Merge tag 'rpmsg-v4.14' of git://github.com/andersson/remoteproc
Browse files Browse the repository at this point in the history
Pull rpmsg updates from Bjorn Andersson:
 "This extends the Qualcomm GLINK implementation to support the
  additional features used for communicating with modem and DSP
  coprocessors in modern Qualcomm platforms.

  In addition to this there's support for placing virtio RPMSG buffers
  in non-System RAM"

* tag 'rpmsg-v4.14' of git://github.com/andersson/remoteproc: (29 commits)
  rpmsg: glink: initialize ret to zero to ensure error status check is correct
  rpmsg: glink: fix null pointer dereference on a null intent
  dt-bindings: soc: qcom: Extend GLINK to cover SMEM
  remoteproc: qcom: adsp: Allow defining GLINK edge
  rpmsg: glink: Export symbols from common code
  rpmsg: glink: Release idr lock before returning on error
  rpmsg: glink: Handle remote rx done command
  rpmsg: glink: Request for intents when unavailable
  rpmsg: glink: Use the intents passed by remote
  rpmsg: glink: Receive and store the remote intent buffers
  rpmsg: glink: Add announce_create ops and preallocate intents
  rpmsg: glink: Add rx done command
  rpmsg: glink: Make RX FIFO peak accessor to take an offset
  rpmsg: glink: Use the local intents when receiving data
  rpmsg: glink: Add support for TX intents
  rpmsg: glink: Fix idr_lock from mutex to spinlock
  rpmsg: glink: Add support for transport version negotiation
  rpmsg: glink: Introduce glink smem based transport
  rpmsg: glink: Do a mbox_free_channel in remove
  rpmsg: glink: Return -EAGAIN when there is no FIFO space
  ...
  • Loading branch information
Linus Torvalds committed Sep 9, 2017
2 parents d7efc35 + ed43d09 commit 7151202
Show file tree
Hide file tree
Showing 16 changed files with 2,210 additions and 971 deletions.
7 changes: 4 additions & 3 deletions Documentation/devicetree/bindings/remoteproc/qcom,adsp.txt
Original file line number Diff line number Diff line change
Expand Up @@ -63,9 +63,10 @@ on the Qualcomm ADSP Hexagon core.


= SUBNODES
The adsp node may have an subnode named "smd-edge" that describes the SMD edge,
channels and devices related to the ADSP. See ../soc/qcom/qcom,smd.txt for
details on how to describe the SMD edge.
The adsp node may have an subnode named either "smd-edge" or "glink-edge" that
describes the communication edge, channels and devices related to the ADSP.
See ../soc/qcom/qcom,smd.txt and ../soc/qcom/qcom,glink.txt for details on how
to describe these.


= EXAMPLE
Expand Down
5 changes: 5 additions & 0 deletions Documentation/devicetree/bindings/remoteproc/qcom,q6v5.txt
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,11 @@ the memory regions used by the Hexagon firmware. Each sub-node must contain:
Value type: <phandle>
Definition: reference to the reserved-memory for the region

The Hexagon node may also have an subnode named either "smd-edge" or
"glink-edge" that describes the communication edge, channels and devices
related to the Hexagon. See ../soc/qcom/qcom,smd.txt and
../soc/qcom/qcom,glink.txt for details on how to describe these.

= EXAMPLE
The following example describes the resources needed to boot control the
Hexagon, as it is found on MSM8974 boards.
Expand Down
13 changes: 7 additions & 6 deletions Documentation/devicetree/bindings/soc/qcom/qcom,glink.txt
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
Qualcomm RPM GLINK binding
Qualcomm GLINK edge binding

This binding describes the Qualcomm RPM GLINK, a fifo based mechanism for
communication with the Resource Power Management system on various Qualcomm
platforms.
This binding describes a Qualcomm GLINK edge, a fifo based mechanism for
communication between subsystem-pairs on various Qualcomm platforms. Two types
of edges can be described by the binding; the GLINK RPM edge and a SMEM based
edge.

- compatible:
Usage: required
Usage: required for glink-rpm
Value type: <stringlist>
Definition: must be "qcom,glink-rpm"

Expand All @@ -16,7 +17,7 @@ platforms.
signal this processor about communication related events

- qcom,rpm-msg-ram:
Usage: required
Usage: required for glink-rpm
Value type: <prop-encoded-array>
Definition: handle to RPM message memory resource

Expand Down
1 change: 1 addition & 0 deletions drivers/remoteproc/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ config QCOM_ADSP_PIL
depends on OF && ARCH_QCOM
depends on QCOM_SMEM
depends on RPMSG_QCOM_SMD || (COMPILE_TEST && RPMSG_QCOM_SMD=n)
depends on RPMSG_QCOM_GLINK_SMEM || RPMSG_QCOM_GLINK_SMEM=n
select MFD_SYSCON
select QCOM_MDT_LOADER
select QCOM_RPROC_COMMON
Expand Down
3 changes: 3 additions & 0 deletions drivers/remoteproc/qcom_adsp_pil.c
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ struct qcom_adsp {
void *mem_region;
size_t mem_size;

struct qcom_rproc_glink glink_subdev;
struct qcom_rproc_subdev smd_subdev;
struct qcom_rproc_ssr ssr_subdev;
};
Expand Down Expand Up @@ -400,6 +401,7 @@ static int adsp_probe(struct platform_device *pdev)
goto free_rproc;
}

qcom_add_glink_subdev(rproc, &adsp->glink_subdev);
qcom_add_smd_subdev(rproc, &adsp->smd_subdev);
qcom_add_ssr_subdev(rproc, &adsp->ssr_subdev, desc->ssr_name);

Expand All @@ -422,6 +424,7 @@ static int adsp_remove(struct platform_device *pdev)
qcom_smem_state_put(adsp->state);
rproc_del(adsp->rproc);

qcom_remove_glink_subdev(adsp->rproc, &adsp->glink_subdev);
qcom_remove_smd_subdev(adsp->rproc, &adsp->smd_subdev);
qcom_remove_ssr_subdev(adsp->rproc, &adsp->ssr_subdev);
rproc_free(adsp->rproc);
Expand Down
49 changes: 49 additions & 0 deletions drivers/remoteproc/qcom_common.c
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,13 @@
#include <linux/module.h>
#include <linux/notifier.h>
#include <linux/remoteproc.h>
#include <linux/rpmsg/qcom_glink.h>
#include <linux/rpmsg/qcom_smd.h>

#include "remoteproc_internal.h"
#include "qcom_common.h"

#define to_glink_subdev(d) container_of(d, struct qcom_rproc_glink, subdev)
#define to_smd_subdev(d) container_of(d, struct qcom_rproc_subdev, subdev)
#define to_ssr_subdev(d) container_of(d, struct qcom_rproc_ssr, subdev)

Expand All @@ -49,6 +51,53 @@ struct resource_table *qcom_mdt_find_rsc_table(struct rproc *rproc,
}
EXPORT_SYMBOL_GPL(qcom_mdt_find_rsc_table);

static int glink_subdev_probe(struct rproc_subdev *subdev)
{
struct qcom_rproc_glink *glink = to_glink_subdev(subdev);

glink->edge = qcom_glink_smem_register(glink->dev, glink->node);

return IS_ERR(glink->edge) ? PTR_ERR(glink->edge) : 0;
}

static void glink_subdev_remove(struct rproc_subdev *subdev)
{
struct qcom_rproc_glink *glink = to_glink_subdev(subdev);

qcom_glink_smem_unregister(glink->edge);
glink->edge = NULL;
}

/**
* qcom_add_glink_subdev() - try to add a GLINK subdevice to rproc
* @rproc: rproc handle to parent the subdevice
* @glink: reference to a GLINK subdev context
*/
void qcom_add_glink_subdev(struct rproc *rproc, struct qcom_rproc_glink *glink)
{
struct device *dev = &rproc->dev;

glink->node = of_get_child_by_name(dev->parent->of_node, "glink-edge");
if (!glink->node)
return;

glink->dev = dev;
rproc_add_subdev(rproc, &glink->subdev, glink_subdev_probe, glink_subdev_remove);
}
EXPORT_SYMBOL_GPL(qcom_add_glink_subdev);

/**
* qcom_remove_glink_subdev() - remove a GLINK subdevice from rproc
* @rproc: rproc handle
* @glink: reference to a GLINK subdev context
*/
void qcom_remove_glink_subdev(struct rproc *rproc, struct qcom_rproc_glink *glink)
{
rproc_remove_subdev(rproc, &glink->subdev);
of_node_put(glink->node);
}
EXPORT_SYMBOL_GPL(qcom_remove_glink_subdev);

static int smd_subdev_probe(struct rproc_subdev *subdev)
{
struct qcom_rproc_subdev *smd = to_smd_subdev(subdev);
Expand Down
11 changes: 11 additions & 0 deletions drivers/remoteproc/qcom_common.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,14 @@
#include <linux/remoteproc.h>
#include "remoteproc_internal.h"

struct qcom_rproc_glink {
struct rproc_subdev subdev;

struct device *dev;
struct device_node *node;
struct qcom_glink *edge;
};

struct qcom_rproc_subdev {
struct rproc_subdev subdev;

Expand All @@ -22,6 +30,9 @@ struct resource_table *qcom_mdt_find_rsc_table(struct rproc *rproc,
const struct firmware *fw,
int *tablesz);

void qcom_add_glink_subdev(struct rproc *rproc, struct qcom_rproc_glink *glink);
void qcom_remove_glink_subdev(struct rproc *rproc, struct qcom_rproc_glink *glink);

void qcom_add_smd_subdev(struct rproc *rproc, struct qcom_rproc_subdev *smd);
void qcom_remove_smd_subdev(struct rproc *rproc, struct qcom_rproc_subdev *smd);

Expand Down
16 changes: 15 additions & 1 deletion drivers/rpmsg/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -13,16 +13,30 @@ config RPMSG_CHAR
in /dev. They make it possible for user-space programs to send and
receive rpmsg packets.

config RPMSG_QCOM_GLINK_NATIVE
tristate
select RPMSG

config RPMSG_QCOM_GLINK_RPM
tristate "Qualcomm RPM Glink driver"
select RPMSG
select RPMSG_QCOM_GLINK_NATIVE
depends on HAS_IOMEM
depends on MAILBOX
help
Say y here to enable support for the GLINK RPM communication driver,
which serves as a channel for communication with the RPM in GLINK
enabled systems.

config RPMSG_QCOM_GLINK_SMEM
tristate "Qualcomm SMEM Glink driver"
select RPMSG_QCOM_GLINK_NATIVE
depends on MAILBOX
depends on QCOM_SMEM
help
Say y here to enable support for the GLINK SMEM communication driver,
which provides support for using the GLINK communication protocol
over SMEM.

config RPMSG_QCOM_SMD
tristate "Qualcomm Shared Memory Driver (SMD)"
depends on QCOM_SMEM
Expand Down
2 changes: 2 additions & 0 deletions drivers/rpmsg/Makefile
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
obj-$(CONFIG_RPMSG) += rpmsg_core.o
obj-$(CONFIG_RPMSG_CHAR) += rpmsg_char.o
obj-$(CONFIG_RPMSG_QCOM_GLINK_RPM) += qcom_glink_rpm.o
obj-$(CONFIG_RPMSG_QCOM_GLINK_NATIVE) += qcom_glink_native.o
obj-$(CONFIG_RPMSG_QCOM_GLINK_SMEM) += qcom_glink_smem.o
obj-$(CONFIG_RPMSG_QCOM_SMD) += qcom_smd.o
obj-$(CONFIG_RPMSG_VIRTIO) += virtio_rpmsg_bus.o
Loading

0 comments on commit 7151202

Please sign in to comment.