.. | .. |
---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-only |
---|
1 | 2 | /* |
---|
2 | 3 | * Qualcomm Wireless Connectivity Subsystem Peripheral Image Loader |
---|
3 | 4 | * |
---|
4 | 5 | * Copyright (C) 2016 Linaro Ltd |
---|
5 | 6 | * Copyright (C) 2014 Sony Mobile Communications AB |
---|
6 | 7 | * Copyright (c) 2012-2013, The Linux Foundation. All rights reserved. |
---|
7 | | - * |
---|
8 | | - * This program is free software; you can redistribute it and/or |
---|
9 | | - * modify it under the terms of the GNU General Public License |
---|
10 | | - * version 2 as published by the Free Software Foundation. |
---|
11 | | - * |
---|
12 | | - * This program is distributed in the hope that it will be useful, |
---|
13 | | - * but WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
14 | | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
---|
15 | | - * GNU General Public License for more details. |
---|
16 | 8 | */ |
---|
17 | 9 | |
---|
18 | 10 | #include <linux/clk.h> |
---|
.. | .. |
---|
35 | 27 | |
---|
36 | 28 | #include "qcom_common.h" |
---|
37 | 29 | #include "remoteproc_internal.h" |
---|
| 30 | +#include "qcom_pil_info.h" |
---|
38 | 31 | #include "qcom_wcnss.h" |
---|
39 | 32 | |
---|
40 | 33 | #define WCNSS_CRASH_REASON_SMEM 422 |
---|
.. | .. |
---|
153 | 146 | static int wcnss_load(struct rproc *rproc, const struct firmware *fw) |
---|
154 | 147 | { |
---|
155 | 148 | struct qcom_wcnss *wcnss = (struct qcom_wcnss *)rproc->priv; |
---|
| 149 | + int ret; |
---|
156 | 150 | |
---|
157 | | - return qcom_mdt_load(wcnss->dev, fw, rproc->firmware, WCNSS_PAS_ID, |
---|
158 | | - wcnss->mem_region, wcnss->mem_phys, |
---|
159 | | - wcnss->mem_size, &wcnss->mem_reloc); |
---|
| 151 | + ret = qcom_mdt_load(wcnss->dev, fw, rproc->firmware, WCNSS_PAS_ID, |
---|
| 152 | + wcnss->mem_region, wcnss->mem_phys, |
---|
| 153 | + wcnss->mem_size, &wcnss->mem_reloc); |
---|
| 154 | + if (ret) |
---|
| 155 | + return ret; |
---|
| 156 | + |
---|
| 157 | + qcom_pil_info_store("wcnss", wcnss->mem_phys, wcnss->mem_size); |
---|
| 158 | + |
---|
| 159 | + return 0; |
---|
160 | 160 | } |
---|
161 | 161 | |
---|
162 | 162 | static void wcnss_indicate_nv_download(struct qcom_wcnss *wcnss) |
---|
.. | .. |
---|
295 | 295 | return ret; |
---|
296 | 296 | } |
---|
297 | 297 | |
---|
298 | | -static void *wcnss_da_to_va(struct rproc *rproc, u64 da, int len) |
---|
| 298 | +static void *wcnss_da_to_va(struct rproc *rproc, u64 da, size_t len, bool *is_iomem) |
---|
299 | 299 | { |
---|
300 | 300 | struct qcom_wcnss *wcnss = (struct qcom_wcnss *)rproc->priv; |
---|
301 | 301 | int offset; |
---|
.. | .. |
---|
415 | 415 | irq_handler_t thread_fn) |
---|
416 | 416 | { |
---|
417 | 417 | int ret; |
---|
| 418 | + int irq_number; |
---|
418 | 419 | |
---|
419 | 420 | ret = platform_get_irq_byname(pdev, name); |
---|
420 | 421 | if (ret < 0 && optional) { |
---|
.. | .. |
---|
425 | 426 | return ret; |
---|
426 | 427 | } |
---|
427 | 428 | |
---|
| 429 | + irq_number = ret; |
---|
| 430 | + |
---|
428 | 431 | ret = devm_request_threaded_irq(&pdev->dev, ret, |
---|
429 | 432 | NULL, thread_fn, |
---|
430 | 433 | IRQF_TRIGGER_RISING | IRQF_ONESHOT, |
---|
431 | 434 | "wcnss", wcnss); |
---|
432 | | - if (ret) |
---|
| 435 | + if (ret) { |
---|
433 | 436 | dev_err(&pdev->dev, "request %s IRQ failed\n", name); |
---|
| 437 | + return ret; |
---|
| 438 | + } |
---|
434 | 439 | |
---|
435 | | - return ret; |
---|
| 440 | + /* Return the IRQ number if the IRQ was successfully acquired */ |
---|
| 441 | + return irq_number; |
---|
436 | 442 | } |
---|
437 | 443 | |
---|
438 | 444 | static int wcnss_alloc_memory_region(struct qcom_wcnss *wcnss) |
---|
.. | .. |
---|
448 | 454 | } |
---|
449 | 455 | |
---|
450 | 456 | ret = of_address_to_resource(node, 0, &r); |
---|
| 457 | + of_node_put(node); |
---|
451 | 458 | if (ret) |
---|
452 | 459 | return ret; |
---|
453 | 460 | |
---|
.. | .. |
---|
488 | 495 | dev_err(&pdev->dev, "unable to allocate remoteproc\n"); |
---|
489 | 496 | return -ENOMEM; |
---|
490 | 497 | } |
---|
| 498 | + rproc_coredump_set_elf_info(rproc, ELFCLASS32, EM_NONE); |
---|
491 | 499 | |
---|
492 | 500 | wcnss = (struct qcom_wcnss *)rproc->priv; |
---|
493 | 501 | wcnss->dev = &pdev->dev; |
---|
.. | .. |
---|
553 | 561 | |
---|
554 | 562 | qcom_add_smd_subdev(rproc, &wcnss->smd_subdev); |
---|
555 | 563 | wcnss->sysmon = qcom_add_sysmon_subdev(rproc, "wcnss", WCNSS_SSCTL_ID); |
---|
| 564 | + if (IS_ERR(wcnss->sysmon)) { |
---|
| 565 | + ret = PTR_ERR(wcnss->sysmon); |
---|
| 566 | + goto free_rproc; |
---|
| 567 | + } |
---|
556 | 568 | |
---|
557 | 569 | ret = rproc_add(rproc); |
---|
558 | 570 | if (ret) |
---|
.. | .. |
---|
622 | 634 | } |
---|
623 | 635 | module_exit(wcnss_exit); |
---|
624 | 636 | |
---|
625 | | -MODULE_DESCRIPTION("Qualcomm Peripherial Image Loader for Wireless Subsystem"); |
---|
| 637 | +MODULE_DESCRIPTION("Qualcomm Peripheral Image Loader for Wireless Subsystem"); |
---|
626 | 638 | MODULE_LICENSE("GPL v2"); |
---|