xref: /OK3568_Linux_fs/kernel/drivers/soc/rockchip/fiq_debugger/fiq_debugger.h (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1*4882a593Smuzhiyun /*
2*4882a593Smuzhiyun  * drivers/staging/android/fiq_debugger/fiq_debugger.h
3*4882a593Smuzhiyun  *
4*4882a593Smuzhiyun  * Copyright (C) 2010 Google, Inc.
5*4882a593Smuzhiyun  * Author: Colin Cross <ccross@android.com>
6*4882a593Smuzhiyun  *
7*4882a593Smuzhiyun  * This software is licensed under the terms of the GNU General Public
8*4882a593Smuzhiyun  * License version 2, as published by the Free Software Foundation, and
9*4882a593Smuzhiyun  * may be copied, distributed, and modified under those terms.
10*4882a593Smuzhiyun  *
11*4882a593Smuzhiyun  * This program is distributed in the hope that it will be useful,
12*4882a593Smuzhiyun  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13*4882a593Smuzhiyun  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14*4882a593Smuzhiyun  * GNU General Public License for more details.
15*4882a593Smuzhiyun  *
16*4882a593Smuzhiyun  */
17*4882a593Smuzhiyun 
18*4882a593Smuzhiyun #ifndef _ARCH_ARM_MACH_TEGRA_FIQ_DEBUGGER_H_
19*4882a593Smuzhiyun #define _ARCH_ARM_MACH_TEGRA_FIQ_DEBUGGER_H_
20*4882a593Smuzhiyun 
21*4882a593Smuzhiyun #include <linux/serial_core.h>
22*4882a593Smuzhiyun 
23*4882a593Smuzhiyun #define FIQ_DEBUGGER_NO_CHAR NO_POLL_CHAR
24*4882a593Smuzhiyun #define FIQ_DEBUGGER_BREAK 0x00ff0100
25*4882a593Smuzhiyun 
26*4882a593Smuzhiyun #define FIQ_DEBUGGER_FIQ_IRQ_NAME	"fiq"
27*4882a593Smuzhiyun #define FIQ_DEBUGGER_SIGNAL_IRQ_NAME	"signal"
28*4882a593Smuzhiyun #define FIQ_DEBUGGER_WAKEUP_IRQ_NAME	"wakeup"
29*4882a593Smuzhiyun 
30*4882a593Smuzhiyun /**
31*4882a593Smuzhiyun  * struct fiq_debugger_pdata - fiq debugger platform data
32*4882a593Smuzhiyun  * @uart_resume:	used to restore uart state right before enabling
33*4882a593Smuzhiyun  *			the fiq.
34*4882a593Smuzhiyun  * @uart_enable:	Do the work necessary to communicate with the uart
35*4882a593Smuzhiyun  *			hw (enable clocks, etc.). This must be ref-counted.
36*4882a593Smuzhiyun  * @uart_disable:	Do the work necessary to disable the uart hw
37*4882a593Smuzhiyun  *			(disable clocks, etc.). This must be ref-counted.
38*4882a593Smuzhiyun  * @uart_dev_suspend:	called during PM suspend, generally not needed
39*4882a593Smuzhiyun  *			for real fiq mode debugger.
40*4882a593Smuzhiyun  * @uart_dev_resume:	called during PM resume, generally not needed
41*4882a593Smuzhiyun  *			for real fiq mode debugger.
42*4882a593Smuzhiyun  */
43*4882a593Smuzhiyun struct fiq_debugger_pdata {
44*4882a593Smuzhiyun 	int (*uart_init)(struct platform_device *pdev);
45*4882a593Smuzhiyun 	void (*uart_free)(struct platform_device *pdev);
46*4882a593Smuzhiyun 	int (*uart_resume)(struct platform_device *pdev);
47*4882a593Smuzhiyun 	int (*uart_getc)(struct platform_device *pdev);
48*4882a593Smuzhiyun 	void (*uart_putc)(struct platform_device *pdev, unsigned int c);
49*4882a593Smuzhiyun 	void (*uart_flush)(struct platform_device *pdev);
50*4882a593Smuzhiyun 	void (*uart_enable)(struct platform_device *pdev);
51*4882a593Smuzhiyun 	void (*uart_disable)(struct platform_device *pdev);
52*4882a593Smuzhiyun 
53*4882a593Smuzhiyun 	int (*uart_dev_suspend)(struct platform_device *pdev);
54*4882a593Smuzhiyun 	int (*uart_dev_resume)(struct platform_device *pdev);
55*4882a593Smuzhiyun 
56*4882a593Smuzhiyun 	void (*fiq_enable)(struct platform_device *pdev, unsigned int fiq,
57*4882a593Smuzhiyun 								bool enable);
58*4882a593Smuzhiyun 	void (*fiq_ack)(struct platform_device *pdev, unsigned int fiq);
59*4882a593Smuzhiyun 
60*4882a593Smuzhiyun 	void (*force_irq)(struct platform_device *pdev, unsigned int irq);
61*4882a593Smuzhiyun 	void (*force_irq_ack)(struct platform_device *pdev, unsigned int irq);
62*4882a593Smuzhiyun 
63*4882a593Smuzhiyun #ifdef CONFIG_RK_CONSOLE_THREAD
64*4882a593Smuzhiyun 	void (*console_write)(struct platform_device *pdev, const char *s,
65*4882a593Smuzhiyun 			      unsigned int count);
66*4882a593Smuzhiyun 	int (*tty_write)(struct platform_device *pdev, const char *s, int count);
67*4882a593Smuzhiyun 	int (*write_room)(struct platform_device *pdev);
68*4882a593Smuzhiyun #endif
69*4882a593Smuzhiyun #ifdef CONFIG_FIQ_DEBUGGER_TRUST_ZONE
70*4882a593Smuzhiyun 	void (*switch_cpu)(struct platform_device *pdev, u32 cpu);
71*4882a593Smuzhiyun 	void (*enable_debug)(struct platform_device *pdev, bool val);
72*4882a593Smuzhiyun #endif
73*4882a593Smuzhiyun };
74*4882a593Smuzhiyun 
75*4882a593Smuzhiyun #ifdef CONFIG_FIQ_GLUE
76*4882a593Smuzhiyun void gic_set_irq_secure(struct irq_data *d);
77*4882a593Smuzhiyun void gic_set_irq_priority(struct irq_data *d, u8 pri);
78*4882a593Smuzhiyun #endif
79*4882a593Smuzhiyun 
80*4882a593Smuzhiyun void fiq_tty_wake_up(struct platform_device *pdev);
81*4882a593Smuzhiyun #endif
82