diff options
author | Cristian Marussi <cristian.marussi@arm.com> | 2020-03-27 17:34:28 +0300 |
---|---|---|
committer | Sudeep Holla <sudeep.holla@arm.com> | 2020-04-14 11:31:49 +0300 |
commit | d5141f37c42e0b833863f157ac4cee203b2ba3d2 (patch) | |
tree | 42e7b9822217fc4d06498b05f1855edb071c7c0f /drivers/firmware/arm_scmi/shmem.c | |
parent | 2264417a9a99babcc45960f28057a04c24919efb (diff) | |
download | linux-d5141f37c42e0b833863f157ac4cee203b2ba3d2.tar.xz |
firmware: arm_scmi: Add notifications support in transport layer
Add common transport-layer methods to:
- fetch a notification instead of a response
- clear a pending notification
Add also all the needed support in mailbox/shmem transports.
Link: https://lore.kernel.org/r/20200327143438.5382-4-cristian.marussi@arm.com
Reviewed-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Reviewed-by: Viresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: Cristian Marussi <cristian.marussi@arm.com>
Signed-off-by: Sudeep Holla <sudeep.holla@arm.com>
Diffstat (limited to 'drivers/firmware/arm_scmi/shmem.c')
-rw-r--r-- | drivers/firmware/arm_scmi/shmem.c | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/drivers/firmware/arm_scmi/shmem.c b/drivers/firmware/arm_scmi/shmem.c index e1e816e0018c..a5a5d0f6bf86 100644 --- a/drivers/firmware/arm_scmi/shmem.c +++ b/drivers/firmware/arm_scmi/shmem.c @@ -67,6 +67,21 @@ void shmem_fetch_response(struct scmi_shared_mem __iomem *shmem, memcpy_fromio(xfer->rx.buf, shmem->msg_payload + 4, xfer->rx.len); } +void shmem_fetch_notification(struct scmi_shared_mem __iomem *shmem, + size_t max_len, struct scmi_xfer *xfer) +{ + /* Skip only the length of header in shmem area i.e 4 bytes */ + xfer->rx.len = min_t(size_t, max_len, ioread32(&shmem->length) - 4); + + /* Take a copy to the rx buffer.. */ + memcpy_fromio(xfer->rx.buf, shmem->msg_payload, xfer->rx.len); +} + +void shmem_clear_notification(struct scmi_shared_mem __iomem *shmem) +{ + iowrite32(SCMI_SHMEM_CHAN_STAT_CHANNEL_FREE, &shmem->channel_status); +} + bool shmem_poll_done(struct scmi_shared_mem __iomem *shmem, struct scmi_xfer *xfer) { |