Skip to content

Commit 7f511d5

Browse files
aford173Shawn Guo
authored andcommitted
soc: imx: imx8m-blk-ctrl: add i.MX8MN DISP blk-ctrl
This adds the description for the i.MX8MN disp blk-ctrl. Signed-off-by: Adam Ford <aford173@gmail.com> Reviewed-by: Lucas Stach <l.stach@pengutronix.de> Signed-off-by: Shawn Guo <shawnguo@kernel.org>
1 parent b77beaa commit 7f511d5

1 file changed

Lines changed: 76 additions & 1 deletion

File tree

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

Lines changed: 76 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
#include <linux/clk.h>
1515

1616
#include <dt-bindings/power/imx8mm-power.h>
17+
#include <dt-bindings/power/imx8mn-power.h>
1718

1819
#define BLK_SFT_RSTN 0x0
1920
#define BLK_CLK_EN 0x4
@@ -498,14 +499,88 @@ static const struct imx8m_blk_ctrl_data imx8mm_disp_blk_ctl_dev_data = {
498499
.num_domains = ARRAY_SIZE(imx8mm_disp_blk_ctl_domain_data),
499500
};
500501

502+
503+
static int imx8mn_disp_power_notifier(struct notifier_block *nb,
504+
unsigned long action, void *data)
505+
{
506+
struct imx8m_blk_ctrl *bc = container_of(nb, struct imx8m_blk_ctrl,
507+
power_nb);
508+
509+
if (action != GENPD_NOTIFY_ON && action != GENPD_NOTIFY_PRE_OFF)
510+
return NOTIFY_OK;
511+
512+
/* Enable bus clock and deassert bus reset */
513+
regmap_set_bits(bc->regmap, BLK_CLK_EN, BIT(8));
514+
regmap_set_bits(bc->regmap, BLK_SFT_RSTN, BIT(8));
515+
516+
/*
517+
* On power up we have no software backchannel to the GPC to
518+
* wait for the ADB handshake to happen, so we just delay for a
519+
* bit. On power down the GPC driver waits for the handshake.
520+
*/
521+
if (action == GENPD_NOTIFY_ON)
522+
udelay(5);
523+
524+
525+
return NOTIFY_OK;
526+
}
527+
528+
static const struct imx8m_blk_ctrl_domain_data imx8mn_disp_blk_ctl_domain_data[] = {
529+
[IMX8MN_DISPBLK_PD_MIPI_DSI] = {
530+
.name = "dispblk-mipi-dsi",
531+
.clk_names = (const char *[]){ "dsi-pclk", "dsi-ref", },
532+
.num_clks = 2,
533+
.gpc_name = "mipi-dsi",
534+
.rst_mask = BIT(0) | BIT(1),
535+
.clk_mask = BIT(0) | BIT(1),
536+
.mipi_phy_rst_mask = BIT(17),
537+
},
538+
[IMX8MN_DISPBLK_PD_MIPI_CSI] = {
539+
.name = "dispblk-mipi-csi",
540+
.clk_names = (const char *[]){ "csi-aclk", "csi-pclk" },
541+
.num_clks = 2,
542+
.gpc_name = "mipi-csi",
543+
.rst_mask = BIT(2) | BIT(3),
544+
.clk_mask = BIT(2) | BIT(3),
545+
.mipi_phy_rst_mask = BIT(16),
546+
},
547+
[IMX8MN_DISPBLK_PD_LCDIF] = {
548+
.name = "dispblk-lcdif",
549+
.clk_names = (const char *[]){ "lcdif-axi", "lcdif-apb", "lcdif-pix", },
550+
.num_clks = 3,
551+
.gpc_name = "lcdif",
552+
.rst_mask = BIT(4) | BIT(5),
553+
.clk_mask = BIT(4) | BIT(5),
554+
},
555+
[IMX8MN_DISPBLK_PD_ISI] = {
556+
.name = "dispblk-isi",
557+
.clk_names = (const char *[]){ "disp_axi", "disp_apb", "disp_axi_root",
558+
"disp_apb_root"},
559+
.num_clks = 4,
560+
.gpc_name = "isi",
561+
.rst_mask = BIT(6) | BIT(7),
562+
.clk_mask = BIT(6) | BIT(7),
563+
},
564+
};
565+
566+
static const struct imx8m_blk_ctrl_data imx8mn_disp_blk_ctl_dev_data = {
567+
.max_reg = 0x84,
568+
.power_notifier_fn = imx8mn_disp_power_notifier,
569+
.domains = imx8mn_disp_blk_ctl_domain_data,
570+
.num_domains = ARRAY_SIZE(imx8mn_disp_blk_ctl_domain_data),
571+
};
572+
501573
static const struct of_device_id imx8m_blk_ctrl_of_match[] = {
502574
{
503575
.compatible = "fsl,imx8mm-vpu-blk-ctrl",
504576
.data = &imx8mm_vpu_blk_ctl_dev_data
505577
}, {
506578
.compatible = "fsl,imx8mm-disp-blk-ctrl",
507579
.data = &imx8mm_disp_blk_ctl_dev_data
508-
} ,{
580+
}, {
581+
.compatible = "fsl,imx8mn-disp-blk-ctrl",
582+
.data = &imx8mn_disp_blk_ctl_dev_data
583+
}, {
509584
/* Sentinel */
510585
}
511586
};

0 commit comments

Comments
 (0)