| .. | .. |
|---|
| 15 | 15 | #include <linux/remoteproc.h> |
|---|
| 16 | 16 | #include "qcom_q6v5.h" |
|---|
| 17 | 17 | |
|---|
| 18 | +#define Q6V5_PANIC_DELAY_MS 200 |
|---|
| 19 | + |
|---|
| 18 | 20 | /** |
|---|
| 19 | 21 | * qcom_q6v5_prepare() - reinitialize the qcom_q6v5 context before start |
|---|
| 20 | 22 | * @q6v5: reference to qcom_q6v5 context to be reinitialized |
|---|
| .. | .. |
|---|
| 165 | 167 | EXPORT_SYMBOL_GPL(qcom_q6v5_request_stop); |
|---|
| 166 | 168 | |
|---|
| 167 | 169 | /** |
|---|
| 170 | + * qcom_q6v5_panic() - panic handler to invoke a stop on the remote |
|---|
| 171 | + * @q6v5: reference to qcom_q6v5 context |
|---|
| 172 | + * |
|---|
| 173 | + * Set the stop bit and sleep in order to allow the remote processor to flush |
|---|
| 174 | + * its caches etc for post mortem debugging. |
|---|
| 175 | + * |
|---|
| 176 | + * Return: 200ms |
|---|
| 177 | + */ |
|---|
| 178 | +unsigned long qcom_q6v5_panic(struct qcom_q6v5 *q6v5) |
|---|
| 179 | +{ |
|---|
| 180 | + qcom_smem_state_update_bits(q6v5->state, |
|---|
| 181 | + BIT(q6v5->stop_bit), BIT(q6v5->stop_bit)); |
|---|
| 182 | + |
|---|
| 183 | + return Q6V5_PANIC_DELAY_MS; |
|---|
| 184 | +} |
|---|
| 185 | +EXPORT_SYMBOL_GPL(qcom_q6v5_panic); |
|---|
| 186 | + |
|---|
| 187 | +/** |
|---|
| 168 | 188 | * qcom_q6v5_init() - initializer of the q6v5 common struct |
|---|
| 169 | 189 | * @q6v5: handle to be initialized |
|---|
| 170 | 190 | * @pdev: platform_device reference for acquiring resources |
|---|
| .. | .. |
|---|
| 189 | 209 | init_completion(&q6v5->stop_done); |
|---|
| 190 | 210 | |
|---|
| 191 | 211 | q6v5->wdog_irq = platform_get_irq_byname(pdev, "wdog"); |
|---|
| 192 | | - if (q6v5->wdog_irq < 0) { |
|---|
| 193 | | - if (q6v5->wdog_irq != -EPROBE_DEFER) |
|---|
| 194 | | - dev_err(&pdev->dev, |
|---|
| 195 | | - "failed to retrieve wdog IRQ: %d\n", |
|---|
| 196 | | - q6v5->wdog_irq); |
|---|
| 212 | + if (q6v5->wdog_irq < 0) |
|---|
| 197 | 213 | return q6v5->wdog_irq; |
|---|
| 198 | | - } |
|---|
| 199 | 214 | |
|---|
| 200 | 215 | ret = devm_request_threaded_irq(&pdev->dev, q6v5->wdog_irq, |
|---|
| 201 | 216 | NULL, q6v5_wdog_interrupt, |
|---|
| .. | .. |
|---|
| 207 | 222 | } |
|---|
| 208 | 223 | |
|---|
| 209 | 224 | q6v5->fatal_irq = platform_get_irq_byname(pdev, "fatal"); |
|---|
| 210 | | - if (q6v5->fatal_irq < 0) { |
|---|
| 211 | | - if (q6v5->fatal_irq != -EPROBE_DEFER) |
|---|
| 212 | | - dev_err(&pdev->dev, |
|---|
| 213 | | - "failed to retrieve fatal IRQ: %d\n", |
|---|
| 214 | | - q6v5->fatal_irq); |
|---|
| 225 | + if (q6v5->fatal_irq < 0) |
|---|
| 215 | 226 | return q6v5->fatal_irq; |
|---|
| 216 | | - } |
|---|
| 217 | 227 | |
|---|
| 218 | 228 | ret = devm_request_threaded_irq(&pdev->dev, q6v5->fatal_irq, |
|---|
| 219 | 229 | NULL, q6v5_fatal_interrupt, |
|---|
| .. | .. |
|---|
| 225 | 235 | } |
|---|
| 226 | 236 | |
|---|
| 227 | 237 | q6v5->ready_irq = platform_get_irq_byname(pdev, "ready"); |
|---|
| 228 | | - if (q6v5->ready_irq < 0) { |
|---|
| 229 | | - if (q6v5->ready_irq != -EPROBE_DEFER) |
|---|
| 230 | | - dev_err(&pdev->dev, |
|---|
| 231 | | - "failed to retrieve ready IRQ: %d\n", |
|---|
| 232 | | - q6v5->ready_irq); |
|---|
| 238 | + if (q6v5->ready_irq < 0) |
|---|
| 233 | 239 | return q6v5->ready_irq; |
|---|
| 234 | | - } |
|---|
| 235 | 240 | |
|---|
| 236 | 241 | ret = devm_request_threaded_irq(&pdev->dev, q6v5->ready_irq, |
|---|
| 237 | 242 | NULL, q6v5_ready_interrupt, |
|---|
| .. | .. |
|---|
| 243 | 248 | } |
|---|
| 244 | 249 | |
|---|
| 245 | 250 | q6v5->handover_irq = platform_get_irq_byname(pdev, "handover"); |
|---|
| 246 | | - if (q6v5->handover_irq < 0) { |
|---|
| 247 | | - if (q6v5->handover_irq != -EPROBE_DEFER) |
|---|
| 248 | | - dev_err(&pdev->dev, |
|---|
| 249 | | - "failed to retrieve handover IRQ: %d\n", |
|---|
| 250 | | - q6v5->handover_irq); |
|---|
| 251 | + if (q6v5->handover_irq < 0) |
|---|
| 251 | 252 | return q6v5->handover_irq; |
|---|
| 252 | | - } |
|---|
| 253 | 253 | |
|---|
| 254 | 254 | ret = devm_request_threaded_irq(&pdev->dev, q6v5->handover_irq, |
|---|
| 255 | 255 | NULL, q6v5_handover_interrupt, |
|---|
| .. | .. |
|---|
| 262 | 262 | disable_irq(q6v5->handover_irq); |
|---|
| 263 | 263 | |
|---|
| 264 | 264 | q6v5->stop_irq = platform_get_irq_byname(pdev, "stop-ack"); |
|---|
| 265 | | - if (q6v5->stop_irq < 0) { |
|---|
| 266 | | - if (q6v5->stop_irq != -EPROBE_DEFER) |
|---|
| 267 | | - dev_err(&pdev->dev, |
|---|
| 268 | | - "failed to retrieve stop-ack IRQ: %d\n", |
|---|
| 269 | | - q6v5->stop_irq); |
|---|
| 265 | + if (q6v5->stop_irq < 0) |
|---|
| 270 | 266 | return q6v5->stop_irq; |
|---|
| 271 | | - } |
|---|
| 272 | 267 | |
|---|
| 273 | 268 | ret = devm_request_threaded_irq(&pdev->dev, q6v5->stop_irq, |
|---|
| 274 | 269 | NULL, q6v5_stop_interrupt, |
|---|