summaryrefslogtreecommitdiff
path: root/drivers/rpmsg
AgeCommit message (Collapse)Author
2018-12-24rpmsg: imx: Disable character echoing by defaultAndri Schmidt
Signed-off-by: Andri Schmidt <a.schmidt@scewo.ch> Signed-off-by: Stefan Agner <stefan.agner@toradex.com>
2018-12-24rpmsg: imx: return ENOTTY if no tty connectedStefan Agner
Return ENOTTY if no reader is using the TTY. Note that the VirtIO transport used by RPmsg currently does not use the return value of this callback, hence currently will not influence operation in any way. Signed-off-by: Stefan Agner <stefan.agner@toradex.com> Acked-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
2018-12-24rpmsg: imx: do not push data when no reader is availableStefan Agner
Pushing data while there is no reader seems to lock/crash the TTY layer in some way. Especially when a reader gets attached again, the kernel crashes with Unable to handle kernel paging request at virtual address 00002248 Also use tty_insert_flip_string which handels the copying and TTY buffer resizing if necessary. Signed-off-by: Stefan Agner <stefan.agner@toradex.com> Acked-by: Marcel Ziswiler <marcel.ziswiler@toradex.com> (cherry picked from commit 5aba75e2c61d4044bed21730b7c471822860fac1)
2018-12-24ARM: imx: define buffer count per VirtIO queueStefan Agner
Let RPMSG_NUM_BUFS to be the number of buffers per VirtIO queue, so that each queue (TX/RX) has 256 buffers. The change does not affect the number of buffers. But specifing per VirtIO queue aligns better with the way buffer sizes are specified on the FreeRTOS side (in platform_info.c). Signed-off-by: Stefan Agner <stefan.agner@toradex.com> Acked-by: Marcel Ziswiler <marcel.ziswiler@toradex.com> (cherry picked from commit 1db9a161430d3975b4b3822b91b2a14c5b8193ba)
2018-12-12Merge tag 'v4.9.144' into 4.9-2.3.x-imxMarcel Ziswiler
This is the 4.9.144 stable release
2018-11-13rpmsg: smd: fix memory leak on channel createColin Ian King
commit 940c620d6af8fca7d115de40f19870fba415efac upstream. Currently a failed allocation of channel->name leads to an immediate return without freeing channel. Fix this by setting ret to -ENOMEM and jumping to an exit path that kfree's channel. Detected by CoverityScan, CID#1473692 ("Resource Leak") Fixes: 53e2822e56c7 ("rpmsg: Introduce Qualcomm SMD backend") Cc: stable@vger.kernel.org Signed-off-by: Colin Ian King <colin.king@canonical.com> Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-08-24MLK-18660-4 rpmsg: imx: add the pm opsRichard Zhu
Add the power management operations into imx rpmsg driver. Signed-off-by: Richard Zhu <hongxing.zhu@nxp.com>
2018-08-24MLK-18308-1: rpmsg: imx_rpmsg: initialize spinlock before usingRobin Gong
Initialize spinlock before using, otherwise the below oops triggered if CONFIG_DEBUG_SPINLOCK enabled. BUG: spinlock bad magic on CPU#0, kthreadd/2 lock: imx_rpmsg_vprocs+0x1240/0x24a0, .magic: 00000000, .owner: <none>/-1, .ow0 CPU: 0 PID: 2 Comm: kthreadd Not tainted 4.9.88-04946-gf984c92 #324 Hardware name: Freescale i.MX7ULP (Device Tree) [<8010ea64>] (unwind_backtrace) from [<8010b184>] (show_stack+0x10/0x14) [<8010b184>] (show_stack) from [<803c3a8c>] (dump_stack+0x78/0x8c) [<803c3a8c>] (dump_stack) from [<8016a744>] (do_raw_spin_lock+0xc4/0x120) [<8016a744>] (do_raw_spin_lock) from [<809f7448>] (_raw_spin_lock_irqsave+0x20/) [<809f7448>] (_raw_spin_lock_irqsave) from [<807bcdc8>] (imx_mu_rpmsg_isr+0x38/) [<807bcdc8>] (imx_mu_rpmsg_isr) from [<801722d8>] (__handle_irq_event_percpu+0x) [<801722d8>] (__handle_irq_event_percpu) from [<8017237c>] (handle_irq_event_pe) [<8017237c>] (handle_irq_event_percpu) from [<801723f0>] (handle_irq_event+0x38) [<801723f0>] (handle_irq_event) from [<801757f4>] (handle_fasteoi_irq+0xd0/0x1a) [<801757f4>] (handle_fasteoi_irq) from [<80171594>] (generic_handle_irq+0x24/0x) [<80171594>] (generic_handle_irq) from [<80171abc>] (__handle_domain_irq+0x7c/0) [<80171abc>] (__handle_domain_irq) from [<801014e8>] (gic_handle_irq+0x48/0x8c) [<801014e8>] (gic_handle_irq) from [<8010bb8c>] (__irq_svc+0x6c/0xa8) Signed-off-by: Robin Gong <yibin.gong@nxp.com>
2018-08-24MLK-17837-01 input: misc: rpmsg_input: add rpmsg virtual sensor driverFugang Duan
NXP i.MX7ULP EVK boards all sensors connect with M4 core, A core has to conmunicate with sensors by virtual io bus like rpmsg bus. The driver implement the virtual sensor input driver to configure sensors active/idle/delay actions and report the sensors' event to user space. Supply below sysfs for user to enable/disable detector and counter, set poll delay: /sys/class/misc/step_counter/enable /sys/class/misc/step_detector/enable /sys/class/misc/step_counter/poll_delay Reviewed-by: Elven Wang <elven.wang@nxp.com> Signed-off-by: Fugang Duan <fugang.duan@nxp.com>
2018-08-24MLK-16595 rpmsg: imx: enable multi-core string demoRichard Zhu
Because that there are two M4 cores on iMX8QM. Enable the multi-core string echo support. BuildInfo: - SCFW a6fd9a48, IMX-MKIMAGE 0, ATF 0 - U-Boot 2017.03-imx_v2017.03_4.9.11_imx8_alpha+g258936c Reviewed-by: Frank Li <frank.li@nxp.com> Signed-off-by: Richard Zhu <hongxing.zhu@nxp.com>
2018-08-24MLK-16586-3 rpmsg: imx: enable multi-core rpmsgRichard Zhu
- Init multi-core mu power and clk. - enable the multi-core rpmsg support BuildInfo: - SCFW a6fd9a48, IMX-MKIMAGE 0, ATF 0 - U-Boot 2017.03-imx_v2017.03_4.9.11_imx8_alpha+g258936c Signed-off-by: Richard Zhu <hongxing.zhu@nxp.com> Reviewed-by: Robin Gong <yibin.gong@nxp.com> Tested-by: Andy Duan <fugang.duan@nxp.com>
2018-08-24MLK-16564-01 gpio: imx-rpmsg: add rpmsg virtual gpio driverFugang Duan
Add rpmsg virtual gpio driver support. i.MX7ULP GPIO PTA and PTB resource are managed by M4 core, setup one simple protocol with M4 core based on RPMSG virtual IO to let A core access such GPIOs that is what the driver do. Reviewed-by: Richard Zhu <hongxing.zhu@nxp.com> Reviewed-by: Robin Gong <yibin.gong@nxp.com> Signed-off-by: Fugang Duan <fugang.duan@nxp.com>
2018-08-24MLK-16530-3 rpmsg: imx: init mu and limit the pingpong cyclesRichard Zhu
- Init mu power and clk. - Change the cycles of the pingpong demot refer to the limitation of M4 side. When the received data larger than 100, the pingpong of M4 side would be finished. BuildInfo: SCFW 9e9f6ec6, IMX-MKIMAGE 0, ATF 0 Signed-off-by: Richard Zhu <hongxing.zhu@nxp.com>
2018-08-24MLK-16371-2 rpmsg: imx: add the rpmsg for imx8qxpRichard Zhu
Add rpmsg support for imx8qxp. The pingpong demo had been verified on 8qxp platforms. Use memset_io replace memset, because that the memory type of rpvq->addr is strong order type. There would be kernel dump when memset is used on imx8qxp. Signed-off-by: Richard Zhu <hongxing.zhu@nxp.com>
2018-08-24rpmsg: Introduce a driver override mechanismBjorn Andersson
Similar to other subsystems it's useful to provide a mechanism to force a specific driver match on a device, so introduce this. Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
2018-08-24rpmsg: cleanup incorrect function in dev_err messageHenri Roosen
Trivial cleanup for incorrect function in dev_err message Signed-off-by: Henri Roosen <henri.roosen@ginzinger.com> Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
2018-08-24rpmsg: unlock on error in rpmsg_eptdev_read()Dan Carpenter
We should unlock before returning if skb_dequeue() returns a NULL. Fixes: c0cdc19f84a4 ("rpmsg: Driver for user space endpoint interface") Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com> Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
2018-08-24rpmsg: Driver for user space endpoint interfaceBjorn Andersson
This driver allows rpmsg instances to expose access to rpmsg endpoints to user space processes. It provides a control interface, allowing userspace to export endpoints and an endpoint interface for each exposed endpoint. The implementation is based on prior art by Texas Instrument, Google, PetaLogix and was derived from a FreeRTOS performance statistics driver written by Michal Simek. The control interface provides a "create endpoint" ioctl, which is fed a name, source and destination address. The three values are used to create the endpoint, in a backend-specific way, and a rpmsg endpoint device is created - with the three parameters are available in sysfs for udev usage. E.g. to create an endpoint device for one of the Qualcomm SMD channel related to DIAG one would issue: struct rpmsg_endpoint_info info = { "DIAG_CNTL", 0, 0 }; int fd = open("/dev/rpmsg_ctrl0", O_RDWR); ioctl(fd, RPMSG_CREATE_EPT_IOCTL, &info); Each created endpoint device shows up as an individual character device in /dev, allowing permission to be controlled on a per-endpoint basis. The rpmsg endpoint will be created and destroyed following the opening and closing of the endpoint device, allowing rpmsg backends to open and close the physical channel, if supported by the wire protocol. Cc: Marek Novak <marek.novak@nxp.com> Cc: Matteo Sartori <matteo.sartori@t3lab.it> Cc: Michal Simek <monstr@monstr.eu> Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
2018-08-24MLK-16114: RPMSG: Fixed ulp can't boot after e12586Frank Li
Need call MU_Init before call other function Signed-off-by: Frank Li <Frank.Li@nxp.com> Signed-off-by: Shenwei Wang <shenwei.wang@nxp.com>
2018-08-24MLK-14659 rpmsg: imx: tty: restore support for imx7dOctavian Purdila
Commit 2a596c353234 ("MLK-13981-2 rpmsg: imx: enable rpmsg virt tty") enabled support for imx7ulp but it broke support for imx7d since the currently distributed M4 image for imx7d still uses the old "rpmsg-openamp-demo-channel" naming. While we could change the channel name in the M4 image it is better to maintain backwards compatibility, so add the old naming back to the id table. Signed-off-by: Octavian Purdila <octavian.purdila@nxp.com>
2018-08-24MLK-14619 input: keyboard: rpmsg-keys: add rpmsg-keys driverRobin Gong
Add rpmsg-keys driver on i.mx7ulp-evk board since vol+/vol- keys are connected on m4 side and have to get the status of keys by rpmsg. Signed-off-by: Robin Gong <yibin.gong@nxp.com> [Irina: updated for 4.9 APIs] Signed-off-by: Irina Tirdea <irina.tirdea@nxp.com>
2018-08-24MLK-14487-2 rpmsg: imx: validate the rpmsg on imx7ulpRichard Zhu
- add the .data into the imx_rpmsg_dt_ids table, thus the driver can distinguish the different platforms. Signed-off-by: Richard Zhu <hongxing.zhu@nxp.com> Tested-by: Daniel Baluta <daniel.baluta@nxp.com>
2018-08-24MLK-14487-1 rpmsg: imx: validate the rpmsg on imx7ulpRichard Zhu
- change the module_init to subsys_initcall. Otherwise, the pf1550-rpmsg would be invoked before the rpmsg bus driver on imx7ulp. Then, sdhc wouldn't be powered up properly if pf1550 isn't functional. - remove the no longer used imc_rpmsg_exit. - pass the real device id if the shared irq is requested. Signed-off-by: Richard Zhu <hongxing.zhu@nxp.com> Tested-by: Daniel Baluta <daniel.baluta@nxp.com>
2018-08-24MLK-14439-4 rpmsg: imx: setup the imx rpmsg driverRichard Zhu
- move imx_rpmsg from arch/arm/ to drivers/rpmsg. - use the new MU generic APIs in the rpmsg implementation. - Validated the pingpong test on both imx6sx and imx7d sdb boards. Signed-off-by: Richard Zhu <hongxing.zhu@nxp.com>
2018-08-24MLK-13981-2 rpmsg: imx: enable rpmsg virt ttyRichard Zhu
Message can be transferred between remote device and iMX7ULP M4. Then the message can be transferred between A7 and M4 by rpmsg channel. demo howto: - insmode the imx_rpmsg_tty.ko module after login A7/Linux. - Receive messages. Used the following command to dump out the msg from the virtual tty. ./unit_tests/mxc_mcc_tty_test.out /dev/ttyRPMSG 115200 R 100 1000 & - Send: use the following command to send the message to M4. echo <your string message> /dev/ttyRPMSG Signed-off-by: Richard Zhu <hongxing.zhu@nxp.com>
2018-08-24MLK-13887: rpmsg: virtio_rpmsg_bus: fix high memory caseRobin Gong
rpmsg core didn't take care of high memory case which may be triggered in 1:3 kernel/userspace memory split. Get correct page by vmalloc_to_page instead of virt_to_page. Signed-off-by: Robin Gong <yibin.gong@nxp.com>
2018-08-24MLK-12265 rpmsg: imx: set the imx rpmsg tests be moduleRichard Zhu
Set the imx rpmsg tests to be module in defaut. Signed-off-by: Richard Zhu <hongxing.zhu@nxp.com> (cherry picked from commit 20adce35ef6abfd6b0a52207febe069c7f09a1be)
2018-08-24MLK-11498 rpmsg: imx: tell remote process about the channelRichard Zhu
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)
2018-08-23MLK-11286-3 rpmsg: imx: enable rpmsg tests on imxRichard Zhu
enable the rpmsg pingpong and tty string echo tests on imx amp socs - pingpong test howto insmod imx_rpmsg_pingpong.ko - tty string echo test howto - step 1, load the imx_rpmsg_tty.ko insmod imx_rpmsg_tty.ko - step 2, lanunch the mxc_mcc_tty_test.out in backend ./mxc_mcc_tty_test.out /dev/ttyRPMSG 115200 R 512 512 & - step 3, issue the echo command echo <string> > /dev/ttyRPMSG Signed-off-by: Richard Zhu <Richard.Zhu@freescale.com>
2018-07-03rpmsg: smd: do not use mananged resources for endpoints and channelsSrinivas Kandagatla
commit 4a2e84c6ed85434ce7843e4844b4d3263f7e233b upstream. All the managed resources would be freed by the time release function is invoked. Handling such memory in qcom_smd_edge_release() would do bad things. Found this issue while testing Audio usecase where the dsp is started up and shutdown in a loop. This patch fixes this issue by using simple kzalloc for allocating channel->name and channel which is then freed in qcom_smd_edge_release(). Without this patch restarting a remoteproc would crash the system. Fixes: 53e2822e56c7 ("rpmsg: Introduce Qualcomm SMD backend") Cc: <stable@vger.kernel.org> Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org> Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-01-26rpmsg: virtio_rpmsg_bus: fix channel creationLoic Pallardy
commit 63447646ac657fde00bb658ce21a3431940ae0ad upstream. Since commit 4dffed5b3ac796b ("rpmsg: Name rpmsg devices based on channel id"), it is no more possible for a firmware to register twice a service (on different endpoints). rpmsg_register_device function is failing when calling device_add for the second time as second device has the same name as first one already register. It is because name is based only on service name and so is not more unique. Previously name was unique thanks to the use of rpmsg_dev_index. This patch adds destination and source endpoint numbers device name to create an unique identifier. Fixes: 4dffed5b3ac7 ("rpmsg: Name rpmsg devices based on channel id") Acked-by: Peter Griffin <peter.griffin@linaro.org> Signed-off-by: Loic Pallardy <loic.pallardy@st.com> [bjorn: flipped name and address in device name] Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-01-12rpmsg: qcom_smd: Correct return value for O_NONBLOCKBjorn Andersson
commit 1d74e7ed5dc1903ac081574a9b6aa94e7ba4ad45 upstream. qcom_smd_send() should return -EAGAIN for non-blocking channels with insufficient space, so that we can propagate this event to user space. Fixes: 53e2822e56c7 ("rpmsg: Introduce Qualcomm SMD backend") Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-09-12rpmsg: smd: fix dependency on QCOM_SMD=nArnd Bergmann
The ARM allmodconfig build broke with the addition of the SMD rpmsg driver that conflicts with the driver its replaces: WARNING: drivers/soc/qcom/smd: 'qcom_smd_register_edge' exported twice. Previous export was in drivers/rpmsg/qcom_smd.ko WARNING: drivers/soc/qcom/smd: 'qcom_smd_unregister_edge' exported twice. Previous export was in drivers/rpmsg/qcom_smd.ko There is already a dependency that is meant to avoid the broken configuration, but that only prevents the case where at least one of the two are built-in, but not if both are modules. This changes the dependency to "=n", to ensure that the new driver can only be enabled if the other one is completely disabled. Signed-off-by: Arnd Bergmann <arnd@arndb.de> Fixes: 53e2822e56c7 ("rpmsg: Introduce Qualcomm SMD backend") Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
2016-09-08rpmsg: Introduce Qualcomm SMD backendBjorn Andersson
This introduces a new rpmsg backend for the Qualcomm SMD system, allowing communication with various remote processors found in Qualcomm platforms. The implementation is based on, and intends to replace, drivers/soc/qcom/smd.c with the necessary adaptions for fitting with the rpmsg core. Based on original work by Sricharan R <sricharan@codeaurora.org> Cc: Sricharan R <sricharan@codeaurora.org> Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
2016-09-08rpmsg: Allow callback to return errorsBjorn Andersson
Some rpmsg backends support holding on to and redelivering messages upon failed handling of them, so provide a way for the callback to report and error and allow the backends to handle this. Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
2016-09-08rpmsg: Move virtio specifics from public headerBjorn Andersson
Move virtio rpmsg implementation details from the public header file to the virtio rpmsg implementation. Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
2016-09-08rpmsg: virtio: Hide vrp pointer from the public APIBjorn Andersson
Create a container struct virtio_rpmsg_channel around the rpmsg_channel to keep virtio backend information separate from the rpmsg and public API. This makes the public structures independant of virtio. Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
2016-09-08rpmsg: Hide rpmsg indirection tablesBjorn Andersson
Move the device and endpoint indirection tables to the rpmsg internal header file, to hide them from the public API. Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
2016-09-08rpmsg: Split rpmsg core and virtio backendBjorn Andersson
Extract the generic rpmsg core functionality from the virtio rpmsg implementation, splitting the implementation in a rpmsg core and a virtio backend. Based on initial work by Sricharan R <sricharan@codeaurora.org> Cc: Sricharan R <sricharan@codeaurora.org> Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
2016-09-08rpmsg: Split off generic tail of create_channel()Bjorn Andersson
The tail of create_channel() is common among all rpmsg backends, so split it off from the virtio specific part to allow it to be extracted to the rpmsg core. Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
2016-09-08rpmsg: Move helper for finding rpmsg devices to coreBjorn Andersson
Extract and move the helper function for finding rpmsg child devices to the core. Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
2016-09-08rpmsg: Move endpoint related interface to rpmsg coreBjorn Andersson
Move the rpmsg_send() and rpmsg_destroy_ept() interface to the rpmsg core, so that we eventually can hide the rpmsg_endpoint ops from the public API. Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
2016-09-08rpmsg: Indirection table for rpmsg_endpoint operationsBjorn Andersson
Add indirection table for rpmsg_endpoint related operations and move virtio implementation behind this, this finishes of the decoupling of the virtio implementation from the public API. Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
2016-09-08rpmsg: Move rpmsg_device API to new fileBjorn Andersson
Extract the now indirect rpmsg_create_ept() interface to a separate file and start building up a rpmsg core. Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
2016-09-08rpmsg: Introduce indirection table for rpmsg_device operationsBjorn Andersson
To allow for multiple backend implementations add an indireection table for rpmsg_device related operations and move the virtio implementation behind this table. Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
2016-09-08rpmsg: Clean up rpmsg device vs channel namingBjorn Andersson
The rpmsg device representing struct is called rpmsg_channel and the variable name used throughout is rpdev, with the communication happening on endpoints it's clearer to just call this a "device" in a public API. Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
2016-09-08rpmsg: Make rpmsg_create_ept() take channel_info structBjorn Andersson
As we introduce support for additional rpmsg backends, some of these only supports point-to-point "links" represented by a name. By making rpmsg_create_ept() take a channel_info struct we allow for these backends to either be passed a source address, a destination address or a name identifier. Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
2016-09-08rpmsg: rpmsg_send() operations takes rpmsg_endpointBjorn Andersson
The rpmsg_send() operations has been taking a rpmsg_device, but this forces users of secondary rpmsg_endpoints to use the rpmsg_sendto() interface - by extracting source and destination from the given data structures. If we instead pass the rpmsg_endpoint to these functions a service can use rpmsg_sendto() to respond to messages, even on secondary endpoints. In addition this would allow us to support operations on multiple channels in future backends that does not support off-channel operations. Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
2016-09-08rpmsg: Name rpmsg devices based on channel idBjorn Andersson
By basing rpmsg device names on channel id we end up with human readable device names in sysfs and debug logs. Reviewed-by: Sarangdhar Joshi <spjoshi@codeaurora.org> Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
2016-09-08rpmsg: Enable matching devices with drivers based on DTBjorn Andersson
Make it possible to match rpmsg devices based on device tree node, in addition to the id table. In some of these cases the rpmsg driver would not have a id_table, so make this optional. Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>