diff options
author | James Hogan <james.hogan@imgtec.com> | 2012-09-21 17:38:15 +0100 |
---|---|---|
committer | James Hogan <james.hogan@imgtec.com> | 2013-03-02 20:09:56 +0000 |
commit | ae85ac71b7433fa974759109c4380c620258f07f (patch) | |
tree | 066915c6c1f0f830c35ff12f4a84e233b6fd15da /arch/metag/kernel | |
parent | 690998b629a554d8004d3129a42176afafce9fae (diff) | |
download | linux-ae85ac71b7433fa974759109c4380c620258f07f.tar.bz2 |
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>
Diffstat (limited to 'arch/metag/kernel')
-rw-r--r-- | arch/metag/kernel/Makefile | 1 | ||||
-rw-r--r-- | arch/metag/kernel/da.c | 23 | ||||
-rw-r--r-- | arch/metag/kernel/setup.c | 15 |
3 files changed, 39 insertions, 0 deletions
diff --git a/arch/metag/kernel/Makefile b/arch/metag/kernel/Makefile index a5e4ba6fd20a..d7675f4a5df8 100644 --- a/arch/metag/kernel/Makefile +++ b/arch/metag/kernel/Makefile @@ -28,6 +28,7 @@ obj-y += user_gateway.o obj-$(CONFIG_PERF_EVENTS) += perf/ obj-$(CONFIG_METAG_COREMEM) += coremem.o +obj-$(CONFIG_METAG_DA) += da.o obj-$(CONFIG_DYNAMIC_FTRACE) += ftrace.o obj-$(CONFIG_FUNCTION_TRACER) += ftrace_stub.o obj-$(CONFIG_MODULES) += metag_ksyms.o diff --git a/arch/metag/kernel/da.c b/arch/metag/kernel/da.c new file mode 100644 index 000000000000..52aabb658fde --- /dev/null +++ b/arch/metag/kernel/da.c @@ -0,0 +1,23 @@ +/* + * Meta DA JTAG debugger control. + * + * Copyright 2012 Imagination Technologies Ltd. + */ + + +#include <linux/io.h> +#include <linux/kernel.h> +#include <asm/da.h> +#include <asm/metag_mem.h> + +bool _metag_da_present; + +int __init metag_da_probe(void) +{ + _metag_da_present = (metag_in32(T0VECINT_BHALT) == 1); + if (_metag_da_present) + pr_info("DA present\n"); + else + pr_info("DA not present\n"); + return 0; +} diff --git a/arch/metag/kernel/setup.c b/arch/metag/kernel/setup.c index 74e2c1f812a5..89f9cdc389e8 100644 --- a/arch/metag/kernel/setup.c +++ b/arch/metag/kernel/setup.c @@ -37,6 +37,7 @@ #include <asm/hwthread.h> #include <asm/mmzone.h> #include <asm/l2cache.h> +#include <asm/da.h> #include <asm/prom.h> #include <asm/mach/arch.h> #include <asm/core_reg.h> @@ -60,6 +61,11 @@ extern char _heap_start[]; extern u32 __dtb_start[]; #endif +#ifdef CONFIG_DA_CONSOLE +/* Our early channel based console driver */ +extern struct console dash_console; +#endif + struct machine_desc *machine_desc __initdata; /* @@ -180,6 +186,15 @@ void __init setup_arch(char **cmdline_p) metag_cache_probe(); + metag_da_probe(); +#ifdef CONFIG_DA_CONSOLE + if (metag_da_enabled()) { + /* An early channel based console driver */ + register_console(&dash_console); + add_preferred_console("ttyDA", 1, NULL); + } +#endif + /* try interpreting the argument as a device tree */ machine_desc = setup_machine_fdt(original_cmd_line); /* if it doesn't look like a device tree it must be a command line */ |