Skip to content

Commit 042b677

Browse files
aford173Shawn Guo
authored andcommitted
soc: imx: imx8m-blk-ctrl: Fix imx8mm mipi reset
Most of the blk-ctrl reset bits are found in one register, however there are two bits in offset 8 for pulling the MIPI DPHY out of reset and one of them needs to be set when IMX8MM_DISPBLK_PD_MIPI_CSI is brought out of reset or the MIPI_CSI hangs. Since MIPI_DSI is impacted, add the additional one for MIPI_DSI too. Fixes: 926e57c ("soc: imx: imx8m-blk-ctrl: add DISP blk-ctrl") Signed-off-by: Adam Ford <[email protected]> Reviewed-by: Fabio Estevam <[email protected]> Reviewed-by: Lucas Stach <[email protected]> Reviewed-by: Laurent Pinchart <[email protected]> Tested by: Tim Harvey <[email protected]> Signed-off-by: Shawn Guo <[email protected]>
1 parent 737e65c commit 042b677

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

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

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717

1818
#define BLK_SFT_RSTN 0x0
1919
#define BLK_CLK_EN 0x4
20+
#define BLK_MIPI_RESET_DIV 0x8 /* Mini/Nano DISPLAY_BLK_CTRL only */
2021

2122
struct imx8m_blk_ctrl_domain;
2223

@@ -36,6 +37,15 @@ struct imx8m_blk_ctrl_domain_data {
3637
const char *gpc_name;
3738
u32 rst_mask;
3839
u32 clk_mask;
40+
41+
/*
42+
* i.MX8M Mini and Nano have a third DISPLAY_BLK_CTRL register
43+
* which is used to control the reset for the MIPI Phy.
44+
* Since it's only present in certain circumstances,
45+
* an if-statement should be used before setting and clearing this
46+
* register.
47+
*/
48+
u32 mipi_phy_rst_mask;
3949
};
4050

4151
#define DOMAIN_MAX_CLKS 3
@@ -78,6 +88,8 @@ static int imx8m_blk_ctrl_power_on(struct generic_pm_domain *genpd)
7888

7989
/* put devices into reset */
8090
regmap_clear_bits(bc->regmap, BLK_SFT_RSTN, data->rst_mask);
91+
if (data->mipi_phy_rst_mask)
92+
regmap_clear_bits(bc->regmap, BLK_MIPI_RESET_DIV, data->mipi_phy_rst_mask);
8193

8294
/* enable upstream and blk-ctrl clocks to allow reset to propagate */
8395
ret = clk_bulk_prepare_enable(data->num_clks, domain->clks);
@@ -99,6 +111,8 @@ static int imx8m_blk_ctrl_power_on(struct generic_pm_domain *genpd)
99111

100112
/* release reset */
101113
regmap_set_bits(bc->regmap, BLK_SFT_RSTN, data->rst_mask);
114+
if (data->mipi_phy_rst_mask)
115+
regmap_set_bits(bc->regmap, BLK_MIPI_RESET_DIV, data->mipi_phy_rst_mask);
102116

103117
/* disable upstream clocks */
104118
clk_bulk_disable_unprepare(data->num_clks, domain->clks);
@@ -120,6 +134,9 @@ static int imx8m_blk_ctrl_power_off(struct generic_pm_domain *genpd)
120134
struct imx8m_blk_ctrl *bc = domain->bc;
121135

122136
/* put devices into reset and disable clocks */
137+
if (data->mipi_phy_rst_mask)
138+
regmap_clear_bits(bc->regmap, BLK_MIPI_RESET_DIV, data->mipi_phy_rst_mask);
139+
123140
regmap_clear_bits(bc->regmap, BLK_SFT_RSTN, data->rst_mask);
124141
regmap_clear_bits(bc->regmap, BLK_CLK_EN, data->clk_mask);
125142

@@ -480,6 +497,7 @@ static const struct imx8m_blk_ctrl_domain_data imx8mm_disp_blk_ctl_domain_data[]
480497
.gpc_name = "mipi-dsi",
481498
.rst_mask = BIT(5),
482499
.clk_mask = BIT(8) | BIT(9),
500+
.mipi_phy_rst_mask = BIT(17),
483501
},
484502
[IMX8MM_DISPBLK_PD_MIPI_CSI] = {
485503
.name = "dispblk-mipi-csi",
@@ -488,6 +506,7 @@ static const struct imx8m_blk_ctrl_domain_data imx8mm_disp_blk_ctl_domain_data[]
488506
.gpc_name = "mipi-csi",
489507
.rst_mask = BIT(3) | BIT(4),
490508
.clk_mask = BIT(10) | BIT(11),
509+
.mipi_phy_rst_mask = BIT(16),
491510
},
492511
};
493512

0 commit comments

Comments
 (0)