From patchwork Thu Jul 5 23:12:40 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anton Vorontsov X-Patchwork-Id: 9877 Return-Path: X-Original-To: patchwork@peony.canonical.com Delivered-To: patchwork@peony.canonical.com Received: from fiordland.canonical.com (fiordland.canonical.com [91.189.94.145]) by peony.canonical.com (Postfix) with ESMTP id 8D31423E2F for ; Thu, 5 Jul 2012 23:15:17 +0000 (UTC) Received: from mail-yx0-f180.google.com (mail-yx0-f180.google.com [209.85.213.180]) by fiordland.canonical.com (Postfix) with ESMTP id 47069A187FF for ; Thu, 5 Jul 2012 23:15:17 +0000 (UTC) Received: by yenq6 with SMTP id q6so8648290yen.11 for ; Thu, 05 Jul 2012 16:15:16 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-forwarded-to:x-forwarded-for:delivered-to:received-spf:from:to:cc :subject:date:message-id:x-mailer:in-reply-to:references :x-gm-message-state; bh=E1mdTXii30twc4sAOO3Dyd2WQ7Y9NADO7+9FOVp+JLk=; b=ZN1QsSXvHFY7UgCKdMKJhyjjShvKu1CIMIwO/AiNQrUDmgDZgctXb1ysGmnvjVTZ/A /Rf/NvnHWMBFgVjR1aW2KJX+xucet5XH++OBpdfLrdY6keedP9RJIPdYBcT6qSxJ/oMF bfjXbCDXl2MIstGtYOc/29THtjMCeRZGxTfNPFjjdY7Wza5B6jHW/9ICLUHBGhWlzeIv JSIZIQBW01j7+Vno0p6lU5cocKpdro/72sk4FaETG1I/eVWWVL1fiZGKxWUcd1vOe9EM Sh1LVE1pOHmEAQI/wX6Zi5uXk0HL5Pb0Z3+5qiIW5UcUGsmFkyYV/M0EQQzL7p+T5s0J F9Mg== Received: by 10.42.89.72 with SMTP id f8mr14672006icm.33.1341530116646; Thu, 05 Jul 2012 16:15:16 -0700 (PDT) X-Forwarded-To: linaro-patchwork@canonical.com X-Forwarded-For: patch@linaro.org linaro-patchwork@canonical.com Delivered-To: patches@linaro.org Received: by 10.231.24.148 with SMTP id v20csp1913ibb; Thu, 5 Jul 2012 16:15:16 -0700 (PDT) Received: by 10.66.84.71 with SMTP id w7mr40991632pay.9.1341530115925; Thu, 05 Jul 2012 16:15:15 -0700 (PDT) Received: from mail-pb0-f50.google.com (mail-pb0-f50.google.com [209.85.160.50]) by mx.google.com with ESMTPS id wt7si40242066pbc.172.2012.07.05.16.15.15 (version=TLSv1/SSLv3 cipher=OTHER); Thu, 05 Jul 2012 16:15:15 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.160.50 is neither permitted nor denied by best guess record for domain of anton.vorontsov@linaro.org) client-ip=209.85.160.50; Authentication-Results: mx.google.com; spf=neutral (google.com: 209.85.160.50 is neither permitted nor denied by best guess record for domain of anton.vorontsov@linaro.org) smtp.mail=anton.vorontsov@linaro.org Received: by mail-pb0-f50.google.com with SMTP id rr4so15920100pbb.37 for ; Thu, 05 Jul 2012 16:15:15 -0700 (PDT) Received: by 10.68.220.104 with SMTP id pv8mr31603830pbc.119.1341530115702; Thu, 05 Jul 2012 16:15:15 -0700 (PDT) Received: from localhost (c-71-204-165-222.hsd1.ca.comcast.net. [71.204.165.222]) by mx.google.com with ESMTPS id gh9sm8049931pbc.20.2012.07.05.16.15.14 (version=TLSv1/SSLv3 cipher=OTHER); Thu, 05 Jul 2012 16:15:15 -0700 (PDT) From: Anton Vorontsov To: Russell King , Jason Wessel Cc: =?UTF-8?q?Arve=20Hj=C3=B8nnev=C3=A5g?= , Colin Cross , John Stultz , linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linaro-kernel@lists.linaro.org, patches@linaro.org, kernel-team@android.com, kgdb-bugreport@lists.sourceforge.net Subject: [PATCH 6/6] ARM: versatile: Make able to use UART ports for KGDB FIQ debugger Date: Thu, 5 Jul 2012 16:12:40 -0700 Message-Id: <1341529960-18370-6-git-send-email-anton.vorontsov@linaro.org> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <20120705231034.GA16931@lizard> References: <20120705231034.GA16931@lizard> X-Gm-Message-State: ALoCoQlPCY7HiKPOHy6ZNdQtR1qKssWRmKYK8+u+Lh5u5Lup6JZKuzB1y9aexFnQMnrjn3ejyMTV If enabled, kernel will able to enter KGDB upon serial line activity on UART ports. Note that even with this patch and CONFIG_KGDB_FIQ is enabled, you still need to pass kgdb_fiq.enable=1 kernel command line option, otherwise UART will behave in a normal way. By default UART0 is used, but this can be changed via kgdb_fiq.uart_num kernel command line option. Signed-off-by: Anton Vorontsov --- arch/arm/mach-versatile/Makefile | 1 + arch/arm/mach-versatile/include/mach/irqs.h | 1 + arch/arm/mach-versatile/kgdb_fiq.c | 40 +++++++++++++++++++++++++++ 3 files changed, 42 insertions(+) create mode 100644 arch/arm/mach-versatile/kgdb_fiq.c diff --git a/arch/arm/mach-versatile/Makefile b/arch/arm/mach-versatile/Makefile index 81fa3fe..bfd761f 100644 --- a/arch/arm/mach-versatile/Makefile +++ b/arch/arm/mach-versatile/Makefile @@ -7,3 +7,4 @@ obj-$(CONFIG_ARCH_VERSATILE_PB) += versatile_pb.o obj-$(CONFIG_MACH_VERSATILE_AB) += versatile_ab.o obj-$(CONFIG_MACH_VERSATILE_DT) += versatile_dt.o obj-$(CONFIG_PCI) += pci.o +obj-$(CONFIG_KGDB_FIQ) += kgdb_fiq.o diff --git a/arch/arm/mach-versatile/include/mach/irqs.h b/arch/arm/mach-versatile/include/mach/irqs.h index bf44c61..fcd2a95 100644 --- a/arch/arm/mach-versatile/include/mach/irqs.h +++ b/arch/arm/mach-versatile/include/mach/irqs.h @@ -26,6 +26,7 @@ * held within platform.h */ #define IRQ_VIC_START 0 +#define FIQ_START IRQ_VIC_START #define IRQ_WDOGINT (IRQ_VIC_START + INT_WDOGINT) #define IRQ_SOFTINT (IRQ_VIC_START + INT_SOFTINT) #define IRQ_COMMRx (IRQ_VIC_START + INT_COMMRx) diff --git a/arch/arm/mach-versatile/kgdb_fiq.c b/arch/arm/mach-versatile/kgdb_fiq.c new file mode 100644 index 0000000..c82e8ce --- /dev/null +++ b/arch/arm/mach-versatile/kgdb_fiq.c @@ -0,0 +1,40 @@ +/* + * KGDB FIQ entry board/IC support + * + * Copyright 2012 Linaro Ltd. + * Anton Vorontsov + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 as published + * by the Free Software Foundation. + */ + +#include +#include +#include +#include +#include +#include +#include + +static int kgdb_fiq; +module_param_named(uart_num, kgdb_fiq, int, 0600); +MODULE_PARM_DESC(uart_num, "UART port to use for KGDB FIQ"); + +static bool is_kgdb_nmi(void) +{ + return vic_is_fiq_rised(kgdb_fiq); +} + +void kgdb_arch_enable_nmi(bool on) +{ + vic_fiq_select(kgdb_fiq, on); +} + +static int kgdb_fiq_init(void) +{ + kgdb_fiq += INT_UARTINT0; + kgdb_register_nmi(is_kgdb_nmi); + return 0; +} +console_initcall(kgdb_fiq_init);