aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKiran AVND <avnd.kiran@samsung.com>2014-10-21 07:07:00 -0400
committerMauro Carvalho Chehab <mchehab@osg.samsung.com>2014-10-28 13:44:32 -0400
commit09accdad0d4b2a6415d3b09bd1b97024f32bb18a (patch)
tree66205501ef0687ade74a61201e6ab62533e01b16
parentd7dce6a3cdcfa95703c551a921068223df46732a (diff)
[media] s5p-mfc: check mfc bus ctrl before reset
during reset sequence, it is advisable to follow the below sequence, in order to avoid unexpected behavior from MFC . set SFR 0x7110 MFC_BUS_RESET_CTRL 0x1 // wait for REQ_STATUS to be 1 . get SFR 0x7110 MFC_BUS_RESET_CTRL 0x3 // reset now Signed-off-by: Kiran AVND <avnd.kiran@samsung.com> Signed-off-by: Arun Kumar K <arun.kk@samsung.com> Signed-off-by: Kamil Debski <k.debski@samsung.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
-rw-r--r--drivers/media/platform/s5p-mfc/regs-mfc-v6.h1
-rw-r--r--drivers/media/platform/s5p-mfc/s5p_mfc_ctrl.c25
2 files changed, 25 insertions, 1 deletions
diff --git a/drivers/media/platform/s5p-mfc/regs-mfc-v6.h b/drivers/media/platform/s5p-mfc/regs-mfc-v6.h
index 51cb2dd0e13a..83e01f3466e9 100644
--- a/drivers/media/platform/s5p-mfc/regs-mfc-v6.h
+++ b/drivers/media/platform/s5p-mfc/regs-mfc-v6.h
@@ -71,6 +71,7 @@
71#define S5P_FIMV_R2H_CMD_ENC_BUFFER_FUL_RET_V6 16 71#define S5P_FIMV_R2H_CMD_ENC_BUFFER_FUL_RET_V6 16
72#define S5P_FIMV_R2H_CMD_ERR_RET_V6 32 72#define S5P_FIMV_R2H_CMD_ERR_RET_V6 32
73 73
74#define S5P_FIMV_MFC_BUS_RESET_CTRL 0x7110
74#define S5P_FIMV_FW_VERSION_V6 0xf000 75#define S5P_FIMV_FW_VERSION_V6 0xf000
75 76
76#define S5P_FIMV_INSTANCE_ID_V6 0xf008 77#define S5P_FIMV_INSTANCE_ID_V6 0xf008
diff --git a/drivers/media/platform/s5p-mfc/s5p_mfc_ctrl.c b/drivers/media/platform/s5p-mfc/s5p_mfc_ctrl.c
index f5bb6b2b3a5f..0d3661b5eaf1 100644
--- a/drivers/media/platform/s5p-mfc/s5p_mfc_ctrl.c
+++ b/drivers/media/platform/s5p-mfc/s5p_mfc_ctrl.c
@@ -129,6 +129,25 @@ int s5p_mfc_release_firmware(struct s5p_mfc_dev *dev)
129 return 0; 129 return 0;
130} 130}
131 131
132int s5p_mfc_bus_reset(struct s5p_mfc_dev *dev)
133{
134 unsigned int status;
135 unsigned long timeout;
136
137 /* Reset */
138 mfc_write(dev, 0x1, S5P_FIMV_MFC_BUS_RESET_CTRL);
139 timeout = jiffies + msecs_to_jiffies(MFC_BW_TIMEOUT);
140 /* Check bus status */
141 do {
142 if (time_after(jiffies, timeout)) {
143 mfc_err("Timeout while resetting MFC.\n");
144 return -EIO;
145 }
146 status = mfc_read(dev, S5P_FIMV_MFC_BUS_RESET_CTRL);
147 } while ((status & 0x2) == 0);
148 return 0;
149}
150
132/* Reset the device */ 151/* Reset the device */
133int s5p_mfc_reset(struct s5p_mfc_dev *dev) 152int s5p_mfc_reset(struct s5p_mfc_dev *dev)
134{ 153{
@@ -147,11 +166,15 @@ int s5p_mfc_reset(struct s5p_mfc_dev *dev)
147 for (i = 0; i < S5P_FIMV_REG_CLEAR_COUNT_V6; i++) 166 for (i = 0; i < S5P_FIMV_REG_CLEAR_COUNT_V6; i++)
148 mfc_write(dev, 0, S5P_FIMV_REG_CLEAR_BEGIN_V6 + (i*4)); 167 mfc_write(dev, 0, S5P_FIMV_REG_CLEAR_BEGIN_V6 + (i*4));
149 168
169 /* check bus reset control before reset */
170 if (dev->risc_on)
171 if (s5p_mfc_bus_reset(dev))
172 return -EIO;
150 /* Reset 173 /* Reset
151 * set RISC_ON to 0 during power_on & wake_up. 174 * set RISC_ON to 0 during power_on & wake_up.
152 * V6 needs RISC_ON set to 0 during reset also. 175 * V6 needs RISC_ON set to 0 during reset also.
153 */ 176 */
154 if ((!dev->risc_on) || (!IS_MFCV7(dev))) 177 if ((!dev->risc_on) || (!IS_MFCV7_PLUS(dev)))
155 mfc_write(dev, 0, S5P_FIMV_RISC_ON_V6); 178 mfc_write(dev, 0, S5P_FIMV_RISC_ON_V6);
156 179
157 mfc_write(dev, 0x1FFF, S5P_FIMV_MFC_RESET_V6); 180 mfc_write(dev, 0x1FFF, S5P_FIMV_MFC_RESET_V6);