blob: 58d43013d16738395b7e6a430a717d610c2dee95 [file] [log] [blame]
Seemanta Dutta4e2d49c2013-04-05 16:28:11 -07001/* Copyright (c) 2010-2013, The Linux Foundation. All rights reserved.
Stephen Boyd3acc9e42011-09-28 16:46:40 -07002 *
3 * This program is free software; you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License version 2 and
5 * only version 2 as published by the Free Software Foundation.
6 *
7 * This program is distributed in the hope that it will be useful,
8 * but WITHOUT ANY WARRANTY; without even the implied warranty of
9 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10 * GNU General Public License for more details.
11 */
12
13#include <linux/init.h>
14#include <linux/module.h>
15#include <linux/platform_device.h>
16#include <linux/io.h>
17#include <linux/ioport.h>
18#include <linux/delay.h>
Stephen Boyd3acc9e42011-09-28 16:46:40 -070019#include <linux/err.h>
20#include <linux/clk.h>
Stephen Boyd2e19d932012-05-09 17:36:04 -070021#include <linux/workqueue.h>
22#include <linux/interrupt.h>
Stephen Boyd3acc9e42011-09-28 16:46:40 -070023
Stephen Boyd2e19d932012-05-09 17:36:04 -070024#include <mach/subsystem_restart.h>
25#include <mach/scm.h>
Seemanta Dutta4e2d49c2013-04-05 16:28:11 -070026#include <mach/ramdump.h>
Deepak Katragadda4118ccc2013-07-05 10:01:19 -070027#include <mach/msm_bus_board.h>
Stephen Boyd3acc9e42011-09-28 16:46:40 -070028
29#include "peripheral-loader.h"
30#include "scm-pas.h"
31
32#define QDSP6SS_RST_EVB 0x0000
33#define QDSP6SS_STRAP_TCM 0x001C
34#define QDSP6SS_STRAP_AHB 0x0020
35
Stephen Boyde24edf52012-07-12 17:46:19 -070036#define LCC_Q6_FUNC 0x001C
Stephen Boyd3acc9e42011-09-28 16:46:40 -070037#define LV_EN BIT(27)
38#define STOP_CORE BIT(26)
39#define CLAMP_IO BIT(25)
40#define Q6SS_PRIV_ARES BIT(24)
41#define Q6SS_SS_ARES BIT(23)
42#define Q6SS_ISDB_ARES BIT(22)
43#define Q6SS_ETM_ARES BIT(21)
44#define Q6_JTAG_CRC_EN BIT(20)
45#define Q6_JTAG_INV_EN BIT(19)
46#define Q6_JTAG_CXC_EN BIT(18)
47#define Q6_PXO_CRC_EN BIT(17)
48#define Q6_PXO_INV_EN BIT(16)
49#define Q6_PXO_CXC_EN BIT(15)
50#define Q6_PXO_SLEEP_EN BIT(14)
51#define Q6_SLP_CRC_EN BIT(13)
52#define Q6_SLP_INV_EN BIT(12)
53#define Q6_SLP_CXC_EN BIT(11)
54#define CORE_ARES BIT(10)
55#define CORE_L1_MEM_CORE_EN BIT(9)
56#define CORE_TCM_MEM_CORE_EN BIT(8)
57#define CORE_TCM_MEM_PERPH_EN BIT(7)
58#define CORE_GFM4_CLK_EN BIT(2)
59#define CORE_GFM4_RES BIT(1)
60#define RAMP_PLL_SRC_SEL BIT(0)
61
62#define Q6_STRAP_AHB_UPPER (0x290 << 12)
63#define Q6_STRAP_AHB_LOWER 0x280
64#define Q6_STRAP_TCM_BASE (0x28C << 15)
65#define Q6_STRAP_TCM_CONFIG 0x28B
66
Stephen Boyd2e19d932012-05-09 17:36:04 -070067#define SCM_Q6_NMI_CMD 0x1
68
69/**
70 * struct q6v3_data - LPASS driver data
71 * @base: register base
Stephen Boyde24edf52012-07-12 17:46:19 -070072 * @cbase: clock base
Stephen Boyd2e19d932012-05-09 17:36:04 -070073 * @wk_base: wakeup register base
74 * @wd_base: watchdog register base
Stephen Boyd2e19d932012-05-09 17:36:04 -070075 * @irq: watchdog irq
76 * @pil: peripheral handle
77 * @subsys: subsystem restart handle
78 * @subsys_desc: subsystem restart descriptor
79 * @fatal_wrk: fatal error workqueue
80 * @pll: pll clock handle
81 * @ramdump_dev: ramdump device
82 */
Stephen Boyd3acc9e42011-09-28 16:46:40 -070083struct q6v3_data {
84 void __iomem *base;
Stephen Boyde24edf52012-07-12 17:46:19 -070085 void __iomem *cbase;
Stephen Boyd2e19d932012-05-09 17:36:04 -070086 void __iomem *wk_base;
87 void __iomem *wd_base;
Stephen Boyd2e19d932012-05-09 17:36:04 -070088 int irq;
Stephen Boyde83a0a22012-06-29 13:51:27 -070089 struct pil_desc pil_desc;
Stephen Boyd2e19d932012-05-09 17:36:04 -070090 struct subsys_device *subsys;
91 struct subsys_desc subsys_desc;
92 struct work_struct fatal_wrk;
Stephen Boyd3acc9e42011-09-28 16:46:40 -070093 struct clk *pll;
Stephen Boyd2e19d932012-05-09 17:36:04 -070094 struct ramdump_device *ramdump_dev;
Stephen Boyd3acc9e42011-09-28 16:46:40 -070095};
96
Stephen Boyd32f7f2e2012-03-22 10:59:22 -070097static void pil_q6v3_remove_proxy_votes(struct pil_desc *pil)
Stephen Boyd3acc9e42011-09-28 16:46:40 -070098{
Stephen Boyd32f7f2e2012-03-22 10:59:22 -070099 struct q6v3_data *drv = dev_get_drvdata(pil->dev);
Stephen Boyd4f8b7e22012-01-24 13:31:29 -0800100 clk_disable_unprepare(drv->pll);
Stephen Boyd3acc9e42011-09-28 16:46:40 -0700101}
102
Stephen Boyd32f7f2e2012-03-22 10:59:22 -0700103static int pil_q6v3_make_proxy_votes(struct pil_desc *pil)
Stephen Boyd3acc9e42011-09-28 16:46:40 -0700104{
105 int ret;
Stephen Boyd32f7f2e2012-03-22 10:59:22 -0700106 struct q6v3_data *drv = dev_get_drvdata(pil->dev);
Stephen Boyd3acc9e42011-09-28 16:46:40 -0700107
Stephen Boyd4f8b7e22012-01-24 13:31:29 -0800108 ret = clk_prepare_enable(drv->pll);
109 if (ret) {
Stephen Boyd32f7f2e2012-03-22 10:59:22 -0700110 dev_err(pil->dev, "Failed to enable PLL\n");
Stephen Boyd4f8b7e22012-01-24 13:31:29 -0800111 return ret;
112 }
Stephen Boyd4f8b7e22012-01-24 13:31:29 -0800113 return 0;
Stephen Boyd3acc9e42011-09-28 16:46:40 -0700114}
115
Stephen Boyd3acc9e42011-09-28 16:46:40 -0700116static int pil_q6v3_reset(struct pil_desc *pil)
117{
118 u32 reg;
119 struct q6v3_data *drv = dev_get_drvdata(pil->dev);
Tianyi Gou819851e2013-04-16 16:05:56 -0700120 phys_addr_t start_addr = pil_get_entry_addr(pil);
Stephen Boyd3acc9e42011-09-28 16:46:40 -0700121
Stephen Boyd3acc9e42011-09-28 16:46:40 -0700122 /* Put Q6 into reset */
Stephen Boyde24edf52012-07-12 17:46:19 -0700123 reg = readl_relaxed(drv->cbase + LCC_Q6_FUNC);
Stephen Boyd3acc9e42011-09-28 16:46:40 -0700124 reg |= Q6SS_SS_ARES | Q6SS_ISDB_ARES | Q6SS_ETM_ARES | STOP_CORE |
125 CORE_ARES;
126 reg &= ~CORE_GFM4_CLK_EN;
Stephen Boyde24edf52012-07-12 17:46:19 -0700127 writel_relaxed(reg, drv->cbase + LCC_Q6_FUNC);
Stephen Boyd3acc9e42011-09-28 16:46:40 -0700128
129 /* Wait 8 AHB cycles for Q6 to be fully reset (AHB = 1.5Mhz) */
130 usleep_range(20, 30);
131
132 /* Turn on Q6 memory */
133 reg |= CORE_GFM4_CLK_EN | CORE_L1_MEM_CORE_EN | CORE_TCM_MEM_CORE_EN |
134 CORE_TCM_MEM_PERPH_EN;
Stephen Boyde24edf52012-07-12 17:46:19 -0700135 writel_relaxed(reg, drv->cbase + LCC_Q6_FUNC);
Stephen Boyd3acc9e42011-09-28 16:46:40 -0700136
137 /* Turn on Q6 core clocks and take core out of reset */
138 reg &= ~(CLAMP_IO | Q6SS_SS_ARES | Q6SS_ISDB_ARES | Q6SS_ETM_ARES |
139 CORE_ARES);
Stephen Boyde24edf52012-07-12 17:46:19 -0700140 writel_relaxed(reg, drv->cbase + LCC_Q6_FUNC);
Stephen Boyd3acc9e42011-09-28 16:46:40 -0700141
142 /* Wait for clocks to be enabled */
143 mb();
144 /* Program boot address */
Stephen Boyd3030c252012-08-08 17:24:05 -0700145 writel_relaxed((start_addr >> 12) & 0xFFFFF,
Stephen Boyd3acc9e42011-09-28 16:46:40 -0700146 drv->base + QDSP6SS_RST_EVB);
147
148 writel_relaxed(Q6_STRAP_TCM_CONFIG | Q6_STRAP_TCM_BASE,
149 drv->base + QDSP6SS_STRAP_TCM);
150 writel_relaxed(Q6_STRAP_AHB_UPPER | Q6_STRAP_AHB_LOWER,
151 drv->base + QDSP6SS_STRAP_AHB);
152
153 /* Wait for addresses to be programmed before starting Q6 */
154 mb();
155
156 /* Start Q6 instruction execution */
157 reg &= ~STOP_CORE;
Stephen Boyde24edf52012-07-12 17:46:19 -0700158 writel_relaxed(reg, drv->cbase + LCC_Q6_FUNC);
Stephen Boyd3acc9e42011-09-28 16:46:40 -0700159
160 return 0;
161}
162
163static int pil_q6v3_shutdown(struct pil_desc *pil)
164{
165 u32 reg;
Stephen Boyde24edf52012-07-12 17:46:19 -0700166 struct q6v3_data *drv = dev_get_drvdata(pil->dev);
Stephen Boyd3acc9e42011-09-28 16:46:40 -0700167
168 /* Put Q6 into reset */
Stephen Boyde24edf52012-07-12 17:46:19 -0700169 reg = readl_relaxed(drv->cbase + LCC_Q6_FUNC);
Stephen Boyd3acc9e42011-09-28 16:46:40 -0700170 reg |= Q6SS_SS_ARES | Q6SS_ISDB_ARES | Q6SS_ETM_ARES | STOP_CORE |
171 CORE_ARES;
172 reg &= ~CORE_GFM4_CLK_EN;
Stephen Boyde24edf52012-07-12 17:46:19 -0700173 writel_relaxed(reg, drv->cbase + LCC_Q6_FUNC);
Stephen Boyd3acc9e42011-09-28 16:46:40 -0700174
175 /* Wait 8 AHB cycles for Q6 to be fully reset (AHB = 1.5Mhz) */
176 usleep_range(20, 30);
177
178 /* Turn off Q6 memory */
179 reg &= ~(CORE_L1_MEM_CORE_EN | CORE_TCM_MEM_CORE_EN |
180 CORE_TCM_MEM_PERPH_EN);
Stephen Boyde24edf52012-07-12 17:46:19 -0700181 writel_relaxed(reg, drv->cbase + LCC_Q6_FUNC);
Stephen Boyd3acc9e42011-09-28 16:46:40 -0700182
183 reg |= CLAMP_IO;
Stephen Boyde24edf52012-07-12 17:46:19 -0700184 writel_relaxed(reg, drv->cbase + LCC_Q6_FUNC);
Stephen Boyd3acc9e42011-09-28 16:46:40 -0700185
Stephen Boyd3acc9e42011-09-28 16:46:40 -0700186 return 0;
187}
188
189static struct pil_reset_ops pil_q6v3_ops = {
Stephen Boyd3acc9e42011-09-28 16:46:40 -0700190 .auth_and_reset = pil_q6v3_reset,
191 .shutdown = pil_q6v3_shutdown,
Stephen Boyd32f7f2e2012-03-22 10:59:22 -0700192 .proxy_vote = pil_q6v3_make_proxy_votes,
193 .proxy_unvote = pil_q6v3_remove_proxy_votes,
Stephen Boyd3acc9e42011-09-28 16:46:40 -0700194};
195
196static int pil_q6v3_init_image_trusted(struct pil_desc *pil,
197 const u8 *metadata, size_t size)
198{
199 return pas_init_image(PAS_Q6, metadata, size);
200}
201
202static int pil_q6v3_reset_trusted(struct pil_desc *pil)
203{
Stephen Boyd3acc9e42011-09-28 16:46:40 -0700204 return pas_auth_and_reset(PAS_Q6);
205}
206
207static int pil_q6v3_shutdown_trusted(struct pil_desc *pil)
208{
Stephen Boyd32f7f2e2012-03-22 10:59:22 -0700209 return pas_shutdown(PAS_Q6);
Stephen Boyd3acc9e42011-09-28 16:46:40 -0700210}
211
212static struct pil_reset_ops pil_q6v3_ops_trusted = {
213 .init_image = pil_q6v3_init_image_trusted,
Stephen Boyd3acc9e42011-09-28 16:46:40 -0700214 .auth_and_reset = pil_q6v3_reset_trusted,
215 .shutdown = pil_q6v3_shutdown_trusted,
Stephen Boyd32f7f2e2012-03-22 10:59:22 -0700216 .proxy_vote = pil_q6v3_make_proxy_votes,
217 .proxy_unvote = pil_q6v3_remove_proxy_votes,
Stephen Boyd3acc9e42011-09-28 16:46:40 -0700218};
219
Stephen Boyd2e19d932012-05-09 17:36:04 -0700220static void q6_fatal_fn(struct work_struct *work)
221{
222 struct q6v3_data *drv = container_of(work, struct q6v3_data, fatal_wrk);
223
224 pr_err("Watchdog bite received from Q6!\n");
225 subsystem_restart_dev(drv->subsys);
226 enable_irq(drv->irq);
227}
228
229static void send_q6_nmi(struct q6v3_data *drv)
230{
231 /* Send NMI to QDSP6 via an SCM call. */
232 scm_call_atomic1(SCM_SVC_UTIL, SCM_Q6_NMI_CMD, 0x1);
233
234 /* Wakeup the Q6 */
235 writel_relaxed(0x2000, drv->wk_base + 0x1c);
236 /* Q6 requires atleast 100ms to dump caches etc.*/
237 mdelay(100);
238 pr_info("Q6 NMI was sent.\n");
239}
240
Stephen Boyd3e4e9752012-06-27 12:46:32 -0700241static int lpass_q6_start(const struct subsys_desc *subsys)
242{
Stephen Boyd3e4e9752012-06-27 12:46:32 -0700243 struct q6v3_data *drv;
244
245 drv = container_of(subsys, struct q6v3_data, subsys_desc);
Stephen Boyde83a0a22012-06-29 13:51:27 -0700246 return pil_boot(&drv->pil_desc);
Stephen Boyd3e4e9752012-06-27 12:46:32 -0700247}
248
249static void lpass_q6_stop(const struct subsys_desc *subsys)
250{
251 struct q6v3_data *drv;
252
253 drv = container_of(subsys, struct q6v3_data, subsys_desc);
Stephen Boyde83a0a22012-06-29 13:51:27 -0700254 pil_shutdown(&drv->pil_desc);
Stephen Boyd3e4e9752012-06-27 12:46:32 -0700255}
256
Stephen Boyd2e19d932012-05-09 17:36:04 -0700257static int lpass_q6_shutdown(const struct subsys_desc *subsys)
258{
259 struct q6v3_data *drv;
260
261 drv = container_of(subsys, struct q6v3_data, subsys_desc);
262 send_q6_nmi(drv);
263 writel_relaxed(0x0, drv->wd_base + 0x24);
264 mb();
265
Stephen Boyde83a0a22012-06-29 13:51:27 -0700266 pil_shutdown(&drv->pil_desc);
Stephen Boyd2e19d932012-05-09 17:36:04 -0700267 disable_irq_nosync(drv->irq);
268
269 return 0;
270}
271
272static int lpass_q6_powerup(const struct subsys_desc *subsys)
273{
274 struct q6v3_data *drv;
275 int ret;
276
277 drv = container_of(subsys, struct q6v3_data, subsys_desc);
Stephen Boyde83a0a22012-06-29 13:51:27 -0700278 ret = pil_boot(&drv->pil_desc);
Stephen Boyd2e19d932012-05-09 17:36:04 -0700279 enable_irq(drv->irq);
280 return ret;
281}
282
Stephen Boyd2e19d932012-05-09 17:36:04 -0700283static int lpass_q6_ramdump(int enable, const struct subsys_desc *subsys)
284{
285 struct q6v3_data *drv;
286
287 drv = container_of(subsys, struct q6v3_data, subsys_desc);
Stephen Boyd5eb17ce2012-11-29 15:34:21 -0800288 if (!enable)
Stephen Boyd2e19d932012-05-09 17:36:04 -0700289 return 0;
Stephen Boyd5eb17ce2012-11-29 15:34:21 -0800290
291 return pil_do_ramdump(&drv->pil_desc, drv->ramdump_dev);
Stephen Boyd2e19d932012-05-09 17:36:04 -0700292}
293
294static void lpass_q6_crash_shutdown(const struct subsys_desc *subsys)
295{
296 struct q6v3_data *drv;
297
298 drv = container_of(subsys, struct q6v3_data, subsys_desc);
299 send_q6_nmi(drv);
300}
301
302static irqreturn_t lpass_wdog_bite_irq(int irq, void *dev_id)
303{
304 int ret;
305 struct q6v3_data *drv = dev_id;
306
307 ret = schedule_work(&drv->fatal_wrk);
308 disable_irq_nosync(drv->irq);
309
310 return IRQ_HANDLED;
311}
312
Stephen Boyd3acc9e42011-09-28 16:46:40 -0700313static int __devinit pil_q6v3_driver_probe(struct platform_device *pdev)
314{
315 struct q6v3_data *drv;
316 struct resource *res;
317 struct pil_desc *desc;
Stephen Boyd2e19d932012-05-09 17:36:04 -0700318 int ret;
Stephen Boyd3acc9e42011-09-28 16:46:40 -0700319
Stephen Boyd3acc9e42011-09-28 16:46:40 -0700320 drv = devm_kzalloc(&pdev->dev, sizeof(*drv), GFP_KERNEL);
321 if (!drv)
322 return -ENOMEM;
323 platform_set_drvdata(pdev, drv);
324
Stephen Boydf8f89282012-07-16 18:05:48 -0700325 res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
326 drv->base = devm_request_and_ioremap(&pdev->dev, res);
Stephen Boyd3acc9e42011-09-28 16:46:40 -0700327 if (!drv->base)
328 return -ENOMEM;
329
Stephen Boyd2e19d932012-05-09 17:36:04 -0700330 res = platform_get_resource(pdev, IORESOURCE_MEM, 1);
Stephen Boydf8f89282012-07-16 18:05:48 -0700331 drv->wk_base = devm_request_and_ioremap(&pdev->dev, res);
Stephen Boyd2e19d932012-05-09 17:36:04 -0700332 if (!drv->wk_base)
Stephen Boyd3acc9e42011-09-28 16:46:40 -0700333 return -ENOMEM;
334
Stephen Boyd2e19d932012-05-09 17:36:04 -0700335 res = platform_get_resource(pdev, IORESOURCE_MEM, 2);
Stephen Boydf8f89282012-07-16 18:05:48 -0700336 drv->wd_base = devm_request_and_ioremap(&pdev->dev, res);
Stephen Boyd2e19d932012-05-09 17:36:04 -0700337 if (!drv->wd_base)
338 return -ENOMEM;
339
Stephen Boyde24edf52012-07-12 17:46:19 -0700340 res = platform_get_resource(pdev, IORESOURCE_MEM, 3);
341 if (!res)
342 return -EINVAL;
343 drv->cbase = devm_ioremap(&pdev->dev, res->start, resource_size(res));
344 if (!drv->cbase)
345 return -ENOMEM;
346
Stephen Boyd2e19d932012-05-09 17:36:04 -0700347 drv->irq = platform_get_irq(pdev, 0);
348 if (drv->irq < 0)
349 return drv->irq;
350
Stephen Boydf11bfb52012-03-23 15:30:48 -0700351 drv->pll = devm_clk_get(&pdev->dev, "pll4");
Stephen Boyd3acc9e42011-09-28 16:46:40 -0700352 if (IS_ERR(drv->pll))
353 return PTR_ERR(drv->pll);
354
Stephen Boyde83a0a22012-06-29 13:51:27 -0700355 desc = &drv->pil_desc;
Stephen Boyd3acc9e42011-09-28 16:46:40 -0700356 desc->name = "q6";
357 desc->dev = &pdev->dev;
Stephen Boyd6d67d252011-09-27 11:50:05 -0700358 desc->owner = THIS_MODULE;
Stephen Boyd32f7f2e2012-03-22 10:59:22 -0700359 desc->proxy_timeout = 10000;
Stephen Boyd3acc9e42011-09-28 16:46:40 -0700360
361 if (pas_supported(PAS_Q6) > 0) {
362 desc->ops = &pil_q6v3_ops_trusted;
363 dev_info(&pdev->dev, "using secure boot\n");
364 } else {
365 desc->ops = &pil_q6v3_ops;
366 dev_info(&pdev->dev, "using non-secure boot\n");
367 }
368
Stephen Boyde83a0a22012-06-29 13:51:27 -0700369 ret = pil_desc_init(desc);
370 if (ret)
371 return ret;
Stephen Boyd2e19d932012-05-09 17:36:04 -0700372
Stephen Boyd77db8bb2012-06-27 15:15:16 -0700373 drv->subsys_desc.name = "adsp";
Stephen Boyd3e4e9752012-06-27 12:46:32 -0700374 drv->subsys_desc.dev = &pdev->dev;
375 drv->subsys_desc.owner = THIS_MODULE;
376 drv->subsys_desc.start = lpass_q6_start;
377 drv->subsys_desc.stop = lpass_q6_stop;
Stephen Boyd2e19d932012-05-09 17:36:04 -0700378 drv->subsys_desc.shutdown = lpass_q6_shutdown;
379 drv->subsys_desc.powerup = lpass_q6_powerup;
380 drv->subsys_desc.ramdump = lpass_q6_ramdump;
381 drv->subsys_desc.crash_shutdown = lpass_q6_crash_shutdown;
382
383 INIT_WORK(&drv->fatal_wrk, q6_fatal_fn);
384
Stephen Boydc1a72612012-07-05 14:07:35 -0700385 drv->ramdump_dev = create_ramdump_device("lpass", &pdev->dev);
Stephen Boyd2e19d932012-05-09 17:36:04 -0700386 if (!drv->ramdump_dev) {
387 ret = -ENOMEM;
388 goto err_ramdump;
Stephen Boyd4f8b7e22012-01-24 13:31:29 -0800389 }
Stephen Boyd2e19d932012-05-09 17:36:04 -0700390
391 drv->subsys = subsys_register(&drv->subsys_desc);
392 if (IS_ERR(drv->subsys)) {
393 ret = PTR_ERR(drv->subsys);
394 goto err_subsys;
395 }
396
Deepak Katragadda4118ccc2013-07-05 10:01:19 -0700397 scm_pas_init(MSM_BUS_MASTER_SPS);
398
Stephen Boyd2e19d932012-05-09 17:36:04 -0700399 ret = devm_request_irq(&pdev->dev, drv->irq, lpass_wdog_bite_irq,
400 IRQF_TRIGGER_RISING, "lpass_wdog", drv);
401 if (ret) {
402 dev_err(&pdev->dev, "Unable to request wdog irq.\n");
403 goto err_irq;
404 }
405
Stephen Boyd3acc9e42011-09-28 16:46:40 -0700406 return 0;
Stephen Boyd2e19d932012-05-09 17:36:04 -0700407err_irq:
408 subsys_unregister(drv->subsys);
409err_subsys:
410 destroy_ramdump_device(drv->ramdump_dev);
411err_ramdump:
Stephen Boyde83a0a22012-06-29 13:51:27 -0700412 pil_desc_release(desc);
Stephen Boyd2e19d932012-05-09 17:36:04 -0700413 return ret;
Stephen Boyd3acc9e42011-09-28 16:46:40 -0700414}
415
416static int __devexit pil_q6v3_driver_exit(struct platform_device *pdev)
417{
418 struct q6v3_data *drv = platform_get_drvdata(pdev);
Stephen Boyd2e19d932012-05-09 17:36:04 -0700419 subsys_unregister(drv->subsys);
420 destroy_ramdump_device(drv->ramdump_dev);
Stephen Boyde83a0a22012-06-29 13:51:27 -0700421 pil_desc_release(&drv->pil_desc);
Stephen Boyd3acc9e42011-09-28 16:46:40 -0700422 return 0;
423}
424
425static struct platform_driver pil_q6v3_driver = {
426 .probe = pil_q6v3_driver_probe,
427 .remove = __devexit_p(pil_q6v3_driver_exit),
428 .driver = {
429 .name = "pil_qdsp6v3",
430 .owner = THIS_MODULE,
431 },
432};
433
434static int __init pil_q6v3_init(void)
435{
436 return platform_driver_register(&pil_q6v3_driver);
437}
438module_init(pil_q6v3_init);
439
440static void __exit pil_q6v3_exit(void)
441{
442 platform_driver_unregister(&pil_q6v3_driver);
443}
444module_exit(pil_q6v3_exit);
445
446MODULE_DESCRIPTION("Support for booting QDSP6v3 (Hexagon) processors");
447MODULE_LICENSE("GPL v2");