aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAbhimanyu Kapur <abhimany@codeaurora.org>2015-09-12 13:44:39 -0400
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2015-10-04 12:49:27 -0400
commit4cad4c57e0b3e90555a81e79ac7e82b253979697 (patch)
tree8613453d6b99db631b57e2adcf33739e8feb69c3
parent3d27070108216b5c689dd3d0bf3ac10ef88570f7 (diff)
ARM64: TTY: hvc_dcc: Add support for ARM64 dcc
Add support for debug communications channel based hvc console for arm64 cpus. Signed-off-by: Abhimanyu Kapur <abhimany@codeaurora.org> Signed-off-by: Timur Tabi <timur@codeaurora.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r--arch/arm64/include/asm/dcc.h55
-rw-r--r--drivers/tty/hvc/Kconfig2
2 files changed, 56 insertions, 1 deletions
diff --git a/arch/arm64/include/asm/dcc.h b/arch/arm64/include/asm/dcc.h
new file mode 100644
index 000000000000..65e0190e97c8
--- /dev/null
+++ b/arch/arm64/include/asm/dcc.h
@@ -0,0 +1,55 @@
1/* Copyright (c) 2014-2015 The Linux Foundation. All rights reserved.
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 * A call to __dcc_getchar() or __dcc_putchar() is typically followed by
13 * a call to __dcc_getstatus(). We want to make sure that the CPU does
14 * not speculative read the DCC status before executing the read or write
15 * instruction. That's what the ISBs are for.
16 *
17 * The 'volatile' ensures that the compiler does not cache the status bits,
18 * and instead reads the DCC register every time.
19 */
20#ifndef __ASM_DCC_H
21#define __ASM_DCC_H
22
23#include <asm/barrier.h>
24
25static inline u32 __dcc_getstatus(void)
26{
27 u32 ret;
28
29 asm volatile("mrs %0, mdccsr_el0" : "=r" (ret));
30
31 return ret;
32}
33
34static inline char __dcc_getchar(void)
35{
36 char c;
37
38 asm volatile("mrs %0, dbgdtrrx_el0" : "=r" (c));
39 isb();
40
41 return c;
42}
43
44static inline void __dcc_putchar(char c)
45{
46 /*
47 * The typecast is to make absolutely certain that 'c' is
48 * zero-extended.
49 */
50 asm volatile("msr dbgdtrtx_el0, %0"
51 : : "r" ((unsigned long)(unsigned char)c));
52 isb();
53}
54
55#endif
diff --git a/drivers/tty/hvc/Kconfig b/drivers/tty/hvc/Kconfig
index 2509d057b99c..574da15fe618 100644
--- a/drivers/tty/hvc/Kconfig
+++ b/drivers/tty/hvc/Kconfig
@@ -81,7 +81,7 @@ config HVC_UDBG
81 81
82config HVC_DCC 82config HVC_DCC
83 bool "ARM JTAG DCC console" 83 bool "ARM JTAG DCC console"
84 depends on ARM 84 depends on ARM || ARM64
85 select HVC_DRIVER 85 select HVC_DRIVER
86 help 86 help
87 This console uses the JTAG DCC on ARM to create a console under the HVC 87 This console uses the JTAG DCC on ARM to create a console under the HVC