Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 63ef9700 authored by Pradeep P V K's avatar Pradeep P V K Committed by Gerrit - the friendly Code Review server
Browse files

mtd: msm_qpic_nand: register msm_nand to panic_notifier



Register msm_nand to panic notifiers list to dump apss
qpic bam registers information during any subsytem failures.

Change-Id: If717d063b41dc8e75b707574e4f703ea4b41da65
Signed-off-by: default avatarPradeep P V K <pragalla@codeaurora.org>
parent 54ae581c
Loading
Loading
Loading
Loading
+36 −1
Original line number Diff line number Diff line
// SPDX-License-Identifier: GPL-2.0-only
/*
 * Copyright (C) 2007 Google, Inc.
 * Copyright (c) 2012-2020 The Linux Foundation. All rights reserved.
 * Copyright (c) 2012-2021 The Linux Foundation. All rights reserved.
 */

#include "msm_qpic_nand.h"
@@ -19,6 +19,38 @@
#define SMEM_APPS 0
#define ONE_CODEWORD_SIZE 516

static struct device *dev_node;
static int msm_nand_bam_panic_notifier(struct notifier_block *this,
					unsigned long event, void *ptr)
{
	struct msm_nand_info *info = dev_get_drvdata(dev_node);

	pr_info("Dumping APSS bam pipes register dumps\n");
	sps_get_bam_debug_info(info->sps.bam_handle, 93,
			(SPS_BAM_PIPE(0) |
			 SPS_BAM_PIPE(1) |
			 SPS_BAM_PIPE(2) |
			 SPS_BAM_PIPE(3)),
			 0, 2);
	return NOTIFY_DONE;
}

static struct notifier_block msm_nand_bam_panic_blk = {
	.notifier_call = msm_nand_bam_panic_notifier,
};

void msm_nand_bam_register_panic_handler(void)
{
	atomic_notifier_chain_register(&panic_notifier_list,
			&msm_nand_bam_panic_blk);
}

void msm_nand_bam_unregister_panic_handler(void)
{
	atomic_notifier_chain_unregister(&panic_notifier_list,
					&msm_nand_bam_panic_blk);
}

/*
 * Get the DMA memory for requested amount of size. It returns the pointer
 * to free memory available from the allocated pool. Returns NULL if there
@@ -4555,6 +4587,8 @@ static int msm_nand_probe(struct platform_device *pdev)
	pr_info("Allocated DMA buffer at virt_addr 0x%pK, phys_addr 0x%x\n",
		info->nand_chip.dma_virt_addr, info->nand_chip.dma_phys_addr);
	pr_info("Host capabilities:0x%08x\n", info->nand_chip.caps);
	dev_node = dev;
	msm_nand_bam_register_panic_handler();
	goto out;
free_bam:
	msm_nand_bam_free(info);
@@ -4576,6 +4610,7 @@ static int msm_nand_remove(struct platform_device *pdev)
{
	struct msm_nand_info *info = dev_get_drvdata(&pdev->dev);

	msm_nand_bam_unregister_panic_handler();
	if (pm_runtime_suspended(&(pdev)->dev))
		pm_runtime_resume(&(pdev)->dev);