diff --git a/MAINTAINERS b/MAINTAINERS index 9b2b7699da4df128b5a40277fc4e53dcfafd8fe3..a6a0c352e5599c4858d950fd8a98ec752ed08304 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -5042,6 +5042,8 @@ F: Documentation/devicetree/bindings/metag/ F: drivers/clocksource/metag_generic.c F: drivers/irqchip/irq-metag.c F: drivers/irqchip/irq-metag-ext.c +F: drivers/tty/metag_da.c +F: fs/imgdafs/ MICROBLAZE ARCHITECTURE M: Michal Simek diff --git a/arch/metag/Kconfig b/arch/metag/Kconfig index f6846ad5d3a8dd80a92b6e47c1fb09e7c201445c..30adc7875daa133b0d8599a46fbced46d93a623d 100644 --- a/arch/metag/Kconfig +++ b/arch/metag/Kconfig @@ -214,6 +214,18 @@ config METAG_PERFCOUNTER_IRQS When disabled, Performance Counters information will be collected based on Timer Interrupt. +config METAG_DA + bool "DA support" + help + Say Y if you plan to use a DA debug adapter with Linux. The presence + of the DA will be detected automatically at boot, so it is safe to say + Y to this option even when booting without a DA. + + This enables support for services provided by DA JTAG debug adapters, + such as: + - communication over DA channels (such as the console driver). + - use of the DA filesystem. + menu "Boot options" config METAG_BUILTIN_DTB diff --git a/arch/metag/configs/meta1_defconfig b/arch/metag/configs/meta1_defconfig index 837c235ab67a41908c9e32d7fde65daa8b60ece6..ad663ca5320823e4bbcddc4f8fc8eb26cf85b724 100644 --- a/arch/metag/configs/meta1_defconfig +++ b/arch/metag/configs/meta1_defconfig @@ -14,6 +14,7 @@ CONFIG_PARTITION_ADVANCED=y # CONFIG_IOSCHED_CFQ is not set CONFIG_FLATMEM_MANUAL=y CONFIG_META12_FPGA=y +CONFIG_METAG_DA=y CONFIG_HZ_100=y CONFIG_DEVTMPFS=y CONFIG_DEVTMPFS_MOUNT=y @@ -27,6 +28,8 @@ CONFIG_BLK_DEV_RAM_SIZE=16384 # CONFIG_SERIO is not set # CONFIG_VT is not set # CONFIG_LEGACY_PTYS is not set +CONFIG_DA_TTY=y +CONFIG_DA_CONSOLE=y # CONFIG_DEVKMEM is not set # CONFIG_HW_RANDOM is not set # CONFIG_HWMON is not set diff --git a/arch/metag/configs/meta2_defconfig b/arch/metag/configs/meta2_defconfig index e5bada83dd769b576d36f361f1e9499e39aec55e..47922e9306af29739e4ad148ec595dd2ceb0bd52 100644 --- a/arch/metag/configs/meta2_defconfig +++ b/arch/metag/configs/meta2_defconfig @@ -16,6 +16,7 @@ CONFIG_PARTITION_ADVANCED=y CONFIG_METAG_L2C=y CONFIG_FLATMEM_MANUAL=y CONFIG_METAG_HALT_ON_PANIC=y +CONFIG_METAG_DA=y CONFIG_HZ_100=y CONFIG_DEVTMPFS=y # CONFIG_STANDALONE is not set @@ -28,6 +29,8 @@ CONFIG_BLK_DEV_RAM_SIZE=16384 # CONFIG_SERIO is not set # CONFIG_VT is not set # CONFIG_LEGACY_PTYS is not set +CONFIG_DA_TTY=y +CONFIG_DA_CONSOLE=y # CONFIG_DEVKMEM is not set # CONFIG_HW_RANDOM is not set # CONFIG_HWMON is not set diff --git a/arch/metag/configs/meta2_smp_defconfig b/arch/metag/configs/meta2_smp_defconfig index 41983a20db727f6922e577d2ed4f9a17f5738357..f5082505872d7a2e533235d2d58f25d466a48c81 100644 --- a/arch/metag/configs/meta2_smp_defconfig +++ b/arch/metag/configs/meta2_smp_defconfig @@ -17,6 +17,7 @@ CONFIG_METAG_L2C=y CONFIG_FLATMEM_MANUAL=y CONFIG_METAG_HALT_ON_PANIC=y CONFIG_SMP=y +CONFIG_METAG_DA=y CONFIG_HZ_100=y CONFIG_DEVTMPFS=y # CONFIG_STANDALONE is not set @@ -29,6 +30,8 @@ CONFIG_BLK_DEV_RAM_SIZE=16384 # CONFIG_SERIO is not set # CONFIG_VT is not set # CONFIG_LEGACY_PTYS is not set +CONFIG_DA_TTY=y +CONFIG_DA_CONSOLE=y # CONFIG_DEVKMEM is not set # CONFIG_HW_RANDOM is not set # CONFIG_HWMON is not set diff --git a/arch/metag/include/asm/da.h b/arch/metag/include/asm/da.h new file mode 100644 index 0000000000000000000000000000000000000000..81bd5212fb03eb6498904a67e376e7458a811dd3 --- /dev/null +++ b/arch/metag/include/asm/da.h @@ -0,0 +1,43 @@ +/* + * Meta DA JTAG debugger control. + * + * Copyright 2012 Imagination Technologies Ltd. + */ + +#ifndef _METAG_DA_H_ +#define _METAG_DA_H_ + +#ifdef CONFIG_METAG_DA + +#include +#include + +extern bool _metag_da_present; + +/** + * metag_da_enabled() - Find whether a DA is currently enabled. + * + * Returns: true if a DA was detected, false if not. + */ +static inline bool metag_da_enabled(void) +{ + return _metag_da_present; +} + +/** + * metag_da_probe() - Try and detect a connected DA. + * + * This is used at start up to detect whether a DA is active. + * + * Returns: 0 on detection, -err otherwise. + */ +int __init metag_da_probe(void); + +#else /* !CONFIG_METAG_DA */ + +#define metag_da_enabled() false +#define metag_da_probe() do {} while (0) + +#endif + +#endif /* _METAG_DA_H_ */ diff --git a/arch/metag/kernel/Makefile b/arch/metag/kernel/Makefile index a5e4ba6fd20a48fcc761d745d1caf67b77a786d2..d7675f4a5df83a1471ea2994eafd3001058cf554 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 0000000000000000000000000000000000000000..52aabb658fde805210ddd18ac1f0d424eb68d12a --- /dev/null +++ b/arch/metag/kernel/da.c @@ -0,0 +1,23 @@ +/* + * Meta DA JTAG debugger control. + * + * Copyright 2012 Imagination Technologies Ltd. + */ + + +#include +#include +#include +#include + +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 74e2c1f812a5a356cfd67d225daf7a191588e492..89f9cdc389e8094a771a13600a7ec8abe5317664 100644 --- a/arch/metag/kernel/setup.c +++ b/arch/metag/kernel/setup.c @@ -37,6 +37,7 @@ #include #include #include +#include #include #include #include @@ -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 */