diff options
author | Paul Mundt <lethal@linux-sh.org> | 2008-10-02 06:14:11 -0400 |
---|---|---|
committer | Paul Mundt <lethal@linux-sh.org> | 2008-10-02 06:14:11 -0400 |
commit | bc0f424faa11a2017ba725bb8c5fc481ece7b440 (patch) | |
tree | e6272f37806941443f1ead19f965e8eeb531282c /arch | |
parent | a2159b52219870553fd67e6456f41cd5225c46c6 (diff) | |
parent | 225c9a8d1da274bf23efec43ec28b1c9e45e12f8 (diff) |
Merge branch 'sh/g3-prep'
Diffstat (limited to 'arch')
-rw-r--r-- | arch/sh/boards/board-ap325rxa.c | 2 | ||||
-rw-r--r-- | arch/sh/boards/mach-migor/lcd_qvga.c | 2 | ||||
-rw-r--r-- | arch/sh/boards/mach-migor/setup.c | 2 | ||||
-rw-r--r-- | arch/sh/include/asm/hw_irq.h | 92 | ||||
-rw-r--r-- | arch/sh/include/asm/io.h | 77 | ||||
-rw-r--r-- | arch/sh/include/asm/migor.h | 2 | ||||
-rw-r--r-- | arch/sh/include/asm/sh_mobile_lcdc.h | 72 | ||||
-rw-r--r-- | arch/sh/kernel/cpu/irq/Makefile | 2 | ||||
-rw-r--r-- | arch/sh/kernel/cpu/irq/intc.c | 712 | ||||
-rw-r--r-- | arch/sh/kernel/cpu/irq/ipr.c | 4 | ||||
-rw-r--r-- | arch/sh/lib/io.c | 8 |
11 files changed, 48 insertions, 927 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 | ||
7 | extern atomic_t irq_err_count; | 8 | extern atomic_t irq_err_count; |
@@ -23,101 +24,12 @@ struct ipr_desc { | |||
23 | 24 | ||
24 | void register_ipr_controller(struct ipr_desc *); | 25 | void register_ipr_controller(struct ipr_desc *); |
25 | 26 | ||
26 | typedef unsigned char intc_enum; | ||
27 | |||
28 | struct 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 | |||
36 | struct 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 | |||
43 | struct 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 | |||
51 | struct 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 | |||
59 | struct 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 | |||
70 | struct 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) \ | ||
91 | struct 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) \ | ||
101 | struct 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 | |||
110 | void __init register_intc_controller(struct intc_desc *desc); | ||
111 | int intc_set_priority(unsigned int irq, unsigned int prio); | ||
112 | |||
113 | void __init plat_irq_setup(void); | 27 | void __init plat_irq_setup(void); |
114 | #ifdef CONFIG_CPU_SH3 | ||
115 | void __init plat_irq_setup_sh3(void); | 28 | void __init plat_irq_setup_sh3(void); |
116 | #endif | 29 | void __init plat_irq_setup_pins(int mode); |
117 | 30 | ||
118 | enum { IRQ_MODE_IRQ, IRQ_MODE_IRQ7654, IRQ_MODE_IRQ3210, | 31 | enum { 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 }; |
121 | void __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 | ||
111 | void __raw_writesl(unsigned long addr, const void *data, int longlen); | 108 | #define __raw_readb(a) (__chk_io_ptr(a), *(volatile unsigned char __force *)(a)) |
112 | void __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 | |||
112 | void __raw_writesl(void __iomem *addr, const void *data, int longlen); | ||
113 | void __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 | \ |
141 | static inline void writes##bwlq(volatile void __iomem *mem, \ | 130 | static 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 | \ |
152 | static inline void reads##bwlq(volatile void __iomem *mem, void *addr, \ | 141 | static 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 | ||
59 | int migor_lcd_qvga_setup(void *board_data, void *sys_ops_handle, | 59 | int 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/include/asm/sh_mobile_lcdc.h b/arch/sh/include/asm/sh_mobile_lcdc.h deleted file mode 100644 index 130102f663f5..000000000000 --- a/arch/sh/include/asm/sh_mobile_lcdc.h +++ /dev/null | |||
@@ -1,72 +0,0 @@ | |||
1 | #ifndef __ASM_SH_MOBILE_LCDC_H__ | ||
2 | #define __ASM_SH_MOBILE_LCDC_H__ | ||
3 | |||
4 | #include <linux/fb.h> | ||
5 | |||
6 | enum { RGB8, /* 24bpp, 8:8:8 */ | ||
7 | RGB9, /* 18bpp, 9:9 */ | ||
8 | RGB12A, /* 24bpp, 12:12 */ | ||
9 | RGB12B, /* 12bpp */ | ||
10 | RGB16, /* 16bpp */ | ||
11 | RGB18, /* 18bpp */ | ||
12 | RGB24, /* 24bpp */ | ||
13 | SYS8A, /* 24bpp, 8:8:8 */ | ||
14 | SYS8B, /* 18bpp, 8:8:2 */ | ||
15 | SYS8C, /* 18bpp, 2:8:8 */ | ||
16 | SYS8D, /* 16bpp, 8:8 */ | ||
17 | SYS9, /* 18bpp, 9:9 */ | ||
18 | SYS12, /* 24bpp, 12:12 */ | ||
19 | SYS16A, /* 16bpp */ | ||
20 | SYS16B, /* 18bpp, 16:2 */ | ||
21 | SYS16C, /* 18bpp, 2:16 */ | ||
22 | SYS18, /* 18bpp */ | ||
23 | SYS24 };/* 24bpp */ | ||
24 | |||
25 | enum { LCDC_CHAN_DISABLED = 0, | ||
26 | LCDC_CHAN_MAINLCD, | ||
27 | LCDC_CHAN_SUBLCD }; | ||
28 | |||
29 | enum { LCDC_CLK_BUS, LCDC_CLK_PERIPHERAL, LCDC_CLK_EXTERNAL }; | ||
30 | |||
31 | struct sh_mobile_lcdc_sys_bus_cfg { | ||
32 | unsigned long ldmt2r; | ||
33 | unsigned long ldmt3r; | ||
34 | }; | ||
35 | |||
36 | struct sh_mobile_lcdc_sys_bus_ops { | ||
37 | void (*write_index)(void *handle, unsigned long data); | ||
38 | void (*write_data)(void *handle, unsigned long data); | ||
39 | unsigned long (*read_data)(void *handle); | ||
40 | }; | ||
41 | |||
42 | struct sh_mobile_lcdc_board_cfg { | ||
43 | void *board_data; | ||
44 | int (*setup_sys)(void *board_data, void *sys_ops_handle, | ||
45 | struct sh_mobile_lcdc_sys_bus_ops *sys_ops); | ||
46 | void (*display_on)(void *board_data); | ||
47 | void (*display_off)(void *board_data); | ||
48 | }; | ||
49 | |||
50 | struct sh_mobile_lcdc_lcd_size_cfg { /* width and height of panel in mm */ | ||
51 | unsigned long width; | ||
52 | unsigned long height; | ||
53 | }; | ||
54 | |||
55 | struct sh_mobile_lcdc_chan_cfg { | ||
56 | int chan; | ||
57 | int bpp; | ||
58 | int interface_type; /* selects RGBn or SYSn I/F, see above */ | ||
59 | int clock_divider; | ||
60 | struct fb_videomode lcd_cfg; | ||
61 | struct sh_mobile_lcdc_lcd_size_cfg lcd_size_cfg; | ||
62 | struct sh_mobile_lcdc_board_cfg board_cfg; | ||
63 | struct sh_mobile_lcdc_sys_bus_cfg sys_bus_cfg; /* only for SYSn I/F */ | ||
64 | }; | ||
65 | |||
66 | struct sh_mobile_lcdc_info { | ||
67 | unsigned long lddckr; | ||
68 | int clock_source; | ||
69 | struct sh_mobile_lcdc_chan_cfg ch[2]; | ||
70 | }; | ||
71 | |||
72 | #endif /* __ASM_SH_MOBILE_LCDC_H__ */ | ||
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 | # |
4 | obj-y += intc.o | ||
5 | |||
6 | obj-$(CONFIG_SUPERH32) += imask.o | 4 | obj-$(CONFIG_SUPERH32) += imask.o |
7 | obj-$(CONFIG_CPU_SH5) += intc-sh5.o | 5 | obj-$(CONFIG_CPU_SH5) += intc-sh5.o |
8 | obj-$(CONFIG_CPU_HAS_IPR_IRQ) += ipr.o | 6 | obj-$(CONFIG_CPU_HAS_IPR_IRQ) += ipr.o |
diff --git a/arch/sh/kernel/cpu/irq/intc.c b/arch/sh/kernel/cpu/irq/intc.c deleted file mode 100644 index 94536d358fe1..000000000000 --- a/arch/sh/kernel/cpu/irq/intc.c +++ /dev/null | |||
@@ -1,712 +0,0 @@ | |||
1 | /* | ||
2 | * Shared interrupt handling code for IPR and INTC2 types of IRQs. | ||
3 | * | ||
4 | * Copyright (C) 2007, 2008 Magnus Damm | ||
5 | * | ||
6 | * Based on intc2.c and ipr.c | ||
7 | * | ||
8 | * Copyright (C) 1999 Niibe Yutaka & Takeshi Yaegashi | ||
9 | * Copyright (C) 2000 Kazumoto Kojima | ||
10 | * Copyright (C) 2001 David J. Mckay (david.mckay@st.com) | ||
11 | * Copyright (C) 2003 Takashi Kusuda <kusuda-takashi@hitachi-ul.co.jp> | ||
12 | * Copyright (C) 2005, 2006 Paul Mundt | ||
13 | * | ||
14 | * This file is subject to the terms and conditions of the GNU General Public | ||
15 | * License. See the file "COPYING" in the main directory of this archive | ||
16 | * for more details. | ||
17 | */ | ||
18 | #include <linux/init.h> | ||
19 | #include <linux/irq.h> | ||
20 | #include <linux/module.h> | ||
21 | #include <linux/io.h> | ||
22 | #include <linux/interrupt.h> | ||
23 | #include <linux/bootmem.h> | ||
24 | |||
25 | #define _INTC_MK(fn, mode, addr_e, addr_d, width, shift) \ | ||
26 | ((shift) | ((width) << 5) | ((fn) << 9) | ((mode) << 13) | \ | ||
27 | ((addr_e) << 16) | ((addr_d << 24))) | ||
28 | |||
29 | #define _INTC_SHIFT(h) (h & 0x1f) | ||
30 | #define _INTC_WIDTH(h) ((h >> 5) & 0xf) | ||
31 | #define _INTC_FN(h) ((h >> 9) & 0xf) | ||
32 | #define _INTC_MODE(h) ((h >> 13) & 0x7) | ||
33 | #define _INTC_ADDR_E(h) ((h >> 16) & 0xff) | ||
34 | #define _INTC_ADDR_D(h) ((h >> 24) & 0xff) | ||
35 | |||
36 | struct intc_handle_int { | ||
37 | unsigned int irq; | ||
38 | unsigned long handle; | ||
39 | }; | ||
40 | |||
41 | struct intc_desc_int { | ||
42 | unsigned long *reg; | ||
43 | #ifdef CONFIG_SMP | ||
44 | unsigned long *smp; | ||
45 | #endif | ||
46 | unsigned int nr_reg; | ||
47 | struct intc_handle_int *prio; | ||
48 | unsigned int nr_prio; | ||
49 | struct intc_handle_int *sense; | ||
50 | unsigned int nr_sense; | ||
51 | struct irq_chip chip; | ||
52 | }; | ||
53 | |||
54 | #ifdef CONFIG_SMP | ||
55 | #define IS_SMP(x) x.smp | ||
56 | #define INTC_REG(d, x, c) (d->reg[(x)] + ((d->smp[(x)] & 0xff) * c)) | ||
57 | #define SMP_NR(d, x) ((d->smp[(x)] >> 8) ? (d->smp[(x)] >> 8) : 1) | ||
58 | #else | ||
59 | #define IS_SMP(x) 0 | ||
60 | #define INTC_REG(d, x, c) (d->reg[(x)]) | ||
61 | #define SMP_NR(d, x) 1 | ||
62 | #endif | ||
63 | |||
64 | static unsigned int intc_prio_level[NR_IRQS]; /* for now */ | ||
65 | #if defined(CONFIG_CPU_SH3) || defined(CONFIG_CPU_SH4A) | ||
66 | static unsigned long ack_handle[NR_IRQS]; | ||
67 | #endif | ||
68 | |||
69 | static inline struct intc_desc_int *get_intc_desc(unsigned int irq) | ||
70 | { | ||
71 | struct irq_chip *chip = get_irq_chip(irq); | ||
72 | return (void *)((char *)chip - offsetof(struct intc_desc_int, chip)); | ||
73 | } | ||
74 | |||
75 | static inline unsigned int set_field(unsigned int value, | ||
76 | unsigned int field_value, | ||
77 | unsigned int handle) | ||
78 | { | ||
79 | unsigned int width = _INTC_WIDTH(handle); | ||
80 | unsigned int shift = _INTC_SHIFT(handle); | ||
81 | |||
82 | value &= ~(((1 << width) - 1) << shift); | ||
83 | value |= field_value << shift; | ||
84 | return value; | ||
85 | } | ||
86 | |||
87 | static void write_8(unsigned long addr, unsigned long h, unsigned long data) | ||
88 | { | ||
89 | ctrl_outb(set_field(0, data, h), addr); | ||
90 | } | ||
91 | |||
92 | static void write_16(unsigned long addr, unsigned long h, unsigned long data) | ||
93 | { | ||
94 | ctrl_outw(set_field(0, data, h), addr); | ||
95 | } | ||
96 | |||
97 | static void write_32(unsigned long addr, unsigned long h, unsigned long data) | ||
98 | { | ||
99 | ctrl_outl(set_field(0, data, h), addr); | ||
100 | } | ||
101 | |||
102 | static void modify_8(unsigned long addr, unsigned long h, unsigned long data) | ||
103 | { | ||
104 | unsigned long flags; | ||
105 | local_irq_save(flags); | ||
106 | ctrl_outb(set_field(ctrl_inb(addr), data, h), addr); | ||
107 | local_irq_restore(flags); | ||
108 | } | ||
109 | |||
110 | static void modify_16(unsigned long addr, unsigned long h, unsigned long data) | ||
111 | { | ||
112 | unsigned long flags; | ||
113 | local_irq_save(flags); | ||
114 | ctrl_outw(set_field(ctrl_inw(addr), data, h), addr); | ||
115 | local_irq_restore(flags); | ||
116 | } | ||
117 | |||
118 | static void modify_32(unsigned long addr, unsigned long h, unsigned long data) | ||
119 | { | ||
120 | unsigned long flags; | ||
121 | local_irq_save(flags); | ||
122 | ctrl_outl(set_field(ctrl_inl(addr), data, h), addr); | ||
123 | local_irq_restore(flags); | ||
124 | } | ||
125 | |||
126 | enum { REG_FN_ERR = 0, REG_FN_WRITE_BASE = 1, REG_FN_MODIFY_BASE = 5 }; | ||
127 | |||
128 | static void (*intc_reg_fns[])(unsigned long addr, | ||
129 | unsigned long h, | ||
130 | unsigned long data) = { | ||
131 | [REG_FN_WRITE_BASE + 0] = write_8, | ||
132 | [REG_FN_WRITE_BASE + 1] = write_16, | ||
133 | [REG_FN_WRITE_BASE + 3] = write_32, | ||
134 | [REG_FN_MODIFY_BASE + 0] = modify_8, | ||
135 | [REG_FN_MODIFY_BASE + 1] = modify_16, | ||
136 | [REG_FN_MODIFY_BASE + 3] = modify_32, | ||
137 | }; | ||
138 | |||
139 | enum { MODE_ENABLE_REG = 0, /* Bit(s) set -> interrupt enabled */ | ||
140 | MODE_MASK_REG, /* Bit(s) set -> interrupt disabled */ | ||
141 | MODE_DUAL_REG, /* Two registers, set bit to enable / disable */ | ||
142 | MODE_PRIO_REG, /* Priority value written to enable interrupt */ | ||
143 | MODE_PCLR_REG, /* Above plus all bits set to disable interrupt */ | ||
144 | }; | ||
145 | |||
146 | static void intc_mode_field(unsigned long addr, | ||
147 | unsigned long handle, | ||
148 | void (*fn)(unsigned long, | ||
149 | unsigned long, | ||
150 | unsigned long), | ||
151 | unsigned int irq) | ||
152 | { | ||
153 | fn(addr, handle, ((1 << _INTC_WIDTH(handle)) - 1)); | ||
154 | } | ||
155 | |||
156 | static void intc_mode_zero(unsigned long addr, | ||
157 | unsigned long handle, | ||
158 | void (*fn)(unsigned long, | ||
159 | unsigned long, | ||
160 | unsigned long), | ||
161 | unsigned int irq) | ||
162 | { | ||
163 | fn(addr, handle, 0); | ||
164 | } | ||
165 | |||
166 | static void intc_mode_prio(unsigned long addr, | ||
167 | unsigned long handle, | ||
168 | void (*fn)(unsigned long, | ||
169 | unsigned long, | ||
170 | unsigned long), | ||
171 | unsigned int irq) | ||
172 | { | ||
173 | fn(addr, handle, intc_prio_level[irq]); | ||
174 | } | ||
175 | |||
176 | static void (*intc_enable_fns[])(unsigned long addr, | ||
177 | unsigned long handle, | ||
178 | void (*fn)(unsigned long, | ||
179 | unsigned long, | ||
180 | unsigned long), | ||
181 | unsigned int irq) = { | ||
182 | [MODE_ENABLE_REG] = intc_mode_field, | ||
183 | [MODE_MASK_REG] = intc_mode_zero, | ||
184 | [MODE_DUAL_REG] = intc_mode_field, | ||
185 | [MODE_PRIO_REG] = intc_mode_prio, | ||
186 | [MODE_PCLR_REG] = intc_mode_prio, | ||
187 | }; | ||
188 | |||
189 | static void (*intc_disable_fns[])(unsigned long addr, | ||
190 | unsigned long handle, | ||
191 | void (*fn)(unsigned long, | ||
192 | unsigned long, | ||
193 | unsigned long), | ||
194 | unsigned int irq) = { | ||
195 | [MODE_ENABLE_REG] = intc_mode_zero, | ||
196 | [MODE_MASK_REG] = intc_mode_field, | ||
197 | [MODE_DUAL_REG] = intc_mode_field, | ||
198 | [MODE_PRIO_REG] = intc_mode_zero, | ||
199 | [MODE_PCLR_REG] = intc_mode_field, | ||
200 | }; | ||
201 | |||
202 | static inline void _intc_enable(unsigned int irq, unsigned long handle) | ||
203 | { | ||
204 | struct intc_desc_int *d = get_intc_desc(irq); | ||
205 | unsigned long addr; | ||
206 | unsigned int cpu; | ||
207 | |||
208 | for (cpu = 0; cpu < SMP_NR(d, _INTC_ADDR_E(handle)); cpu++) { | ||
209 | addr = INTC_REG(d, _INTC_ADDR_E(handle), cpu); | ||
210 | intc_enable_fns[_INTC_MODE(handle)](addr, handle, intc_reg_fns\ | ||
211 | [_INTC_FN(handle)], irq); | ||
212 | } | ||
213 | } | ||
214 | |||
215 | static void intc_enable(unsigned int irq) | ||
216 | { | ||
217 | _intc_enable(irq, (unsigned long)get_irq_chip_data(irq)); | ||
218 | } | ||
219 | |||
220 | static void intc_disable(unsigned int irq) | ||
221 | { | ||
222 | struct intc_desc_int *d = get_intc_desc(irq); | ||
223 | unsigned long handle = (unsigned long) get_irq_chip_data(irq); | ||
224 | unsigned long addr; | ||
225 | unsigned int cpu; | ||
226 | |||
227 | for (cpu = 0; cpu < SMP_NR(d, _INTC_ADDR_D(handle)); cpu++) { | ||
228 | addr = INTC_REG(d, _INTC_ADDR_D(handle), cpu); | ||
229 | intc_disable_fns[_INTC_MODE(handle)](addr, handle,intc_reg_fns\ | ||
230 | [_INTC_FN(handle)], irq); | ||
231 | } | ||
232 | } | ||
233 | |||
234 | #if defined(CONFIG_CPU_SH3) || defined(CONFIG_CPU_SH4A) | ||
235 | static void intc_mask_ack(unsigned int irq) | ||
236 | { | ||
237 | struct intc_desc_int *d = get_intc_desc(irq); | ||
238 | unsigned long handle = ack_handle[irq]; | ||
239 | unsigned long addr; | ||
240 | |||
241 | intc_disable(irq); | ||
242 | |||
243 | /* read register and write zero only to the assocaited bit */ | ||
244 | |||
245 | if (handle) { | ||
246 | addr = INTC_REG(d, _INTC_ADDR_D(handle), 0); | ||
247 | switch (_INTC_FN(handle)) { | ||
248 | case REG_FN_MODIFY_BASE + 0: /* 8bit */ | ||
249 | ctrl_inb(addr); | ||
250 | ctrl_outb(0xff ^ set_field(0, 1, handle), addr); | ||
251 | break; | ||
252 | case REG_FN_MODIFY_BASE + 1: /* 16bit */ | ||
253 | ctrl_inw(addr); | ||
254 | ctrl_outw(0xffff ^ set_field(0, 1, handle), addr); | ||
255 | break; | ||
256 | case REG_FN_MODIFY_BASE + 3: /* 32bit */ | ||
257 | ctrl_inl(addr); | ||
258 | ctrl_outl(0xffffffff ^ set_field(0, 1, handle), addr); | ||
259 | break; | ||
260 | default: | ||
261 | BUG(); | ||
262 | break; | ||
263 | } | ||
264 | } | ||
265 | } | ||
266 | #endif | ||
267 | |||
268 | static struct intc_handle_int *intc_find_irq(struct intc_handle_int *hp, | ||
269 | unsigned int nr_hp, | ||
270 | unsigned int irq) | ||
271 | { | ||
272 | int i; | ||
273 | |||
274 | /* this doesn't scale well, but... | ||
275 | * | ||
276 | * this function should only be used for cerain uncommon | ||
277 | * operations such as intc_set_priority() and intc_set_sense() | ||
278 | * and in those rare cases performance doesn't matter that much. | ||
279 | * keeping the memory footprint low is more important. | ||
280 | * | ||
281 | * one rather simple way to speed this up and still keep the | ||
282 | * memory footprint down is to make sure the array is sorted | ||
283 | * and then perform a bisect to lookup the irq. | ||
284 | */ | ||
285 | |||
286 | for (i = 0; i < nr_hp; i++) { | ||
287 | if ((hp + i)->irq != irq) | ||
288 | continue; | ||
289 | |||
290 | return hp + i; | ||
291 | } | ||
292 | |||
293 | return NULL; | ||
294 | } | ||
295 | |||
296 | int intc_set_priority(unsigned int irq, unsigned int prio) | ||
297 | { | ||
298 | struct intc_desc_int *d = get_intc_desc(irq); | ||
299 | struct intc_handle_int *ihp; | ||
300 | |||
301 | if (!intc_prio_level[irq] || prio <= 1) | ||
302 | return -EINVAL; | ||
303 | |||
304 | ihp = intc_find_irq(d->prio, d->nr_prio, irq); | ||
305 | if (ihp) { | ||
306 | if (prio >= (1 << _INTC_WIDTH(ihp->handle))) | ||
307 | return -EINVAL; | ||
308 | |||
309 | intc_prio_level[irq] = prio; | ||
310 | |||
311 | /* | ||
312 | * only set secondary masking method directly | ||
313 | * primary masking method is using intc_prio_level[irq] | ||
314 | * priority level will be set during next enable() | ||
315 | */ | ||
316 | |||
317 | if (_INTC_FN(ihp->handle) != REG_FN_ERR) | ||
318 | _intc_enable(irq, ihp->handle); | ||
319 | } | ||
320 | return 0; | ||
321 | } | ||
322 | |||
323 | #define VALID(x) (x | 0x80) | ||
324 | |||
325 | static unsigned char intc_irq_sense_table[IRQ_TYPE_SENSE_MASK + 1] = { | ||
326 | [IRQ_TYPE_EDGE_FALLING] = VALID(0), | ||
327 | [IRQ_TYPE_EDGE_RISING] = VALID(1), | ||
328 | [IRQ_TYPE_LEVEL_LOW] = VALID(2), | ||
329 | /* SH7706, SH7707 and SH7709 do not support high level triggered */ | ||
330 | #if !defined(CONFIG_CPU_SUBTYPE_SH7706) && \ | ||
331 | !defined(CONFIG_CPU_SUBTYPE_SH7707) && \ | ||
332 | !defined(CONFIG_CPU_SUBTYPE_SH7709) | ||
333 | [IRQ_TYPE_LEVEL_HIGH] = VALID(3), | ||
334 | #endif | ||
335 | }; | ||
336 | |||
337 | static int intc_set_sense(unsigned int irq, unsigned int type) | ||
338 | { | ||
339 | struct intc_desc_int *d = get_intc_desc(irq); | ||
340 | unsigned char value = intc_irq_sense_table[type & IRQ_TYPE_SENSE_MASK]; | ||
341 | struct intc_handle_int *ihp; | ||
342 | unsigned long addr; | ||
343 | |||
344 | if (!value) | ||
345 | return -EINVAL; | ||
346 | |||
347 | ihp = intc_find_irq(d->sense, d->nr_sense, irq); | ||
348 | if (ihp) { | ||
349 | addr = INTC_REG(d, _INTC_ADDR_E(ihp->handle), 0); | ||
350 | intc_reg_fns[_INTC_FN(ihp->handle)](addr, ihp->handle, value); | ||
351 | } | ||
352 | return 0; | ||
353 | } | ||
354 | |||
355 | static unsigned int __init intc_get_reg(struct intc_desc_int *d, | ||
356 | unsigned long address) | ||
357 | { | ||
358 | unsigned int k; | ||
359 | |||
360 | for (k = 0; k < d->nr_reg; k++) { | ||
361 | if (d->reg[k] == address) | ||
362 | return k; | ||
363 | } | ||
364 | |||
365 | BUG(); | ||
366 | return 0; | ||
367 | } | ||
368 | |||
369 | static intc_enum __init intc_grp_id(struct intc_desc *desc, | ||
370 | intc_enum enum_id) | ||
371 | { | ||
372 | struct intc_group *g = desc->groups; | ||
373 | unsigned int i, j; | ||
374 | |||
375 | for (i = 0; g && enum_id && i < desc->nr_groups; i++) { | ||
376 | g = desc->groups + i; | ||
377 | |||
378 | for (j = 0; g->enum_ids[j]; j++) { | ||
379 | if (g->enum_ids[j] != enum_id) | ||
380 | continue; | ||
381 | |||
382 | return g->enum_id; | ||
383 | } | ||
384 | } | ||
385 | |||
386 | return 0; | ||
387 | } | ||
388 | |||
389 | static unsigned int __init intc_mask_data(struct intc_desc *desc, | ||
390 | struct intc_desc_int *d, | ||
391 | intc_enum enum_id, int do_grps) | ||
392 | { | ||
393 | struct intc_mask_reg *mr = desc->mask_regs; | ||
394 | unsigned int i, j, fn, mode; | ||
395 | unsigned long reg_e, reg_d; | ||
396 | |||
397 | for (i = 0; mr && enum_id && i < desc->nr_mask_regs; i++) { | ||
398 | mr = desc->mask_regs + i; | ||
399 | |||
400 | for (j = 0; j < ARRAY_SIZE(mr->enum_ids); j++) { | ||
401 | if (mr->enum_ids[j] != enum_id) | ||
402 | continue; | ||
403 | |||
404 | if (mr->set_reg && mr->clr_reg) { | ||
405 | fn = REG_FN_WRITE_BASE; | ||
406 | mode = MODE_DUAL_REG; | ||
407 | reg_e = mr->clr_reg; | ||
408 | reg_d = mr->set_reg; | ||
409 | } else { | ||
410 | fn = REG_FN_MODIFY_BASE; | ||
411 | if (mr->set_reg) { | ||
412 | mode = MODE_ENABLE_REG; | ||
413 | reg_e = mr->set_reg; | ||
414 | reg_d = mr->set_reg; | ||
415 | } else { | ||
416 | mode = MODE_MASK_REG; | ||
417 | reg_e = mr->clr_reg; | ||
418 | reg_d = mr->clr_reg; | ||
419 | } | ||
420 | } | ||
421 | |||
422 | fn += (mr->reg_width >> 3) - 1; | ||
423 | return _INTC_MK(fn, mode, | ||
424 | intc_get_reg(d, reg_e), | ||
425 | intc_get_reg(d, reg_d), | ||
426 | 1, | ||
427 | (mr->reg_width - 1) - j); | ||
428 | } | ||
429 | } | ||
430 | |||
431 | if (do_grps) | ||
432 | return intc_mask_data(desc, d, intc_grp_id(desc, enum_id), 0); | ||
433 | |||
434 | return 0; | ||
435 | } | ||
436 | |||
437 | static unsigned int __init intc_prio_data(struct intc_desc *desc, | ||
438 | struct intc_desc_int *d, | ||
439 | intc_enum enum_id, int do_grps) | ||
440 | { | ||
441 | struct intc_prio_reg *pr = desc->prio_regs; | ||
442 | unsigned int i, j, fn, mode, bit; | ||
443 | unsigned long reg_e, reg_d; | ||
444 | |||
445 | for (i = 0; pr && enum_id && i < desc->nr_prio_regs; i++) { | ||
446 | pr = desc->prio_regs + i; | ||
447 | |||
448 | for (j = 0; j < ARRAY_SIZE(pr->enum_ids); j++) { | ||
449 | if (pr->enum_ids[j] != enum_id) | ||
450 | continue; | ||
451 | |||
452 | if (pr->set_reg && pr->clr_reg) { | ||
453 | fn = REG_FN_WRITE_BASE; | ||
454 | mode = MODE_PCLR_REG; | ||
455 | reg_e = pr->set_reg; | ||
456 | reg_d = pr->clr_reg; | ||
457 | } else { | ||
458 | fn = REG_FN_MODIFY_BASE; | ||
459 | mode = MODE_PRIO_REG; | ||
460 | if (!pr->set_reg) | ||
461 | BUG(); | ||
462 | reg_e = pr->set_reg; | ||
463 | reg_d = pr->set_reg; | ||
464 | } | ||
465 | |||
466 | fn += (pr->reg_width >> 3) - 1; | ||
467 | |||
468 | BUG_ON((j + 1) * pr->field_width > pr->reg_width); | ||
469 | |||
470 | bit = pr->reg_width - ((j + 1) * pr->field_width); | ||
471 | |||
472 | return _INTC_MK(fn, mode, | ||
473 | intc_get_reg(d, reg_e), | ||
474 | intc_get_reg(d, reg_d), | ||
475 | pr->field_width, bit); | ||
476 | } | ||
477 | } | ||
478 | |||
479 | if (do_grps) | ||
480 | return intc_prio_data(desc, d, intc_grp_id(desc, enum_id), 0); | ||
481 | |||
482 | return 0; | ||
483 | } | ||
484 | |||
485 | #if defined(CONFIG_CPU_SH3) || defined(CONFIG_CPU_SH4A) | ||
486 | static unsigned int __init intc_ack_data(struct intc_desc *desc, | ||
487 | struct intc_desc_int *d, | ||
488 | intc_enum enum_id) | ||
489 | { | ||
490 | struct intc_mask_reg *mr = desc->ack_regs; | ||
491 | unsigned int i, j, fn, mode; | ||
492 | unsigned long reg_e, reg_d; | ||
493 | |||
494 | for (i = 0; mr && enum_id && i < desc->nr_ack_regs; i++) { | ||
495 | mr = desc->ack_regs + i; | ||
496 | |||
497 | for (j = 0; j < ARRAY_SIZE(mr->enum_ids); j++) { | ||
498 | if (mr->enum_ids[j] != enum_id) | ||
499 | continue; | ||
500 | |||
501 | fn = REG_FN_MODIFY_BASE; | ||
502 | mode = MODE_ENABLE_REG; | ||
503 | reg_e = mr->set_reg; | ||
504 | reg_d = mr->set_reg; | ||
505 | |||
506 | fn += (mr->reg_width >> 3) - 1; | ||
507 | return _INTC_MK(fn, mode, | ||
508 | intc_get_reg(d, reg_e), | ||
509 | intc_get_reg(d, reg_d), | ||
510 | 1, | ||
511 | (mr->reg_width - 1) - j); | ||
512 | } | ||
513 | } | ||
514 | |||
515 | return 0; | ||
516 | } | ||
517 | #endif | ||
518 | |||
519 | static unsigned int __init intc_sense_data(struct intc_desc *desc, | ||
520 | struct intc_desc_int *d, | ||
521 | intc_enum enum_id) | ||
522 | { | ||
523 | struct intc_sense_reg *sr = desc->sense_regs; | ||
524 | unsigned int i, j, fn, bit; | ||
525 | |||
526 | for (i = 0; sr && enum_id && i < desc->nr_sense_regs; i++) { | ||
527 | sr = desc->sense_regs + i; | ||
528 | |||
529 | for (j = 0; j < ARRAY_SIZE(sr->enum_ids); j++) { | ||
530 | if (sr->enum_ids[j] != enum_id) | ||
531 | continue; | ||
532 | |||
533 | fn = REG_FN_MODIFY_BASE; | ||
534 | fn += (sr->reg_width >> 3) - 1; | ||
535 | |||
536 | BUG_ON((j + 1) * sr->field_width > sr->reg_width); | ||
537 | |||
538 | bit = sr->reg_width - ((j + 1) * sr->field_width); | ||
539 | |||
540 | return _INTC_MK(fn, 0, intc_get_reg(d, sr->reg), | ||
541 | 0, sr->field_width, bit); | ||
542 | } | ||
543 | } | ||
544 | |||
545 | return 0; | ||
546 | } | ||
547 | |||
548 | static void __init intc_register_irq(struct intc_desc *desc, | ||
549 | struct intc_desc_int *d, | ||
550 | intc_enum enum_id, | ||
551 | unsigned int irq) | ||
552 | { | ||
553 | struct intc_handle_int *hp; | ||
554 | unsigned int data[2], primary; | ||
555 | |||
556 | /* Prefer single interrupt source bitmap over other combinations: | ||
557 | * 1. bitmap, single interrupt source | ||
558 | * 2. priority, single interrupt source | ||
559 | * 3. bitmap, multiple interrupt sources (groups) | ||
560 | * 4. priority, multiple interrupt sources (groups) | ||
561 | */ | ||
562 | |||
563 | data[0] = intc_mask_data(desc, d, enum_id, 0); | ||
564 | data[1] = intc_prio_data(desc, d, enum_id, 0); | ||
565 | |||
566 | primary = 0; | ||
567 | if (!data[0] && data[1]) | ||
568 | primary = 1; | ||
569 | |||
570 | data[0] = data[0] ? data[0] : intc_mask_data(desc, d, enum_id, 1); | ||
571 | data[1] = data[1] ? data[1] : intc_prio_data(desc, d, enum_id, 1); | ||
572 | |||
573 | if (!data[primary]) | ||
574 | primary ^= 1; | ||
575 | |||
576 | BUG_ON(!data[primary]); /* must have primary masking method */ | ||
577 | |||
578 | disable_irq_nosync(irq); | ||
579 | set_irq_chip_and_handler_name(irq, &d->chip, | ||
580 | handle_level_irq, "level"); | ||
581 | set_irq_chip_data(irq, (void *)data[primary]); | ||
582 | |||
583 | /* set priority level | ||
584 | * - this needs to be at least 2 for 5-bit priorities on 7780 | ||
585 | */ | ||
586 | intc_prio_level[irq] = 2; | ||
587 | |||
588 | /* enable secondary masking method if present */ | ||
589 | if (data[!primary]) | ||
590 | _intc_enable(irq, data[!primary]); | ||
591 | |||
592 | /* add irq to d->prio list if priority is available */ | ||
593 | if (data[1]) { | ||
594 | hp = d->prio + d->nr_prio; | ||
595 | hp->irq = irq; | ||
596 | hp->handle = data[1]; | ||
597 | |||
598 | if (primary) { | ||
599 | /* | ||
600 | * only secondary priority should access registers, so | ||
601 | * set _INTC_FN(h) = REG_FN_ERR for intc_set_priority() | ||
602 | */ | ||
603 | |||
604 | hp->handle &= ~_INTC_MK(0x0f, 0, 0, 0, 0, 0); | ||
605 | hp->handle |= _INTC_MK(REG_FN_ERR, 0, 0, 0, 0, 0); | ||
606 | } | ||
607 | d->nr_prio++; | ||
608 | } | ||
609 | |||
610 | /* add irq to d->sense list if sense is available */ | ||
611 | data[0] = intc_sense_data(desc, d, enum_id); | ||
612 | if (data[0]) { | ||
613 | (d->sense + d->nr_sense)->irq = irq; | ||
614 | (d->sense + d->nr_sense)->handle = data[0]; | ||
615 | d->nr_sense++; | ||
616 | } | ||
617 | |||
618 | /* irq should be disabled by default */ | ||
619 | d->chip.mask(irq); | ||
620 | |||
621 | #if defined(CONFIG_CPU_SH3) || defined(CONFIG_CPU_SH4A) | ||
622 | if (desc->ack_regs) | ||
623 | ack_handle[irq] = intc_ack_data(desc, d, enum_id); | ||
624 | #endif | ||
625 | } | ||
626 | |||
627 | static unsigned int __init save_reg(struct intc_desc_int *d, | ||
628 | unsigned int cnt, | ||
629 | unsigned long value, | ||
630 | unsigned int smp) | ||
631 | { | ||
632 | if (value) { | ||
633 | d->reg[cnt] = value; | ||
634 | #ifdef CONFIG_SMP | ||
635 | d->smp[cnt] = smp; | ||
636 | #endif | ||
637 | return 1; | ||
638 | } | ||
639 | |||
640 | return 0; | ||
641 | } | ||
642 | |||
643 | |||
644 | void __init register_intc_controller(struct intc_desc *desc) | ||
645 | { | ||
646 | unsigned int i, k, smp; | ||
647 | struct intc_desc_int *d; | ||
648 | |||
649 | d = alloc_bootmem(sizeof(*d)); | ||
650 | |||
651 | d->nr_reg = desc->mask_regs ? desc->nr_mask_regs * 2 : 0; | ||
652 | d->nr_reg += desc->prio_regs ? desc->nr_prio_regs * 2 : 0; | ||
653 | d->nr_reg += desc->sense_regs ? desc->nr_sense_regs : 0; | ||
654 | |||
655 | #if defined(CONFIG_CPU_SH3) || defined(CONFIG_CPU_SH4A) | ||
656 | d->nr_reg += desc->ack_regs ? desc->nr_ack_regs : 0; | ||
657 | #endif | ||
658 | d->reg = alloc_bootmem(d->nr_reg * sizeof(*d->reg)); | ||
659 | #ifdef CONFIG_SMP | ||
660 | d->smp = alloc_bootmem(d->nr_reg * sizeof(*d->smp)); | ||
661 | #endif | ||
662 | k = 0; | ||
663 | |||
664 | if (desc->mask_regs) { | ||
665 | for (i = 0; i < desc->nr_mask_regs; i++) { | ||
666 | smp = IS_SMP(desc->mask_regs[i]); | ||
667 | k += save_reg(d, k, desc->mask_regs[i].set_reg, smp); | ||
668 | k += save_reg(d, k, desc->mask_regs[i].clr_reg, smp); | ||
669 | } | ||
670 | } | ||
671 | |||
672 | if (desc->prio_regs) { | ||
673 | d->prio = alloc_bootmem(desc->nr_vectors * sizeof(*d->prio)); | ||
674 | |||
675 | for (i = 0; i < desc->nr_prio_regs; i++) { | ||
676 | smp = IS_SMP(desc->prio_regs[i]); | ||
677 | k += save_reg(d, k, desc->prio_regs[i].set_reg, smp); | ||
678 | k += save_reg(d, k, desc->prio_regs[i].clr_reg, smp); | ||
679 | } | ||
680 | } | ||
681 | |||
682 | if (desc->sense_regs) { | ||
683 | d->sense = alloc_bootmem(desc->nr_vectors * sizeof(*d->sense)); | ||
684 | |||
685 | for (i = 0; i < desc->nr_sense_regs; i++) { | ||
686 | k += save_reg(d, k, desc->sense_regs[i].reg, 0); | ||
687 | } | ||
688 | } | ||
689 | |||
690 | d->chip.name = desc->name; | ||
691 | d->chip.mask = intc_disable; | ||
692 | d->chip.unmask = intc_enable; | ||
693 | d->chip.mask_ack = intc_disable; | ||
694 | d->chip.set_type = intc_set_sense; | ||
695 | |||
696 | #if defined(CONFIG_CPU_SH3) || defined(CONFIG_CPU_SH4A) | ||
697 | if (desc->ack_regs) { | ||
698 | for (i = 0; i < desc->nr_ack_regs; i++) | ||
699 | k += save_reg(d, k, desc->ack_regs[i].set_reg, 0); | ||
700 | |||
701 | d->chip.mask_ack = intc_mask_ack; | ||
702 | } | ||
703 | #endif | ||
704 | |||
705 | BUG_ON(k > 256); /* _INTC_ADDR_E() and _INTC_ADDR_D() are 8 bits */ | ||
706 | |||
707 | for (i = 0; i < desc->nr_vectors; i++) { | ||
708 | struct intc_vect *vect = desc->vectors + i; | ||
709 | |||
710 | intc_register_irq(desc, d, vect->enum_id, evt2irq(vect->vect)); | ||
711 | } | ||
712 | } | ||
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 | ||
39 | static void enable_ipr_irq(unsigned int irq) | 39 | static 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 | ||
17 | void __raw_readsl(unsigned long addr, void *datap, int len) | 17 | void __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 | } |
64 | EXPORT_SYMBOL(__raw_readsl); | 64 | EXPORT_SYMBOL(__raw_readsl); |
65 | 65 | ||
66 | void __raw_writesl(unsigned long addr, const void *data, int len) | 66 | void __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; |