soc: imx: add icc paths for i.MX8MP hsio/hdmi blk ctrl

Add interconnect paths for i.MX8MP hsio/hdmi blk ctrl

Signed-off-by: Peng Fan <peng.fan@nxp.com>
Signed-off-by: Shawn Guo <shawnguo@kernel.org>
This commit is contained in:
Peng Fan 2022-07-08 16:56:30 +08:00 committed by Shawn Guo
parent c553ca9245
commit 50299fa1f8

View File

@ -6,6 +6,7 @@
#include <linux/clk.h> #include <linux/clk.h>
#include <linux/device.h> #include <linux/device.h>
#include <linux/interconnect.h>
#include <linux/module.h> #include <linux/module.h>
#include <linux/of_device.h> #include <linux/of_device.h>
#include <linux/platform_device.h> #include <linux/platform_device.h>
@ -36,17 +37,22 @@ struct imx8mp_blk_ctrl_domain_data {
const char *name; const char *name;
const char * const *clk_names; const char * const *clk_names;
int num_clks; int num_clks;
const char * const *path_names;
int num_paths;
const char *gpc_name; const char *gpc_name;
}; };
#define DOMAIN_MAX_CLKS 2 #define DOMAIN_MAX_CLKS 2
#define DOMAIN_MAX_PATHS 3
struct imx8mp_blk_ctrl_domain { struct imx8mp_blk_ctrl_domain {
struct generic_pm_domain genpd; struct generic_pm_domain genpd;
const struct imx8mp_blk_ctrl_domain_data *data; const struct imx8mp_blk_ctrl_domain_data *data;
struct clk_bulk_data clks[DOMAIN_MAX_CLKS]; struct clk_bulk_data clks[DOMAIN_MAX_CLKS];
struct icc_bulk_data paths[DOMAIN_MAX_PATHS];
struct device *power_dev; struct device *power_dev;
struct imx8mp_blk_ctrl *bc; struct imx8mp_blk_ctrl *bc;
int num_paths;
int id; int id;
}; };
@ -144,6 +150,8 @@ static const struct imx8mp_blk_ctrl_domain_data imx8mp_hsio_domain_data[] = {
.clk_names = (const char *[]){ "usb" }, .clk_names = (const char *[]){ "usb" },
.num_clks = 1, .num_clks = 1,
.gpc_name = "usb", .gpc_name = "usb",
.path_names = (const char *[]){"usb1", "usb2"},
.num_paths = 2,
}, },
[IMX8MP_HSIOBLK_PD_USB_PHY1] = { [IMX8MP_HSIOBLK_PD_USB_PHY1] = {
.name = "hsioblk-usb-phy1", .name = "hsioblk-usb-phy1",
@ -158,6 +166,8 @@ static const struct imx8mp_blk_ctrl_domain_data imx8mp_hsio_domain_data[] = {
.clk_names = (const char *[]){ "pcie" }, .clk_names = (const char *[]){ "pcie" },
.num_clks = 1, .num_clks = 1,
.gpc_name = "pcie", .gpc_name = "pcie",
.path_names = (const char *[]){"noc-pcie", "pcie"},
.num_paths = 2,
}, },
[IMX8MP_HSIOBLK_PD_PCIE_PHY] = { [IMX8MP_HSIOBLK_PD_PCIE_PHY] = {
.name = "hsioblk-pcie-phy", .name = "hsioblk-pcie-phy",
@ -322,6 +332,8 @@ static const struct imx8mp_blk_ctrl_domain_data imx8mp_hdmi_domain_data[] = {
.clk_names = (const char *[]){ "axi", "apb" }, .clk_names = (const char *[]){ "axi", "apb" },
.num_clks = 2, .num_clks = 2,
.gpc_name = "lcdif", .gpc_name = "lcdif",
.path_names = (const char *[]){"lcdif-hdmi"},
.num_paths = 1,
}, },
[IMX8MP_HDMIBLK_PD_PAI] = { [IMX8MP_HDMIBLK_PD_PAI] = {
.name = "hdmiblk-pai", .name = "hdmiblk-pai",
@ -395,6 +407,10 @@ static int imx8mp_blk_ctrl_power_on(struct generic_pm_domain *genpd)
goto clk_disable; goto clk_disable;
} }
ret = icc_bulk_set_bw(domain->num_paths, domain->paths);
if (ret)
dev_err(bc->dev, "failed to set icc bw\n");
clk_bulk_disable_unprepare(data->num_clks, domain->clks); clk_bulk_disable_unprepare(data->num_clks, domain->clks);
return 0; return 0;
@ -510,10 +526,29 @@ static int imx8mp_blk_ctrl_probe(struct platform_device *pdev)
int j; int j;
domain->data = data; domain->data = data;
domain->num_paths = data->num_paths;
for (j = 0; j < data->num_clks; j++) for (j = 0; j < data->num_clks; j++)
domain->clks[j].id = data->clk_names[j]; domain->clks[j].id = data->clk_names[j];
for (j = 0; j < data->num_paths; j++) {
domain->paths[j].name = data->path_names[j];
/* Fake value for now, just let ICC could configure NoC mode/priority */
domain->paths[j].avg_bw = 1;
domain->paths[j].peak_bw = 1;
}
ret = devm_of_icc_bulk_get(dev, data->num_paths, domain->paths);
if (ret) {
if (ret != -EPROBE_DEFER) {
dev_warn_once(dev, "Could not get interconnect paths, NoC will stay unconfigured!\n");
domain->num_paths = 0;
} else {
dev_err_probe(dev, ret, "failed to get noc entries\n");
goto cleanup_pds;
}
}
ret = devm_clk_bulk_get(dev, data->num_clks, domain->clks); ret = devm_clk_bulk_get(dev, data->num_clks, domain->clks);
if (ret) { if (ret) {
dev_err_probe(dev, ret, "failed to get clock\n"); dev_err_probe(dev, ret, "failed to get clock\n");