linux-sh.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] sh: extend INTC with optional ioremap() support
@ 2010-02-10 11:17 Magnus Damm
  2010-02-10 12:55 ` Paul Mundt
  2010-02-10 13:14 ` Magnus Damm
  0 siblings, 2 replies; 3+ messages in thread
From: Magnus Damm @ 2010-02-10 11:17 UTC (permalink / raw)
  To: linux-sh

From: Magnus Damm <damm@opensource.se>

Add the member "io_window" to intc_desc to allow
passing a physical memory window to the INTC code.
The INTC code will ioremap the window if present.

Required to support INTCS on SH-Mobile G-series.

Signed-off-by: Magnus Damm <damm@opensource.se>
---

 drivers/sh/intc.c       |   14 ++++++++++++++
 include/linux/sh_intc.h |    3 +++
 2 files changed, 17 insertions(+)

--- 0006/drivers/sh/intc.c
+++ work/drivers/sh/intc.c	2010-02-10 19:31:14.000000000 +0900
@@ -45,6 +45,8 @@ struct intc_handle_int {
 
 struct intc_desc_int {
 	struct list_head list;
+	unsigned long virt_base;
+	unsigned long phys_base;
 	struct sys_device sysdev;
 	pm_message_t state;
 	unsigned long *reg;
@@ -425,6 +427,9 @@ static unsigned int __init intc_get_reg(
 {
 	unsigned int k;
 
+	address -= d->phys_base;
+	address += d->virt_base;
+
 	for (k = 0; k < d->nr_reg; k++) {
 		if (d->reg[k] = address)
 			return k;
@@ -774,6 +779,9 @@ static unsigned int __init save_reg(stru
 				    unsigned int smp)
 {
 	if (value) {
+		value -= d->phys_base;
+		value += d->virt_base;
+
 		d->reg[cnt] = value;
 #ifdef CONFIG_SMP
 		d->smp[cnt] = smp;
@@ -800,6 +808,12 @@ void __init register_intc_controller(str
 	INIT_LIST_HEAD(&d->list);
 	list_add(&d->list, &intc_list);
 
+	if (desc->io_window) {
+		d->phys_base = desc->io_window->start;
+		d->virt_base = (unsigned long)ioremap_nocache(d->phys_base,
+					       resource_size(desc->io_window));
+	}
+
 	d->nr_reg = hw->mask_regs ? hw->nr_mask_regs * 2 : 0;
 	d->nr_reg += hw->prio_regs ? hw->nr_prio_regs * 2 : 0;
 	d->nr_reg += hw->sense_regs ? hw->nr_sense_regs : 0;
--- 0006/include/linux/sh_intc.h
+++ work/include/linux/sh_intc.h	2010-02-10 19:31:14.000000000 +0900
@@ -1,6 +1,8 @@
 #ifndef __SH_INTC_H
 #define __SH_INTC_H
 
+#include <linux/ioport.h>
+
 typedef unsigned char intc_enum;
 
 struct intc_vect {
@@ -71,6 +73,7 @@ struct intc_hw_desc {
 
 struct intc_desc {
 	char *name;
+	struct resource *io_window;
 	intc_enum force_enable;
 	struct intc_hw_desc hw;
 };

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2010-02-10 13:14 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-02-10 11:17 [PATCH] sh: extend INTC with optional ioremap() support Magnus Damm
2010-02-10 12:55 ` Paul Mundt
2010-02-10 13:14 ` Magnus Damm

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).