mirror of
https://github.com/torvalds/linux.git
synced 2026-05-12 16:18:45 +02:00
interconnect changes for 6.20
This pull request contains the interconnect changes for the 6.20-rc1
merge window. The core and driver changes are listed below.
Core changes:
- Add KUnit tests for core functionality
Driver changes:
- New driver for MediaTek MT8196 EMI
- MediaTek driver fixes
- Support for Glymur BWMONs
- QCS8300 driver topology fix
- Misc cleanups
Signed-off-by: Georgi Djakov <djakov@kernel.org>
-----BEGIN PGP SIGNATURE-----
iQIzBAABCgAdFiEExQ4tCsdmOu34XfMFgNDMCsbYFmMFAml8pNoACgkQgNDMCsbY
FmOG6xAApKmTbvk1W5bI3D/kMDf0vqEQ57tZzstjVOorLhBffJcZ/FT4Yi0cYmoe
LGYuC4o2qgm4zSI88QyFUrQdCNDJFxJX9XTlTw3rWckleW50mk7X3KxJ7O3U8JiF
jOrS7vFZG7+NaoGI8hzkKNO6GcgpJdamyb0K4mxMfsqisKJVbHqgtb0jtTpqbWX3
dJd9Ok7rEFhUshA19xdjHb8XfhLQzFKLhfhnzudU49AX9ZHgpsHKqlXhwQJqYyWm
TpM8vtpcwo4M0FHxqyR4AAt7U7TAOIMrL9QR3j+Oh7GHTROYnErdmQYAk7Bl39Wt
TAVeNKSMQvvepUpk8u4kyHn4/r+721jgDDwm8s2cPepv+0ggoR7LzdewAJaO9j1I
7huKR38OLrlhF1805YJXGA6L3vblbaxbML9mF40GD6fPPP18yCeWJojG2sZrj98n
ayz/VJEU1tvrzK9EvoCsw/451HbEx8Q0PiJjcbOYwOs/yD5WZ2AbmG2PQsh4aUMS
x9Dqfqv7oIXDNQ0FKMPGo5odsQgo0h+7Yy+xrDxOXKOb+4YW53D9zxfuwLo4drMX
gaXjxyNW4Hv4gp7hcvpNT7woN7qmoPUhullYZVvbU2RWGalvvh2RA+EK/w50ysSn
/sRZP/Kgu+j4Q06CELMFTldhRIav0v8GyUa3clmSZ5Kf60H8ChM=
=gAyf
-----END PGP SIGNATURE-----
Merge tag 'icc-6.20-rc1' of ssh://gitolite.kernel.org/pub/scm/linux/kernel/git/djakov/icc into char-misc-next
Georgi writes:
interconnect changes for 6.20
This pull request contains the interconnect changes for the 6.20-rc1
merge window. The core and driver changes are listed below.
Core changes:
- Add KUnit tests for core functionality
Driver changes:
- New driver for MediaTek MT8196 EMI
- MediaTek driver fixes
- Support for Glymur BWMONs
- QCS8300 driver topology fix
- Misc cleanups
Signed-off-by: Georgi Djakov <djakov@kernel.org>
* tag 'icc-6.20-rc1' of ssh://gitolite.kernel.org/pub/scm/linux/kernel/git/djakov/icc:
interconnect: qcom: msm8974: drop duplicated RPM_BUS_{MASTER,SLAVE}_REQ defines
interconnect: qcom: smd-rpm: drop duplicated QCOM_RPM_SMD_KEY_RATE define
dt-bindings: interconnect: qcom-bwmon: Document Glymur BWMONs
interconnect: qcom: qcs8300: fix the num_links for nsp icc node
interconnect: Add kunit tests for core functionality
dt-bindings: interconnect: qcom,qcs615-rpmh: Drop IPA interconnects
interconnect: mediatek: Aggregate bandwidth with saturating add
interconnect: mediatek: Don't hijack parent device
interconnect: mediatek: Add support for MediaTek MT8196 EMI ICC
dt-bindings: interconnect: mt8183-emi: Add support for MT8196 EMI
This commit is contained in:
commit
96657eb5ab
|
|
@ -40,6 +40,7 @@ properties:
|
|||
enum:
|
||||
- mediatek,mt8183-emi
|
||||
- mediatek,mt8195-emi
|
||||
- mediatek,mt8196-emi
|
||||
|
||||
'#interconnect-cells':
|
||||
const: 1
|
||||
|
|
|
|||
|
|
@ -25,6 +25,7 @@ properties:
|
|||
- const: qcom,msm8998-bwmon # BWMON v4
|
||||
- items:
|
||||
- enum:
|
||||
- qcom,glymur-cpu-bwmon
|
||||
- qcom,kaanapali-cpu-bwmon
|
||||
- qcom,qcm2290-cpu-bwmon
|
||||
- qcom,qcs615-cpu-bwmon
|
||||
|
|
|
|||
|
|
@ -27,7 +27,6 @@ properties:
|
|||
- qcom,qcs615-config-noc
|
||||
- qcom,qcs615-dc-noc
|
||||
- qcom,qcs615-gem-noc
|
||||
- qcom,qcs615-ipa-virt
|
||||
- qcom,qcs615-mc-virt
|
||||
- qcom,qcs615-mmss-noc
|
||||
- qcom,qcs615-system-noc
|
||||
|
|
@ -46,7 +45,6 @@ allOf:
|
|||
contains:
|
||||
enum:
|
||||
- qcom,qcs615-camnoc-virt
|
||||
- qcom,qcs615-ipa-virt
|
||||
- qcom,qcs615-mc-virt
|
||||
then:
|
||||
properties:
|
||||
|
|
|
|||
|
|
@ -22,4 +22,18 @@ config INTERCONNECT_CLK
|
|||
help
|
||||
Support for wrapping clocks into the interconnect nodes.
|
||||
|
||||
config INTERCONNECT_KUNIT_TEST
|
||||
tristate "KUnit tests for Interconnect framework"
|
||||
depends on KUNIT
|
||||
default KUNIT_ALL_TESTS
|
||||
help
|
||||
This builds the KUnit test suite for the generic system interconnect
|
||||
framework.
|
||||
|
||||
The tests cover the core functionality of the interconnect subsystem,
|
||||
including provider/consumer APIs, topology management, and bandwidth
|
||||
aggregation logic.
|
||||
|
||||
If unsure, say N.
|
||||
|
||||
endif
|
||||
|
|
|
|||
|
|
@ -10,3 +10,5 @@ obj-$(CONFIG_INTERCONNECT_QCOM) += qcom/
|
|||
obj-$(CONFIG_INTERCONNECT_SAMSUNG) += samsung/
|
||||
|
||||
obj-$(CONFIG_INTERCONNECT_CLK) += icc-clk.o
|
||||
|
||||
obj-$(CONFIG_INTERCONNECT_KUNIT_TEST) += icc-kunit.o
|
||||
|
|
|
|||
324
drivers/interconnect/icc-kunit.c
Normal file
324
drivers/interconnect/icc-kunit.c
Normal file
|
|
@ -0,0 +1,324 @@
|
|||
// SPDX-License-Identifier: GPL-2.0
|
||||
/*
|
||||
* KUnit tests for the Interconnect framework.
|
||||
*
|
||||
* Copyright (c) 2025 Kuan-Wei Chiu <visitorckw@gmail.com>
|
||||
*
|
||||
* This suite verifies the behavior of the interconnect core, including
|
||||
* topology construction, bandwidth aggregation, and path lifecycle.
|
||||
*/
|
||||
|
||||
#include <kunit/platform_device.h>
|
||||
#include <kunit/test.h>
|
||||
#include <linux/interconnect-provider.h>
|
||||
#include <linux/interconnect.h>
|
||||
#include <linux/list.h>
|
||||
#include <linux/module.h>
|
||||
#include <linux/overflow.h>
|
||||
#include <linux/platform_device.h>
|
||||
#include <linux/slab.h>
|
||||
|
||||
#include "internal.h"
|
||||
|
||||
enum {
|
||||
NODE_CPU,
|
||||
NODE_GPU,
|
||||
NODE_BUS,
|
||||
NODE_DDR,
|
||||
NODE_MAX
|
||||
};
|
||||
|
||||
struct test_node_data {
|
||||
int id;
|
||||
const char *name;
|
||||
int num_links;
|
||||
int links[2];
|
||||
};
|
||||
|
||||
/*
|
||||
* Static Topology:
|
||||
* CPU -\
|
||||
* -> BUS -> DDR
|
||||
* GPU -/
|
||||
*/
|
||||
static const struct test_node_data test_topology[] = {
|
||||
{ NODE_CPU, "cpu", 1, { NODE_BUS } },
|
||||
{ NODE_GPU, "gpu", 1, { NODE_BUS } },
|
||||
{ NODE_BUS, "bus", 1, { NODE_DDR } },
|
||||
{ NODE_DDR, "ddr", 0, { } },
|
||||
};
|
||||
|
||||
struct icc_test_priv {
|
||||
struct icc_provider provider;
|
||||
struct platform_device *pdev;
|
||||
struct icc_node *nodes[NODE_MAX];
|
||||
};
|
||||
|
||||
static struct icc_node *get_node(struct icc_test_priv *priv, int id)
|
||||
{
|
||||
int idx = id - NODE_CPU;
|
||||
|
||||
if (idx < 0 || idx >= ARRAY_SIZE(test_topology))
|
||||
return NULL;
|
||||
return priv->nodes[idx];
|
||||
}
|
||||
|
||||
static int icc_test_set(struct icc_node *src, struct icc_node *dst)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int icc_test_aggregate(struct icc_node *node, u32 tag, u32 avg_bw,
|
||||
u32 peak_bw, u32 *agg_avg, u32 *agg_peak)
|
||||
{
|
||||
return icc_std_aggregate(node, tag, avg_bw, peak_bw, agg_avg, agg_peak);
|
||||
}
|
||||
|
||||
static struct icc_node *icc_test_xlate(const struct of_phandle_args *spec, void *data)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static int icc_test_get_bw(struct icc_node *node, u32 *avg, u32 *peak)
|
||||
{
|
||||
*avg = 0;
|
||||
*peak = 0;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int icc_test_init(struct kunit *test)
|
||||
{
|
||||
struct icc_test_priv *priv;
|
||||
struct icc_node *node;
|
||||
int i, j, ret;
|
||||
|
||||
priv = kunit_kzalloc(test, sizeof(*priv), GFP_KERNEL);
|
||||
KUNIT_ASSERT_NOT_ERR_OR_NULL(test, priv);
|
||||
test->priv = priv;
|
||||
|
||||
priv->pdev = kunit_platform_device_alloc(test, "icc-test-dev", -1);
|
||||
KUNIT_ASSERT_NOT_ERR_OR_NULL(test, priv->pdev);
|
||||
KUNIT_ASSERT_EQ(test, kunit_platform_device_add(test, priv->pdev), 0);
|
||||
|
||||
priv->provider.set = icc_test_set;
|
||||
priv->provider.aggregate = icc_test_aggregate;
|
||||
priv->provider.xlate = icc_test_xlate;
|
||||
priv->provider.get_bw = icc_test_get_bw;
|
||||
priv->provider.dev = &priv->pdev->dev;
|
||||
priv->provider.data = priv;
|
||||
INIT_LIST_HEAD(&priv->provider.nodes);
|
||||
|
||||
ret = icc_provider_register(&priv->provider);
|
||||
KUNIT_ASSERT_EQ(test, ret, 0);
|
||||
|
||||
for (i = 0; i < ARRAY_SIZE(test_topology); i++) {
|
||||
const struct test_node_data *data = &test_topology[i];
|
||||
|
||||
node = icc_node_create(data->id);
|
||||
KUNIT_ASSERT_NOT_ERR_OR_NULL(test, node);
|
||||
|
||||
node->name = data->name;
|
||||
icc_node_add(node, &priv->provider);
|
||||
priv->nodes[i] = node;
|
||||
}
|
||||
|
||||
for (i = 0; i < ARRAY_SIZE(test_topology); i++) {
|
||||
const struct test_node_data *data = &test_topology[i];
|
||||
struct icc_node *src = get_node(priv, data->id);
|
||||
|
||||
for (j = 0; j < data->num_links; j++) {
|
||||
ret = icc_link_create(src, data->links[j]);
|
||||
KUNIT_ASSERT_EQ_MSG(test, ret, 0, "Failed to link %s->%d",
|
||||
src->name, data->links[j]);
|
||||
}
|
||||
}
|
||||
|
||||
icc_sync_state(&priv->pdev->dev);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void icc_test_exit(struct kunit *test)
|
||||
{
|
||||
struct icc_test_priv *priv = test->priv;
|
||||
|
||||
icc_nodes_remove(&priv->provider);
|
||||
icc_provider_deregister(&priv->provider);
|
||||
}
|
||||
|
||||
/*
|
||||
* Helper to construct a mock path.
|
||||
*
|
||||
* Because we are bypassing icc_get(), we must manually link the requests
|
||||
* to the nodes' req_list so that icc_std_aggregate() can discover them.
|
||||
*/
|
||||
static struct icc_path *icc_test_create_path(struct kunit *test,
|
||||
struct icc_node **nodes, int num)
|
||||
{
|
||||
struct icc_path *path;
|
||||
int i;
|
||||
|
||||
path = kunit_kzalloc(test, struct_size(path, reqs, num), GFP_KERNEL);
|
||||
KUNIT_ASSERT_NOT_ERR_OR_NULL(test, path);
|
||||
|
||||
path->num_nodes = num;
|
||||
for (i = 0; i < num; i++) {
|
||||
path->reqs[i].node = nodes[i];
|
||||
hlist_add_head(&path->reqs[i].req_node, &nodes[i]->req_list);
|
||||
}
|
||||
path->name = "mock-path";
|
||||
|
||||
return path;
|
||||
}
|
||||
|
||||
static void icc_test_destroy_path(struct kunit *test, struct icc_path *path)
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = 0; i < path->num_nodes; i++)
|
||||
hlist_del(&path->reqs[i].req_node);
|
||||
|
||||
kunit_kfree(test, path);
|
||||
}
|
||||
|
||||
static void icc_test_topology_integrity(struct kunit *test)
|
||||
{
|
||||
struct icc_test_priv *priv = test->priv;
|
||||
struct icc_node *cpu = get_node(priv, NODE_CPU);
|
||||
struct icc_node *bus = get_node(priv, NODE_BUS);
|
||||
|
||||
KUNIT_EXPECT_EQ(test, cpu->num_links, 1);
|
||||
KUNIT_EXPECT_PTR_EQ(test, cpu->links[0], bus);
|
||||
KUNIT_EXPECT_PTR_EQ(test, cpu->provider, &priv->provider);
|
||||
}
|
||||
|
||||
static void icc_test_set_bw(struct kunit *test)
|
||||
{
|
||||
struct icc_test_priv *priv = test->priv;
|
||||
struct icc_path *path;
|
||||
struct icc_node *path_nodes[3];
|
||||
int ret;
|
||||
|
||||
/* Path: CPU -> BUS -> DDR */
|
||||
path_nodes[0] = get_node(priv, NODE_CPU);
|
||||
path_nodes[1] = get_node(priv, NODE_BUS);
|
||||
path_nodes[2] = get_node(priv, NODE_DDR);
|
||||
|
||||
path = icc_test_create_path(test, path_nodes, 3);
|
||||
|
||||
ret = icc_enable(path);
|
||||
KUNIT_ASSERT_EQ(test, ret, 0);
|
||||
|
||||
ret = icc_set_bw(path, 1000, 2000);
|
||||
KUNIT_EXPECT_EQ(test, ret, 0);
|
||||
|
||||
KUNIT_EXPECT_EQ(test, path_nodes[0]->avg_bw, 1000);
|
||||
KUNIT_EXPECT_EQ(test, path_nodes[0]->peak_bw, 2000);
|
||||
KUNIT_EXPECT_EQ(test, path_nodes[1]->avg_bw, 1000);
|
||||
KUNIT_EXPECT_EQ(test, path_nodes[1]->peak_bw, 2000);
|
||||
|
||||
icc_set_tag(path, 0xABC);
|
||||
KUNIT_EXPECT_EQ(test, path->reqs[0].tag, 0xABC);
|
||||
|
||||
icc_disable(path);
|
||||
KUNIT_EXPECT_EQ(test, path_nodes[0]->avg_bw, 0);
|
||||
|
||||
icc_test_destroy_path(test, path);
|
||||
}
|
||||
|
||||
static void icc_test_aggregation(struct kunit *test)
|
||||
{
|
||||
struct icc_test_priv *priv = test->priv;
|
||||
struct icc_path *path_cpu, *path_gpu;
|
||||
struct icc_node *nodes_cpu[3], *nodes_gpu[2];
|
||||
struct icc_node *bus = get_node(priv, NODE_BUS);
|
||||
int ret;
|
||||
|
||||
nodes_cpu[0] = get_node(priv, NODE_CPU);
|
||||
nodes_cpu[1] = bus;
|
||||
nodes_cpu[2] = get_node(priv, NODE_DDR);
|
||||
path_cpu = icc_test_create_path(test, nodes_cpu, 3);
|
||||
|
||||
nodes_gpu[0] = get_node(priv, NODE_GPU);
|
||||
nodes_gpu[1] = bus;
|
||||
path_gpu = icc_test_create_path(test, nodes_gpu, 2);
|
||||
|
||||
icc_enable(path_cpu);
|
||||
icc_enable(path_gpu);
|
||||
|
||||
ret = icc_set_bw(path_cpu, 1000, 1000);
|
||||
KUNIT_EXPECT_EQ(test, ret, 0);
|
||||
KUNIT_EXPECT_EQ(test, bus->avg_bw, 1000);
|
||||
|
||||
ret = icc_set_bw(path_gpu, 2000, 2000);
|
||||
KUNIT_EXPECT_EQ(test, ret, 0);
|
||||
|
||||
/* Bus aggregates: CPU(1000) + GPU(2000) */
|
||||
KUNIT_EXPECT_EQ(test, bus->avg_bw, 3000);
|
||||
/* Peak aggregates: max(CPU, GPU) */
|
||||
KUNIT_EXPECT_EQ(test, bus->peak_bw, 2000);
|
||||
|
||||
icc_test_destroy_path(test, path_cpu);
|
||||
icc_test_destroy_path(test, path_gpu);
|
||||
}
|
||||
|
||||
static void icc_test_bulk_ops(struct kunit *test)
|
||||
{
|
||||
struct icc_test_priv *priv = test->priv;
|
||||
struct icc_node *nodes_cpu[3], *nodes_gpu[2];
|
||||
struct icc_bulk_data bulk[2];
|
||||
int ret;
|
||||
|
||||
nodes_cpu[0] = get_node(priv, NODE_CPU);
|
||||
nodes_cpu[1] = get_node(priv, NODE_BUS);
|
||||
nodes_cpu[2] = get_node(priv, NODE_DDR);
|
||||
|
||||
nodes_gpu[0] = get_node(priv, NODE_GPU);
|
||||
nodes_gpu[1] = get_node(priv, NODE_BUS);
|
||||
|
||||
bulk[0].path = icc_test_create_path(test, nodes_cpu, 3);
|
||||
bulk[0].avg_bw = 500;
|
||||
bulk[0].peak_bw = 500;
|
||||
|
||||
bulk[1].path = icc_test_create_path(test, nodes_gpu, 2);
|
||||
bulk[1].avg_bw = 600;
|
||||
bulk[1].peak_bw = 600;
|
||||
|
||||
ret = icc_bulk_set_bw(2, bulk);
|
||||
KUNIT_EXPECT_EQ(test, ret, 0);
|
||||
/* Paths disabled, bandwidth should be 0 */
|
||||
KUNIT_EXPECT_EQ(test, get_node(priv, NODE_BUS)->avg_bw, 0);
|
||||
|
||||
ret = icc_bulk_enable(2, bulk);
|
||||
KUNIT_EXPECT_EQ(test, ret, 0);
|
||||
/* Paths enabled, aggregation applies */
|
||||
KUNIT_EXPECT_EQ(test, get_node(priv, NODE_BUS)->avg_bw, 1100);
|
||||
|
||||
icc_bulk_disable(2, bulk);
|
||||
KUNIT_EXPECT_EQ(test, get_node(priv, NODE_BUS)->avg_bw, 0);
|
||||
|
||||
icc_test_destroy_path(test, bulk[0].path);
|
||||
icc_test_destroy_path(test, bulk[1].path);
|
||||
}
|
||||
|
||||
static struct kunit_case icc_test_cases[] = {
|
||||
KUNIT_CASE(icc_test_topology_integrity),
|
||||
KUNIT_CASE(icc_test_set_bw),
|
||||
KUNIT_CASE(icc_test_aggregation),
|
||||
KUNIT_CASE(icc_test_bulk_ops),
|
||||
{}
|
||||
};
|
||||
|
||||
static struct kunit_suite icc_test_suite = {
|
||||
.name = "interconnect",
|
||||
.init = icc_test_init,
|
||||
.exit = icc_test_exit,
|
||||
.test_cases = icc_test_cases,
|
||||
};
|
||||
|
||||
kunit_test_suite(icc_test_suite);
|
||||
|
||||
MODULE_AUTHOR("Kuan-Wei Chiu <visitorckw@gmail.com>");
|
||||
MODULE_DESCRIPTION("KUnit tests for the Interconnect framework");
|
||||
MODULE_LICENSE("GPL");
|
||||
|
|
@ -27,3 +27,10 @@ config INTERCONNECT_MTK_MT8195
|
|||
help
|
||||
This is a driver for the MediaTek bus interconnect on MT8195-based
|
||||
platforms.
|
||||
|
||||
config INTERCONNECT_MTK_MT8196
|
||||
tristate "MediaTek MT8196 interconnect driver"
|
||||
depends on INTERCONNECT_MTK_DVFSRC_EMI
|
||||
help
|
||||
This is a driver for the MediaTek bus interconnect on MT8196-based
|
||||
platforms.
|
||||
|
|
|
|||
|
|
@ -3,3 +3,4 @@
|
|||
obj-$(CONFIG_INTERCONNECT_MTK_DVFSRC_EMI) += icc-emi.o
|
||||
obj-$(CONFIG_INTERCONNECT_MTK_MT8183) += mt8183.o
|
||||
obj-$(CONFIG_INTERCONNECT_MTK_MT8195) += mt8195.o
|
||||
obj-$(CONFIG_INTERCONNECT_MTK_MT8195) += mt8196.o
|
||||
|
|
|
|||
|
|
@ -12,6 +12,7 @@
|
|||
#include <linux/module.h>
|
||||
#include <linux/of.h>
|
||||
#include <linux/of_platform.h>
|
||||
#include <linux/overflow.h>
|
||||
#include <linux/platform_device.h>
|
||||
#include <linux/soc/mediatek/dvfsrc.h>
|
||||
|
||||
|
|
@ -22,7 +23,9 @@ static int mtk_emi_icc_aggregate(struct icc_node *node, u32 tag, u32 avg_bw,
|
|||
{
|
||||
struct mtk_icc_node *in = node->data;
|
||||
|
||||
*agg_avg += avg_bw;
|
||||
if (check_add_overflow(*agg_avg, avg_bw, agg_avg))
|
||||
*agg_avg = U32_MAX;
|
||||
|
||||
*agg_peak = max_t(u32, *agg_peak, peak_bw);
|
||||
|
||||
in->sum_avg = *agg_avg;
|
||||
|
|
@ -40,7 +43,7 @@ static int mtk_emi_icc_set(struct icc_node *src, struct icc_node *dst)
|
|||
if (unlikely(!src->provider))
|
||||
return -EINVAL;
|
||||
|
||||
dev = src->provider->dev;
|
||||
dev = src->provider->dev->parent;
|
||||
|
||||
switch (node->ep) {
|
||||
case 0:
|
||||
|
|
@ -97,7 +100,7 @@ int mtk_emi_icc_probe(struct platform_device *pdev)
|
|||
if (!data)
|
||||
return -ENOMEM;
|
||||
|
||||
provider->dev = pdev->dev.parent;
|
||||
provider->dev = dev;
|
||||
provider->set = mtk_emi_icc_set;
|
||||
provider->aggregate = mtk_emi_icc_aggregate;
|
||||
provider->xlate = of_icc_xlate_onecell;
|
||||
|
|
|
|||
383
drivers/interconnect/mediatek/mt8196.c
Normal file
383
drivers/interconnect/mediatek/mt8196.c
Normal file
|
|
@ -0,0 +1,383 @@
|
|||
// SPDX-License-Identifier: GPL-2.0
|
||||
/*
|
||||
* Copyright (c) 2025 Collabora Ltd.
|
||||
* AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
|
||||
*/
|
||||
|
||||
#include <linux/device.h>
|
||||
#include <linux/interconnect.h>
|
||||
#include <linux/interconnect-provider.h>
|
||||
#include <linux/mod_devicetable.h>
|
||||
#include <linux/module.h>
|
||||
#include <linux/platform_device.h>
|
||||
#include <dt-bindings/interconnect/mediatek,mt8196.h>
|
||||
|
||||
#include "icc-emi.h"
|
||||
|
||||
static struct mtk_icc_node ddr_emi = {
|
||||
.name = "ddr-emi",
|
||||
.id = SLAVE_DDR_EMI,
|
||||
.ep = 1,
|
||||
};
|
||||
|
||||
static struct mtk_icc_node mcusys = {
|
||||
.name = "mcusys",
|
||||
.id = MASTER_MCUSYS,
|
||||
.ep = 0,
|
||||
.num_links = 1,
|
||||
.links = { SLAVE_DDR_EMI }
|
||||
};
|
||||
|
||||
static struct mtk_icc_node mcu_port0 = {
|
||||
.name = "mcu-port0",
|
||||
.id = MASTER_MCU_0,
|
||||
.ep = 0,
|
||||
.num_links = 1,
|
||||
.links = { SLAVE_DDR_EMI }
|
||||
};
|
||||
|
||||
static struct mtk_icc_node mcu_port1 = {
|
||||
.name = "mcu-port1",
|
||||
.id = MASTER_MCU_1,
|
||||
.ep = 0,
|
||||
.num_links = 1,
|
||||
.links = { SLAVE_DDR_EMI }
|
||||
};
|
||||
|
||||
static struct mtk_icc_node mcu_port2 = {
|
||||
.name = "mcu-port2",
|
||||
.id = MASTER_MCU_2,
|
||||
.ep = 0,
|
||||
.num_links = 1,
|
||||
.links = { SLAVE_DDR_EMI }
|
||||
};
|
||||
|
||||
static struct mtk_icc_node mcu_port3 = {
|
||||
.name = "mcu-port3",
|
||||
.id = MASTER_MCU_3,
|
||||
.ep = 0,
|
||||
.num_links = 1,
|
||||
.links = { SLAVE_DDR_EMI }
|
||||
};
|
||||
|
||||
static struct mtk_icc_node mcu_port4 = {
|
||||
.name = "mcu-port4",
|
||||
.id = MASTER_MCU_4,
|
||||
.ep = 0,
|
||||
.num_links = 1,
|
||||
.links = { SLAVE_DDR_EMI }
|
||||
};
|
||||
|
||||
static struct mtk_icc_node gpu = {
|
||||
.name = "gpu",
|
||||
.id = MASTER_GPUSYS,
|
||||
.ep = 0,
|
||||
.num_links = 1,
|
||||
.links = { SLAVE_DDR_EMI }
|
||||
};
|
||||
|
||||
static struct mtk_icc_node mmsys = {
|
||||
.name = "mmsys",
|
||||
.id = MASTER_MMSYS,
|
||||
.ep = 0,
|
||||
.num_links = 1,
|
||||
.links = { SLAVE_DDR_EMI }
|
||||
};
|
||||
|
||||
static struct mtk_icc_node mm_vpu = {
|
||||
.name = "mm-vpu",
|
||||
.id = MASTER_MM_VPU,
|
||||
.ep = 0,
|
||||
.num_links = 1,
|
||||
.links = { MASTER_MMSYS }
|
||||
};
|
||||
|
||||
static struct mtk_icc_node mm_disp = {
|
||||
.name = "mm-disp",
|
||||
.id = MASTER_MM_DISP,
|
||||
.ep = 0,
|
||||
.num_links = 1,
|
||||
.links = { MASTER_MMSYS }
|
||||
};
|
||||
|
||||
static struct mtk_icc_node mm_vdec = {
|
||||
.name = "mm-vdec",
|
||||
.id = MASTER_MM_VDEC,
|
||||
.ep = 0,
|
||||
.num_links = 1,
|
||||
.links = { MASTER_MMSYS }
|
||||
};
|
||||
|
||||
static struct mtk_icc_node mm_venc = {
|
||||
.name = "mm-venc",
|
||||
.id = MASTER_MM_VENC,
|
||||
.ep = 0,
|
||||
.num_links = 1,
|
||||
.links = { MASTER_MMSYS }
|
||||
};
|
||||
|
||||
static struct mtk_icc_node mm_cam = {
|
||||
.name = "mm-cam",
|
||||
.id = MASTER_MM_CAM,
|
||||
.ep = 0,
|
||||
.num_links = 1,
|
||||
.links = { MASTER_MMSYS }
|
||||
};
|
||||
|
||||
static struct mtk_icc_node mm_img = {
|
||||
.name = "mm-img",
|
||||
.id = MASTER_MM_IMG,
|
||||
.ep = 0,
|
||||
.num_links = 1,
|
||||
.links = { MASTER_MMSYS }
|
||||
};
|
||||
|
||||
static struct mtk_icc_node mm_mdp = {
|
||||
.name = "mm-mdp",
|
||||
.id = MASTER_MM_MDP,
|
||||
.ep = 0,
|
||||
.num_links = 1,
|
||||
.links = { MASTER_MMSYS }
|
||||
};
|
||||
|
||||
static struct mtk_icc_node vpusys = {
|
||||
.name = "vpusys",
|
||||
.id = MASTER_VPUSYS,
|
||||
.ep = 0,
|
||||
.num_links = 1,
|
||||
.links = { SLAVE_DDR_EMI }
|
||||
};
|
||||
|
||||
static struct mtk_icc_node vpu_port0 = {
|
||||
.name = "vpu-port0",
|
||||
.id = MASTER_VPU_0,
|
||||
.ep = 0,
|
||||
.num_links = 1,
|
||||
.links = { MASTER_VPUSYS }
|
||||
};
|
||||
|
||||
static struct mtk_icc_node vpu_port1 = {
|
||||
.name = "vpu-port1",
|
||||
.id = MASTER_VPU_1,
|
||||
.ep = 0,
|
||||
.num_links = 1,
|
||||
.links = { MASTER_VPUSYS }
|
||||
};
|
||||
|
||||
static struct mtk_icc_node mdlasys = {
|
||||
.name = "mdlasys",
|
||||
.id = MASTER_MDLASYS,
|
||||
.ep = 0,
|
||||
.num_links = 1,
|
||||
.links = { SLAVE_DDR_EMI }
|
||||
};
|
||||
|
||||
static struct mtk_icc_node mdla_port0 = {
|
||||
.name = "mdla-port0",
|
||||
.id = MASTER_MDLA_0,
|
||||
.ep = 0,
|
||||
.num_links = 1,
|
||||
.links = { MASTER_MDLASYS }
|
||||
};
|
||||
|
||||
static struct mtk_icc_node ufs = {
|
||||
.name = "ufs",
|
||||
.id = MASTER_UFS,
|
||||
.ep = 0,
|
||||
.num_links = 1,
|
||||
.links = { SLAVE_DDR_EMI }
|
||||
};
|
||||
|
||||
static struct mtk_icc_node pcie = {
|
||||
.name = "pcie",
|
||||
.id = MASTER_PCIE,
|
||||
.ep = 0,
|
||||
.num_links = 1,
|
||||
.links = { SLAVE_DDR_EMI }
|
||||
};
|
||||
|
||||
static struct mtk_icc_node usb = {
|
||||
.name = "usb",
|
||||
.id = MASTER_USB,
|
||||
.ep = 0,
|
||||
.num_links = 1,
|
||||
.links = { SLAVE_DDR_EMI }
|
||||
};
|
||||
|
||||
static struct mtk_icc_node wifi = {
|
||||
.name = "wifi",
|
||||
.id = MASTER_WIFI,
|
||||
.ep = 0,
|
||||
.num_links = 1,
|
||||
.links = { SLAVE_DDR_EMI }
|
||||
};
|
||||
|
||||
static struct mtk_icc_node bt = {
|
||||
.name = "bt",
|
||||
.id = MASTER_BT,
|
||||
.ep = 0,
|
||||
.num_links = 1,
|
||||
.links = { SLAVE_DDR_EMI }
|
||||
};
|
||||
|
||||
static struct mtk_icc_node netsys = {
|
||||
.name = "netsys",
|
||||
.id = MASTER_NETSYS,
|
||||
.ep = 0,
|
||||
.num_links = 1,
|
||||
.links = { SLAVE_DDR_EMI }
|
||||
};
|
||||
|
||||
static struct mtk_icc_node dbgif = {
|
||||
.name = "dbgif",
|
||||
.id = MASTER_DBGIF,
|
||||
.ep = 0,
|
||||
.num_links = 1,
|
||||
.links = { SLAVE_DDR_EMI }
|
||||
};
|
||||
|
||||
static struct mtk_icc_node hrt_ddr_emi = {
|
||||
.name = "hrt-ddr-emi",
|
||||
.id = SLAVE_HRT_DDR_EMI,
|
||||
.ep = 2,
|
||||
};
|
||||
|
||||
static struct mtk_icc_node hrt_mmsys = {
|
||||
.name = "hrt-mmsys",
|
||||
.id = MASTER_HRT_MMSYS,
|
||||
.ep = 0,
|
||||
.num_links = 1,
|
||||
.links = { SLAVE_HRT_DDR_EMI }
|
||||
};
|
||||
|
||||
static struct mtk_icc_node hrt_mm_disp = {
|
||||
.name = "hrt-mm-disp",
|
||||
.id = MASTER_HRT_MM_DISP,
|
||||
.ep = 0,
|
||||
.num_links = 1,
|
||||
.links = { MASTER_HRT_MMSYS }
|
||||
};
|
||||
|
||||
static struct mtk_icc_node hrt_mm_vdec = {
|
||||
.name = "hrt-mm-vdec",
|
||||
.id = MASTER_HRT_MM_VDEC,
|
||||
.ep = 0,
|
||||
.num_links = 1,
|
||||
.links = { MASTER_HRT_MMSYS }
|
||||
};
|
||||
|
||||
static struct mtk_icc_node hrt_mm_venc = {
|
||||
.name = "hrt-mm-venc",
|
||||
.id = MASTER_HRT_MM_VENC,
|
||||
.ep = 0,
|
||||
.num_links = 1,
|
||||
.links = { MASTER_HRT_MMSYS }
|
||||
};
|
||||
|
||||
static struct mtk_icc_node hrt_mm_cam = {
|
||||
.name = "hrt-mm-cam",
|
||||
.id = MASTER_HRT_MM_CAM,
|
||||
.ep = 0,
|
||||
.num_links = 1,
|
||||
.links = { MASTER_HRT_MMSYS }
|
||||
};
|
||||
|
||||
static struct mtk_icc_node hrt_mm_img = {
|
||||
.name = "hrt-mm-img",
|
||||
.id = MASTER_HRT_MM_IMG,
|
||||
.ep = 0,
|
||||
.num_links = 1,
|
||||
.links = { MASTER_HRT_MMSYS }
|
||||
};
|
||||
|
||||
static struct mtk_icc_node hrt_mm_mdp = {
|
||||
.name = "hrt-mm-mdp",
|
||||
.id = MASTER_HRT_MM_MDP,
|
||||
.ep = 0,
|
||||
.num_links = 1,
|
||||
.links = { MASTER_HRT_MMSYS }
|
||||
};
|
||||
|
||||
static struct mtk_icc_node hrt_adsp = {
|
||||
.name = "hrt-adsp",
|
||||
.id = MASTER_HRT_ADSP,
|
||||
.ep = 0,
|
||||
.num_links = 1,
|
||||
.links = { SLAVE_HRT_DDR_EMI }
|
||||
};
|
||||
|
||||
static struct mtk_icc_node hrt_dbgif = {
|
||||
.name = "hrt-dbgif",
|
||||
.id = MASTER_HRT_DBGIF,
|
||||
.ep = 0,
|
||||
.num_links = 1,
|
||||
.links = { SLAVE_HRT_DDR_EMI }
|
||||
};
|
||||
|
||||
static struct mtk_icc_node *mt8196_emi_icc_nodes[] = {
|
||||
[SLAVE_DDR_EMI] = &ddr_emi,
|
||||
[MASTER_MCUSYS] = &mcusys,
|
||||
[MASTER_MCU_0] = &mcu_port0,
|
||||
[MASTER_MCU_1] = &mcu_port1,
|
||||
[MASTER_MCU_2] = &mcu_port2,
|
||||
[MASTER_MCU_3] = &mcu_port3,
|
||||
[MASTER_MCU_4] = &mcu_port4,
|
||||
[MASTER_GPUSYS] = &gpu,
|
||||
[MASTER_MMSYS] = &mmsys,
|
||||
[MASTER_MM_VPU] = &mm_vpu,
|
||||
[MASTER_MM_DISP] = &mm_disp,
|
||||
[MASTER_MM_VDEC] = &mm_vdec,
|
||||
[MASTER_MM_VENC] = &mm_venc,
|
||||
[MASTER_MM_CAM] = &mm_cam,
|
||||
[MASTER_MM_IMG] = &mm_img,
|
||||
[MASTER_MM_MDP] = &mm_mdp,
|
||||
[MASTER_VPUSYS] = &vpusys,
|
||||
[MASTER_VPU_0] = &vpu_port0,
|
||||
[MASTER_VPU_1] = &vpu_port1,
|
||||
[MASTER_MDLASYS] = &mdlasys,
|
||||
[MASTER_MDLA_0] = &mdla_port0,
|
||||
[MASTER_UFS] = &ufs,
|
||||
[MASTER_PCIE] = &pcie,
|
||||
[MASTER_USB] = &usb,
|
||||
[MASTER_WIFI] = &wifi,
|
||||
[MASTER_BT] = &bt,
|
||||
[MASTER_NETSYS] = &netsys,
|
||||
[MASTER_DBGIF] = &dbgif,
|
||||
[SLAVE_HRT_DDR_EMI] = &hrt_ddr_emi,
|
||||
[MASTER_HRT_MMSYS] = &hrt_mmsys,
|
||||
[MASTER_HRT_MM_DISP] = &hrt_mm_disp,
|
||||
[MASTER_HRT_MM_VDEC] = &hrt_mm_vdec,
|
||||
[MASTER_HRT_MM_VENC] = &hrt_mm_venc,
|
||||
[MASTER_HRT_MM_CAM] = &hrt_mm_cam,
|
||||
[MASTER_HRT_MM_IMG] = &hrt_mm_img,
|
||||
[MASTER_HRT_MM_MDP] = &hrt_mm_mdp,
|
||||
[MASTER_HRT_ADSP] = &hrt_adsp,
|
||||
[MASTER_HRT_DBGIF] = &hrt_dbgif
|
||||
};
|
||||
|
||||
static struct mtk_icc_desc mt8196_emi_icc = {
|
||||
.nodes = mt8196_emi_icc_nodes,
|
||||
.num_nodes = ARRAY_SIZE(mt8196_emi_icc_nodes),
|
||||
};
|
||||
|
||||
static const struct of_device_id mtk_mt8196_emi_icc_of_match[] = {
|
||||
{ .compatible = "mediatek,mt8196-emi", .data = &mt8196_emi_icc },
|
||||
{ /* sentinel */ },
|
||||
};
|
||||
MODULE_DEVICE_TABLE(of, mtk_mt8196_emi_icc_of_match);
|
||||
|
||||
static struct platform_driver mtk_emi_icc_mt8196_driver = {
|
||||
.driver = {
|
||||
.name = "emi-icc-mt8196",
|
||||
.of_match_table = mtk_mt8196_emi_icc_of_match,
|
||||
.sync_state = icc_sync_state,
|
||||
},
|
||||
.probe = mtk_emi_icc_probe,
|
||||
.remove = mtk_emi_icc_remove,
|
||||
|
||||
};
|
||||
module_platform_driver(mtk_emi_icc_mt8196_driver);
|
||||
|
||||
MODULE_AUTHOR("AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>");
|
||||
MODULE_DESCRIPTION("MediaTek MT8196 EMI ICC driver");
|
||||
MODULE_LICENSE("GPL");
|
||||
|
|
@ -173,9 +173,6 @@ enum {
|
|||
MSM8974_SNOC_SLV_QDSS_STM,
|
||||
};
|
||||
|
||||
#define RPM_BUS_MASTER_REQ 0x73616d62
|
||||
#define RPM_BUS_SLAVE_REQ 0x766c7362
|
||||
|
||||
#define to_msm8974_icc_provider(_provider) \
|
||||
container_of(_provider, struct msm8974_icc_provider, provider)
|
||||
|
||||
|
|
|
|||
|
|
@ -629,7 +629,7 @@ static struct qcom_icc_node qxm_nsp = {
|
|||
.name = "qxm_nsp",
|
||||
.channels = 2,
|
||||
.buswidth = 32,
|
||||
.num_links = 1,
|
||||
.num_links = 2,
|
||||
.link_nodes = { &qns_hcp, &qns_nsp_gemnoc },
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -14,7 +14,6 @@
|
|||
#include "icc-rpm.h"
|
||||
|
||||
#define RPM_KEY_BW 0x00007762
|
||||
#define QCOM_RPM_SMD_KEY_RATE 0x007a484b
|
||||
|
||||
static struct qcom_smd_rpm *icc_smd_rpm;
|
||||
|
||||
|
|
|
|||
48
include/dt-bindings/interconnect/mediatek,mt8196.h
Normal file
48
include/dt-bindings/interconnect/mediatek,mt8196.h
Normal file
|
|
@ -0,0 +1,48 @@
|
|||
/* SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) */
|
||||
/*
|
||||
* Copyright (c) 2025 Collabora Ltd.
|
||||
* AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
|
||||
*/
|
||||
|
||||
#ifndef __DT_BINDINGS_INTERCONNECT_MEDIATEK_MT8196_H
|
||||
#define __DT_BINDINGS_INTERCONNECT_MEDIATEK_MT8196_H
|
||||
|
||||
#define SLAVE_DDR_EMI 0
|
||||
#define MASTER_MCUSYS 1
|
||||
#define MASTER_MCU_0 2
|
||||
#define MASTER_MCU_1 3
|
||||
#define MASTER_MCU_2 4
|
||||
#define MASTER_MCU_3 5
|
||||
#define MASTER_MCU_4 6
|
||||
#define MASTER_GPUSYS 7
|
||||
#define MASTER_MMSYS 8
|
||||
#define MASTER_MM_VPU 9
|
||||
#define MASTER_MM_DISP 10
|
||||
#define MASTER_MM_VDEC 11
|
||||
#define MASTER_MM_VENC 12
|
||||
#define MASTER_MM_CAM 13
|
||||
#define MASTER_MM_IMG 14
|
||||
#define MASTER_MM_MDP 15
|
||||
#define MASTER_VPUSYS 16
|
||||
#define MASTER_VPU_0 17
|
||||
#define MASTER_VPU_1 18
|
||||
#define MASTER_MDLASYS 19
|
||||
#define MASTER_MDLA_0 20
|
||||
#define MASTER_UFS 21
|
||||
#define MASTER_PCIE 22
|
||||
#define MASTER_USB 23
|
||||
#define MASTER_WIFI 24
|
||||
#define MASTER_BT 25
|
||||
#define MASTER_NETSYS 26
|
||||
#define MASTER_DBGIF 27
|
||||
#define SLAVE_HRT_DDR_EMI 28
|
||||
#define MASTER_HRT_MMSYS 29
|
||||
#define MASTER_HRT_MM_DISP 30
|
||||
#define MASTER_HRT_MM_VDEC 31
|
||||
#define MASTER_HRT_MM_VENC 32
|
||||
#define MASTER_HRT_MM_CAM 33
|
||||
#define MASTER_HRT_MM_IMG 34
|
||||
#define MASTER_HRT_MM_MDP 35
|
||||
#define MASTER_HRT_ADSP 36
|
||||
#define MASTER_HRT_DBGIF 37
|
||||
#endif
|
||||
Loading…
Reference in New Issue
Block a user