Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

metag: Add JTAG Debug Adapter (DA) support

Add basic JTAG Debug Adapter (DA) support so that drivers which
communicate with the DA can detect whether one is actually present
(otherwise the target will halt indefinitely).

This allows the metag_da TTY driver and imgdafs filesystem driver to be
built, updates defconfigs, and sets up the metag_da console early if
it's configured in.

Signed-off-by: James Hogan <james.hogan@imgtec.com>

+105
+2
MAINTAINERS
··· 5042 5042 F: drivers/clocksource/metag_generic.c 5043 5043 F: drivers/irqchip/irq-metag.c 5044 5044 F: drivers/irqchip/irq-metag-ext.c 5045 + F: drivers/tty/metag_da.c 5046 + F: fs/imgdafs/ 5045 5047 5046 5048 MICROBLAZE ARCHITECTURE 5047 5049 M: Michal Simek <monstr@monstr.eu>
+12
arch/metag/Kconfig
··· 214 214 When disabled, Performance Counters information will be collected 215 215 based on Timer Interrupt. 216 216 217 + config METAG_DA 218 + bool "DA support" 219 + help 220 + Say Y if you plan to use a DA debug adapter with Linux. The presence 221 + of the DA will be detected automatically at boot, so it is safe to say 222 + Y to this option even when booting without a DA. 223 + 224 + This enables support for services provided by DA JTAG debug adapters, 225 + such as: 226 + - communication over DA channels (such as the console driver). 227 + - use of the DA filesystem. 228 + 217 229 menu "Boot options" 218 230 219 231 config METAG_BUILTIN_DTB
+3
arch/metag/configs/meta1_defconfig
··· 14 14 # CONFIG_IOSCHED_CFQ is not set 15 15 CONFIG_FLATMEM_MANUAL=y 16 16 CONFIG_META12_FPGA=y 17 + CONFIG_METAG_DA=y 17 18 CONFIG_HZ_100=y 18 19 CONFIG_DEVTMPFS=y 19 20 CONFIG_DEVTMPFS_MOUNT=y ··· 28 27 # CONFIG_SERIO is not set 29 28 # CONFIG_VT is not set 30 29 # CONFIG_LEGACY_PTYS is not set 30 + CONFIG_DA_TTY=y 31 + CONFIG_DA_CONSOLE=y 31 32 # CONFIG_DEVKMEM is not set 32 33 # CONFIG_HW_RANDOM is not set 33 34 # CONFIG_HWMON is not set
+3
arch/metag/configs/meta2_defconfig
··· 16 16 CONFIG_METAG_L2C=y 17 17 CONFIG_FLATMEM_MANUAL=y 18 18 CONFIG_METAG_HALT_ON_PANIC=y 19 + CONFIG_METAG_DA=y 19 20 CONFIG_HZ_100=y 20 21 CONFIG_DEVTMPFS=y 21 22 # CONFIG_STANDALONE is not set ··· 29 28 # CONFIG_SERIO is not set 30 29 # CONFIG_VT is not set 31 30 # CONFIG_LEGACY_PTYS is not set 31 + CONFIG_DA_TTY=y 32 + CONFIG_DA_CONSOLE=y 32 33 # CONFIG_DEVKMEM is not set 33 34 # CONFIG_HW_RANDOM is not set 34 35 # CONFIG_HWMON is not set
+3
arch/metag/configs/meta2_smp_defconfig
··· 17 17 CONFIG_FLATMEM_MANUAL=y 18 18 CONFIG_METAG_HALT_ON_PANIC=y 19 19 CONFIG_SMP=y 20 + CONFIG_METAG_DA=y 20 21 CONFIG_HZ_100=y 21 22 CONFIG_DEVTMPFS=y 22 23 # CONFIG_STANDALONE is not set ··· 30 29 # CONFIG_SERIO is not set 31 30 # CONFIG_VT is not set 32 31 # CONFIG_LEGACY_PTYS is not set 32 + CONFIG_DA_TTY=y 33 + CONFIG_DA_CONSOLE=y 33 34 # CONFIG_DEVKMEM is not set 34 35 # CONFIG_HW_RANDOM is not set 35 36 # CONFIG_HWMON is not set
+43
arch/metag/include/asm/da.h
··· 1 + /* 2 + * Meta DA JTAG debugger control. 3 + * 4 + * Copyright 2012 Imagination Technologies Ltd. 5 + */ 6 + 7 + #ifndef _METAG_DA_H_ 8 + #define _METAG_DA_H_ 9 + 10 + #ifdef CONFIG_METAG_DA 11 + 12 + #include <linux/init.h> 13 + #include <linux/types.h> 14 + 15 + extern bool _metag_da_present; 16 + 17 + /** 18 + * metag_da_enabled() - Find whether a DA is currently enabled. 19 + * 20 + * Returns: true if a DA was detected, false if not. 21 + */ 22 + static inline bool metag_da_enabled(void) 23 + { 24 + return _metag_da_present; 25 + } 26 + 27 + /** 28 + * metag_da_probe() - Try and detect a connected DA. 29 + * 30 + * This is used at start up to detect whether a DA is active. 31 + * 32 + * Returns: 0 on detection, -err otherwise. 33 + */ 34 + int __init metag_da_probe(void); 35 + 36 + #else /* !CONFIG_METAG_DA */ 37 + 38 + #define metag_da_enabled() false 39 + #define metag_da_probe() do {} while (0) 40 + 41 + #endif 42 + 43 + #endif /* _METAG_DA_H_ */
+1
arch/metag/kernel/Makefile
··· 28 28 obj-$(CONFIG_PERF_EVENTS) += perf/ 29 29 30 30 obj-$(CONFIG_METAG_COREMEM) += coremem.o 31 + obj-$(CONFIG_METAG_DA) += da.o 31 32 obj-$(CONFIG_DYNAMIC_FTRACE) += ftrace.o 32 33 obj-$(CONFIG_FUNCTION_TRACER) += ftrace_stub.o 33 34 obj-$(CONFIG_MODULES) += metag_ksyms.o
+23
arch/metag/kernel/da.c
··· 1 + /* 2 + * Meta DA JTAG debugger control. 3 + * 4 + * Copyright 2012 Imagination Technologies Ltd. 5 + */ 6 + 7 + 8 + #include <linux/io.h> 9 + #include <linux/kernel.h> 10 + #include <asm/da.h> 11 + #include <asm/metag_mem.h> 12 + 13 + bool _metag_da_present; 14 + 15 + int __init metag_da_probe(void) 16 + { 17 + _metag_da_present = (metag_in32(T0VECINT_BHALT) == 1); 18 + if (_metag_da_present) 19 + pr_info("DA present\n"); 20 + else 21 + pr_info("DA not present\n"); 22 + return 0; 23 + }
+15
arch/metag/kernel/setup.c
··· 37 37 #include <asm/hwthread.h> 38 38 #include <asm/mmzone.h> 39 39 #include <asm/l2cache.h> 40 + #include <asm/da.h> 40 41 #include <asm/prom.h> 41 42 #include <asm/mach/arch.h> 42 43 #include <asm/core_reg.h> ··· 59 58 60 59 #ifdef CONFIG_METAG_BUILTIN_DTB 61 60 extern u32 __dtb_start[]; 61 + #endif 62 + 63 + #ifdef CONFIG_DA_CONSOLE 64 + /* Our early channel based console driver */ 65 + extern struct console dash_console; 62 66 #endif 63 67 64 68 struct machine_desc *machine_desc __initdata; ··· 185 179 int heap_id, i; 186 180 187 181 metag_cache_probe(); 182 + 183 + metag_da_probe(); 184 + #ifdef CONFIG_DA_CONSOLE 185 + if (metag_da_enabled()) { 186 + /* An early channel based console driver */ 187 + register_console(&dash_console); 188 + add_preferred_console("ttyDA", 1, NULL); 189 + } 190 + #endif 188 191 189 192 /* try interpreting the argument as a device tree */ 190 193 machine_desc = setup_machine_fdt(original_cmd_line);