soc: imx: Refactor BLK CTRL driver
cover soc: imx: Refactor BLK CTRL driver
This splits the SoC specific parts into separate drivers for i.MX8MM and i.MX8MN. Should be more readable and easier to maintain.
As for the i.MX8MP BLK CTRL driver (sent by Lucas here:
https://lore.kernel.org/linux-arm-kernel/[email protected]/raw)
It can remain as a separate driver until we figure out what is the overlap and how can we make it use the generic part.
This patchset doesn't rely on the above-mentioned patch and does not impact it in any way.
Abel Vesa (3):
soc: imx: make i.MX8MM BLK CTRL a separate driver
soc: imx: make i.MX8MN BLK CTRL a separate driver
soc: imx: Rename generic BLK CTRL driver to suggest future usability
drivers/soc/imx/Kconfig | 14 + drivers/soc/imx/Makefile | 4 +- drivers/soc/imx/imx-blk-ctrl.c | 322 ++++++++++++++++ drivers/soc/imx/imx-blk-ctrl.h | 72 ++++ drivers/soc/imx/imx8m-blk-ctrl.c | 617 ------------------------------ drivers/soc/imx/imx8mm-blk-ctrl.c | 173 +++++++++ drivers/soc/imx/imx8mn-blk-ctrl.c | 101 +++++ 7 files changed, 685 insertions(+), 618 deletions(-) create mode 100644 drivers/soc/imx/imx-blk-ctrl.c create mode 100644 drivers/soc/imx/imx-blk-ctrl.h delete mode 100644 drivers/soc/imx/imx8m-blk-ctrl.c create mode 100644 drivers/soc/imx/imx8mm-blk-ctrl.c create mode 100644 drivers/soc/imx/imx8mn-blk-ctrl.c
Signature · 1 line
2.31.1
RFC 1/3 soc: imx: make i.MX8MM BLK CTRL a separate driver
The imx8m-blk-ctrl driver was increasing in size with every new BLK CTRL addition for every SoC. Lets split the SoC specific parts into separate drivers. Do that for i.MX8MM now.
--- drivers/soc/imx/Kconfig | 7 + drivers/soc/imx/Makefile | 1 + drivers/soc/imx/imx8m-blk-ctrl.c | 210 +----------------------------- drivers/soc/imx/imx8m-blk-ctrl.h | 72 ++++++++++ drivers/soc/imx/imx8mm-blk-ctrl.c | 173 ++++++++++++++++++++++++ 5 files changed, 257 insertions(+), 206 deletions(-) create mode 100644 drivers/soc/imx/imx8m-blk-ctrl.h create mode 100644 drivers/soc/imx/imx8mm-blk-ctrl.c
drivers/soc/imx/Kconfig +7 -0
@@ -20,4 +20,11 @@ config SOC_IMX8M support, it will provide the SoC info like SoC family, ID and revision etc. +config SOC_IMX8MM_BLK_CTRL + bool "i.MX8MM SoC BLK CTRL support" + depends on SOC_IMX8M + help + If you say yes here you get support for the NXP i.MX8MM BLK CTRL + support. + endmenu
drivers/soc/imx/Makefile +1 -0
@@ -6,3 +6,4 @@ obj-$(CONFIG_HAVE_IMX_GPC) += gpc.o obj-$(CONFIG_IMX_GPCV2_PM_DOMAINS) += gpcv2.o obj-$(CONFIG_SOC_IMX8M) += soc-imx8m.o obj-$(CONFIG_SOC_IMX8M) += imx8m-blk-ctrl.o +obj-$(CONFIG_SOC_IMX8MM_BLK_CTRL) += imx8mm-blk-ctrl.o
drivers/soc/imx/imx8m-blk-ctrl.c +4 -206
247 lines not on this page · raw message
drivers/soc/imx/imx8m-blk-ctrl.h new file +72 -0
72 lines not on this page · raw message
drivers/soc/imx/imx8mm-blk-ctrl.c new file +173 -0
173 lines not on this page · raw message
Signature · 1 line
2.31.1
RFC 2/3 soc: imx: make i.MX8MN BLK CTRL a separate driver
In reply to Abel VesaThe imx8m-blk-ctrl driver was increasing in size with every new BLK CTRL addition for every SoC. Lets split the SoC specific parts into separate drivers. Do that for i.MX8MN now.
--- drivers/soc/imx/Kconfig | 7 +++ drivers/soc/imx/Makefile | 1 + drivers/soc/imx/imx8m-blk-ctrl.c | 93 --------------------------- drivers/soc/imx/imx8mn-blk-ctrl.c | 101 ++++++++++++++++++++++++++++++ 4 files changed, 109 insertions(+), 93 deletions(-) create mode 100644 drivers/soc/imx/imx8mn-blk-ctrl.c
drivers/soc/imx/Kconfig +7 -0
@@ -27,4 +27,11 @@ config SOC_IMX8MM_BLK_CTRL If you say yes here you get support for the NXP i.MX8MM BLK CTRL support. +config SOC_IMX8MN_BLK_CTRL + bool "i.MX8MN SoC BLK CTRL support" + depends on SOC_IMX8M + help + If you say yes here you get support for the NXP i.MX8MN BLK CTRL + support. + endmenu
drivers/soc/imx/Makefile +1 -0
@@ -7,3 +7,4 @@ obj-$(CONFIG_IMX_GPCV2_PM_DOMAINS) += gpcv2.o obj-$(CONFIG_SOC_IMX8M) += soc-imx8m.o obj-$(CONFIG_SOC_IMX8M) += imx8m-blk-ctrl.o obj-$(CONFIG_SOC_IMX8MM_BLK_CTRL) += imx8mm-blk-ctrl.o +obj-$(CONFIG_SOC_IMX8MN_BLK_CTRL) += imx8mn-blk-ctrl.o
drivers/soc/imx/imx8m-blk-ctrl.c +0 -93
102 lines not on this page · raw message
drivers/soc/imx/imx8mn-blk-ctrl.c new file +101 -0
101 lines not on this page · raw message
Signature · 1 line
2.31.1
RFC 3/3 soc: imx: Rename generic BLK CTRL driver to suggest future usability
In reply to Abel VesaBy changing the prefix for every single generic API from "imx8m_" to "imx_" we suggest that it can be used by future i.MX SoC families.
---
drivers/soc/imx/Makefile | 2 +-
.../imx/{imx8m-blk-ctrl.c => imx-blk-ctrl.c} | 64 +++++++++----------
.../imx/{imx8m-blk-ctrl.h => imx-blk-ctrl.h} | 24 +++----
drivers/soc/imx/imx8mm-blk-ctrl.c | 20 +++---
drivers/soc/imx/imx8mn-blk-ctrl.c | 14 ++--
5 files changed, 62 insertions(+), 62 deletions(-)
rename drivers/soc/imx/{imx8m-blk-ctrl.c => imx-blk-ctrl.c} (79%)
rename drivers/soc/imx/{imx8m-blk-ctrl.h => imx-blk-ctrl.h} (72%)drivers/soc/imx/Makefile +1 -1
@@ -5,6 +5,6 @@ endif obj-$(CONFIG_HAVE_IMX_GPC) += gpc.o obj-$(CONFIG_IMX_GPCV2_PM_DOMAINS) += gpcv2.o obj-$(CONFIG_SOC_IMX8M) += soc-imx8m.o -obj-$(CONFIG_SOC_IMX8M) += imx8m-blk-ctrl.o +obj-$(CONFIG_SOC_IMX8M) += imx-blk-ctrl.o obj-$(CONFIG_SOC_IMX8MM_BLK_CTRL) += imx8mm-blk-ctrl.o obj-$(CONFIG_SOC_IMX8MN_BLK_CTRL) += imx8mn-blk-ctrl.o
drivers/soc/imx/imx-blk-ctrl.c renamed from drivers/soc/imx/imx8m-blk-ctrl.c +32 -32
155 lines not on this page · raw message
drivers/soc/imx/imx-blk-ctrl.h renamed from drivers/soc/imx/imx8m-blk-ctrl.h +12 -12
@@ -18,18 +18,18 @@#define BLK_CLK_EN 0x4#define BLK_MIPI_RESET_DIV 0x8/* Mini/Nano DISPLAY_BLK_CTRL only */ -struct imx8m_blk_ctrl_domain ; +struct imx_blk_ctrl_domain ; -struct imx8m_blk_ctrl { +struct imx_blk_ctrl {struct device *dev;struct notifier_block power_nb;struct device *bus_power_dev;struct regmap *regmap; -struct imx8m_blk_ctrl_domain *domains; +struct imx_blk_ctrl_domain *domains;struct genpd_onecell_data onecell_data; }; -struct imx8m_blk_ctrl_domain_data { +struct imx_blk_ctrl_domain_data {const char *name;const char *const *clk_names;int num_clks;
@@ -49,24 +49,24 @@ struct imx8m_blk_ctrl_domain_data {#define DOMAIN_MAX_CLKS 3 -struct imx8m_blk_ctrl_domain { +struct imx_blk_ctrl_domain {struct generic_pm_domain genpd; -const struct imx8m_blk_ctrl_domain_data *data; +const struct imx_blk_ctrl_domain_data *data;struct clk_bulk_data clks[DOMAIN_MAX_CLKS ];struct device *power_dev; -struct imx8m_blk_ctrl *bc; +struct imx_blk_ctrl *bc; }; -struct imx8m_blk_ctrl_data { +struct imx_blk_ctrl_data {int max_reg;notifier_fn_t power_notifier_fn; -const struct imx8m_blk_ctrl_domain_data *domains; +const struct imx_blk_ctrl_domain_data *domains;int num_domains; }; -extern const struct dev_pm_ops imx8m_blk_ctrl_pm_ops; +extern const struct dev_pm_ops imx_blk_ctrl_pm_ops; -int imx8m_blk_ctrl_remove (struct platform_device *pdev); -int imx8m_blk_ctrl_probe (struct platform_device *pdev); +int imx_blk_ctrl_remove (struct platform_device *pdev); +int imx_blk_ctrl_probe (struct platform_device *pdev);#endif
drivers/soc/imx/imx8mm-blk-ctrl.c +10 -10
@@ -7,12 +7,12 @@#include <dt-bindings/power/imx8mm-power.h> -#include "imx8m-blk-ctrl.h" +#include "imx-blk-ctrl.h" static int imx8mm_vpu_power_notifier (struct notifier_block *nb,unsigned long action,void *data) { - struct imx8m_blk_ctrl *bc = container_of(nb, struct imx8m_blk_ctrl, + struct imx_blk_ctrl *bc = container_of(nb, struct imx_blk_ctrl, power_nb);if (action !=GENPD_NOTIFY_ON && action !=GENPD_NOTIFY_PRE_OFF )
@@ -45,7 +45,7 @@ static int imx8mm_vpu_power_notifier(struct notifier_block *nb,return NOTIFY_OK ; } -static const struct imx8m_blk_ctrl_domain_data imx8mm_vpu_blk_ctl_domain_data[] = { +static const struct imx_blk_ctrl_domain_data imx8mm_vpu_blk_ctl_domain_data[] = { [IMX8MM_VPUBLK_PD_G1 ] = { .name ="vpublk-g1" , .clk_names = (const char *[]){"g1" , },
@@ -72,7 +72,7 @@ static const struct imx8m_blk_ctrl_domain_data imx8mm_vpu_blk_ctl_domain_data[] }, }; -static const struct imx8m_blk_ctrl_data imx8mm_vpu_blk_ctl_dev_data = { +static const struct imx_blk_ctrl_data imx8mm_vpu_blk_ctl_dev_data = { .max_reg =0x18 , .power_notifier_fn = imx8mm_vpu_power_notifier, .domains = imx8mm_vpu_blk_ctl_domain_data,
@@ -82,7 +82,7 @@ static const struct imx8m_blk_ctrl_data imx8mm_vpu_blk_ctl_dev_data = {static int imx8mm_disp_power_notifier (struct notifier_block *nb,unsigned long action,void *data) { - struct imx8m_blk_ctrl *bc = container_of(nb, struct imx8m_blk_ctrl, + struct imx_blk_ctrl *bc = container_of(nb, struct imx_blk_ctrl, power_nb);if (action !=GENPD_NOTIFY_ON && action !=GENPD_NOTIFY_PRE_OFF )
@@ -104,7 +104,7 @@ static int imx8mm_disp_power_notifier(struct notifier_block *nb,return NOTIFY_OK ; } -static const struct imx8m_blk_ctrl_domain_data imx8mm_disp_blk_ctl_domain_data[] = { +static const struct imx_blk_ctrl_domain_data imx8mm_disp_blk_ctl_domain_data[] = { [IMX8MM_DISPBLK_PD_CSI_BRIDGE ] = { .name ="dispblk-csi-bridge" , .clk_names = (const char *[]){"csi-bridge-axi" ,"csi-bridge-apb" ,
@@ -141,7 +141,7 @@ static const struct imx8m_blk_ctrl_domain_data imx8mm_disp_blk_ctl_domain_data[] }, }; -static const struct imx8m_blk_ctrl_data imx8mm_disp_blk_ctl_dev_data = { +static const struct imx_blk_ctrl_data imx8mm_disp_blk_ctl_dev_data = { .max_reg =0x2c , .power_notifier_fn = imx8mm_disp_power_notifier, .domains = imx8mm_disp_blk_ctl_domain_data,
@@ -162,11 +162,11 @@ static const struct of_device_id imx8mm_blk_ctrl_of_match[] = {MODULE_DEVICE_TABLE (of, imx8mm_blk_ctrl_of_match);static struct platform_driver imx8mm_blk_ctrl_driver = { - .probe = imx8m_blk_ctrl_probe, - .remove = imx8m_blk_ctrl_remove, + .probe = imx_blk_ctrl_probe, + .remove = imx_blk_ctrl_remove, .driver = { .name ="imx8mm-blk-ctrl" , - .pm = &imx8m_blk_ctrl_pm_ops, + .pm = &imx_blk_ctrl_pm_ops, .of_match_table = imx8mm_blk_ctrl_of_match, }, };
drivers/soc/imx/imx8mn-blk-ctrl.c +7 -7
@@ -7,12 +7,12 @@#include <dt-bindings/power/imx8mn-power.h> -#include "imx8m-blk-ctrl.h" +#include "imx-blk-ctrl.h" static int imx8mn_disp_power_notifier (struct notifier_block *nb,unsigned long action,void *data) { - struct imx8m_blk_ctrl *bc = container_of(nb, struct imx8m_blk_ctrl, + struct imx_blk_ctrl *bc = container_of(nb, struct imx_blk_ctrl, power_nb);if (action !=GENPD_NOTIFY_ON && action !=GENPD_NOTIFY_PRE_OFF )
@@ -34,7 +34,7 @@ static int imx8mn_disp_power_notifier(struct notifier_block *nb,return NOTIFY_OK ; } -static const struct imx8m_blk_ctrl_domain_data imx8mn_disp_blk_ctl_domain_data[] = { +static const struct imx_blk_ctrl_domain_data imx8mn_disp_blk_ctl_domain_data[] = { [IMX8MN_DISPBLK_PD_MIPI_DSI ] = { .name ="dispblk-mipi-dsi" , .clk_names = (const char *[]){"dsi-pclk" ,"dsi-ref" , },
@@ -72,7 +72,7 @@ static const struct imx8m_blk_ctrl_domain_data imx8mn_disp_blk_ctl_domain_data[] }, }; -static const struct imx8m_blk_ctrl_data imx8mn_disp_blk_ctl_dev_data = { +static const struct imx_blk_ctrl_data imx8mn_disp_blk_ctl_dev_data = { .max_reg =0x84 , .power_notifier_fn = imx8mn_disp_power_notifier, .domains = imx8mn_disp_blk_ctl_domain_data,
@@ -90,11 +90,11 @@ static const struct of_device_id imx8mn_blk_ctrl_of_match[] = {MODULE_DEVICE_TABLE (of, imx8mn_blk_ctrl_of_match);static struct platform_driver imx8mn_blk_ctrl_driver = { - .probe = imx8m_blk_ctrl_probe, - .remove = imx8m_blk_ctrl_remove, + .probe = imx_blk_ctrl_probe, + .remove = imx_blk_ctrl_remove, .driver = { .name ="imx8mn-blk-ctrl" , - .pm = &imx8m_blk_ctrl_pm_ops, + .pm = &imx_blk_ctrl_pm_ops, .of_match_table = imx8mn_blk_ctrl_of_match, }, };
Signature · 1 line
2.31.1