summaryrefslogtreecommitdiff
path: root/drivers/soc/qcom
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/soc/qcom')
-rw-r--r--drivers/soc/qcom/Kconfig6
-rw-r--r--drivers/soc/qcom/smd-rpm.c43
-rw-r--r--drivers/soc/qcom/wcnss_ctrl.c50
3 files changed, 53 insertions, 46 deletions
diff --git a/drivers/soc/qcom/Kconfig b/drivers/soc/qcom/Kconfig
index 78b1bb7bcf20..4e090c697eb6 100644
--- a/drivers/soc/qcom/Kconfig
+++ b/drivers/soc/qcom/Kconfig
@@ -43,7 +43,8 @@ config QCOM_SMD
config QCOM_SMD_RPM
tristate "Qualcomm Resource Power Manager (RPM) over SMD"
- depends on QCOM_SMD && OF
+ depends on ARCH_QCOM
+ depends on RPMSG && OF
help
If you say yes to this option, support will be included for the
Resource Power Manager system found in the Qualcomm 8974 based
@@ -76,7 +77,8 @@ config QCOM_SMSM
config QCOM_WCNSS_CTRL
tristate "Qualcomm WCNSS control driver"
- depends on QCOM_SMD
+ depends on ARCH_QCOM
+ depends on RPMSG
help
Client driver for the WCNSS_CTRL SMD channel, used to download nv
firmware to a newly booted WCNSS chip.
diff --git a/drivers/soc/qcom/smd-rpm.c b/drivers/soc/qcom/smd-rpm.c
index 6609d7e0edb0..0dcf1bf33126 100644
--- a/drivers/soc/qcom/smd-rpm.c
+++ b/drivers/soc/qcom/smd-rpm.c
@@ -19,7 +19,7 @@
#include <linux/interrupt.h>
#include <linux/slab.h>
-#include <linux/soc/qcom/smd.h>
+#include <linux/rpmsg.h>
#include <linux/soc/qcom/smd-rpm.h>
#define RPM_REQUEST_TIMEOUT (5 * HZ)
@@ -32,7 +32,7 @@
* @ack_status: result of the rpm request
*/
struct qcom_smd_rpm {
- struct qcom_smd_channel *rpm_channel;
+ struct rpmsg_endpoint *rpm_channel;
struct device *dev;
struct completion ack;
@@ -133,7 +133,7 @@ int qcom_rpm_smd_write(struct qcom_smd_rpm *rpm,
pkt->req.data_len = cpu_to_le32(count);
memcpy(pkt->payload, buf, count);
- ret = qcom_smd_send(rpm->rpm_channel, pkt, size);
+ ret = rpmsg_send(rpm->rpm_channel, pkt, size);
if (ret)
goto out;
@@ -150,14 +150,16 @@ out:
}
EXPORT_SYMBOL(qcom_rpm_smd_write);
-static int qcom_smd_rpm_callback(struct qcom_smd_channel *channel,
- const void *data,
- size_t count)
+static int qcom_smd_rpm_callback(struct rpmsg_device *rpdev,
+ void *data,
+ int count,
+ void *priv,
+ u32 addr)
{
const struct qcom_rpm_header *hdr = data;
size_t hdr_length = le32_to_cpu(hdr->length);
const struct qcom_rpm_message *msg;
- struct qcom_smd_rpm *rpm = qcom_smd_get_drvdata(channel);
+ struct qcom_smd_rpm *rpm = dev_get_drvdata(&rpdev->dev);
const u8 *buf = data + sizeof(struct qcom_rpm_header);
const u8 *end = buf + hdr_length;
char msgbuf[32];
@@ -196,29 +198,27 @@ static int qcom_smd_rpm_callback(struct qcom_smd_channel *channel,
return 0;
}
-static int qcom_smd_rpm_probe(struct qcom_smd_device *sdev)
+static int qcom_smd_rpm_probe(struct rpmsg_device *rpdev)
{
struct qcom_smd_rpm *rpm;
- rpm = devm_kzalloc(&sdev->dev, sizeof(*rpm), GFP_KERNEL);
+ rpm = devm_kzalloc(&rpdev->dev, sizeof(*rpm), GFP_KERNEL);
if (!rpm)
return -ENOMEM;
mutex_init(&rpm->lock);
init_completion(&rpm->ack);
- rpm->dev = &sdev->dev;
- rpm->rpm_channel = sdev->channel;
- qcom_smd_set_drvdata(sdev->channel, rpm);
+ rpm->dev = &rpdev->dev;
+ rpm->rpm_channel = rpdev->ept;
+ dev_set_drvdata(&rpdev->dev, rpm);
- dev_set_drvdata(&sdev->dev, rpm);
-
- return of_platform_populate(sdev->dev.of_node, NULL, NULL, &sdev->dev);
+ return of_platform_populate(rpdev->dev.of_node, NULL, NULL, &rpdev->dev);
}
-static void qcom_smd_rpm_remove(struct qcom_smd_device *sdev)
+static void qcom_smd_rpm_remove(struct rpmsg_device *rpdev)
{
- of_platform_depopulate(&sdev->dev);
+ of_platform_depopulate(&rpdev->dev);
}
static const struct of_device_id qcom_smd_rpm_of_match[] = {
@@ -229,26 +229,25 @@ static const struct of_device_id qcom_smd_rpm_of_match[] = {
};
MODULE_DEVICE_TABLE(of, qcom_smd_rpm_of_match);
-static struct qcom_smd_driver qcom_smd_rpm_driver = {
+static struct rpmsg_driver qcom_smd_rpm_driver = {
.probe = qcom_smd_rpm_probe,
.remove = qcom_smd_rpm_remove,
.callback = qcom_smd_rpm_callback,
- .driver = {
+ .drv = {
.name = "qcom_smd_rpm",
- .owner = THIS_MODULE,
.of_match_table = qcom_smd_rpm_of_match,
},
};
static int __init qcom_smd_rpm_init(void)
{
- return qcom_smd_driver_register(&qcom_smd_rpm_driver);
+ return register_rpmsg_driver(&qcom_smd_rpm_driver);
}
arch_initcall(qcom_smd_rpm_init);
static void __exit qcom_smd_rpm_exit(void)
{
- qcom_smd_driver_unregister(&qcom_smd_rpm_driver);
+ unregister_rpmsg_driver(&qcom_smd_rpm_driver);
}
module_exit(qcom_smd_rpm_exit);
diff --git a/drivers/soc/qcom/wcnss_ctrl.c b/drivers/soc/qcom/wcnss_ctrl.c
index 520aedd29965..b9069184df19 100644
--- a/drivers/soc/qcom/wcnss_ctrl.c
+++ b/drivers/soc/qcom/wcnss_ctrl.c
@@ -14,10 +14,10 @@
#include <linux/firmware.h>
#include <linux/module.h>
#include <linux/slab.h>
-#include <linux/soc/qcom/smd.h>
#include <linux/io.h>
#include <linux/of_platform.h>
#include <linux/platform_device.h>
+#include <linux/rpmsg.h>
#include <linux/soc/qcom/wcnss_ctrl.h>
#define WCNSS_REQUEST_TIMEOUT (5 * HZ)
@@ -40,7 +40,7 @@
*/
struct wcnss_ctrl {
struct device *dev;
- struct qcom_smd_channel *channel;
+ struct rpmsg_endpoint *channel;
struct completion ack;
struct completion cbc;
@@ -122,11 +122,13 @@ struct wcnss_download_nv_resp {
*
* Handles any incoming packets from the remote WCNSS_CTRL service.
*/
-static int wcnss_ctrl_smd_callback(struct qcom_smd_channel *channel,
- const void *data,
- size_t count)
+static int wcnss_ctrl_smd_callback(struct rpmsg_device *rpdev,
+ void *data,
+ int count,
+ void *priv,
+ u32 addr)
{
- struct wcnss_ctrl *wcnss = qcom_smd_get_drvdata(channel);
+ struct wcnss_ctrl *wcnss = dev_get_drvdata(&rpdev->dev);
const struct wcnss_download_nv_resp *nvresp;
const struct wcnss_version_resp *version;
const struct wcnss_msg_hdr *hdr = data;
@@ -180,7 +182,7 @@ static int wcnss_request_version(struct wcnss_ctrl *wcnss)
msg.type = WCNSS_VERSION_REQ;
msg.len = sizeof(msg);
- ret = qcom_smd_send(wcnss->channel, &msg, sizeof(msg));
+ ret = rpmsg_send(wcnss->channel, &msg, sizeof(msg));
if (ret < 0)
return ret;
@@ -238,7 +240,7 @@ static int wcnss_download_nv(struct wcnss_ctrl *wcnss, bool *expect_cbc)
memcpy(req->fragment, data, req->frag_size);
- ret = qcom_smd_send(wcnss->channel, req, req->hdr.len);
+ ret = rpmsg_send(wcnss->channel, req, req->hdr.len);
if (ret < 0) {
dev_err(wcnss->dev, "failed to send smd packet\n");
goto release_fw;
@@ -274,11 +276,16 @@ free_req:
* @name: SMD channel name
* @cb: callback to handle incoming data on the channel
*/
-struct qcom_smd_channel *qcom_wcnss_open_channel(void *wcnss, const char *name, qcom_smd_cb_t cb)
+struct rpmsg_endpoint *qcom_wcnss_open_channel(void *wcnss, const char *name, rpmsg_rx_cb_t cb, void *priv)
{
+ struct rpmsg_channel_info chinfo;
struct wcnss_ctrl *_wcnss = wcnss;
- return qcom_smd_open_channel(_wcnss->channel, name, cb);
+ strncpy(chinfo.name, name, sizeof(chinfo.name));
+ chinfo.src = RPMSG_ADDR_ANY;
+ chinfo.dst = RPMSG_ADDR_ANY;
+
+ return rpmsg_create_ept(_wcnss->channel->rpdev, cb, priv, chinfo);
}
EXPORT_SYMBOL(qcom_wcnss_open_channel);
@@ -306,35 +313,34 @@ static void wcnss_async_probe(struct work_struct *work)
of_platform_populate(wcnss->dev->of_node, NULL, NULL, wcnss->dev);
}
-static int wcnss_ctrl_probe(struct qcom_smd_device *sdev)
+static int wcnss_ctrl_probe(struct rpmsg_device *rpdev)
{
struct wcnss_ctrl *wcnss;
- wcnss = devm_kzalloc(&sdev->dev, sizeof(*wcnss), GFP_KERNEL);
+ wcnss = devm_kzalloc(&rpdev->dev, sizeof(*wcnss), GFP_KERNEL);
if (!wcnss)
return -ENOMEM;
- wcnss->dev = &sdev->dev;
- wcnss->channel = sdev->channel;
+ wcnss->dev = &rpdev->dev;
+ wcnss->channel = rpdev->ept;
init_completion(&wcnss->ack);
init_completion(&wcnss->cbc);
INIT_WORK(&wcnss->probe_work, wcnss_async_probe);
- qcom_smd_set_drvdata(sdev->channel, wcnss);
- dev_set_drvdata(&sdev->dev, wcnss);
+ dev_set_drvdata(&rpdev->dev, wcnss);
schedule_work(&wcnss->probe_work);
return 0;
}
-static void wcnss_ctrl_remove(struct qcom_smd_device *sdev)
+static void wcnss_ctrl_remove(struct rpmsg_device *rpdev)
{
- struct wcnss_ctrl *wcnss = qcom_smd_get_drvdata(sdev->channel);
+ struct wcnss_ctrl *wcnss = dev_get_drvdata(&rpdev->dev);
cancel_work_sync(&wcnss->probe_work);
- of_platform_depopulate(&sdev->dev);
+ of_platform_depopulate(&rpdev->dev);
}
static const struct of_device_id wcnss_ctrl_of_match[] = {
@@ -342,18 +348,18 @@ static const struct of_device_id wcnss_ctrl_of_match[] = {
{}
};
-static struct qcom_smd_driver wcnss_ctrl_driver = {
+static struct rpmsg_driver wcnss_ctrl_driver = {
.probe = wcnss_ctrl_probe,
.remove = wcnss_ctrl_remove,
.callback = wcnss_ctrl_smd_callback,
- .driver = {
+ .drv = {
.name = "qcom_wcnss_ctrl",
.owner = THIS_MODULE,
.of_match_table = wcnss_ctrl_of_match,
},
};
-module_qcom_smd_driver(wcnss_ctrl_driver);
+module_rpmsg_driver(wcnss_ctrl_driver);
MODULE_DESCRIPTION("Qualcomm WCNSS control driver");
MODULE_LICENSE("GPL v2");