-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
interconnect: qcom: Add interconnect RPM over SMD driver
On some Qualcomm SoCs, there is a remote processor, which controls some of the Network-On-Chip interconnect resources. Other CPUs express their needs by communicating with this processor. Add a driver to handle communication with this remote processor. Reviewed-by: Bjorn Andersson <bjorn.andersson@linaro.org> Signed-off-by: Georgi Djakov <georgi.djakov@linaro.org>
- Loading branch information
Georgi Djakov
committed
Aug 13, 2019
1 parent
24f516e
commit be06f8e
Showing
4 changed files
with
97 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,7 @@ | ||
# SPDX-License-Identifier: GPL-2.0 | ||
|
||
qnoc-sdm845-objs := sdm845.o | ||
icc-smd-rpm-objs := smd-rpm.o | ||
|
||
obj-$(CONFIG_INTERCONNECT_QCOM_SDM845) += qnoc-sdm845.o | ||
obj-$(CONFIG_INTERCONNECT_QCOM_SMD_RPM) += icc-smd-rpm.o |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
// SPDX-License-Identifier: GPL-2.0 | ||
/* | ||
* RPM over SMD communication wrapper for interconnects | ||
* | ||
* Copyright (C) 2019 Linaro Ltd | ||
* Author: Georgi Djakov <georgi.djakov@linaro.org> | ||
*/ | ||
|
||
#include <linux/interconnect-provider.h> | ||
#include <linux/module.h> | ||
#include <linux/of.h> | ||
#include <linux/of_platform.h> | ||
#include <linux/platform_device.h> | ||
#include <linux/soc/qcom/smd-rpm.h> | ||
|
||
#include "smd-rpm.h" | ||
|
||
#define RPM_KEY_BW 0x00007762 | ||
|
||
static struct qcom_smd_rpm *icc_smd_rpm; | ||
|
||
struct icc_rpm_smd_req { | ||
__le32 key; | ||
__le32 nbytes; | ||
__le32 value; | ||
}; | ||
|
||
bool qcom_icc_rpm_smd_available(void) | ||
{ | ||
return !!icc_smd_rpm; | ||
} | ||
EXPORT_SYMBOL_GPL(qcom_icc_rpm_smd_available); | ||
|
||
int qcom_icc_rpm_smd_send(int ctx, int rsc_type, int id, u32 val) | ||
{ | ||
struct icc_rpm_smd_req req = { | ||
.key = cpu_to_le32(RPM_KEY_BW), | ||
.nbytes = cpu_to_le32(sizeof(u32)), | ||
.value = cpu_to_le32(val), | ||
}; | ||
|
||
return qcom_rpm_smd_write(icc_smd_rpm, ctx, rsc_type, id, &req, | ||
sizeof(req)); | ||
} | ||
EXPORT_SYMBOL_GPL(qcom_icc_rpm_smd_send); | ||
|
||
static int qcom_icc_rpm_smd_remove(struct platform_device *pdev) | ||
{ | ||
icc_smd_rpm = NULL; | ||
|
||
return 0; | ||
} | ||
|
||
static int qcom_icc_rpm_smd_probe(struct platform_device *pdev) | ||
{ | ||
icc_smd_rpm = dev_get_drvdata(pdev->dev.parent); | ||
|
||
if (!icc_smd_rpm) { | ||
dev_err(&pdev->dev, "unable to retrieve handle to RPM\n"); | ||
return -ENODEV; | ||
} | ||
|
||
return 0; | ||
} | ||
|
||
static struct platform_driver qcom_interconnect_rpm_smd_driver = { | ||
.driver = { | ||
.name = "icc_smd_rpm", | ||
}, | ||
.probe = qcom_icc_rpm_smd_probe, | ||
.remove = qcom_icc_rpm_smd_remove, | ||
}; | ||
module_platform_driver(qcom_interconnect_rpm_smd_driver); | ||
MODULE_AUTHOR("Georgi Djakov <georgi.djakov@linaro.org>"); | ||
MODULE_DESCRIPTION("Qualcomm SMD RPM interconnect proxy driver"); | ||
MODULE_LICENSE("GPL v2"); | ||
MODULE_ALIAS("platform:icc_smd_rpm"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
/* SPDX-License-Identifier: GPL-2.0 */ | ||
/* | ||
* Copyright (c) 2019, Linaro Ltd. | ||
* Author: Georgi Djakov <georgi.djakov@linaro.org> | ||
*/ | ||
|
||
#ifndef __DRIVERS_INTERCONNECT_QCOM_SMD_RPM_H | ||
#define __DRIVERS_INTERCONNECT_QCOM_SMD_RPM_H | ||
|
||
#include <linux/soc/qcom/smd-rpm.h> | ||
|
||
bool qcom_icc_rpm_smd_available(void); | ||
int qcom_icc_rpm_smd_send(int ctx, int rsc_type, int id, u32 val); | ||
|
||
#endif |