summaryrefslogtreecommitdiff
path: root/drivers/crypto/caam/secvio.h
blob: 97eb2723f19ce16a8760b65e3afa401cd7277c99 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67

/*
 * CAAM Security Violation Handler
 * Copyright (C) 2012-2015 Freescale Semiconductor, Inc., All Rights Reserved
 */

#ifndef SECVIO_H
#define SECVIO_H

#include "snvsregs.h"


/*
 * Defines the published interfaces to install/remove application-specified
 * handlers for catching violations
 */

#define MAX_SECVIO_SOURCES 6

/* these are the untranslated causes */
enum secvio_cause {
	SECVIO_CAUSE_SOURCE_0,
	SECVIO_CAUSE_SOURCE_1,
	SECVIO_CAUSE_SOURCE_2,
	SECVIO_CAUSE_SOURCE_3,
	SECVIO_CAUSE_SOURCE_4,
	SECVIO_CAUSE_SOURCE_5
};

/* These are common "recommended" cause definitions for most devices */
#define SECVIO_CAUSE_CAAM_VIOLATION	SECVIO_CAUSE_SOURCE_0
#define SECVIO_CAUSE_JTAG_ALARM		SECVIO_CAUSE_SOURCE_1
#define SECVIO_CAUSE_WATCHDOG		SECVIO_CAUSE_SOURCE_2
#define SECVIO_CAUSE_EXTERNAL_BOOT	SECVIO_CAUSE_SOURCE_4
#define SECVIO_CAUSE_TAMPER_DETECT	SECVIO_CAUSE_SOURCE_5

int snvs_secvio_install_handler(struct device *dev, enum secvio_cause cause,
				void (*handler)(struct device *dev, u32 cause,
						void *ext),
				u8 *cause_description, void *ext);
int snvs_secvio_remove_handler(struct device *dev, enum  secvio_cause cause);

/*
 * Private data definitions for the secvio "driver"
 */

struct secvio_int_src {
	const u8 *intname;	/* Points to a descriptive name for source */
	void *ext;		/* Extended data to pass to the handler */
	void (*handler)(struct device *dev, u32 cause, void *ext);
};

struct snvs_secvio_drv_private {
	struct platform_device *pdev;
	spinlock_t svlock ____cacheline_aligned;
	struct tasklet_struct irqtask[NR_CPUS];
	struct snvs_full __iomem *svregs;	/* both HP and LP domains */
	struct clk *clk;
	int irq;
	u32 irqcause; /* stashed cause of violation interrupt */

	/* Registered handlers for each violation */
	struct secvio_int_src intsrc[MAX_SECVIO_SOURCES];

};

#endif /* SECVIO_H */