2010-07-28 14:50:32

by Ernesto Ramos

[permalink] [raw]
Subject: [PATCH 0/4] staging:ti dspbridge: Fix IVA2 power OFF series

This series of patches fixes issues that prevent IVA2 to turn OFF when
there are issues to load the base image and makes sure IVA2 switched OFF
when dsp bridge driver is installed.

Ernesto Ramos (4):
staging:ti dspbridge: fix bridge_brd_stop so IVA2 is set OFF
staging:ti dspbridge: proc_load/start should set IVA2 to OFF in case
of failure
staging:ti dspbridge: make sure IVA2 is OFF when dev is created
staging:ti dspbridge: remove bridge_brd_delete function

drivers/staging/tidspbridge/core/tiomap3430.c | 65 ++----------------------
drivers/staging/tidspbridge/rmgr/proc.c | 6 ++-
2 files changed, 10 insertions(+), 61 deletions(-)


2010-07-28 14:50:15

by Ernesto Ramos

[permalink] [raw]
Subject: [PATCH 3/4] staging:ti dspbridge: make sure IVA2 is OFF when dev is created

Regardless the IVA2 power state before bridgedriver is
installed, the driver must ensure that IVA2 power
state is OFF when the device driver is created.

Signed-off-by: Ernesto Ramos <[email protected]>
---
drivers/staging/tidspbridge/core/tiomap3430.c | 4 +++-
1 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/drivers/staging/tidspbridge/core/tiomap3430.c b/drivers/staging/tidspbridge/core/tiomap3430.c
index 77527bd..e7584de 100644
--- a/drivers/staging/tidspbridge/core/tiomap3430.c
+++ b/drivers/staging/tidspbridge/core/tiomap3430.c
@@ -919,8 +919,10 @@ static int bridge_dev_create(struct bridge_dev_context
if (!status) {
dev_context->hdev_obj = hdev_obj;
/* Store current board state. */
- dev_context->dw_brd_state = BRD_STOPPED;
+ dev_context->dw_brd_state = BRD_UNKNOWN;
dev_context->resources = resources;
+ dsp_clk_enable(DSP_CLK_IVA2);
+ bridge_brd_stop(dev_context);
/* Return ptr to our device state to the DSP API for storage */
*dev_cntxt = dev_context;
} else {
--
1.5.4.5

2010-07-28 14:50:34

by Ernesto Ramos

[permalink] [raw]
Subject: [PATCH 4/4] staging:ti dspbridge: remove bridge_brd_delete function

From: Ernesto Ramos <ernesto@ernesto-desktop.(none)>

Remove bridge_brd_delete() function since it is
doing the same that bridge_brd_stop().

Signed-off-by: Ernesto Ramos <ernesto@ernesto-desktop.(none)>
---
drivers/staging/tidspbridge/core/tiomap3430.c | 57 +------------------------
1 files changed, 1 insertions(+), 56 deletions(-)

diff --git a/drivers/staging/tidspbridge/core/tiomap3430.c b/drivers/staging/tidspbridge/core/tiomap3430.c
index e7584de..f914829 100644
--- a/drivers/staging/tidspbridge/core/tiomap3430.c
+++ b/drivers/staging/tidspbridge/core/tiomap3430.c
@@ -686,61 +686,6 @@ static int bridge_brd_stop(struct bridge_dev_context *dev_ctxt)
}

/*
- * ======== bridge_brd_delete ========
- * purpose:
- * Puts DSP in Low power mode
- *
- * Preconditions :
- * a) None
- */
-static int bridge_brd_delete(struct bridge_dev_context *dev_ctxt)
-{
- int status = 0;
- struct bridge_dev_context *dev_context = dev_ctxt;
- struct pg_table_attrs *pt_attrs;
- int clk_status;
- struct dspbridge_platform_data *pdata =
- omap_dspbridge_dev->dev.platform_data;
-
- if (dev_context->dw_brd_state == BRD_STOPPED)
- return status;
-
- /* as per TRM, it is advised to first drive
- * the IVA2 to 'Standby' mode, before turning off the clocks.. This is
- * to ensure that there are no pending L3 or other transactons from
- * IVA2 */
- status = sleep_dsp(dev_context, PWR_EMERGENCYDEEPSLEEP, NULL);
- clk_status = dsp_clk_disable(DSP_CLK_IVA2);
-
- /* Release the Ext Base virtual Address as the next DSP Program
- * may have a different load address */
- if (dev_context->dw_dsp_ext_base_addr)
- dev_context->dw_dsp_ext_base_addr = 0;
-
- dev_context->dw_brd_state = BRD_STOPPED; /* update board state */
-
- /* This is a good place to clear the MMU page tables as well */
- if (dev_context->pt_attrs) {
- pt_attrs = dev_context->pt_attrs;
- memset((u8 *) pt_attrs->l1_base_va, 0x00, pt_attrs->l1_size);
- memset((u8 *) pt_attrs->l2_base_va, 0x00, pt_attrs->l2_size);
- memset((u8 *) pt_attrs->pg_info, 0x00,
- (pt_attrs->l2_num_pages * sizeof(struct page_info)));
- }
- /* Disable the mail box interrupts */
- if (dev_context->mbox) {
- omap_mbox_disable_irq(dev_context->mbox, IRQ_RX);
- omap_mbox_put(dev_context->mbox);
- dev_context->mbox = NULL;
- }
- /* Reset IVA2 clocks*/
- (*pdata->dsp_prm_write)(OMAP3430_RST1_IVA2_MASK | OMAP3430_RST2_IVA2_MASK |
- OMAP3430_RST3_IVA2_MASK, OMAP3430_IVA2_MOD, OMAP2_RM_RSTCTRL);
-
- return status;
-}
-
-/*
* ======== bridge_brd_status ========
* Returns the board status.
*/
@@ -1023,7 +968,7 @@ static int bridge_dev_destroy(struct bridge_dev_context *dev_ctxt)
return -EFAULT;

/* first put the device to stop state */
- bridge_brd_delete(dev_context);
+ bridge_brd_stop(dev_context);
if (dev_context->pt_attrs) {
pt_attrs = dev_context->pt_attrs;
kfree(pt_attrs->pg_info);
--
1.5.4.5

2010-07-28 14:50:51

by Ernesto Ramos

[permalink] [raw]
Subject: [PATCH 1/4] staging:ti dspbridge: fix bridge_brd_stop so IVA2 is set OFF

right now, bridge_brd_stop is not changing the IVA2 power state
to OFF since PM_PWSTST_IVA2 is not 0 after calling this function.

Signed-off-by: Ernesto Ramos <[email protected]>
---
drivers/staging/tidspbridge/core/tiomap3430.c | 8 ++++----
1 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/staging/tidspbridge/core/tiomap3430.c b/drivers/staging/tidspbridge/core/tiomap3430.c
index 9673acb..77527bd 100644
--- a/drivers/staging/tidspbridge/core/tiomap3430.c
+++ b/drivers/staging/tidspbridge/core/tiomap3430.c
@@ -639,11 +639,11 @@ static int bridge_brd_stop(struct bridge_dev_context *dev_ctxt)
dsp_pwr_state = (*pdata->dsp_prm_read)(OMAP3430_IVA2_MOD, OMAP2_PM_PWSTST) &
OMAP_POWERSTATEST_MASK;
if (dsp_pwr_state != PWRDM_POWER_OFF) {
+ (*pdata->dsp_prm_rmw_bits)(OMAP3430_RST2_IVA2_MASK, 0,
+ OMAP3430_IVA2_MOD, OMAP2_RM_RSTCTRL);
sm_interrupt_dsp(dev_context, MBX_PM_DSPIDLE);
mdelay(10);

- clk_status = dsp_clk_disable(DSP_CLK_IVA2);
-
/* IVA2 is not in OFF state */
/* Set PM_PWSTCTRL_IVA2 to OFF */
(*pdata->dsp_prm_rmw_bits)(OMAP_POWERSTATEST_MASK,
@@ -651,8 +651,6 @@ static int bridge_brd_stop(struct bridge_dev_context *dev_ctxt)
/* Set the SW supervised state transition for Sleep */
(*pdata->dsp_cm_write)(OMAP34XX_CLKSTCTRL_FORCE_SLEEP,
OMAP3430_IVA2_MOD, OMAP2_CM_CLKSTCTRL);
- } else {
- clk_status = dsp_clk_disable(DSP_CLK_IVA2);
}
udelay(10);
/* Release the Ext Base virtual Address as the next DSP Program
@@ -682,6 +680,8 @@ static int bridge_brd_stop(struct bridge_dev_context *dev_ctxt)
(*pdata->dsp_prm_write)(OMAP3430_RST1_IVA2_MASK | OMAP3430_RST2_IVA2_MASK |
OMAP3430_RST3_IVA2_MASK, OMAP3430_IVA2_MOD, OMAP2_RM_RSTCTRL);

+ clk_status = dsp_clk_disable(DSP_CLK_IVA2);
+
return status;
}

--
1.5.4.5

2010-07-28 14:50:54

by Ernesto Ramos

[permalink] [raw]
Subject: [PATCH 2/4] staging:ti dspbridge: proc_load/start should set IVA2 to OFF in case of failure

When a base image is being loaded or started and by some reason
the process fails, the IVA2 should be switched OFF.

Signed-off-by: Ernesto Ramos <[email protected]>
---
drivers/staging/tidspbridge/rmgr/proc.c | 6 ++++--
1 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/tidspbridge/rmgr/proc.c b/drivers/staging/tidspbridge/rmgr/proc.c
index 6258d8b..44c26e1 100644
--- a/drivers/staging/tidspbridge/rmgr/proc.c
+++ b/drivers/staging/tidspbridge/rmgr/proc.c
@@ -1302,9 +1302,10 @@ int proc_load(void *hprocessor, const s32 argc_index,
}

func_end:
- if (status)
+ if (status) {
pr_err("%s: Processor failed to load\n", __func__);
-
+ proc_stop(p_proc_object);
+ }
DBC_ENSURE((!status
&& p_proc_object->proc_state == PROC_LOADED)
|| status);
@@ -1594,6 +1595,7 @@ func_cont:
}
} else {
pr_err("%s: Failed to start the dsp\n", __func__);
+ proc_stop(p_proc_object);
}

func_end:
--
1.5.4.5