Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 74672e6b authored by Raghavendra Rao Ananta's avatar Raghavendra Rao Ananta
Browse files

soc: qcom: proxy_consumer: Add support for amba_driver



The proxy consumer driver currently only supports proxy
probing for platform bus. However, there's a need to
proxy-probe coresight devices, which falls under ABMA bus.
Hence, extend the driver to support proxy probing for
"struct amba_driver" and add coresight-etm ids to the list.

Change-Id: I48da20ea18f61b5cc82ae0616a75c23af32481a2
Signed-off-by: default avatarRaghavendra Rao Ananta <rananta@codeaurora.org>
parent 87306802
Loading
Loading
Loading
Loading
+73 −1
Original line number Diff line number Diff line
@@ -6,6 +6,14 @@
#include <linux/module.h>
#include <linux/mod_devicetable.h>
#include <linux/platform_device.h>
#include <linux/pm_runtime.h>
#include <linux/amba/bus.h>

#define QCOM_PROXY_CONSUMER_AMBA_ID(pid)			\
	{				\
		.id	= pid,		\
		.mask	= 0x000fffff,	\
	}

/*
 * of_match table that contains a list of compatible strings for the
@@ -22,12 +30,42 @@ static const struct of_device_id qcom_proxy_of_consumer_match[] = {
	{}
};

static const struct amba_id qcom_proxy_amba_of_consumer_match[] = {
#if !IS_ENABLED(CONFIG_CORESIGHT_SOURCE_ETM4X)
	QCOM_PROXY_CONSUMER_AMBA_ID(0x000bb95d), /* Cortex-A53 */
	QCOM_PROXY_CONSUMER_AMBA_ID(0x000bb95e), /* Cortex-A57 */
	QCOM_PROXY_CONSUMER_AMBA_ID(0x000bb95a), /* Cortex-A72 */
	QCOM_PROXY_CONSUMER_AMBA_ID(0x000bb959), /* Cortex-A73 */
	QCOM_PROXY_CONSUMER_AMBA_ID(0x000bb9da), /* Cortex-A35 */
	QCOM_PROXY_CONSUMER_AMBA_ID(0x000f0205), /* QCOM Kryo */
	QCOM_PROXY_CONSUMER_AMBA_ID(0x000f0211), /* QCOM Kryo */
	QCOM_PROXY_CONSUMER_AMBA_ID(0x000bb802), /* QCOM Kryo 385 Cortex-A55 */
	QCOM_PROXY_CONSUMER_AMBA_ID(0x000bb803), /* QCOM Kryo 385 Cortex-A75 */
#endif
	{}
};

static int qcom_proxy_of_consumer_probe(struct platform_device *pdev)
{
	dev_dbg(&pdev->dev, "Proxy probing\n");
	return 0;
}

static int qcom_proxy_amba_of_consumer_probe(struct amba_device *adev,
						const struct amba_id *id)
{
	dev_dbg(&adev->dev, "Proxy probing\n");

	/* Before calling this probe, the amba framework votes for the clk
	 * by default. It removes the vote only during the runtime suspend
	 * of the device. Hence, explicilty decrement the usage count of
	 * the device for the suspend to happen.
	 */
	pm_runtime_put(&adev->dev);

	return 0;
}

static struct platform_driver qcom_proxy_of_consumer_driver = {
	.probe = qcom_proxy_of_consumer_probe,
	.driver = {
@@ -36,7 +74,41 @@ static struct platform_driver qcom_proxy_of_consumer_driver = {
	},
};

module_platform_driver(qcom_proxy_of_consumer_driver);
static struct amba_driver qcom_proxy_amba_of_consumer_driver = {
	.probe = qcom_proxy_amba_of_consumer_probe,
	.id_table = qcom_proxy_amba_of_consumer_match,
	.drv = {
		.name = "qcom_proxy_amba_of_consumer",
	},
};

static int __init qcom_proxy_of_init(void)
{
	int ret;

	ret = platform_driver_register(&qcom_proxy_of_consumer_driver);
	if (ret < 0)
		return ret;

	ret = amba_driver_register(&qcom_proxy_amba_of_consumer_driver);
	if (ret < 0)
		goto amba_fail;

	return 0;

amba_fail:
	platform_driver_unregister(&qcom_proxy_of_consumer_driver);
	return ret;
}

static void __exit qcom_proxy_of_exit(void)
{
	amba_driver_unregister(&qcom_proxy_amba_of_consumer_driver);
	platform_driver_unregister(&qcom_proxy_of_consumer_driver);
}

module_init(qcom_proxy_of_init);
module_exit(qcom_proxy_of_exit);

MODULE_LICENSE("GPL v2");
MODULE_DESCRIPTION("Qualcomm Technologies, of proxy consumer driver");