Commit 65c62bb9 authored by Tomi Valkeinen's avatar Tomi Valkeinen

OMAP: DSS2: DSI: fix CIO init and uninit

Use dsi_enable_scp_clk and dsi_disable_scp_clk in CIO init and uninit,
and improve the CIO init by adding a few status checks and error
handling.
Signed-off-by: default avatarTomi Valkeinen <tomi.valkeinen@ti.com>
parent 24c1ae41
...@@ -1971,13 +1971,12 @@ static void dsi_cio_disable_lane_override(void) ...@@ -1971,13 +1971,12 @@ static void dsi_cio_disable_lane_override(void)
static int dsi_cio_init(struct omap_dss_device *dssdev) static int dsi_cio_init(struct omap_dss_device *dssdev)
{ {
int r = 0; int r;
u32 l; u32 l;
DSSDBGF(); DSSDBGF();
if (dsi.ulps_enabled) dsi_enable_scp_clk();
DSSDBG("manual ulps exit\n");
/* A dummy read using the SCP interface to any DSIPHY register is /* A dummy read using the SCP interface to any DSIPHY register is
* required after DSIPHY reset to complete the reset of the DSI complex * required after DSIPHY reset to complete the reset of the DSI complex
...@@ -1985,17 +1984,13 @@ static int dsi_cio_init(struct omap_dss_device *dssdev) ...@@ -1985,17 +1984,13 @@ static int dsi_cio_init(struct omap_dss_device *dssdev)
dsi_read_reg(DSI_DSIPHY_CFG5); dsi_read_reg(DSI_DSIPHY_CFG5);
if (wait_for_bit_change(DSI_DSIPHY_CFG5, 30, 1) != 1) { if (wait_for_bit_change(DSI_DSIPHY_CFG5, 30, 1) != 1) {
DSSERR("ComplexIO PHY not coming out of reset.\n"); DSSERR("CIO SCP Clock domain not coming out of reset.\n");
r = -ENODEV; r = -EIO;
goto err; goto err_scp_clk_dom;
} }
dsi_set_lane_config(dssdev); dsi_set_lane_config(dssdev);
dsi_if_enable(true);
dsi_if_enable(false);
REG_FLD_MOD(DSI_CLK_CTRL, 1, 20, 20); /* LP_CLK_ENABLE */
/* set TX STOP MODE timer to maximum for this operation */ /* set TX STOP MODE timer to maximum for this operation */
l = dsi_read_reg(DSI_TIMING1); l = dsi_read_reg(DSI_TIMING1);
l = FLD_MOD(l, 1, 15, 15); /* FORCE_TX_STOP_MODE_IO */ l = FLD_MOD(l, 1, 15, 15); /* FORCE_TX_STOP_MODE_IO */
...@@ -2005,6 +2000,8 @@ static int dsi_cio_init(struct omap_dss_device *dssdev) ...@@ -2005,6 +2000,8 @@ static int dsi_cio_init(struct omap_dss_device *dssdev)
dsi_write_reg(DSI_TIMING1, l); dsi_write_reg(DSI_TIMING1, l);
if (dsi.ulps_enabled) { if (dsi.ulps_enabled) {
DSSDBG("manual ulps exit\n");
/* ULPS is exited by Mark-1 state for 1ms, followed by /* ULPS is exited by Mark-1 state for 1ms, followed by
* stop state. DSS HW cannot do this via the normal * stop state. DSS HW cannot do this via the normal
* ULPS exit sequence, as after reset the DSS HW thinks * ULPS exit sequence, as after reset the DSS HW thinks
...@@ -2019,7 +2016,17 @@ static int dsi_cio_init(struct omap_dss_device *dssdev) ...@@ -2019,7 +2016,17 @@ static int dsi_cio_init(struct omap_dss_device *dssdev)
r = dsi_cio_power(DSI_COMPLEXIO_POWER_ON); r = dsi_cio_power(DSI_COMPLEXIO_POWER_ON);
if (r) if (r)
goto err; goto err_cio_pwr;
if (wait_for_bit_change(DSI_COMPLEXIO_CFG1, 29, 1) != 1) {
DSSERR("CIO PWR clock domain not coming out of reset.\n");
r = -ENODEV;
goto err_cio_pwr_dom;
}
dsi_if_enable(true);
dsi_if_enable(false);
REG_FLD_MOD(DSI_CLK_CTRL, 1, 20, 20); /* LP_CLK_ENABLE */
if (dsi.ulps_enabled) { if (dsi.ulps_enabled) {
/* Keep Mark-1 state for 1ms (as per DSI spec) */ /* Keep Mark-1 state for 1ms (as per DSI spec) */
...@@ -2035,24 +2042,28 @@ static int dsi_cio_init(struct omap_dss_device *dssdev) ...@@ -2035,24 +2042,28 @@ static int dsi_cio_init(struct omap_dss_device *dssdev)
/* FORCE_TX_STOP_MODE_IO */ /* FORCE_TX_STOP_MODE_IO */
REG_FLD_MOD(DSI_TIMING1, 0, 15, 15); REG_FLD_MOD(DSI_TIMING1, 0, 15, 15);
if (wait_for_bit_change(DSI_COMPLEXIO_CFG1, 29, 1) != 1) {
DSSERR("ComplexIO not coming out of reset.\n");
r = -ENODEV;
goto err;
}
dsi_cio_timings(); dsi_cio_timings();
dsi.ulps_enabled = false; dsi.ulps_enabled = false;
DSSDBG("CIO init done\n"); DSSDBG("CIO init done\n");
err:
return 0;
err_cio_pwr_dom:
dsi_cio_power(DSI_COMPLEXIO_POWER_OFF);
err_cio_pwr:
if (dsi.ulps_enabled)
dsi_cio_disable_lane_override();
err_scp_clk_dom:
dsi_disable_scp_clk();
return r; return r;
} }
static void dsi_cio_uninit(void) static void dsi_cio_uninit(void)
{ {
dsi_cio_power(DSI_COMPLEXIO_POWER_OFF); dsi_cio_power(DSI_COMPLEXIO_POWER_OFF);
dsi_disable_scp_clk();
} }
static int _dsi_wait_reset(void) static int _dsi_wait_reset(void)
...@@ -3631,11 +3642,6 @@ static int dsi_display_init_dsi(struct omap_dss_device *dssdev) ...@@ -3631,11 +3642,6 @@ static int dsi_display_init_dsi(struct omap_dss_device *dssdev)
{ {
int r; int r;
/* The SCPClk is required for both PLL and CIO registers on OMAP4 */
dsi_enable_scp_clk();
_dsi_print_reset_status();
r = dsi_pll_init(dssdev, true, true); r = dsi_pll_init(dssdev, true, true);
if (r) if (r)
goto err0; goto err0;
...@@ -3688,7 +3694,6 @@ static int dsi_display_init_dsi(struct omap_dss_device *dssdev) ...@@ -3688,7 +3694,6 @@ static int dsi_display_init_dsi(struct omap_dss_device *dssdev)
err1: err1:
dsi_pll_uninit(true); dsi_pll_uninit(true);
err0: err0:
dsi_disable_scp_clk();
return r; return r;
} }
...@@ -3709,7 +3714,6 @@ static void dsi_display_uninit_dsi(struct omap_dss_device *dssdev, ...@@ -3709,7 +3714,6 @@ static void dsi_display_uninit_dsi(struct omap_dss_device *dssdev,
dss_select_dsi_clk_source(OMAP_DSS_CLK_SRC_FCK); dss_select_dsi_clk_source(OMAP_DSS_CLK_SRC_FCK);
dsi_cio_uninit(); dsi_cio_uninit();
dsi_pll_uninit(disconnect_lanes); dsi_pll_uninit(disconnect_lanes);
dsi_disable_scp_clk();
} }
static int dsi_core_init(void) static int dsi_core_init(void)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment