Stephen Boyd | fcb52a3 | 2012-12-03 12:35:14 -0800 | [diff] [blame] | 1 | /* Copyright (c) 2012-2013, The Linux Foundation. All rights reserved. |
Stephen Boyd | 25c4a0b | 2011-09-20 00:12:36 -0700 | [diff] [blame] | 2 | * |
| 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> |
Stephen Boyd | 25c4a0b | 2011-09-20 00:12:36 -0700 | [diff] [blame] | 16 | #include <linux/err.h> |
| 17 | #include <linux/io.h> |
| 18 | #include <linux/delay.h> |
Stephen Boyd | f169b4b | 2012-05-10 17:55:55 -0700 | [diff] [blame] | 19 | #include <linux/atomic.h> |
| 20 | #include <linux/interrupt.h> |
Stephen Boyd | 25c4a0b | 2011-09-20 00:12:36 -0700 | [diff] [blame] | 21 | |
Stephen Boyd | f169b4b | 2012-05-10 17:55:55 -0700 | [diff] [blame] | 22 | #include <mach/subsystem_restart.h> |
| 23 | #include <mach/msm_smsm.h> |
Stephen Boyd | 25c4a0b | 2011-09-20 00:12:36 -0700 | [diff] [blame] | 24 | |
| 25 | #include "peripheral-loader.h" |
| 26 | #include "scm-pas.h" |
Stephen Boyd | f169b4b | 2012-05-10 17:55:55 -0700 | [diff] [blame] | 27 | #include "ramdump.h" |
Stephen Boyd | 25c4a0b | 2011-09-20 00:12:36 -0700 | [diff] [blame] | 28 | |
Stephen Boyd | e24edf5 | 2012-07-12 17:46:19 -0700 | [diff] [blame] | 29 | #define PPSS_RESET 0x2594 |
Stephen Boyd | 25c4a0b | 2011-09-20 00:12:36 -0700 | [diff] [blame] | 30 | #define PPSS_RESET_PROC_RESET 0x2 |
| 31 | #define PPSS_RESET_RESET 0x1 |
Stephen Boyd | e24edf5 | 2012-07-12 17:46:19 -0700 | [diff] [blame] | 32 | #define PPSS_PROC_CLK_CTL 0x2588 |
Stephen Boyd | 25c4a0b | 2011-09-20 00:12:36 -0700 | [diff] [blame] | 33 | #define CLK_BRANCH_ENA 0x10 |
Stephen Boyd | e24edf5 | 2012-07-12 17:46:19 -0700 | [diff] [blame] | 34 | #define PPSS_HCLK_CTL 0x2580 |
| 35 | #define CLK_HALT_DFAB_STATE 0x2FC8 |
Stephen Boyd | 25c4a0b | 2011-09-20 00:12:36 -0700 | [diff] [blame] | 36 | |
Stephen Boyd | f169b4b | 2012-05-10 17:55:55 -0700 | [diff] [blame] | 37 | #define PPSS_WDOG_UNMASKED_INT_EN 0x1808 |
| 38 | |
| 39 | struct dsps_data { |
Stephen Boyd | e24edf5 | 2012-07-12 17:46:19 -0700 | [diff] [blame] | 40 | void __iomem *base; |
Stephen Boyd | f169b4b | 2012-05-10 17:55:55 -0700 | [diff] [blame] | 41 | struct pil_desc desc; |
| 42 | struct subsys_device *subsys; |
| 43 | struct subsys_desc subsys_desc; |
| 44 | int crash; |
| 45 | int wdog_irq; |
| 46 | atomic_t wd_crash; |
| 47 | atomic_t crash_in_progress; |
| 48 | void __iomem *ppss_base; |
| 49 | |
| 50 | void *ramdump_dev; |
Stephen Boyd | f169b4b | 2012-05-10 17:55:55 -0700 | [diff] [blame] | 51 | |
| 52 | void *smem_ramdump_dev; |
| 53 | struct ramdump_segment smem_ramdump_segments[1]; |
| 54 | }; |
| 55 | |
| 56 | #define desc_to_drv(d) container_of(d, struct dsps_data, subsys_desc) |
Stephen Boyd | e24edf5 | 2012-07-12 17:46:19 -0700 | [diff] [blame] | 57 | #define pil_to_drv(d) container_of(d, struct dsps_data, desc) |
Stephen Boyd | f169b4b | 2012-05-10 17:55:55 -0700 | [diff] [blame] | 58 | |
Stephen Boyd | 25c4a0b | 2011-09-20 00:12:36 -0700 | [diff] [blame] | 59 | static int init_image_dsps(struct pil_desc *pil, const u8 *metadata, |
| 60 | size_t size) |
| 61 | { |
Stephen Boyd | e24edf5 | 2012-07-12 17:46:19 -0700 | [diff] [blame] | 62 | struct dsps_data *drv = pil_to_drv(pil); |
| 63 | |
Stephen Boyd | 25c4a0b | 2011-09-20 00:12:36 -0700 | [diff] [blame] | 64 | /* Bring memory and bus interface out of reset */ |
Stephen Boyd | e24edf5 | 2012-07-12 17:46:19 -0700 | [diff] [blame] | 65 | writel_relaxed(PPSS_RESET_PROC_RESET, drv->base + PPSS_RESET); |
| 66 | writel_relaxed(CLK_BRANCH_ENA, drv->base + PPSS_HCLK_CTL); |
Stephen Boyd | 25c4a0b | 2011-09-20 00:12:36 -0700 | [diff] [blame] | 67 | mb(); |
| 68 | return 0; |
| 69 | } |
| 70 | |
| 71 | static int reset_dsps(struct pil_desc *pil) |
| 72 | { |
Stephen Boyd | e24edf5 | 2012-07-12 17:46:19 -0700 | [diff] [blame] | 73 | struct dsps_data *drv = pil_to_drv(pil); |
| 74 | |
| 75 | writel_relaxed(CLK_BRANCH_ENA, drv->base + PPSS_PROC_CLK_CTL); |
| 76 | while (readl_relaxed(drv->base + CLK_HALT_DFAB_STATE) & BIT(18)) |
Stephen Boyd | 25c4a0b | 2011-09-20 00:12:36 -0700 | [diff] [blame] | 77 | cpu_relax(); |
| 78 | /* Bring DSPS out of reset */ |
Stephen Boyd | e24edf5 | 2012-07-12 17:46:19 -0700 | [diff] [blame] | 79 | writel_relaxed(0x0, drv->base + PPSS_RESET); |
Stephen Boyd | 25c4a0b | 2011-09-20 00:12:36 -0700 | [diff] [blame] | 80 | return 0; |
| 81 | } |
| 82 | |
| 83 | static int shutdown_dsps(struct pil_desc *pil) |
| 84 | { |
Stephen Boyd | e24edf5 | 2012-07-12 17:46:19 -0700 | [diff] [blame] | 85 | struct dsps_data *drv = pil_to_drv(pil); |
| 86 | |
| 87 | writel_relaxed(PPSS_RESET_PROC_RESET | PPSS_RESET_RESET, |
| 88 | drv->base + PPSS_RESET); |
Stephen Boyd | 25c4a0b | 2011-09-20 00:12:36 -0700 | [diff] [blame] | 89 | usleep_range(1000, 2000); |
Stephen Boyd | e24edf5 | 2012-07-12 17:46:19 -0700 | [diff] [blame] | 90 | writel_relaxed(PPSS_RESET_PROC_RESET, drv->base + PPSS_RESET); |
| 91 | writel_relaxed(0x0, drv->base + PPSS_PROC_CLK_CTL); |
Stephen Boyd | 25c4a0b | 2011-09-20 00:12:36 -0700 | [diff] [blame] | 92 | return 0; |
| 93 | } |
| 94 | |
| 95 | struct pil_reset_ops pil_dsps_ops = { |
| 96 | .init_image = init_image_dsps, |
| 97 | .auth_and_reset = reset_dsps, |
| 98 | .shutdown = shutdown_dsps, |
| 99 | }; |
| 100 | |
| 101 | static int init_image_dsps_trusted(struct pil_desc *pil, const u8 *metadata, |
| 102 | size_t size) |
| 103 | { |
| 104 | return pas_init_image(PAS_DSPS, metadata, size); |
| 105 | } |
| 106 | |
| 107 | static int reset_dsps_trusted(struct pil_desc *pil) |
| 108 | { |
| 109 | return pas_auth_and_reset(PAS_DSPS); |
| 110 | } |
| 111 | |
| 112 | static int shutdown_dsps_trusted(struct pil_desc *pil) |
| 113 | { |
| 114 | return pas_shutdown(PAS_DSPS); |
| 115 | } |
| 116 | |
| 117 | struct pil_reset_ops pil_dsps_ops_trusted = { |
| 118 | .init_image = init_image_dsps_trusted, |
| 119 | .auth_and_reset = reset_dsps_trusted, |
| 120 | .shutdown = shutdown_dsps_trusted, |
| 121 | }; |
| 122 | |
Stephen Boyd | f169b4b | 2012-05-10 17:55:55 -0700 | [diff] [blame] | 123 | static void dsps_log_sfr(void) |
| 124 | { |
| 125 | const char dflt_reason[] = "Died too early due to unknown reason"; |
| 126 | char *smem_reset_reason; |
| 127 | unsigned smem_reset_size; |
| 128 | |
| 129 | smem_reset_reason = smem_get_entry(SMEM_SSR_REASON_DSPS0, |
| 130 | &smem_reset_size); |
| 131 | if (smem_reset_reason != NULL && smem_reset_reason[0] != 0) { |
| 132 | smem_reset_reason[smem_reset_size-1] = 0; |
| 133 | pr_err("%s: DSPS failure: %s\nResetting DSPS\n", |
| 134 | __func__, smem_reset_reason); |
| 135 | memset(smem_reset_reason, 0, smem_reset_size); |
| 136 | wmb(); |
| 137 | } else |
| 138 | pr_err("%s: DSPS failure: %s\nResetting DSPS\n", |
| 139 | __func__, dflt_reason); |
| 140 | } |
| 141 | |
| 142 | |
| 143 | static void dsps_restart_handler(struct dsps_data *drv) |
| 144 | { |
Stephen Boyd | f169b4b | 2012-05-10 17:55:55 -0700 | [diff] [blame] | 145 | if (atomic_add_return(1, &drv->crash_in_progress) > 1) { |
| 146 | pr_err("%s: DSPS already resetting. Count %d\n", __func__, |
| 147 | atomic_read(&drv->crash_in_progress)); |
| 148 | } else { |
| 149 | subsystem_restart_dev(drv->subsys); |
| 150 | } |
| 151 | } |
| 152 | |
| 153 | static void dsps_smsm_state_cb(void *data, uint32_t old_state, |
| 154 | uint32_t new_state) |
| 155 | { |
| 156 | struct dsps_data *drv = data; |
| 157 | |
| 158 | if (drv->crash == 1) { |
| 159 | pr_debug("SMSM_RESET state change ignored\n"); |
| 160 | drv->crash = 0; |
| 161 | } else if (new_state & SMSM_RESET) { |
| 162 | dsps_log_sfr(); |
| 163 | dsps_restart_handler(drv); |
| 164 | } |
| 165 | } |
| 166 | |
Stephen Boyd | 037c353 | 2012-06-27 11:07:03 -0700 | [diff] [blame] | 167 | static int dsps_start(const struct subsys_desc *desc) |
| 168 | { |
Stephen Boyd | 037c353 | 2012-06-27 11:07:03 -0700 | [diff] [blame] | 169 | struct dsps_data *drv = desc_to_drv(desc); |
| 170 | |
Stephen Boyd | e83a0a2 | 2012-06-29 13:51:27 -0700 | [diff] [blame] | 171 | return pil_boot(&drv->desc); |
Stephen Boyd | 037c353 | 2012-06-27 11:07:03 -0700 | [diff] [blame] | 172 | } |
| 173 | |
| 174 | static void dsps_stop(const struct subsys_desc *desc) |
| 175 | { |
| 176 | struct dsps_data *drv = desc_to_drv(desc); |
Stephen Boyd | e83a0a2 | 2012-06-29 13:51:27 -0700 | [diff] [blame] | 177 | pil_shutdown(&drv->desc); |
Stephen Boyd | 037c353 | 2012-06-27 11:07:03 -0700 | [diff] [blame] | 178 | } |
| 179 | |
Stephen Boyd | f169b4b | 2012-05-10 17:55:55 -0700 | [diff] [blame] | 180 | static int dsps_shutdown(const struct subsys_desc *desc) |
| 181 | { |
| 182 | struct dsps_data *drv = desc_to_drv(desc); |
| 183 | disable_irq_nosync(drv->wdog_irq); |
| 184 | if (drv->ppss_base) { |
| 185 | writel_relaxed(0, drv->ppss_base + PPSS_WDOG_UNMASKED_INT_EN); |
| 186 | mb(); /* Make sure wdog is disabled before shutting down */ |
| 187 | } |
Stephen Boyd | e83a0a2 | 2012-06-29 13:51:27 -0700 | [diff] [blame] | 188 | pil_shutdown(&drv->desc); |
Stephen Boyd | f169b4b | 2012-05-10 17:55:55 -0700 | [diff] [blame] | 189 | return 0; |
| 190 | } |
| 191 | |
| 192 | static int dsps_powerup(const struct subsys_desc *desc) |
| 193 | { |
| 194 | struct dsps_data *drv = desc_to_drv(desc); |
| 195 | |
Stephen Boyd | e83a0a2 | 2012-06-29 13:51:27 -0700 | [diff] [blame] | 196 | pil_boot(&drv->desc); |
Stephen Boyd | f169b4b | 2012-05-10 17:55:55 -0700 | [diff] [blame] | 197 | atomic_set(&drv->crash_in_progress, 0); |
| 198 | enable_irq(drv->wdog_irq); |
| 199 | |
| 200 | return 0; |
| 201 | } |
| 202 | |
| 203 | static int dsps_ramdump(int enable, const struct subsys_desc *desc) |
| 204 | { |
| 205 | int ret; |
| 206 | struct dsps_data *drv = desc_to_drv(desc); |
| 207 | |
| 208 | if (!enable) |
| 209 | return 0; |
| 210 | |
Stephen Boyd | 5eb17ce | 2012-11-29 15:34:21 -0800 | [diff] [blame] | 211 | ret = pil_do_ramdump(&drv->desc, drv->ramdump_dev); |
Stephen Boyd | f169b4b | 2012-05-10 17:55:55 -0700 | [diff] [blame] | 212 | if (ret < 0) { |
| 213 | pr_err("%s: Unable to dump DSPS memory (rc = %d).\n", |
| 214 | __func__, ret); |
| 215 | return ret; |
| 216 | } |
Stephen Boyd | 5eb17ce | 2012-11-29 15:34:21 -0800 | [diff] [blame] | 217 | ret = do_elf_ramdump(drv->smem_ramdump_dev, drv->smem_ramdump_segments, |
Stephen Boyd | f169b4b | 2012-05-10 17:55:55 -0700 | [diff] [blame] | 218 | ARRAY_SIZE(drv->smem_ramdump_segments)); |
| 219 | if (ret < 0) { |
| 220 | pr_err("%s: Unable to dump smem memory (rc = %d).\n", |
| 221 | __func__, ret); |
| 222 | return ret; |
| 223 | } |
| 224 | return 0; |
| 225 | } |
| 226 | |
| 227 | static void dsps_crash_shutdown(const struct subsys_desc *desc) |
| 228 | { |
| 229 | struct dsps_data *drv = desc_to_drv(desc); |
| 230 | |
| 231 | disable_irq_nosync(drv->wdog_irq); |
| 232 | drv->crash = 1; |
| 233 | smsm_change_state(SMSM_DSPS_STATE, SMSM_RESET, SMSM_RESET); |
| 234 | } |
| 235 | |
| 236 | static irqreturn_t dsps_wdog_bite_irq(int irq, void *dev_id) |
| 237 | { |
| 238 | struct dsps_data *drv = dev_id; |
| 239 | |
| 240 | atomic_set(&drv->wd_crash, 1); |
| 241 | dsps_log_sfr(); |
| 242 | dsps_restart_handler(drv); |
| 243 | return IRQ_HANDLED; |
| 244 | } |
| 245 | |
Stephen Boyd | 25c4a0b | 2011-09-20 00:12:36 -0700 | [diff] [blame] | 246 | static int __devinit pil_dsps_driver_probe(struct platform_device *pdev) |
| 247 | { |
Stephen Boyd | f169b4b | 2012-05-10 17:55:55 -0700 | [diff] [blame] | 248 | struct dsps_data *drv; |
Stephen Boyd | 25c4a0b | 2011-09-20 00:12:36 -0700 | [diff] [blame] | 249 | struct pil_desc *desc; |
Stephen Boyd | f169b4b | 2012-05-10 17:55:55 -0700 | [diff] [blame] | 250 | struct resource *res; |
Stephen Boyd | e24edf5 | 2012-07-12 17:46:19 -0700 | [diff] [blame] | 251 | int ret; |
Stephen Boyd | 25c4a0b | 2011-09-20 00:12:36 -0700 | [diff] [blame] | 252 | |
Stephen Boyd | f169b4b | 2012-05-10 17:55:55 -0700 | [diff] [blame] | 253 | drv = devm_kzalloc(&pdev->dev, sizeof(*drv), GFP_KERNEL); |
| 254 | if (!drv) |
Stephen Boyd | 25c4a0b | 2011-09-20 00:12:36 -0700 | [diff] [blame] | 255 | return -ENOMEM; |
Stephen Boyd | f169b4b | 2012-05-10 17:55:55 -0700 | [diff] [blame] | 256 | platform_set_drvdata(pdev, drv); |
Stephen Boyd | 25c4a0b | 2011-09-20 00:12:36 -0700 | [diff] [blame] | 257 | |
Stephen Boyd | f169b4b | 2012-05-10 17:55:55 -0700 | [diff] [blame] | 258 | res = platform_get_resource(pdev, IORESOURCE_MEM, 0); |
Stephen Boyd | e24edf5 | 2012-07-12 17:46:19 -0700 | [diff] [blame] | 259 | if (!res) |
| 260 | return -EINVAL; |
| 261 | drv->base = devm_ioremap(&pdev->dev, res->start, resource_size(res)); |
| 262 | if (!drv->base) |
| 263 | return -ENOMEM; |
| 264 | |
| 265 | res = platform_get_resource(pdev, IORESOURCE_MEM, 1); |
Stephen Boyd | f169b4b | 2012-05-10 17:55:55 -0700 | [diff] [blame] | 266 | if (res) { |
| 267 | drv->ppss_base = devm_ioremap(&pdev->dev, res->start, |
| 268 | resource_size(res)); |
| 269 | if (!drv->ppss_base) |
| 270 | return -ENOMEM; |
| 271 | } |
| 272 | |
| 273 | desc = &drv->desc; |
Stephen Boyd | 25c4a0b | 2011-09-20 00:12:36 -0700 | [diff] [blame] | 274 | desc->name = pdev->dev.platform_data; |
| 275 | desc->dev = &pdev->dev; |
| 276 | desc->owner = THIS_MODULE; |
Stephen Boyd | 3030c25 | 2012-08-08 17:24:05 -0700 | [diff] [blame] | 277 | desc->flags = PIL_SKIP_ENTRY_CHECK; |
Stephen Boyd | 25c4a0b | 2011-09-20 00:12:36 -0700 | [diff] [blame] | 278 | if (pas_supported(PAS_DSPS) > 0) { |
| 279 | desc->ops = &pil_dsps_ops_trusted; |
| 280 | dev_info(&pdev->dev, "using secure boot\n"); |
| 281 | } else { |
| 282 | desc->ops = &pil_dsps_ops; |
| 283 | dev_info(&pdev->dev, "using non-secure boot\n"); |
| 284 | } |
Stephen Boyd | e83a0a2 | 2012-06-29 13:51:27 -0700 | [diff] [blame] | 285 | ret = pil_desc_init(desc); |
| 286 | if (ret) |
| 287 | return ret; |
Stephen Boyd | f169b4b | 2012-05-10 17:55:55 -0700 | [diff] [blame] | 288 | |
Stephen Boyd | c1a7261 | 2012-07-05 14:07:35 -0700 | [diff] [blame] | 289 | drv->ramdump_dev = create_ramdump_device("dsps", &pdev->dev); |
Stephen Boyd | f169b4b | 2012-05-10 17:55:55 -0700 | [diff] [blame] | 290 | if (!drv->ramdump_dev) { |
| 291 | ret = -ENOMEM; |
| 292 | goto err_ramdump; |
| 293 | } |
| 294 | |
| 295 | drv->smem_ramdump_segments[0].address = PHYS_OFFSET - SZ_2M; |
| 296 | drv->smem_ramdump_segments[0].size = SZ_2M; |
Stephen Boyd | c1a7261 | 2012-07-05 14:07:35 -0700 | [diff] [blame] | 297 | drv->smem_ramdump_dev = create_ramdump_device("smem-dsps", &pdev->dev); |
Stephen Boyd | f169b4b | 2012-05-10 17:55:55 -0700 | [diff] [blame] | 298 | if (!drv->smem_ramdump_dev) { |
| 299 | ret = -ENOMEM; |
| 300 | goto err_smem_ramdump; |
| 301 | } |
| 302 | |
| 303 | drv->subsys_desc.name = "dsps"; |
Stephen Boyd | 037c353 | 2012-06-27 11:07:03 -0700 | [diff] [blame] | 304 | drv->subsys_desc.dev = &pdev->dev; |
| 305 | drv->subsys_desc.owner = THIS_MODULE; |
| 306 | drv->subsys_desc.start = dsps_start; |
| 307 | drv->subsys_desc.stop = dsps_stop; |
Stephen Boyd | f169b4b | 2012-05-10 17:55:55 -0700 | [diff] [blame] | 308 | drv->subsys_desc.shutdown = dsps_shutdown; |
| 309 | drv->subsys_desc.powerup = dsps_powerup; |
| 310 | drv->subsys_desc.ramdump = dsps_ramdump, |
| 311 | drv->subsys_desc.crash_shutdown = dsps_crash_shutdown; |
| 312 | |
| 313 | drv->subsys = subsys_register(&drv->subsys_desc); |
| 314 | if (IS_ERR(drv->subsys)) { |
| 315 | ret = PTR_ERR(drv->subsys); |
| 316 | goto err_subsys; |
| 317 | } |
| 318 | |
| 319 | ret = smsm_state_cb_register(SMSM_DSPS_STATE, SMSM_RESET, |
| 320 | dsps_smsm_state_cb, drv); |
| 321 | if (ret) |
| 322 | goto err_smsm; |
| 323 | |
| 324 | drv->wdog_irq = platform_get_irq(pdev, 0); |
| 325 | if (drv->wdog_irq >= 0) { |
| 326 | ret = devm_request_irq(&pdev->dev, drv->wdog_irq, |
| 327 | dsps_wdog_bite_irq, IRQF_TRIGGER_RISING, |
| 328 | "dsps_wdog", drv); |
| 329 | if (ret) { |
| 330 | dev_err(&pdev->dev, "request_irq failed\n"); |
| 331 | goto err_smsm; |
| 332 | } |
| 333 | } else { |
| 334 | drv->wdog_irq = -1; |
| 335 | dev_dbg(&pdev->dev, "ppss_wdog not supported\n"); |
| 336 | } |
| 337 | |
Stephen Boyd | 25c4a0b | 2011-09-20 00:12:36 -0700 | [diff] [blame] | 338 | return 0; |
Stephen Boyd | f169b4b | 2012-05-10 17:55:55 -0700 | [diff] [blame] | 339 | |
| 340 | err_smsm: |
| 341 | subsys_unregister(drv->subsys); |
| 342 | err_subsys: |
| 343 | destroy_ramdump_device(drv->smem_ramdump_dev); |
| 344 | err_smem_ramdump: |
| 345 | destroy_ramdump_device(drv->ramdump_dev); |
| 346 | err_ramdump: |
Stephen Boyd | e83a0a2 | 2012-06-29 13:51:27 -0700 | [diff] [blame] | 347 | pil_desc_release(desc); |
Stephen Boyd | f169b4b | 2012-05-10 17:55:55 -0700 | [diff] [blame] | 348 | return ret; |
Stephen Boyd | 25c4a0b | 2011-09-20 00:12:36 -0700 | [diff] [blame] | 349 | } |
| 350 | |
| 351 | static int __devexit pil_dsps_driver_exit(struct platform_device *pdev) |
| 352 | { |
Stephen Boyd | f169b4b | 2012-05-10 17:55:55 -0700 | [diff] [blame] | 353 | struct dsps_data *drv = platform_get_drvdata(pdev); |
| 354 | smsm_state_cb_deregister(SMSM_DSPS_STATE, SMSM_RESET, |
| 355 | dsps_smsm_state_cb, drv); |
| 356 | subsys_unregister(drv->subsys); |
| 357 | destroy_ramdump_device(drv->smem_ramdump_dev); |
| 358 | destroy_ramdump_device(drv->ramdump_dev); |
Stephen Boyd | e83a0a2 | 2012-06-29 13:51:27 -0700 | [diff] [blame] | 359 | pil_desc_release(&drv->desc); |
Stephen Boyd | 25c4a0b | 2011-09-20 00:12:36 -0700 | [diff] [blame] | 360 | return 0; |
| 361 | } |
| 362 | |
| 363 | static struct platform_driver pil_dsps_driver = { |
| 364 | .probe = pil_dsps_driver_probe, |
| 365 | .remove = __devexit_p(pil_dsps_driver_exit), |
| 366 | .driver = { |
| 367 | .name = "pil_dsps", |
| 368 | .owner = THIS_MODULE, |
| 369 | }, |
| 370 | }; |
| 371 | |
| 372 | static int __init pil_dsps_init(void) |
| 373 | { |
| 374 | return platform_driver_register(&pil_dsps_driver); |
| 375 | } |
| 376 | module_init(pil_dsps_init); |
| 377 | |
| 378 | static void __exit pil_dsps_exit(void) |
| 379 | { |
| 380 | platform_driver_unregister(&pil_dsps_driver); |
| 381 | } |
| 382 | module_exit(pil_dsps_exit); |
| 383 | |
| 384 | MODULE_DESCRIPTION("Support for booting sensors (DSPS) images"); |
| 385 | MODULE_LICENSE("GPL v2"); |