firmware: arm_scmi: Enable notification core
Initialize and enable SCMI notifications core support during bus/driver probe phase, so that protocols can start registering their supported events during their initialization. Link: https://lore.kernel.org/r/20200701155348.52864-5-cristian.marussi@arm.com Reviewed-by: Jonathan Cameron <Jonathan.Cameron@huawei.com> Signed-off-by: Cristian Marussi <cristian.marussi@arm.com> Signed-off-by: Sudeep Holla <sudeep.holla@arm.com>
This commit is contained in:
parent
bd31b24969
commit
6b8a69131d
@ -26,6 +26,7 @@
|
|||||||
#include <linux/slab.h>
|
#include <linux/slab.h>
|
||||||
|
|
||||||
#include "common.h"
|
#include "common.h"
|
||||||
|
#include "notify.h"
|
||||||
|
|
||||||
#define CREATE_TRACE_POINTS
|
#define CREATE_TRACE_POINTS
|
||||||
#include <trace/events/scmi.h>
|
#include <trace/events/scmi.h>
|
||||||
@ -204,11 +205,13 @@ __scmi_xfer_put(struct scmi_xfers_info *minfo, struct scmi_xfer *xfer)
|
|||||||
|
|
||||||
static void scmi_handle_notification(struct scmi_chan_info *cinfo, u32 msg_hdr)
|
static void scmi_handle_notification(struct scmi_chan_info *cinfo, u32 msg_hdr)
|
||||||
{
|
{
|
||||||
|
u64 ts;
|
||||||
struct scmi_xfer *xfer;
|
struct scmi_xfer *xfer;
|
||||||
struct device *dev = cinfo->dev;
|
struct device *dev = cinfo->dev;
|
||||||
struct scmi_info *info = handle_to_scmi_info(cinfo->handle);
|
struct scmi_info *info = handle_to_scmi_info(cinfo->handle);
|
||||||
struct scmi_xfers_info *minfo = &info->rx_minfo;
|
struct scmi_xfers_info *minfo = &info->rx_minfo;
|
||||||
|
|
||||||
|
ts = ktime_get_boottime_ns();
|
||||||
xfer = scmi_xfer_get(cinfo->handle, minfo);
|
xfer = scmi_xfer_get(cinfo->handle, minfo);
|
||||||
if (IS_ERR(xfer)) {
|
if (IS_ERR(xfer)) {
|
||||||
dev_err(dev, "failed to get free message slot (%ld)\n",
|
dev_err(dev, "failed to get free message slot (%ld)\n",
|
||||||
@ -221,6 +224,8 @@ static void scmi_handle_notification(struct scmi_chan_info *cinfo, u32 msg_hdr)
|
|||||||
scmi_dump_header_dbg(dev, &xfer->hdr);
|
scmi_dump_header_dbg(dev, &xfer->hdr);
|
||||||
info->desc->ops->fetch_notification(cinfo, info->desc->max_msg_size,
|
info->desc->ops->fetch_notification(cinfo, info->desc->max_msg_size,
|
||||||
xfer);
|
xfer);
|
||||||
|
scmi_notify(cinfo->handle, xfer->hdr.protocol_id,
|
||||||
|
xfer->hdr.id, xfer->rx.buf, xfer->rx.len, ts);
|
||||||
|
|
||||||
trace_scmi_rx_done(xfer->transfer_id, xfer->hdr.id,
|
trace_scmi_rx_done(xfer->transfer_id, xfer->hdr.id,
|
||||||
xfer->hdr.protocol_id, xfer->hdr.seq,
|
xfer->hdr.protocol_id, xfer->hdr.seq,
|
||||||
@ -788,6 +793,9 @@ static int scmi_probe(struct platform_device *pdev)
|
|||||||
if (ret)
|
if (ret)
|
||||||
return ret;
|
return ret;
|
||||||
|
|
||||||
|
if (scmi_notification_init(handle))
|
||||||
|
dev_err(dev, "SCMI Notifications NOT available.\n");
|
||||||
|
|
||||||
ret = scmi_base_protocol_init(handle);
|
ret = scmi_base_protocol_init(handle);
|
||||||
if (ret) {
|
if (ret) {
|
||||||
dev_err(dev, "unable to communicate with SCMI(%d)\n", ret);
|
dev_err(dev, "unable to communicate with SCMI(%d)\n", ret);
|
||||||
@ -830,6 +838,8 @@ static int scmi_remove(struct platform_device *pdev)
|
|||||||
struct scmi_info *info = platform_get_drvdata(pdev);
|
struct scmi_info *info = platform_get_drvdata(pdev);
|
||||||
struct idr *idr = &info->tx_idr;
|
struct idr *idr = &info->tx_idr;
|
||||||
|
|
||||||
|
scmi_notification_exit(&info->handle);
|
||||||
|
|
||||||
mutex_lock(&scmi_list_mutex);
|
mutex_lock(&scmi_list_mutex);
|
||||||
if (info->users)
|
if (info->users)
|
||||||
ret = -EBUSY;
|
ret = -EBUSY;
|
||||||
|
Loading…
Reference in New Issue
Block a user