diff options
author | Djamil Elaidi <d-elaidi@ti.com> | 2011-10-17 13:57:11 +0200 |
---|---|---|
committer | Ziyann <jaraidaniel@gmail.com> | 2014-10-01 12:59:33 +0200 |
commit | a8fa7188ab5f193908b58f43fab00f9f5771884a (patch) | |
tree | 60ae18f9667bb55cffa6b6108e15b79a9b81c30c | |
parent | 84dfca58a7ab2c0203108bc123918dcd87d809c1 (diff) | |
download | kernel_samsung_tuna-a8fa7188ab5f193908b58f43fab00f9f5771884a.zip kernel_samsung_tuna-a8fa7188ab5f193908b58f43fab00f9f5771884a.tar.gz kernel_samsung_tuna-a8fa7188ab5f193908b58f43fab00f9f5771884a.tar.bz2 |
OMAP4: HSI: cleanup: move HSR FSM control in separate functions
created functions hsi_hsr_resume & hsi_hsr_suspend to regroup
specific HSR FSM controls.
Change-Id: I2237fb467b886eb4b47d47b191b799ff01d9e22a
Signed-off-by: Djamil Elaidi <d-elaidi@ti.com>
Conflicts:
drivers/omap_hsi/hsi_driver.c
-rwxr-xr-x | drivers/omap_hsi/hsi_driver.c | 50 |
1 files changed, 38 insertions, 12 deletions
diff --git a/drivers/omap_hsi/hsi_driver.c b/drivers/omap_hsi/hsi_driver.c index fbffe1d..8fba60f 100755 --- a/drivers/omap_hsi/hsi_driver.c +++ b/drivers/omap_hsi/hsi_driver.c @@ -41,6 +41,39 @@ #define HSI_RESETDONE_MAX_RETRIES 5 /* Max 5*L4 Read cycles waiting for */ /* reset to complete */ #define HSI_RESETDONE_NORMAL_RETRIES 1 /* Reset should complete in 1 R/W */ + /* cycle */ + + +void hsi_hsr_suspend(struct hsi_dev *hsi_ctrl) +{ + struct hsi_platform_data *pdata = hsi_ctrl->dev->platform_data; + int port; + + dev_dbg(hsi_ctrl->dev, "%s\n", __func__); + + /* Put HSR into SLEEP mode to force ACREADY to low while HSI is idle */ + for (port = 1; port <= pdata->num_ports; port++) { + hsi_outl_and(HSI_HSR_MODE_MODE_VAL_SLEEP, hsi_ctrl->base, + HSI_HSR_MODE_REG(port)); + } +} + +void hsi_hsr_resume(struct hsi_dev *hsi_ctrl) +{ + struct hsi_platform_data *pdata = hsi_ctrl->dev->platform_data; + void __iomem *base = hsi_ctrl->base; + struct hsi_port_ctx *p; + int port; + + dev_dbg(hsi_ctrl->dev, "%s\n", __func__); + + /* Move HSR from MODE_VAL.SLEEP to the relevant mode. */ + /* This will enable the ACREADY flow control mechanism. */ + for (port = 1; port <= pdata->num_ports; port++) { + p = &pdata->ctx->pctx[port - 1]; + hsi_outl(p->hsr.mode, base, HSI_HSR_MODE_REG(port)); + } +} void hsi_save_ctx(struct hsi_dev *hsi_ctrl) { @@ -126,13 +159,6 @@ void hsi_restore_ctx(struct hsi_dev *hsi_ctrl) /* SW strategy for HSI fifo management can be changed here */ hsi_fifo_mapping(hsi_ctrl, hsi_ctrl->fifo_mapping_strategy); } - - /* As a last step move HSR from MODE_VAL.SLEEP to the relevant mode. */ - /* This will enable the ACREADY flow control mechanism. */ - for (port = 1; port <= pdata->num_ports; port++) { - p = &pdata->ctx->pctx[port - 1]; - hsi_outl(p->hsr.mode, base, HSI_HSR_MODE_REG(port)); - } } @@ -1042,6 +1068,9 @@ int hsi_runtime_resume(struct device *dev) hsi_outl(HSI_HSR_MODE_FRAME, hsi_ctrl->base, HSI_HSR_MODE_REG(HSI_PORT1)); + /* Allow data reception */ + hsi_hsr_resume(hsi_ctrl); + /* When HSI is ON, no need for IO wakeup mechanism on any HSI port */ for (i = 0; i < hsi_ctrl->max_p; i++) pdata->wakeup_disable(hsi_ctrl->hsi_port[i].port_number); @@ -1072,11 +1101,8 @@ int hsi_runtime_suspend(struct device *dev) if (!hsi_ctrl->clock_enabled) dev_warn(dev, "Warning: clock status mismatch vs runtime PM\n"); - /* Put HSR into SLEEP mode to force ACREADY to low while HSI is idle */ - for (port = 1; port <= pdata->num_ports; port++) { - hsi_outl_and(HSI_HSR_MODE_MODE_VAL_SLEEP, hsi_ctrl->base, - HSI_HSR_MODE_REG(port)); - } + /* Forbid data reception */ + hsi_hsr_suspend(hsi_ctrl); /* Save context */ hsi_save_ctx(hsi_ctrl); |