diff mbox series

[V2,4/8] soc: imx: add icc paths for i.MX8MP media blk ctrl

Message ID 20220616073953.2204978-5-peng.fan@oss.nxp.com (mailing list archive)
State New, archived
Headers show
Series Add interconnect for i.MX8MP blk ctrl | expand

Commit Message

Peng Fan (OSS) June 16, 2022, 7:39 a.m. UTC
From: Peng Fan <peng.fan@nxp.com>

Add interconnect paths for i.MX8MP media blk ctrl

Signed-off-by: Peng Fan <peng.fan@nxp.com>
---
 drivers/soc/imx/imx8m-blk-ctrl.c | 32 ++++++++++++++++++++++++++++++++
 1 file changed, 32 insertions(+)

Comments

kernel test robot June 16, 2022, 10:09 a.m. UTC | #1
Hi "Peng,

Thank you for the patch! Yet something to improve:

[auto build test ERROR on robh/for-next]
[also build test ERROR on shawnguo/for-next linus/master v5.19-rc2 next-20220616]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]

url:    https://github.com/intel-lab-lkp/linux/commits/Peng-Fan-OSS/Add-interconnect-for-i-MX8MP-blk-ctrl/20220616-153932
base:   https://git.kernel.org/pub/scm/linux/kernel/git/robh/linux.git for-next
config: arc-randconfig-r043-20220616 (https://download.01.org/0day-ci/archive/20220616/202206161757.tudlinMv-lkp@intel.com/config)
compiler: arc-elf-gcc (GCC) 11.3.0
reproduce (this is a W=1 build):
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # https://github.com/intel-lab-lkp/linux/commit/118c632adf7409c5a51e85fa0c61286665116b10
        git remote add linux-review https://github.com/intel-lab-lkp/linux
        git fetch --no-tags linux-review Peng-Fan-OSS/Add-interconnect-for-i-MX8MP-blk-ctrl/20220616-153932
        git checkout 118c632adf7409c5a51e85fa0c61286665116b10
        # save the config file
        mkdir build_dir && cp config build_dir/.config
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-11.3.0 make.cross W=1 O=build_dir ARCH=arc SHELL=/bin/bash drivers/soc/imx/

If you fix the issue, kindly add following tag where applicable
Reported-by: kernel test robot <lkp@intel.com>

All errors (new ones prefixed by >>):

   drivers/soc/imx/imx8m-blk-ctrl.c: In function 'imx8m_blk_ctrl_probe':
>> drivers/soc/imx/imx8m-blk-ctrl.c:247:23: error: implicit declaration of function 'devm_of_icc_bulk_get'; did you mean 'of_icc_bulk_get'? [-Werror=implicit-function-declaration]
     247 |                 ret = devm_of_icc_bulk_get(dev, data->num_paths, domain->paths);
         |                       ^~~~~~~~~~~~~~~~~~~~
         |                       of_icc_bulk_get
   cc1: some warnings being treated as errors


vim +247 drivers/soc/imx/imx8m-blk-ctrl.c

   178	
   179	static int imx8m_blk_ctrl_probe(struct platform_device *pdev)
   180	{
   181		const struct imx8m_blk_ctrl_data *bc_data;
   182		struct device *dev = &pdev->dev;
   183		struct imx8m_blk_ctrl *bc;
   184		void __iomem *base;
   185		int i, ret;
   186	
   187		struct regmap_config regmap_config = {
   188			.reg_bits	= 32,
   189			.val_bits	= 32,
   190			.reg_stride	= 4,
   191		};
   192	
   193		bc = devm_kzalloc(dev, sizeof(*bc), GFP_KERNEL);
   194		if (!bc)
   195			return -ENOMEM;
   196	
   197		bc->dev = dev;
   198	
   199		bc_data = of_device_get_match_data(dev);
   200	
   201		base = devm_platform_ioremap_resource(pdev, 0);
   202		if (IS_ERR(base))
   203			return PTR_ERR(base);
   204	
   205		regmap_config.max_register = bc_data->max_reg;
   206		bc->regmap = devm_regmap_init_mmio(dev, base, &regmap_config);
   207		if (IS_ERR(bc->regmap))
   208			return dev_err_probe(dev, PTR_ERR(bc->regmap),
   209					     "failed to init regmap\n");
   210	
   211		bc->domains = devm_kcalloc(dev, bc_data->num_domains,
   212					   sizeof(struct imx8m_blk_ctrl_domain),
   213					   GFP_KERNEL);
   214		if (!bc->domains)
   215			return -ENOMEM;
   216	
   217		bc->onecell_data.num_domains = bc_data->num_domains;
   218		bc->onecell_data.xlate = imx8m_blk_ctrl_xlate;
   219		bc->onecell_data.domains =
   220			devm_kcalloc(dev, bc_data->num_domains,
   221				     sizeof(struct generic_pm_domain *), GFP_KERNEL);
   222		if (!bc->onecell_data.domains)
   223			return -ENOMEM;
   224	
   225		bc->bus_power_dev = genpd_dev_pm_attach_by_name(dev, "bus");
   226		if (IS_ERR(bc->bus_power_dev))
   227			return dev_err_probe(dev, PTR_ERR(bc->bus_power_dev),
   228					     "failed to attach power domain\n");
   229	
   230		for (i = 0; i < bc_data->num_domains; i++) {
   231			const struct imx8m_blk_ctrl_domain_data *data = &bc_data->domains[i];
   232			struct imx8m_blk_ctrl_domain *domain = &bc->domains[i];
   233			int j;
   234	
   235			domain->data = data;
   236	
   237			for (j = 0; j < data->num_clks; j++)
   238				domain->clks[j].id = data->clk_names[j];
   239	
   240			for (j = 0; j < data->num_paths; j++) {
   241				domain->paths[j].name = data->path_names[j];
   242				/* Fake value for now, just let ICC could configure NoC mode/priority */
   243				domain->paths[j].avg_bw = 1;
   244				domain->paths[j].peak_bw = 1;
   245			}
   246	
 > 247			ret = devm_of_icc_bulk_get(dev, data->num_paths, domain->paths);
   248			if (ret) {
   249				dev_err_probe(dev, ret, "failed to get noc entries\n");
   250				goto cleanup_pds;
   251			}
   252	
   253			ret = devm_clk_bulk_get(dev, data->num_clks, domain->clks);
   254			if (ret) {
   255				dev_err_probe(dev, ret, "failed to get clock\n");
   256				goto cleanup_pds;
   257			}
   258	
   259			domain->power_dev =
   260				dev_pm_domain_attach_by_name(dev, data->gpc_name);
   261			if (IS_ERR(domain->power_dev)) {
   262				dev_err_probe(dev, PTR_ERR(domain->power_dev),
   263					      "failed to attach power domain\n");
   264				ret = PTR_ERR(domain->power_dev);
   265				goto cleanup_pds;
   266			}
   267			dev_set_name(domain->power_dev, "%s", data->name);
   268	
   269			domain->genpd.name = data->name;
   270			domain->genpd.power_on = imx8m_blk_ctrl_power_on;
   271			domain->genpd.power_off = imx8m_blk_ctrl_power_off;
   272			domain->bc = bc;
   273	
   274			ret = pm_genpd_init(&domain->genpd, NULL, true);
   275			if (ret) {
   276				dev_err_probe(dev, ret, "failed to init power domain\n");
   277				dev_pm_domain_detach(domain->power_dev, true);
   278				goto cleanup_pds;
   279			}
   280	
   281			/*
   282			 * We use runtime PM to trigger power on/off of the upstream GPC
   283			 * domain, as a strict hierarchical parent/child power domain
   284			 * setup doesn't allow us to meet the sequencing requirements.
   285			 * This means we have nested locking of genpd locks, without the
   286			 * nesting being visible at the genpd level, so we need a
   287			 * separate lock class to make lockdep aware of the fact that
   288			 * this are separate domain locks that can be nested without a
   289			 * self-deadlock.
   290			 */
   291			lockdep_set_class(&domain->genpd.mlock,
   292					  &blk_ctrl_genpd_lock_class);
   293	
   294			bc->onecell_data.domains[i] = &domain->genpd;
   295		}
   296	
   297		ret = of_genpd_add_provider_onecell(dev->of_node, &bc->onecell_data);
   298		if (ret) {
   299			dev_err_probe(dev, ret, "failed to add power domain provider\n");
   300			goto cleanup_pds;
   301		}
   302	
   303		bc->power_nb.notifier_call = bc_data->power_notifier_fn;
   304		ret = dev_pm_genpd_add_notifier(bc->bus_power_dev, &bc->power_nb);
   305		if (ret) {
   306			dev_err_probe(dev, ret, "failed to add power notifier\n");
   307			goto cleanup_provider;
   308		}
   309	
   310		dev_set_drvdata(dev, bc);
   311	
   312		return 0;
   313	
   314	cleanup_provider:
   315		of_genpd_del_provider(dev->of_node);
   316	cleanup_pds:
   317		for (i--; i >= 0; i--) {
   318			pm_genpd_remove(&bc->domains[i].genpd);
   319			dev_pm_domain_detach(bc->domains[i].power_dev, true);
   320		}
   321	
   322		dev_pm_domain_detach(bc->bus_power_dev, true);
   323	
   324		return ret;
   325	}
   326
kernel test robot June 16, 2022, 11:18 p.m. UTC | #2
Hi "Peng,

Thank you for the patch! Yet something to improve:

[auto build test ERROR on robh/for-next]
[also build test ERROR on shawnguo/for-next linus/master v5.19-rc2 next-20220616]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]

url:    https://github.com/intel-lab-lkp/linux/commits/Peng-Fan-OSS/Add-interconnect-for-i-MX8MP-blk-ctrl/20220616-153932
base:   https://git.kernel.org/pub/scm/linux/kernel/git/robh/linux.git for-next
config: hexagon-randconfig-r045-20220616 (https://download.01.org/0day-ci/archive/20220617/202206170720.eTetqCJ6-lkp@intel.com/config)
compiler: clang version 15.0.0 (https://github.com/llvm/llvm-project f0e608de27b3d568000046eebf3712ab542979d6)
reproduce (this is a W=1 build):
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # https://github.com/intel-lab-lkp/linux/commit/118c632adf7409c5a51e85fa0c61286665116b10
        git remote add linux-review https://github.com/intel-lab-lkp/linux
        git fetch --no-tags linux-review Peng-Fan-OSS/Add-interconnect-for-i-MX8MP-blk-ctrl/20220616-153932
        git checkout 118c632adf7409c5a51e85fa0c61286665116b10
        # save the config file
        mkdir build_dir && cp config build_dir/.config
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=hexagon SHELL=/bin/bash drivers/soc/

If you fix the issue, kindly add following tag where applicable
Reported-by: kernel test robot <lkp@intel.com>

All errors (new ones prefixed by >>):

>> drivers/soc/imx/imx8m-blk-ctrl.c:247:9: error: call to undeclared function 'devm_of_icc_bulk_get'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
                   ret = devm_of_icc_bulk_get(dev, data->num_paths, domain->paths);
                         ^
   1 error generated.


vim +/devm_of_icc_bulk_get +247 drivers/soc/imx/imx8m-blk-ctrl.c

   178	
   179	static int imx8m_blk_ctrl_probe(struct platform_device *pdev)
   180	{
   181		const struct imx8m_blk_ctrl_data *bc_data;
   182		struct device *dev = &pdev->dev;
   183		struct imx8m_blk_ctrl *bc;
   184		void __iomem *base;
   185		int i, ret;
   186	
   187		struct regmap_config regmap_config = {
   188			.reg_bits	= 32,
   189			.val_bits	= 32,
   190			.reg_stride	= 4,
   191		};
   192	
   193		bc = devm_kzalloc(dev, sizeof(*bc), GFP_KERNEL);
   194		if (!bc)
   195			return -ENOMEM;
   196	
   197		bc->dev = dev;
   198	
   199		bc_data = of_device_get_match_data(dev);
   200	
   201		base = devm_platform_ioremap_resource(pdev, 0);
   202		if (IS_ERR(base))
   203			return PTR_ERR(base);
   204	
   205		regmap_config.max_register = bc_data->max_reg;
   206		bc->regmap = devm_regmap_init_mmio(dev, base, &regmap_config);
   207		if (IS_ERR(bc->regmap))
   208			return dev_err_probe(dev, PTR_ERR(bc->regmap),
   209					     "failed to init regmap\n");
   210	
   211		bc->domains = devm_kcalloc(dev, bc_data->num_domains,
   212					   sizeof(struct imx8m_blk_ctrl_domain),
   213					   GFP_KERNEL);
   214		if (!bc->domains)
   215			return -ENOMEM;
   216	
   217		bc->onecell_data.num_domains = bc_data->num_domains;
   218		bc->onecell_data.xlate = imx8m_blk_ctrl_xlate;
   219		bc->onecell_data.domains =
   220			devm_kcalloc(dev, bc_data->num_domains,
   221				     sizeof(struct generic_pm_domain *), GFP_KERNEL);
   222		if (!bc->onecell_data.domains)
   223			return -ENOMEM;
   224	
   225		bc->bus_power_dev = genpd_dev_pm_attach_by_name(dev, "bus");
   226		if (IS_ERR(bc->bus_power_dev))
   227			return dev_err_probe(dev, PTR_ERR(bc->bus_power_dev),
   228					     "failed to attach power domain\n");
   229	
   230		for (i = 0; i < bc_data->num_domains; i++) {
   231			const struct imx8m_blk_ctrl_domain_data *data = &bc_data->domains[i];
   232			struct imx8m_blk_ctrl_domain *domain = &bc->domains[i];
   233			int j;
   234	
   235			domain->data = data;
   236	
   237			for (j = 0; j < data->num_clks; j++)
   238				domain->clks[j].id = data->clk_names[j];
   239	
   240			for (j = 0; j < data->num_paths; j++) {
   241				domain->paths[j].name = data->path_names[j];
   242				/* Fake value for now, just let ICC could configure NoC mode/priority */
   243				domain->paths[j].avg_bw = 1;
   244				domain->paths[j].peak_bw = 1;
   245			}
   246	
 > 247			ret = devm_of_icc_bulk_get(dev, data->num_paths, domain->paths);
   248			if (ret) {
   249				dev_err_probe(dev, ret, "failed to get noc entries\n");
   250				goto cleanup_pds;
   251			}
   252	
   253			ret = devm_clk_bulk_get(dev, data->num_clks, domain->clks);
   254			if (ret) {
   255				dev_err_probe(dev, ret, "failed to get clock\n");
   256				goto cleanup_pds;
   257			}
   258	
   259			domain->power_dev =
   260				dev_pm_domain_attach_by_name(dev, data->gpc_name);
   261			if (IS_ERR(domain->power_dev)) {
   262				dev_err_probe(dev, PTR_ERR(domain->power_dev),
   263					      "failed to attach power domain\n");
   264				ret = PTR_ERR(domain->power_dev);
   265				goto cleanup_pds;
   266			}
   267			dev_set_name(domain->power_dev, "%s", data->name);
   268	
   269			domain->genpd.name = data->name;
   270			domain->genpd.power_on = imx8m_blk_ctrl_power_on;
   271			domain->genpd.power_off = imx8m_blk_ctrl_power_off;
   272			domain->bc = bc;
   273	
   274			ret = pm_genpd_init(&domain->genpd, NULL, true);
   275			if (ret) {
   276				dev_err_probe(dev, ret, "failed to init power domain\n");
   277				dev_pm_domain_detach(domain->power_dev, true);
   278				goto cleanup_pds;
   279			}
   280	
   281			/*
   282			 * We use runtime PM to trigger power on/off of the upstream GPC
   283			 * domain, as a strict hierarchical parent/child power domain
   284			 * setup doesn't allow us to meet the sequencing requirements.
   285			 * This means we have nested locking of genpd locks, without the
   286			 * nesting being visible at the genpd level, so we need a
   287			 * separate lock class to make lockdep aware of the fact that
   288			 * this are separate domain locks that can be nested without a
   289			 * self-deadlock.
   290			 */
   291			lockdep_set_class(&domain->genpd.mlock,
   292					  &blk_ctrl_genpd_lock_class);
   293	
   294			bc->onecell_data.domains[i] = &domain->genpd;
   295		}
   296	
   297		ret = of_genpd_add_provider_onecell(dev->of_node, &bc->onecell_data);
   298		if (ret) {
   299			dev_err_probe(dev, ret, "failed to add power domain provider\n");
   300			goto cleanup_pds;
   301		}
   302	
   303		bc->power_nb.notifier_call = bc_data->power_notifier_fn;
   304		ret = dev_pm_genpd_add_notifier(bc->bus_power_dev, &bc->power_nb);
   305		if (ret) {
   306			dev_err_probe(dev, ret, "failed to add power notifier\n");
   307			goto cleanup_provider;
   308		}
   309	
   310		dev_set_drvdata(dev, bc);
   311	
   312		return 0;
   313	
   314	cleanup_provider:
   315		of_genpd_del_provider(dev->of_node);
   316	cleanup_pds:
   317		for (i--; i >= 0; i--) {
   318			pm_genpd_remove(&bc->domains[i].genpd);
   319			dev_pm_domain_detach(bc->domains[i].power_dev, true);
   320		}
   321	
   322		dev_pm_domain_detach(bc->bus_power_dev, true);
   323	
   324		return ret;
   325	}
   326
diff mbox series

Patch

diff --git a/drivers/soc/imx/imx8m-blk-ctrl.c b/drivers/soc/imx/imx8m-blk-ctrl.c
index 7ebc28709e94..fc0b94be6439 100644
--- a/drivers/soc/imx/imx8m-blk-ctrl.c
+++ b/drivers/soc/imx/imx8m-blk-ctrl.c
@@ -5,6 +5,7 @@ 
  */
 
 #include <linux/device.h>
+#include <linux/interconnect.h>
 #include <linux/module.h>
 #include <linux/of_device.h>
 #include <linux/platform_device.h>
@@ -37,6 +38,8 @@  struct imx8m_blk_ctrl_domain_data {
 	const char *name;
 	const char * const *clk_names;
 	int num_clks;
+	const char * const *path_names;
+	int num_paths;
 	const char *gpc_name;
 	u32 rst_mask;
 	u32 clk_mask;
@@ -52,11 +55,13 @@  struct imx8m_blk_ctrl_domain_data {
 };
 
 #define DOMAIN_MAX_CLKS 4
+#define DOMAIN_MAX_PATHS 4
 
 struct imx8m_blk_ctrl_domain {
 	struct generic_pm_domain genpd;
 	const struct imx8m_blk_ctrl_domain_data *data;
 	struct clk_bulk_data clks[DOMAIN_MAX_CLKS];
+	struct icc_bulk_data paths[DOMAIN_MAX_PATHS];
 	struct device *power_dev;
 	struct imx8m_blk_ctrl *bc;
 };
@@ -117,6 +122,10 @@  static int imx8m_blk_ctrl_power_on(struct generic_pm_domain *genpd)
 	if (data->mipi_phy_rst_mask)
 		regmap_set_bits(bc->regmap, BLK_MIPI_RESET_DIV, data->mipi_phy_rst_mask);
 
+	ret = icc_bulk_set_bw(data->num_paths, domain->paths);
+	if (ret)
+		dev_err(bc->dev, "failed to set icc bw\n");
+
 	/* disable upstream clocks */
 	clk_bulk_disable_unprepare(data->num_clks, domain->clks);
 
@@ -228,6 +237,19 @@  static int imx8m_blk_ctrl_probe(struct platform_device *pdev)
 		for (j = 0; j < data->num_clks; 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) {
+			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);
 		if (ret) {
 			dev_err_probe(dev, ret, "failed to get clock\n");
@@ -647,6 +669,8 @@  static const struct imx8m_blk_ctrl_domain_data imx8mp_media_blk_ctl_domain_data[
 		.gpc_name = "lcdif1",
 		.rst_mask = BIT(4) | BIT(5) | BIT(23),
 		.clk_mask = BIT(4) | BIT(5) | BIT(23),
+		.path_names = (const char *[]){"lcdif-rd", "lcdif-wr"},
+		.num_paths = 2,
 	},
 	[IMX8MP_MEDIABLK_PD_ISI] = {
 		.name = "mediablk-isi",
@@ -655,6 +679,8 @@  static const struct imx8m_blk_ctrl_domain_data imx8mp_media_blk_ctl_domain_data[
 		.gpc_name = "isi",
 		.rst_mask = BIT(6) | BIT(7),
 		.clk_mask = BIT(6) | BIT(7),
+		.path_names = (const char *[]){"isi0", "isi1", "isi2"},
+		.num_paths = 3,
 	},
 	[IMX8MP_MEDIABLK_PD_MIPI_CSI2_2] = {
 		.name = "mediablk-mipi-csi2-2",
@@ -672,6 +698,8 @@  static const struct imx8m_blk_ctrl_domain_data imx8mp_media_blk_ctl_domain_data[
 		.gpc_name = "lcdif2",
 		.rst_mask = BIT(11) | BIT(12) | BIT(24),
 		.clk_mask = BIT(11) | BIT(12) | BIT(24),
+		.path_names = (const char *[]){"lcdif-rd", "lcdif-wr"},
+		.num_paths = 2,
 	},
 	[IMX8MP_MEDIABLK_PD_ISP] = {
 		.name = "mediablk-isp",
@@ -680,6 +708,8 @@  static const struct imx8m_blk_ctrl_domain_data imx8mp_media_blk_ctl_domain_data[
 		.gpc_name = "isp",
 		.rst_mask = BIT(16) | BIT(17) | BIT(18),
 		.clk_mask = BIT(16) | BIT(17) | BIT(18),
+		.path_names = (const char *[]){"isp0", "isp1"},
+		.num_paths = 2,
 	},
 	[IMX8MP_MEDIABLK_PD_DWE] = {
 		.name = "mediablk-dwe",
@@ -688,6 +718,8 @@  static const struct imx8m_blk_ctrl_domain_data imx8mp_media_blk_ctl_domain_data[
 		.gpc_name = "dwe",
 		.rst_mask = BIT(19) | BIT(20) | BIT(21),
 		.clk_mask = BIT(19) | BIT(20) | BIT(21),
+		.path_names = (const char *[]){"dwe"},
+		.num_paths = 1,
 	},
 	[IMX8MP_MEDIABLK_PD_MIPI_DSI_2] = {
 		.name = "mediablk-mipi-dsi-2",