Skip to content

Commit 07614fe

Browse files
Rahi374Shawn Guo
authored andcommitted
soc: imx: imx8m-blk-ctrl: Add i.MX8MP media blk-ctrl
Add the description for the i.MX8MP media blk-ctrl. Signed-off-by: Paul Elder <[email protected]> Reviewed-by: Laurent Pinchart <[email protected]> Signed-off-by: Laurent Pinchart <[email protected]> Reviewed-by: Marek Vasut <[email protected]> Tested-by: Marek Vasut <[email protected]> # MX8MP LCDIF #1 and #2 Signed-off-by: Lucas Stach <[email protected]> Signed-off-by: Shawn Guo <[email protected]>
1 parent 556f5cf commit 07614fe

File tree

1 file changed

+121
-2
lines changed

1 file changed

+121
-2
lines changed

drivers/soc/imx/imx8m-blk-ctrl.c

Lines changed: 121 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,12 @@
1515

1616
#include <dt-bindings/power/imx8mm-power.h>
1717
#include <dt-bindings/power/imx8mn-power.h>
18+
#include <dt-bindings/power/imx8mp-power.h>
1819
#include <dt-bindings/power/imx8mq-power.h>
1920

2021
#define BLK_SFT_RSTN 0x0
2122
#define BLK_CLK_EN 0x4
22-
#define BLK_MIPI_RESET_DIV 0x8 /* Mini/Nano DISPLAY_BLK_CTRL only */
23+
#define BLK_MIPI_RESET_DIV 0x8 /* Mini/Nano/Plus DISPLAY_BLK_CTRL only */
2324

2425
struct imx8m_blk_ctrl_domain;
2526

@@ -41,7 +42,7 @@ struct imx8m_blk_ctrl_domain_data {
4142
u32 clk_mask;
4243

4344
/*
44-
* i.MX8M Mini and Nano have a third DISPLAY_BLK_CTRL register
45+
* i.MX8M Mini, Nano and Plus have a third DISPLAY_BLK_CTRL register
4546
* which is used to control the reset for the MIPI Phy.
4647
* Since it's only present in certain circumstances,
4748
* an if-statement should be used before setting and clearing this
@@ -591,6 +592,121 @@ static const struct imx8m_blk_ctrl_data imx8mn_disp_blk_ctl_dev_data = {
591592
.num_domains = ARRAY_SIZE(imx8mn_disp_blk_ctl_domain_data),
592593
};
593594

595+
static int imx8mp_media_power_notifier(struct notifier_block *nb,
596+
unsigned long action, void *data)
597+
{
598+
struct imx8m_blk_ctrl *bc = container_of(nb, struct imx8m_blk_ctrl,
599+
power_nb);
600+
601+
if (action != GENPD_NOTIFY_ON && action != GENPD_NOTIFY_PRE_OFF)
602+
return NOTIFY_OK;
603+
604+
/* Enable bus clock and deassert bus reset */
605+
regmap_set_bits(bc->regmap, BLK_CLK_EN, BIT(8));
606+
regmap_set_bits(bc->regmap, BLK_SFT_RSTN, BIT(8));
607+
608+
/*
609+
* On power up we have no software backchannel to the GPC to
610+
* wait for the ADB handshake to happen, so we just delay for a
611+
* bit. On power down the GPC driver waits for the handshake.
612+
*/
613+
if (action == GENPD_NOTIFY_ON)
614+
udelay(5);
615+
616+
return NOTIFY_OK;
617+
}
618+
619+
/*
620+
* From i.MX 8M Plus Applications Processor Reference Manual, Rev. 1,
621+
* section 13.2.2, 13.2.3
622+
* isp-ahb and dwe are not in Figure 13-5. Media BLK_CTRL Clocks
623+
*/
624+
static const struct imx8m_blk_ctrl_domain_data imx8mp_media_blk_ctl_domain_data[] = {
625+
[IMX8MP_MEDIABLK_PD_MIPI_DSI_1] = {
626+
.name = "mediablk-mipi-dsi-1",
627+
.clk_names = (const char *[]){ "apb", "phy", },
628+
.num_clks = 2,
629+
.gpc_name = "mipi-dsi1",
630+
.rst_mask = BIT(0) | BIT(1),
631+
.clk_mask = BIT(0) | BIT(1),
632+
.mipi_phy_rst_mask = BIT(17),
633+
},
634+
[IMX8MP_MEDIABLK_PD_MIPI_CSI2_1] = {
635+
.name = "mediablk-mipi-csi2-1",
636+
.clk_names = (const char *[]){ "apb", "cam1" },
637+
.num_clks = 2,
638+
.gpc_name = "mipi-csi1",
639+
.rst_mask = BIT(2) | BIT(3),
640+
.clk_mask = BIT(2) | BIT(3),
641+
.mipi_phy_rst_mask = BIT(16),
642+
},
643+
[IMX8MP_MEDIABLK_PD_LCDIF_1] = {
644+
.name = "mediablk-lcdif-1",
645+
.clk_names = (const char *[]){ "disp1", "apb", "axi", },
646+
.num_clks = 3,
647+
.gpc_name = "lcdif1",
648+
.rst_mask = BIT(4) | BIT(5) | BIT(23),
649+
.clk_mask = BIT(4) | BIT(5) | BIT(23),
650+
},
651+
[IMX8MP_MEDIABLK_PD_ISI] = {
652+
.name = "mediablk-isi",
653+
.clk_names = (const char *[]){ "axi", "apb" },
654+
.num_clks = 2,
655+
.gpc_name = "isi",
656+
.rst_mask = BIT(6) | BIT(7),
657+
.clk_mask = BIT(6) | BIT(7),
658+
},
659+
[IMX8MP_MEDIABLK_PD_MIPI_CSI2_2] = {
660+
.name = "mediablk-mipi-csi2-2",
661+
.clk_names = (const char *[]){ "apb", "cam2" },
662+
.num_clks = 2,
663+
.gpc_name = "mipi-csi2",
664+
.rst_mask = BIT(9) | BIT(10),
665+
.clk_mask = BIT(9) | BIT(10),
666+
.mipi_phy_rst_mask = BIT(30),
667+
},
668+
[IMX8MP_MEDIABLK_PD_LCDIF_2] = {
669+
.name = "mediablk-lcdif-2",
670+
.clk_names = (const char *[]){ "disp1", "apb", "axi", },
671+
.num_clks = 3,
672+
.gpc_name = "lcdif2",
673+
.rst_mask = BIT(11) | BIT(12) | BIT(24),
674+
.clk_mask = BIT(11) | BIT(12) | BIT(24),
675+
},
676+
[IMX8MP_MEDIABLK_PD_ISP] = {
677+
.name = "mediablk-isp",
678+
.clk_names = (const char *[]){ "isp", "axi", "apb" },
679+
.num_clks = 3,
680+
.gpc_name = "isp",
681+
.rst_mask = BIT(16) | BIT(17) | BIT(18),
682+
.clk_mask = BIT(16) | BIT(17) | BIT(18),
683+
},
684+
[IMX8MP_MEDIABLK_PD_DWE] = {
685+
.name = "mediablk-dwe",
686+
.clk_names = (const char *[]){ "axi", "apb" },
687+
.num_clks = 2,
688+
.gpc_name = "dwe",
689+
.rst_mask = BIT(19) | BIT(20) | BIT(21),
690+
.clk_mask = BIT(19) | BIT(20) | BIT(21),
691+
},
692+
[IMX8MP_MEDIABLK_PD_MIPI_DSI_2] = {
693+
.name = "mediablk-mipi-dsi-2",
694+
.clk_names = (const char *[]){ "phy", },
695+
.num_clks = 1,
696+
.gpc_name = "mipi-dsi2",
697+
.rst_mask = BIT(22),
698+
.clk_mask = BIT(22),
699+
.mipi_phy_rst_mask = BIT(29),
700+
},
701+
};
702+
703+
static const struct imx8m_blk_ctrl_data imx8mp_media_blk_ctl_dev_data = {
704+
.max_reg = 0x138,
705+
.power_notifier_fn = imx8mp_media_power_notifier,
706+
.domains = imx8mp_media_blk_ctl_domain_data,
707+
.num_domains = ARRAY_SIZE(imx8mp_media_blk_ctl_domain_data),
708+
};
709+
594710
static int imx8mq_vpu_power_notifier(struct notifier_block *nb,
595711
unsigned long action, void *data)
596712
{
@@ -663,6 +779,9 @@ static const struct of_device_id imx8m_blk_ctrl_of_match[] = {
663779
}, {
664780
.compatible = "fsl,imx8mn-disp-blk-ctrl",
665781
.data = &imx8mn_disp_blk_ctl_dev_data
782+
}, {
783+
.compatible = "fsl,imx8mp-media-blk-ctrl",
784+
.data = &imx8mp_media_blk_ctl_dev_data
666785
}, {
667786
.compatible = "fsl,imx8mq-vpu-blk-ctrl",
668787
.data = &imx8mq_vpu_blk_ctl_dev_data

0 commit comments

Comments
 (0)