All of lore.kernel.org
 help / color / mirror / Atom feed
From: James Hogan <james.hogan@imgtec.com>
To: Ralf Baechle <ralf@linux-mips.org>, <linux-mips@linux-mips.org>
Cc: <linux-kernel@vger.kernel.org>,
	James Hogan <james.hogan@imgtec.com>,
	Andrew Bresticker <abrestic@chromium.org>,
	Thomas Gleixner <tglx@linutronix.de>,
	Jason Cooper <jason@lakedaemon.net>
Subject: [PATCH 4/9] irqchip: mips-gic: Add function for retrieving FDC IRQ
Date: Thu, 29 Jan 2015 11:14:09 +0000	[thread overview]
Message-ID: <1422530054-7976-5-git-send-email-james.hogan@imgtec.com> (raw)
In-Reply-To: <1422530054-7976-1-git-send-email-james.hogan@imgtec.com>

Add a function to the MIPS GIC driver for retrieving the Fast Debug
Channel (FDC) interrupt number, similar to the existing ones for the
timer and perf counter interrupts. This will be used by platform
implementations of get_c0_fdc_int() if a GIC is present.

A workaround exists for interAptiv and proAptiv which claim to be able
to route the FDC interrupt but don't seem to be able to in practice (at
least on Malta).

Signed-off-by: James Hogan <james.hogan@imgtec.com>
Cc: Ralf Baechle <ralf@linux-mips.org>
Cc: Andrew Bresticker <abrestic@chromium.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Jason Cooper <jason@lakedaemon.net>
Cc: linux-mips@linux-mips.org
---
 drivers/irqchip/irq-mips-gic.c   | 23 +++++++++++++++++++++++
 include/linux/irqchip/mips-gic.h |  1 +
 2 files changed, 24 insertions(+)

diff --git a/drivers/irqchip/irq-mips-gic.c b/drivers/irqchip/irq-mips-gic.c
index bcfead6e8ae6..00379550cd71 100644
--- a/drivers/irqchip/irq-mips-gic.c
+++ b/drivers/irqchip/irq-mips-gic.c
@@ -234,6 +234,29 @@ int gic_get_c0_perfcount_int(void)
 				  GIC_LOCAL_TO_HWIRQ(GIC_LOCAL_INT_PERFCTR));
 }
 
+int gic_get_c0_fdc_int(void)
+{
+	if (!gic_local_irq_is_routable(GIC_LOCAL_INT_FDC)) {
+		/* Is the FDC IRQ even present? */
+		if (cp0_fdc_irq < 0)
+			return -1;
+		return MIPS_CPU_IRQ_BASE + cp0_fdc_irq;
+	}
+
+	/*
+	 * Some cores claim the FDC is routable but it doesn't actually seem to
+	 * be connected.
+	 */
+	switch (current_cpu_type()) {
+	case CPU_INTERAPTIV:
+	case CPU_PROAPTIV:
+		return -1;
+	}
+
+	return irq_create_mapping(gic_irq_domain,
+				  GIC_LOCAL_TO_HWIRQ(GIC_LOCAL_INT_FDC));
+}
+
 static unsigned int gic_get_int(void)
 {
 	unsigned int i;
diff --git a/include/linux/irqchip/mips-gic.h b/include/linux/irqchip/mips-gic.h
index ff0e75f40ef5..8e9940040e6d 100644
--- a/include/linux/irqchip/mips-gic.h
+++ b/include/linux/irqchip/mips-gic.h
@@ -252,4 +252,5 @@ extern unsigned int plat_ipi_resched_int_xlate(unsigned int);
 extern unsigned int gic_get_timer_pending(void);
 extern int gic_get_c0_compare_int(void);
 extern int gic_get_c0_perfcount_int(void);
+extern int gic_get_c0_fdc_int(void);
 #endif /* __LINUX_IRQCHIP_MIPS_GIC_H */
-- 
2.0.5


WARNING: multiple messages have this Message-ID (diff)
From: James Hogan <james.hogan@imgtec.com>
To: Ralf Baechle <ralf@linux-mips.org>, linux-mips@linux-mips.org
Cc: linux-kernel@vger.kernel.org,
	James Hogan <james.hogan@imgtec.com>,
	Andrew Bresticker <abrestic@chromium.org>,
	Thomas Gleixner <tglx@linutronix.de>,
	Jason Cooper <jason@lakedaemon.net>
Subject: [PATCH 4/9] irqchip: mips-gic: Add function for retrieving FDC IRQ
Date: Thu, 29 Jan 2015 11:14:09 +0000	[thread overview]
Message-ID: <1422530054-7976-5-git-send-email-james.hogan@imgtec.com> (raw)
Message-ID: <20150129111409.pg8-jgK_zcMj8gD_mOK_9C4L8FNMBvxaKgTEbKbKAj0@z> (raw)
In-Reply-To: <1422530054-7976-1-git-send-email-james.hogan@imgtec.com>

Add a function to the MIPS GIC driver for retrieving the Fast Debug
Channel (FDC) interrupt number, similar to the existing ones for the
timer and perf counter interrupts. This will be used by platform
implementations of get_c0_fdc_int() if a GIC is present.

A workaround exists for interAptiv and proAptiv which claim to be able
to route the FDC interrupt but don't seem to be able to in practice (at
least on Malta).

Signed-off-by: James Hogan <james.hogan@imgtec.com>
Cc: Ralf Baechle <ralf@linux-mips.org>
Cc: Andrew Bresticker <abrestic@chromium.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Jason Cooper <jason@lakedaemon.net>
Cc: linux-mips@linux-mips.org
---
 drivers/irqchip/irq-mips-gic.c   | 23 +++++++++++++++++++++++
 include/linux/irqchip/mips-gic.h |  1 +
 2 files changed, 24 insertions(+)

diff --git a/drivers/irqchip/irq-mips-gic.c b/drivers/irqchip/irq-mips-gic.c
index bcfead6e8ae6..00379550cd71 100644
--- a/drivers/irqchip/irq-mips-gic.c
+++ b/drivers/irqchip/irq-mips-gic.c
@@ -234,6 +234,29 @@ int gic_get_c0_perfcount_int(void)
 				  GIC_LOCAL_TO_HWIRQ(GIC_LOCAL_INT_PERFCTR));
 }
 
+int gic_get_c0_fdc_int(void)
+{
+	if (!gic_local_irq_is_routable(GIC_LOCAL_INT_FDC)) {
+		/* Is the FDC IRQ even present? */
+		if (cp0_fdc_irq < 0)
+			return -1;
+		return MIPS_CPU_IRQ_BASE + cp0_fdc_irq;
+	}
+
+	/*
+	 * Some cores claim the FDC is routable but it doesn't actually seem to
+	 * be connected.
+	 */
+	switch (current_cpu_type()) {
+	case CPU_INTERAPTIV:
+	case CPU_PROAPTIV:
+		return -1;
+	}
+
+	return irq_create_mapping(gic_irq_domain,
+				  GIC_LOCAL_TO_HWIRQ(GIC_LOCAL_INT_FDC));
+}
+
 static unsigned int gic_get_int(void)
 {
 	unsigned int i;
diff --git a/include/linux/irqchip/mips-gic.h b/include/linux/irqchip/mips-gic.h
index ff0e75f40ef5..8e9940040e6d 100644
--- a/include/linux/irqchip/mips-gic.h
+++ b/include/linux/irqchip/mips-gic.h
@@ -252,4 +252,5 @@ extern unsigned int plat_ipi_resched_int_xlate(unsigned int);
 extern unsigned int gic_get_timer_pending(void);
 extern int gic_get_c0_compare_int(void);
 extern int gic_get_c0_perfcount_int(void);
+extern int gic_get_c0_fdc_int(void);
 #endif /* __LINUX_IRQCHIP_MIPS_GIC_H */
-- 
2.0.5

  parent reply	other threads:[~2015-01-29 11:17 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-01-29 11:14 [PATCH 0/9] Add MIPS EJTAG Fast Debug Channel TTY driver James Hogan
2015-01-29 11:14 ` James Hogan
2015-01-29 11:14 ` [PATCH 1/9] MIPS: Add architectural FDC IRQ fields James Hogan
2015-01-29 11:14   ` James Hogan
2015-01-29 11:14 ` [PATCH 2/9] MIPS: Read CPU IRQ line that FDC to routed to James Hogan
2015-01-29 11:14   ` James Hogan
2015-01-29 11:14 ` [PATCH 3/9] irqchip: mips-gic: Don't treat FDC IRQ as percpu devid James Hogan
2015-01-29 11:14   ` James Hogan
2015-01-29 11:14 ` James Hogan [this message]
2015-01-29 11:14   ` [PATCH 4/9] irqchip: mips-gic: Add function for retrieving FDC IRQ James Hogan
2015-01-29 11:14 ` [PATCH 5/9] MIPS: Malta: Implement get_c0_fdc_int() James Hogan
2015-01-29 11:14   ` James Hogan
2015-01-29 11:14 ` [PATCH 6/9] MIPS: idle: Workaround wait + FDC problems James Hogan
2015-01-29 11:14   ` James Hogan
2015-01-29 11:14 ` [PATCH 7/9] tty: Add MIPS EJTAG Fast Debug Channel TTY driver James Hogan
2015-01-29 11:14   ` James Hogan
2015-03-26 15:09   ` Greg Kroah-Hartman
2015-01-29 11:14 ` [PATCH 8/9] MIPS, ttyFDC: Add early FDC console support James Hogan
2015-01-29 11:14   ` James Hogan
2015-03-26 15:09   ` Greg Kroah-Hartman
2015-01-29 11:14 ` [PATCH 9/9] ttyFDC: Implement KGDB IO operations James Hogan
2015-01-29 11:14   ` James Hogan
2015-03-26 15:09   ` Greg Kroah-Hartman
2015-02-25 11:06 ` [PATCH 0/9] Add MIPS EJTAG Fast Debug Channel TTY driver James Hogan
2015-02-25 11:06   ` James Hogan

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1422530054-7976-5-git-send-email-james.hogan@imgtec.com \
    --to=james.hogan@imgtec.com \
    --cc=abrestic@chromium.org \
    --cc=jason@lakedaemon.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mips@linux-mips.org \
    --cc=ralf@linux-mips.org \
    --cc=tglx@linutronix.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.