aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--arch/sh/boards/board-ap325rxa.c2
-rw-r--r--arch/sh/boards/mach-migor/lcd_qvga.c2
-rw-r--r--arch/sh/boards/mach-migor/setup.c2
-rw-r--r--arch/sh/include/asm/hw_irq.h92
-rw-r--r--arch/sh/include/asm/io.h77
-rw-r--r--arch/sh/include/asm/migor.h2
-rw-r--r--arch/sh/kernel/cpu/irq/Makefile2
-rw-r--r--arch/sh/kernel/cpu/irq/ipr.c4
-rw-r--r--arch/sh/lib/io.c8
-rw-r--r--drivers/serial/sh-sci.c45
-rw-r--r--drivers/serial/sh-sci.h10
-rw-r--r--drivers/sh/Makefile2
-rw-r--r--drivers/sh/intc.c (renamed from arch/sh/kernel/cpu/irq/intc.c)25
-rw-r--r--drivers/video/sh_mobile_lcdcfb.c8
-rw-r--r--include/linux/sh_intc.h91
-rw-r--r--include/video/sh_mobile_lcdc.h (renamed from arch/sh/include/asm/sh_mobile_lcdc.h)0
16 files changed, 197 insertions, 175 deletions
diff --git a/arch/sh/boards/board-ap325rxa.c b/arch/sh/boards/board-ap325rxa.c
index 00e632fc0688..7ae8dcddfeb4 100644
--- a/arch/sh/boards/board-ap325rxa.c
+++ b/arch/sh/boards/board-ap325rxa.c
@@ -20,7 +20,7 @@
20#include <linux/smc911x.h> 20#include <linux/smc911x.h>
21#include <media/soc_camera_platform.h> 21#include <media/soc_camera_platform.h>
22#include <media/sh_mobile_ceu.h> 22#include <media/sh_mobile_ceu.h>
23#include <asm/sh_mobile_lcdc.h> 23#include <video/sh_mobile_lcdc.h>
24#include <asm/io.h> 24#include <asm/io.h>
25#include <asm/clock.h> 25#include <asm/clock.h>
26 26
diff --git a/arch/sh/boards/mach-migor/lcd_qvga.c b/arch/sh/boards/mach-migor/lcd_qvga.c
index 6e9609596448..735326c04497 100644
--- a/arch/sh/boards/mach-migor/lcd_qvga.c
+++ b/arch/sh/boards/mach-migor/lcd_qvga.c
@@ -17,7 +17,7 @@
17#include <linux/init.h> 17#include <linux/init.h>
18#include <linux/kernel.h> 18#include <linux/kernel.h>
19#include <linux/module.h> 19#include <linux/module.h>
20#include <asm/sh_mobile_lcdc.h> 20#include <video/sh_mobile_lcdc.h>
21#include <asm/migor.h> 21#include <asm/migor.h>
22 22
23/* LCD Module is a PH240320T according to board schematics. This module 23/* LCD Module is a PH240320T according to board schematics. This module
diff --git a/arch/sh/boards/mach-migor/setup.c b/arch/sh/boards/mach-migor/setup.c
index 714dce91cc9b..f27475d2fa0c 100644
--- a/arch/sh/boards/mach-migor/setup.c
+++ b/arch/sh/boards/mach-migor/setup.c
@@ -19,11 +19,11 @@
19#include <linux/clk.h> 19#include <linux/clk.h>
20#include <media/soc_camera_platform.h> 20#include <media/soc_camera_platform.h>
21#include <media/sh_mobile_ceu.h> 21#include <media/sh_mobile_ceu.h>
22#include <video/sh_mobile_lcdc.h>
22#include <asm/clock.h> 23#include <asm/clock.h>
23#include <asm/machvec.h> 24#include <asm/machvec.h>
24#include <asm/io.h> 25#include <asm/io.h>
25#include <asm/sh_keysc.h> 26#include <asm/sh_keysc.h>
26#include <asm/sh_mobile_lcdc.h>
27#include <asm/migor.h> 27#include <asm/migor.h>
28 28
29/* Address IRQ Size Bus Description 29/* Address IRQ Size Bus Description
diff --git a/arch/sh/include/asm/hw_irq.h b/arch/sh/include/asm/hw_irq.h
index d557b00111bf..603cdde813d1 100644
--- a/arch/sh/include/asm/hw_irq.h
+++ b/arch/sh/include/asm/hw_irq.h
@@ -2,6 +2,7 @@
2#define __ASM_SH_HW_IRQ_H 2#define __ASM_SH_HW_IRQ_H
3 3
4#include <linux/init.h> 4#include <linux/init.h>
5#include <linux/sh_intc.h>
5#include <asm/atomic.h> 6#include <asm/atomic.h>
6 7
7extern atomic_t irq_err_count; 8extern atomic_t irq_err_count;
@@ -23,101 +24,12 @@ struct ipr_desc {
23 24
24void register_ipr_controller(struct ipr_desc *); 25void register_ipr_controller(struct ipr_desc *);
25 26
26typedef unsigned char intc_enum;
27
28struct intc_vect {
29 intc_enum enum_id;
30 unsigned short vect;
31};
32
33#define INTC_VECT(enum_id, vect) { enum_id, vect }
34#define INTC_IRQ(enum_id, irq) INTC_VECT(enum_id, irq2evt(irq))
35
36struct intc_group {
37 intc_enum enum_id;
38 intc_enum enum_ids[32];
39};
40
41#define INTC_GROUP(enum_id, ids...) { enum_id, { ids } }
42
43struct intc_mask_reg {
44 unsigned long set_reg, clr_reg, reg_width;
45 intc_enum enum_ids[32];
46#ifdef CONFIG_SMP
47 unsigned long smp;
48#endif
49};
50
51struct intc_prio_reg {
52 unsigned long set_reg, clr_reg, reg_width, field_width;
53 intc_enum enum_ids[16];
54#ifdef CONFIG_SMP
55 unsigned long smp;
56#endif
57};
58
59struct intc_sense_reg {
60 unsigned long reg, reg_width, field_width;
61 intc_enum enum_ids[16];
62};
63
64#ifdef CONFIG_SMP
65#define INTC_SMP(stride, nr) .smp = (stride) | ((nr) << 8)
66#else
67#define INTC_SMP(stride, nr)
68#endif
69
70struct intc_desc {
71 struct intc_vect *vectors;
72 unsigned int nr_vectors;
73 struct intc_group *groups;
74 unsigned int nr_groups;
75 struct intc_mask_reg *mask_regs;
76 unsigned int nr_mask_regs;
77 struct intc_prio_reg *prio_regs;
78 unsigned int nr_prio_regs;
79 struct intc_sense_reg *sense_regs;
80 unsigned int nr_sense_regs;
81 char *name;
82#if defined(CONFIG_CPU_SH3) || defined(CONFIG_CPU_SH4A)
83 struct intc_mask_reg *ack_regs;
84 unsigned int nr_ack_regs;
85#endif
86};
87
88#define _INTC_ARRAY(a) a, sizeof(a)/sizeof(*a)
89#define DECLARE_INTC_DESC(symbol, chipname, vectors, groups, \
90 mask_regs, prio_regs, sense_regs) \
91struct intc_desc symbol __initdata = { \
92 _INTC_ARRAY(vectors), _INTC_ARRAY(groups), \
93 _INTC_ARRAY(mask_regs), _INTC_ARRAY(prio_regs), \
94 _INTC_ARRAY(sense_regs), \
95 chipname, \
96}
97
98#if defined(CONFIG_CPU_SH3) || defined(CONFIG_CPU_SH4A)
99#define DECLARE_INTC_DESC_ACK(symbol, chipname, vectors, groups, \
100 mask_regs, prio_regs, sense_regs, ack_regs) \
101struct intc_desc symbol __initdata = { \
102 _INTC_ARRAY(vectors), _INTC_ARRAY(groups), \
103 _INTC_ARRAY(mask_regs), _INTC_ARRAY(prio_regs), \
104 _INTC_ARRAY(sense_regs), \
105 chipname, \
106 _INTC_ARRAY(ack_regs), \
107}
108#endif
109
110void __init register_intc_controller(struct intc_desc *desc);
111int intc_set_priority(unsigned int irq, unsigned int prio);
112
113void __init plat_irq_setup(void); 27void __init plat_irq_setup(void);
114#ifdef CONFIG_CPU_SH3
115void __init plat_irq_setup_sh3(void); 28void __init plat_irq_setup_sh3(void);
116#endif 29void __init plat_irq_setup_pins(int mode);
117 30
118enum { IRQ_MODE_IRQ, IRQ_MODE_IRQ7654, IRQ_MODE_IRQ3210, 31enum { IRQ_MODE_IRQ, IRQ_MODE_IRQ7654, IRQ_MODE_IRQ3210,
119 IRQ_MODE_IRL7654_MASK, IRQ_MODE_IRL3210_MASK, 32 IRQ_MODE_IRL7654_MASK, IRQ_MODE_IRL3210_MASK,
120 IRQ_MODE_IRL7654, IRQ_MODE_IRL3210 }; 33 IRQ_MODE_IRL7654, IRQ_MODE_IRL3210 };
121void __init plat_irq_setup_pins(int mode);
122 34
123#endif /* __ASM_SH_HW_IRQ_H */ 35#endif /* __ASM_SH_HW_IRQ_H */
diff --git a/arch/sh/include/asm/io.h b/arch/sh/include/asm/io.h
index 1857666136f2..d9e794eff830 100644
--- a/arch/sh/include/asm/io.h
+++ b/arch/sh/include/asm/io.h
@@ -101,44 +101,33 @@
101#define outsw __outsw 101#define outsw __outsw
102#define outsl __outsl 102#define outsl __outsl
103 103
104#define __raw_readb(a) __readb((void __iomem *)(a)) 104#define __raw_writeb(v,a) (__chk_io_ptr(a), *(volatile unsigned char __force *)(a) = (v))
105#define __raw_readw(a) __readw((void __iomem *)(a)) 105#define __raw_writew(v,a) (__chk_io_ptr(a), *(volatile unsigned short __force *)(a) = (v))
106#define __raw_readl(a) __readl((void __iomem *)(a)) 106#define __raw_writel(v,a) (__chk_io_ptr(a), *(volatile unsigned int __force *)(a) = (v))
107#define __raw_writeb(v, a) __writeb(v, (void __iomem *)(a))
108#define __raw_writew(v, a) __writew(v, (void __iomem *)(a))
109#define __raw_writel(v, a) __writel(v, (void __iomem *)(a))
110 107
111void __raw_writesl(unsigned long addr, const void *data, int longlen); 108#define __raw_readb(a) (__chk_io_ptr(a), *(volatile unsigned char __force *)(a))
112void __raw_readsl(unsigned long addr, void *data, int longlen); 109#define __raw_readw(a) (__chk_io_ptr(a), *(volatile unsigned short __force *)(a))
110#define __raw_readl(a) (__chk_io_ptr(a), *(volatile unsigned int __force *)(a))
111
112void __raw_writesl(void __iomem *addr, const void *data, int longlen);
113void __raw_readsl(const void __iomem *addr, void *data, int longlen);
113 114
114/* 115/*
115 * The platform header files may define some of these macros to use 116 * The platform header files may define some of these macros to use
116 * the inlined versions where appropriate. These macros may also be 117 * the inlined versions where appropriate. These macros may also be
117 * redefined by userlevel programs. 118 * redefined by userlevel programs.
118 */ 119 */
119#ifdef __readb 120#define readb(a) ({ unsigned int r_ = __readb(a); mb(); r_; })
120# define readb(a) ({ unsigned int r_ = __raw_readb(a); mb(); r_; }) 121#define readw(a) ({ unsigned int r_ = __readw(a); mb(); r_; })
121#endif 122#define readl(a) ({ unsigned int r_ = __readl(a); mb(); r_; })
122#ifdef __raw_readw
123# define readw(a) ({ unsigned int r_ = __raw_readw(a); mb(); r_; })
124#endif
125#ifdef __raw_readl
126# define readl(a) ({ unsigned int r_ = __raw_readl(a); mb(); r_; })
127#endif
128 123
129#ifdef __raw_writeb 124#define writeb(v,a) ({ __writeb((v),(a)); mb(); })
130# define writeb(v,a) ({ __raw_writeb((v),(a)); mb(); }) 125#define writew(v,a) ({ __writew((v),(a)); mb(); })
131#endif 126#define writel(v,a) ({ __writel((v),(a)); mb(); })
132#ifdef __raw_writew
133# define writew(v,a) ({ __raw_writew((v),(a)); mb(); })
134#endif
135#ifdef __raw_writel
136# define writel(v,a) ({ __raw_writel((v),(a)); mb(); })
137#endif
138 127
139#define __BUILD_MEMORY_STRING(bwlq, type) \ 128#define __BUILD_MEMORY_STRING(bwlq, type) \
140 \ 129 \
141static inline void writes##bwlq(volatile void __iomem *mem, \ 130static inline void __raw_writes##bwlq(volatile void __iomem *mem, \
142 const void *addr, unsigned int count) \ 131 const void *addr, unsigned int count) \
143{ \ 132{ \
144 const volatile type *__addr = addr; \ 133 const volatile type *__addr = addr; \
@@ -149,8 +138,8 @@ static inline void writes##bwlq(volatile void __iomem *mem, \
149 } \ 138 } \
150} \ 139} \
151 \ 140 \
152static inline void reads##bwlq(volatile void __iomem *mem, void *addr, \ 141static inline void __raw_reads##bwlq(volatile void __iomem *mem, \
153 unsigned int count) \ 142 void *addr, unsigned int count) \
154{ \ 143{ \
155 volatile type *__addr = addr; \ 144 volatile type *__addr = addr; \
156 \ 145 \
@@ -162,7 +151,13 @@ static inline void reads##bwlq(volatile void __iomem *mem, void *addr, \
162 151
163__BUILD_MEMORY_STRING(b, u8) 152__BUILD_MEMORY_STRING(b, u8)
164__BUILD_MEMORY_STRING(w, u16) 153__BUILD_MEMORY_STRING(w, u16)
154
155#define writesb __raw_writesb
156#define writesw __raw_writesw
165#define writesl __raw_writesl 157#define writesl __raw_writesl
158
159#define readsb __raw_readsb
160#define readsw __raw_readsw
166#define readsl __raw_readsl 161#define readsl __raw_readsl
167 162
168#define readb_relaxed(a) readb(a) 163#define readb_relaxed(a) readb(a)
@@ -170,25 +165,25 @@ __BUILD_MEMORY_STRING(w, u16)
170#define readl_relaxed(a) readl(a) 165#define readl_relaxed(a) readl(a)
171 166
172/* Simple MMIO */ 167/* Simple MMIO */
173#define ioread8(a) readb(a) 168#define ioread8(a) __raw_readb(a)
174#define ioread16(a) readw(a) 169#define ioread16(a) __raw_readw(a)
175#define ioread16be(a) be16_to_cpu(__raw_readw((a))) 170#define ioread16be(a) be16_to_cpu(__raw_readw((a)))
176#define ioread32(a) readl(a) 171#define ioread32(a) __raw_readl(a)
177#define ioread32be(a) be32_to_cpu(__raw_readl((a))) 172#define ioread32be(a) be32_to_cpu(__raw_readl((a)))
178 173
179#define iowrite8(v,a) writeb((v),(a)) 174#define iowrite8(v,a) __raw_writeb((v),(a))
180#define iowrite16(v,a) writew((v),(a)) 175#define iowrite16(v,a) __raw_writew((v),(a))
181#define iowrite16be(v,a) __raw_writew(cpu_to_be16((v)),(a)) 176#define iowrite16be(v,a) __raw_writew(cpu_to_be16((v)),(a))
182#define iowrite32(v,a) writel((v),(a)) 177#define iowrite32(v,a) __raw_writel((v),(a))
183#define iowrite32be(v,a) __raw_writel(cpu_to_be32((v)),(a)) 178#define iowrite32be(v,a) __raw_writel(cpu_to_be32((v)),(a))
184 179
185#define ioread8_rep(a, d, c) readsb((a), (d), (c)) 180#define ioread8_rep(a, d, c) __raw_readsb((a), (d), (c))
186#define ioread16_rep(a, d, c) readsw((a), (d), (c)) 181#define ioread16_rep(a, d, c) __raw_readsw((a), (d), (c))
187#define ioread32_rep(a, d, c) readsl((a), (d), (c)) 182#define ioread32_rep(a, d, c) __raw_readsl((a), (d), (c))
188 183
189#define iowrite8_rep(a, s, c) writesb((a), (s), (c)) 184#define iowrite8_rep(a, s, c) __raw_writesb((a), (s), (c))
190#define iowrite16_rep(a, s, c) writesw((a), (s), (c)) 185#define iowrite16_rep(a, s, c) __raw_writesw((a), (s), (c))
191#define iowrite32_rep(a, s, c) writesl((a), (s), (c)) 186#define iowrite32_rep(a, s, c) __raw_writesl((a), (s), (c))
192 187
193#define mmiowb() wmb() /* synco on SH-4A, otherwise a nop */ 188#define mmiowb() wmb() /* synco on SH-4A, otherwise a nop */
194 189
diff --git a/arch/sh/include/asm/migor.h b/arch/sh/include/asm/migor.h
index c12b632c540b..70596d38fd67 100644
--- a/arch/sh/include/asm/migor.h
+++ b/arch/sh/include/asm/migor.h
@@ -54,7 +54,7 @@
54 54
55#define BSC_CS6ABCR 0xfec1001c 55#define BSC_CS6ABCR 0xfec1001c
56 56
57#include <asm/sh_mobile_lcdc.h> 57#include <video/sh_mobile_lcdc.h>
58 58
59int migor_lcd_qvga_setup(void *board_data, void *sys_ops_handle, 59int migor_lcd_qvga_setup(void *board_data, void *sys_ops_handle,
60 struct sh_mobile_lcdc_sys_bus_ops *sys_ops); 60 struct sh_mobile_lcdc_sys_bus_ops *sys_ops);
diff --git a/arch/sh/kernel/cpu/irq/Makefile b/arch/sh/kernel/cpu/irq/Makefile
index 462a8f6dfee2..f0c7025a67d1 100644
--- a/arch/sh/kernel/cpu/irq/Makefile
+++ b/arch/sh/kernel/cpu/irq/Makefile
@@ -1,8 +1,6 @@
1# 1#
2# Makefile for the Linux/SuperH CPU-specifc IRQ handlers. 2# Makefile for the Linux/SuperH CPU-specifc IRQ handlers.
3# 3#
4obj-y += intc.o
5
6obj-$(CONFIG_SUPERH32) += imask.o 4obj-$(CONFIG_SUPERH32) += imask.o
7obj-$(CONFIG_CPU_SH5) += intc-sh5.o 5obj-$(CONFIG_CPU_SH5) += intc-sh5.o
8obj-$(CONFIG_CPU_HAS_IPR_IRQ) += ipr.o 6obj-$(CONFIG_CPU_HAS_IPR_IRQ) += ipr.o
diff --git a/arch/sh/kernel/cpu/irq/ipr.c b/arch/sh/kernel/cpu/irq/ipr.c
index 56ea7b269b59..3eb17ee5540e 100644
--- a/arch/sh/kernel/cpu/irq/ipr.c
+++ b/arch/sh/kernel/cpu/irq/ipr.c
@@ -33,7 +33,7 @@ static void disable_ipr_irq(unsigned int irq)
33 struct ipr_data *p = get_irq_chip_data(irq); 33 struct ipr_data *p = get_irq_chip_data(irq);
34 unsigned long addr = get_ipr_desc(irq)->ipr_offsets[p->ipr_idx]; 34 unsigned long addr = get_ipr_desc(irq)->ipr_offsets[p->ipr_idx];
35 /* Set the priority in IPR to 0 */ 35 /* Set the priority in IPR to 0 */
36 ctrl_outw(ctrl_inw(addr) & (0xffff ^ (0xf << p->shift)), addr); 36 __raw_writew(__raw_readw(addr) & (0xffff ^ (0xf << p->shift)), addr);
37} 37}
38 38
39static void enable_ipr_irq(unsigned int irq) 39static void enable_ipr_irq(unsigned int irq)
@@ -41,7 +41,7 @@ static void enable_ipr_irq(unsigned int irq)
41 struct ipr_data *p = get_irq_chip_data(irq); 41 struct ipr_data *p = get_irq_chip_data(irq);
42 unsigned long addr = get_ipr_desc(irq)->ipr_offsets[p->ipr_idx]; 42 unsigned long addr = get_ipr_desc(irq)->ipr_offsets[p->ipr_idx];
43 /* Set priority in IPR back to original value */ 43 /* Set priority in IPR back to original value */
44 ctrl_outw(ctrl_inw(addr) | (p->priority << p->shift), addr); 44 __raw_writew(__raw_readw(addr) | (p->priority << p->shift), addr);
45} 45}
46 46
47/* 47/*
diff --git a/arch/sh/lib/io.c b/arch/sh/lib/io.c
index 4f54ec43516f..88dfe6e396bc 100644
--- a/arch/sh/lib/io.c
+++ b/arch/sh/lib/io.c
@@ -14,12 +14,12 @@
14#include <linux/module.h> 14#include <linux/module.h>
15#include <linux/io.h> 15#include <linux/io.h>
16 16
17void __raw_readsl(unsigned long addr, void *datap, int len) 17void __raw_readsl(const void __iomem *addr, void *datap, int len)
18{ 18{
19 u32 *data; 19 u32 *data;
20 20
21 for (data = datap; (len != 0) && (((u32)data & 0x1f) != 0); len--) 21 for (data = datap; (len != 0) && (((u32)data & 0x1f) != 0); len--)
22 *data++ = ctrl_inl(addr); 22 *data++ = __raw_readl(addr);
23 23
24 if (likely(len >= (0x20 >> 2))) { 24 if (likely(len >= (0x20 >> 2))) {
25 int tmp2, tmp3, tmp4, tmp5, tmp6; 25 int tmp2, tmp3, tmp4, tmp5, tmp6;
@@ -59,11 +59,11 @@ void __raw_readsl(unsigned long addr, void *datap, int len)
59 } 59 }
60 60
61 for (; len != 0; len--) 61 for (; len != 0; len--)
62 *data++ = ctrl_inl(addr); 62 *data++ = __raw_readl(addr);
63} 63}
64EXPORT_SYMBOL(__raw_readsl); 64EXPORT_SYMBOL(__raw_readsl);
65 65
66void __raw_writesl(unsigned long addr, const void *data, int len) 66void __raw_writesl(void __iomem *addr, const void *data, int len)
67{ 67{
68 if (likely(len != 0)) { 68 if (likely(len != 0)) {
69 int tmp1; 69 int tmp1;
diff --git a/drivers/serial/sh-sci.c b/drivers/serial/sh-sci.c
index 5bb571548558..3b9d2d83b590 100644
--- a/drivers/serial/sh-sci.c
+++ b/drivers/serial/sh-sci.c
@@ -3,7 +3,7 @@
3 * 3 *
4 * SuperH on-chip serial module support. (SCI with no FIFO / with FIFO) 4 * SuperH on-chip serial module support. (SCI with no FIFO / with FIFO)
5 * 5 *
6 * Copyright (C) 2002 - 2006 Paul Mundt 6 * Copyright (C) 2002 - 2008 Paul Mundt
7 * Modified to support SH7720 SCIF. Markus Brunner, Mark Jonas (Jul 2007). 7 * Modified to support SH7720 SCIF. Markus Brunner, Mark Jonas (Jul 2007).
8 * 8 *
9 * based off of the old drivers/char/sh-sci.c by: 9 * based off of the old drivers/char/sh-sci.c by:
@@ -46,6 +46,7 @@
46#include <linux/cpufreq.h> 46#include <linux/cpufreq.h>
47#include <linux/clk.h> 47#include <linux/clk.h>
48#include <linux/ctype.h> 48#include <linux/ctype.h>
49#include <linux/err.h>
49 50
50#ifdef CONFIG_SUPERH 51#ifdef CONFIG_SUPERH
51#include <asm/clock.h> 52#include <asm/clock.h>
@@ -1132,12 +1133,16 @@ static void sci_config_port(struct uart_port *port, int flags)
1132 break; 1133 break;
1133 } 1134 }
1134 1135
1135#if defined(CONFIG_CPU_SUBTYPE_SH5_101) || defined(CONFIG_CPU_SUBTYPE_SH5_103) 1136 if (port->flags & UPF_IOREMAP && !port->membase) {
1136 if (port->mapbase == 0) 1137#if defined(CONFIG_SUPERH64)
1137 port->mapbase = onchip_remap(SCIF_ADDR_SH5, 1024, "SCIF"); 1138 port->mapbase = onchip_remap(SCIF_ADDR_SH5, 1024, "SCIF");
1138 1139 port->membase = (void __iomem *)port->mapbase;
1139 port->membase = (void __iomem *)port->mapbase; 1140#else
1141 port->membase = ioremap_nocache(port->mapbase, 0x40);
1140#endif 1142#endif
1143
1144 printk(KERN_ERR "sci: can't remap port#%d\n", port->line);
1145 }
1141} 1146}
1142 1147
1143static int sci_verify_port(struct uart_port *port, struct serial_struct *ser) 1148static int sci_verify_port(struct uart_port *port, struct serial_struct *ser)
@@ -1423,7 +1428,7 @@ static struct uart_driver sci_uart_driver = {
1423static int __devinit sci_probe(struct platform_device *dev) 1428static int __devinit sci_probe(struct platform_device *dev)
1424{ 1429{
1425 struct plat_sci_port *p = dev->dev.platform_data; 1430 struct plat_sci_port *p = dev->dev.platform_data;
1426 int i; 1431 int i, ret = -EINVAL;
1427 1432
1428 for (i = 0; p && p->flags != 0; p++, i++) { 1433 for (i = 0; p && p->flags != 0; p++, i++) {
1429 struct sci_port *sciport = &sci_ports[i]; 1434 struct sci_port *sciport = &sci_ports[i];
@@ -1440,12 +1445,22 @@ static int __devinit sci_probe(struct platform_device *dev)
1440 1445
1441 sciport->port.mapbase = p->mapbase; 1446 sciport->port.mapbase = p->mapbase;
1442 1447
1443 /* 1448 if (p->mapbase && !p->membase) {
1444 * For the simple (and majority of) cases where we don't need 1449 if (p->flags & UPF_IOREMAP) {
1445 * to do any remapping, just cast the cookie directly. 1450 p->membase = ioremap_nocache(p->mapbase, 0x40);
1446 */ 1451 if (IS_ERR(p->membase)) {
1447 if (p->mapbase && !p->membase && !(p->flags & UPF_IOREMAP)) 1452 ret = PTR_ERR(p->membase);
1448 p->membase = (void __iomem *)p->mapbase; 1453 goto err_unreg;
1454 }
1455 } else {
1456 /*
1457 * For the simple (and majority of) cases
1458 * where we don't need to do any remapping,
1459 * just cast the cookie directly.
1460 */
1461 p->membase = (void __iomem *)p->mapbase;
1462 }
1463 }
1449 1464
1450 sciport->port.membase = p->membase; 1465 sciport->port.membase = p->membase;
1451 1466
@@ -1476,6 +1491,12 @@ static int __devinit sci_probe(struct platform_device *dev)
1476#endif 1491#endif
1477 1492
1478 return 0; 1493 return 0;
1494
1495err_unreg:
1496 for (i = i - 1; i >= 0; i--)
1497 uart_remove_one_port(&sci_uart_driver, &sci_ports[i].port);
1498
1499 return ret;
1479} 1500}
1480 1501
1481static int __devexit sci_remove(struct platform_device *dev) 1502static int __devexit sci_remove(struct platform_device *dev)
diff --git a/drivers/serial/sh-sci.h b/drivers/serial/sh-sci.h
index b3d906bfbd87..511c10d42187 100644
--- a/drivers/serial/sh-sci.h
+++ b/drivers/serial/sh-sci.h
@@ -320,18 +320,16 @@
320#define SCI_EVENT_WRITE_WAKEUP 0 320#define SCI_EVENT_WRITE_WAKEUP 0
321 321
322#define SCI_IN(size, offset) \ 322#define SCI_IN(size, offset) \
323 unsigned int addr = port->mapbase + (offset); \
324 if ((size) == 8) { \ 323 if ((size) == 8) { \
325 return ctrl_inb(addr); \ 324 return ioread8(port->membase + (offset)); \
326 } else { \ 325 } else { \
327 return ctrl_inw(addr); \ 326 return ioread16(port->membase + (offset)); \
328 } 327 }
329#define SCI_OUT(size, offset, value) \ 328#define SCI_OUT(size, offset, value) \
330 unsigned int addr = port->mapbase + (offset); \
331 if ((size) == 8) { \ 329 if ((size) == 8) { \
332 ctrl_outb(value, addr); \ 330 iowrite8(value, port->membase + (offset)); \
333 } else if ((size) == 16) { \ 331 } else if ((size) == 16) { \
334 ctrl_outw(value, addr); \ 332 iowrite16(value, port->membase + (offset)); \
335 } 333 }
336 334
337#define CPU_SCIx_FNS(name, sci_offset, sci_size, scif_offset, scif_size)\ 335#define CPU_SCIx_FNS(name, sci_offset, sci_size, scif_offset, scif_size)\
diff --git a/drivers/sh/Makefile b/drivers/sh/Makefile
index a96f4a8cfeb8..6a025cefe6dc 100644
--- a/drivers/sh/Makefile
+++ b/drivers/sh/Makefile
@@ -1,6 +1,6 @@
1# 1#
2# Makefile for the SuperH specific drivers. 2# Makefile for the SuperH specific drivers.
3# 3#
4
5obj-$(CONFIG_SUPERHYWAY) += superhyway/ 4obj-$(CONFIG_SUPERHYWAY) += superhyway/
6obj-$(CONFIG_MAPLE) += maple/ 5obj-$(CONFIG_MAPLE) += maple/
6obj-y += intc.o
diff --git a/arch/sh/kernel/cpu/irq/intc.c b/drivers/sh/intc.c
index 94536d358fe1..58d24c5a76ce 100644
--- a/arch/sh/kernel/cpu/irq/intc.c
+++ b/drivers/sh/intc.c
@@ -21,6 +21,7 @@
21#include <linux/io.h> 21#include <linux/io.h>
22#include <linux/interrupt.h> 22#include <linux/interrupt.h>
23#include <linux/bootmem.h> 23#include <linux/bootmem.h>
24#include <linux/sh_intc.h>
24 25
25#define _INTC_MK(fn, mode, addr_e, addr_d, width, shift) \ 26#define _INTC_MK(fn, mode, addr_e, addr_d, width, shift) \
26 ((shift) | ((width) << 5) | ((fn) << 9) | ((mode) << 13) | \ 27 ((shift) | ((width) << 5) | ((fn) << 9) | ((mode) << 13) | \
@@ -86,24 +87,24 @@ static inline unsigned int set_field(unsigned int value,
86 87
87static void write_8(unsigned long addr, unsigned long h, unsigned long data) 88static void write_8(unsigned long addr, unsigned long h, unsigned long data)
88{ 89{
89 ctrl_outb(set_field(0, data, h), addr); 90 __raw_writeb(set_field(0, data, h), addr);
90} 91}
91 92
92static void write_16(unsigned long addr, unsigned long h, unsigned long data) 93static void write_16(unsigned long addr, unsigned long h, unsigned long data)
93{ 94{
94 ctrl_outw(set_field(0, data, h), addr); 95 __raw_writew(set_field(0, data, h), addr);
95} 96}
96 97
97static void write_32(unsigned long addr, unsigned long h, unsigned long data) 98static void write_32(unsigned long addr, unsigned long h, unsigned long data)
98{ 99{
99 ctrl_outl(set_field(0, data, h), addr); 100 __raw_writel(set_field(0, data, h), addr);
100} 101}
101 102
102static void modify_8(unsigned long addr, unsigned long h, unsigned long data) 103static void modify_8(unsigned long addr, unsigned long h, unsigned long data)
103{ 104{
104 unsigned long flags; 105 unsigned long flags;
105 local_irq_save(flags); 106 local_irq_save(flags);
106 ctrl_outb(set_field(ctrl_inb(addr), data, h), addr); 107 __raw_writeb(set_field(__raw_readb(addr), data, h), addr);
107 local_irq_restore(flags); 108 local_irq_restore(flags);
108} 109}
109 110
@@ -111,7 +112,7 @@ static void modify_16(unsigned long addr, unsigned long h, unsigned long data)
111{ 112{
112 unsigned long flags; 113 unsigned long flags;
113 local_irq_save(flags); 114 local_irq_save(flags);
114 ctrl_outw(set_field(ctrl_inw(addr), data, h), addr); 115 __raw_writew(set_field(__raw_readw(addr), data, h), addr);
115 local_irq_restore(flags); 116 local_irq_restore(flags);
116} 117}
117 118
@@ -119,7 +120,7 @@ static void modify_32(unsigned long addr, unsigned long h, unsigned long data)
119{ 120{
120 unsigned long flags; 121 unsigned long flags;
121 local_irq_save(flags); 122 local_irq_save(flags);
122 ctrl_outl(set_field(ctrl_inl(addr), data, h), addr); 123 __raw_writel(set_field(__raw_readl(addr), data, h), addr);
123 local_irq_restore(flags); 124 local_irq_restore(flags);
124} 125}
125 126
@@ -246,16 +247,16 @@ static void intc_mask_ack(unsigned int irq)
246 addr = INTC_REG(d, _INTC_ADDR_D(handle), 0); 247 addr = INTC_REG(d, _INTC_ADDR_D(handle), 0);
247 switch (_INTC_FN(handle)) { 248 switch (_INTC_FN(handle)) {
248 case REG_FN_MODIFY_BASE + 0: /* 8bit */ 249 case REG_FN_MODIFY_BASE + 0: /* 8bit */
249 ctrl_inb(addr); 250 __raw_readb(addr);
250 ctrl_outb(0xff ^ set_field(0, 1, handle), addr); 251 __raw_writeb(0xff ^ set_field(0, 1, handle), addr);
251 break; 252 break;
252 case REG_FN_MODIFY_BASE + 1: /* 16bit */ 253 case REG_FN_MODIFY_BASE + 1: /* 16bit */
253 ctrl_inw(addr); 254 __raw_readw(addr);
254 ctrl_outw(0xffff ^ set_field(0, 1, handle), addr); 255 __raw_writew(0xffff ^ set_field(0, 1, handle), addr);
255 break; 256 break;
256 case REG_FN_MODIFY_BASE + 3: /* 32bit */ 257 case REG_FN_MODIFY_BASE + 3: /* 32bit */
257 ctrl_inl(addr); 258 __raw_readl(addr);
258 ctrl_outl(0xffffffff ^ set_field(0, 1, handle), addr); 259 __raw_writel(0xffffffff ^ set_field(0, 1, handle), addr);
259 break; 260 break;
260 default: 261 default:
261 BUG(); 262 BUG();
diff --git a/drivers/video/sh_mobile_lcdcfb.c b/drivers/video/sh_mobile_lcdcfb.c
index 4c32c06579a0..b7468bacce80 100644
--- a/drivers/video/sh_mobile_lcdcfb.c
+++ b/drivers/video/sh_mobile_lcdcfb.c
@@ -16,7 +16,7 @@
16#include <linux/clk.h> 16#include <linux/clk.h>
17#include <linux/platform_device.h> 17#include <linux/platform_device.h>
18#include <linux/dma-mapping.h> 18#include <linux/dma-mapping.h>
19#include <asm/sh_mobile_lcdc.h> 19#include <video/sh_mobile_lcdc.h>
20 20
21#define PALETTE_NR 16 21#define PALETTE_NR 16
22 22
@@ -34,7 +34,9 @@ struct sh_mobile_lcdc_chan {
34 34
35struct sh_mobile_lcdc_priv { 35struct sh_mobile_lcdc_priv {
36 void __iomem *base; 36 void __iomem *base;
37#ifdef CONFIG_HAVE_CLK
37 struct clk *clk; 38 struct clk *clk;
39#endif
38 unsigned long lddckr; 40 unsigned long lddckr;
39 struct sh_mobile_lcdc_chan ch[2]; 41 struct sh_mobile_lcdc_chan ch[2];
40}; 42};
@@ -422,6 +424,7 @@ static int sh_mobile_lcdc_setup_clocks(struct device *dev, int clock_source,
422 424
423 priv->lddckr = icksel << 16; 425 priv->lddckr = icksel << 16;
424 426
427#ifdef CONFIG_HAVE_CLK
425 if (str) { 428 if (str) {
426 priv->clk = clk_get(dev, str); 429 priv->clk = clk_get(dev, str);
427 if (IS_ERR(priv->clk)) { 430 if (IS_ERR(priv->clk)) {
@@ -431,6 +434,7 @@ static int sh_mobile_lcdc_setup_clocks(struct device *dev, int clock_source,
431 434
432 clk_enable(priv->clk); 435 clk_enable(priv->clk);
433 } 436 }
437#endif
434 438
435 return 0; 439 return 0;
436} 440}
@@ -688,10 +692,12 @@ static int sh_mobile_lcdc_remove(struct platform_device *pdev)
688 fb_dealloc_cmap(&info->cmap); 692 fb_dealloc_cmap(&info->cmap);
689 } 693 }
690 694
695#ifdef CONFIG_HAVE_CLK
691 if (priv->clk) { 696 if (priv->clk) {
692 clk_disable(priv->clk); 697 clk_disable(priv->clk);
693 clk_put(priv->clk); 698 clk_put(priv->clk);
694 } 699 }
700#endif
695 701
696 if (priv->base) 702 if (priv->base)
697 iounmap(priv->base); 703 iounmap(priv->base);
diff --git a/include/linux/sh_intc.h b/include/linux/sh_intc.h
new file mode 100644
index 000000000000..68e212ff9dde
--- /dev/null
+++ b/include/linux/sh_intc.h
@@ -0,0 +1,91 @@
1#ifndef __SH_INTC_H
2#define __SH_INTC_H
3
4typedef unsigned char intc_enum;
5
6struct intc_vect {
7 intc_enum enum_id;
8 unsigned short vect;
9};
10
11#define INTC_VECT(enum_id, vect) { enum_id, vect }
12#define INTC_IRQ(enum_id, irq) INTC_VECT(enum_id, irq2evt(irq))
13
14struct intc_group {
15 intc_enum enum_id;
16 intc_enum enum_ids[32];
17};
18
19#define INTC_GROUP(enum_id, ids...) { enum_id, { ids } }
20
21struct intc_mask_reg {
22 unsigned long set_reg, clr_reg, reg_width;
23 intc_enum enum_ids[32];
24#ifdef CONFIG_SMP
25 unsigned long smp;
26#endif
27};
28
29struct intc_prio_reg {
30 unsigned long set_reg, clr_reg, reg_width, field_width;
31 intc_enum enum_ids[16];
32#ifdef CONFIG_SMP
33 unsigned long smp;
34#endif
35};
36
37struct intc_sense_reg {
38 unsigned long reg, reg_width, field_width;
39 intc_enum enum_ids[16];
40};
41
42#ifdef CONFIG_SMP
43#define INTC_SMP(stride, nr) .smp = (stride) | ((nr) << 8)
44#else
45#define INTC_SMP(stride, nr)
46#endif
47
48struct intc_desc {
49 struct intc_vect *vectors;
50 unsigned int nr_vectors;
51 struct intc_group *groups;
52 unsigned int nr_groups;
53 struct intc_mask_reg *mask_regs;
54 unsigned int nr_mask_regs;
55 struct intc_prio_reg *prio_regs;
56 unsigned int nr_prio_regs;
57 struct intc_sense_reg *sense_regs;
58 unsigned int nr_sense_regs;
59 char *name;
60#if defined(CONFIG_CPU_SH3) || defined(CONFIG_CPU_SH4A)
61 struct intc_mask_reg *ack_regs;
62 unsigned int nr_ack_regs;
63#endif
64};
65
66#define _INTC_ARRAY(a) a, sizeof(a)/sizeof(*a)
67#define DECLARE_INTC_DESC(symbol, chipname, vectors, groups, \
68 mask_regs, prio_regs, sense_regs) \
69struct intc_desc symbol __initdata = { \
70 _INTC_ARRAY(vectors), _INTC_ARRAY(groups), \
71 _INTC_ARRAY(mask_regs), _INTC_ARRAY(prio_regs), \
72 _INTC_ARRAY(sense_regs), \
73 chipname, \
74}
75
76#if defined(CONFIG_CPU_SH3) || defined(CONFIG_CPU_SH4A)
77#define DECLARE_INTC_DESC_ACK(symbol, chipname, vectors, groups, \
78 mask_regs, prio_regs, sense_regs, ack_regs) \
79struct intc_desc symbol __initdata = { \
80 _INTC_ARRAY(vectors), _INTC_ARRAY(groups), \
81 _INTC_ARRAY(mask_regs), _INTC_ARRAY(prio_regs), \
82 _INTC_ARRAY(sense_regs), \
83 chipname, \
84 _INTC_ARRAY(ack_regs), \
85}
86#endif
87
88void __init register_intc_controller(struct intc_desc *desc);
89int intc_set_priority(unsigned int irq, unsigned int prio);
90
91#endif /* __SH_INTC_H */
diff --git a/arch/sh/include/asm/sh_mobile_lcdc.h b/include/video/sh_mobile_lcdc.h
index 130102f663f5..130102f663f5 100644
--- a/arch/sh/include/asm/sh_mobile_lcdc.h
+++ b/include/video/sh_mobile_lcdc.h