aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid S. Miller <davem@davemloft.net>2006-06-29 17:35:33 -0400
committerDavid S. Miller <davem@sunset.davemloft.net>2006-06-29 19:37:16 -0400
commit3ca9fab410fbef6fc3a13284f5c26faccade21d1 (patch)
tree91b4c38077db397bec0ff85f1c89c9f869b3970f
parent95714e12dfb4794ee120f058fdf763e61baaad82 (diff)
[SPARC]: Add of_io{remap,unmap}().
Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r--arch/sparc/kernel/ioport.c17
-rw-r--r--arch/sparc64/kernel/of_device.c17
-rw-r--r--include/asm-sparc/of_device.h3
-rw-r--r--include/asm-sparc64/of_device.h3
4 files changed, 40 insertions, 0 deletions
diff --git a/arch/sparc/kernel/ioport.c b/arch/sparc/kernel/ioport.c
index 79d177149fdb..8654b446ac9e 100644
--- a/arch/sparc/kernel/ioport.c
+++ b/arch/sparc/kernel/ioport.c
@@ -26,6 +26,7 @@
26 */ 26 */
27 27
28#include <linux/config.h> 28#include <linux/config.h>
29#include <linux/module.h>
29#include <linux/sched.h> 30#include <linux/sched.h>
30#include <linux/kernel.h> 31#include <linux/kernel.h>
31#include <linux/errno.h> 32#include <linux/errno.h>
@@ -40,6 +41,7 @@
40#include <asm/vaddrs.h> 41#include <asm/vaddrs.h>
41#include <asm/oplib.h> 42#include <asm/oplib.h>
42#include <asm/prom.h> 43#include <asm/prom.h>
44#include <asm/of_device.h>
43#include <asm/sbus.h> 45#include <asm/sbus.h>
44#include <asm/page.h> 46#include <asm/page.h>
45#include <asm/pgalloc.h> 47#include <asm/pgalloc.h>
@@ -143,6 +145,21 @@ void __iomem *sbus_ioremap(struct resource *phyres, unsigned long offset,
143 phyres->start + offset, size, name); 145 phyres->start + offset, size, name);
144} 146}
145 147
148void __iomem *of_ioremap(struct resource *res, unsigned long offset,
149 unsigned long size, char *name)
150{
151 return _sparc_alloc_io(res->flags & 0xF,
152 res->start + offset,
153 size, name);
154}
155EXPORT_SYMBOL(of_ioremap);
156
157void of_iounmap(void __iomem *base, unsigned long size)
158{
159 iounmap(base);
160}
161EXPORT_SYMBOL(of_iounmap);
162
146/* 163/*
147 */ 164 */
148void sbus_iounmap(volatile void __iomem *addr, unsigned long size) 165void sbus_iounmap(volatile void __iomem *addr, unsigned long size)
diff --git a/arch/sparc64/kernel/of_device.c b/arch/sparc64/kernel/of_device.c
index 00502dc280ef..9812cfa6dd36 100644
--- a/arch/sparc64/kernel/of_device.c
+++ b/arch/sparc64/kernel/of_device.c
@@ -129,6 +129,23 @@ static int of_device_resume(struct device * dev)
129 return error; 129 return error;
130} 130}
131 131
132void __iomem *of_ioremap(struct resource *res, unsigned long offset, unsigned long size, char *name)
133{
134 unsigned long ret = res->start + offset;
135
136 if (!request_region(ret, size, name))
137 ret = 0;
138
139 return (void __iomem *) ret;
140}
141EXPORT_SYMBOL(of_ioremap);
142
143void of_iounmap(void __iomem *base, unsigned long size)
144{
145 release_region((unsigned long) base, size);
146}
147EXPORT_SYMBOL(of_iounmap);
148
132#ifdef CONFIG_PCI 149#ifdef CONFIG_PCI
133struct bus_type isa_bus_type = { 150struct bus_type isa_bus_type = {
134 .name = "isa", 151 .name = "isa",
diff --git a/include/asm-sparc/of_device.h b/include/asm-sparc/of_device.h
index 1b43ee5eb5e7..b5ca3145d48b 100644
--- a/include/asm-sparc/of_device.h
+++ b/include/asm-sparc/of_device.h
@@ -31,6 +31,9 @@ struct of_device
31}; 31};
32#define to_of_device(d) container_of(d, struct of_device, dev) 32#define to_of_device(d) container_of(d, struct of_device, dev)
33 33
34extern void __iomem *of_ioremap(struct resource *res, unsigned long offset, unsigned long size, char *name);
35extern void of_iounmap(void __iomem *base, unsigned long size);
36
34extern const struct of_device_id *of_match_device( 37extern const struct of_device_id *of_match_device(
35 const struct of_device_id *matches, const struct of_device *dev); 38 const struct of_device_id *matches, const struct of_device *dev);
36 39
diff --git a/include/asm-sparc64/of_device.h b/include/asm-sparc64/of_device.h
index 27bc08671d68..37c5856fae12 100644
--- a/include/asm-sparc64/of_device.h
+++ b/include/asm-sparc64/of_device.h
@@ -32,6 +32,9 @@ struct of_device
32}; 32};
33#define to_of_device(d) container_of(d, struct of_device, dev) 33#define to_of_device(d) container_of(d, struct of_device, dev)
34 34
35extern void __iomem *of_ioremap(struct resource *res, unsigned long offset, unsigned long size, char *name);
36extern void of_iounmap(void __iomem *base, unsigned long size);
37
35extern const struct of_device_id *of_match_device( 38extern const struct of_device_id *of_match_device(
36 const struct of_device_id *matches, const struct of_device *dev); 39 const struct of_device_id *matches, const struct of_device *dev);
37 40