diff options
Diffstat (limited to 'arch')
301 files changed, 2979 insertions, 3149 deletions
diff --git a/arch/Kconfig b/arch/Kconfig index 26b0e2397a57..4b0669cbb3b0 100644 --- a/arch/Kconfig +++ b/arch/Kconfig | |||
@@ -178,4 +178,7 @@ config HAVE_ARCH_MUTEX_CPU_RELAX | |||
178 | config HAVE_RCU_TABLE_FREE | 178 | config HAVE_RCU_TABLE_FREE |
179 | bool | 179 | bool |
180 | 180 | ||
181 | config ARCH_HAVE_NMI_SAFE_CMPXCHG | ||
182 | bool | ||
183 | |||
181 | source "kernel/gcov/Kconfig" | 184 | source "kernel/gcov/Kconfig" |
diff --git a/arch/alpha/Kconfig b/arch/alpha/Kconfig index ca2da8da6e9c..60cde53d266c 100644 --- a/arch/alpha/Kconfig +++ b/arch/alpha/Kconfig | |||
@@ -14,6 +14,7 @@ config ALPHA | |||
14 | select AUTO_IRQ_AFFINITY if SMP | 14 | select AUTO_IRQ_AFFINITY if SMP |
15 | select GENERIC_IRQ_SHOW | 15 | select GENERIC_IRQ_SHOW |
16 | select ARCH_WANT_OPTIONAL_GPIOLIB | 16 | select ARCH_WANT_OPTIONAL_GPIOLIB |
17 | select ARCH_HAVE_NMI_SAFE_CMPXCHG | ||
17 | help | 18 | help |
18 | The Alpha is a 64-bit general-purpose processor designed and | 19 | The Alpha is a 64-bit general-purpose processor designed and |
19 | marketed by the Digital Equipment Corporation of blessed memory, | 20 | marketed by the Digital Equipment Corporation of blessed memory, |
diff --git a/arch/alpha/kernel/sys_alcor.c b/arch/alpha/kernel/sys_alcor.c index 0e1439904cdb..8606d77e5163 100644 --- a/arch/alpha/kernel/sys_alcor.c +++ b/arch/alpha/kernel/sys_alcor.c | |||
@@ -183,7 +183,7 @@ alcor_init_irq(void) | |||
183 | */ | 183 | */ |
184 | 184 | ||
185 | static int __init | 185 | static int __init |
186 | alcor_map_irq(struct pci_dev *dev, u8 slot, u8 pin) | 186 | alcor_map_irq(const struct pci_dev *dev, u8 slot, u8 pin) |
187 | { | 187 | { |
188 | static char irq_tab[7][5] __initdata = { | 188 | static char irq_tab[7][5] __initdata = { |
189 | /*INT INTA INTB INTC INTD */ | 189 | /*INT INTA INTB INTC INTD */ |
diff --git a/arch/alpha/kernel/sys_cabriolet.c b/arch/alpha/kernel/sys_cabriolet.c index c8c112d51584..1029619fb6c0 100644 --- a/arch/alpha/kernel/sys_cabriolet.c +++ b/arch/alpha/kernel/sys_cabriolet.c | |||
@@ -175,7 +175,7 @@ pc164_init_irq(void) | |||
175 | */ | 175 | */ |
176 | 176 | ||
177 | static inline int __init | 177 | static inline int __init |
178 | eb66p_map_irq(struct pci_dev *dev, u8 slot, u8 pin) | 178 | eb66p_map_irq(const struct pci_dev *dev, u8 slot, u8 pin) |
179 | { | 179 | { |
180 | static char irq_tab[5][5] __initdata = { | 180 | static char irq_tab[5][5] __initdata = { |
181 | /*INT INTA INTB INTC INTD */ | 181 | /*INT INTA INTB INTC INTD */ |
@@ -205,7 +205,7 @@ eb66p_map_irq(struct pci_dev *dev, u8 slot, u8 pin) | |||
205 | */ | 205 | */ |
206 | 206 | ||
207 | static inline int __init | 207 | static inline int __init |
208 | cabriolet_map_irq(struct pci_dev *dev, u8 slot, u8 pin) | 208 | cabriolet_map_irq(const struct pci_dev *dev, u8 slot, u8 pin) |
209 | { | 209 | { |
210 | static char irq_tab[5][5] __initdata = { | 210 | static char irq_tab[5][5] __initdata = { |
211 | /*INT INTA INTB INTC INTD */ | 211 | /*INT INTA INTB INTC INTD */ |
@@ -289,7 +289,7 @@ cia_cab_init_pci(void) | |||
289 | */ | 289 | */ |
290 | 290 | ||
291 | static inline int __init | 291 | static inline int __init |
292 | alphapc164_map_irq(struct pci_dev *dev, u8 slot, u8 pin) | 292 | alphapc164_map_irq(const struct pci_dev *dev, u8 slot, u8 pin) |
293 | { | 293 | { |
294 | static char irq_tab[7][5] __initdata = { | 294 | static char irq_tab[7][5] __initdata = { |
295 | /*INT INTA INTB INTC INTD */ | 295 | /*INT INTA INTB INTC INTD */ |
diff --git a/arch/alpha/kernel/sys_dp264.c b/arch/alpha/kernel/sys_dp264.c index f8856829c22a..bb7f0c7cb17a 100644 --- a/arch/alpha/kernel/sys_dp264.c +++ b/arch/alpha/kernel/sys_dp264.c | |||
@@ -382,7 +382,7 @@ isa_irq_fixup(struct pci_dev *dev, int irq) | |||
382 | } | 382 | } |
383 | 383 | ||
384 | static int __init | 384 | static int __init |
385 | dp264_map_irq(struct pci_dev *dev, u8 slot, u8 pin) | 385 | dp264_map_irq(const struct pci_dev *dev, u8 slot, u8 pin) |
386 | { | 386 | { |
387 | static char irq_tab[6][5] __initdata = { | 387 | static char irq_tab[6][5] __initdata = { |
388 | /*INT INTA INTB INTC INTD */ | 388 | /*INT INTA INTB INTC INTD */ |
@@ -404,7 +404,7 @@ dp264_map_irq(struct pci_dev *dev, u8 slot, u8 pin) | |||
404 | } | 404 | } |
405 | 405 | ||
406 | static int __init | 406 | static int __init |
407 | monet_map_irq(struct pci_dev *dev, u8 slot, u8 pin) | 407 | monet_map_irq(const struct pci_dev *dev, u8 slot, u8 pin) |
408 | { | 408 | { |
409 | static char irq_tab[13][5] __initdata = { | 409 | static char irq_tab[13][5] __initdata = { |
410 | /*INT INTA INTB INTC INTD */ | 410 | /*INT INTA INTB INTC INTD */ |
@@ -466,7 +466,7 @@ monet_swizzle(struct pci_dev *dev, u8 *pinp) | |||
466 | } | 466 | } |
467 | 467 | ||
468 | static int __init | 468 | static int __init |
469 | webbrick_map_irq(struct pci_dev *dev, u8 slot, u8 pin) | 469 | webbrick_map_irq(const struct pci_dev *dev, u8 slot, u8 pin) |
470 | { | 470 | { |
471 | static char irq_tab[13][5] __initdata = { | 471 | static char irq_tab[13][5] __initdata = { |
472 | /*INT INTA INTB INTC INTD */ | 472 | /*INT INTA INTB INTC INTD */ |
@@ -488,7 +488,7 @@ webbrick_map_irq(struct pci_dev *dev, u8 slot, u8 pin) | |||
488 | } | 488 | } |
489 | 489 | ||
490 | static int __init | 490 | static int __init |
491 | clipper_map_irq(struct pci_dev *dev, u8 slot, u8 pin) | 491 | clipper_map_irq(const struct pci_dev *dev, u8 slot, u8 pin) |
492 | { | 492 | { |
493 | static char irq_tab[7][5] __initdata = { | 493 | static char irq_tab[7][5] __initdata = { |
494 | /*INT INTA INTB INTC INTD */ | 494 | /*INT INTA INTB INTC INTD */ |
diff --git a/arch/alpha/kernel/sys_eb64p.c b/arch/alpha/kernel/sys_eb64p.c index a7a23b40eec5..3c6c13cd8b19 100644 --- a/arch/alpha/kernel/sys_eb64p.c +++ b/arch/alpha/kernel/sys_eb64p.c | |||
@@ -169,7 +169,7 @@ eb64p_init_irq(void) | |||
169 | */ | 169 | */ |
170 | 170 | ||
171 | static int __init | 171 | static int __init |
172 | eb64p_map_irq(struct pci_dev *dev, u8 slot, u8 pin) | 172 | eb64p_map_irq(const struct pci_dev *dev, u8 slot, u8 pin) |
173 | { | 173 | { |
174 | static char irq_tab[5][5] __initdata = { | 174 | static char irq_tab[5][5] __initdata = { |
175 | /*INT INTA INTB INTC INTD */ | 175 | /*INT INTA INTB INTC INTD */ |
diff --git a/arch/alpha/kernel/sys_eiger.c b/arch/alpha/kernel/sys_eiger.c index a60cd5b2621e..35f480db7719 100644 --- a/arch/alpha/kernel/sys_eiger.c +++ b/arch/alpha/kernel/sys_eiger.c | |||
@@ -144,7 +144,7 @@ eiger_init_irq(void) | |||
144 | } | 144 | } |
145 | 145 | ||
146 | static int __init | 146 | static int __init |
147 | eiger_map_irq(struct pci_dev *dev, u8 slot, u8 pin) | 147 | eiger_map_irq(const struct pci_dev *dev, u8 slot, u8 pin) |
148 | { | 148 | { |
149 | u8 irq_orig; | 149 | u8 irq_orig; |
150 | 150 | ||
diff --git a/arch/alpha/kernel/sys_marvel.c b/arch/alpha/kernel/sys_marvel.c index 388b99d1779d..95cfc83ece8f 100644 --- a/arch/alpha/kernel/sys_marvel.c +++ b/arch/alpha/kernel/sys_marvel.c | |||
@@ -318,7 +318,7 @@ marvel_init_irq(void) | |||
318 | } | 318 | } |
319 | 319 | ||
320 | static int | 320 | static int |
321 | marvel_map_irq(struct pci_dev *dev, u8 slot, u8 pin) | 321 | marvel_map_irq(const struct pci_dev *dev, u8 slot, u8 pin) |
322 | { | 322 | { |
323 | struct pci_controller *hose = dev->sysdata; | 323 | struct pci_controller *hose = dev->sysdata; |
324 | struct io7_port *io7_port = hose->sysdata; | 324 | struct io7_port *io7_port = hose->sysdata; |
diff --git a/arch/alpha/kernel/sys_miata.c b/arch/alpha/kernel/sys_miata.c index 61ccd95579ec..258da684670b 100644 --- a/arch/alpha/kernel/sys_miata.c +++ b/arch/alpha/kernel/sys_miata.c | |||
@@ -151,7 +151,7 @@ miata_init_irq(void) | |||
151 | */ | 151 | */ |
152 | 152 | ||
153 | static int __init | 153 | static int __init |
154 | miata_map_irq(struct pci_dev *dev, u8 slot, u8 pin) | 154 | miata_map_irq(const struct pci_dev *dev, u8 slot, u8 pin) |
155 | { | 155 | { |
156 | static char irq_tab[18][5] __initdata = { | 156 | static char irq_tab[18][5] __initdata = { |
157 | /*INT INTA INTB INTC INTD */ | 157 | /*INT INTA INTB INTC INTD */ |
diff --git a/arch/alpha/kernel/sys_mikasa.c b/arch/alpha/kernel/sys_mikasa.c index 0e6e4697a025..c0fd7284dec3 100644 --- a/arch/alpha/kernel/sys_mikasa.c +++ b/arch/alpha/kernel/sys_mikasa.c | |||
@@ -146,7 +146,7 @@ mikasa_init_irq(void) | |||
146 | */ | 146 | */ |
147 | 147 | ||
148 | static int __init | 148 | static int __init |
149 | mikasa_map_irq(struct pci_dev *dev, u8 slot, u8 pin) | 149 | mikasa_map_irq(const struct pci_dev *dev, u8 slot, u8 pin) |
150 | { | 150 | { |
151 | static char irq_tab[8][5] __initdata = { | 151 | static char irq_tab[8][5] __initdata = { |
152 | /*INT INTA INTB INTC INTD */ | 152 | /*INT INTA INTB INTC INTD */ |
diff --git a/arch/alpha/kernel/sys_nautilus.c b/arch/alpha/kernel/sys_nautilus.c index 99c0f46f6b9c..4112200307c7 100644 --- a/arch/alpha/kernel/sys_nautilus.c +++ b/arch/alpha/kernel/sys_nautilus.c | |||
@@ -65,7 +65,7 @@ nautilus_init_irq(void) | |||
65 | } | 65 | } |
66 | 66 | ||
67 | static int __init | 67 | static int __init |
68 | nautilus_map_irq(struct pci_dev *dev, u8 slot, u8 pin) | 68 | nautilus_map_irq(const struct pci_dev *dev, u8 slot, u8 pin) |
69 | { | 69 | { |
70 | /* Preserve the IRQ set up by the console. */ | 70 | /* Preserve the IRQ set up by the console. */ |
71 | 71 | ||
diff --git a/arch/alpha/kernel/sys_noritake.c b/arch/alpha/kernel/sys_noritake.c index a00ac7087167..21725283cdd7 100644 --- a/arch/alpha/kernel/sys_noritake.c +++ b/arch/alpha/kernel/sys_noritake.c | |||
@@ -194,7 +194,7 @@ noritake_init_irq(void) | |||
194 | */ | 194 | */ |
195 | 195 | ||
196 | static int __init | 196 | static int __init |
197 | noritake_map_irq(struct pci_dev *dev, u8 slot, u8 pin) | 197 | noritake_map_irq(const struct pci_dev *dev, u8 slot, u8 pin) |
198 | { | 198 | { |
199 | static char irq_tab[15][5] __initdata = { | 199 | static char irq_tab[15][5] __initdata = { |
200 | /*INT INTA INTB INTC INTD */ | 200 | /*INT INTA INTB INTC INTD */ |
diff --git a/arch/alpha/kernel/sys_rawhide.c b/arch/alpha/kernel/sys_rawhide.c index 7f52161f3d88..a125d6bea7e1 100644 --- a/arch/alpha/kernel/sys_rawhide.c +++ b/arch/alpha/kernel/sys_rawhide.c | |||
@@ -223,7 +223,7 @@ rawhide_init_irq(void) | |||
223 | */ | 223 | */ |
224 | 224 | ||
225 | static int __init | 225 | static int __init |
226 | rawhide_map_irq(struct pci_dev *dev, u8 slot, u8 pin) | 226 | rawhide_map_irq(const struct pci_dev *dev, u8 slot, u8 pin) |
227 | { | 227 | { |
228 | static char irq_tab[5][5] __initdata = { | 228 | static char irq_tab[5][5] __initdata = { |
229 | /*INT INTA INTB INTC INTD */ | 229 | /*INT INTA INTB INTC INTD */ |
diff --git a/arch/alpha/kernel/sys_ruffian.c b/arch/alpha/kernel/sys_ruffian.c index f33648e4e8cf..2581cbec6fc2 100644 --- a/arch/alpha/kernel/sys_ruffian.c +++ b/arch/alpha/kernel/sys_ruffian.c | |||
@@ -119,7 +119,7 @@ ruffian_kill_arch (int mode) | |||
119 | */ | 119 | */ |
120 | 120 | ||
121 | static int __init | 121 | static int __init |
122 | ruffian_map_irq(struct pci_dev *dev, u8 slot, u8 pin) | 122 | ruffian_map_irq(const struct pci_dev *dev, u8 slot, u8 pin) |
123 | { | 123 | { |
124 | static char irq_tab[11][5] __initdata = { | 124 | static char irq_tab[11][5] __initdata = { |
125 | /*INT INTA INTB INTC INTD */ | 125 | /*INT INTA INTB INTC INTD */ |
diff --git a/arch/alpha/kernel/sys_rx164.c b/arch/alpha/kernel/sys_rx164.c index 216d94d9c0c1..b172b27555a7 100644 --- a/arch/alpha/kernel/sys_rx164.c +++ b/arch/alpha/kernel/sys_rx164.c | |||
@@ -144,7 +144,7 @@ rx164_init_irq(void) | |||
144 | */ | 144 | */ |
145 | 145 | ||
146 | static int __init | 146 | static int __init |
147 | rx164_map_irq(struct pci_dev *dev, u8 slot, u8 pin) | 147 | rx164_map_irq(const struct pci_dev *dev, u8 slot, u8 pin) |
148 | { | 148 | { |
149 | #if 0 | 149 | #if 0 |
150 | static char irq_tab_pass1[6][5] __initdata = { | 150 | static char irq_tab_pass1[6][5] __initdata = { |
diff --git a/arch/alpha/kernel/sys_sable.c b/arch/alpha/kernel/sys_sable.c index da714e427c5f..98d1dbffe98f 100644 --- a/arch/alpha/kernel/sys_sable.c +++ b/arch/alpha/kernel/sys_sable.c | |||
@@ -194,7 +194,7 @@ sable_init_irq(void) | |||
194 | */ | 194 | */ |
195 | 195 | ||
196 | static int __init | 196 | static int __init |
197 | sable_map_irq(struct pci_dev *dev, u8 slot, u8 pin) | 197 | sable_map_irq(const struct pci_dev *dev, u8 slot, u8 pin) |
198 | { | 198 | { |
199 | static char irq_tab[9][5] __initdata = { | 199 | static char irq_tab[9][5] __initdata = { |
200 | /*INT INTA INTB INTC INTD */ | 200 | /*INT INTA INTB INTC INTD */ |
@@ -376,7 +376,7 @@ lynx_init_irq(void) | |||
376 | */ | 376 | */ |
377 | 377 | ||
378 | static int __init | 378 | static int __init |
379 | lynx_map_irq(struct pci_dev *dev, u8 slot, u8 pin) | 379 | lynx_map_irq(const struct pci_dev *dev, u8 slot, u8 pin) |
380 | { | 380 | { |
381 | static char irq_tab[19][5] __initdata = { | 381 | static char irq_tab[19][5] __initdata = { |
382 | /*INT INTA INTB INTC INTD */ | 382 | /*INT INTA INTB INTC INTD */ |
diff --git a/arch/alpha/kernel/sys_sio.c b/arch/alpha/kernel/sys_sio.c index 85b4aea01ef8..47bec1e97d1c 100644 --- a/arch/alpha/kernel/sys_sio.c +++ b/arch/alpha/kernel/sys_sio.c | |||
@@ -146,7 +146,7 @@ sio_fixup_irq_levels(unsigned int level_bits) | |||
146 | } | 146 | } |
147 | 147 | ||
148 | static inline int __init | 148 | static inline int __init |
149 | noname_map_irq(struct pci_dev *dev, u8 slot, u8 pin) | 149 | noname_map_irq(const struct pci_dev *dev, u8 slot, u8 pin) |
150 | { | 150 | { |
151 | /* | 151 | /* |
152 | * The Noname board has 5 PCI slots with each of the 4 | 152 | * The Noname board has 5 PCI slots with each of the 4 |
@@ -185,7 +185,7 @@ noname_map_irq(struct pci_dev *dev, u8 slot, u8 pin) | |||
185 | } | 185 | } |
186 | 186 | ||
187 | static inline int __init | 187 | static inline int __init |
188 | p2k_map_irq(struct pci_dev *dev, u8 slot, u8 pin) | 188 | p2k_map_irq(const struct pci_dev *dev, u8 slot, u8 pin) |
189 | { | 189 | { |
190 | static char irq_tab[][5] __initdata = { | 190 | static char irq_tab[][5] __initdata = { |
191 | /*INT A B C D */ | 191 | /*INT A B C D */ |
diff --git a/arch/alpha/kernel/sys_sx164.c b/arch/alpha/kernel/sys_sx164.c index 41d4ad4c7c44..73e1c317afcb 100644 --- a/arch/alpha/kernel/sys_sx164.c +++ b/arch/alpha/kernel/sys_sx164.c | |||
@@ -95,7 +95,7 @@ sx164_init_irq(void) | |||
95 | */ | 95 | */ |
96 | 96 | ||
97 | static int __init | 97 | static int __init |
98 | sx164_map_irq(struct pci_dev *dev, u8 slot, u8 pin) | 98 | sx164_map_irq(const struct pci_dev *dev, u8 slot, u8 pin) |
99 | { | 99 | { |
100 | static char irq_tab[5][5] __initdata = { | 100 | static char irq_tab[5][5] __initdata = { |
101 | /*INT INTA INTB INTC INTD */ | 101 | /*INT INTA INTB INTC INTD */ |
diff --git a/arch/alpha/kernel/sys_takara.c b/arch/alpha/kernel/sys_takara.c index a31f8cd9bd6b..2ae99ad6975e 100644 --- a/arch/alpha/kernel/sys_takara.c +++ b/arch/alpha/kernel/sys_takara.c | |||
@@ -157,7 +157,7 @@ takara_init_irq(void) | |||
157 | */ | 157 | */ |
158 | 158 | ||
159 | static int __init | 159 | static int __init |
160 | takara_map_irq_srm(struct pci_dev *dev, u8 slot, u8 pin) | 160 | takara_map_irq_srm(const struct pci_dev *dev, u8 slot, u8 pin) |
161 | { | 161 | { |
162 | static char irq_tab[15][5] __initdata = { | 162 | static char irq_tab[15][5] __initdata = { |
163 | { 16+3, 16+3, 16+3, 16+3, 16+3}, /* slot 6 == device 3 */ | 163 | { 16+3, 16+3, 16+3, 16+3, 16+3}, /* slot 6 == device 3 */ |
@@ -188,7 +188,7 @@ takara_map_irq_srm(struct pci_dev *dev, u8 slot, u8 pin) | |||
188 | } | 188 | } |
189 | 189 | ||
190 | static int __init | 190 | static int __init |
191 | takara_map_irq(struct pci_dev *dev, u8 slot, u8 pin) | 191 | takara_map_irq(const struct pci_dev *dev, u8 slot, u8 pin) |
192 | { | 192 | { |
193 | static char irq_tab[15][5] __initdata = { | 193 | static char irq_tab[15][5] __initdata = { |
194 | { 16+3, 16+3, 16+3, 16+3, 16+3}, /* slot 6 == device 3 */ | 194 | { 16+3, 16+3, 16+3, 16+3, 16+3}, /* slot 6 == device 3 */ |
diff --git a/arch/alpha/kernel/sys_titan.c b/arch/alpha/kernel/sys_titan.c index 6994407e242a..f47b30a2a117 100644 --- a/arch/alpha/kernel/sys_titan.c +++ b/arch/alpha/kernel/sys_titan.c | |||
@@ -305,7 +305,7 @@ titan_late_init(void) | |||
305 | } | 305 | } |
306 | 306 | ||
307 | static int __devinit | 307 | static int __devinit |
308 | titan_map_irq(struct pci_dev *dev, u8 slot, u8 pin) | 308 | titan_map_irq(const struct pci_dev *dev, u8 slot, u8 pin) |
309 | { | 309 | { |
310 | u8 intline; | 310 | u8 intline; |
311 | int irq; | 311 | int irq; |
diff --git a/arch/alpha/kernel/sys_wildfire.c b/arch/alpha/kernel/sys_wildfire.c index d92cdc715c65..17c85a65e7b0 100644 --- a/arch/alpha/kernel/sys_wildfire.c +++ b/arch/alpha/kernel/sys_wildfire.c | |||
@@ -290,7 +290,7 @@ wildfire_device_interrupt(unsigned long vector) | |||
290 | */ | 290 | */ |
291 | 291 | ||
292 | static int __init | 292 | static int __init |
293 | wildfire_map_irq(struct pci_dev *dev, u8 slot, u8 pin) | 293 | wildfire_map_irq(const struct pci_dev *dev, u8 slot, u8 pin) |
294 | { | 294 | { |
295 | static char irq_tab[8][5] __initdata = { | 295 | static char irq_tab[8][5] __initdata = { |
296 | /*INT INTA INTB INTC INTD */ | 296 | /*INT INTA INTB INTC INTD */ |
diff --git a/arch/arm/common/it8152.c b/arch/arm/common/it8152.c index 14ad62e16dd1..a7934ba9e1df 100644 --- a/arch/arm/common/it8152.c +++ b/arch/arm/common/it8152.c | |||
@@ -144,7 +144,7 @@ void it8152_irq_demux(unsigned int irq, struct irq_desc *desc) | |||
144 | } | 144 | } |
145 | 145 | ||
146 | /* mapping for on-chip devices */ | 146 | /* mapping for on-chip devices */ |
147 | int __init it8152_pci_map_irq(struct pci_dev *dev, u8 slot, u8 pin) | 147 | int __init it8152_pci_map_irq(const struct pci_dev *dev, u8 slot, u8 pin) |
148 | { | 148 | { |
149 | if ((dev->vendor == PCI_VENDOR_ID_ITE) && | 149 | if ((dev->vendor == PCI_VENDOR_ID_ITE) && |
150 | (dev->device == PCI_DEVICE_ID_ITE_8152)) { | 150 | (dev->device == PCI_DEVICE_ID_ITE_8152)) { |
diff --git a/arch/arm/include/asm/hardware/it8152.h b/arch/arm/include/asm/hardware/it8152.h index b2f95c72287c..b3fea38d55c6 100644 --- a/arch/arm/include/asm/hardware/it8152.h +++ b/arch/arm/include/asm/hardware/it8152.h | |||
@@ -105,7 +105,7 @@ struct pci_sys_data; | |||
105 | 105 | ||
106 | extern void it8152_irq_demux(unsigned int irq, struct irq_desc *desc); | 106 | extern void it8152_irq_demux(unsigned int irq, struct irq_desc *desc); |
107 | extern void it8152_init_irq(void); | 107 | extern void it8152_init_irq(void); |
108 | extern int it8152_pci_map_irq(struct pci_dev *dev, u8 slot, u8 pin); | 108 | extern int it8152_pci_map_irq(const struct pci_dev *dev, u8 slot, u8 pin); |
109 | extern int it8152_pci_setup(int nr, struct pci_sys_data *sys); | 109 | extern int it8152_pci_setup(int nr, struct pci_sys_data *sys); |
110 | extern struct pci_bus *it8152_pci_scan_bus(int nr, struct pci_sys_data *sys); | 110 | extern struct pci_bus *it8152_pci_scan_bus(int nr, struct pci_sys_data *sys); |
111 | 111 | ||
diff --git a/arch/arm/include/asm/mach/pci.h b/arch/arm/include/asm/mach/pci.h index 16330bd0657c..186efd4e05c9 100644 --- a/arch/arm/include/asm/mach/pci.h +++ b/arch/arm/include/asm/mach/pci.h | |||
@@ -25,7 +25,7 @@ struct hw_pci { | |||
25 | void (*preinit)(void); | 25 | void (*preinit)(void); |
26 | void (*postinit)(void); | 26 | void (*postinit)(void); |
27 | u8 (*swizzle)(struct pci_dev *dev, u8 *pin); | 27 | u8 (*swizzle)(struct pci_dev *dev, u8 *pin); |
28 | int (*map_irq)(struct pci_dev *dev, u8 slot, u8 pin); | 28 | int (*map_irq)(const struct pci_dev *dev, u8 slot, u8 pin); |
29 | }; | 29 | }; |
30 | 30 | ||
31 | /* | 31 | /* |
@@ -44,7 +44,7 @@ struct pci_sys_data { | |||
44 | /* Bridge swizzling */ | 44 | /* Bridge swizzling */ |
45 | u8 (*swizzle)(struct pci_dev *, u8 *); | 45 | u8 (*swizzle)(struct pci_dev *, u8 *); |
46 | /* IRQ mapping */ | 46 | /* IRQ mapping */ |
47 | int (*map_irq)(struct pci_dev *, u8, u8); | 47 | int (*map_irq)(const struct pci_dev *, u8, u8); |
48 | struct hw_pci *hw; | 48 | struct hw_pci *hw; |
49 | void *private_data; /* platform controller private data */ | 49 | void *private_data; /* platform controller private data */ |
50 | }; | 50 | }; |
diff --git a/arch/arm/kernel/bios32.c b/arch/arm/kernel/bios32.c index e4ee050aad7d..d6df359408f0 100644 --- a/arch/arm/kernel/bios32.c +++ b/arch/arm/kernel/bios32.c | |||
@@ -476,7 +476,7 @@ static u8 __devinit pcibios_swizzle(struct pci_dev *dev, u8 *pin) | |||
476 | /* | 476 | /* |
477 | * Map a slot/pin to an IRQ. | 477 | * Map a slot/pin to an IRQ. |
478 | */ | 478 | */ |
479 | static int pcibios_map_irq(struct pci_dev *dev, u8 slot, u8 pin) | 479 | static int pcibios_map_irq(const struct pci_dev *dev, u8 slot, u8 pin) |
480 | { | 480 | { |
481 | struct pci_sys_data *sys = dev->sysdata; | 481 | struct pci_sys_data *sys = dev->sysdata; |
482 | int irq = -1; | 482 | int irq = -1; |
diff --git a/arch/arm/kernel/process.c b/arch/arm/kernel/process.c index 5e1e54197227..1a347f481e5e 100644 --- a/arch/arm/kernel/process.c +++ b/arch/arm/kernel/process.c | |||
@@ -30,6 +30,7 @@ | |||
30 | #include <linux/uaccess.h> | 30 | #include <linux/uaccess.h> |
31 | #include <linux/random.h> | 31 | #include <linux/random.h> |
32 | #include <linux/hw_breakpoint.h> | 32 | #include <linux/hw_breakpoint.h> |
33 | #include <linux/cpuidle.h> | ||
33 | 34 | ||
34 | #include <asm/cacheflush.h> | 35 | #include <asm/cacheflush.h> |
35 | #include <asm/leds.h> | 36 | #include <asm/leds.h> |
@@ -196,7 +197,8 @@ void cpu_idle(void) | |||
196 | cpu_relax(); | 197 | cpu_relax(); |
197 | } else { | 198 | } else { |
198 | stop_critical_timings(); | 199 | stop_critical_timings(); |
199 | pm_idle(); | 200 | if (cpuidle_idle_call()) |
201 | pm_idle(); | ||
200 | start_critical_timings(); | 202 | start_critical_timings(); |
201 | /* | 203 | /* |
202 | * This will eventually be removed - pm_idle | 204 | * This will eventually be removed - pm_idle |
diff --git a/arch/arm/mach-cns3xxx/pcie.c b/arch/arm/mach-cns3xxx/pcie.c index a4ec080908b8..06fd25d70aec 100644 --- a/arch/arm/mach-cns3xxx/pcie.c +++ b/arch/arm/mach-cns3xxx/pcie.c | |||
@@ -172,7 +172,7 @@ static struct pci_bus *cns3xxx_pci_scan_bus(int nr, struct pci_sys_data *sys) | |||
172 | return pci_scan_bus(sys->busnr, &cns3xxx_pcie_ops, sys); | 172 | return pci_scan_bus(sys->busnr, &cns3xxx_pcie_ops, sys); |
173 | } | 173 | } |
174 | 174 | ||
175 | static int cns3xxx_pcie_map_irq(struct pci_dev *dev, u8 slot, u8 pin) | 175 | static int cns3xxx_pcie_map_irq(const struct pci_dev *dev, u8 slot, u8 pin) |
176 | { | 176 | { |
177 | struct cns3xxx_pcie *cnspci = pdev_to_cnspci(dev); | 177 | struct cns3xxx_pcie *cnspci = pdev_to_cnspci(dev); |
178 | int irq = cnspci->irqs[slot]; | 178 | int irq = cnspci->irqs[slot]; |
diff --git a/arch/arm/mach-dove/pcie.c b/arch/arm/mach-dove/pcie.c index c2f1c4767f21..aa2b3a09a51d 100644 --- a/arch/arm/mach-dove/pcie.c +++ b/arch/arm/mach-dove/pcie.c | |||
@@ -193,7 +193,7 @@ dove_pcie_scan_bus(int nr, struct pci_sys_data *sys) | |||
193 | return bus; | 193 | return bus; |
194 | } | 194 | } |
195 | 195 | ||
196 | static int __init dove_pcie_map_irq(struct pci_dev *dev, u8 slot, u8 pin) | 196 | static int __init dove_pcie_map_irq(const struct pci_dev *dev, u8 slot, u8 pin) |
197 | { | 197 | { |
198 | struct pcie_port *pp = bus_to_port(dev->bus->number); | 198 | struct pcie_port *pp = bus_to_port(dev->bus->number); |
199 | 199 | ||
diff --git a/arch/arm/mach-footbridge/cats-pci.c b/arch/arm/mach-footbridge/cats-pci.c index ae3e1c8c7583..32321f66dec4 100644 --- a/arch/arm/mach-footbridge/cats-pci.c +++ b/arch/arm/mach-footbridge/cats-pci.c | |||
@@ -16,7 +16,7 @@ | |||
16 | /* cats host-specific stuff */ | 16 | /* cats host-specific stuff */ |
17 | static int irqmap_cats[] __initdata = { IRQ_PCI, IRQ_IN0, IRQ_IN1, IRQ_IN3 }; | 17 | static int irqmap_cats[] __initdata = { IRQ_PCI, IRQ_IN0, IRQ_IN1, IRQ_IN3 }; |
18 | 18 | ||
19 | static int __init cats_map_irq(struct pci_dev *dev, u8 slot, u8 pin) | 19 | static int __init cats_map_irq(const struct pci_dev *dev, u8 slot, u8 pin) |
20 | { | 20 | { |
21 | if (dev->irq >= 255) | 21 | if (dev->irq >= 255) |
22 | return -1; /* not a valid interrupt. */ | 22 | return -1; /* not a valid interrupt. */ |
diff --git a/arch/arm/mach-footbridge/ebsa285-pci.c b/arch/arm/mach-footbridge/ebsa285-pci.c index e5ab5bddbc8c..511c673ffa9d 100644 --- a/arch/arm/mach-footbridge/ebsa285-pci.c +++ b/arch/arm/mach-footbridge/ebsa285-pci.c | |||
@@ -15,7 +15,7 @@ | |||
15 | 15 | ||
16 | static int irqmap_ebsa285[] __initdata = { IRQ_IN3, IRQ_IN1, IRQ_IN0, IRQ_PCI }; | 16 | static int irqmap_ebsa285[] __initdata = { IRQ_IN3, IRQ_IN1, IRQ_IN0, IRQ_PCI }; |
17 | 17 | ||
18 | static int __init ebsa285_map_irq(struct pci_dev *dev, u8 slot, u8 pin) | 18 | static int __init ebsa285_map_irq(const struct pci_dev *dev, u8 slot, u8 pin) |
19 | { | 19 | { |
20 | if (dev->vendor == PCI_VENDOR_ID_CONTAQ && | 20 | if (dev->vendor == PCI_VENDOR_ID_CONTAQ && |
21 | dev->device == PCI_DEVICE_ID_CONTAQ_82C693) | 21 | dev->device == PCI_DEVICE_ID_CONTAQ_82C693) |
diff --git a/arch/arm/mach-footbridge/netwinder-pci.c b/arch/arm/mach-footbridge/netwinder-pci.c index e263d6d54a0f..62187610e17e 100644 --- a/arch/arm/mach-footbridge/netwinder-pci.c +++ b/arch/arm/mach-footbridge/netwinder-pci.c | |||
@@ -17,7 +17,7 @@ | |||
17 | * We now use the slot ID instead of the device identifiers to select | 17 | * We now use the slot ID instead of the device identifiers to select |
18 | * which interrupt is routed where. | 18 | * which interrupt is routed where. |
19 | */ | 19 | */ |
20 | static int __init netwinder_map_irq(struct pci_dev *dev, u8 slot, u8 pin) | 20 | static int __init netwinder_map_irq(const struct pci_dev *dev, u8 slot, u8 pin) |
21 | { | 21 | { |
22 | switch (slot) { | 22 | switch (slot) { |
23 | case 0: /* host bridge */ | 23 | case 0: /* host bridge */ |
diff --git a/arch/arm/mach-footbridge/personal-pci.c b/arch/arm/mach-footbridge/personal-pci.c index d5fca95afdad..aeb651d914a6 100644 --- a/arch/arm/mach-footbridge/personal-pci.c +++ b/arch/arm/mach-footbridge/personal-pci.c | |||
@@ -18,7 +18,8 @@ static int irqmap_personal_server[] __initdata = { | |||
18 | IRQ_DOORBELLHOST, IRQ_DMA1, IRQ_DMA2, IRQ_PCI | 18 | IRQ_DOORBELLHOST, IRQ_DMA1, IRQ_DMA2, IRQ_PCI |
19 | }; | 19 | }; |
20 | 20 | ||
21 | static int __init personal_server_map_irq(struct pci_dev *dev, u8 slot, u8 pin) | 21 | static int __init personal_server_map_irq(const struct pci_dev *dev, u8 slot, |
22 | u8 pin) | ||
22 | { | 23 | { |
23 | unsigned char line; | 24 | unsigned char line; |
24 | 25 | ||
diff --git a/arch/arm/mach-integrator/pci.c b/arch/arm/mach-integrator/pci.c index 2fdb95433f0a..520b6bf81bb1 100644 --- a/arch/arm/mach-integrator/pci.c +++ b/arch/arm/mach-integrator/pci.c | |||
@@ -95,7 +95,7 @@ static int irq_tab[4] __initdata = { | |||
95 | * map the specified device/slot/pin to an IRQ. This works out such | 95 | * map the specified device/slot/pin to an IRQ. This works out such |
96 | * that slot 9 pin 1 is INT0, pin 2 is INT1, and slot 10 pin 1 is INT1. | 96 | * that slot 9 pin 1 is INT0, pin 2 is INT1, and slot 10 pin 1 is INT1. |
97 | */ | 97 | */ |
98 | static int __init integrator_map_irq(struct pci_dev *dev, u8 slot, u8 pin) | 98 | static int __init integrator_map_irq(const struct pci_dev *dev, u8 slot, u8 pin) |
99 | { | 99 | { |
100 | int intnr = ((slot - 9) + (pin - 1)) & 3; | 100 | int intnr = ((slot - 9) + (pin - 1)) & 3; |
101 | 101 | ||
diff --git a/arch/arm/mach-iop13xx/iq81340mc.c b/arch/arm/mach-iop13xx/iq81340mc.c index 9b5a63f5d07d..23dfaffc586c 100644 --- a/arch/arm/mach-iop13xx/iq81340mc.c +++ b/arch/arm/mach-iop13xx/iq81340mc.c | |||
@@ -30,7 +30,7 @@ | |||
30 | extern int init_atu; /* Flag to select which ATU(s) to initialize / disable */ | 30 | extern int init_atu; /* Flag to select which ATU(s) to initialize / disable */ |
31 | 31 | ||
32 | static int __init | 32 | static int __init |
33 | iq81340mc_pcix_map_irq(struct pci_dev *dev, u8 idsel, u8 pin) | 33 | iq81340mc_pcix_map_irq(const struct pci_dev *dev, u8 idsel, u8 pin) |
34 | { | 34 | { |
35 | switch (idsel) { | 35 | switch (idsel) { |
36 | case 1: | 36 | case 1: |
diff --git a/arch/arm/mach-iop13xx/pci.c b/arch/arm/mach-iop13xx/pci.c index 0690b1d7fd3e..251c40897dad 100644 --- a/arch/arm/mach-iop13xx/pci.c +++ b/arch/arm/mach-iop13xx/pci.c | |||
@@ -388,7 +388,7 @@ static int iop13xx_atue_pci_status(int clear) | |||
388 | } | 388 | } |
389 | 389 | ||
390 | static int | 390 | static int |
391 | iop13xx_pcie_map_irq(struct pci_dev *dev, u8 idsel, u8 pin) | 391 | iop13xx_pcie_map_irq(const struct pci_dev *dev, u8 idsel, u8 pin) |
392 | { | 392 | { |
393 | WARN_ON(idsel != 0); | 393 | WARN_ON(idsel != 0); |
394 | 394 | ||
diff --git a/arch/arm/mach-iop32x/em7210.c b/arch/arm/mach-iop32x/em7210.c index 779f924af302..6cbffbfc2bba 100644 --- a/arch/arm/mach-iop32x/em7210.c +++ b/arch/arm/mach-iop32x/em7210.c | |||
@@ -81,7 +81,7 @@ void __init em7210_map_io(void) | |||
81 | #define INTD IRQ_IOP32X_XINT3 | 81 | #define INTD IRQ_IOP32X_XINT3 |
82 | 82 | ||
83 | static int __init | 83 | static int __init |
84 | em7210_pci_map_irq(struct pci_dev *dev, u8 slot, u8 pin) | 84 | em7210_pci_map_irq(const struct pci_dev *dev, u8 slot, u8 pin) |
85 | { | 85 | { |
86 | static int pci_irq_table[][4] = { | 86 | static int pci_irq_table[][4] = { |
87 | /* | 87 | /* |
diff --git a/arch/arm/mach-iop32x/glantank.c b/arch/arm/mach-iop32x/glantank.c index c6b6f9c5650d..ceef5d4dce1a 100644 --- a/arch/arm/mach-iop32x/glantank.c +++ b/arch/arm/mach-iop32x/glantank.c | |||
@@ -77,7 +77,7 @@ void __init glantank_map_io(void) | |||
77 | #define INTD IRQ_IOP32X_XINT3 | 77 | #define INTD IRQ_IOP32X_XINT3 |
78 | 78 | ||
79 | static int __init | 79 | static int __init |
80 | glantank_pci_map_irq(struct pci_dev *dev, u8 slot, u8 pin) | 80 | glantank_pci_map_irq(const struct pci_dev *dev, u8 slot, u8 pin) |
81 | { | 81 | { |
82 | static int pci_irq_table[][4] = { | 82 | static int pci_irq_table[][4] = { |
83 | /* | 83 | /* |
diff --git a/arch/arm/mach-iop32x/iq31244.c b/arch/arm/mach-iop32x/iq31244.c index fde962c057f0..3a62514dae7c 100644 --- a/arch/arm/mach-iop32x/iq31244.c +++ b/arch/arm/mach-iop32x/iq31244.c | |||
@@ -103,7 +103,7 @@ void __init iq31244_map_io(void) | |||
103 | * EP80219/IQ31244 PCI. | 103 | * EP80219/IQ31244 PCI. |
104 | */ | 104 | */ |
105 | static int __init | 105 | static int __init |
106 | ep80219_pci_map_irq(struct pci_dev *dev, u8 slot, u8 pin) | 106 | ep80219_pci_map_irq(const struct pci_dev *dev, u8 slot, u8 pin) |
107 | { | 107 | { |
108 | int irq; | 108 | int irq; |
109 | 109 | ||
@@ -139,7 +139,7 @@ static struct hw_pci ep80219_pci __initdata = { | |||
139 | }; | 139 | }; |
140 | 140 | ||
141 | static int __init | 141 | static int __init |
142 | iq31244_pci_map_irq(struct pci_dev *dev, u8 slot, u8 pin) | 142 | iq31244_pci_map_irq(const struct pci_dev *dev, u8 slot, u8 pin) |
143 | { | 143 | { |
144 | int irq; | 144 | int irq; |
145 | 145 | ||
diff --git a/arch/arm/mach-iop32x/iq80321.c b/arch/arm/mach-iop32x/iq80321.c index 3a95950e8737..35b7e6914d3b 100644 --- a/arch/arm/mach-iop32x/iq80321.c +++ b/arch/arm/mach-iop32x/iq80321.c | |||
@@ -71,7 +71,7 @@ void __init iq80321_map_io(void) | |||
71 | * IQ80321 PCI. | 71 | * IQ80321 PCI. |
72 | */ | 72 | */ |
73 | static int __init | 73 | static int __init |
74 | iq80321_pci_map_irq(struct pci_dev *dev, u8 slot, u8 pin) | 74 | iq80321_pci_map_irq(const struct pci_dev *dev, u8 slot, u8 pin) |
75 | { | 75 | { |
76 | int irq; | 76 | int irq; |
77 | 77 | ||
diff --git a/arch/arm/mach-iop32x/n2100.c b/arch/arm/mach-iop32x/n2100.c index 626aa375915d..1a374eab6007 100644 --- a/arch/arm/mach-iop32x/n2100.c +++ b/arch/arm/mach-iop32x/n2100.c | |||
@@ -78,7 +78,7 @@ void __init n2100_map_io(void) | |||
78 | * N2100 PCI. | 78 | * N2100 PCI. |
79 | */ | 79 | */ |
80 | static int __init | 80 | static int __init |
81 | n2100_pci_map_irq(struct pci_dev *dev, u8 slot, u8 pin) | 81 | n2100_pci_map_irq(const struct pci_dev *dev, u8 slot, u8 pin) |
82 | { | 82 | { |
83 | int irq; | 83 | int irq; |
84 | 84 | ||
diff --git a/arch/arm/mach-iop33x/iq80331.c b/arch/arm/mach-iop33x/iq80331.c index c565f8d1e3a4..637c0272d5e0 100644 --- a/arch/arm/mach-iop33x/iq80331.c +++ b/arch/arm/mach-iop33x/iq80331.c | |||
@@ -54,7 +54,7 @@ static struct sys_timer iq80331_timer = { | |||
54 | * IQ80331 PCI. | 54 | * IQ80331 PCI. |
55 | */ | 55 | */ |
56 | static int __init | 56 | static int __init |
57 | iq80331_pci_map_irq(struct pci_dev *dev, u8 slot, u8 pin) | 57 | iq80331_pci_map_irq(const struct pci_dev *dev, u8 slot, u8 pin) |
58 | { | 58 | { |
59 | int irq; | 59 | int irq; |
60 | 60 | ||
diff --git a/arch/arm/mach-iop33x/iq80332.c b/arch/arm/mach-iop33x/iq80332.c index 36a9efb254c2..90a0436d7255 100644 --- a/arch/arm/mach-iop33x/iq80332.c +++ b/arch/arm/mach-iop33x/iq80332.c | |||
@@ -54,7 +54,7 @@ static struct sys_timer iq80332_timer = { | |||
54 | * IQ80332 PCI. | 54 | * IQ80332 PCI. |
55 | */ | 55 | */ |
56 | static int __init | 56 | static int __init |
57 | iq80332_pci_map_irq(struct pci_dev *dev, u8 slot, u8 pin) | 57 | iq80332_pci_map_irq(const struct pci_dev *dev, u8 slot, u8 pin) |
58 | { | 58 | { |
59 | int irq; | 59 | int irq; |
60 | 60 | ||
diff --git a/arch/arm/mach-ixp2000/enp2611.c b/arch/arm/mach-ixp2000/enp2611.c index 88663ab1d2ad..62c60ade5274 100644 --- a/arch/arm/mach-ixp2000/enp2611.c +++ b/arch/arm/mach-ixp2000/enp2611.c | |||
@@ -148,7 +148,8 @@ static struct pci_bus * __init enp2611_pci_scan_bus(int nr, | |||
148 | return pci_scan_bus(sys->busnr, &enp2611_pci_ops, sys); | 148 | return pci_scan_bus(sys->busnr, &enp2611_pci_ops, sys); |
149 | } | 149 | } |
150 | 150 | ||
151 | static int __init enp2611_pci_map_irq(struct pci_dev *dev, u8 slot, u8 pin) | 151 | static int __init enp2611_pci_map_irq(const struct pci_dev *dev, u8 slot, |
152 | u8 pin) | ||
152 | { | 153 | { |
153 | int irq; | 154 | int irq; |
154 | 155 | ||
diff --git a/arch/arm/mach-ixp2000/ixdp2400.c b/arch/arm/mach-ixp2000/ixdp2400.c index dfffc1e817fa..5bad1a8419b7 100644 --- a/arch/arm/mach-ixp2000/ixdp2400.c +++ b/arch/arm/mach-ixp2000/ixdp2400.c | |||
@@ -78,7 +78,8 @@ int ixdp2400_pci_setup(int nr, struct pci_sys_data *sys) | |||
78 | return 1; | 78 | return 1; |
79 | } | 79 | } |
80 | 80 | ||
81 | static int __init ixdp2400_pci_map_irq(struct pci_dev *dev, u8 slot, u8 pin) | 81 | static int __init ixdp2400_pci_map_irq(const struct pci_dev *dev, u8 slot, |
82 | u8 pin) | ||
82 | { | 83 | { |
83 | if (ixdp2x00_master_npu()) { | 84 | if (ixdp2x00_master_npu()) { |
84 | 85 | ||
diff --git a/arch/arm/mach-ixp2000/ixdp2800.c b/arch/arm/mach-ixp2000/ixdp2800.c index cd4c9bcff2b5..3d3cef876467 100644 --- a/arch/arm/mach-ixp2000/ixdp2800.c +++ b/arch/arm/mach-ixp2000/ixdp2800.c | |||
@@ -161,7 +161,8 @@ static int __init ixdp2800_pci_setup(int nr, struct pci_sys_data *sys) | |||
161 | return 1; | 161 | return 1; |
162 | } | 162 | } |
163 | 163 | ||
164 | static int __init ixdp2800_pci_map_irq(struct pci_dev *dev, u8 slot, u8 pin) | 164 | static int __init ixdp2800_pci_map_irq(const struct pci_dev *dev, u8 slot, |
165 | u8 pin) | ||
165 | { | 166 | { |
166 | if (ixdp2x00_master_npu()) { | 167 | if (ixdp2x00_master_npu()) { |
167 | 168 | ||
diff --git a/arch/arm/mach-ixp2000/ixdp2x01.c b/arch/arm/mach-ixp2000/ixdp2x01.c index 84835b209557..be2a254f1374 100644 --- a/arch/arm/mach-ixp2000/ixdp2x01.c +++ b/arch/arm/mach-ixp2000/ixdp2x01.c | |||
@@ -252,7 +252,8 @@ void __init ixdp2x01_pci_preinit(void) | |||
252 | 252 | ||
253 | #define DEVPIN(dev, pin) ((pin) | ((dev) << 3)) | 253 | #define DEVPIN(dev, pin) ((pin) | ((dev) << 3)) |
254 | 254 | ||
255 | static int __init ixdp2x01_pci_map_irq(struct pci_dev *dev, u8 slot, u8 pin) | 255 | static int __init ixdp2x01_pci_map_irq(const struct pci_dev *dev, u8 slot, |
256 | u8 pin) | ||
256 | { | 257 | { |
257 | u8 bus = dev->bus->number; | 258 | u8 bus = dev->bus->number; |
258 | u32 devpin = DEVPIN(PCI_SLOT(dev->devfn), pin); | 259 | u32 devpin = DEVPIN(PCI_SLOT(dev->devfn), pin); |
diff --git a/arch/arm/mach-ixp23xx/ixdp2351.c b/arch/arm/mach-ixp23xx/ixdp2351.c index 8dcba17c81e7..ec028e35f401 100644 --- a/arch/arm/mach-ixp23xx/ixdp2351.c +++ b/arch/arm/mach-ixp23xx/ixdp2351.c | |||
@@ -168,7 +168,7 @@ void __init ixdp2351_init_irq(void) | |||
168 | */ | 168 | */ |
169 | #define DEVPIN(dev, pin) ((pin) | ((dev) << 3)) | 169 | #define DEVPIN(dev, pin) ((pin) | ((dev) << 3)) |
170 | 170 | ||
171 | static int __init ixdp2351_map_irq(struct pci_dev *dev, u8 slot, u8 pin) | 171 | static int __init ixdp2351_map_irq(const struct pci_dev *dev, u8 slot, u8 pin) |
172 | { | 172 | { |
173 | u8 bus = dev->bus->number; | 173 | u8 bus = dev->bus->number; |
174 | u32 devpin = DEVPIN(PCI_SLOT(dev->devfn), pin); | 174 | u32 devpin = DEVPIN(PCI_SLOT(dev->devfn), pin); |
diff --git a/arch/arm/mach-ixp23xx/roadrunner.c b/arch/arm/mach-ixp23xx/roadrunner.c index 8fe0c6273262..844551d2368b 100644 --- a/arch/arm/mach-ixp23xx/roadrunner.c +++ b/arch/arm/mach-ixp23xx/roadrunner.c | |||
@@ -56,7 +56,8 @@ | |||
56 | #define INTC_PIN IXP23XX_GPIO_PIN_11 | 56 | #define INTC_PIN IXP23XX_GPIO_PIN_11 |
57 | #define INTD_PIN IXP23XX_GPIO_PIN_12 | 57 | #define INTD_PIN IXP23XX_GPIO_PIN_12 |
58 | 58 | ||
59 | static int __init roadrunner_map_irq(struct pci_dev *dev, u8 idsel, u8 pin) | 59 | static int __init roadrunner_map_irq(const struct pci_dev *dev, u8 idsel, |
60 | u8 pin) | ||
60 | { | 61 | { |
61 | static int pci_card_slot_irq[] = {INTB, INTC, INTD, INTA}; | 62 | static int pci_card_slot_irq[] = {INTB, INTC, INTD, INTA}; |
62 | static int pmc_card_slot_irq[] = {INTA, INTB, INTC, INTD}; | 63 | static int pmc_card_slot_irq[] = {INTA, INTB, INTC, INTD}; |
diff --git a/arch/arm/mach-ixp4xx/avila-pci.c b/arch/arm/mach-ixp4xx/avila-pci.c index 162043ff29ff..8fea0a3c5246 100644 --- a/arch/arm/mach-ixp4xx/avila-pci.c +++ b/arch/arm/mach-ixp4xx/avila-pci.c | |||
@@ -46,7 +46,7 @@ void __init avila_pci_preinit(void) | |||
46 | ixp4xx_pci_preinit(); | 46 | ixp4xx_pci_preinit(); |
47 | } | 47 | } |
48 | 48 | ||
49 | static int __init avila_map_irq(struct pci_dev *dev, u8 slot, u8 pin) | 49 | static int __init avila_map_irq(const struct pci_dev *dev, u8 slot, u8 pin) |
50 | { | 50 | { |
51 | static int pci_irq_table[IRQ_LINES] = { | 51 | static int pci_irq_table[IRQ_LINES] = { |
52 | IXP4XX_GPIO_IRQ(INTA), | 52 | IXP4XX_GPIO_IRQ(INTA), |
diff --git a/arch/arm/mach-ixp4xx/coyote-pci.c b/arch/arm/mach-ixp4xx/coyote-pci.c index 37fda7d6e83d..71f5c9c60fc3 100644 --- a/arch/arm/mach-ixp4xx/coyote-pci.c +++ b/arch/arm/mach-ixp4xx/coyote-pci.c | |||
@@ -37,7 +37,7 @@ void __init coyote_pci_preinit(void) | |||
37 | ixp4xx_pci_preinit(); | 37 | ixp4xx_pci_preinit(); |
38 | } | 38 | } |
39 | 39 | ||
40 | static int __init coyote_map_irq(struct pci_dev *dev, u8 slot, u8 pin) | 40 | static int __init coyote_map_irq(const struct pci_dev *dev, u8 slot, u8 pin) |
41 | { | 41 | { |
42 | if (slot == SLOT0_DEVID) | 42 | if (slot == SLOT0_DEVID) |
43 | return IXP4XX_GPIO_IRQ(SLOT0_INTA); | 43 | return IXP4XX_GPIO_IRQ(SLOT0_INTA); |
diff --git a/arch/arm/mach-ixp4xx/dsmg600-pci.c b/arch/arm/mach-ixp4xx/dsmg600-pci.c index c7612010b3fc..0532510b5e8c 100644 --- a/arch/arm/mach-ixp4xx/dsmg600-pci.c +++ b/arch/arm/mach-ixp4xx/dsmg600-pci.c | |||
@@ -44,7 +44,7 @@ void __init dsmg600_pci_preinit(void) | |||
44 | ixp4xx_pci_preinit(); | 44 | ixp4xx_pci_preinit(); |
45 | } | 45 | } |
46 | 46 | ||
47 | static int __init dsmg600_map_irq(struct pci_dev *dev, u8 slot, u8 pin) | 47 | static int __init dsmg600_map_irq(const struct pci_dev *dev, u8 slot, u8 pin) |
48 | { | 48 | { |
49 | static int pci_irq_table[MAX_DEV][IRQ_LINES] = { | 49 | static int pci_irq_table[MAX_DEV][IRQ_LINES] = { |
50 | { IXP4XX_GPIO_IRQ(INTE), -1, -1 }, | 50 | { IXP4XX_GPIO_IRQ(INTE), -1, -1 }, |
diff --git a/arch/arm/mach-ixp4xx/fsg-pci.c b/arch/arm/mach-ixp4xx/fsg-pci.c index 44ccde9d4879..d2ac803328f7 100644 --- a/arch/arm/mach-ixp4xx/fsg-pci.c +++ b/arch/arm/mach-ixp4xx/fsg-pci.c | |||
@@ -38,7 +38,7 @@ void __init fsg_pci_preinit(void) | |||
38 | ixp4xx_pci_preinit(); | 38 | ixp4xx_pci_preinit(); |
39 | } | 39 | } |
40 | 40 | ||
41 | static int __init fsg_map_irq(struct pci_dev *dev, u8 slot, u8 pin) | 41 | static int __init fsg_map_irq(const struct pci_dev *dev, u8 slot, u8 pin) |
42 | { | 42 | { |
43 | static int pci_irq_table[IRQ_LINES] = { | 43 | static int pci_irq_table[IRQ_LINES] = { |
44 | IXP4XX_GPIO_IRQ(INTC), | 44 | IXP4XX_GPIO_IRQ(INTC), |
diff --git a/arch/arm/mach-ixp4xx/gateway7001-pci.c b/arch/arm/mach-ixp4xx/gateway7001-pci.c index fc1124168874..76581fb467c4 100644 --- a/arch/arm/mach-ixp4xx/gateway7001-pci.c +++ b/arch/arm/mach-ixp4xx/gateway7001-pci.c | |||
@@ -35,7 +35,8 @@ void __init gateway7001_pci_preinit(void) | |||
35 | ixp4xx_pci_preinit(); | 35 | ixp4xx_pci_preinit(); |
36 | } | 36 | } |
37 | 37 | ||
38 | static int __init gateway7001_map_irq(struct pci_dev *dev, u8 slot, u8 pin) | 38 | static int __init gateway7001_map_irq(const struct pci_dev *dev, u8 slot, |
39 | u8 pin) | ||
39 | { | 40 | { |
40 | if (slot == 1) | 41 | if (slot == 1) |
41 | return IRQ_IXP4XX_GPIO11; | 42 | return IRQ_IXP4XX_GPIO11; |
diff --git a/arch/arm/mach-ixp4xx/goramo_mlr.c b/arch/arm/mach-ixp4xx/goramo_mlr.c index 5f00ad224fe0..7548d9a2efe2 100644 --- a/arch/arm/mach-ixp4xx/goramo_mlr.c +++ b/arch/arm/mach-ixp4xx/goramo_mlr.c | |||
@@ -462,7 +462,7 @@ static void __init gmlr_pci_postinit(void) | |||
462 | } | 462 | } |
463 | } | 463 | } |
464 | 464 | ||
465 | static int __init gmlr_map_irq(struct pci_dev *dev, u8 slot, u8 pin) | 465 | static int __init gmlr_map_irq(const struct pci_dev *dev, u8 slot, u8 pin) |
466 | { | 466 | { |
467 | switch(slot) { | 467 | switch(slot) { |
468 | case SLOT_ETHA: return IXP4XX_GPIO_IRQ(GPIO_IRQ_ETHA); | 468 | case SLOT_ETHA: return IXP4XX_GPIO_IRQ(GPIO_IRQ_ETHA); |
diff --git a/arch/arm/mach-ixp4xx/gtwx5715-pci.c b/arch/arm/mach-ixp4xx/gtwx5715-pci.c index 38cc0725dbd8..d68fc068c38d 100644 --- a/arch/arm/mach-ixp4xx/gtwx5715-pci.c +++ b/arch/arm/mach-ixp4xx/gtwx5715-pci.c | |||
@@ -49,7 +49,7 @@ void __init gtwx5715_pci_preinit(void) | |||
49 | } | 49 | } |
50 | 50 | ||
51 | 51 | ||
52 | static int __init gtwx5715_map_irq(struct pci_dev *dev, u8 slot, u8 pin) | 52 | static int __init gtwx5715_map_irq(const struct pci_dev *dev, u8 slot, u8 pin) |
53 | { | 53 | { |
54 | int rc = -1; | 54 | int rc = -1; |
55 | 55 | ||
diff --git a/arch/arm/mach-ixp4xx/ixdp425-pci.c b/arch/arm/mach-ixp4xx/ixdp425-pci.c index 58f400417eaf..fffd8c5e40bf 100644 --- a/arch/arm/mach-ixp4xx/ixdp425-pci.c +++ b/arch/arm/mach-ixp4xx/ixdp425-pci.c | |||
@@ -43,7 +43,7 @@ void __init ixdp425_pci_preinit(void) | |||
43 | ixp4xx_pci_preinit(); | 43 | ixp4xx_pci_preinit(); |
44 | } | 44 | } |
45 | 45 | ||
46 | static int __init ixdp425_map_irq(struct pci_dev *dev, u8 slot, u8 pin) | 46 | static int __init ixdp425_map_irq(const struct pci_dev *dev, u8 slot, u8 pin) |
47 | { | 47 | { |
48 | static int pci_irq_table[IRQ_LINES] = { | 48 | static int pci_irq_table[IRQ_LINES] = { |
49 | IXP4XX_GPIO_IRQ(INTA), | 49 | IXP4XX_GPIO_IRQ(INTA), |
diff --git a/arch/arm/mach-ixp4xx/ixdpg425-pci.c b/arch/arm/mach-ixp4xx/ixdpg425-pci.c index e64f6d041488..34efe75015ec 100644 --- a/arch/arm/mach-ixp4xx/ixdpg425-pci.c +++ b/arch/arm/mach-ixp4xx/ixdpg425-pci.c | |||
@@ -31,7 +31,7 @@ void __init ixdpg425_pci_preinit(void) | |||
31 | ixp4xx_pci_preinit(); | 31 | ixp4xx_pci_preinit(); |
32 | } | 32 | } |
33 | 33 | ||
34 | static int __init ixdpg425_map_irq(struct pci_dev *dev, u8 slot, u8 pin) | 34 | static int __init ixdpg425_map_irq(const struct pci_dev *dev, u8 slot, u8 pin) |
35 | { | 35 | { |
36 | if (slot == 12 || slot == 13) | 36 | if (slot == 12 || slot == 13) |
37 | return IRQ_IXP4XX_GPIO7; | 37 | return IRQ_IXP4XX_GPIO7; |
diff --git a/arch/arm/mach-ixp4xx/nas100d-pci.c b/arch/arm/mach-ixp4xx/nas100d-pci.c index 428d1202b799..5434ccf553eb 100644 --- a/arch/arm/mach-ixp4xx/nas100d-pci.c +++ b/arch/arm/mach-ixp4xx/nas100d-pci.c | |||
@@ -41,7 +41,7 @@ void __init nas100d_pci_preinit(void) | |||
41 | ixp4xx_pci_preinit(); | 41 | ixp4xx_pci_preinit(); |
42 | } | 42 | } |
43 | 43 | ||
44 | static int __init nas100d_map_irq(struct pci_dev *dev, u8 slot, u8 pin) | 44 | static int __init nas100d_map_irq(const struct pci_dev *dev, u8 slot, u8 pin) |
45 | { | 45 | { |
46 | static int pci_irq_table[MAX_DEV][IRQ_LINES] = { | 46 | static int pci_irq_table[MAX_DEV][IRQ_LINES] = { |
47 | { IXP4XX_GPIO_IRQ(INTA), -1, -1 }, | 47 | { IXP4XX_GPIO_IRQ(INTA), -1, -1 }, |
diff --git a/arch/arm/mach-ixp4xx/nslu2-pci.c b/arch/arm/mach-ixp4xx/nslu2-pci.c index 2e85f76b950d..b57160535e47 100644 --- a/arch/arm/mach-ixp4xx/nslu2-pci.c +++ b/arch/arm/mach-ixp4xx/nslu2-pci.c | |||
@@ -38,7 +38,7 @@ void __init nslu2_pci_preinit(void) | |||
38 | ixp4xx_pci_preinit(); | 38 | ixp4xx_pci_preinit(); |
39 | } | 39 | } |
40 | 40 | ||
41 | static int __init nslu2_map_irq(struct pci_dev *dev, u8 slot, u8 pin) | 41 | static int __init nslu2_map_irq(const struct pci_dev *dev, u8 slot, u8 pin) |
42 | { | 42 | { |
43 | static int pci_irq_table[IRQ_LINES] = { | 43 | static int pci_irq_table[IRQ_LINES] = { |
44 | IXP4XX_GPIO_IRQ(INTA), | 44 | IXP4XX_GPIO_IRQ(INTA), |
diff --git a/arch/arm/mach-ixp4xx/vulcan-pci.c b/arch/arm/mach-ixp4xx/vulcan-pci.c index 03bdec5140a7..0bc3f34c282f 100644 --- a/arch/arm/mach-ixp4xx/vulcan-pci.c +++ b/arch/arm/mach-ixp4xx/vulcan-pci.c | |||
@@ -43,7 +43,7 @@ void __init vulcan_pci_preinit(void) | |||
43 | ixp4xx_pci_preinit(); | 43 | ixp4xx_pci_preinit(); |
44 | } | 44 | } |
45 | 45 | ||
46 | static int __init vulcan_map_irq(struct pci_dev *dev, u8 slot, u8 pin) | 46 | static int __init vulcan_map_irq(const struct pci_dev *dev, u8 slot, u8 pin) |
47 | { | 47 | { |
48 | if (slot == 1) | 48 | if (slot == 1) |
49 | return IXP4XX_GPIO_IRQ(INTA); | 49 | return IXP4XX_GPIO_IRQ(INTA); |
diff --git a/arch/arm/mach-ixp4xx/wg302v2-pci.c b/arch/arm/mach-ixp4xx/wg302v2-pci.c index 17f3cf59a31b..f27dfcfe811b 100644 --- a/arch/arm/mach-ixp4xx/wg302v2-pci.c +++ b/arch/arm/mach-ixp4xx/wg302v2-pci.c | |||
@@ -35,7 +35,7 @@ void __init wg302v2_pci_preinit(void) | |||
35 | ixp4xx_pci_preinit(); | 35 | ixp4xx_pci_preinit(); |
36 | } | 36 | } |
37 | 37 | ||
38 | static int __init wg302v2_map_irq(struct pci_dev *dev, u8 slot, u8 pin) | 38 | static int __init wg302v2_map_irq(const struct pci_dev *dev, u8 slot, u8 pin) |
39 | { | 39 | { |
40 | if (slot == 1) | 40 | if (slot == 1) |
41 | return IRQ_IXP4XX_GPIO8; | 41 | return IRQ_IXP4XX_GPIO8; |
diff --git a/arch/arm/mach-kirkwood/pcie.c b/arch/arm/mach-kirkwood/pcie.c index bfeb9c900cec..74b992d810ea 100644 --- a/arch/arm/mach-kirkwood/pcie.c +++ b/arch/arm/mach-kirkwood/pcie.c | |||
@@ -245,7 +245,8 @@ kirkwood_pcie_scan_bus(int nr, struct pci_sys_data *sys) | |||
245 | return bus; | 245 | return bus; |
246 | } | 246 | } |
247 | 247 | ||
248 | static int __init kirkwood_pcie_map_irq(struct pci_dev *dev, u8 slot, u8 pin) | 248 | static int __init kirkwood_pcie_map_irq(const struct pci_dev *dev, u8 slot, |
249 | u8 pin) | ||
249 | { | 250 | { |
250 | struct pcie_port *pp = bus_to_port(dev->bus); | 251 | struct pcie_port *pp = bus_to_port(dev->bus); |
251 | 252 | ||
diff --git a/arch/arm/mach-ks8695/board-dsm320.c b/arch/arm/mach-ks8695/board-dsm320.c index ada92b6bed24..1338cb3e9827 100644 --- a/arch/arm/mach-ks8695/board-dsm320.c +++ b/arch/arm/mach-ks8695/board-dsm320.c | |||
@@ -34,7 +34,7 @@ | |||
34 | #include "generic.h" | 34 | #include "generic.h" |
35 | 35 | ||
36 | #ifdef CONFIG_PCI | 36 | #ifdef CONFIG_PCI |
37 | static int dsm320_pci_map_irq(struct pci_dev *dev, u8 slot, u8 pin) | 37 | static int dsm320_pci_map_irq(const struct pci_dev *dev, u8 slot, u8 pin) |
38 | { | 38 | { |
39 | switch (slot) { | 39 | switch (slot) { |
40 | case 0: | 40 | case 0: |
diff --git a/arch/arm/mach-ks8695/board-micrel.c b/arch/arm/mach-ks8695/board-micrel.c index c7ad09bd6ea2..e2e3cba8dcdb 100644 --- a/arch/arm/mach-ks8695/board-micrel.c +++ b/arch/arm/mach-ks8695/board-micrel.c | |||
@@ -24,7 +24,7 @@ | |||
24 | #include "generic.h" | 24 | #include "generic.h" |
25 | 25 | ||
26 | #ifdef CONFIG_PCI | 26 | #ifdef CONFIG_PCI |
27 | static int micrel_pci_map_irq(struct pci_dev *dev, u8 slot, u8 pin) | 27 | static int micrel_pci_map_irq(const struct pci_dev *dev, u8 slot, u8 pin) |
28 | { | 28 | { |
29 | return KS8695_IRQ_EXTERN0; | 29 | return KS8695_IRQ_EXTERN0; |
30 | } | 30 | } |
diff --git a/arch/arm/mach-ks8695/include/mach/devices.h b/arch/arm/mach-ks8695/include/mach/devices.h index 2744fecb429c..85a3c9aa7d13 100644 --- a/arch/arm/mach-ks8695/include/mach/devices.h +++ b/arch/arm/mach-ks8695/include/mach/devices.h | |||
@@ -30,7 +30,7 @@ extern void __init ks8695_init_leds(u8 cpu_led, u8 timer_led); | |||
30 | 30 | ||
31 | struct ks8695_pci_cfg { | 31 | struct ks8695_pci_cfg { |
32 | short mode; | 32 | short mode; |
33 | int (*map_irq)(struct pci_dev *, u8, u8); | 33 | int (*map_irq)(const struct pci_dev *, u8, u8); |
34 | }; | 34 | }; |
35 | extern __init void ks8695_init_pci(struct ks8695_pci_cfg *); | 35 | extern __init void ks8695_init_pci(struct ks8695_pci_cfg *); |
36 | 36 | ||
diff --git a/arch/arm/mach-msm/Kconfig b/arch/arm/mach-msm/Kconfig index 888e92502e15..ebde97f5d5f0 100644 --- a/arch/arm/mach-msm/Kconfig +++ b/arch/arm/mach-msm/Kconfig | |||
@@ -11,6 +11,7 @@ config ARCH_MSM7X00A | |||
11 | select MSM_SMD | 11 | select MSM_SMD |
12 | select MSM_SMD_PKG3 | 12 | select MSM_SMD_PKG3 |
13 | select CPU_V6 | 13 | select CPU_V6 |
14 | select GPIO_MSM_V1 | ||
14 | select MSM_PROC_COMM | 15 | select MSM_PROC_COMM |
15 | select HAS_MSM_DEBUG_UART_PHYS | 16 | select HAS_MSM_DEBUG_UART_PHYS |
16 | 17 | ||
@@ -22,6 +23,7 @@ config ARCH_MSM7X30 | |||
22 | select MSM_VIC | 23 | select MSM_VIC |
23 | select CPU_V7 | 24 | select CPU_V7 |
24 | select MSM_GPIOMUX | 25 | select MSM_GPIOMUX |
26 | select GPIO_MSM_V1 | ||
25 | select MSM_PROC_COMM | 27 | select MSM_PROC_COMM |
26 | select HAS_MSM_DEBUG_UART_PHYS | 28 | select HAS_MSM_DEBUG_UART_PHYS |
27 | 29 | ||
@@ -33,6 +35,7 @@ config ARCH_QSD8X50 | |||
33 | select MSM_VIC | 35 | select MSM_VIC |
34 | select CPU_V7 | 36 | select CPU_V7 |
35 | select MSM_GPIOMUX | 37 | select MSM_GPIOMUX |
38 | select GPIO_MSM_V1 | ||
36 | select MSM_PROC_COMM | 39 | select MSM_PROC_COMM |
37 | select HAS_MSM_DEBUG_UART_PHYS | 40 | select HAS_MSM_DEBUG_UART_PHYS |
38 | 41 | ||
@@ -44,6 +47,7 @@ config ARCH_MSM8X60 | |||
44 | select ARM_GIC | 47 | select ARM_GIC |
45 | select CPU_V7 | 48 | select CPU_V7 |
46 | select MSM_V2_TLMM | 49 | select MSM_V2_TLMM |
50 | select GPIO_MSM_V2 | ||
47 | select MSM_GPIOMUX | 51 | select MSM_GPIOMUX |
48 | select MSM_SCM if SMP | 52 | select MSM_SCM if SMP |
49 | 53 | ||
diff --git a/arch/arm/mach-msm/Makefile b/arch/arm/mach-msm/Makefile index b70658c5ae00..4285dfd80b6f 100644 --- a/arch/arm/mach-msm/Makefile +++ b/arch/arm/mach-msm/Makefile | |||
@@ -29,11 +29,3 @@ obj-$(CONFIG_ARCH_MSM8960) += board-msm8960.o devices-msm8960.o | |||
29 | obj-$(CONFIG_ARCH_MSM7X30) += gpiomux-v1.o gpiomux.o | 29 | obj-$(CONFIG_ARCH_MSM7X30) += gpiomux-v1.o gpiomux.o |
30 | obj-$(CONFIG_ARCH_QSD8X50) += gpiomux-8x50.o gpiomux-v1.o gpiomux.o | 30 | obj-$(CONFIG_ARCH_QSD8X50) += gpiomux-8x50.o gpiomux-v1.o gpiomux.o |
31 | obj-$(CONFIG_ARCH_MSM8X60) += gpiomux-8x60.o gpiomux-v2.o gpiomux.o | 31 | obj-$(CONFIG_ARCH_MSM8X60) += gpiomux-8x60.o gpiomux-v2.o gpiomux.o |
32 | ifdef CONFIG_MSM_V2_TLMM | ||
33 | ifndef CONFIG_ARCH_MSM8960 | ||
34 | # TODO: TLMM Mapping issues need to be resolved | ||
35 | obj-y += gpio-v2.o | ||
36 | endif | ||
37 | else | ||
38 | obj-y += gpio.o | ||
39 | endif | ||
diff --git a/arch/arm/mach-msm/gpio-v2.c b/arch/arm/mach-msm/gpio-v2.c deleted file mode 100644 index cc9c4fd7cccc..000000000000 --- a/arch/arm/mach-msm/gpio-v2.c +++ /dev/null | |||
@@ -1,433 +0,0 @@ | |||
1 | /* Copyright (c) 2010, Code Aurora Forum. All rights reserved. | ||
2 | * | ||
3 | * This program is free software; you can redistribute it and/or modify | ||
4 | * it under the terms of the GNU General Public License version 2 and | ||
5 | * only version 2 as published by the Free Software Foundation. | ||
6 | * | ||
7 | * This program is distributed in the hope that it will be useful, | ||
8 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
9 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
10 | * GNU General Public License for more details. | ||
11 | * | ||
12 | * You should have received a copy of the GNU General Public License | ||
13 | * along with this program; if not, write to the Free Software | ||
14 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA | ||
15 | * 02110-1301, USA. | ||
16 | * | ||
17 | */ | ||
18 | #define pr_fmt(fmt) "%s: " fmt, __func__ | ||
19 | |||
20 | #include <linux/bitmap.h> | ||
21 | #include <linux/bitops.h> | ||
22 | #include <linux/gpio.h> | ||
23 | #include <linux/init.h> | ||
24 | #include <linux/interrupt.h> | ||
25 | #include <linux/io.h> | ||
26 | #include <linux/irq.h> | ||
27 | #include <linux/module.h> | ||
28 | #include <linux/platform_device.h> | ||
29 | #include <linux/spinlock.h> | ||
30 | |||
31 | #include <asm/mach/irq.h> | ||
32 | |||
33 | #include <mach/msm_iomap.h> | ||
34 | #include "gpiomux.h" | ||
35 | |||
36 | /* Bits of interest in the GPIO_IN_OUT register. | ||
37 | */ | ||
38 | enum { | ||
39 | GPIO_IN = 0, | ||
40 | GPIO_OUT = 1 | ||
41 | }; | ||
42 | |||
43 | /* Bits of interest in the GPIO_INTR_STATUS register. | ||
44 | */ | ||
45 | enum { | ||
46 | INTR_STATUS = 0, | ||
47 | }; | ||
48 | |||
49 | /* Bits of interest in the GPIO_CFG register. | ||
50 | */ | ||
51 | enum { | ||
52 | GPIO_OE = 9, | ||
53 | }; | ||
54 | |||
55 | /* Bits of interest in the GPIO_INTR_CFG register. | ||
56 | * When a GPIO triggers, two separate decisions are made, controlled | ||
57 | * by two separate flags. | ||
58 | * | ||
59 | * - First, INTR_RAW_STATUS_EN controls whether or not the GPIO_INTR_STATUS | ||
60 | * register for that GPIO will be updated to reflect the triggering of that | ||
61 | * gpio. If this bit is 0, this register will not be updated. | ||
62 | * - Second, INTR_ENABLE controls whether an interrupt is triggered. | ||
63 | * | ||
64 | * If INTR_ENABLE is set and INTR_RAW_STATUS_EN is NOT set, an interrupt | ||
65 | * can be triggered but the status register will not reflect it. | ||
66 | */ | ||
67 | enum { | ||
68 | INTR_ENABLE = 0, | ||
69 | INTR_POL_CTL = 1, | ||
70 | INTR_DECT_CTL = 2, | ||
71 | INTR_RAW_STATUS_EN = 3, | ||
72 | }; | ||
73 | |||
74 | /* Codes of interest in GPIO_INTR_CFG_SU. | ||
75 | */ | ||
76 | enum { | ||
77 | TARGET_PROC_SCORPION = 4, | ||
78 | TARGET_PROC_NONE = 7, | ||
79 | }; | ||
80 | |||
81 | |||
82 | #define GPIO_INTR_CFG_SU(gpio) (MSM_TLMM_BASE + 0x0400 + (0x04 * (gpio))) | ||
83 | #define GPIO_CONFIG(gpio) (MSM_TLMM_BASE + 0x1000 + (0x10 * (gpio))) | ||
84 | #define GPIO_IN_OUT(gpio) (MSM_TLMM_BASE + 0x1004 + (0x10 * (gpio))) | ||
85 | #define GPIO_INTR_CFG(gpio) (MSM_TLMM_BASE + 0x1008 + (0x10 * (gpio))) | ||
86 | #define GPIO_INTR_STATUS(gpio) (MSM_TLMM_BASE + 0x100c + (0x10 * (gpio))) | ||
87 | |||
88 | /** | ||
89 | * struct msm_gpio_dev: the MSM8660 SoC GPIO device structure | ||
90 | * | ||
91 | * @enabled_irqs: a bitmap used to optimize the summary-irq handler. By | ||
92 | * keeping track of which gpios are unmasked as irq sources, we avoid | ||
93 | * having to do readl calls on hundreds of iomapped registers each time | ||
94 | * the summary interrupt fires in order to locate the active interrupts. | ||
95 | * | ||
96 | * @wake_irqs: a bitmap for tracking which interrupt lines are enabled | ||
97 | * as wakeup sources. When the device is suspended, interrupts which are | ||
98 | * not wakeup sources are disabled. | ||
99 | * | ||
100 | * @dual_edge_irqs: a bitmap used to track which irqs are configured | ||
101 | * as dual-edge, as this is not supported by the hardware and requires | ||
102 | * some special handling in the driver. | ||
103 | */ | ||
104 | struct msm_gpio_dev { | ||
105 | struct gpio_chip gpio_chip; | ||
106 | DECLARE_BITMAP(enabled_irqs, NR_GPIO_IRQS); | ||
107 | DECLARE_BITMAP(wake_irqs, NR_GPIO_IRQS); | ||
108 | DECLARE_BITMAP(dual_edge_irqs, NR_GPIO_IRQS); | ||
109 | }; | ||
110 | |||
111 | static DEFINE_SPINLOCK(tlmm_lock); | ||
112 | |||
113 | static inline struct msm_gpio_dev *to_msm_gpio_dev(struct gpio_chip *chip) | ||
114 | { | ||
115 | return container_of(chip, struct msm_gpio_dev, gpio_chip); | ||
116 | } | ||
117 | |||
118 | static inline void set_gpio_bits(unsigned n, void __iomem *reg) | ||
119 | { | ||
120 | writel(readl(reg) | n, reg); | ||
121 | } | ||
122 | |||
123 | static inline void clear_gpio_bits(unsigned n, void __iomem *reg) | ||
124 | { | ||
125 | writel(readl(reg) & ~n, reg); | ||
126 | } | ||
127 | |||
128 | static int msm_gpio_get(struct gpio_chip *chip, unsigned offset) | ||
129 | { | ||
130 | return readl(GPIO_IN_OUT(offset)) & BIT(GPIO_IN); | ||
131 | } | ||
132 | |||
133 | static void msm_gpio_set(struct gpio_chip *chip, unsigned offset, int val) | ||
134 | { | ||
135 | writel(val ? BIT(GPIO_OUT) : 0, GPIO_IN_OUT(offset)); | ||
136 | } | ||
137 | |||
138 | static int msm_gpio_direction_input(struct gpio_chip *chip, unsigned offset) | ||
139 | { | ||
140 | unsigned long irq_flags; | ||
141 | |||
142 | spin_lock_irqsave(&tlmm_lock, irq_flags); | ||
143 | clear_gpio_bits(BIT(GPIO_OE), GPIO_CONFIG(offset)); | ||
144 | spin_unlock_irqrestore(&tlmm_lock, irq_flags); | ||
145 | return 0; | ||
146 | } | ||
147 | |||
148 | static int msm_gpio_direction_output(struct gpio_chip *chip, | ||
149 | unsigned offset, | ||
150 | int val) | ||
151 | { | ||
152 | unsigned long irq_flags; | ||
153 | |||
154 | spin_lock_irqsave(&tlmm_lock, irq_flags); | ||
155 | msm_gpio_set(chip, offset, val); | ||
156 | set_gpio_bits(BIT(GPIO_OE), GPIO_CONFIG(offset)); | ||
157 | spin_unlock_irqrestore(&tlmm_lock, irq_flags); | ||
158 | return 0; | ||
159 | } | ||
160 | |||
161 | static int msm_gpio_request(struct gpio_chip *chip, unsigned offset) | ||
162 | { | ||
163 | return msm_gpiomux_get(chip->base + offset); | ||
164 | } | ||
165 | |||
166 | static void msm_gpio_free(struct gpio_chip *chip, unsigned offset) | ||
167 | { | ||
168 | msm_gpiomux_put(chip->base + offset); | ||
169 | } | ||
170 | |||
171 | static int msm_gpio_to_irq(struct gpio_chip *chip, unsigned offset) | ||
172 | { | ||
173 | return MSM_GPIO_TO_INT(chip->base + offset); | ||
174 | } | ||
175 | |||
176 | static inline int msm_irq_to_gpio(struct gpio_chip *chip, unsigned irq) | ||
177 | { | ||
178 | return irq - MSM_GPIO_TO_INT(chip->base); | ||
179 | } | ||
180 | |||
181 | static struct msm_gpio_dev msm_gpio = { | ||
182 | .gpio_chip = { | ||
183 | .base = 0, | ||
184 | .ngpio = NR_GPIO_IRQS, | ||
185 | .direction_input = msm_gpio_direction_input, | ||
186 | .direction_output = msm_gpio_direction_output, | ||
187 | .get = msm_gpio_get, | ||
188 | .set = msm_gpio_set, | ||
189 | .to_irq = msm_gpio_to_irq, | ||
190 | .request = msm_gpio_request, | ||
191 | .free = msm_gpio_free, | ||
192 | }, | ||
193 | }; | ||
194 | |||
195 | /* For dual-edge interrupts in software, since the hardware has no | ||
196 | * such support: | ||
197 | * | ||
198 | * At appropriate moments, this function may be called to flip the polarity | ||
199 | * settings of both-edge irq lines to try and catch the next edge. | ||
200 | * | ||
201 | * The attempt is considered successful if: | ||
202 | * - the status bit goes high, indicating that an edge was caught, or | ||
203 | * - the input value of the gpio doesn't change during the attempt. | ||
204 | * If the value changes twice during the process, that would cause the first | ||
205 | * test to fail but would force the second, as two opposite | ||
206 | * transitions would cause a detection no matter the polarity setting. | ||
207 | * | ||
208 | * The do-loop tries to sledge-hammer closed the timing hole between | ||
209 | * the initial value-read and the polarity-write - if the line value changes | ||
210 | * during that window, an interrupt is lost, the new polarity setting is | ||
211 | * incorrect, and the first success test will fail, causing a retry. | ||
212 | * | ||
213 | * Algorithm comes from Google's msmgpio driver, see mach-msm/gpio.c. | ||
214 | */ | ||
215 | static void msm_gpio_update_dual_edge_pos(unsigned gpio) | ||
216 | { | ||
217 | int loop_limit = 100; | ||
218 | unsigned val, val2, intstat; | ||
219 | |||
220 | do { | ||
221 | val = readl(GPIO_IN_OUT(gpio)) & BIT(GPIO_IN); | ||
222 | if (val) | ||
223 | clear_gpio_bits(BIT(INTR_POL_CTL), GPIO_INTR_CFG(gpio)); | ||
224 | else | ||
225 | set_gpio_bits(BIT(INTR_POL_CTL), GPIO_INTR_CFG(gpio)); | ||
226 | val2 = readl(GPIO_IN_OUT(gpio)) & BIT(GPIO_IN); | ||
227 | intstat = readl(GPIO_INTR_STATUS(gpio)) & BIT(INTR_STATUS); | ||
228 | if (intstat || val == val2) | ||
229 | return; | ||
230 | } while (loop_limit-- > 0); | ||
231 | pr_err("dual-edge irq failed to stabilize, " | ||
232 | "interrupts dropped. %#08x != %#08x\n", | ||
233 | val, val2); | ||
234 | } | ||
235 | |||
236 | static void msm_gpio_irq_ack(struct irq_data *d) | ||
237 | { | ||
238 | int gpio = msm_irq_to_gpio(&msm_gpio.gpio_chip, d->irq); | ||
239 | |||
240 | writel(BIT(INTR_STATUS), GPIO_INTR_STATUS(gpio)); | ||
241 | if (test_bit(gpio, msm_gpio.dual_edge_irqs)) | ||
242 | msm_gpio_update_dual_edge_pos(gpio); | ||
243 | } | ||
244 | |||
245 | static void msm_gpio_irq_mask(struct irq_data *d) | ||
246 | { | ||
247 | int gpio = msm_irq_to_gpio(&msm_gpio.gpio_chip, d->irq); | ||
248 | unsigned long irq_flags; | ||
249 | |||
250 | spin_lock_irqsave(&tlmm_lock, irq_flags); | ||
251 | writel(TARGET_PROC_NONE, GPIO_INTR_CFG_SU(gpio)); | ||
252 | clear_gpio_bits(INTR_RAW_STATUS_EN | INTR_ENABLE, GPIO_INTR_CFG(gpio)); | ||
253 | __clear_bit(gpio, msm_gpio.enabled_irqs); | ||
254 | spin_unlock_irqrestore(&tlmm_lock, irq_flags); | ||
255 | } | ||
256 | |||
257 | static void msm_gpio_irq_unmask(struct irq_data *d) | ||
258 | { | ||
259 | int gpio = msm_irq_to_gpio(&msm_gpio.gpio_chip, d->irq); | ||
260 | unsigned long irq_flags; | ||
261 | |||
262 | spin_lock_irqsave(&tlmm_lock, irq_flags); | ||
263 | __set_bit(gpio, msm_gpio.enabled_irqs); | ||
264 | set_gpio_bits(INTR_RAW_STATUS_EN | INTR_ENABLE, GPIO_INTR_CFG(gpio)); | ||
265 | writel(TARGET_PROC_SCORPION, GPIO_INTR_CFG_SU(gpio)); | ||
266 | spin_unlock_irqrestore(&tlmm_lock, irq_flags); | ||
267 | } | ||
268 | |||
269 | static int msm_gpio_irq_set_type(struct irq_data *d, unsigned int flow_type) | ||
270 | { | ||
271 | int gpio = msm_irq_to_gpio(&msm_gpio.gpio_chip, d->irq); | ||
272 | unsigned long irq_flags; | ||
273 | uint32_t bits; | ||
274 | |||
275 | spin_lock_irqsave(&tlmm_lock, irq_flags); | ||
276 | |||
277 | bits = readl(GPIO_INTR_CFG(gpio)); | ||
278 | |||
279 | if (flow_type & IRQ_TYPE_EDGE_BOTH) { | ||
280 | bits |= BIT(INTR_DECT_CTL); | ||
281 | __irq_set_handler_locked(d->irq, handle_edge_irq); | ||
282 | if ((flow_type & IRQ_TYPE_EDGE_BOTH) == IRQ_TYPE_EDGE_BOTH) | ||
283 | __set_bit(gpio, msm_gpio.dual_edge_irqs); | ||
284 | else | ||
285 | __clear_bit(gpio, msm_gpio.dual_edge_irqs); | ||
286 | } else { | ||
287 | bits &= ~BIT(INTR_DECT_CTL); | ||
288 | __irq_set_handler_locked(d->irq, handle_level_irq); | ||
289 | __clear_bit(gpio, msm_gpio.dual_edge_irqs); | ||
290 | } | ||
291 | |||
292 | if (flow_type & (IRQ_TYPE_EDGE_RISING | IRQ_TYPE_LEVEL_HIGH)) | ||
293 | bits |= BIT(INTR_POL_CTL); | ||
294 | else | ||
295 | bits &= ~BIT(INTR_POL_CTL); | ||
296 | |||
297 | writel(bits, GPIO_INTR_CFG(gpio)); | ||
298 | |||
299 | if ((flow_type & IRQ_TYPE_EDGE_BOTH) == IRQ_TYPE_EDGE_BOTH) | ||
300 | msm_gpio_update_dual_edge_pos(gpio); | ||
301 | |||
302 | spin_unlock_irqrestore(&tlmm_lock, irq_flags); | ||
303 | |||
304 | return 0; | ||
305 | } | ||
306 | |||
307 | /* | ||
308 | * When the summary IRQ is raised, any number of GPIO lines may be high. | ||
309 | * It is the job of the summary handler to find all those GPIO lines | ||
310 | * which have been set as summary IRQ lines and which are triggered, | ||
311 | * and to call their interrupt handlers. | ||
312 | */ | ||
313 | static void msm_summary_irq_handler(unsigned int irq, struct irq_desc *desc) | ||
314 | { | ||
315 | unsigned long i; | ||
316 | struct irq_chip *chip = irq_desc_get_chip(desc); | ||
317 | |||
318 | chained_irq_enter(chip, desc); | ||
319 | |||
320 | for (i = find_first_bit(msm_gpio.enabled_irqs, NR_GPIO_IRQS); | ||
321 | i < NR_GPIO_IRQS; | ||
322 | i = find_next_bit(msm_gpio.enabled_irqs, NR_GPIO_IRQS, i + 1)) { | ||
323 | if (readl(GPIO_INTR_STATUS(i)) & BIT(INTR_STATUS)) | ||
324 | generic_handle_irq(msm_gpio_to_irq(&msm_gpio.gpio_chip, | ||
325 | i)); | ||
326 | } | ||
327 | |||
328 | chained_irq_exit(chip, desc); | ||
329 | } | ||
330 | |||
331 | static int msm_gpio_irq_set_wake(struct irq_data *d, unsigned int on) | ||
332 | { | ||
333 | int gpio = msm_irq_to_gpio(&msm_gpio.gpio_chip, d->irq); | ||
334 | |||
335 | if (on) { | ||
336 | if (bitmap_empty(msm_gpio.wake_irqs, NR_GPIO_IRQS)) | ||
337 | irq_set_irq_wake(TLMM_SCSS_SUMMARY_IRQ, 1); | ||
338 | set_bit(gpio, msm_gpio.wake_irqs); | ||
339 | } else { | ||
340 | clear_bit(gpio, msm_gpio.wake_irqs); | ||
341 | if (bitmap_empty(msm_gpio.wake_irqs, NR_GPIO_IRQS)) | ||
342 | irq_set_irq_wake(TLMM_SCSS_SUMMARY_IRQ, 0); | ||
343 | } | ||
344 | |||
345 | return 0; | ||
346 | } | ||
347 | |||
348 | static struct irq_chip msm_gpio_irq_chip = { | ||
349 | .name = "msmgpio", | ||
350 | .irq_mask = msm_gpio_irq_mask, | ||
351 | .irq_unmask = msm_gpio_irq_unmask, | ||
352 | .irq_ack = msm_gpio_irq_ack, | ||
353 | .irq_set_type = msm_gpio_irq_set_type, | ||
354 | .irq_set_wake = msm_gpio_irq_set_wake, | ||
355 | }; | ||
356 | |||
357 | static int __devinit msm_gpio_probe(struct platform_device *dev) | ||
358 | { | ||
359 | int i, irq, ret; | ||
360 | |||
361 | bitmap_zero(msm_gpio.enabled_irqs, NR_GPIO_IRQS); | ||
362 | bitmap_zero(msm_gpio.wake_irqs, NR_GPIO_IRQS); | ||
363 | bitmap_zero(msm_gpio.dual_edge_irqs, NR_GPIO_IRQS); | ||
364 | msm_gpio.gpio_chip.label = dev->name; | ||
365 | ret = gpiochip_add(&msm_gpio.gpio_chip); | ||
366 | if (ret < 0) | ||
367 | return ret; | ||
368 | |||
369 | for (i = 0; i < msm_gpio.gpio_chip.ngpio; ++i) { | ||
370 | irq = msm_gpio_to_irq(&msm_gpio.gpio_chip, i); | ||
371 | irq_set_chip_and_handler(irq, &msm_gpio_irq_chip, | ||
372 | handle_level_irq); | ||
373 | set_irq_flags(irq, IRQF_VALID); | ||
374 | } | ||
375 | |||
376 | irq_set_chained_handler(TLMM_SCSS_SUMMARY_IRQ, | ||
377 | msm_summary_irq_handler); | ||
378 | return 0; | ||
379 | } | ||
380 | |||
381 | static int __devexit msm_gpio_remove(struct platform_device *dev) | ||
382 | { | ||
383 | int ret = gpiochip_remove(&msm_gpio.gpio_chip); | ||
384 | |||
385 | if (ret < 0) | ||
386 | return ret; | ||
387 | |||
388 | irq_set_handler(TLMM_SCSS_SUMMARY_IRQ, NULL); | ||
389 | |||
390 | return 0; | ||
391 | } | ||
392 | |||
393 | static struct platform_driver msm_gpio_driver = { | ||
394 | .probe = msm_gpio_probe, | ||
395 | .remove = __devexit_p(msm_gpio_remove), | ||
396 | .driver = { | ||
397 | .name = "msmgpio", | ||
398 | .owner = THIS_MODULE, | ||
399 | }, | ||
400 | }; | ||
401 | |||
402 | static struct platform_device msm_device_gpio = { | ||
403 | .name = "msmgpio", | ||
404 | .id = -1, | ||
405 | }; | ||
406 | |||
407 | static int __init msm_gpio_init(void) | ||
408 | { | ||
409 | int rc; | ||
410 | |||
411 | rc = platform_driver_register(&msm_gpio_driver); | ||
412 | if (!rc) { | ||
413 | rc = platform_device_register(&msm_device_gpio); | ||
414 | if (rc) | ||
415 | platform_driver_unregister(&msm_gpio_driver); | ||
416 | } | ||
417 | |||
418 | return rc; | ||
419 | } | ||
420 | |||
421 | static void __exit msm_gpio_exit(void) | ||
422 | { | ||
423 | platform_device_unregister(&msm_device_gpio); | ||
424 | platform_driver_unregister(&msm_gpio_driver); | ||
425 | } | ||
426 | |||
427 | postcore_initcall(msm_gpio_init); | ||
428 | module_exit(msm_gpio_exit); | ||
429 | |||
430 | MODULE_AUTHOR("Gregory Bean <gbean@codeaurora.org>"); | ||
431 | MODULE_DESCRIPTION("Driver for Qualcomm MSM TLMMv2 SoC GPIOs"); | ||
432 | MODULE_LICENSE("GPL v2"); | ||
433 | MODULE_ALIAS("platform:msmgpio"); | ||
diff --git a/arch/arm/mach-msm/gpio.c b/arch/arm/mach-msm/gpio.c deleted file mode 100644 index 5ea273b00da8..000000000000 --- a/arch/arm/mach-msm/gpio.c +++ /dev/null | |||
@@ -1,376 +0,0 @@ | |||
1 | /* linux/arch/arm/mach-msm/gpio.c | ||
2 | * | ||
3 | * Copyright (C) 2007 Google, Inc. | ||
4 | * Copyright (c) 2009-2010, Code Aurora Forum. All rights reserved. | ||
5 | * | ||
6 | * This software is licensed under the terms of the GNU General Public | ||
7 | * License version 2, as published by the Free Software Foundation, and | ||
8 | * may be copied, distributed, and modified under those terms. | ||
9 | * | ||
10 | * This program is distributed in the hope that it will be useful, | ||
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
13 | * GNU General Public License for more details. | ||
14 | * | ||
15 | */ | ||
16 | |||
17 | #include <linux/bitops.h> | ||
18 | #include <linux/gpio.h> | ||
19 | #include <linux/interrupt.h> | ||
20 | #include <linux/io.h> | ||
21 | #include <linux/irq.h> | ||
22 | #include <linux/module.h> | ||
23 | #include "gpio_hw.h" | ||
24 | #include "gpiomux.h" | ||
25 | |||
26 | #define FIRST_GPIO_IRQ MSM_GPIO_TO_INT(0) | ||
27 | |||
28 | #define MSM_GPIO_BANK(bank, first, last) \ | ||
29 | { \ | ||
30 | .regs = { \ | ||
31 | .out = MSM_GPIO_OUT_##bank, \ | ||
32 | .in = MSM_GPIO_IN_##bank, \ | ||
33 | .int_status = MSM_GPIO_INT_STATUS_##bank, \ | ||
34 | .int_clear = MSM_GPIO_INT_CLEAR_##bank, \ | ||
35 | .int_en = MSM_GPIO_INT_EN_##bank, \ | ||
36 | .int_edge = MSM_GPIO_INT_EDGE_##bank, \ | ||
37 | .int_pos = MSM_GPIO_INT_POS_##bank, \ | ||
38 | .oe = MSM_GPIO_OE_##bank, \ | ||
39 | }, \ | ||
40 | .chip = { \ | ||
41 | .base = (first), \ | ||
42 | .ngpio = (last) - (first) + 1, \ | ||
43 | .get = msm_gpio_get, \ | ||
44 | .set = msm_gpio_set, \ | ||
45 | .direction_input = msm_gpio_direction_input, \ | ||
46 | .direction_output = msm_gpio_direction_output, \ | ||
47 | .to_irq = msm_gpio_to_irq, \ | ||
48 | .request = msm_gpio_request, \ | ||
49 | .free = msm_gpio_free, \ | ||
50 | } \ | ||
51 | } | ||
52 | |||
53 | #define MSM_GPIO_BROKEN_INT_CLEAR 1 | ||
54 | |||
55 | struct msm_gpio_regs { | ||
56 | void __iomem *out; | ||
57 | void __iomem *in; | ||
58 | void __iomem *int_status; | ||
59 | void __iomem *int_clear; | ||
60 | void __iomem *int_en; | ||
61 | void __iomem *int_edge; | ||
62 | void __iomem *int_pos; | ||
63 | void __iomem *oe; | ||
64 | }; | ||
65 | |||
66 | struct msm_gpio_chip { | ||
67 | spinlock_t lock; | ||
68 | struct gpio_chip chip; | ||
69 | struct msm_gpio_regs regs; | ||
70 | #if MSM_GPIO_BROKEN_INT_CLEAR | ||
71 | unsigned int_status_copy; | ||
72 | #endif | ||
73 | unsigned int both_edge_detect; | ||
74 | unsigned int int_enable[2]; /* 0: awake, 1: sleep */ | ||
75 | }; | ||
76 | |||
77 | static int msm_gpio_write(struct msm_gpio_chip *msm_chip, | ||
78 | unsigned offset, unsigned on) | ||
79 | { | ||
80 | unsigned mask = BIT(offset); | ||
81 | unsigned val; | ||
82 | |||
83 | val = readl(msm_chip->regs.out); | ||
84 | if (on) | ||
85 | writel(val | mask, msm_chip->regs.out); | ||
86 | else | ||
87 | writel(val & ~mask, msm_chip->regs.out); | ||
88 | return 0; | ||
89 | } | ||
90 | |||
91 | static void msm_gpio_update_both_edge_detect(struct msm_gpio_chip *msm_chip) | ||
92 | { | ||
93 | int loop_limit = 100; | ||
94 | unsigned pol, val, val2, intstat; | ||
95 | do { | ||
96 | val = readl(msm_chip->regs.in); | ||
97 | pol = readl(msm_chip->regs.int_pos); | ||
98 | pol = (pol & ~msm_chip->both_edge_detect) | | ||
99 | (~val & msm_chip->both_edge_detect); | ||
100 | writel(pol, msm_chip->regs.int_pos); | ||
101 | intstat = readl(msm_chip->regs.int_status); | ||
102 | val2 = readl(msm_chip->regs.in); | ||
103 | if (((val ^ val2) & msm_chip->both_edge_detect & ~intstat) == 0) | ||
104 | return; | ||
105 | } while (loop_limit-- > 0); | ||
106 | printk(KERN_ERR "msm_gpio_update_both_edge_detect, " | ||
107 | "failed to reach stable state %x != %x\n", val, val2); | ||
108 | } | ||
109 | |||
110 | static int msm_gpio_clear_detect_status(struct msm_gpio_chip *msm_chip, | ||
111 | unsigned offset) | ||
112 | { | ||
113 | unsigned bit = BIT(offset); | ||
114 | |||
115 | #if MSM_GPIO_BROKEN_INT_CLEAR | ||
116 | /* Save interrupts that already triggered before we loose them. */ | ||
117 | /* Any interrupt that triggers between the read of int_status */ | ||
118 | /* and the write to int_clear will still be lost though. */ | ||
119 | msm_chip->int_status_copy |= readl(msm_chip->regs.int_status); | ||
120 | msm_chip->int_status_copy &= ~bit; | ||
121 | #endif | ||
122 | writel(bit, msm_chip->regs.int_clear); | ||
123 | msm_gpio_update_both_edge_detect(msm_chip); | ||
124 | return 0; | ||
125 | } | ||
126 | |||
127 | static int msm_gpio_direction_input(struct gpio_chip *chip, unsigned offset) | ||
128 | { | ||
129 | struct msm_gpio_chip *msm_chip; | ||
130 | unsigned long irq_flags; | ||
131 | |||
132 | msm_chip = container_of(chip, struct msm_gpio_chip, chip); | ||
133 | spin_lock_irqsave(&msm_chip->lock, irq_flags); | ||
134 | writel(readl(msm_chip->regs.oe) & ~BIT(offset), msm_chip->regs.oe); | ||
135 | spin_unlock_irqrestore(&msm_chip->lock, irq_flags); | ||
136 | return 0; | ||
137 | } | ||
138 | |||
139 | static int | ||
140 | msm_gpio_direction_output(struct gpio_chip *chip, unsigned offset, int value) | ||
141 | { | ||
142 | struct msm_gpio_chip *msm_chip; | ||
143 | unsigned long irq_flags; | ||
144 | |||
145 | msm_chip = container_of(chip, struct msm_gpio_chip, chip); | ||
146 | spin_lock_irqsave(&msm_chip->lock, irq_flags); | ||
147 | msm_gpio_write(msm_chip, offset, value); | ||
148 | writel(readl(msm_chip->regs.oe) | BIT(offset), msm_chip->regs.oe); | ||
149 | spin_unlock_irqrestore(&msm_chip->lock, irq_flags); | ||
150 | return 0; | ||
151 | } | ||
152 | |||
153 | static int msm_gpio_get(struct gpio_chip *chip, unsigned offset) | ||
154 | { | ||
155 | struct msm_gpio_chip *msm_chip; | ||
156 | |||
157 | msm_chip = container_of(chip, struct msm_gpio_chip, chip); | ||
158 | return (readl(msm_chip->regs.in) & (1U << offset)) ? 1 : 0; | ||
159 | } | ||
160 | |||
161 | static void msm_gpio_set(struct gpio_chip *chip, unsigned offset, int value) | ||
162 | { | ||
163 | struct msm_gpio_chip *msm_chip; | ||
164 | unsigned long irq_flags; | ||
165 | |||
166 | msm_chip = container_of(chip, struct msm_gpio_chip, chip); | ||
167 | spin_lock_irqsave(&msm_chip->lock, irq_flags); | ||
168 | msm_gpio_write(msm_chip, offset, value); | ||
169 | spin_unlock_irqrestore(&msm_chip->lock, irq_flags); | ||
170 | } | ||
171 | |||
172 | static int msm_gpio_to_irq(struct gpio_chip *chip, unsigned offset) | ||
173 | { | ||
174 | return MSM_GPIO_TO_INT(chip->base + offset); | ||
175 | } | ||
176 | |||
177 | #ifdef CONFIG_MSM_GPIOMUX | ||
178 | static int msm_gpio_request(struct gpio_chip *chip, unsigned offset) | ||
179 | { | ||
180 | return msm_gpiomux_get(chip->base + offset); | ||
181 | } | ||
182 | |||
183 | static void msm_gpio_free(struct gpio_chip *chip, unsigned offset) | ||
184 | { | ||
185 | msm_gpiomux_put(chip->base + offset); | ||
186 | } | ||
187 | #else | ||
188 | #define msm_gpio_request NULL | ||
189 | #define msm_gpio_free NULL | ||
190 | #endif | ||
191 | |||
192 | struct msm_gpio_chip msm_gpio_chips[] = { | ||
193 | #if defined(CONFIG_ARCH_MSM7X00A) | ||
194 | MSM_GPIO_BANK(0, 0, 15), | ||
195 | MSM_GPIO_BANK(1, 16, 42), | ||
196 | MSM_GPIO_BANK(2, 43, 67), | ||
197 | MSM_GPIO_BANK(3, 68, 94), | ||
198 | MSM_GPIO_BANK(4, 95, 106), | ||
199 | MSM_GPIO_BANK(5, 107, 121), | ||
200 | #elif defined(CONFIG_ARCH_MSM7X25) || defined(CONFIG_ARCH_MSM7X27) | ||
201 | MSM_GPIO_BANK(0, 0, 15), | ||
202 | MSM_GPIO_BANK(1, 16, 42), | ||
203 | MSM_GPIO_BANK(2, 43, 67), | ||
204 | MSM_GPIO_BANK(3, 68, 94), | ||
205 | MSM_GPIO_BANK(4, 95, 106), | ||
206 | MSM_GPIO_BANK(5, 107, 132), | ||
207 | #elif defined(CONFIG_ARCH_MSM7X30) | ||
208 | MSM_GPIO_BANK(0, 0, 15), | ||
209 | MSM_GPIO_BANK(1, 16, 43), | ||
210 | MSM_GPIO_BANK(2, 44, 67), | ||
211 | MSM_GPIO_BANK(3, 68, 94), | ||
212 | MSM_GPIO_BANK(4, 95, 106), | ||
213 | MSM_GPIO_BANK(5, 107, 133), | ||
214 | MSM_GPIO_BANK(6, 134, 150), | ||
215 | MSM_GPIO_BANK(7, 151, 181), | ||
216 | #elif defined(CONFIG_ARCH_QSD8X50) | ||
217 | MSM_GPIO_BANK(0, 0, 15), | ||
218 | MSM_GPIO_BANK(1, 16, 42), | ||
219 | MSM_GPIO_BANK(2, 43, 67), | ||
220 | MSM_GPIO_BANK(3, 68, 94), | ||
221 | MSM_GPIO_BANK(4, 95, 103), | ||
222 | MSM_GPIO_BANK(5, 104, 121), | ||
223 | MSM_GPIO_BANK(6, 122, 152), | ||
224 | MSM_GPIO_BANK(7, 153, 164), | ||
225 | #endif | ||
226 | }; | ||
227 | |||
228 | static void msm_gpio_irq_ack(struct irq_data *d) | ||
229 | { | ||
230 | unsigned long irq_flags; | ||
231 | struct msm_gpio_chip *msm_chip = irq_data_get_irq_chip_data(d); | ||
232 | spin_lock_irqsave(&msm_chip->lock, irq_flags); | ||
233 | msm_gpio_clear_detect_status(msm_chip, | ||
234 | d->irq - gpio_to_irq(msm_chip->chip.base)); | ||
235 | spin_unlock_irqrestore(&msm_chip->lock, irq_flags); | ||
236 | } | ||
237 | |||
238 | static void msm_gpio_irq_mask(struct irq_data *d) | ||
239 | { | ||
240 | unsigned long irq_flags; | ||
241 | struct msm_gpio_chip *msm_chip = irq_data_get_irq_chip_data(d); | ||
242 | unsigned offset = d->irq - gpio_to_irq(msm_chip->chip.base); | ||
243 | |||
244 | spin_lock_irqsave(&msm_chip->lock, irq_flags); | ||
245 | /* level triggered interrupts are also latched */ | ||
246 | if (!(readl(msm_chip->regs.int_edge) & BIT(offset))) | ||
247 | msm_gpio_clear_detect_status(msm_chip, offset); | ||
248 | msm_chip->int_enable[0] &= ~BIT(offset); | ||
249 | writel(msm_chip->int_enable[0], msm_chip->regs.int_en); | ||
250 | spin_unlock_irqrestore(&msm_chip->lock, irq_flags); | ||
251 | } | ||
252 | |||
253 | static void msm_gpio_irq_unmask(struct irq_data *d) | ||
254 | { | ||
255 | unsigned long irq_flags; | ||
256 | struct msm_gpio_chip *msm_chip = irq_data_get_irq_chip_data(d); | ||
257 | unsigned offset = d->irq - gpio_to_irq(msm_chip->chip.base); | ||
258 | |||
259 | spin_lock_irqsave(&msm_chip->lock, irq_flags); | ||
260 | /* level triggered interrupts are also latched */ | ||
261 | if (!(readl(msm_chip->regs.int_edge) & BIT(offset))) | ||
262 | msm_gpio_clear_detect_status(msm_chip, offset); | ||
263 | msm_chip->int_enable[0] |= BIT(offset); | ||
264 | writel(msm_chip->int_enable[0], msm_chip->regs.int_en); | ||
265 | spin_unlock_irqrestore(&msm_chip->lock, irq_flags); | ||
266 | } | ||
267 | |||
268 | static int msm_gpio_irq_set_wake(struct irq_data *d, unsigned int on) | ||
269 | { | ||
270 | unsigned long irq_flags; | ||
271 | struct msm_gpio_chip *msm_chip = irq_data_get_irq_chip_data(d); | ||
272 | unsigned offset = d->irq - gpio_to_irq(msm_chip->chip.base); | ||
273 | |||
274 | spin_lock_irqsave(&msm_chip->lock, irq_flags); | ||
275 | |||
276 | if (on) | ||
277 | msm_chip->int_enable[1] |= BIT(offset); | ||
278 | else | ||
279 | msm_chip->int_enable[1] &= ~BIT(offset); | ||
280 | |||
281 | spin_unlock_irqrestore(&msm_chip->lock, irq_flags); | ||
282 | return 0; | ||
283 | } | ||
284 | |||
285 | static int msm_gpio_irq_set_type(struct irq_data *d, unsigned int flow_type) | ||
286 | { | ||
287 | unsigned long irq_flags; | ||
288 | struct msm_gpio_chip *msm_chip = irq_data_get_irq_chip_data(d); | ||
289 | unsigned offset = d->irq - gpio_to_irq(msm_chip->chip.base); | ||
290 | unsigned val, mask = BIT(offset); | ||
291 | |||
292 | spin_lock_irqsave(&msm_chip->lock, irq_flags); | ||
293 | val = readl(msm_chip->regs.int_edge); | ||
294 | if (flow_type & IRQ_TYPE_EDGE_BOTH) { | ||
295 | writel(val | mask, msm_chip->regs.int_edge); | ||
296 | __irq_set_handler_locked(d->irq, handle_edge_irq); | ||
297 | } else { | ||
298 | writel(val & ~mask, msm_chip->regs.int_edge); | ||
299 | __irq_set_handler_locked(d->irq, handle_level_irq); | ||
300 | } | ||
301 | if ((flow_type & IRQ_TYPE_EDGE_BOTH) == IRQ_TYPE_EDGE_BOTH) { | ||
302 | msm_chip->both_edge_detect |= mask; | ||
303 | msm_gpio_update_both_edge_detect(msm_chip); | ||
304 | } else { | ||
305 | msm_chip->both_edge_detect &= ~mask; | ||
306 | val = readl(msm_chip->regs.int_pos); | ||
307 | if (flow_type & (IRQF_TRIGGER_RISING | IRQF_TRIGGER_HIGH)) | ||
308 | writel(val | mask, msm_chip->regs.int_pos); | ||
309 | else | ||
310 | writel(val & ~mask, msm_chip->regs.int_pos); | ||
311 | } | ||
312 | spin_unlock_irqrestore(&msm_chip->lock, irq_flags); | ||
313 | return 0; | ||
314 | } | ||
315 | |||
316 | static void msm_gpio_irq_handler(unsigned int irq, struct irq_desc *desc) | ||
317 | { | ||
318 | int i, j, mask; | ||
319 | unsigned val; | ||
320 | |||
321 | for (i = 0; i < ARRAY_SIZE(msm_gpio_chips); i++) { | ||
322 | struct msm_gpio_chip *msm_chip = &msm_gpio_chips[i]; | ||
323 | val = readl(msm_chip->regs.int_status); | ||
324 | val &= msm_chip->int_enable[0]; | ||
325 | while (val) { | ||
326 | mask = val & -val; | ||
327 | j = fls(mask) - 1; | ||
328 | /* printk("%s %08x %08x bit %d gpio %d irq %d\n", | ||
329 | __func__, v, m, j, msm_chip->chip.start + j, | ||
330 | FIRST_GPIO_IRQ + msm_chip->chip.start + j); */ | ||
331 | val &= ~mask; | ||
332 | generic_handle_irq(FIRST_GPIO_IRQ + | ||
333 | msm_chip->chip.base + j); | ||
334 | } | ||
335 | } | ||
336 | desc->irq_data.chip->irq_ack(&desc->irq_data); | ||
337 | } | ||
338 | |||
339 | static struct irq_chip msm_gpio_irq_chip = { | ||
340 | .name = "msmgpio", | ||
341 | .irq_ack = msm_gpio_irq_ack, | ||
342 | .irq_mask = msm_gpio_irq_mask, | ||
343 | .irq_unmask = msm_gpio_irq_unmask, | ||
344 | .irq_set_wake = msm_gpio_irq_set_wake, | ||
345 | .irq_set_type = msm_gpio_irq_set_type, | ||
346 | }; | ||
347 | |||
348 | static int __init msm_init_gpio(void) | ||
349 | { | ||
350 | int i, j = 0; | ||
351 | |||
352 | for (i = FIRST_GPIO_IRQ; i < FIRST_GPIO_IRQ + NR_GPIO_IRQS; i++) { | ||
353 | if (i - FIRST_GPIO_IRQ >= | ||
354 | msm_gpio_chips[j].chip.base + | ||
355 | msm_gpio_chips[j].chip.ngpio) | ||
356 | j++; | ||
357 | irq_set_chip_data(i, &msm_gpio_chips[j]); | ||
358 | irq_set_chip_and_handler(i, &msm_gpio_irq_chip, | ||
359 | handle_edge_irq); | ||
360 | set_irq_flags(i, IRQF_VALID); | ||
361 | } | ||
362 | |||
363 | for (i = 0; i < ARRAY_SIZE(msm_gpio_chips); i++) { | ||
364 | spin_lock_init(&msm_gpio_chips[i].lock); | ||
365 | writel(0, msm_gpio_chips[i].regs.int_en); | ||
366 | gpiochip_add(&msm_gpio_chips[i].chip); | ||
367 | } | ||
368 | |||
369 | irq_set_chained_handler(INT_GPIO_GROUP1, msm_gpio_irq_handler); | ||
370 | irq_set_chained_handler(INT_GPIO_GROUP2, msm_gpio_irq_handler); | ||
371 | irq_set_irq_wake(INT_GPIO_GROUP1, 1); | ||
372 | irq_set_irq_wake(INT_GPIO_GROUP2, 2); | ||
373 | return 0; | ||
374 | } | ||
375 | |||
376 | postcore_initcall(msm_init_gpio); | ||
diff --git a/arch/arm/mach-msm/gpio_hw.h b/arch/arm/mach-msm/gpio_hw.h deleted file mode 100644 index 6b5066038baa..000000000000 --- a/arch/arm/mach-msm/gpio_hw.h +++ /dev/null | |||
@@ -1,278 +0,0 @@ | |||
1 | /* arch/arm/mach-msm/gpio_hw.h | ||
2 | * | ||
3 | * Copyright (C) 2007 Google, Inc. | ||
4 | * Author: Brian Swetland <swetland@google.com> | ||
5 | * Copyright (c) 2008-2010, Code Aurora Forum. All rights reserved. | ||
6 | * | ||
7 | * This software is licensed under the terms of the GNU General Public | ||
8 | * License version 2, as published by the Free Software Foundation, and | ||
9 | * may be copied, distributed, and modified under those terms. | ||
10 | * | ||
11 | * This program is distributed in the hope that it will be useful, | ||
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
14 | * GNU General Public License for more details. | ||
15 | * | ||
16 | */ | ||
17 | |||
18 | #ifndef __ARCH_ARM_MACH_MSM_GPIO_HW_H | ||
19 | #define __ARCH_ARM_MACH_MSM_GPIO_HW_H | ||
20 | |||
21 | #include <mach/msm_iomap.h> | ||
22 | |||
23 | /* see 80-VA736-2 Rev C pp 695-751 | ||
24 | ** | ||
25 | ** These are actually the *shadow* gpio registers, since the | ||
26 | ** real ones (which allow full access) are only available to the | ||
27 | ** ARM9 side of the world. | ||
28 | ** | ||
29 | ** Since the _BASE need to be page-aligned when we're mapping them | ||
30 | ** to virtual addresses, adjust for the additional offset in these | ||
31 | ** macros. | ||
32 | */ | ||
33 | |||
34 | #if defined(CONFIG_ARCH_MSM7X30) | ||
35 | #define MSM_GPIO1_REG(off) (MSM_GPIO1_BASE + (off)) | ||
36 | #define MSM_GPIO2_REG(off) (MSM_GPIO2_BASE + 0x400 + (off)) | ||
37 | #else | ||
38 | #define MSM_GPIO1_REG(off) (MSM_GPIO1_BASE + 0x800 + (off)) | ||
39 | #define MSM_GPIO2_REG(off) (MSM_GPIO2_BASE + 0xC00 + (off)) | ||
40 | #endif | ||
41 | |||
42 | #if defined(CONFIG_ARCH_MSM7X00A) || defined(CONFIG_ARCH_MSM7X25) ||\ | ||
43 | defined(CONFIG_ARCH_MSM7X27) | ||
44 | |||
45 | /* output value */ | ||
46 | #define MSM_GPIO_OUT_0 MSM_GPIO1_REG(0x00) /* gpio 15-0 */ | ||
47 | #define MSM_GPIO_OUT_1 MSM_GPIO2_REG(0x00) /* gpio 42-16 */ | ||
48 | #define MSM_GPIO_OUT_2 MSM_GPIO1_REG(0x04) /* gpio 67-43 */ | ||
49 | #define MSM_GPIO_OUT_3 MSM_GPIO1_REG(0x08) /* gpio 94-68 */ | ||
50 | #define MSM_GPIO_OUT_4 MSM_GPIO1_REG(0x0C) /* gpio 106-95 */ | ||
51 | #define MSM_GPIO_OUT_5 MSM_GPIO1_REG(0x50) /* gpio 107-121 */ | ||
52 | |||
53 | /* same pin map as above, output enable */ | ||
54 | #define MSM_GPIO_OE_0 MSM_GPIO1_REG(0x10) | ||
55 | #define MSM_GPIO_OE_1 MSM_GPIO2_REG(0x08) | ||
56 | #define MSM_GPIO_OE_2 MSM_GPIO1_REG(0x14) | ||
57 | #define MSM_GPIO_OE_3 MSM_GPIO1_REG(0x18) | ||
58 | #define MSM_GPIO_OE_4 MSM_GPIO1_REG(0x1C) | ||
59 | #define MSM_GPIO_OE_5 MSM_GPIO1_REG(0x54) | ||
60 | |||
61 | /* same pin map as above, input read */ | ||
62 | #define MSM_GPIO_IN_0 MSM_GPIO1_REG(0x34) | ||
63 | #define MSM_GPIO_IN_1 MSM_GPIO2_REG(0x20) | ||
64 | #define MSM_GPIO_IN_2 MSM_GPIO1_REG(0x38) | ||
65 | #define MSM_GPIO_IN_3 MSM_GPIO1_REG(0x3C) | ||
66 | #define MSM_GPIO_IN_4 MSM_GPIO1_REG(0x40) | ||
67 | #define MSM_GPIO_IN_5 MSM_GPIO1_REG(0x44) | ||
68 | |||
69 | /* same pin map as above, 1=edge 0=level interrup */ | ||
70 | #define MSM_GPIO_INT_EDGE_0 MSM_GPIO1_REG(0x60) | ||
71 | #define MSM_GPIO_INT_EDGE_1 MSM_GPIO2_REG(0x50) | ||
72 | #define MSM_GPIO_INT_EDGE_2 MSM_GPIO1_REG(0x64) | ||
73 | #define MSM_GPIO_INT_EDGE_3 MSM_GPIO1_REG(0x68) | ||
74 | #define MSM_GPIO_INT_EDGE_4 MSM_GPIO1_REG(0x6C) | ||
75 | #define MSM_GPIO_INT_EDGE_5 MSM_GPIO1_REG(0xC0) | ||
76 | |||
77 | /* same pin map as above, 1=positive 0=negative */ | ||
78 | #define MSM_GPIO_INT_POS_0 MSM_GPIO1_REG(0x70) | ||
79 | #define MSM_GPIO_INT_POS_1 MSM_GPIO2_REG(0x58) | ||
80 | #define MSM_GPIO_INT_POS_2 MSM_GPIO1_REG(0x74) | ||
81 | #define MSM_GPIO_INT_POS_3 MSM_GPIO1_REG(0x78) | ||
82 | #define MSM_GPIO_INT_POS_4 MSM_GPIO1_REG(0x7C) | ||
83 | #define MSM_GPIO_INT_POS_5 MSM_GPIO1_REG(0xBC) | ||
84 | |||
85 | /* same pin map as above, interrupt enable */ | ||
86 | #define MSM_GPIO_INT_EN_0 MSM_GPIO1_REG(0x80) | ||
87 | #define MSM_GPIO_INT_EN_1 MSM_GPIO2_REG(0x60) | ||
88 | #define MSM_GPIO_INT_EN_2 MSM_GPIO1_REG(0x84) | ||
89 | #define MSM_GPIO_INT_EN_3 MSM_GPIO1_REG(0x88) | ||
90 | #define MSM_GPIO_INT_EN_4 MSM_GPIO1_REG(0x8C) | ||
91 | #define MSM_GPIO_INT_EN_5 MSM_GPIO1_REG(0xB8) | ||
92 | |||
93 | /* same pin map as above, write 1 to clear interrupt */ | ||
94 | #define MSM_GPIO_INT_CLEAR_0 MSM_GPIO1_REG(0x90) | ||
95 | #define MSM_GPIO_INT_CLEAR_1 MSM_GPIO2_REG(0x68) | ||
96 | #define MSM_GPIO_INT_CLEAR_2 MSM_GPIO1_REG(0x94) | ||
97 | #define MSM_GPIO_INT_CLEAR_3 MSM_GPIO1_REG(0x98) | ||
98 | #define MSM_GPIO_INT_CLEAR_4 MSM_GPIO1_REG(0x9C) | ||
99 | #define MSM_GPIO_INT_CLEAR_5 MSM_GPIO1_REG(0xB4) | ||
100 | |||
101 | /* same pin map as above, 1=interrupt pending */ | ||
102 | #define MSM_GPIO_INT_STATUS_0 MSM_GPIO1_REG(0xA0) | ||
103 | #define MSM_GPIO_INT_STATUS_1 MSM_GPIO2_REG(0x70) | ||
104 | #define MSM_GPIO_INT_STATUS_2 MSM_GPIO1_REG(0xA4) | ||
105 | #define MSM_GPIO_INT_STATUS_3 MSM_GPIO1_REG(0xA8) | ||
106 | #define MSM_GPIO_INT_STATUS_4 MSM_GPIO1_REG(0xAC) | ||
107 | #define MSM_GPIO_INT_STATUS_5 MSM_GPIO1_REG(0xB0) | ||
108 | |||
109 | #endif | ||
110 | |||
111 | #if defined(CONFIG_ARCH_QSD8X50) | ||
112 | /* output value */ | ||
113 | #define MSM_GPIO_OUT_0 MSM_GPIO1_REG(0x00) /* gpio 15-0 */ | ||
114 | #define MSM_GPIO_OUT_1 MSM_GPIO2_REG(0x00) /* gpio 42-16 */ | ||
115 | #define MSM_GPIO_OUT_2 MSM_GPIO1_REG(0x04) /* gpio 67-43 */ | ||
116 | #define MSM_GPIO_OUT_3 MSM_GPIO1_REG(0x08) /* gpio 94-68 */ | ||
117 | #define MSM_GPIO_OUT_4 MSM_GPIO1_REG(0x0C) /* gpio 103-95 */ | ||
118 | #define MSM_GPIO_OUT_5 MSM_GPIO1_REG(0x10) /* gpio 121-104 */ | ||
119 | #define MSM_GPIO_OUT_6 MSM_GPIO1_REG(0x14) /* gpio 152-122 */ | ||
120 | #define MSM_GPIO_OUT_7 MSM_GPIO1_REG(0x18) /* gpio 164-153 */ | ||
121 | |||
122 | /* same pin map as above, output enable */ | ||
123 | #define MSM_GPIO_OE_0 MSM_GPIO1_REG(0x20) | ||
124 | #define MSM_GPIO_OE_1 MSM_GPIO2_REG(0x08) | ||
125 | #define MSM_GPIO_OE_2 MSM_GPIO1_REG(0x24) | ||
126 | #define MSM_GPIO_OE_3 MSM_GPIO1_REG(0x28) | ||
127 | #define MSM_GPIO_OE_4 MSM_GPIO1_REG(0x2C) | ||
128 | #define MSM_GPIO_OE_5 MSM_GPIO1_REG(0x30) | ||
129 | #define MSM_GPIO_OE_6 MSM_GPIO1_REG(0x34) | ||
130 | #define MSM_GPIO_OE_7 MSM_GPIO1_REG(0x38) | ||
131 | |||
132 | /* same pin map as above, input read */ | ||
133 | #define MSM_GPIO_IN_0 MSM_GPIO1_REG(0x50) | ||
134 | #define MSM_GPIO_IN_1 MSM_GPIO2_REG(0x20) | ||
135 | #define MSM_GPIO_IN_2 MSM_GPIO1_REG(0x54) | ||
136 | #define MSM_GPIO_IN_3 MSM_GPIO1_REG(0x58) | ||
137 | #define MSM_GPIO_IN_4 MSM_GPIO1_REG(0x5C) | ||
138 | #define MSM_GPIO_IN_5 MSM_GPIO1_REG(0x60) | ||
139 | #define MSM_GPIO_IN_6 MSM_GPIO1_REG(0x64) | ||
140 | #define MSM_GPIO_IN_7 MSM_GPIO1_REG(0x68) | ||
141 | |||
142 | /* same pin map as above, 1=edge 0=level interrup */ | ||
143 | #define MSM_GPIO_INT_EDGE_0 MSM_GPIO1_REG(0x70) | ||
144 | #define MSM_GPIO_INT_EDGE_1 MSM_GPIO2_REG(0x50) | ||
145 | #define MSM_GPIO_INT_EDGE_2 MSM_GPIO1_REG(0x74) | ||
146 | #define MSM_GPIO_INT_EDGE_3 MSM_GPIO1_REG(0x78) | ||
147 | #define MSM_GPIO_INT_EDGE_4 MSM_GPIO1_REG(0x7C) | ||
148 | #define MSM_GPIO_INT_EDGE_5 MSM_GPIO1_REG(0x80) | ||
149 | #define MSM_GPIO_INT_EDGE_6 MSM_GPIO1_REG(0x84) | ||
150 | #define MSM_GPIO_INT_EDGE_7 MSM_GPIO1_REG(0x88) | ||
151 | |||
152 | /* same pin map as above, 1=positive 0=negative */ | ||
153 | #define MSM_GPIO_INT_POS_0 MSM_GPIO1_REG(0x90) | ||
154 | #define MSM_GPIO_INT_POS_1 MSM_GPIO2_REG(0x58) | ||
155 | #define MSM_GPIO_INT_POS_2 MSM_GPIO1_REG(0x94) | ||
156 | #define MSM_GPIO_INT_POS_3 MSM_GPIO1_REG(0x98) | ||
157 | #define MSM_GPIO_INT_POS_4 MSM_GPIO1_REG(0x9C) | ||
158 | #define MSM_GPIO_INT_POS_5 MSM_GPIO1_REG(0xA0) | ||
159 | #define MSM_GPIO_INT_POS_6 MSM_GPIO1_REG(0xA4) | ||
160 | #define MSM_GPIO_INT_POS_7 MSM_GPIO1_REG(0xA8) | ||
161 | |||
162 | /* same pin map as above, interrupt enable */ | ||
163 | #define MSM_GPIO_INT_EN_0 MSM_GPIO1_REG(0xB0) | ||
164 | #define MSM_GPIO_INT_EN_1 MSM_GPIO2_REG(0x60) | ||
165 | #define MSM_GPIO_INT_EN_2 MSM_GPIO1_REG(0xB4) | ||
166 | #define MSM_GPIO_INT_EN_3 MSM_GPIO1_REG(0xB8) | ||
167 | #define MSM_GPIO_INT_EN_4 MSM_GPIO1_REG(0xBC) | ||
168 | #define MSM_GPIO_INT_EN_5 MSM_GPIO1_REG(0xC0) | ||
169 | #define MSM_GPIO_INT_EN_6 MSM_GPIO1_REG(0xC4) | ||
170 | #define MSM_GPIO_INT_EN_7 MSM_GPIO1_REG(0xC8) | ||
171 | |||
172 | /* same pin map as above, write 1 to clear interrupt */ | ||
173 | #define MSM_GPIO_INT_CLEAR_0 MSM_GPIO1_REG(0xD0) | ||
174 | #define MSM_GPIO_INT_CLEAR_1 MSM_GPIO2_REG(0x68) | ||
175 | #define MSM_GPIO_INT_CLEAR_2 MSM_GPIO1_REG(0xD4) | ||
176 | #define MSM_GPIO_INT_CLEAR_3 MSM_GPIO1_REG(0xD8) | ||
177 | #define MSM_GPIO_INT_CLEAR_4 MSM_GPIO1_REG(0xDC) | ||
178 | #define MSM_GPIO_INT_CLEAR_5 MSM_GPIO1_REG(0xE0) | ||
179 | #define MSM_GPIO_INT_CLEAR_6 MSM_GPIO1_REG(0xE4) | ||
180 | #define MSM_GPIO_INT_CLEAR_7 MSM_GPIO1_REG(0xE8) | ||
181 | |||
182 | /* same pin map as above, 1=interrupt pending */ | ||
183 | #define MSM_GPIO_INT_STATUS_0 MSM_GPIO1_REG(0xF0) | ||
184 | #define MSM_GPIO_INT_STATUS_1 MSM_GPIO2_REG(0x70) | ||
185 | #define MSM_GPIO_INT_STATUS_2 MSM_GPIO1_REG(0xF4) | ||
186 | #define MSM_GPIO_INT_STATUS_3 MSM_GPIO1_REG(0xF8) | ||
187 | #define MSM_GPIO_INT_STATUS_4 MSM_GPIO1_REG(0xFC) | ||
188 | #define MSM_GPIO_INT_STATUS_5 MSM_GPIO1_REG(0x100) | ||
189 | #define MSM_GPIO_INT_STATUS_6 MSM_GPIO1_REG(0x104) | ||
190 | #define MSM_GPIO_INT_STATUS_7 MSM_GPIO1_REG(0x108) | ||
191 | |||
192 | #endif | ||
193 | |||
194 | #if defined(CONFIG_ARCH_MSM7X30) | ||
195 | |||
196 | /* output value */ | ||
197 | #define MSM_GPIO_OUT_0 MSM_GPIO1_REG(0x00) /* gpio 15-0 */ | ||
198 | #define MSM_GPIO_OUT_1 MSM_GPIO2_REG(0x00) /* gpio 43-16 */ | ||
199 | #define MSM_GPIO_OUT_2 MSM_GPIO1_REG(0x04) /* gpio 67-44 */ | ||
200 | #define MSM_GPIO_OUT_3 MSM_GPIO1_REG(0x08) /* gpio 94-68 */ | ||
201 | #define MSM_GPIO_OUT_4 MSM_GPIO1_REG(0x0C) /* gpio 106-95 */ | ||
202 | #define MSM_GPIO_OUT_5 MSM_GPIO1_REG(0x50) /* gpio 133-107 */ | ||
203 | #define MSM_GPIO_OUT_6 MSM_GPIO1_REG(0xC4) /* gpio 150-134 */ | ||
204 | #define MSM_GPIO_OUT_7 MSM_GPIO1_REG(0x214) /* gpio 181-151 */ | ||
205 | |||
206 | /* same pin map as above, output enable */ | ||
207 | #define MSM_GPIO_OE_0 MSM_GPIO1_REG(0x10) | ||
208 | #define MSM_GPIO_OE_1 MSM_GPIO2_REG(0x08) | ||
209 | #define MSM_GPIO_OE_2 MSM_GPIO1_REG(0x14) | ||
210 | #define MSM_GPIO_OE_3 MSM_GPIO1_REG(0x18) | ||
211 | #define MSM_GPIO_OE_4 MSM_GPIO1_REG(0x1C) | ||
212 | #define MSM_GPIO_OE_5 MSM_GPIO1_REG(0x54) | ||
213 | #define MSM_GPIO_OE_6 MSM_GPIO1_REG(0xC8) | ||
214 | #define MSM_GPIO_OE_7 MSM_GPIO1_REG(0x218) | ||
215 | |||
216 | /* same pin map as above, input read */ | ||
217 | #define MSM_GPIO_IN_0 MSM_GPIO1_REG(0x34) | ||
218 | #define MSM_GPIO_IN_1 MSM_GPIO2_REG(0x20) | ||
219 | #define MSM_GPIO_IN_2 MSM_GPIO1_REG(0x38) | ||
220 | #define MSM_GPIO_IN_3 MSM_GPIO1_REG(0x3C) | ||
221 | #define MSM_GPIO_IN_4 MSM_GPIO1_REG(0x40) | ||
222 | #define MSM_GPIO_IN_5 MSM_GPIO1_REG(0x44) | ||
223 | #define MSM_GPIO_IN_6 MSM_GPIO1_REG(0xCC) | ||
224 | #define MSM_GPIO_IN_7 MSM_GPIO1_REG(0x21C) | ||
225 | |||
226 | /* same pin map as above, 1=edge 0=level interrup */ | ||
227 | #define MSM_GPIO_INT_EDGE_0 MSM_GPIO1_REG(0x60) | ||
228 | #define MSM_GPIO_INT_EDGE_1 MSM_GPIO2_REG(0x50) | ||
229 | #define MSM_GPIO_INT_EDGE_2 MSM_GPIO1_REG(0x64) | ||
230 | #define MSM_GPIO_INT_EDGE_3 MSM_GPIO1_REG(0x68) | ||
231 | #define MSM_GPIO_INT_EDGE_4 MSM_GPIO1_REG(0x6C) | ||
232 | #define MSM_GPIO_INT_EDGE_5 MSM_GPIO1_REG(0xC0) | ||
233 | #define MSM_GPIO_INT_EDGE_6 MSM_GPIO1_REG(0xD0) | ||
234 | #define MSM_GPIO_INT_EDGE_7 MSM_GPIO1_REG(0x240) | ||
235 | |||
236 | /* same pin map as above, 1=positive 0=negative */ | ||
237 | #define MSM_GPIO_INT_POS_0 MSM_GPIO1_REG(0x70) | ||
238 | #define MSM_GPIO_INT_POS_1 MSM_GPIO2_REG(0x58) | ||
239 | #define MSM_GPIO_INT_POS_2 MSM_GPIO1_REG(0x74) | ||
240 | #define MSM_GPIO_INT_POS_3 MSM_GPIO1_REG(0x78) | ||
241 | #define MSM_GPIO_INT_POS_4 MSM_GPIO1_REG(0x7C) | ||
242 | #define MSM_GPIO_INT_POS_5 MSM_GPIO1_REG(0xBC) | ||
243 | #define MSM_GPIO_INT_POS_6 MSM_GPIO1_REG(0xD4) | ||
244 | #define MSM_GPIO_INT_POS_7 MSM_GPIO1_REG(0x228) | ||
245 | |||
246 | /* same pin map as above, interrupt enable */ | ||
247 | #define MSM_GPIO_INT_EN_0 MSM_GPIO1_REG(0x80) | ||
248 | #define MSM_GPIO_INT_EN_1 MSM_GPIO2_REG(0x60) | ||
249 | #define MSM_GPIO_INT_EN_2 MSM_GPIO1_REG(0x84) | ||
250 | #define MSM_GPIO_INT_EN_3 MSM_GPIO1_REG(0x88) | ||
251 | #define MSM_GPIO_INT_EN_4 MSM_GPIO1_REG(0x8C) | ||
252 | #define MSM_GPIO_INT_EN_5 MSM_GPIO1_REG(0xB8) | ||
253 | #define MSM_GPIO_INT_EN_6 MSM_GPIO1_REG(0xD8) | ||
254 | #define MSM_GPIO_INT_EN_7 MSM_GPIO1_REG(0x22C) | ||
255 | |||
256 | /* same pin map as above, write 1 to clear interrupt */ | ||
257 | #define MSM_GPIO_INT_CLEAR_0 MSM_GPIO1_REG(0x90) | ||
258 | #define MSM_GPIO_INT_CLEAR_1 MSM_GPIO2_REG(0x68) | ||
259 | #define MSM_GPIO_INT_CLEAR_2 MSM_GPIO1_REG(0x94) | ||
260 | #define MSM_GPIO_INT_CLEAR_3 MSM_GPIO1_REG(0x98) | ||
261 | #define MSM_GPIO_INT_CLEAR_4 MSM_GPIO1_REG(0x9C) | ||
262 | #define MSM_GPIO_INT_CLEAR_5 MSM_GPIO1_REG(0xB4) | ||
263 | #define MSM_GPIO_INT_CLEAR_6 MSM_GPIO1_REG(0xDC) | ||
264 | #define MSM_GPIO_INT_CLEAR_7 MSM_GPIO1_REG(0x230) | ||
265 | |||
266 | /* same pin map as above, 1=interrupt pending */ | ||
267 | #define MSM_GPIO_INT_STATUS_0 MSM_GPIO1_REG(0xA0) | ||
268 | #define MSM_GPIO_INT_STATUS_1 MSM_GPIO2_REG(0x70) | ||
269 | #define MSM_GPIO_INT_STATUS_2 MSM_GPIO1_REG(0xA4) | ||
270 | #define MSM_GPIO_INT_STATUS_3 MSM_GPIO1_REG(0xA8) | ||
271 | #define MSM_GPIO_INT_STATUS_4 MSM_GPIO1_REG(0xAC) | ||
272 | #define MSM_GPIO_INT_STATUS_5 MSM_GPIO1_REG(0xB0) | ||
273 | #define MSM_GPIO_INT_STATUS_6 MSM_GPIO1_REG(0xE0) | ||
274 | #define MSM_GPIO_INT_STATUS_7 MSM_GPIO1_REG(0x234) | ||
275 | |||
276 | #endif | ||
277 | |||
278 | #endif | ||
diff --git a/arch/arm/mach-msm/gpiomux.h b/arch/arm/mach-msm/gpiomux.h index b178d9cb742f..00459f6ee13c 100644 --- a/arch/arm/mach-msm/gpiomux.h +++ b/arch/arm/mach-msm/gpiomux.h | |||
@@ -19,6 +19,7 @@ | |||
19 | 19 | ||
20 | #include <linux/bitops.h> | 20 | #include <linux/bitops.h> |
21 | #include <linux/errno.h> | 21 | #include <linux/errno.h> |
22 | #include <mach/msm_gpiomux.h> | ||
22 | 23 | ||
23 | #if defined(CONFIG_MSM_V2_TLMM) | 24 | #if defined(CONFIG_MSM_V2_TLMM) |
24 | #include "gpiomux-v2.h" | 25 | #include "gpiomux-v2.h" |
@@ -71,12 +72,6 @@ enum { | |||
71 | */ | 72 | */ |
72 | extern struct msm_gpiomux_config msm_gpiomux_configs[GPIOMUX_NGPIOS]; | 73 | extern struct msm_gpiomux_config msm_gpiomux_configs[GPIOMUX_NGPIOS]; |
73 | 74 | ||
74 | /* Increment a gpio's reference count, possibly activating the line. */ | ||
75 | int __must_check msm_gpiomux_get(unsigned gpio); | ||
76 | |||
77 | /* Decrement a gpio's reference count, possibly suspending the line. */ | ||
78 | int msm_gpiomux_put(unsigned gpio); | ||
79 | |||
80 | /* Install a new configuration to the gpio line. To avoid overwriting | 75 | /* Install a new configuration to the gpio line. To avoid overwriting |
81 | * a configuration, leave the VALID bit out. | 76 | * a configuration, leave the VALID bit out. |
82 | */ | 77 | */ |
@@ -94,16 +89,6 @@ int msm_gpiomux_write(unsigned gpio, | |||
94 | */ | 89 | */ |
95 | void __msm_gpiomux_write(unsigned gpio, gpiomux_config_t val); | 90 | void __msm_gpiomux_write(unsigned gpio, gpiomux_config_t val); |
96 | #else | 91 | #else |
97 | static inline int __must_check msm_gpiomux_get(unsigned gpio) | ||
98 | { | ||
99 | return -ENOSYS; | ||
100 | } | ||
101 | |||
102 | static inline int msm_gpiomux_put(unsigned gpio) | ||
103 | { | ||
104 | return -ENOSYS; | ||
105 | } | ||
106 | |||
107 | static inline int msm_gpiomux_write(unsigned gpio, | 92 | static inline int msm_gpiomux_write(unsigned gpio, |
108 | gpiomux_config_t active, | 93 | gpiomux_config_t active, |
109 | gpiomux_config_t suspended) | 94 | gpiomux_config_t suspended) |
diff --git a/arch/arm/mach-msm/include/mach/msm_gpiomux.h b/arch/arm/mach-msm/include/mach/msm_gpiomux.h new file mode 100644 index 000000000000..0c7d3936e02f --- /dev/null +++ b/arch/arm/mach-msm/include/mach/msm_gpiomux.h | |||
@@ -0,0 +1,38 @@ | |||
1 | /* Copyright (c) 2011, Code Aurora Forum. All rights reserved. | ||
2 | * | ||
3 | * This program is free software; you can redistribute it and/or modify | ||
4 | * it under the terms of the GNU General Public License version 2 and | ||
5 | * only version 2 as published by the Free Software Foundation. | ||
6 | * | ||
7 | * This program is distributed in the hope that it will be useful, | ||
8 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
9 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
10 | * GNU General Public License for more details. | ||
11 | */ | ||
12 | |||
13 | #ifndef _LINUX_MSM_GPIOMUX_H | ||
14 | #define _LINUX_MSM_GPIOMUX_H | ||
15 | |||
16 | #ifdef CONFIG_MSM_GPIOMUX | ||
17 | |||
18 | /* Increment a gpio's reference count, possibly activating the line. */ | ||
19 | int __must_check msm_gpiomux_get(unsigned gpio); | ||
20 | |||
21 | /* Decrement a gpio's reference count, possibly suspending the line. */ | ||
22 | int msm_gpiomux_put(unsigned gpio); | ||
23 | |||
24 | #else | ||
25 | |||
26 | static inline int __must_check msm_gpiomux_get(unsigned gpio) | ||
27 | { | ||
28 | return -ENOSYS; | ||
29 | } | ||
30 | |||
31 | static inline int msm_gpiomux_put(unsigned gpio) | ||
32 | { | ||
33 | return -ENOSYS; | ||
34 | } | ||
35 | |||
36 | #endif | ||
37 | |||
38 | #endif /* _LINUX_MSM_GPIOMUX_H */ | ||
diff --git a/arch/arm/mach-msm/include/mach/msm_iomap-7x00.h b/arch/arm/mach-msm/include/mach/msm_iomap-7x00.h index 8f99d97615a0..94fe9fe6feb3 100644 --- a/arch/arm/mach-msm/include/mach/msm_iomap-7x00.h +++ b/arch/arm/mach-msm/include/mach/msm_iomap-7x00.h | |||
@@ -55,13 +55,11 @@ | |||
55 | #define MSM_DMOV_PHYS 0xA9700000 | 55 | #define MSM_DMOV_PHYS 0xA9700000 |
56 | #define MSM_DMOV_SIZE SZ_4K | 56 | #define MSM_DMOV_SIZE SZ_4K |
57 | 57 | ||
58 | #define MSM_GPIO1_BASE IOMEM(0xE0003000) | 58 | #define MSM7X00_GPIO1_PHYS 0xA9200000 |
59 | #define MSM_GPIO1_PHYS 0xA9200000 | 59 | #define MSM7X00_GPIO1_SIZE SZ_4K |
60 | #define MSM_GPIO1_SIZE SZ_4K | ||
61 | 60 | ||
62 | #define MSM_GPIO2_BASE IOMEM(0xE0004000) | 61 | #define MSM7X00_GPIO2_PHYS 0xA9300000 |
63 | #define MSM_GPIO2_PHYS 0xA9300000 | 62 | #define MSM7X00_GPIO2_SIZE SZ_4K |
64 | #define MSM_GPIO2_SIZE SZ_4K | ||
65 | 63 | ||
66 | #define MSM_CLK_CTL_BASE IOMEM(0xE0005000) | 64 | #define MSM_CLK_CTL_BASE IOMEM(0xE0005000) |
67 | #define MSM_CLK_CTL_PHYS 0xA8600000 | 65 | #define MSM_CLK_CTL_PHYS 0xA8600000 |
diff --git a/arch/arm/mach-msm/include/mach/msm_iomap-7x30.h b/arch/arm/mach-msm/include/mach/msm_iomap-7x30.h index 4d84be15955e..37694442d1bd 100644 --- a/arch/arm/mach-msm/include/mach/msm_iomap-7x30.h +++ b/arch/arm/mach-msm/include/mach/msm_iomap-7x30.h | |||
@@ -46,13 +46,11 @@ | |||
46 | #define MSM_DMOV_PHYS 0xAC400000 | 46 | #define MSM_DMOV_PHYS 0xAC400000 |
47 | #define MSM_DMOV_SIZE SZ_4K | 47 | #define MSM_DMOV_SIZE SZ_4K |
48 | 48 | ||
49 | #define MSM_GPIO1_BASE IOMEM(0xE0003000) | 49 | #define MSM7X30_GPIO1_PHYS 0xAC001000 |
50 | #define MSM_GPIO1_PHYS 0xAC001000 | 50 | #define MSM7X30_GPIO1_SIZE SZ_4K |
51 | #define MSM_GPIO1_SIZE SZ_4K | ||
52 | 51 | ||
53 | #define MSM_GPIO2_BASE IOMEM(0xE0004000) | 52 | #define MSM7X30_GPIO2_PHYS 0xAC101000 |
54 | #define MSM_GPIO2_PHYS 0xAC101000 | 53 | #define MSM7X30_GPIO2_SIZE SZ_4K |
55 | #define MSM_GPIO2_SIZE SZ_4K | ||
56 | 54 | ||
57 | #define MSM_CLK_CTL_BASE IOMEM(0xE0005000) | 55 | #define MSM_CLK_CTL_BASE IOMEM(0xE0005000) |
58 | #define MSM_CLK_CTL_PHYS 0xAB800000 | 56 | #define MSM_CLK_CTL_PHYS 0xAB800000 |
diff --git a/arch/arm/mach-msm/include/mach/msm_iomap-8x50.h b/arch/arm/mach-msm/include/mach/msm_iomap-8x50.h index d4143201999f..d67cd73316f4 100644 --- a/arch/arm/mach-msm/include/mach/msm_iomap-8x50.h +++ b/arch/arm/mach-msm/include/mach/msm_iomap-8x50.h | |||
@@ -46,13 +46,11 @@ | |||
46 | #define MSM_DMOV_PHYS 0xA9700000 | 46 | #define MSM_DMOV_PHYS 0xA9700000 |
47 | #define MSM_DMOV_SIZE SZ_4K | 47 | #define MSM_DMOV_SIZE SZ_4K |
48 | 48 | ||
49 | #define MSM_GPIO1_BASE IOMEM(0xE0003000) | 49 | #define QSD8X50_GPIO1_PHYS 0xA9000000 |
50 | #define MSM_GPIO1_PHYS 0xA9000000 | 50 | #define QSD8X50_GPIO1_SIZE SZ_4K |
51 | #define MSM_GPIO1_SIZE SZ_4K | ||
52 | 51 | ||
53 | #define MSM_GPIO2_BASE IOMEM(0xE0004000) | 52 | #define QSD8X50_GPIO2_PHYS 0xA9100000 |
54 | #define MSM_GPIO2_PHYS 0xA9100000 | 53 | #define QSD8X50_GPIO2_SIZE SZ_4K |
55 | #define MSM_GPIO2_SIZE SZ_4K | ||
56 | 54 | ||
57 | #define MSM_CLK_CTL_BASE IOMEM(0xE0005000) | 55 | #define MSM_CLK_CTL_BASE IOMEM(0xE0005000) |
58 | #define MSM_CLK_CTL_PHYS 0xA8600000 | 56 | #define MSM_CLK_CTL_PHYS 0xA8600000 |
diff --git a/arch/arm/mach-msm/include/mach/msm_iomap.h b/arch/arm/mach-msm/include/mach/msm_iomap.h index 2f494b6a9d0a..4ded15238b60 100644 --- a/arch/arm/mach-msm/include/mach/msm_iomap.h +++ b/arch/arm/mach-msm/include/mach/msm_iomap.h | |||
@@ -61,5 +61,7 @@ | |||
61 | #define MSM_QGIC_CPU_BASE IOMEM(0xF0001000) | 61 | #define MSM_QGIC_CPU_BASE IOMEM(0xF0001000) |
62 | #define MSM_TMR_BASE IOMEM(0xF0200000) | 62 | #define MSM_TMR_BASE IOMEM(0xF0200000) |
63 | #define MSM_TMR0_BASE IOMEM(0xF0201000) | 63 | #define MSM_TMR0_BASE IOMEM(0xF0201000) |
64 | #define MSM_GPIO1_BASE IOMEM(0xE0003000) | ||
65 | #define MSM_GPIO2_BASE IOMEM(0xE0004000) | ||
64 | 66 | ||
65 | #endif | 67 | #endif |
diff --git a/arch/arm/mach-msm/io.c b/arch/arm/mach-msm/io.c index cec6ed1c91d3..140ddbbc3a8a 100644 --- a/arch/arm/mach-msm/io.c +++ b/arch/arm/mach-msm/io.c | |||
@@ -43,8 +43,8 @@ static struct map_desc msm_io_desc[] __initdata = { | |||
43 | MSM_DEVICE(VIC), | 43 | MSM_DEVICE(VIC), |
44 | MSM_CHIP_DEVICE(CSR, MSM7X00), | 44 | MSM_CHIP_DEVICE(CSR, MSM7X00), |
45 | MSM_DEVICE(DMOV), | 45 | MSM_DEVICE(DMOV), |
46 | MSM_DEVICE(GPIO1), | 46 | MSM_CHIP_DEVICE(GPIO1, MSM7X00), |
47 | MSM_DEVICE(GPIO2), | 47 | MSM_CHIP_DEVICE(GPIO2, MSM7X00), |
48 | MSM_DEVICE(CLK_CTL), | 48 | MSM_DEVICE(CLK_CTL), |
49 | #ifdef CONFIG_MSM_DEBUG_UART | 49 | #ifdef CONFIG_MSM_DEBUG_UART |
50 | MSM_DEVICE(DEBUG_UART), | 50 | MSM_DEVICE(DEBUG_UART), |
@@ -76,8 +76,8 @@ static struct map_desc qsd8x50_io_desc[] __initdata = { | |||
76 | MSM_DEVICE(VIC), | 76 | MSM_DEVICE(VIC), |
77 | MSM_CHIP_DEVICE(CSR, QSD8X50), | 77 | MSM_CHIP_DEVICE(CSR, QSD8X50), |
78 | MSM_DEVICE(DMOV), | 78 | MSM_DEVICE(DMOV), |
79 | MSM_DEVICE(GPIO1), | 79 | MSM_CHIP_DEVICE(GPIO1, QSD8X50), |
80 | MSM_DEVICE(GPIO2), | 80 | MSM_CHIP_DEVICE(GPIO2, QSD8X50), |
81 | MSM_DEVICE(CLK_CTL), | 81 | MSM_DEVICE(CLK_CTL), |
82 | MSM_DEVICE(SIRC), | 82 | MSM_DEVICE(SIRC), |
83 | MSM_DEVICE(SCPLL), | 83 | MSM_DEVICE(SCPLL), |
@@ -135,8 +135,8 @@ static struct map_desc msm7x30_io_desc[] __initdata = { | |||
135 | MSM_DEVICE(VIC), | 135 | MSM_DEVICE(VIC), |
136 | MSM_CHIP_DEVICE(CSR, MSM7X30), | 136 | MSM_CHIP_DEVICE(CSR, MSM7X30), |
137 | MSM_DEVICE(DMOV), | 137 | MSM_DEVICE(DMOV), |
138 | MSM_DEVICE(GPIO1), | 138 | MSM_CHIP_DEVICE(GPIO1, MSM7X30), |
139 | MSM_DEVICE(GPIO2), | 139 | MSM_CHIP_DEVICE(GPIO2, MSM7X30), |
140 | MSM_DEVICE(CLK_CTL), | 140 | MSM_DEVICE(CLK_CTL), |
141 | MSM_DEVICE(CLK_CTL_SH2), | 141 | MSM_DEVICE(CLK_CTL_SH2), |
142 | MSM_DEVICE(AD5), | 142 | MSM_DEVICE(AD5), |
diff --git a/arch/arm/mach-mv78xx0/pcie.c b/arch/arm/mach-mv78xx0/pcie.c index d6336afe9948..c51af1cac300 100644 --- a/arch/arm/mach-mv78xx0/pcie.c +++ b/arch/arm/mach-mv78xx0/pcie.c | |||
@@ -260,7 +260,8 @@ mv78xx0_pcie_scan_bus(int nr, struct pci_sys_data *sys) | |||
260 | return bus; | 260 | return bus; |
261 | } | 261 | } |
262 | 262 | ||
263 | static int __init mv78xx0_pcie_map_irq(struct pci_dev *dev, u8 slot, u8 pin) | 263 | static int __init mv78xx0_pcie_map_irq(const struct pci_dev *dev, u8 slot, |
264 | u8 pin) | ||
264 | { | 265 | { |
265 | struct pcie_port *pp = bus_to_port(dev->bus->number); | 266 | struct pcie_port *pp = bus_to_port(dev->bus->number); |
266 | 267 | ||
diff --git a/arch/arm/mach-omap2/board-rx51-peripherals.c b/arch/arm/mach-omap2/board-rx51-peripherals.c index cc503aa89c5e..5a886cd2c598 100644 --- a/arch/arm/mach-omap2/board-rx51-peripherals.c +++ b/arch/arm/mach-omap2/board-rx51-peripherals.c | |||
@@ -418,6 +418,10 @@ static struct regulator_consumer_supply rx51_vmmc1_supply[] = { | |||
418 | REGULATOR_SUPPLY("vmmc", "omap_hsmmc.0"), | 418 | REGULATOR_SUPPLY("vmmc", "omap_hsmmc.0"), |
419 | }; | 419 | }; |
420 | 420 | ||
421 | static struct regulator_consumer_supply rx51_vaux2_supply[] = { | ||
422 | REGULATOR_SUPPLY("vdds_csib", "omap3isp"), | ||
423 | }; | ||
424 | |||
421 | static struct regulator_consumer_supply rx51_vaux3_supply[] = { | 425 | static struct regulator_consumer_supply rx51_vaux3_supply[] = { |
422 | REGULATOR_SUPPLY("vmmc", "omap_hsmmc.1"), | 426 | REGULATOR_SUPPLY("vmmc", "omap_hsmmc.1"), |
423 | }; | 427 | }; |
@@ -479,6 +483,8 @@ static struct regulator_init_data rx51_vaux2 = { | |||
479 | .valid_ops_mask = REGULATOR_CHANGE_MODE | 483 | .valid_ops_mask = REGULATOR_CHANGE_MODE |
480 | | REGULATOR_CHANGE_STATUS, | 484 | | REGULATOR_CHANGE_STATUS, |
481 | }, | 485 | }, |
486 | .num_consumer_supplies = ARRAY_SIZE(rx51_vaux2_supply), | ||
487 | .consumer_supplies = rx51_vaux2_supply, | ||
482 | }; | 488 | }; |
483 | 489 | ||
484 | /* VAUX3 - adds more power to VIO_18 rail */ | 490 | /* VAUX3 - adds more power to VIO_18 rail */ |
diff --git a/arch/arm/mach-omap2/display.c b/arch/arm/mach-omap2/display.c index 543fcb8b518c..a5b7a236aa5b 100644 --- a/arch/arm/mach-omap2/display.c +++ b/arch/arm/mach-omap2/display.c | |||
@@ -25,6 +25,7 @@ | |||
25 | #include <video/omapdss.h> | 25 | #include <video/omapdss.h> |
26 | #include <plat/omap_hwmod.h> | 26 | #include <plat/omap_hwmod.h> |
27 | #include <plat/omap_device.h> | 27 | #include <plat/omap_device.h> |
28 | #include <plat/omap-pm.h> | ||
28 | 29 | ||
29 | static struct platform_device omap_display_device = { | 30 | static struct platform_device omap_display_device = { |
30 | .name = "omapdss", | 31 | .name = "omapdss", |
@@ -42,20 +43,6 @@ static struct omap_device_pm_latency omap_dss_latency[] = { | |||
42 | }, | 43 | }, |
43 | }; | 44 | }; |
44 | 45 | ||
45 | /* oh_core is used for getting opt-clocks */ | ||
46 | static struct omap_hwmod *oh_core; | ||
47 | |||
48 | static bool opt_clock_available(const char *clk_role) | ||
49 | { | ||
50 | int i; | ||
51 | |||
52 | for (i = 0; i < oh_core->opt_clks_cnt; i++) { | ||
53 | if (!strcmp(oh_core->opt_clks[i].role, clk_role)) | ||
54 | return true; | ||
55 | } | ||
56 | return false; | ||
57 | } | ||
58 | |||
59 | struct omap_dss_hwmod_data { | 46 | struct omap_dss_hwmod_data { |
60 | const char *oh_name; | 47 | const char *oh_name; |
61 | const char *dev_name; | 48 | const char *dev_name; |
@@ -109,16 +96,9 @@ int __init omap_display_init(struct omap_dss_board_info *board_data) | |||
109 | oh_count = ARRAY_SIZE(omap4_dss_hwmod_data); | 96 | oh_count = ARRAY_SIZE(omap4_dss_hwmod_data); |
110 | } | 97 | } |
111 | 98 | ||
112 | /* opt_clks are always associated with dss hwmod */ | ||
113 | oh_core = omap_hwmod_lookup("dss_core"); | ||
114 | if (!oh_core) { | ||
115 | pr_err("Could not look up dss_core.\n"); | ||
116 | return -ENODEV; | ||
117 | } | ||
118 | |||
119 | pdata.board_data = board_data; | 99 | pdata.board_data = board_data; |
120 | pdata.board_data->get_last_off_on_transaction_id = NULL; | 100 | pdata.board_data->get_context_loss_count = |
121 | pdata.opt_clock_available = opt_clock_available; | 101 | omap_pm_get_dev_context_loss_count; |
122 | 102 | ||
123 | for (i = 0; i < oh_count; i++) { | 103 | for (i = 0; i < oh_count; i++) { |
124 | oh = omap_hwmod_lookup(curr_dss_hwmod[i].oh_name); | 104 | oh = omap_hwmod_lookup(curr_dss_hwmod[i].oh_name); |
diff --git a/arch/arm/mach-orion5x/common.h b/arch/arm/mach-orion5x/common.h index f2b2b35e8646..3e5499dda49a 100644 --- a/arch/arm/mach-orion5x/common.h +++ b/arch/arm/mach-orion5x/common.h | |||
@@ -51,7 +51,7 @@ void orion5x_pci_disable(void); | |||
51 | void orion5x_pci_set_cardbus_mode(void); | 51 | void orion5x_pci_set_cardbus_mode(void); |
52 | int orion5x_pci_sys_setup(int nr, struct pci_sys_data *sys); | 52 | int orion5x_pci_sys_setup(int nr, struct pci_sys_data *sys); |
53 | struct pci_bus *orion5x_pci_sys_scan_bus(int nr, struct pci_sys_data *sys); | 53 | struct pci_bus *orion5x_pci_sys_scan_bus(int nr, struct pci_sys_data *sys); |
54 | int orion5x_pci_map_irq(struct pci_dev *dev, u8 slot, u8 pin); | 54 | int orion5x_pci_map_irq(const struct pci_dev *dev, u8 slot, u8 pin); |
55 | 55 | ||
56 | struct machine_desc; | 56 | struct machine_desc; |
57 | struct meminfo; | 57 | struct meminfo; |
diff --git a/arch/arm/mach-orion5x/db88f5281-setup.c b/arch/arm/mach-orion5x/db88f5281-setup.c index f95d3cb01cbf..a3e3e9e5e328 100644 --- a/arch/arm/mach-orion5x/db88f5281-setup.c +++ b/arch/arm/mach-orion5x/db88f5281-setup.c | |||
@@ -237,7 +237,8 @@ void __init db88f5281_pci_preinit(void) | |||
237 | } | 237 | } |
238 | } | 238 | } |
239 | 239 | ||
240 | static int __init db88f5281_pci_map_irq(struct pci_dev *dev, u8 slot, u8 pin) | 240 | static int __init db88f5281_pci_map_irq(const struct pci_dev *dev, u8 slot, |
241 | u8 pin) | ||
241 | { | 242 | { |
242 | int irq; | 243 | int irq; |
243 | 244 | ||
diff --git a/arch/arm/mach-orion5x/dns323-setup.c b/arch/arm/mach-orion5x/dns323-setup.c index 855e0e77d563..a6eddae82a0b 100644 --- a/arch/arm/mach-orion5x/dns323-setup.c +++ b/arch/arm/mach-orion5x/dns323-setup.c | |||
@@ -70,14 +70,14 @@ enum { | |||
70 | * PCI setup | 70 | * PCI setup |
71 | */ | 71 | */ |
72 | 72 | ||
73 | static int __init dns323_pci_map_irq(struct pci_dev *dev, u8 slot, u8 pin) | 73 | static int __init dns323_pci_map_irq(const struct pci_dev *dev, u8 slot, u8 pin) |
74 | { | 74 | { |
75 | int irq; | 75 | int irq; |
76 | 76 | ||
77 | /* | 77 | /* |
78 | * Check for devices with hard-wired IRQs. | 78 | * Check for devices with hard-wired IRQs. |
79 | */ | 79 | */ |
80 | irq = orion5x_pci_map_irq(dev, slot, pin); | 80 | irq = orion5x_pci_map_irq(const dev, slot, pin); |
81 | if (irq != -1) | 81 | if (irq != -1) |
82 | return irq; | 82 | return irq; |
83 | 83 | ||
diff --git a/arch/arm/mach-orion5x/kurobox_pro-setup.c b/arch/arm/mach-orion5x/kurobox_pro-setup.c index c0eb6462633f..00381249d766 100644 --- a/arch/arm/mach-orion5x/kurobox_pro-setup.c +++ b/arch/arm/mach-orion5x/kurobox_pro-setup.c | |||
@@ -119,7 +119,8 @@ static struct platform_device kurobox_pro_nor_flash = { | |||
119 | * PCI | 119 | * PCI |
120 | ****************************************************************************/ | 120 | ****************************************************************************/ |
121 | 121 | ||
122 | static int __init kurobox_pro_pci_map_irq(struct pci_dev *dev, u8 slot, u8 pin) | 122 | static int __init kurobox_pro_pci_map_irq(const struct pci_dev *dev, u8 slot, |
123 | u8 pin) | ||
123 | { | 124 | { |
124 | int irq; | 125 | int irq; |
125 | 126 | ||
diff --git a/arch/arm/mach-orion5x/mss2-setup.c b/arch/arm/mach-orion5x/mss2-setup.c index 59263b73d1e4..ef3bb8e9a4c2 100644 --- a/arch/arm/mach-orion5x/mss2-setup.c +++ b/arch/arm/mach-orion5x/mss2-setup.c | |||
@@ -73,7 +73,7 @@ static struct platform_device mss2_nor_flash = { | |||
73 | /**************************************************************************** | 73 | /**************************************************************************** |
74 | * PCI setup | 74 | * PCI setup |
75 | ****************************************************************************/ | 75 | ****************************************************************************/ |
76 | static int __init mss2_pci_map_irq(struct pci_dev *dev, u8 slot, u8 pin) | 76 | static int __init mss2_pci_map_irq(const struct pci_dev *dev, u8 slot, u8 pin) |
77 | { | 77 | { |
78 | int irq; | 78 | int irq; |
79 | 79 | ||
diff --git a/arch/arm/mach-orion5x/pci.c b/arch/arm/mach-orion5x/pci.c index f64965d4f8e8..28b8760ab9fa 100644 --- a/arch/arm/mach-orion5x/pci.c +++ b/arch/arm/mach-orion5x/pci.c | |||
@@ -589,7 +589,7 @@ struct pci_bus __init *orion5x_pci_sys_scan_bus(int nr, struct pci_sys_data *sys | |||
589 | return bus; | 589 | return bus; |
590 | } | 590 | } |
591 | 591 | ||
592 | int __init orion5x_pci_map_irq(struct pci_dev *dev, u8 slot, u8 pin) | 592 | int __init orion5x_pci_map_irq(const struct pci_dev *dev, u8 slot, u8 pin) |
593 | { | 593 | { |
594 | int bus = dev->bus->number; | 594 | int bus = dev->bus->number; |
595 | 595 | ||
diff --git a/arch/arm/mach-orion5x/rd88f5181l-fxo-setup.c b/arch/arm/mach-orion5x/rd88f5181l-fxo-setup.c index 9eec7c2375e9..291d22bf44c9 100644 --- a/arch/arm/mach-orion5x/rd88f5181l-fxo-setup.c +++ b/arch/arm/mach-orion5x/rd88f5181l-fxo-setup.c | |||
@@ -131,7 +131,7 @@ static void __init rd88f5181l_fxo_init(void) | |||
131 | } | 131 | } |
132 | 132 | ||
133 | static int __init | 133 | static int __init |
134 | rd88f5181l_fxo_pci_map_irq(struct pci_dev *dev, u8 slot, u8 pin) | 134 | rd88f5181l_fxo_pci_map_irq(const struct pci_dev *dev, u8 slot, u8 pin) |
135 | { | 135 | { |
136 | int irq; | 136 | int irq; |
137 | 137 | ||
diff --git a/arch/arm/mach-orion5x/rd88f5181l-ge-setup.c b/arch/arm/mach-orion5x/rd88f5181l-ge-setup.c index 0cc90bbfd326..3f02362e1632 100644 --- a/arch/arm/mach-orion5x/rd88f5181l-ge-setup.c +++ b/arch/arm/mach-orion5x/rd88f5181l-ge-setup.c | |||
@@ -140,7 +140,7 @@ static void __init rd88f5181l_ge_init(void) | |||
140 | } | 140 | } |
141 | 141 | ||
142 | static int __init | 142 | static int __init |
143 | rd88f5181l_ge_pci_map_irq(struct pci_dev *dev, u8 slot, u8 pin) | 143 | rd88f5181l_ge_pci_map_irq(const struct pci_dev *dev, u8 slot, u8 pin) |
144 | { | 144 | { |
145 | int irq; | 145 | int irq; |
146 | 146 | ||
diff --git a/arch/arm/mach-orion5x/rd88f5182-setup.c b/arch/arm/mach-orion5x/rd88f5182-setup.c index 48da39b9bdb0..27fd38e658bd 100644 --- a/arch/arm/mach-orion5x/rd88f5182-setup.c +++ b/arch/arm/mach-orion5x/rd88f5182-setup.c | |||
@@ -172,7 +172,8 @@ void __init rd88f5182_pci_preinit(void) | |||
172 | } | 172 | } |
173 | } | 173 | } |
174 | 174 | ||
175 | static int __init rd88f5182_pci_map_irq(struct pci_dev *dev, u8 slot, u8 pin) | 175 | static int __init rd88f5182_pci_map_irq(const struct pci_dev *dev, u8 slot, |
176 | u8 pin) | ||
176 | { | 177 | { |
177 | int irq; | 178 | int irq; |
178 | 179 | ||
diff --git a/arch/arm/mach-orion5x/terastation_pro2-setup.c b/arch/arm/mach-orion5x/terastation_pro2-setup.c index 29ce826c3c21..a34e4fac72b0 100644 --- a/arch/arm/mach-orion5x/terastation_pro2-setup.c +++ b/arch/arm/mach-orion5x/terastation_pro2-setup.c | |||
@@ -100,7 +100,7 @@ void __init tsp2_pci_preinit(void) | |||
100 | } | 100 | } |
101 | } | 101 | } |
102 | 102 | ||
103 | static int __init tsp2_pci_map_irq(struct pci_dev *dev, u8 slot, u8 pin) | 103 | static int __init tsp2_pci_map_irq(const struct pci_dev *dev, u8 slot, u8 pin) |
104 | { | 104 | { |
105 | int irq; | 105 | int irq; |
106 | 106 | ||
diff --git a/arch/arm/mach-orion5x/ts209-setup.c b/arch/arm/mach-orion5x/ts209-setup.c index 47162fd5f044..c9831614e355 100644 --- a/arch/arm/mach-orion5x/ts209-setup.c +++ b/arch/arm/mach-orion5x/ts209-setup.c | |||
@@ -143,7 +143,8 @@ void __init qnap_ts209_pci_preinit(void) | |||
143 | } | 143 | } |
144 | } | 144 | } |
145 | 145 | ||
146 | static int __init qnap_ts209_pci_map_irq(struct pci_dev *dev, u8 slot, u8 pin) | 146 | static int __init qnap_ts209_pci_map_irq(const struct pci_dev *dev, u8 slot, |
147 | u8 pin) | ||
147 | { | 148 | { |
148 | int irq; | 149 | int irq; |
149 | 150 | ||
diff --git a/arch/arm/mach-orion5x/ts409-setup.c b/arch/arm/mach-orion5x/ts409-setup.c index 5aacc7ac5cf4..cc33b2222bad 100644 --- a/arch/arm/mach-orion5x/ts409-setup.c +++ b/arch/arm/mach-orion5x/ts409-setup.c | |||
@@ -121,7 +121,8 @@ static struct platform_device qnap_ts409_nor_flash = { | |||
121 | * PCI | 121 | * PCI |
122 | ****************************************************************************/ | 122 | ****************************************************************************/ |
123 | 123 | ||
124 | static int __init qnap_ts409_pci_map_irq(struct pci_dev *dev, u8 slot, u8 pin) | 124 | static int __init qnap_ts409_pci_map_irq(const struct pci_dev *dev, u8 slot, |
125 | u8 pin) | ||
125 | { | 126 | { |
126 | int irq; | 127 | int irq; |
127 | 128 | ||
diff --git a/arch/arm/mach-orion5x/wnr854t-setup.c b/arch/arm/mach-orion5x/wnr854t-setup.c index 444a1c7fdfd6..2653595f901c 100644 --- a/arch/arm/mach-orion5x/wnr854t-setup.c +++ b/arch/arm/mach-orion5x/wnr854t-setup.c | |||
@@ -133,7 +133,8 @@ static void __init wnr854t_init(void) | |||
133 | platform_device_register(&wnr854t_nor_flash); | 133 | platform_device_register(&wnr854t_nor_flash); |
134 | } | 134 | } |
135 | 135 | ||
136 | static int __init wnr854t_pci_map_irq(struct pci_dev *dev, u8 slot, u8 pin) | 136 | static int __init wnr854t_pci_map_irq(const struct pci_dev *dev, u8 slot, |
137 | u8 pin) | ||
137 | { | 138 | { |
138 | int irq; | 139 | int irq; |
139 | 140 | ||
diff --git a/arch/arm/mach-orion5x/wrt350n-v2-setup.c b/arch/arm/mach-orion5x/wrt350n-v2-setup.c index d1952be0ae1c..251ef1543e53 100644 --- a/arch/arm/mach-orion5x/wrt350n-v2-setup.c +++ b/arch/arm/mach-orion5x/wrt350n-v2-setup.c | |||
@@ -221,7 +221,8 @@ static void __init wrt350n_v2_init(void) | |||
221 | platform_device_register(&wrt350n_v2_button_device); | 221 | platform_device_register(&wrt350n_v2_button_device); |
222 | } | 222 | } |
223 | 223 | ||
224 | static int __init wrt350n_v2_pci_map_irq(struct pci_dev *dev, u8 slot, u8 pin) | 224 | static int __init wrt350n_v2_pci_map_irq(const struct pci_dev *dev, u8 slot, |
225 | u8 pin) | ||
225 | { | 226 | { |
226 | int irq; | 227 | int irq; |
227 | 228 | ||
diff --git a/arch/arm/mach-pxa/cm-x2xx-pci.c b/arch/arm/mach-pxa/cm-x2xx-pci.c index 4eb7660a279d..6bf479d9b5ac 100644 --- a/arch/arm/mach-pxa/cm-x2xx-pci.c +++ b/arch/arm/mach-pxa/cm-x2xx-pci.c | |||
@@ -77,7 +77,7 @@ void cmx2xx_pci_resume(void) {} | |||
77 | #endif | 77 | #endif |
78 | 78 | ||
79 | /* PCI IRQ mapping*/ | 79 | /* PCI IRQ mapping*/ |
80 | static int __init cmx2xx_pci_map_irq(struct pci_dev *dev, u8 slot, u8 pin) | 80 | static int __init cmx2xx_pci_map_irq(const struct pci_dev *dev, u8 slot, u8 pin) |
81 | { | 81 | { |
82 | int irq; | 82 | int irq; |
83 | 83 | ||
diff --git a/arch/arm/mach-sa1100/pci-nanoengine.c b/arch/arm/mach-sa1100/pci-nanoengine.c index 5fc074fe3eee..964c6c3cd7a6 100644 --- a/arch/arm/mach-sa1100/pci-nanoengine.c +++ b/arch/arm/mach-sa1100/pci-nanoengine.c | |||
@@ -122,7 +122,8 @@ static struct pci_ops pci_nano_ops = { | |||
122 | .write = nanoengine_write_config, | 122 | .write = nanoengine_write_config, |
123 | }; | 123 | }; |
124 | 124 | ||
125 | static int __init pci_nanoengine_map_irq(struct pci_dev *dev, u8 slot, u8 pin) | 125 | static int __init pci_nanoengine_map_irq(const struct pci_dev *dev, u8 slot, |
126 | u8 pin) | ||
126 | { | 127 | { |
127 | return NANOENGINE_IRQ_GPIO_PCI; | 128 | return NANOENGINE_IRQ_GPIO_PCI; |
128 | } | 129 | } |
diff --git a/arch/arm/mach-shark/pci.c b/arch/arm/mach-shark/pci.c index 92d7227de0ac..7cb79a092f31 100644 --- a/arch/arm/mach-shark/pci.c +++ b/arch/arm/mach-shark/pci.c | |||
@@ -14,7 +14,7 @@ | |||
14 | #include <asm/mach/pci.h> | 14 | #include <asm/mach/pci.h> |
15 | #include <asm/mach-types.h> | 15 | #include <asm/mach-types.h> |
16 | 16 | ||
17 | static int __init shark_map_irq(struct pci_dev *dev, u8 slot, u8 pin) | 17 | static int __init shark_map_irq(const struct pci_dev *dev, u8 slot, u8 pin) |
18 | { | 18 | { |
19 | if (dev->bus->number == 0) | 19 | if (dev->bus->number == 0) |
20 | if (dev->devfn == 0) | 20 | if (dev->devfn == 0) |
diff --git a/arch/arm/mach-shmobile/board-ap4evb.c b/arch/arm/mach-shmobile/board-ap4evb.c index 837138e369bc..9e0856b2f9e9 100644 --- a/arch/arm/mach-shmobile/board-ap4evb.c +++ b/arch/arm/mach-shmobile/board-ap4evb.c | |||
@@ -957,19 +957,16 @@ static struct resource csi2_resources[] = { | |||
957 | }, | 957 | }, |
958 | }; | 958 | }; |
959 | 959 | ||
960 | static struct platform_device csi2_device = { | 960 | static struct sh_mobile_ceu_companion csi2 = { |
961 | .name = "sh-mobile-csi2", | 961 | .id = 0, |
962 | .id = 0, | ||
963 | .num_resources = ARRAY_SIZE(csi2_resources), | 962 | .num_resources = ARRAY_SIZE(csi2_resources), |
964 | .resource = csi2_resources, | 963 | .resource = csi2_resources, |
965 | .dev = { | 964 | .platform_data = &csi2_info, |
966 | .platform_data = &csi2_info, | ||
967 | }, | ||
968 | }; | 965 | }; |
969 | 966 | ||
970 | static struct sh_mobile_ceu_info sh_mobile_ceu_info = { | 967 | static struct sh_mobile_ceu_info sh_mobile_ceu_info = { |
971 | .flags = SH_CEU_FLAG_USE_8BIT_BUS, | 968 | .flags = SH_CEU_FLAG_USE_8BIT_BUS, |
972 | .csi2_dev = &csi2_device.dev, | 969 | .csi2 = &csi2, |
973 | }; | 970 | }; |
974 | 971 | ||
975 | static struct resource ceu_resources[] = { | 972 | static struct resource ceu_resources[] = { |
@@ -1013,7 +1010,6 @@ static struct platform_device *ap4evb_devices[] __initdata = { | |||
1013 | &lcdc1_device, | 1010 | &lcdc1_device, |
1014 | &lcdc_device, | 1011 | &lcdc_device, |
1015 | &hdmi_device, | 1012 | &hdmi_device, |
1016 | &csi2_device, | ||
1017 | &ceu_device, | 1013 | &ceu_device, |
1018 | &ap4evb_camera, | 1014 | &ap4evb_camera, |
1019 | &meram_device, | 1015 | &meram_device, |
diff --git a/arch/arm/mach-shmobile/board-mackerel.c b/arch/arm/mach-shmobile/board-mackerel.c index 5b36b6c5b448..d41c01f83f15 100644 --- a/arch/arm/mach-shmobile/board-mackerel.c +++ b/arch/arm/mach-shmobile/board-mackerel.c | |||
@@ -1192,8 +1192,8 @@ static struct platform_device sh_mmcif_device = { | |||
1192 | }; | 1192 | }; |
1193 | 1193 | ||
1194 | 1194 | ||
1195 | static int mackerel_camera_add(struct soc_camera_link *icl, struct device *dev); | 1195 | static int mackerel_camera_add(struct soc_camera_device *icd); |
1196 | static void mackerel_camera_del(struct soc_camera_link *icl); | 1196 | static void mackerel_camera_del(struct soc_camera_device *icd); |
1197 | 1197 | ||
1198 | static int camera_set_capture(struct soc_camera_platform_info *info, | 1198 | static int camera_set_capture(struct soc_camera_platform_info *info, |
1199 | int enable) | 1199 | int enable) |
@@ -1232,16 +1232,15 @@ static void mackerel_camera_release(struct device *dev) | |||
1232 | soc_camera_platform_release(&camera_device); | 1232 | soc_camera_platform_release(&camera_device); |
1233 | } | 1233 | } |
1234 | 1234 | ||
1235 | static int mackerel_camera_add(struct soc_camera_link *icl, | 1235 | static int mackerel_camera_add(struct soc_camera_device *icd) |
1236 | struct device *dev) | ||
1237 | { | 1236 | { |
1238 | return soc_camera_platform_add(icl, dev, &camera_device, &camera_link, | 1237 | return soc_camera_platform_add(icd, &camera_device, &camera_link, |
1239 | mackerel_camera_release, 0); | 1238 | mackerel_camera_release, 0); |
1240 | } | 1239 | } |
1241 | 1240 | ||
1242 | static void mackerel_camera_del(struct soc_camera_link *icl) | 1241 | static void mackerel_camera_del(struct soc_camera_device *icd) |
1243 | { | 1242 | { |
1244 | soc_camera_platform_del(icl, camera_device, &camera_link); | 1243 | soc_camera_platform_del(icd, camera_device, &camera_link); |
1245 | } | 1244 | } |
1246 | 1245 | ||
1247 | static struct sh_mobile_ceu_info sh_mobile_ceu_info = { | 1246 | static struct sh_mobile_ceu_info sh_mobile_ceu_info = { |
diff --git a/arch/arm/mach-shmobile/clock-sh7367.c b/arch/arm/mach-shmobile/clock-sh7367.c index 6b186aefcbd6..5218c34a9cc6 100644 --- a/arch/arm/mach-shmobile/clock-sh7367.c +++ b/arch/arm/mach-shmobile/clock-sh7367.c | |||
@@ -259,9 +259,6 @@ static struct clk mstp_clks[MSTP_NR] = { | |||
259 | [CMMSTP003] = MSTP(&r_clk, CMMSTPCR0, 3, 0), /* KEYSC */ | 259 | [CMMSTP003] = MSTP(&r_clk, CMMSTPCR0, 3, 0), /* KEYSC */ |
260 | }; | 260 | }; |
261 | 261 | ||
262 | #define CLKDEV_CON_ID(_id, _clk) { .con_id = _id, .clk = _clk } | ||
263 | #define CLKDEV_DEV_ID(_id, _clk) { .dev_id = _id, .clk = _clk } | ||
264 | |||
265 | static struct clk_lookup lookups[] = { | 262 | static struct clk_lookup lookups[] = { |
266 | /* main clocks */ | 263 | /* main clocks */ |
267 | CLKDEV_CON_ID("r_clk", &r_clk), | 264 | CLKDEV_CON_ID("r_clk", &r_clk), |
diff --git a/arch/arm/mach-shmobile/clock-sh7372.c b/arch/arm/mach-shmobile/clock-sh7372.c index 91f5779abdd3..6b1619a65dba 100644 --- a/arch/arm/mach-shmobile/clock-sh7372.c +++ b/arch/arm/mach-shmobile/clock-sh7372.c | |||
@@ -561,10 +561,6 @@ static struct clk mstp_clks[MSTP_NR] = { | |||
561 | [MSTP403] = MSTP(&r_clk, SMSTPCR4, 3, 0), /* KEYSC */ | 561 | [MSTP403] = MSTP(&r_clk, SMSTPCR4, 3, 0), /* KEYSC */ |
562 | }; | 562 | }; |
563 | 563 | ||
564 | #define CLKDEV_CON_ID(_id, _clk) { .con_id = _id, .clk = _clk } | ||
565 | #define CLKDEV_DEV_ID(_id, _clk) { .dev_id = _id, .clk = _clk } | ||
566 | #define CLKDEV_ICK_ID(_cid, _did, _clk) { .con_id = _cid, .dev_id = _did, .clk = _clk } | ||
567 | |||
568 | static struct clk_lookup lookups[] = { | 564 | static struct clk_lookup lookups[] = { |
569 | /* main clocks */ | 565 | /* main clocks */ |
570 | CLKDEV_CON_ID("dv_clki_div2_clk", &sh7372_dv_clki_div2_clk), | 566 | CLKDEV_CON_ID("dv_clki_div2_clk", &sh7372_dv_clki_div2_clk), |
diff --git a/arch/arm/mach-shmobile/clock-sh7377.c b/arch/arm/mach-shmobile/clock-sh7377.c index 95942466e63f..8cee7b151ae3 100644 --- a/arch/arm/mach-shmobile/clock-sh7377.c +++ b/arch/arm/mach-shmobile/clock-sh7377.c | |||
@@ -267,9 +267,6 @@ static struct clk mstp_clks[] = { | |||
267 | [MSTP403] = MSTP(&r_clk, SMSTPCR4, 3, 0), /* KEYSC */ | 267 | [MSTP403] = MSTP(&r_clk, SMSTPCR4, 3, 0), /* KEYSC */ |
268 | }; | 268 | }; |
269 | 269 | ||
270 | #define CLKDEV_CON_ID(_id, _clk) { .con_id = _id, .clk = _clk } | ||
271 | #define CLKDEV_DEV_ID(_id, _clk) { .dev_id = _id, .clk = _clk } | ||
272 | |||
273 | static struct clk_lookup lookups[] = { | 270 | static struct clk_lookup lookups[] = { |
274 | /* main clocks */ | 271 | /* main clocks */ |
275 | CLKDEV_CON_ID("r_clk", &r_clk), | 272 | CLKDEV_CON_ID("r_clk", &r_clk), |
diff --git a/arch/arm/mach-shmobile/clock-sh73a0.c b/arch/arm/mach-shmobile/clock-sh73a0.c index bcacb1e8cf85..6db2ccabc2bf 100644 --- a/arch/arm/mach-shmobile/clock-sh73a0.c +++ b/arch/arm/mach-shmobile/clock-sh73a0.c | |||
@@ -306,10 +306,6 @@ static struct clk mstp_clks[MSTP_NR] = { | |||
306 | [MSTP403] = MSTP(&r_clk, SMSTPCR4, 3, 0), /* KEYSC */ | 306 | [MSTP403] = MSTP(&r_clk, SMSTPCR4, 3, 0), /* KEYSC */ |
307 | }; | 307 | }; |
308 | 308 | ||
309 | #define CLKDEV_CON_ID(_id, _clk) { .con_id = _id, .clk = _clk } | ||
310 | #define CLKDEV_DEV_ID(_id, _clk) { .dev_id = _id, .clk = _clk } | ||
311 | #define CLKDEV_ICK_ID(_cid, _did, _clk) { .con_id = _cid, .dev_id = _did, .clk = _clk } | ||
312 | |||
313 | static struct clk_lookup lookups[] = { | 309 | static struct clk_lookup lookups[] = { |
314 | /* main clocks */ | 310 | /* main clocks */ |
315 | CLKDEV_CON_ID("r_clk", &r_clk), | 311 | CLKDEV_CON_ID("r_clk", &r_clk), |
diff --git a/arch/arm/mach-tegra/pcie.c b/arch/arm/mach-tegra/pcie.c index 031cd0a7d71d..f1f699d86c32 100644 --- a/arch/arm/mach-tegra/pcie.c +++ b/arch/arm/mach-tegra/pcie.c | |||
@@ -449,7 +449,7 @@ static int tegra_pcie_setup(int nr, struct pci_sys_data *sys) | |||
449 | return 1; | 449 | return 1; |
450 | } | 450 | } |
451 | 451 | ||
452 | static int tegra_pcie_map_irq(struct pci_dev *dev, u8 slot, u8 pin) | 452 | static int tegra_pcie_map_irq(const struct pci_dev *dev, u8 slot, u8 pin) |
453 | { | 453 | { |
454 | return INT_PCIE_INTR; | 454 | return INT_PCIE_INTR; |
455 | } | 455 | } |
diff --git a/arch/arm/mach-versatile/pci.c b/arch/arm/mach-versatile/pci.c index 7848a177b1f0..c898deb3ada0 100644 --- a/arch/arm/mach-versatile/pci.c +++ b/arch/arm/mach-versatile/pci.c | |||
@@ -328,7 +328,7 @@ void __init pci_versatile_preinit(void) | |||
328 | /* | 328 | /* |
329 | * map the specified device/slot/pin to an IRQ. Different backplanes may need to modify this. | 329 | * map the specified device/slot/pin to an IRQ. Different backplanes may need to modify this. |
330 | */ | 330 | */ |
331 | static int __init versatile_map_irq(struct pci_dev *dev, u8 slot, u8 pin) | 331 | static int __init versatile_map_irq(const struct pci_dev *dev, u8 slot, u8 pin) |
332 | { | 332 | { |
333 | int irq; | 333 | int irq; |
334 | int devslot = PCI_SLOT(dev->devfn); | 334 | int devslot = PCI_SLOT(dev->devfn); |
diff --git a/arch/avr32/Kconfig b/arch/avr32/Kconfig index e9d689b7c833..197e96f70405 100644 --- a/arch/avr32/Kconfig +++ b/arch/avr32/Kconfig | |||
@@ -10,6 +10,7 @@ config AVR32 | |||
10 | select GENERIC_IRQ_PROBE | 10 | select GENERIC_IRQ_PROBE |
11 | select HARDIRQS_SW_RESEND | 11 | select HARDIRQS_SW_RESEND |
12 | select GENERIC_IRQ_SHOW | 12 | select GENERIC_IRQ_SHOW |
13 | select ARCH_HAVE_NMI_SAFE_CMPXCHG | ||
13 | help | 14 | help |
14 | AVR32 is a high-performance 32-bit RISC microprocessor core, | 15 | AVR32 is a high-performance 32-bit RISC microprocessor core, |
15 | designed for cost-sensitive embedded applications, with particular | 16 | designed for cost-sensitive embedded applications, with particular |
diff --git a/arch/cris/arch-v10/drivers/sync_serial.c b/arch/cris/arch-v10/drivers/sync_serial.c index 850265373611..466af40c5822 100644 --- a/arch/cris/arch-v10/drivers/sync_serial.c +++ b/arch/cris/arch-v10/drivers/sync_serial.c | |||
@@ -158,7 +158,7 @@ static int sync_serial_open(struct inode *inode, struct file *file); | |||
158 | static int sync_serial_release(struct inode *inode, struct file *file); | 158 | static int sync_serial_release(struct inode *inode, struct file *file); |
159 | static unsigned int sync_serial_poll(struct file *filp, poll_table *wait); | 159 | static unsigned int sync_serial_poll(struct file *filp, poll_table *wait); |
160 | 160 | ||
161 | static int sync_serial_ioctl(struct file *file, | 161 | static long sync_serial_ioctl(struct file *file, |
162 | unsigned int cmd, unsigned long arg); | 162 | unsigned int cmd, unsigned long arg); |
163 | static ssize_t sync_serial_write(struct file *file, const char *buf, | 163 | static ssize_t sync_serial_write(struct file *file, const char *buf, |
164 | size_t count, loff_t *ppos); | 164 | size_t count, loff_t *ppos); |
@@ -625,11 +625,11 @@ static int sync_serial_open(struct inode *inode, struct file *file) | |||
625 | *R_IRQ_MASK1_SET = 1 << port->data_avail_bit; | 625 | *R_IRQ_MASK1_SET = 1 << port->data_avail_bit; |
626 | DEBUG(printk(KERN_DEBUG "sser%d rec started\n", dev)); | 626 | DEBUG(printk(KERN_DEBUG "sser%d rec started\n", dev)); |
627 | } | 627 | } |
628 | ret = 0; | 628 | err = 0; |
629 | 629 | ||
630 | out: | 630 | out: |
631 | mutex_unlock(&sync_serial_mutex); | 631 | mutex_unlock(&sync_serial_mutex); |
632 | return ret; | 632 | return err; |
633 | } | 633 | } |
634 | 634 | ||
635 | static int sync_serial_release(struct inode *inode, struct file *file) | 635 | static int sync_serial_release(struct inode *inode, struct file *file) |
diff --git a/arch/cris/arch-v10/kernel/irq.c b/arch/cris/arch-v10/kernel/irq.c index 907cfb5a873d..ba0e5965d6e3 100644 --- a/arch/cris/arch-v10/kernel/irq.c +++ b/arch/cris/arch-v10/kernel/irq.c | |||
@@ -20,6 +20,9 @@ | |||
20 | #define crisv10_mask_irq(irq_nr) (*R_VECT_MASK_CLR = 1 << (irq_nr)); | 20 | #define crisv10_mask_irq(irq_nr) (*R_VECT_MASK_CLR = 1 << (irq_nr)); |
21 | #define crisv10_unmask_irq(irq_nr) (*R_VECT_MASK_SET = 1 << (irq_nr)); | 21 | #define crisv10_unmask_irq(irq_nr) (*R_VECT_MASK_SET = 1 << (irq_nr)); |
22 | 22 | ||
23 | extern void kgdb_init(void); | ||
24 | extern void breakpoint(void); | ||
25 | |||
23 | /* don't use set_int_vector, it bypasses the linux interrupt handlers. it is | 26 | /* don't use set_int_vector, it bypasses the linux interrupt handlers. it is |
24 | * global just so that the kernel gdb can use it. | 27 | * global just so that the kernel gdb can use it. |
25 | */ | 28 | */ |
diff --git a/arch/cris/include/asm/thread_info.h b/arch/cris/include/asm/thread_info.h index 29b74a105830..332f19c54557 100644 --- a/arch/cris/include/asm/thread_info.h +++ b/arch/cris/include/asm/thread_info.h | |||
@@ -11,8 +11,6 @@ | |||
11 | 11 | ||
12 | #ifdef __KERNEL__ | 12 | #ifdef __KERNEL__ |
13 | 13 | ||
14 | #define __HAVE_ARCH_THREAD_INFO_ALLOCATOR | ||
15 | |||
16 | #ifndef __ASSEMBLY__ | 14 | #ifndef __ASSEMBLY__ |
17 | #include <asm/types.h> | 15 | #include <asm/types.h> |
18 | #include <asm/processor.h> | 16 | #include <asm/processor.h> |
@@ -67,8 +65,10 @@ struct thread_info { | |||
67 | 65 | ||
68 | #define init_thread_info (init_thread_union.thread_info) | 66 | #define init_thread_info (init_thread_union.thread_info) |
69 | 67 | ||
68 | #define __HAVE_ARCH_THREAD_INFO_ALLOCATOR | ||
70 | /* thread information allocation */ | 69 | /* thread information allocation */ |
71 | #define alloc_thread_info(tsk, node) ((struct thread_info *) __get_free_pages(GFP_KERNEL,1)) | 70 | #define alloc_thread_info_node(tsk, node) \ |
71 | ((struct thread_info *) __get_free_pages(GFP_KERNEL, 1)) | ||
72 | #define free_thread_info(ti) free_pages((unsigned long) (ti), 1) | 72 | #define free_thread_info(ti) free_pages((unsigned long) (ti), 1) |
73 | 73 | ||
74 | #endif /* !__ASSEMBLY__ */ | 74 | #endif /* !__ASSEMBLY__ */ |
diff --git a/arch/frv/Kconfig b/arch/frv/Kconfig index cb884e489425..bad27a6ff407 100644 --- a/arch/frv/Kconfig +++ b/arch/frv/Kconfig | |||
@@ -7,6 +7,7 @@ config FRV | |||
7 | select HAVE_PERF_EVENTS | 7 | select HAVE_PERF_EVENTS |
8 | select HAVE_GENERIC_HARDIRQS | 8 | select HAVE_GENERIC_HARDIRQS |
9 | select GENERIC_IRQ_SHOW | 9 | select GENERIC_IRQ_SHOW |
10 | select ARCH_HAVE_NMI_SAFE_CMPXCHG | ||
10 | 11 | ||
11 | config ZONE_DMA | 12 | config ZONE_DMA |
12 | bool | 13 | bool |
diff --git a/arch/frv/mm/pgalloc.c b/arch/frv/mm/pgalloc.c index c42c83d507bc..4fb63a36bd52 100644 --- a/arch/frv/mm/pgalloc.c +++ b/arch/frv/mm/pgalloc.c | |||
@@ -133,13 +133,7 @@ void pgd_dtor(void *pgd) | |||
133 | 133 | ||
134 | pgd_t *pgd_alloc(struct mm_struct *mm) | 134 | pgd_t *pgd_alloc(struct mm_struct *mm) |
135 | { | 135 | { |
136 | pgd_t *pgd; | 136 | return quicklist_alloc(0, GFP_KERNEL, pgd_ctor); |
137 | |||
138 | pgd = quicklist_alloc(0, GFP_KERNEL, pgd_ctor); | ||
139 | if (!pgd) | ||
140 | return pgd; | ||
141 | |||
142 | return pgd; | ||
143 | } | 137 | } |
144 | 138 | ||
145 | void pgd_free(struct mm_struct *mm, pgd_t *pgd) | 139 | void pgd_free(struct mm_struct *mm, pgd_t *pgd) |
diff --git a/arch/ia64/Kconfig b/arch/ia64/Kconfig index 137b277f7e56..124854714958 100644 --- a/arch/ia64/Kconfig +++ b/arch/ia64/Kconfig | |||
@@ -27,6 +27,8 @@ config IA64 | |||
27 | select GENERIC_PENDING_IRQ if SMP | 27 | select GENERIC_PENDING_IRQ if SMP |
28 | select IRQ_PER_CPU | 28 | select IRQ_PER_CPU |
29 | select GENERIC_IRQ_SHOW | 29 | select GENERIC_IRQ_SHOW |
30 | select ARCH_WANT_OPTIONAL_GPIOLIB | ||
31 | select ARCH_HAVE_NMI_SAFE_CMPXCHG | ||
30 | default y | 32 | default y |
31 | help | 33 | help |
32 | The Itanium Processor Family is Intel's 64-bit successor to | 34 | The Itanium Processor Family is Intel's 64-bit successor to |
@@ -89,6 +91,9 @@ config GENERIC_TIME_VSYSCALL | |||
89 | config HAVE_SETUP_PER_CPU_AREA | 91 | config HAVE_SETUP_PER_CPU_AREA |
90 | def_bool y | 92 | def_bool y |
91 | 93 | ||
94 | config GENERIC_GPIO | ||
95 | def_bool y | ||
96 | |||
92 | config DMI | 97 | config DMI |
93 | bool | 98 | bool |
94 | default y | 99 | default y |
diff --git a/arch/ia64/include/asm/gpio.h b/arch/ia64/include/asm/gpio.h new file mode 100644 index 000000000000..590a20debc4e --- /dev/null +++ b/arch/ia64/include/asm/gpio.h | |||
@@ -0,0 +1,55 @@ | |||
1 | /* | ||
2 | * Generic GPIO API implementation for IA-64. | ||
3 | * | ||
4 | * A stright copy of that for PowerPC which was: | ||
5 | * | ||
6 | * Copyright (c) 2007-2008 MontaVista Software, Inc. | ||
7 | * | ||
8 | * Author: Anton Vorontsov <avorontsov@ru.mvista.com> | ||
9 | * | ||
10 | * This program is free software; you can redistribute it and/or modify | ||
11 | * it under the terms of the GNU General Public License as published by | ||
12 | * the Free Software Foundation; either version 2 of the License, or | ||
13 | * (at your option) any later version. | ||
14 | */ | ||
15 | |||
16 | #ifndef _ASM_IA64_GPIO_H | ||
17 | #define _ASM_IA64_GPIO_H | ||
18 | |||
19 | #include <linux/errno.h> | ||
20 | #include <asm-generic/gpio.h> | ||
21 | |||
22 | #ifdef CONFIG_GPIOLIB | ||
23 | |||
24 | /* | ||
25 | * We don't (yet) implement inlined/rapid versions for on-chip gpios. | ||
26 | * Just call gpiolib. | ||
27 | */ | ||
28 | static inline int gpio_get_value(unsigned int gpio) | ||
29 | { | ||
30 | return __gpio_get_value(gpio); | ||
31 | } | ||
32 | |||
33 | static inline void gpio_set_value(unsigned int gpio, int value) | ||
34 | { | ||
35 | __gpio_set_value(gpio, value); | ||
36 | } | ||
37 | |||
38 | static inline int gpio_cansleep(unsigned int gpio) | ||
39 | { | ||
40 | return __gpio_cansleep(gpio); | ||
41 | } | ||
42 | |||
43 | static inline int gpio_to_irq(unsigned int gpio) | ||
44 | { | ||
45 | return __gpio_to_irq(gpio); | ||
46 | } | ||
47 | |||
48 | static inline int irq_to_gpio(unsigned int irq) | ||
49 | { | ||
50 | return -EINVAL; | ||
51 | } | ||
52 | |||
53 | #endif /* CONFIG_GPIOLIB */ | ||
54 | |||
55 | #endif /* _ASM_IA64_GPIO_H */ | ||
diff --git a/arch/ia64/kernel/efi.c b/arch/ia64/kernel/efi.c index 6fc03aff046c..c38d22e5e902 100644 --- a/arch/ia64/kernel/efi.c +++ b/arch/ia64/kernel/efi.c | |||
@@ -156,7 +156,7 @@ prefix##_get_next_variable (unsigned long *name_size, efi_char16_t *name, \ | |||
156 | #define STUB_SET_VARIABLE(prefix, adjust_arg) \ | 156 | #define STUB_SET_VARIABLE(prefix, adjust_arg) \ |
157 | static efi_status_t \ | 157 | static efi_status_t \ |
158 | prefix##_set_variable (efi_char16_t *name, efi_guid_t *vendor, \ | 158 | prefix##_set_variable (efi_char16_t *name, efi_guid_t *vendor, \ |
159 | unsigned long attr, unsigned long data_size, \ | 159 | u32 attr, unsigned long data_size, \ |
160 | void *data) \ | 160 | void *data) \ |
161 | { \ | 161 | { \ |
162 | struct ia64_fpreg fr[6]; \ | 162 | struct ia64_fpreg fr[6]; \ |
diff --git a/arch/m68k/Kconfig b/arch/m68k/Kconfig index 284cd3771eaa..9e8ee9d2b8ca 100644 --- a/arch/m68k/Kconfig +++ b/arch/m68k/Kconfig | |||
@@ -6,6 +6,7 @@ config M68K | |||
6 | select GENERIC_ATOMIC64 if MMU | 6 | select GENERIC_ATOMIC64 if MMU |
7 | select HAVE_GENERIC_HARDIRQS if !MMU | 7 | select HAVE_GENERIC_HARDIRQS if !MMU |
8 | select GENERIC_IRQ_SHOW if !MMU | 8 | select GENERIC_IRQ_SHOW if !MMU |
9 | select ARCH_HAVE_NMI_SAFE_CMPXCHG if RMW_INSNS | ||
9 | 10 | ||
10 | config RWSEM_GENERIC_SPINLOCK | 11 | config RWSEM_GENERIC_SPINLOCK |
11 | bool | 12 | bool |
diff --git a/arch/m68k/Kconfig.mmu b/arch/m68k/Kconfig.mmu index 16539b1d5d3a..13e20bbc4079 100644 --- a/arch/m68k/Kconfig.mmu +++ b/arch/m68k/Kconfig.mmu | |||
@@ -372,12 +372,6 @@ config AMIGA_PCMCIA | |||
372 | Include support in the kernel for pcmcia on Amiga 1200 and Amiga | 372 | Include support in the kernel for pcmcia on Amiga 1200 and Amiga |
373 | 600. If you intend to use pcmcia cards say Y; otherwise say N. | 373 | 600. If you intend to use pcmcia cards say Y; otherwise say N. |
374 | 374 | ||
375 | config STRAM_PROC | ||
376 | bool "ST-RAM statistics in /proc" | ||
377 | depends on ATARI | ||
378 | help | ||
379 | Say Y here to report ST-RAM usage statistics in /proc/stram. | ||
380 | |||
381 | config HEARTBEAT | 375 | config HEARTBEAT |
382 | bool "Use power LED as a heartbeat" if AMIGA || APOLLO || ATARI || MAC ||Q40 | 376 | bool "Use power LED as a heartbeat" if AMIGA || APOLLO || ATARI || MAC ||Q40 |
383 | default y if !AMIGA && !APOLLO && !ATARI && !MAC && !Q40 && HP300 | 377 | default y if !AMIGA && !APOLLO && !ATARI && !MAC && !Q40 && HP300 |
diff --git a/arch/m68k/amiga/chipram.c b/arch/m68k/amiga/chipram.c index dd0447db1c90..99449fbf9a72 100644 --- a/arch/m68k/amiga/chipram.c +++ b/arch/m68k/amiga/chipram.c | |||
@@ -16,6 +16,7 @@ | |||
16 | #include <linux/string.h> | 16 | #include <linux/string.h> |
17 | #include <linux/module.h> | 17 | #include <linux/module.h> |
18 | 18 | ||
19 | #include <asm/atomic.h> | ||
19 | #include <asm/page.h> | 20 | #include <asm/page.h> |
20 | #include <asm/amigahw.h> | 21 | #include <asm/amigahw.h> |
21 | 22 | ||
@@ -23,111 +24,100 @@ unsigned long amiga_chip_size; | |||
23 | EXPORT_SYMBOL(amiga_chip_size); | 24 | EXPORT_SYMBOL(amiga_chip_size); |
24 | 25 | ||
25 | static struct resource chipram_res = { | 26 | static struct resource chipram_res = { |
26 | .name = "Chip RAM", .start = CHIP_PHYSADDR | 27 | .name = "Chip RAM", .start = CHIP_PHYSADDR |
27 | }; | 28 | }; |
28 | static unsigned long chipavail; | 29 | static atomic_t chipavail; |
29 | 30 | ||
30 | 31 | ||
31 | void __init amiga_chip_init(void) | 32 | void __init amiga_chip_init(void) |
32 | { | 33 | { |
33 | if (!AMIGAHW_PRESENT(CHIP_RAM)) | 34 | if (!AMIGAHW_PRESENT(CHIP_RAM)) |
34 | return; | 35 | return; |
35 | 36 | ||
36 | chipram_res.end = amiga_chip_size-1; | 37 | chipram_res.end = CHIP_PHYSADDR + amiga_chip_size - 1; |
37 | request_resource(&iomem_resource, &chipram_res); | 38 | request_resource(&iomem_resource, &chipram_res); |
38 | 39 | ||
39 | chipavail = amiga_chip_size; | 40 | atomic_set(&chipavail, amiga_chip_size); |
40 | } | 41 | } |
41 | 42 | ||
42 | 43 | ||
43 | void *amiga_chip_alloc(unsigned long size, const char *name) | 44 | void *amiga_chip_alloc(unsigned long size, const char *name) |
44 | { | 45 | { |
45 | struct resource *res; | 46 | struct resource *res; |
47 | void *p; | ||
46 | 48 | ||
47 | /* round up */ | 49 | res = kzalloc(sizeof(struct resource), GFP_KERNEL); |
48 | size = PAGE_ALIGN(size); | 50 | if (!res) |
51 | return NULL; | ||
49 | 52 | ||
50 | #ifdef DEBUG | 53 | res->name = name; |
51 | printk("amiga_chip_alloc: allocate %ld bytes\n", size); | 54 | p = amiga_chip_alloc_res(size, res); |
52 | #endif | 55 | if (!p) { |
53 | res = kzalloc(sizeof(struct resource), GFP_KERNEL); | 56 | kfree(res); |
54 | if (!res) | 57 | return NULL; |
55 | return NULL; | 58 | } |
56 | res->name = name; | ||
57 | 59 | ||
58 | if (allocate_resource(&chipram_res, res, size, 0, UINT_MAX, PAGE_SIZE, NULL, NULL) < 0) { | 60 | return p; |
59 | kfree(res); | ||
60 | return NULL; | ||
61 | } | ||
62 | chipavail -= size; | ||
63 | #ifdef DEBUG | ||
64 | printk("amiga_chip_alloc: returning %lx\n", res->start); | ||
65 | #endif | ||
66 | return (void *)ZTWO_VADDR(res->start); | ||
67 | } | 61 | } |
68 | EXPORT_SYMBOL(amiga_chip_alloc); | 62 | EXPORT_SYMBOL(amiga_chip_alloc); |
69 | 63 | ||
70 | 64 | ||
71 | /* | 65 | /* |
72 | * Warning: | 66 | * Warning: |
73 | * amiga_chip_alloc_res is meant only for drivers that need to allocate | 67 | * amiga_chip_alloc_res is meant only for drivers that need to |
74 | * Chip RAM before kmalloc() is functional. As a consequence, those | 68 | * allocate Chip RAM before kmalloc() is functional. As a consequence, |
75 | * drivers must not free that Chip RAM afterwards. | 69 | * those drivers must not free that Chip RAM afterwards. |
76 | */ | 70 | */ |
77 | 71 | ||
78 | void * __init amiga_chip_alloc_res(unsigned long size, struct resource *res) | 72 | void *amiga_chip_alloc_res(unsigned long size, struct resource *res) |
79 | { | 73 | { |
80 | unsigned long start; | 74 | int error; |
81 | 75 | ||
82 | /* round up */ | 76 | /* round up */ |
83 | size = PAGE_ALIGN(size); | 77 | size = PAGE_ALIGN(size); |
84 | /* dmesg into chipmem prefers memory at the safe end */ | 78 | |
85 | start = CHIP_PHYSADDR + chipavail - size; | 79 | pr_debug("amiga_chip_alloc_res: allocate %lu bytes\n", size); |
86 | 80 | error = allocate_resource(&chipram_res, res, size, 0, UINT_MAX, | |
87 | #ifdef DEBUG | 81 | PAGE_SIZE, NULL, NULL); |
88 | printk("amiga_chip_alloc_res: allocate %ld bytes\n", size); | 82 | if (error < 0) { |
89 | #endif | 83 | pr_err("amiga_chip_alloc_res: allocate_resource() failed %d!\n", |
90 | if (allocate_resource(&chipram_res, res, size, start, UINT_MAX, PAGE_SIZE, NULL, NULL) < 0) { | 84 | error); |
91 | printk("amiga_chip_alloc_res: first alloc failed!\n"); | 85 | return NULL; |
92 | if (allocate_resource(&chipram_res, res, size, 0, UINT_MAX, PAGE_SIZE, NULL, NULL) < 0) | 86 | } |
93 | return NULL; | 87 | |
94 | } | 88 | atomic_sub(size, &chipavail); |
95 | chipavail -= size; | 89 | pr_debug("amiga_chip_alloc_res: returning %pR\n", res); |
96 | #ifdef DEBUG | 90 | return (void *)ZTWO_VADDR(res->start); |
97 | printk("amiga_chip_alloc_res: returning %lx\n", res->start); | ||
98 | #endif | ||
99 | return (void *)ZTWO_VADDR(res->start); | ||
100 | } | 91 | } |
101 | 92 | ||
102 | void amiga_chip_free(void *ptr) | 93 | void amiga_chip_free(void *ptr) |
103 | { | 94 | { |
104 | unsigned long start = ZTWO_PADDR(ptr); | 95 | unsigned long start = ZTWO_PADDR(ptr); |
105 | struct resource **p, *res; | 96 | struct resource *res; |
106 | unsigned long size; | 97 | unsigned long size; |
107 | 98 | ||
108 | for (p = &chipram_res.child; (res = *p); p = &res->sibling) { | 99 | res = lookup_resource(&chipram_res, start); |
109 | if (res->start != start) | 100 | if (!res) { |
110 | continue; | 101 | pr_err("amiga_chip_free: trying to free nonexistent region at " |
111 | *p = res->sibling; | 102 | "%p\n", ptr); |
112 | size = res->end-start; | 103 | return; |
113 | #ifdef DEBUG | 104 | } |
114 | printk("amiga_chip_free: free %ld bytes at %p\n", size, ptr); | 105 | |
115 | #endif | 106 | size = resource_size(res); |
116 | chipavail += size; | 107 | pr_debug("amiga_chip_free: free %lu bytes at %p\n", size, ptr); |
108 | atomic_add(size, &chipavail); | ||
109 | release_resource(res); | ||
117 | kfree(res); | 110 | kfree(res); |
118 | return; | ||
119 | } | ||
120 | printk("amiga_chip_free: trying to free nonexistent region at %p\n", ptr); | ||
121 | } | 111 | } |
122 | EXPORT_SYMBOL(amiga_chip_free); | 112 | EXPORT_SYMBOL(amiga_chip_free); |
123 | 113 | ||
124 | 114 | ||
125 | unsigned long amiga_chip_avail(void) | 115 | unsigned long amiga_chip_avail(void) |
126 | { | 116 | { |
127 | #ifdef DEBUG | 117 | unsigned long n = atomic_read(&chipavail); |
128 | printk("amiga_chip_avail : %ld bytes\n", chipavail); | 118 | |
129 | #endif | 119 | pr_debug("amiga_chip_avail : %lu bytes\n", n); |
130 | return chipavail; | 120 | return n; |
131 | } | 121 | } |
132 | EXPORT_SYMBOL(amiga_chip_avail); | 122 | EXPORT_SYMBOL(amiga_chip_avail); |
133 | 123 | ||
diff --git a/arch/m68k/atari/stram.c b/arch/m68k/atari/stram.c index 6ec3b7f33779..0810c8d56e59 100644 --- a/arch/m68k/atari/stram.c +++ b/arch/m68k/atari/stram.c | |||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | * arch/m68k/atari/stram.c: Functions for ST-RAM allocations | 2 | * Functions for ST-RAM allocations |
3 | * | 3 | * |
4 | * Copyright 1994-97 Roman Hodek <Roman.Hodek@informatik.uni-erlangen.de> | 4 | * Copyright 1994-97 Roman Hodek <Roman.Hodek@informatik.uni-erlangen.de> |
5 | * | 5 | * |
@@ -30,91 +30,35 @@ | |||
30 | #include <asm/atari_stram.h> | 30 | #include <asm/atari_stram.h> |
31 | #include <asm/io.h> | 31 | #include <asm/io.h> |
32 | 32 | ||
33 | #undef DEBUG | ||
34 | |||
35 | #ifdef DEBUG | ||
36 | #define DPRINTK(fmt,args...) printk( fmt, ##args ) | ||
37 | #else | ||
38 | #define DPRINTK(fmt,args...) | ||
39 | #endif | ||
40 | |||
41 | #if defined(CONFIG_PROC_FS) && defined(CONFIG_STRAM_PROC) | ||
42 | /* abbrev for the && above... */ | ||
43 | #define DO_PROC | ||
44 | #include <linux/proc_fs.h> | ||
45 | #include <linux/seq_file.h> | ||
46 | #endif | ||
47 | 33 | ||
48 | /* | 34 | /* |
49 | * ++roman: | 35 | * The ST-RAM allocator allocates memory from a pool of reserved ST-RAM of |
50 | * | 36 | * configurable size, set aside on ST-RAM init. |
51 | * New version of ST-Ram buffer allocation. Instead of using the | 37 | * As long as this pool is not exhausted, allocation of real ST-RAM can be |
52 | * 1 MB - 4 KB that remain when the ST-Ram chunk starts at $1000 | 38 | * guaranteed. |
53 | * (1 MB granularity!), such buffers are reserved like this: | ||
54 | * | ||
55 | * - If the kernel resides in ST-Ram anyway, we can take the buffer | ||
56 | * from behind the current kernel data space the normal way | ||
57 | * (incrementing start_mem). | ||
58 | * | ||
59 | * - If the kernel is in TT-Ram, stram_init() initializes start and | ||
60 | * end of the available region. Buffers are allocated from there | ||
61 | * and mem_init() later marks the such used pages as reserved. | ||
62 | * Since each TT-Ram chunk is at least 4 MB in size, I hope there | ||
63 | * won't be an overrun of the ST-Ram region by normal kernel data | ||
64 | * space. | ||
65 | * | ||
66 | * For that, ST-Ram may only be allocated while kernel initialization | ||
67 | * is going on, or exactly: before mem_init() is called. There is also | ||
68 | * no provision now for freeing ST-Ram buffers. It seems that isn't | ||
69 | * really needed. | ||
70 | * | ||
71 | */ | 39 | */ |
72 | 40 | ||
73 | /* Start and end (virtual) of ST-RAM */ | ||
74 | static void *stram_start, *stram_end; | ||
75 | |||
76 | /* set after memory_init() executed and allocations via start_mem aren't | ||
77 | * possible anymore */ | ||
78 | static int mem_init_done; | ||
79 | |||
80 | /* set if kernel is in ST-RAM */ | 41 | /* set if kernel is in ST-RAM */ |
81 | static int kernel_in_stram; | 42 | static int kernel_in_stram; |
82 | 43 | ||
83 | typedef struct stram_block { | 44 | static struct resource stram_pool = { |
84 | struct stram_block *next; | 45 | .name = "ST-RAM Pool" |
85 | void *start; | 46 | }; |
86 | unsigned long size; | ||
87 | unsigned flags; | ||
88 | const char *owner; | ||
89 | } BLOCK; | ||
90 | |||
91 | /* values for flags field */ | ||
92 | #define BLOCK_FREE 0x01 /* free structure in the BLOCKs pool */ | ||
93 | #define BLOCK_KMALLOCED 0x02 /* structure allocated by kmalloc() */ | ||
94 | #define BLOCK_GFP 0x08 /* block allocated with __get_dma_pages() */ | ||
95 | 47 | ||
96 | /* list of allocated blocks */ | 48 | static unsigned long pool_size = 1024*1024; |
97 | static BLOCK *alloc_list; | ||
98 | 49 | ||
99 | /* We can't always use kmalloc() to allocate BLOCK structures, since | ||
100 | * stram_alloc() can be called rather early. So we need some pool of | ||
101 | * statically allocated structures. 20 of them is more than enough, so in most | ||
102 | * cases we never should need to call kmalloc(). */ | ||
103 | #define N_STATIC_BLOCKS 20 | ||
104 | static BLOCK static_blocks[N_STATIC_BLOCKS]; | ||
105 | 50 | ||
106 | /***************************** Prototypes *****************************/ | 51 | static int __init atari_stram_setup(char *arg) |
52 | { | ||
53 | if (!MACH_IS_ATARI) | ||
54 | return 0; | ||
107 | 55 | ||
108 | static BLOCK *add_region( void *addr, unsigned long size ); | 56 | pool_size = memparse(arg, NULL); |
109 | static BLOCK *find_region( void *addr ); | 57 | return 0; |
110 | static int remove_region( BLOCK *block ); | 58 | } |
111 | 59 | ||
112 | /************************* End of Prototypes **************************/ | 60 | early_param("stram_pool", atari_stram_setup); |
113 | 61 | ||
114 | |||
115 | /* ------------------------------------------------------------------------ */ | ||
116 | /* Public Interface */ | ||
117 | /* ------------------------------------------------------------------------ */ | ||
118 | 62 | ||
119 | /* | 63 | /* |
120 | * This init function is called very early by atari/config.c | 64 | * This init function is called very early by atari/config.c |
@@ -123,25 +67,23 @@ static int remove_region( BLOCK *block ); | |||
123 | void __init atari_stram_init(void) | 67 | void __init atari_stram_init(void) |
124 | { | 68 | { |
125 | int i; | 69 | int i; |
70 | void *stram_start; | ||
126 | 71 | ||
127 | /* initialize static blocks */ | 72 | /* |
128 | for( i = 0; i < N_STATIC_BLOCKS; ++i ) | 73 | * determine whether kernel code resides in ST-RAM |
129 | static_blocks[i].flags = BLOCK_FREE; | 74 | * (then ST-RAM is the first memory block at virtual 0x0) |
130 | 75 | */ | |
131 | /* determine whether kernel code resides in ST-RAM (then ST-RAM is the | ||
132 | * first memory block at virtual 0x0) */ | ||
133 | stram_start = phys_to_virt(0); | 76 | stram_start = phys_to_virt(0); |
134 | kernel_in_stram = (stram_start == 0); | 77 | kernel_in_stram = (stram_start == 0); |
135 | 78 | ||
136 | for( i = 0; i < m68k_num_memory; ++i ) { | 79 | for (i = 0; i < m68k_num_memory; ++i) { |
137 | if (m68k_memory[i].addr == 0) { | 80 | if (m68k_memory[i].addr == 0) { |
138 | /* skip first 2kB or page (supervisor-only!) */ | ||
139 | stram_end = stram_start + m68k_memory[i].size; | ||
140 | return; | 81 | return; |
141 | } | 82 | } |
142 | } | 83 | } |
84 | |||
143 | /* Should never come here! (There is always ST-Ram!) */ | 85 | /* Should never come here! (There is always ST-Ram!) */ |
144 | panic( "atari_stram_init: no ST-RAM found!" ); | 86 | panic("atari_stram_init: no ST-RAM found!"); |
145 | } | 87 | } |
146 | 88 | ||
147 | 89 | ||
@@ -151,226 +93,68 @@ void __init atari_stram_init(void) | |||
151 | */ | 93 | */ |
152 | void __init atari_stram_reserve_pages(void *start_mem) | 94 | void __init atari_stram_reserve_pages(void *start_mem) |
153 | { | 95 | { |
154 | /* always reserve first page of ST-RAM, the first 2 kB are | 96 | /* |
155 | * supervisor-only! */ | 97 | * always reserve first page of ST-RAM, the first 2 KiB are |
98 | * supervisor-only! | ||
99 | */ | ||
156 | if (!kernel_in_stram) | 100 | if (!kernel_in_stram) |
157 | reserve_bootmem(0, PAGE_SIZE, BOOTMEM_DEFAULT); | 101 | reserve_bootmem(0, PAGE_SIZE, BOOTMEM_DEFAULT); |
158 | 102 | ||
159 | } | 103 | stram_pool.start = (resource_size_t)alloc_bootmem_low_pages(pool_size); |
104 | stram_pool.end = stram_pool.start + pool_size - 1; | ||
105 | request_resource(&iomem_resource, &stram_pool); | ||
160 | 106 | ||
161 | void atari_stram_mem_init_hook (void) | 107 | pr_debug("atari_stram pool: size = %lu bytes, resource = %pR\n", |
162 | { | 108 | pool_size, &stram_pool); |
163 | mem_init_done = 1; | ||
164 | } | 109 | } |
165 | 110 | ||
166 | 111 | ||
167 | /* | 112 | void *atari_stram_alloc(unsigned long size, const char *owner) |
168 | * This is main public interface: somehow allocate a ST-RAM block | ||
169 | * | ||
170 | * - If we're before mem_init(), we have to make a static allocation. The | ||
171 | * region is taken in the kernel data area (if the kernel is in ST-RAM) or | ||
172 | * from the start of ST-RAM (if the kernel is in TT-RAM) and added to the | ||
173 | * rsvd_stram_* region. The ST-RAM is somewhere in the middle of kernel | ||
174 | * address space in the latter case. | ||
175 | * | ||
176 | * - If mem_init() already has been called, try with __get_dma_pages(). | ||
177 | * This has the disadvantage that it's very hard to get more than 1 page, | ||
178 | * and it is likely to fail :-( | ||
179 | * | ||
180 | */ | ||
181 | void *atari_stram_alloc(long size, const char *owner) | ||
182 | { | 113 | { |
183 | void *addr = NULL; | 114 | struct resource *res; |
184 | BLOCK *block; | 115 | int error; |
185 | int flags; | 116 | |
186 | 117 | pr_debug("atari_stram_alloc: allocate %lu bytes\n", size); | |
187 | DPRINTK("atari_stram_alloc(size=%08lx,owner=%s)\n", size, owner); | 118 | |
188 | 119 | /* round up */ | |
189 | if (!mem_init_done) | 120 | size = PAGE_ALIGN(size); |
190 | return alloc_bootmem_low(size); | 121 | |
191 | else { | 122 | res = kzalloc(sizeof(struct resource), GFP_KERNEL); |
192 | /* After mem_init(): can only resort to __get_dma_pages() */ | 123 | if (!res) |
193 | addr = (void *)__get_dma_pages(GFP_KERNEL, get_order(size)); | 124 | return NULL; |
194 | flags = BLOCK_GFP; | 125 | |
195 | DPRINTK( "atari_stram_alloc: after mem_init, " | 126 | res->name = owner; |
196 | "get_pages=%p\n", addr ); | 127 | error = allocate_resource(&stram_pool, res, size, 0, UINT_MAX, |
128 | PAGE_SIZE, NULL, NULL); | ||
129 | if (error < 0) { | ||
130 | pr_err("atari_stram_alloc: allocate_resource() failed %d!\n", | ||
131 | error); | ||
132 | kfree(res); | ||
133 | return NULL; | ||
197 | } | 134 | } |
198 | 135 | ||
199 | if (addr) { | 136 | pr_debug("atari_stram_alloc: returning %pR\n", res); |
200 | if (!(block = add_region( addr, size ))) { | 137 | return (void *)res->start; |
201 | /* out of memory for BLOCK structure :-( */ | ||
202 | DPRINTK( "atari_stram_alloc: out of mem for BLOCK -- " | ||
203 | "freeing again\n" ); | ||
204 | free_pages((unsigned long)addr, get_order(size)); | ||
205 | return( NULL ); | ||
206 | } | ||
207 | block->owner = owner; | ||
208 | block->flags |= flags; | ||
209 | } | ||
210 | return( addr ); | ||
211 | } | 138 | } |
212 | EXPORT_SYMBOL(atari_stram_alloc); | 139 | EXPORT_SYMBOL(atari_stram_alloc); |
213 | 140 | ||
214 | void atari_stram_free( void *addr ) | ||
215 | 141 | ||
142 | void atari_stram_free(void *addr) | ||
216 | { | 143 | { |
217 | BLOCK *block; | 144 | unsigned long start = (unsigned long)addr; |
218 | 145 | struct resource *res; | |
219 | DPRINTK( "atari_stram_free(addr=%p)\n", addr ); | 146 | unsigned long size; |
220 | 147 | ||
221 | if (!(block = find_region( addr ))) { | 148 | res = lookup_resource(&stram_pool, start); |
222 | printk( KERN_ERR "Attempt to free non-allocated ST-RAM block at %p " | 149 | if (!res) { |
223 | "from %p\n", addr, __builtin_return_address(0) ); | 150 | pr_err("atari_stram_free: trying to free nonexistent region " |
151 | "at %p\n", addr); | ||
224 | return; | 152 | return; |
225 | } | 153 | } |
226 | DPRINTK( "atari_stram_free: found block (%p): size=%08lx, owner=%s, " | ||
227 | "flags=%02x\n", block, block->size, block->owner, block->flags ); | ||
228 | |||
229 | if (!(block->flags & BLOCK_GFP)) | ||
230 | goto fail; | ||
231 | 154 | ||
232 | DPRINTK("atari_stram_free: is kmalloced, order_size=%d\n", | 155 | size = resource_size(res); |
233 | get_order(block->size)); | 156 | pr_debug("atari_stram_free: free %lu bytes at %p\n", size, addr); |
234 | free_pages((unsigned long)addr, get_order(block->size)); | 157 | release_resource(res); |
235 | remove_region( block ); | 158 | kfree(res); |
236 | return; | ||
237 | |||
238 | fail: | ||
239 | printk( KERN_ERR "atari_stram_free: cannot free block at %p " | ||
240 | "(called from %p)\n", addr, __builtin_return_address(0) ); | ||
241 | } | 159 | } |
242 | EXPORT_SYMBOL(atari_stram_free); | 160 | EXPORT_SYMBOL(atari_stram_free); |
243 | |||
244 | |||
245 | /* ------------------------------------------------------------------------ */ | ||
246 | /* Region Management */ | ||
247 | /* ------------------------------------------------------------------------ */ | ||
248 | |||
249 | |||
250 | /* insert a region into the alloced list (sorted) */ | ||
251 | static BLOCK *add_region( void *addr, unsigned long size ) | ||
252 | { | ||
253 | BLOCK **p, *n = NULL; | ||
254 | int i; | ||
255 | |||
256 | for( i = 0; i < N_STATIC_BLOCKS; ++i ) { | ||
257 | if (static_blocks[i].flags & BLOCK_FREE) { | ||
258 | n = &static_blocks[i]; | ||
259 | n->flags = 0; | ||
260 | break; | ||
261 | } | ||
262 | } | ||
263 | if (!n && mem_init_done) { | ||
264 | /* if statics block pool exhausted and we can call kmalloc() already | ||
265 | * (after mem_init()), try that */ | ||
266 | n = kmalloc( sizeof(BLOCK), GFP_KERNEL ); | ||
267 | if (n) | ||
268 | n->flags = BLOCK_KMALLOCED; | ||
269 | } | ||
270 | if (!n) { | ||
271 | printk( KERN_ERR "Out of memory for ST-RAM descriptor blocks\n" ); | ||
272 | return( NULL ); | ||
273 | } | ||
274 | n->start = addr; | ||
275 | n->size = size; | ||
276 | |||
277 | for( p = &alloc_list; *p; p = &((*p)->next) ) | ||
278 | if ((*p)->start > addr) break; | ||
279 | n->next = *p; | ||
280 | *p = n; | ||
281 | |||
282 | return( n ); | ||
283 | } | ||
284 | |||
285 | |||
286 | /* find a region (by start addr) in the alloced list */ | ||
287 | static BLOCK *find_region( void *addr ) | ||
288 | { | ||
289 | BLOCK *p; | ||
290 | |||
291 | for( p = alloc_list; p; p = p->next ) { | ||
292 | if (p->start == addr) | ||
293 | return( p ); | ||
294 | if (p->start > addr) | ||
295 | break; | ||
296 | } | ||
297 | return( NULL ); | ||
298 | } | ||
299 | |||
300 | |||
301 | /* remove a block from the alloced list */ | ||
302 | static int remove_region( BLOCK *block ) | ||
303 | { | ||
304 | BLOCK **p; | ||
305 | |||
306 | for( p = &alloc_list; *p; p = &((*p)->next) ) | ||
307 | if (*p == block) break; | ||
308 | if (!*p) | ||
309 | return( 0 ); | ||
310 | |||
311 | *p = block->next; | ||
312 | if (block->flags & BLOCK_KMALLOCED) | ||
313 | kfree( block ); | ||
314 | else | ||
315 | block->flags |= BLOCK_FREE; | ||
316 | return( 1 ); | ||
317 | } | ||
318 | |||
319 | |||
320 | |||
321 | /* ------------------------------------------------------------------------ */ | ||
322 | /* /proc statistics file stuff */ | ||
323 | /* ------------------------------------------------------------------------ */ | ||
324 | |||
325 | #ifdef DO_PROC | ||
326 | |||
327 | #define PRINT_PROC(fmt,args...) seq_printf( m, fmt, ##args ) | ||
328 | |||
329 | static int stram_proc_show(struct seq_file *m, void *v) | ||
330 | { | ||
331 | BLOCK *p; | ||
332 | |||
333 | PRINT_PROC("Total ST-RAM: %8u kB\n", | ||
334 | (stram_end - stram_start) >> 10); | ||
335 | PRINT_PROC( "Allocated regions:\n" ); | ||
336 | for( p = alloc_list; p; p = p->next ) { | ||
337 | PRINT_PROC("0x%08lx-0x%08lx: %s (", | ||
338 | virt_to_phys(p->start), | ||
339 | virt_to_phys(p->start+p->size-1), | ||
340 | p->owner); | ||
341 | if (p->flags & BLOCK_GFP) | ||
342 | PRINT_PROC( "page-alloced)\n" ); | ||
343 | else | ||
344 | PRINT_PROC( "??)\n" ); | ||
345 | } | ||
346 | |||
347 | return 0; | ||
348 | } | ||
349 | |||
350 | static int stram_proc_open(struct inode *inode, struct file *file) | ||
351 | { | ||
352 | return single_open(file, stram_proc_show, NULL); | ||
353 | } | ||
354 | |||
355 | static const struct file_operations stram_proc_fops = { | ||
356 | .open = stram_proc_open, | ||
357 | .read = seq_read, | ||
358 | .llseek = seq_lseek, | ||
359 | .release = single_release, | ||
360 | }; | ||
361 | |||
362 | static int __init proc_stram_init(void) | ||
363 | { | ||
364 | proc_create("stram", 0, NULL, &stram_proc_fops); | ||
365 | return 0; | ||
366 | } | ||
367 | module_init(proc_stram_init); | ||
368 | #endif | ||
369 | |||
370 | |||
371 | /* | ||
372 | * Local variables: | ||
373 | * c-indent-level: 4 | ||
374 | * tab-width: 4 | ||
375 | * End: | ||
376 | */ | ||
diff --git a/arch/m68k/include/asm/atari_stram.h b/arch/m68k/include/asm/atari_stram.h index 7546d13963be..62e27598af91 100644 --- a/arch/m68k/include/asm/atari_stram.h +++ b/arch/m68k/include/asm/atari_stram.h | |||
@@ -6,12 +6,11 @@ | |||
6 | */ | 6 | */ |
7 | 7 | ||
8 | /* public interface */ | 8 | /* public interface */ |
9 | void *atari_stram_alloc(long size, const char *owner); | 9 | void *atari_stram_alloc(unsigned long size, const char *owner); |
10 | void atari_stram_free(void *); | 10 | void atari_stram_free(void *); |
11 | 11 | ||
12 | /* functions called internally by other parts of the kernel */ | 12 | /* functions called internally by other parts of the kernel */ |
13 | void atari_stram_init(void); | 13 | void atari_stram_init(void); |
14 | void atari_stram_reserve_pages(void *start_mem); | 14 | void atari_stram_reserve_pages(void *start_mem); |
15 | void atari_stram_mem_init_hook (void); | ||
16 | 15 | ||
17 | #endif /*_M68K_ATARI_STRAM_H */ | 16 | #endif /*_M68K_ATARI_STRAM_H */ |
diff --git a/arch/m68k/include/asm/atarihw.h b/arch/m68k/include/asm/atarihw.h index f51f709bbf30..0392b28656ab 100644 --- a/arch/m68k/include/asm/atarihw.h +++ b/arch/m68k/include/asm/atarihw.h | |||
@@ -399,8 +399,8 @@ struct CODEC | |||
399 | #define CODEC_OVERFLOW_LEFT 2 | 399 | #define CODEC_OVERFLOW_LEFT 2 |
400 | u_char unused2, unused3, unused4, unused5; | 400 | u_char unused2, unused3, unused4, unused5; |
401 | u_char gpio_directions; | 401 | u_char gpio_directions; |
402 | #define GPIO_IN 0 | 402 | #define CODEC_GPIO_IN 0 |
403 | #define GPIO_OUT 1 | 403 | #define CODEC_GPIO_OUT 1 |
404 | u_char unused6; | 404 | u_char unused6; |
405 | u_char gpio_data; | 405 | u_char gpio_data; |
406 | }; | 406 | }; |
diff --git a/arch/m68k/kernel/setup_mm.c b/arch/m68k/kernel/setup_mm.c index 334d83640376..c3b45061dd08 100644 --- a/arch/m68k/kernel/setup_mm.c +++ b/arch/m68k/kernel/setup_mm.c | |||
@@ -216,7 +216,9 @@ static void __init m68k_parse_bootinfo(const struct bi_record *record) | |||
216 | 216 | ||
217 | void __init setup_arch(char **cmdline_p) | 217 | void __init setup_arch(char **cmdline_p) |
218 | { | 218 | { |
219 | #ifndef CONFIG_SUN3 | ||
219 | int i; | 220 | int i; |
221 | #endif | ||
220 | 222 | ||
221 | /* The bootinfo is located right after the kernel bss */ | 223 | /* The bootinfo is located right after the kernel bss */ |
222 | m68k_parse_bootinfo((const struct bi_record *)_end); | 224 | m68k_parse_bootinfo((const struct bi_record *)_end); |
diff --git a/arch/m68k/math-emu/fp_log.c b/arch/m68k/math-emu/fp_log.c index 367ecee2f981..3384a5244fbd 100644 --- a/arch/m68k/math-emu/fp_log.c +++ b/arch/m68k/math-emu/fp_log.c | |||
@@ -105,9 +105,6 @@ fp_fetoxm1(struct fp_ext *dest, struct fp_ext *src) | |||
105 | 105 | ||
106 | fp_monadic_check(dest, src); | 106 | fp_monadic_check(dest, src); |
107 | 107 | ||
108 | if (IS_ZERO(dest)) | ||
109 | return dest; | ||
110 | |||
111 | return dest; | 108 | return dest; |
112 | } | 109 | } |
113 | 110 | ||
diff --git a/arch/m68k/math-emu/multi_arith.h b/arch/m68k/math-emu/multi_arith.h index 4ad0ca918e2e..4b5eb3d85638 100644 --- a/arch/m68k/math-emu/multi_arith.h +++ b/arch/m68k/math-emu/multi_arith.h | |||
@@ -19,246 +19,6 @@ | |||
19 | #ifndef MULTI_ARITH_H | 19 | #ifndef MULTI_ARITH_H |
20 | #define MULTI_ARITH_H | 20 | #define MULTI_ARITH_H |
21 | 21 | ||
22 | #if 0 /* old code... */ | ||
23 | |||
24 | /* Unsigned only, because we don't need signs to multiply and divide. */ | ||
25 | typedef unsigned int int128[4]; | ||
26 | |||
27 | /* Word order */ | ||
28 | enum { | ||
29 | MSW128, | ||
30 | NMSW128, | ||
31 | NLSW128, | ||
32 | LSW128 | ||
33 | }; | ||
34 | |||
35 | /* big-endian */ | ||
36 | #define LO_WORD(ll) (((unsigned int *) &ll)[1]) | ||
37 | #define HI_WORD(ll) (((unsigned int *) &ll)[0]) | ||
38 | |||
39 | /* Convenience functions to stuff various integer values into int128s */ | ||
40 | |||
41 | static inline void zero128(int128 a) | ||
42 | { | ||
43 | a[LSW128] = a[NLSW128] = a[NMSW128] = a[MSW128] = 0; | ||
44 | } | ||
45 | |||
46 | /* Human-readable word order in the arguments */ | ||
47 | static inline void set128(unsigned int i3, unsigned int i2, unsigned int i1, | ||
48 | unsigned int i0, int128 a) | ||
49 | { | ||
50 | a[LSW128] = i0; | ||
51 | a[NLSW128] = i1; | ||
52 | a[NMSW128] = i2; | ||
53 | a[MSW128] = i3; | ||
54 | } | ||
55 | |||
56 | /* Convenience functions (for testing as well) */ | ||
57 | static inline void int64_to_128(unsigned long long src, int128 dest) | ||
58 | { | ||
59 | dest[LSW128] = (unsigned int) src; | ||
60 | dest[NLSW128] = src >> 32; | ||
61 | dest[NMSW128] = dest[MSW128] = 0; | ||
62 | } | ||
63 | |||
64 | static inline void int128_to_64(const int128 src, unsigned long long *dest) | ||
65 | { | ||
66 | *dest = src[LSW128] | (long long) src[NLSW128] << 32; | ||
67 | } | ||
68 | |||
69 | static inline void put_i128(const int128 a) | ||
70 | { | ||
71 | printk("%08x %08x %08x %08x\n", a[MSW128], a[NMSW128], | ||
72 | a[NLSW128], a[LSW128]); | ||
73 | } | ||
74 | |||
75 | /* Internal shifters: | ||
76 | |||
77 | Note that these are only good for 0 < count < 32. | ||
78 | */ | ||
79 | |||
80 | static inline void _lsl128(unsigned int count, int128 a) | ||
81 | { | ||
82 | a[MSW128] = (a[MSW128] << count) | (a[NMSW128] >> (32 - count)); | ||
83 | a[NMSW128] = (a[NMSW128] << count) | (a[NLSW128] >> (32 - count)); | ||
84 | a[NLSW128] = (a[NLSW128] << count) | (a[LSW128] >> (32 - count)); | ||
85 | a[LSW128] <<= count; | ||
86 | } | ||
87 | |||
88 | static inline void _lsr128(unsigned int count, int128 a) | ||
89 | { | ||
90 | a[LSW128] = (a[LSW128] >> count) | (a[NLSW128] << (32 - count)); | ||
91 | a[NLSW128] = (a[NLSW128] >> count) | (a[NMSW128] << (32 - count)); | ||
92 | a[NMSW128] = (a[NMSW128] >> count) | (a[MSW128] << (32 - count)); | ||
93 | a[MSW128] >>= count; | ||
94 | } | ||
95 | |||
96 | /* Should be faster, one would hope */ | ||
97 | |||
98 | static inline void lslone128(int128 a) | ||
99 | { | ||
100 | asm volatile ("lsl.l #1,%0\n" | ||
101 | "roxl.l #1,%1\n" | ||
102 | "roxl.l #1,%2\n" | ||
103 | "roxl.l #1,%3\n" | ||
104 | : | ||
105 | "=d" (a[LSW128]), | ||
106 | "=d"(a[NLSW128]), | ||
107 | "=d"(a[NMSW128]), | ||
108 | "=d"(a[MSW128]) | ||
109 | : | ||
110 | "0"(a[LSW128]), | ||
111 | "1"(a[NLSW128]), | ||
112 | "2"(a[NMSW128]), | ||
113 | "3"(a[MSW128])); | ||
114 | } | ||
115 | |||
116 | static inline void lsrone128(int128 a) | ||
117 | { | ||
118 | asm volatile ("lsr.l #1,%0\n" | ||
119 | "roxr.l #1,%1\n" | ||
120 | "roxr.l #1,%2\n" | ||
121 | "roxr.l #1,%3\n" | ||
122 | : | ||
123 | "=d" (a[MSW128]), | ||
124 | "=d"(a[NMSW128]), | ||
125 | "=d"(a[NLSW128]), | ||
126 | "=d"(a[LSW128]) | ||
127 | : | ||
128 | "0"(a[MSW128]), | ||
129 | "1"(a[NMSW128]), | ||
130 | "2"(a[NLSW128]), | ||
131 | "3"(a[LSW128])); | ||
132 | } | ||
133 | |||
134 | /* Generalized 128-bit shifters: | ||
135 | |||
136 | These bit-shift to a multiple of 32, then move whole longwords. */ | ||
137 | |||
138 | static inline void lsl128(unsigned int count, int128 a) | ||
139 | { | ||
140 | int wordcount, i; | ||
141 | |||
142 | if (count % 32) | ||
143 | _lsl128(count % 32, a); | ||
144 | |||
145 | if (0 == (wordcount = count / 32)) | ||
146 | return; | ||
147 | |||
148 | /* argh, gak, endian-sensitive */ | ||
149 | for (i = 0; i < 4 - wordcount; i++) { | ||
150 | a[i] = a[i + wordcount]; | ||
151 | } | ||
152 | for (i = 3; i >= 4 - wordcount; --i) { | ||
153 | a[i] = 0; | ||
154 | } | ||
155 | } | ||
156 | |||
157 | static inline void lsr128(unsigned int count, int128 a) | ||
158 | { | ||
159 | int wordcount, i; | ||
160 | |||
161 | if (count % 32) | ||
162 | _lsr128(count % 32, a); | ||
163 | |||
164 | if (0 == (wordcount = count / 32)) | ||
165 | return; | ||
166 | |||
167 | for (i = 3; i >= wordcount; --i) { | ||
168 | a[i] = a[i - wordcount]; | ||
169 | } | ||
170 | for (i = 0; i < wordcount; i++) { | ||
171 | a[i] = 0; | ||
172 | } | ||
173 | } | ||
174 | |||
175 | static inline int orl128(int a, int128 b) | ||
176 | { | ||
177 | b[LSW128] |= a; | ||
178 | } | ||
179 | |||
180 | static inline int btsthi128(const int128 a) | ||
181 | { | ||
182 | return a[MSW128] & 0x80000000; | ||
183 | } | ||
184 | |||
185 | /* test bits (numbered from 0 = LSB) up to and including "top" */ | ||
186 | static inline int bftestlo128(int top, const int128 a) | ||
187 | { | ||
188 | int r = 0; | ||
189 | |||
190 | if (top > 31) | ||
191 | r |= a[LSW128]; | ||
192 | if (top > 63) | ||
193 | r |= a[NLSW128]; | ||
194 | if (top > 95) | ||
195 | r |= a[NMSW128]; | ||
196 | |||
197 | r |= a[3 - (top / 32)] & ((1 << (top % 32 + 1)) - 1); | ||
198 | |||
199 | return (r != 0); | ||
200 | } | ||
201 | |||
202 | /* Aargh. We need these because GCC is broken */ | ||
203 | /* FIXME: do them in assembly, for goodness' sake! */ | ||
204 | static inline void mask64(int pos, unsigned long long *mask) | ||
205 | { | ||
206 | *mask = 0; | ||
207 | |||
208 | if (pos < 32) { | ||
209 | LO_WORD(*mask) = (1 << pos) - 1; | ||
210 | return; | ||
211 | } | ||
212 | LO_WORD(*mask) = -1; | ||
213 | HI_WORD(*mask) = (1 << (pos - 32)) - 1; | ||
214 | } | ||
215 | |||
216 | static inline void bset64(int pos, unsigned long long *dest) | ||
217 | { | ||
218 | /* This conditional will be optimized away. Thanks, GCC! */ | ||
219 | if (pos < 32) | ||
220 | asm volatile ("bset %1,%0":"=m" | ||
221 | (LO_WORD(*dest)):"id"(pos)); | ||
222 | else | ||
223 | asm volatile ("bset %1,%0":"=m" | ||
224 | (HI_WORD(*dest)):"id"(pos - 32)); | ||
225 | } | ||
226 | |||
227 | static inline int btst64(int pos, unsigned long long dest) | ||
228 | { | ||
229 | if (pos < 32) | ||
230 | return (0 != (LO_WORD(dest) & (1 << pos))); | ||
231 | else | ||
232 | return (0 != (HI_WORD(dest) & (1 << (pos - 32)))); | ||
233 | } | ||
234 | |||
235 | static inline void lsl64(int count, unsigned long long *dest) | ||
236 | { | ||
237 | if (count < 32) { | ||
238 | HI_WORD(*dest) = (HI_WORD(*dest) << count) | ||
239 | | (LO_WORD(*dest) >> count); | ||
240 | LO_WORD(*dest) <<= count; | ||
241 | return; | ||
242 | } | ||
243 | count -= 32; | ||
244 | HI_WORD(*dest) = LO_WORD(*dest) << count; | ||
245 | LO_WORD(*dest) = 0; | ||
246 | } | ||
247 | |||
248 | static inline void lsr64(int count, unsigned long long *dest) | ||
249 | { | ||
250 | if (count < 32) { | ||
251 | LO_WORD(*dest) = (LO_WORD(*dest) >> count) | ||
252 | | (HI_WORD(*dest) << (32 - count)); | ||
253 | HI_WORD(*dest) >>= count; | ||
254 | return; | ||
255 | } | ||
256 | count -= 32; | ||
257 | LO_WORD(*dest) = HI_WORD(*dest) >> count; | ||
258 | HI_WORD(*dest) = 0; | ||
259 | } | ||
260 | #endif | ||
261 | |||
262 | static inline void fp_denormalize(struct fp_ext *reg, unsigned int cnt) | 22 | static inline void fp_denormalize(struct fp_ext *reg, unsigned int cnt) |
263 | { | 23 | { |
264 | reg->exp += cnt; | 24 | reg->exp += cnt; |
@@ -481,117 +241,6 @@ static inline void fp_dividemant(union fp_mant128 *dest, struct fp_ext *src, | |||
481 | } | 241 | } |
482 | } | 242 | } |
483 | 243 | ||
484 | #if 0 | ||
485 | static inline unsigned int fp_fls128(union fp_mant128 *src) | ||
486 | { | ||
487 | unsigned long data; | ||
488 | unsigned int res, off; | ||
489 | |||
490 | if ((data = src->m32[0])) | ||
491 | off = 0; | ||
492 | else if ((data = src->m32[1])) | ||
493 | off = 32; | ||
494 | else if ((data = src->m32[2])) | ||
495 | off = 64; | ||
496 | else if ((data = src->m32[3])) | ||
497 | off = 96; | ||
498 | else | ||
499 | return 128; | ||
500 | |||
501 | asm ("bfffo %1{#0,#32},%0" : "=d" (res) : "dm" (data)); | ||
502 | return res + off; | ||
503 | } | ||
504 | |||
505 | static inline void fp_shiftmant128(union fp_mant128 *src, int shift) | ||
506 | { | ||
507 | unsigned long sticky; | ||
508 | |||
509 | switch (shift) { | ||
510 | case 0: | ||
511 | return; | ||
512 | case 1: | ||
513 | asm volatile ("lsl.l #1,%0" | ||
514 | : "=d" (src->m32[3]) : "0" (src->m32[3])); | ||
515 | asm volatile ("roxl.l #1,%0" | ||
516 | : "=d" (src->m32[2]) : "0" (src->m32[2])); | ||
517 | asm volatile ("roxl.l #1,%0" | ||
518 | : "=d" (src->m32[1]) : "0" (src->m32[1])); | ||
519 | asm volatile ("roxl.l #1,%0" | ||
520 | : "=d" (src->m32[0]) : "0" (src->m32[0])); | ||
521 | return; | ||
522 | case 2 ... 31: | ||
523 | src->m32[0] = (src->m32[0] << shift) | (src->m32[1] >> (32 - shift)); | ||
524 | src->m32[1] = (src->m32[1] << shift) | (src->m32[2] >> (32 - shift)); | ||
525 | src->m32[2] = (src->m32[2] << shift) | (src->m32[3] >> (32 - shift)); | ||
526 | src->m32[3] = (src->m32[3] << shift); | ||
527 | return; | ||
528 | case 32 ... 63: | ||
529 | shift -= 32; | ||
530 | src->m32[0] = (src->m32[1] << shift) | (src->m32[2] >> (32 - shift)); | ||
531 | src->m32[1] = (src->m32[2] << shift) | (src->m32[3] >> (32 - shift)); | ||
532 | src->m32[2] = (src->m32[3] << shift); | ||
533 | src->m32[3] = 0; | ||
534 | return; | ||
535 | case 64 ... 95: | ||
536 | shift -= 64; | ||
537 | src->m32[0] = (src->m32[2] << shift) | (src->m32[3] >> (32 - shift)); | ||
538 | src->m32[1] = (src->m32[3] << shift); | ||
539 | src->m32[2] = src->m32[3] = 0; | ||
540 | return; | ||
541 | case 96 ... 127: | ||
542 | shift -= 96; | ||
543 | src->m32[0] = (src->m32[3] << shift); | ||
544 | src->m32[1] = src->m32[2] = src->m32[3] = 0; | ||
545 | return; | ||
546 | case -31 ... -1: | ||
547 | shift = -shift; | ||
548 | sticky = 0; | ||
549 | if (src->m32[3] << (32 - shift)) | ||
550 | sticky = 1; | ||
551 | src->m32[3] = (src->m32[3] >> shift) | (src->m32[2] << (32 - shift)) | sticky; | ||
552 | src->m32[2] = (src->m32[2] >> shift) | (src->m32[1] << (32 - shift)); | ||
553 | src->m32[1] = (src->m32[1] >> shift) | (src->m32[0] << (32 - shift)); | ||
554 | src->m32[0] = (src->m32[0] >> shift); | ||
555 | return; | ||
556 | case -63 ... -32: | ||
557 | shift = -shift - 32; | ||
558 | sticky = 0; | ||
559 | if ((src->m32[2] << (32 - shift)) || src->m32[3]) | ||
560 | sticky = 1; | ||
561 | src->m32[3] = (src->m32[2] >> shift) | (src->m32[1] << (32 - shift)) | sticky; | ||
562 | src->m32[2] = (src->m32[1] >> shift) | (src->m32[0] << (32 - shift)); | ||
563 | src->m32[1] = (src->m32[0] >> shift); | ||
564 | src->m32[0] = 0; | ||
565 | return; | ||
566 | case -95 ... -64: | ||
567 | shift = -shift - 64; | ||
568 | sticky = 0; | ||
569 | if ((src->m32[1] << (32 - shift)) || src->m32[2] || src->m32[3]) | ||
570 | sticky = 1; | ||
571 | src->m32[3] = (src->m32[1] >> shift) | (src->m32[0] << (32 - shift)) | sticky; | ||
572 | src->m32[2] = (src->m32[0] >> shift); | ||
573 | src->m32[1] = src->m32[0] = 0; | ||
574 | return; | ||
575 | case -127 ... -96: | ||
576 | shift = -shift - 96; | ||
577 | sticky = 0; | ||
578 | if ((src->m32[0] << (32 - shift)) || src->m32[1] || src->m32[2] || src->m32[3]) | ||
579 | sticky = 1; | ||
580 | src->m32[3] = (src->m32[0] >> shift) | sticky; | ||
581 | src->m32[2] = src->m32[1] = src->m32[0] = 0; | ||
582 | return; | ||
583 | } | ||
584 | |||
585 | if (shift < 0 && (src->m32[0] || src->m32[1] || src->m32[2] || src->m32[3])) | ||
586 | src->m32[3] = 1; | ||
587 | else | ||
588 | src->m32[3] = 0; | ||
589 | src->m32[2] = 0; | ||
590 | src->m32[1] = 0; | ||
591 | src->m32[0] = 0; | ||
592 | } | ||
593 | #endif | ||
594 | |||
595 | static inline void fp_putmant128(struct fp_ext *dest, union fp_mant128 *src, | 244 | static inline void fp_putmant128(struct fp_ext *dest, union fp_mant128 *src, |
596 | int shift) | 245 | int shift) |
597 | { | 246 | { |
@@ -637,183 +286,4 @@ static inline void fp_putmant128(struct fp_ext *dest, union fp_mant128 *src, | |||
637 | } | 286 | } |
638 | } | 287 | } |
639 | 288 | ||
640 | #if 0 /* old code... */ | ||
641 | static inline int fls(unsigned int a) | ||
642 | { | ||
643 | int r; | ||
644 | |||
645 | asm volatile ("bfffo %1{#0,#32},%0" | ||
646 | : "=d" (r) : "md" (a)); | ||
647 | return r; | ||
648 | } | ||
649 | |||
650 | /* fls = "find last set" (cf. ffs(3)) */ | ||
651 | static inline int fls128(const int128 a) | ||
652 | { | ||
653 | if (a[MSW128]) | ||
654 | return fls(a[MSW128]); | ||
655 | if (a[NMSW128]) | ||
656 | return fls(a[NMSW128]) + 32; | ||
657 | /* XXX: it probably never gets beyond this point in actual | ||
658 | use, but that's indicative of a more general problem in the | ||
659 | algorithm (i.e. as per the actual 68881 implementation, we | ||
660 | really only need at most 67 bits of precision [plus | ||
661 | overflow]) so I'm not going to fix it. */ | ||
662 | if (a[NLSW128]) | ||
663 | return fls(a[NLSW128]) + 64; | ||
664 | if (a[LSW128]) | ||
665 | return fls(a[LSW128]) + 96; | ||
666 | else | ||
667 | return -1; | ||
668 | } | ||
669 | |||
670 | static inline int zerop128(const int128 a) | ||
671 | { | ||
672 | return !(a[LSW128] | a[NLSW128] | a[NMSW128] | a[MSW128]); | ||
673 | } | ||
674 | |||
675 | static inline int nonzerop128(const int128 a) | ||
676 | { | ||
677 | return (a[LSW128] | a[NLSW128] | a[NMSW128] | a[MSW128]); | ||
678 | } | ||
679 | |||
680 | /* Addition and subtraction */ | ||
681 | /* Do these in "pure" assembly, because "extended" asm is unmanageable | ||
682 | here */ | ||
683 | static inline void add128(const int128 a, int128 b) | ||
684 | { | ||
685 | /* rotating carry flags */ | ||
686 | unsigned int carry[2]; | ||
687 | |||
688 | carry[0] = a[LSW128] > (0xffffffff - b[LSW128]); | ||
689 | b[LSW128] += a[LSW128]; | ||
690 | |||
691 | carry[1] = a[NLSW128] > (0xffffffff - b[NLSW128] - carry[0]); | ||
692 | b[NLSW128] = a[NLSW128] + b[NLSW128] + carry[0]; | ||
693 | |||
694 | carry[0] = a[NMSW128] > (0xffffffff - b[NMSW128] - carry[1]); | ||
695 | b[NMSW128] = a[NMSW128] + b[NMSW128] + carry[1]; | ||
696 | |||
697 | b[MSW128] = a[MSW128] + b[MSW128] + carry[0]; | ||
698 | } | ||
699 | |||
700 | /* Note: assembler semantics: "b -= a" */ | ||
701 | static inline void sub128(const int128 a, int128 b) | ||
702 | { | ||
703 | /* rotating borrow flags */ | ||
704 | unsigned int borrow[2]; | ||
705 | |||
706 | borrow[0] = b[LSW128] < a[LSW128]; | ||
707 | b[LSW128] -= a[LSW128]; | ||
708 | |||
709 | borrow[1] = b[NLSW128] < a[NLSW128] + borrow[0]; | ||
710 | b[NLSW128] = b[NLSW128] - a[NLSW128] - borrow[0]; | ||
711 | |||
712 | borrow[0] = b[NMSW128] < a[NMSW128] + borrow[1]; | ||
713 | b[NMSW128] = b[NMSW128] - a[NMSW128] - borrow[1]; | ||
714 | |||
715 | b[MSW128] = b[MSW128] - a[MSW128] - borrow[0]; | ||
716 | } | ||
717 | |||
718 | /* Poor man's 64-bit expanding multiply */ | ||
719 | static inline void mul64(unsigned long long a, unsigned long long b, int128 c) | ||
720 | { | ||
721 | unsigned long long acc; | ||
722 | int128 acc128; | ||
723 | |||
724 | zero128(acc128); | ||
725 | zero128(c); | ||
726 | |||
727 | /* first the low words */ | ||
728 | if (LO_WORD(a) && LO_WORD(b)) { | ||
729 | acc = (long long) LO_WORD(a) * LO_WORD(b); | ||
730 | c[NLSW128] = HI_WORD(acc); | ||
731 | c[LSW128] = LO_WORD(acc); | ||
732 | } | ||
733 | /* Next the high words */ | ||
734 | if (HI_WORD(a) && HI_WORD(b)) { | ||
735 | acc = (long long) HI_WORD(a) * HI_WORD(b); | ||
736 | c[MSW128] = HI_WORD(acc); | ||
737 | c[NMSW128] = LO_WORD(acc); | ||
738 | } | ||
739 | /* The middle words */ | ||
740 | if (LO_WORD(a) && HI_WORD(b)) { | ||
741 | acc = (long long) LO_WORD(a) * HI_WORD(b); | ||
742 | acc128[NMSW128] = HI_WORD(acc); | ||
743 | acc128[NLSW128] = LO_WORD(acc); | ||
744 | add128(acc128, c); | ||
745 | } | ||
746 | /* The first and last words */ | ||
747 | if (HI_WORD(a) && LO_WORD(b)) { | ||
748 | acc = (long long) HI_WORD(a) * LO_WORD(b); | ||
749 | acc128[NMSW128] = HI_WORD(acc); | ||
750 | acc128[NLSW128] = LO_WORD(acc); | ||
751 | add128(acc128, c); | ||
752 | } | ||
753 | } | ||
754 | |||
755 | /* Note: unsigned */ | ||
756 | static inline int cmp128(int128 a, int128 b) | ||
757 | { | ||
758 | if (a[MSW128] < b[MSW128]) | ||
759 | return -1; | ||
760 | if (a[MSW128] > b[MSW128]) | ||
761 | return 1; | ||
762 | if (a[NMSW128] < b[NMSW128]) | ||
763 | return -1; | ||
764 | if (a[NMSW128] > b[NMSW128]) | ||
765 | return 1; | ||
766 | if (a[NLSW128] < b[NLSW128]) | ||
767 | return -1; | ||
768 | if (a[NLSW128] > b[NLSW128]) | ||
769 | return 1; | ||
770 | |||
771 | return (signed) a[LSW128] - b[LSW128]; | ||
772 | } | ||
773 | |||
774 | inline void div128(int128 a, int128 b, int128 c) | ||
775 | { | ||
776 | int128 mask; | ||
777 | |||
778 | /* Algorithm: | ||
779 | |||
780 | Shift the divisor until it's at least as big as the | ||
781 | dividend, keeping track of the position to which we've | ||
782 | shifted it, i.e. the power of 2 which we've multiplied it | ||
783 | by. | ||
784 | |||
785 | Then, for this power of 2 (the mask), and every one smaller | ||
786 | than it, subtract the mask from the dividend and add it to | ||
787 | the quotient until the dividend is smaller than the raised | ||
788 | divisor. At this point, divide the dividend and the mask | ||
789 | by 2 (i.e. shift one place to the right). Lather, rinse, | ||
790 | and repeat, until there are no more powers of 2 left. */ | ||
791 | |||
792 | /* FIXME: needless to say, there's room for improvement here too. */ | ||
793 | |||
794 | /* Shift up */ | ||
795 | /* XXX: since it just has to be "at least as big", we can | ||
796 | probably eliminate this horribly wasteful loop. I will | ||
797 | have to prove this first, though */ | ||
798 | set128(0, 0, 0, 1, mask); | ||
799 | while (cmp128(b, a) < 0 && !btsthi128(b)) { | ||
800 | lslone128(b); | ||
801 | lslone128(mask); | ||
802 | } | ||
803 | |||
804 | /* Shift down */ | ||
805 | zero128(c); | ||
806 | do { | ||
807 | if (cmp128(a, b) >= 0) { | ||
808 | sub128(b, a); | ||
809 | add128(mask, c); | ||
810 | } | ||
811 | lsrone128(mask); | ||
812 | lsrone128(b); | ||
813 | } while (nonzerop128(mask)); | ||
814 | |||
815 | /* The remainder is in a... */ | ||
816 | } | ||
817 | #endif | ||
818 | |||
819 | #endif /* MULTI_ARITH_H */ | 289 | #endif /* MULTI_ARITH_H */ |
diff --git a/arch/m68k/mm/init_mm.c b/arch/m68k/mm/init_mm.c index 9113c2f17607..bbe525434ccb 100644 --- a/arch/m68k/mm/init_mm.c +++ b/arch/m68k/mm/init_mm.c | |||
@@ -83,11 +83,6 @@ void __init mem_init(void) | |||
83 | int initpages = 0; | 83 | int initpages = 0; |
84 | int i; | 84 | int i; |
85 | 85 | ||
86 | #ifdef CONFIG_ATARI | ||
87 | if (MACH_IS_ATARI) | ||
88 | atari_stram_mem_init_hook(); | ||
89 | #endif | ||
90 | |||
91 | /* this will put all memory onto the freelists */ | 86 | /* this will put all memory onto the freelists */ |
92 | totalram_pages = num_physpages = 0; | 87 | totalram_pages = num_physpages = 0; |
93 | for_each_online_pgdat(pgdat) { | 88 | for_each_online_pgdat(pgdat) { |
diff --git a/arch/parisc/Kconfig b/arch/parisc/Kconfig index 65adc86a230e..e077b0bf56ca 100644 --- a/arch/parisc/Kconfig +++ b/arch/parisc/Kconfig | |||
@@ -15,6 +15,7 @@ config PARISC | |||
15 | select HAVE_GENERIC_HARDIRQS | 15 | select HAVE_GENERIC_HARDIRQS |
16 | select GENERIC_IRQ_PROBE | 16 | select GENERIC_IRQ_PROBE |
17 | select IRQ_PER_CPU | 17 | select IRQ_PER_CPU |
18 | select ARCH_HAVE_NMI_SAFE_CMPXCHG | ||
18 | 19 | ||
19 | help | 20 | help |
20 | The PA-RISC microprocessor is designed by Hewlett-Packard and used | 21 | The PA-RISC microprocessor is designed by Hewlett-Packard and used |
diff --git a/arch/parisc/include/asm/atomic.h b/arch/parisc/include/asm/atomic.h index b1dc71f5534e..4054b31e0fa9 100644 --- a/arch/parisc/include/asm/atomic.h +++ b/arch/parisc/include/asm/atomic.h | |||
@@ -258,10 +258,10 @@ static __inline__ int __atomic_add_unless(atomic_t *v, int a, int u) | |||
258 | 258 | ||
259 | #define ATOMIC64_INIT(i) ((atomic64_t) { (i) }) | 259 | #define ATOMIC64_INIT(i) ((atomic64_t) { (i) }) |
260 | 260 | ||
261 | static __inline__ int | 261 | static __inline__ s64 |
262 | __atomic64_add_return(s64 i, atomic64_t *v) | 262 | __atomic64_add_return(s64 i, atomic64_t *v) |
263 | { | 263 | { |
264 | int ret; | 264 | s64 ret; |
265 | unsigned long flags; | 265 | unsigned long flags; |
266 | _atomic_spin_lock_irqsave(v, flags); | 266 | _atomic_spin_lock_irqsave(v, flags); |
267 | 267 | ||
diff --git a/arch/parisc/include/asm/futex.h b/arch/parisc/include/asm/futex.h index 67a33cc27ef2..2388bdb32832 100644 --- a/arch/parisc/include/asm/futex.h +++ b/arch/parisc/include/asm/futex.h | |||
@@ -5,11 +5,14 @@ | |||
5 | 5 | ||
6 | #include <linux/futex.h> | 6 | #include <linux/futex.h> |
7 | #include <linux/uaccess.h> | 7 | #include <linux/uaccess.h> |
8 | #include <asm/atomic.h> | ||
8 | #include <asm/errno.h> | 9 | #include <asm/errno.h> |
9 | 10 | ||
10 | static inline int | 11 | static inline int |
11 | futex_atomic_op_inuser (int encoded_op, u32 __user *uaddr) | 12 | futex_atomic_op_inuser (int encoded_op, u32 __user *uaddr) |
12 | { | 13 | { |
14 | unsigned long int flags; | ||
15 | u32 val; | ||
13 | int op = (encoded_op >> 28) & 7; | 16 | int op = (encoded_op >> 28) & 7; |
14 | int cmp = (encoded_op >> 24) & 15; | 17 | int cmp = (encoded_op >> 24) & 15; |
15 | int oparg = (encoded_op << 8) >> 20; | 18 | int oparg = (encoded_op << 8) >> 20; |
@@ -18,21 +21,58 @@ futex_atomic_op_inuser (int encoded_op, u32 __user *uaddr) | |||
18 | if (encoded_op & (FUTEX_OP_OPARG_SHIFT << 28)) | 21 | if (encoded_op & (FUTEX_OP_OPARG_SHIFT << 28)) |
19 | oparg = 1 << oparg; | 22 | oparg = 1 << oparg; |
20 | 23 | ||
21 | if (! access_ok (VERIFY_WRITE, uaddr, sizeof(u32))) | 24 | if (!access_ok(VERIFY_WRITE, uaddr, sizeof(*uaddr))) |
22 | return -EFAULT; | 25 | return -EFAULT; |
23 | 26 | ||
24 | pagefault_disable(); | 27 | pagefault_disable(); |
25 | 28 | ||
29 | _atomic_spin_lock_irqsave(uaddr, flags); | ||
30 | |||
26 | switch (op) { | 31 | switch (op) { |
27 | case FUTEX_OP_SET: | 32 | case FUTEX_OP_SET: |
33 | /* *(int *)UADDR2 = OPARG; */ | ||
34 | ret = get_user(oldval, uaddr); | ||
35 | if (!ret) | ||
36 | ret = put_user(oparg, uaddr); | ||
37 | break; | ||
28 | case FUTEX_OP_ADD: | 38 | case FUTEX_OP_ADD: |
39 | /* *(int *)UADDR2 += OPARG; */ | ||
40 | ret = get_user(oldval, uaddr); | ||
41 | if (!ret) { | ||
42 | val = oldval + oparg; | ||
43 | ret = put_user(val, uaddr); | ||
44 | } | ||
45 | break; | ||
29 | case FUTEX_OP_OR: | 46 | case FUTEX_OP_OR: |
47 | /* *(int *)UADDR2 |= OPARG; */ | ||
48 | ret = get_user(oldval, uaddr); | ||
49 | if (!ret) { | ||
50 | val = oldval | oparg; | ||
51 | ret = put_user(val, uaddr); | ||
52 | } | ||
53 | break; | ||
30 | case FUTEX_OP_ANDN: | 54 | case FUTEX_OP_ANDN: |
55 | /* *(int *)UADDR2 &= ~OPARG; */ | ||
56 | ret = get_user(oldval, uaddr); | ||
57 | if (!ret) { | ||
58 | val = oldval & ~oparg; | ||
59 | ret = put_user(val, uaddr); | ||
60 | } | ||
61 | break; | ||
31 | case FUTEX_OP_XOR: | 62 | case FUTEX_OP_XOR: |
63 | /* *(int *)UADDR2 ^= OPARG; */ | ||
64 | ret = get_user(oldval, uaddr); | ||
65 | if (!ret) { | ||
66 | val = oldval ^ oparg; | ||
67 | ret = put_user(val, uaddr); | ||
68 | } | ||
69 | break; | ||
32 | default: | 70 | default: |
33 | ret = -ENOSYS; | 71 | ret = -ENOSYS; |
34 | } | 72 | } |
35 | 73 | ||
74 | _atomic_spin_unlock_irqrestore(uaddr, flags); | ||
75 | |||
36 | pagefault_enable(); | 76 | pagefault_enable(); |
37 | 77 | ||
38 | if (!ret) { | 78 | if (!ret) { |
@@ -54,7 +94,9 @@ static inline int | |||
54 | futex_atomic_cmpxchg_inatomic(u32 *uval, u32 __user *uaddr, | 94 | futex_atomic_cmpxchg_inatomic(u32 *uval, u32 __user *uaddr, |
55 | u32 oldval, u32 newval) | 95 | u32 oldval, u32 newval) |
56 | { | 96 | { |
97 | int ret; | ||
57 | u32 val; | 98 | u32 val; |
99 | unsigned long flags; | ||
58 | 100 | ||
59 | /* futex.c wants to do a cmpxchg_inatomic on kernel NULL, which is | 101 | /* futex.c wants to do a cmpxchg_inatomic on kernel NULL, which is |
60 | * our gateway page, and causes no end of trouble... | 102 | * our gateway page, and causes no end of trouble... |
@@ -65,12 +107,24 @@ futex_atomic_cmpxchg_inatomic(u32 *uval, u32 __user *uaddr, | |||
65 | if (!access_ok(VERIFY_WRITE, uaddr, sizeof(u32))) | 107 | if (!access_ok(VERIFY_WRITE, uaddr, sizeof(u32))) |
66 | return -EFAULT; | 108 | return -EFAULT; |
67 | 109 | ||
68 | if (get_user(val, uaddr)) | 110 | /* HPPA has no cmpxchg in hardware and therefore the |
69 | return -EFAULT; | 111 | * best we can do here is use an array of locks. The |
70 | if (val == oldval && put_user(newval, uaddr)) | 112 | * lock selected is based on a hash of the userspace |
71 | return -EFAULT; | 113 | * address. This should scale to a couple of CPUs. |
114 | */ | ||
115 | |||
116 | _atomic_spin_lock_irqsave(uaddr, flags); | ||
117 | |||
118 | ret = get_user(val, uaddr); | ||
119 | |||
120 | if (!ret && val == oldval) | ||
121 | ret = put_user(newval, uaddr); | ||
122 | |||
72 | *uval = val; | 123 | *uval = val; |
73 | return 0; | 124 | |
125 | _atomic_spin_unlock_irqrestore(uaddr, flags); | ||
126 | |||
127 | return ret; | ||
74 | } | 128 | } |
75 | 129 | ||
76 | #endif /*__KERNEL__*/ | 130 | #endif /*__KERNEL__*/ |
diff --git a/arch/parisc/include/asm/unistd.h b/arch/parisc/include/asm/unistd.h index 3392de3e7be0..d61de64f990a 100644 --- a/arch/parisc/include/asm/unistd.h +++ b/arch/parisc/include/asm/unistd.h | |||
@@ -821,8 +821,9 @@ | |||
821 | #define __NR_open_by_handle_at (__NR_Linux + 326) | 821 | #define __NR_open_by_handle_at (__NR_Linux + 326) |
822 | #define __NR_syncfs (__NR_Linux + 327) | 822 | #define __NR_syncfs (__NR_Linux + 327) |
823 | #define __NR_setns (__NR_Linux + 328) | 823 | #define __NR_setns (__NR_Linux + 328) |
824 | #define __NR_sendmmsg (__NR_Linux + 329) | ||
824 | 825 | ||
825 | #define __NR_Linux_syscalls (__NR_setns + 1) | 826 | #define __NR_Linux_syscalls (__NR_sendmmsg + 1) |
826 | 827 | ||
827 | 828 | ||
828 | #define __IGNORE_select /* newselect */ | 829 | #define __IGNORE_select /* newselect */ |
diff --git a/arch/parisc/kernel/syscall_table.S b/arch/parisc/kernel/syscall_table.S index 34a4f5a2fffb..e66366fd2abc 100644 --- a/arch/parisc/kernel/syscall_table.S +++ b/arch/parisc/kernel/syscall_table.S | |||
@@ -427,6 +427,7 @@ | |||
427 | ENTRY_COMP(open_by_handle_at) | 427 | ENTRY_COMP(open_by_handle_at) |
428 | ENTRY_SAME(syncfs) | 428 | ENTRY_SAME(syncfs) |
429 | ENTRY_SAME(setns) | 429 | ENTRY_SAME(setns) |
430 | ENTRY_COMP(sendmmsg) | ||
430 | 431 | ||
431 | /* Nothing yet */ | 432 | /* Nothing yet */ |
432 | 433 | ||
diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig index 374c475e56a3..6926b61acfea 100644 --- a/arch/powerpc/Kconfig +++ b/arch/powerpc/Kconfig | |||
@@ -136,6 +136,7 @@ config PPC | |||
136 | select HAVE_SYSCALL_TRACEPOINTS | 136 | select HAVE_SYSCALL_TRACEPOINTS |
137 | select HAVE_BPF_JIT if (PPC64 && NET) | 137 | select HAVE_BPF_JIT if (PPC64 && NET) |
138 | select HAVE_ARCH_JUMP_LABEL | 138 | select HAVE_ARCH_JUMP_LABEL |
139 | select ARCH_HAVE_NMI_SAFE_CMPXCHG | ||
139 | 140 | ||
140 | config EARLY_PRINTK | 141 | config EARLY_PRINTK |
141 | bool | 142 | bool |
diff --git a/arch/s390/Kconfig b/arch/s390/Kconfig index c03fef7a9c22..ed5cb5af5281 100644 --- a/arch/s390/Kconfig +++ b/arch/s390/Kconfig | |||
@@ -81,6 +81,7 @@ config S390 | |||
81 | select INIT_ALL_POSSIBLE | 81 | select INIT_ALL_POSSIBLE |
82 | select HAVE_IRQ_WORK | 82 | select HAVE_IRQ_WORK |
83 | select HAVE_PERF_EVENTS | 83 | select HAVE_PERF_EVENTS |
84 | select ARCH_HAVE_NMI_SAFE_CMPXCHG | ||
84 | select HAVE_KERNEL_GZIP | 85 | select HAVE_KERNEL_GZIP |
85 | select HAVE_KERNEL_BZIP2 | 86 | select HAVE_KERNEL_BZIP2 |
86 | select HAVE_KERNEL_LZMA | 87 | select HAVE_KERNEL_LZMA |
@@ -273,11 +274,11 @@ config MARCH_Z10 | |||
273 | on older machines. | 274 | on older machines. |
274 | 275 | ||
275 | config MARCH_Z196 | 276 | config MARCH_Z196 |
276 | bool "IBM zEnterprise 196" | 277 | bool "IBM zEnterprise 114 and 196" |
277 | help | 278 | help |
278 | Select this to enable optimizations for IBM zEnterprise 196 | 279 | Select this to enable optimizations for IBM zEnterprise 114 and 196 |
279 | (2817 series). The kernel will be slightly faster but will not work | 280 | (2818 and 2817 series). The kernel will be slightly faster but will |
280 | on older machines. | 281 | not work on older machines. |
281 | 282 | ||
282 | endchoice | 283 | endchoice |
283 | 284 | ||
diff --git a/arch/s390/include/asm/ipl.h b/arch/s390/include/asm/ipl.h index 5e95d95450b3..97cc4403fabf 100644 --- a/arch/s390/include/asm/ipl.h +++ b/arch/s390/include/asm/ipl.h | |||
@@ -167,5 +167,6 @@ enum diag308_rc { | |||
167 | }; | 167 | }; |
168 | 168 | ||
169 | extern int diag308(unsigned long subcode, void *addr); | 169 | extern int diag308(unsigned long subcode, void *addr); |
170 | extern void diag308_reset(void); | ||
170 | 171 | ||
171 | #endif /* _ASM_S390_IPL_H */ | 172 | #endif /* _ASM_S390_IPL_H */ |
diff --git a/arch/s390/include/asm/lowcore.h b/arch/s390/include/asm/lowcore.h index f26280d9e88d..e85c911aabf0 100644 --- a/arch/s390/include/asm/lowcore.h +++ b/arch/s390/include/asm/lowcore.h | |||
@@ -18,6 +18,7 @@ void system_call(void); | |||
18 | void pgm_check_handler(void); | 18 | void pgm_check_handler(void); |
19 | void mcck_int_handler(void); | 19 | void mcck_int_handler(void); |
20 | void io_int_handler(void); | 20 | void io_int_handler(void); |
21 | void psw_restart_int_handler(void); | ||
21 | 22 | ||
22 | #ifdef CONFIG_32BIT | 23 | #ifdef CONFIG_32BIT |
23 | 24 | ||
@@ -150,7 +151,10 @@ struct _lowcore { | |||
150 | */ | 151 | */ |
151 | __u32 ipib; /* 0x0e00 */ | 152 | __u32 ipib; /* 0x0e00 */ |
152 | __u32 ipib_checksum; /* 0x0e04 */ | 153 | __u32 ipib_checksum; /* 0x0e04 */ |
153 | __u8 pad_0x0e08[0x0f00-0x0e08]; /* 0x0e08 */ | 154 | |
155 | /* 64 bit save area */ | ||
156 | __u64 save_area_64; /* 0x0e08 */ | ||
157 | __u8 pad_0x0e10[0x0f00-0x0e10]; /* 0x0e10 */ | ||
154 | 158 | ||
155 | /* Extended facility list */ | 159 | /* Extended facility list */ |
156 | __u64 stfle_fac_list[32]; /* 0x0f00 */ | 160 | __u64 stfle_fac_list[32]; /* 0x0f00 */ |
@@ -286,7 +290,10 @@ struct _lowcore { | |||
286 | */ | 290 | */ |
287 | __u64 ipib; /* 0x0e00 */ | 291 | __u64 ipib; /* 0x0e00 */ |
288 | __u32 ipib_checksum; /* 0x0e08 */ | 292 | __u32 ipib_checksum; /* 0x0e08 */ |
289 | __u8 pad_0x0e0c[0x0f00-0x0e0c]; /* 0x0e0c */ | 293 | |
294 | /* 64 bit save area */ | ||
295 | __u64 save_area_64; /* 0x0e0c */ | ||
296 | __u8 pad_0x0e14[0x0f00-0x0e14]; /* 0x0e14 */ | ||
290 | 297 | ||
291 | /* Extended facility list */ | 298 | /* Extended facility list */ |
292 | __u64 stfle_fac_list[32]; /* 0x0f00 */ | 299 | __u64 stfle_fac_list[32]; /* 0x0f00 */ |
diff --git a/arch/s390/include/asm/processor.h b/arch/s390/include/asm/processor.h index 55dfcc8bdc0d..a4b6229e5d4b 100644 --- a/arch/s390/include/asm/processor.h +++ b/arch/s390/include/asm/processor.h | |||
@@ -119,14 +119,12 @@ struct stack_frame { | |||
119 | * Do necessary setup to start up a new thread. | 119 | * Do necessary setup to start up a new thread. |
120 | */ | 120 | */ |
121 | #define start_thread(regs, new_psw, new_stackp) do { \ | 121 | #define start_thread(regs, new_psw, new_stackp) do { \ |
122 | set_fs(USER_DS); \ | ||
123 | regs->psw.mask = psw_user_bits; \ | 122 | regs->psw.mask = psw_user_bits; \ |
124 | regs->psw.addr = new_psw | PSW_ADDR_AMODE; \ | 123 | regs->psw.addr = new_psw | PSW_ADDR_AMODE; \ |
125 | regs->gprs[15] = new_stackp; \ | 124 | regs->gprs[15] = new_stackp; \ |
126 | } while (0) | 125 | } while (0) |
127 | 126 | ||
128 | #define start_thread31(regs, new_psw, new_stackp) do { \ | 127 | #define start_thread31(regs, new_psw, new_stackp) do { \ |
129 | set_fs(USER_DS); \ | ||
130 | regs->psw.mask = psw_user32_bits; \ | 128 | regs->psw.mask = psw_user32_bits; \ |
131 | regs->psw.addr = new_psw | PSW_ADDR_AMODE; \ | 129 | regs->psw.addr = new_psw | PSW_ADDR_AMODE; \ |
132 | regs->gprs[15] = new_stackp; \ | 130 | regs->gprs[15] = new_stackp; \ |
diff --git a/arch/s390/include/asm/system.h b/arch/s390/include/asm/system.h index d382629a0172..6582f69f2389 100644 --- a/arch/s390/include/asm/system.h +++ b/arch/s390/include/asm/system.h | |||
@@ -113,6 +113,7 @@ extern void pfault_fini(void); | |||
113 | 113 | ||
114 | extern void cmma_init(void); | 114 | extern void cmma_init(void); |
115 | extern int memcpy_real(void *, void *, size_t); | 115 | extern int memcpy_real(void *, void *, size_t); |
116 | extern void copy_to_absolute_zero(void *dest, void *src, size_t count); | ||
116 | 117 | ||
117 | #define finish_arch_switch(prev) do { \ | 118 | #define finish_arch_switch(prev) do { \ |
118 | set_fs(current->thread.mm_segment); \ | 119 | set_fs(current->thread.mm_segment); \ |
diff --git a/arch/s390/kernel/asm-offsets.c b/arch/s390/kernel/asm-offsets.c index 05d8f38734ec..532fd4322156 100644 --- a/arch/s390/kernel/asm-offsets.c +++ b/arch/s390/kernel/asm-offsets.c | |||
@@ -27,12 +27,9 @@ int main(void) | |||
27 | BLANK(); | 27 | BLANK(); |
28 | DEFINE(__TASK_pid, offsetof(struct task_struct, pid)); | 28 | DEFINE(__TASK_pid, offsetof(struct task_struct, pid)); |
29 | BLANK(); | 29 | BLANK(); |
30 | DEFINE(__THREAD_per_cause, | 30 | DEFINE(__THREAD_per_cause, offsetof(struct task_struct, thread.per_event.cause)); |
31 | offsetof(struct task_struct, thread.per_event.cause)); | 31 | DEFINE(__THREAD_per_address, offsetof(struct task_struct, thread.per_event.address)); |
32 | DEFINE(__THREAD_per_address, | 32 | DEFINE(__THREAD_per_paid, offsetof(struct task_struct, thread.per_event.paid)); |
33 | offsetof(struct task_struct, thread.per_event.address)); | ||
34 | DEFINE(__THREAD_per_paid, | ||
35 | offsetof(struct task_struct, thread.per_event.paid)); | ||
36 | BLANK(); | 33 | BLANK(); |
37 | DEFINE(__TI_task, offsetof(struct thread_info, task)); | 34 | DEFINE(__TI_task, offsetof(struct thread_info, task)); |
38 | DEFINE(__TI_domain, offsetof(struct thread_info, exec_domain)); | 35 | DEFINE(__TI_domain, offsetof(struct thread_info, exec_domain)); |
@@ -142,6 +139,7 @@ int main(void) | |||
142 | DEFINE(__LC_FPREGS_SAVE_AREA, offsetof(struct _lowcore, floating_pt_save_area)); | 139 | DEFINE(__LC_FPREGS_SAVE_AREA, offsetof(struct _lowcore, floating_pt_save_area)); |
143 | DEFINE(__LC_GPREGS_SAVE_AREA, offsetof(struct _lowcore, gpregs_save_area)); | 140 | DEFINE(__LC_GPREGS_SAVE_AREA, offsetof(struct _lowcore, gpregs_save_area)); |
144 | DEFINE(__LC_CREGS_SAVE_AREA, offsetof(struct _lowcore, cregs_save_area)); | 141 | DEFINE(__LC_CREGS_SAVE_AREA, offsetof(struct _lowcore, cregs_save_area)); |
142 | DEFINE(__LC_SAVE_AREA_64, offsetof(struct _lowcore, save_area_64)); | ||
145 | #ifdef CONFIG_32BIT | 143 | #ifdef CONFIG_32BIT |
146 | DEFINE(SAVE_AREA_BASE, offsetof(struct _lowcore, extended_save_area_addr)); | 144 | DEFINE(SAVE_AREA_BASE, offsetof(struct _lowcore, extended_save_area_addr)); |
147 | #else /* CONFIG_32BIT */ | 145 | #else /* CONFIG_32BIT */ |
diff --git a/arch/s390/kernel/base.S b/arch/s390/kernel/base.S index 209938c1dfc8..255435663bf8 100644 --- a/arch/s390/kernel/base.S +++ b/arch/s390/kernel/base.S | |||
@@ -76,6 +76,42 @@ s390_base_pgm_handler_fn: | |||
76 | .quad 0 | 76 | .quad 0 |
77 | .previous | 77 | .previous |
78 | 78 | ||
79 | # | ||
80 | # Calls diag 308 subcode 1 and continues execution | ||
81 | # | ||
82 | # The following conditions must be ensured before calling this function: | ||
83 | # * Prefix register = 0 | ||
84 | # * Lowcore protection is disabled | ||
85 | # | ||
86 | ENTRY(diag308_reset) | ||
87 | larl %r4,.Lctlregs # Save control registers | ||
88 | stctg %c0,%c15,0(%r4) | ||
89 | larl %r4,.Lrestart_psw # Setup restart PSW at absolute 0 | ||
90 | lghi %r3,0 | ||
91 | lg %r4,0(%r4) # Save PSW | ||
92 | sturg %r4,%r3 # Use sturg, because of large pages | ||
93 | lghi %r1,1 | ||
94 | diag %r1,%r1,0x308 | ||
95 | .Lrestart_part2: | ||
96 | lhi %r0,0 # Load r0 with zero | ||
97 | lhi %r1,2 # Use mode 2 = ESAME (dump) | ||
98 | sigp %r1,%r0,0x12 # Switch to ESAME mode | ||
99 | sam64 # Switch to 64 bit addressing mode | ||
100 | larl %r4,.Lctlregs # Restore control registers | ||
101 | lctlg %c0,%c15,0(%r4) | ||
102 | br %r14 | ||
103 | .align 16 | ||
104 | .Lrestart_psw: | ||
105 | .long 0x00080000,0x80000000 + .Lrestart_part2 | ||
106 | |||
107 | .section .bss | ||
108 | .align 8 | ||
109 | .Lctlregs: | ||
110 | .rept 16 | ||
111 | .quad 0 | ||
112 | .endr | ||
113 | .previous | ||
114 | |||
79 | #else /* CONFIG_64BIT */ | 115 | #else /* CONFIG_64BIT */ |
80 | 116 | ||
81 | ENTRY(s390_base_mcck_handler) | 117 | ENTRY(s390_base_mcck_handler) |
diff --git a/arch/s390/kernel/compat_signal.c b/arch/s390/kernel/compat_signal.c index eee999853a7c..a9a285b8c4ad 100644 --- a/arch/s390/kernel/compat_signal.c +++ b/arch/s390/kernel/compat_signal.c | |||
@@ -380,20 +380,13 @@ asmlinkage long sys32_sigreturn(void) | |||
380 | goto badframe; | 380 | goto badframe; |
381 | if (__copy_from_user(&set.sig, &frame->sc.oldmask, _SIGMASK_COPY_SIZE32)) | 381 | if (__copy_from_user(&set.sig, &frame->sc.oldmask, _SIGMASK_COPY_SIZE32)) |
382 | goto badframe; | 382 | goto badframe; |
383 | |||
384 | sigdelsetmask(&set, ~_BLOCKABLE); | 383 | sigdelsetmask(&set, ~_BLOCKABLE); |
385 | spin_lock_irq(¤t->sighand->siglock); | 384 | set_current_blocked(&set); |
386 | current->blocked = set; | ||
387 | recalc_sigpending(); | ||
388 | spin_unlock_irq(¤t->sighand->siglock); | ||
389 | |||
390 | if (restore_sigregs32(regs, &frame->sregs)) | 385 | if (restore_sigregs32(regs, &frame->sregs)) |
391 | goto badframe; | 386 | goto badframe; |
392 | if (restore_sigregs_gprs_high(regs, frame->gprs_high)) | 387 | if (restore_sigregs_gprs_high(regs, frame->gprs_high)) |
393 | goto badframe; | 388 | goto badframe; |
394 | |||
395 | return regs->gprs[2]; | 389 | return regs->gprs[2]; |
396 | |||
397 | badframe: | 390 | badframe: |
398 | force_sig(SIGSEGV, current); | 391 | force_sig(SIGSEGV, current); |
399 | return 0; | 392 | return 0; |
@@ -413,31 +406,22 @@ asmlinkage long sys32_rt_sigreturn(void) | |||
413 | goto badframe; | 406 | goto badframe; |
414 | if (__copy_from_user(&set, &frame->uc.uc_sigmask, sizeof(set))) | 407 | if (__copy_from_user(&set, &frame->uc.uc_sigmask, sizeof(set))) |
415 | goto badframe; | 408 | goto badframe; |
416 | |||
417 | sigdelsetmask(&set, ~_BLOCKABLE); | 409 | sigdelsetmask(&set, ~_BLOCKABLE); |
418 | spin_lock_irq(¤t->sighand->siglock); | 410 | set_current_blocked(&set); |
419 | current->blocked = set; | ||
420 | recalc_sigpending(); | ||
421 | spin_unlock_irq(¤t->sighand->siglock); | ||
422 | |||
423 | if (restore_sigregs32(regs, &frame->uc.uc_mcontext)) | 411 | if (restore_sigregs32(regs, &frame->uc.uc_mcontext)) |
424 | goto badframe; | 412 | goto badframe; |
425 | if (restore_sigregs_gprs_high(regs, frame->gprs_high)) | 413 | if (restore_sigregs_gprs_high(regs, frame->gprs_high)) |
426 | goto badframe; | 414 | goto badframe; |
427 | |||
428 | err = __get_user(ss_sp, &frame->uc.uc_stack.ss_sp); | 415 | err = __get_user(ss_sp, &frame->uc.uc_stack.ss_sp); |
429 | st.ss_sp = compat_ptr(ss_sp); | 416 | st.ss_sp = compat_ptr(ss_sp); |
430 | err |= __get_user(st.ss_size, &frame->uc.uc_stack.ss_size); | 417 | err |= __get_user(st.ss_size, &frame->uc.uc_stack.ss_size); |
431 | err |= __get_user(st.ss_flags, &frame->uc.uc_stack.ss_flags); | 418 | err |= __get_user(st.ss_flags, &frame->uc.uc_stack.ss_flags); |
432 | if (err) | 419 | if (err) |
433 | goto badframe; | 420 | goto badframe; |
434 | |||
435 | set_fs (KERNEL_DS); | 421 | set_fs (KERNEL_DS); |
436 | do_sigaltstack((stack_t __force __user *)&st, NULL, regs->gprs[15]); | 422 | do_sigaltstack((stack_t __force __user *)&st, NULL, regs->gprs[15]); |
437 | set_fs (old_fs); | 423 | set_fs (old_fs); |
438 | |||
439 | return regs->gprs[2]; | 424 | return regs->gprs[2]; |
440 | |||
441 | badframe: | 425 | badframe: |
442 | force_sig(SIGSEGV, current); | 426 | force_sig(SIGSEGV, current); |
443 | return 0; | 427 | return 0; |
@@ -605,10 +589,10 @@ give_sigsegv: | |||
605 | * OK, we're invoking a handler | 589 | * OK, we're invoking a handler |
606 | */ | 590 | */ |
607 | 591 | ||
608 | int | 592 | int handle_signal32(unsigned long sig, struct k_sigaction *ka, |
609 | handle_signal32(unsigned long sig, struct k_sigaction *ka, | 593 | siginfo_t *info, sigset_t *oldset, struct pt_regs *regs) |
610 | siginfo_t *info, sigset_t *oldset, struct pt_regs * regs) | ||
611 | { | 594 | { |
595 | sigset_t blocked; | ||
612 | int ret; | 596 | int ret; |
613 | 597 | ||
614 | /* Set up the stack frame */ | 598 | /* Set up the stack frame */ |
@@ -616,15 +600,12 @@ handle_signal32(unsigned long sig, struct k_sigaction *ka, | |||
616 | ret = setup_rt_frame32(sig, ka, info, oldset, regs); | 600 | ret = setup_rt_frame32(sig, ka, info, oldset, regs); |
617 | else | 601 | else |
618 | ret = setup_frame32(sig, ka, oldset, regs); | 602 | ret = setup_frame32(sig, ka, oldset, regs); |
619 | 603 | if (ret) | |
620 | if (ret == 0) { | 604 | return ret; |
621 | spin_lock_irq(¤t->sighand->siglock); | 605 | sigorsets(&blocked, ¤t->blocked, &ka->sa.sa_mask); |
622 | sigorsets(¤t->blocked,¤t->blocked,&ka->sa.sa_mask); | 606 | if (!(ka->sa.sa_flags & SA_NODEFER)) |
623 | if (!(ka->sa.sa_flags & SA_NODEFER)) | 607 | sigaddset(&blocked, sig); |
624 | sigaddset(¤t->blocked,sig); | 608 | set_current_blocked(&blocked); |
625 | recalc_sigpending(); | 609 | return 0; |
626 | spin_unlock_irq(¤t->sighand->siglock); | ||
627 | } | ||
628 | return ret; | ||
629 | } | 610 | } |
630 | 611 | ||
diff --git a/arch/s390/kernel/entry.S b/arch/s390/kernel/entry.S index 3eab7cfab07c..02ec8fe7d03f 100644 --- a/arch/s390/kernel/entry.S +++ b/arch/s390/kernel/entry.S | |||
@@ -849,6 +849,34 @@ restart_crash: | |||
849 | restart_go: | 849 | restart_go: |
850 | #endif | 850 | #endif |
851 | 851 | ||
852 | # | ||
853 | # PSW restart interrupt handler | ||
854 | # | ||
855 | ENTRY(psw_restart_int_handler) | ||
856 | st %r15,__LC_SAVE_AREA_64(%r0) # save r15 | ||
857 | basr %r15,0 | ||
858 | 0: l %r15,.Lrestart_stack-0b(%r15) # load restart stack | ||
859 | l %r15,0(%r15) | ||
860 | ahi %r15,-SP_SIZE # make room for pt_regs | ||
861 | stm %r0,%r14,SP_R0(%r15) # store gprs %r0-%r14 to stack | ||
862 | mvc SP_R15(4,%r15),__LC_SAVE_AREA_64(%r0)# store saved %r15 to stack | ||
863 | mvc SP_PSW(8,%r15),__LC_RST_OLD_PSW(%r0) # store restart old psw | ||
864 | xc __SF_BACKCHAIN(4,%r15),__SF_BACKCHAIN(%r15) # set backchain to 0 | ||
865 | basr %r14,0 | ||
866 | 1: l %r14,.Ldo_restart-1b(%r14) | ||
867 | basr %r14,%r14 | ||
868 | |||
869 | basr %r14,0 # load disabled wait PSW if | ||
870 | 2: lpsw restart_psw_crash-2b(%r14) # do_restart returns | ||
871 | .align 4 | ||
872 | .Ldo_restart: | ||
873 | .long do_restart | ||
874 | .Lrestart_stack: | ||
875 | .long restart_stack | ||
876 | .align 8 | ||
877 | restart_psw_crash: | ||
878 | .long 0x000a0000,0x00000000 + restart_psw_crash | ||
879 | |||
852 | .section .kprobes.text, "ax" | 880 | .section .kprobes.text, "ax" |
853 | 881 | ||
854 | #ifdef CONFIG_CHECK_STACK | 882 | #ifdef CONFIG_CHECK_STACK |
diff --git a/arch/s390/kernel/entry64.S b/arch/s390/kernel/entry64.S index 7a0fd426ca92..5f729d627cef 100644 --- a/arch/s390/kernel/entry64.S +++ b/arch/s390/kernel/entry64.S | |||
@@ -865,6 +865,26 @@ restart_crash: | |||
865 | restart_go: | 865 | restart_go: |
866 | #endif | 866 | #endif |
867 | 867 | ||
868 | # | ||
869 | # PSW restart interrupt handler | ||
870 | # | ||
871 | ENTRY(psw_restart_int_handler) | ||
872 | stg %r15,__LC_SAVE_AREA_64(%r0) # save r15 | ||
873 | larl %r15,restart_stack # load restart stack | ||
874 | lg %r15,0(%r15) | ||
875 | aghi %r15,-SP_SIZE # make room for pt_regs | ||
876 | stmg %r0,%r14,SP_R0(%r15) # store gprs %r0-%r14 to stack | ||
877 | mvc SP_R15(8,%r15),__LC_SAVE_AREA_64(%r0)# store saved %r15 to stack | ||
878 | mvc SP_PSW(16,%r15),__LC_RST_OLD_PSW(%r0)# store restart old psw | ||
879 | xc __SF_BACKCHAIN(8,%r15),__SF_BACKCHAIN(%r15) # set backchain to 0 | ||
880 | brasl %r14,do_restart | ||
881 | |||
882 | larl %r14,restart_psw_crash # load disabled wait PSW if | ||
883 | lpswe 0(%r14) # do_restart returns | ||
884 | .align 8 | ||
885 | restart_psw_crash: | ||
886 | .quad 0x0002000080000000,0x0000000000000000 + restart_psw_crash | ||
887 | |||
868 | .section .kprobes.text, "ax" | 888 | .section .kprobes.text, "ax" |
869 | 889 | ||
870 | #ifdef CONFIG_CHECK_STACK | 890 | #ifdef CONFIG_CHECK_STACK |
diff --git a/arch/s390/kernel/ipl.c b/arch/s390/kernel/ipl.c index a689070be287..04361d5a4279 100644 --- a/arch/s390/kernel/ipl.c +++ b/arch/s390/kernel/ipl.c | |||
@@ -45,11 +45,13 @@ | |||
45 | * - halt | 45 | * - halt |
46 | * - power off | 46 | * - power off |
47 | * - reipl | 47 | * - reipl |
48 | * - restart | ||
48 | */ | 49 | */ |
49 | #define ON_PANIC_STR "on_panic" | 50 | #define ON_PANIC_STR "on_panic" |
50 | #define ON_HALT_STR "on_halt" | 51 | #define ON_HALT_STR "on_halt" |
51 | #define ON_POFF_STR "on_poff" | 52 | #define ON_POFF_STR "on_poff" |
52 | #define ON_REIPL_STR "on_reboot" | 53 | #define ON_REIPL_STR "on_reboot" |
54 | #define ON_RESTART_STR "on_restart" | ||
53 | 55 | ||
54 | struct shutdown_action; | 56 | struct shutdown_action; |
55 | struct shutdown_trigger { | 57 | struct shutdown_trigger { |
@@ -1544,17 +1546,20 @@ static char vmcmd_on_reboot[128]; | |||
1544 | static char vmcmd_on_panic[128]; | 1546 | static char vmcmd_on_panic[128]; |
1545 | static char vmcmd_on_halt[128]; | 1547 | static char vmcmd_on_halt[128]; |
1546 | static char vmcmd_on_poff[128]; | 1548 | static char vmcmd_on_poff[128]; |
1549 | static char vmcmd_on_restart[128]; | ||
1547 | 1550 | ||
1548 | DEFINE_IPL_ATTR_STR_RW(vmcmd, on_reboot, "%s\n", "%s\n", vmcmd_on_reboot); | 1551 | DEFINE_IPL_ATTR_STR_RW(vmcmd, on_reboot, "%s\n", "%s\n", vmcmd_on_reboot); |
1549 | DEFINE_IPL_ATTR_STR_RW(vmcmd, on_panic, "%s\n", "%s\n", vmcmd_on_panic); | 1552 | DEFINE_IPL_ATTR_STR_RW(vmcmd, on_panic, "%s\n", "%s\n", vmcmd_on_panic); |
1550 | DEFINE_IPL_ATTR_STR_RW(vmcmd, on_halt, "%s\n", "%s\n", vmcmd_on_halt); | 1553 | DEFINE_IPL_ATTR_STR_RW(vmcmd, on_halt, "%s\n", "%s\n", vmcmd_on_halt); |
1551 | DEFINE_IPL_ATTR_STR_RW(vmcmd, on_poff, "%s\n", "%s\n", vmcmd_on_poff); | 1554 | DEFINE_IPL_ATTR_STR_RW(vmcmd, on_poff, "%s\n", "%s\n", vmcmd_on_poff); |
1555 | DEFINE_IPL_ATTR_STR_RW(vmcmd, on_restart, "%s\n", "%s\n", vmcmd_on_restart); | ||
1552 | 1556 | ||
1553 | static struct attribute *vmcmd_attrs[] = { | 1557 | static struct attribute *vmcmd_attrs[] = { |
1554 | &sys_vmcmd_on_reboot_attr.attr, | 1558 | &sys_vmcmd_on_reboot_attr.attr, |
1555 | &sys_vmcmd_on_panic_attr.attr, | 1559 | &sys_vmcmd_on_panic_attr.attr, |
1556 | &sys_vmcmd_on_halt_attr.attr, | 1560 | &sys_vmcmd_on_halt_attr.attr, |
1557 | &sys_vmcmd_on_poff_attr.attr, | 1561 | &sys_vmcmd_on_poff_attr.attr, |
1562 | &sys_vmcmd_on_restart_attr.attr, | ||
1558 | NULL, | 1563 | NULL, |
1559 | }; | 1564 | }; |
1560 | 1565 | ||
@@ -1576,6 +1581,8 @@ static void vmcmd_run(struct shutdown_trigger *trigger) | |||
1576 | cmd = vmcmd_on_halt; | 1581 | cmd = vmcmd_on_halt; |
1577 | else if (strcmp(trigger->name, ON_POFF_STR) == 0) | 1582 | else if (strcmp(trigger->name, ON_POFF_STR) == 0) |
1578 | cmd = vmcmd_on_poff; | 1583 | cmd = vmcmd_on_poff; |
1584 | else if (strcmp(trigger->name, ON_RESTART_STR) == 0) | ||
1585 | cmd = vmcmd_on_restart; | ||
1579 | else | 1586 | else |
1580 | return; | 1587 | return; |
1581 | 1588 | ||
@@ -1707,6 +1714,34 @@ static void do_panic(void) | |||
1707 | stop_run(&on_panic_trigger); | 1714 | stop_run(&on_panic_trigger); |
1708 | } | 1715 | } |
1709 | 1716 | ||
1717 | /* on restart */ | ||
1718 | |||
1719 | static struct shutdown_trigger on_restart_trigger = {ON_RESTART_STR, | ||
1720 | &reipl_action}; | ||
1721 | |||
1722 | static ssize_t on_restart_show(struct kobject *kobj, | ||
1723 | struct kobj_attribute *attr, char *page) | ||
1724 | { | ||
1725 | return sprintf(page, "%s\n", on_restart_trigger.action->name); | ||
1726 | } | ||
1727 | |||
1728 | static ssize_t on_restart_store(struct kobject *kobj, | ||
1729 | struct kobj_attribute *attr, | ||
1730 | const char *buf, size_t len) | ||
1731 | { | ||
1732 | return set_trigger(buf, &on_restart_trigger, len); | ||
1733 | } | ||
1734 | |||
1735 | static struct kobj_attribute on_restart_attr = | ||
1736 | __ATTR(on_restart, 0644, on_restart_show, on_restart_store); | ||
1737 | |||
1738 | void do_restart(void) | ||
1739 | { | ||
1740 | smp_send_stop(); | ||
1741 | on_restart_trigger.action->fn(&on_restart_trigger); | ||
1742 | stop_run(&on_restart_trigger); | ||
1743 | } | ||
1744 | |||
1710 | /* on halt */ | 1745 | /* on halt */ |
1711 | 1746 | ||
1712 | static struct shutdown_trigger on_halt_trigger = {ON_HALT_STR, &stop_action}; | 1747 | static struct shutdown_trigger on_halt_trigger = {ON_HALT_STR, &stop_action}; |
@@ -1783,7 +1818,9 @@ static void __init shutdown_triggers_init(void) | |||
1783 | if (sysfs_create_file(&shutdown_actions_kset->kobj, | 1818 | if (sysfs_create_file(&shutdown_actions_kset->kobj, |
1784 | &on_poff_attr.attr)) | 1819 | &on_poff_attr.attr)) |
1785 | goto fail; | 1820 | goto fail; |
1786 | 1821 | if (sysfs_create_file(&shutdown_actions_kset->kobj, | |
1822 | &on_restart_attr.attr)) | ||
1823 | goto fail; | ||
1787 | return; | 1824 | return; |
1788 | fail: | 1825 | fail: |
1789 | panic("shutdown_triggers_init failed\n"); | 1826 | panic("shutdown_triggers_init failed\n"); |
@@ -1959,6 +1996,12 @@ static void do_reset_calls(void) | |||
1959 | { | 1996 | { |
1960 | struct reset_call *reset; | 1997 | struct reset_call *reset; |
1961 | 1998 | ||
1999 | #ifdef CONFIG_64BIT | ||
2000 | if (diag308_set_works) { | ||
2001 | diag308_reset(); | ||
2002 | return; | ||
2003 | } | ||
2004 | #endif | ||
1962 | list_for_each_entry(reset, &rcall, list) | 2005 | list_for_each_entry(reset, &rcall, list) |
1963 | reset->fn(); | 2006 | reset->fn(); |
1964 | } | 2007 | } |
diff --git a/arch/s390/kernel/reipl64.S b/arch/s390/kernel/reipl64.S index 78eb7cfbd3d1..e690975403f4 100644 --- a/arch/s390/kernel/reipl64.S +++ b/arch/s390/kernel/reipl64.S | |||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright IBM Corp 2000,2009 | 2 | * Copyright IBM Corp 2000,2011 |
3 | * Author(s): Holger Smolinski <Holger.Smolinski@de.ibm.com>, | 3 | * Author(s): Holger Smolinski <Holger.Smolinski@de.ibm.com>, |
4 | * Denis Joseph Barrow, | 4 | * Denis Joseph Barrow, |
5 | */ | 5 | */ |
@@ -8,6 +8,64 @@ | |||
8 | #include <asm/asm-offsets.h> | 8 | #include <asm/asm-offsets.h> |
9 | 9 | ||
10 | # | 10 | # |
11 | # store_status | ||
12 | # | ||
13 | # Prerequisites to run this function: | ||
14 | # - Prefix register is set to zero | ||
15 | # - Original prefix register is stored in "dump_prefix_page" | ||
16 | # - Lowcore protection is off | ||
17 | # | ||
18 | ENTRY(store_status) | ||
19 | /* Save register one and load save area base */ | ||
20 | stg %r1,__LC_SAVE_AREA_64(%r0) | ||
21 | lghi %r1,SAVE_AREA_BASE | ||
22 | /* General purpose registers */ | ||
23 | stmg %r0,%r15,__LC_GPREGS_SAVE_AREA-SAVE_AREA_BASE(%r1) | ||
24 | lg %r2,__LC_SAVE_AREA_64(%r0) | ||
25 | stg %r2,__LC_GPREGS_SAVE_AREA-SAVE_AREA_BASE+8(%r1) | ||
26 | /* Control registers */ | ||
27 | stctg %c0,%c15,__LC_CREGS_SAVE_AREA-SAVE_AREA_BASE(%r1) | ||
28 | /* Access registers */ | ||
29 | stam %a0,%a15,__LC_AREGS_SAVE_AREA-SAVE_AREA_BASE(%r1) | ||
30 | /* Floating point registers */ | ||
31 | std %f0, 0x00 + __LC_FPREGS_SAVE_AREA-SAVE_AREA_BASE(%r1) | ||
32 | std %f1, 0x08 + __LC_FPREGS_SAVE_AREA-SAVE_AREA_BASE(%r1) | ||
33 | std %f2, 0x10 + __LC_FPREGS_SAVE_AREA-SAVE_AREA_BASE(%r1) | ||
34 | std %f3, 0x18 + __LC_FPREGS_SAVE_AREA-SAVE_AREA_BASE(%r1) | ||
35 | std %f4, 0x20 + __LC_FPREGS_SAVE_AREA-SAVE_AREA_BASE(%r1) | ||
36 | std %f5, 0x28 + __LC_FPREGS_SAVE_AREA-SAVE_AREA_BASE(%r1) | ||
37 | std %f6, 0x30 + __LC_FPREGS_SAVE_AREA-SAVE_AREA_BASE(%r1) | ||
38 | std %f7, 0x38 + __LC_FPREGS_SAVE_AREA-SAVE_AREA_BASE(%r1) | ||
39 | std %f8, 0x40 + __LC_FPREGS_SAVE_AREA-SAVE_AREA_BASE(%r1) | ||
40 | std %f9, 0x48 + __LC_FPREGS_SAVE_AREA-SAVE_AREA_BASE(%r1) | ||
41 | std %f10,0x50 + __LC_FPREGS_SAVE_AREA-SAVE_AREA_BASE(%r1) | ||
42 | std %f11,0x58 + __LC_FPREGS_SAVE_AREA-SAVE_AREA_BASE(%r1) | ||
43 | std %f12,0x60 + __LC_FPREGS_SAVE_AREA-SAVE_AREA_BASE(%r1) | ||
44 | std %f13,0x68 + __LC_FPREGS_SAVE_AREA-SAVE_AREA_BASE(%r1) | ||
45 | std %f14,0x70 + __LC_FPREGS_SAVE_AREA-SAVE_AREA_BASE(%r1) | ||
46 | std %f15,0x78 + __LC_FPREGS_SAVE_AREA-SAVE_AREA_BASE(%r1) | ||
47 | /* Floating point control register */ | ||
48 | stfpc __LC_FP_CREG_SAVE_AREA-SAVE_AREA_BASE(%r1) | ||
49 | /* CPU timer */ | ||
50 | stpt __LC_CPU_TIMER_SAVE_AREA-SAVE_AREA_BASE(%r1) | ||
51 | /* Saved prefix register */ | ||
52 | larl %r2,dump_prefix_page | ||
53 | mvc __LC_PREFIX_SAVE_AREA-SAVE_AREA_BASE(4,%r1),0(%r2) | ||
54 | /* Clock comparator - seven bytes */ | ||
55 | larl %r2,.Lclkcmp | ||
56 | stckc 0(%r2) | ||
57 | mvc __LC_CLOCK_COMP_SAVE_AREA-SAVE_AREA_BASE + 1(7,%r1),1(%r2) | ||
58 | /* Program status word */ | ||
59 | epsw %r2,%r3 | ||
60 | st %r2,__LC_PSW_SAVE_AREA-SAVE_AREA_BASE + 0(%r1) | ||
61 | st %r3,__LC_PSW_SAVE_AREA-SAVE_AREA_BASE + 4(%r1) | ||
62 | larl %r2,store_status | ||
63 | stg %r2,__LC_PSW_SAVE_AREA-SAVE_AREA_BASE + 8(%r1) | ||
64 | br %r14 | ||
65 | .align 8 | ||
66 | .Lclkcmp: .quad 0x0000000000000000 | ||
67 | |||
68 | # | ||
11 | # do_reipl_asm | 69 | # do_reipl_asm |
12 | # Parameter: r2 = schid of reipl device | 70 | # Parameter: r2 = schid of reipl device |
13 | # | 71 | # |
@@ -15,22 +73,7 @@ | |||
15 | ENTRY(do_reipl_asm) | 73 | ENTRY(do_reipl_asm) |
16 | basr %r13,0 | 74 | basr %r13,0 |
17 | .Lpg0: lpswe .Lnewpsw-.Lpg0(%r13) | 75 | .Lpg0: lpswe .Lnewpsw-.Lpg0(%r13) |
18 | .Lpg1: # do store status of all registers | 76 | .Lpg1: brasl %r14,store_status |
19 | |||
20 | stg %r1,.Lregsave-.Lpg0(%r13) | ||
21 | lghi %r1,0x1000 | ||
22 | stmg %r0,%r15,__LC_GPREGS_SAVE_AREA-0x1000(%r1) | ||
23 | lg %r0,.Lregsave-.Lpg0(%r13) | ||
24 | stg %r0,__LC_GPREGS_SAVE_AREA-0x1000+8(%r1) | ||
25 | stctg %c0,%c15,__LC_CREGS_SAVE_AREA-0x1000(%r1) | ||
26 | stam %a0,%a15,__LC_AREGS_SAVE_AREA-0x1000(%r1) | ||
27 | lg %r10,.Ldump_pfx-.Lpg0(%r13) | ||
28 | mvc __LC_PREFIX_SAVE_AREA-0x1000(4,%r1),0(%r10) | ||
29 | stfpc __LC_FP_CREG_SAVE_AREA-0x1000(%r1) | ||
30 | stckc .Lclkcmp-.Lpg0(%r13) | ||
31 | mvc __LC_CLOCK_COMP_SAVE_AREA-0x1000(7,%r1),.Lclkcmp-.Lpg0(%r13) | ||
32 | stpt __LC_CPU_TIMER_SAVE_AREA-0x1000(%r1) | ||
33 | stg %r13, __LC_PSW_SAVE_AREA-0x1000+8(%r1) | ||
34 | 77 | ||
35 | lctlg %c6,%c6,.Lall-.Lpg0(%r13) | 78 | lctlg %c6,%c6,.Lall-.Lpg0(%r13) |
36 | lgr %r1,%r2 | 79 | lgr %r1,%r2 |
@@ -67,10 +110,7 @@ ENTRY(do_reipl_asm) | |||
67 | st %r14,.Ldispsw+12-.Lpg0(%r13) | 110 | st %r14,.Ldispsw+12-.Lpg0(%r13) |
68 | lpswe .Ldispsw-.Lpg0(%r13) | 111 | lpswe .Ldispsw-.Lpg0(%r13) |
69 | .align 8 | 112 | .align 8 |
70 | .Lclkcmp: .quad 0x0000000000000000 | ||
71 | .Lall: .quad 0x00000000ff000000 | 113 | .Lall: .quad 0x00000000ff000000 |
72 | .Ldump_pfx: .quad dump_prefix_page | ||
73 | .Lregsave: .quad 0x0000000000000000 | ||
74 | .align 16 | 114 | .align 16 |
75 | /* | 115 | /* |
76 | * These addresses have to be 31 bit otherwise | 116 | * These addresses have to be 31 bit otherwise |
diff --git a/arch/s390/kernel/setup.c b/arch/s390/kernel/setup.c index 0c35dee10b00..7b371c37061d 100644 --- a/arch/s390/kernel/setup.c +++ b/arch/s390/kernel/setup.c | |||
@@ -346,7 +346,7 @@ setup_lowcore(void) | |||
346 | lc = __alloc_bootmem_low(LC_PAGES * PAGE_SIZE, LC_PAGES * PAGE_SIZE, 0); | 346 | lc = __alloc_bootmem_low(LC_PAGES * PAGE_SIZE, LC_PAGES * PAGE_SIZE, 0); |
347 | lc->restart_psw.mask = PSW_BASE_BITS | PSW_DEFAULT_KEY; | 347 | lc->restart_psw.mask = PSW_BASE_BITS | PSW_DEFAULT_KEY; |
348 | lc->restart_psw.addr = | 348 | lc->restart_psw.addr = |
349 | PSW_ADDR_AMODE | (unsigned long) restart_int_handler; | 349 | PSW_ADDR_AMODE | (unsigned long) psw_restart_int_handler; |
350 | if (user_mode != HOME_SPACE_MODE) | 350 | if (user_mode != HOME_SPACE_MODE) |
351 | lc->restart_psw.mask |= PSW_ASC_HOME; | 351 | lc->restart_psw.mask |= PSW_ASC_HOME; |
352 | lc->external_new_psw.mask = psw_kernel_bits; | 352 | lc->external_new_psw.mask = psw_kernel_bits; |
@@ -529,6 +529,27 @@ static void __init setup_memory_end(void) | |||
529 | memory_end = memory_size; | 529 | memory_end = memory_size; |
530 | } | 530 | } |
531 | 531 | ||
532 | void *restart_stack __attribute__((__section__(".data"))); | ||
533 | |||
534 | /* | ||
535 | * Setup new PSW and allocate stack for PSW restart interrupt | ||
536 | */ | ||
537 | static void __init setup_restart_psw(void) | ||
538 | { | ||
539 | psw_t psw; | ||
540 | |||
541 | restart_stack = __alloc_bootmem(ASYNC_SIZE, ASYNC_SIZE, 0); | ||
542 | restart_stack += ASYNC_SIZE; | ||
543 | |||
544 | /* | ||
545 | * Setup restart PSW for absolute zero lowcore. This is necesary | ||
546 | * if PSW restart is done on an offline CPU that has lowcore zero | ||
547 | */ | ||
548 | psw.mask = PSW_BASE_BITS | PSW_DEFAULT_KEY; | ||
549 | psw.addr = PSW_ADDR_AMODE | (unsigned long) psw_restart_int_handler; | ||
550 | copy_to_absolute_zero(&S390_lowcore.restart_psw, &psw, sizeof(psw)); | ||
551 | } | ||
552 | |||
532 | static void __init | 553 | static void __init |
533 | setup_memory(void) | 554 | setup_memory(void) |
534 | { | 555 | { |
@@ -731,6 +752,7 @@ static void __init setup_hwcaps(void) | |||
731 | strcpy(elf_platform, "z10"); | 752 | strcpy(elf_platform, "z10"); |
732 | break; | 753 | break; |
733 | case 0x2817: | 754 | case 0x2817: |
755 | case 0x2818: | ||
734 | strcpy(elf_platform, "z196"); | 756 | strcpy(elf_platform, "z196"); |
735 | break; | 757 | break; |
736 | } | 758 | } |
@@ -792,6 +814,7 @@ setup_arch(char **cmdline_p) | |||
792 | setup_addressing_mode(); | 814 | setup_addressing_mode(); |
793 | setup_memory(); | 815 | setup_memory(); |
794 | setup_resources(); | 816 | setup_resources(); |
817 | setup_restart_psw(); | ||
795 | setup_lowcore(); | 818 | setup_lowcore(); |
796 | 819 | ||
797 | cpu_init(); | 820 | cpu_init(); |
diff --git a/arch/s390/kernel/signal.c b/arch/s390/kernel/signal.c index abbb3c3c7aab..9a40e1cc5ec3 100644 --- a/arch/s390/kernel/signal.c +++ b/arch/s390/kernel/signal.c | |||
@@ -57,17 +57,15 @@ typedef struct | |||
57 | */ | 57 | */ |
58 | SYSCALL_DEFINE3(sigsuspend, int, history0, int, history1, old_sigset_t, mask) | 58 | SYSCALL_DEFINE3(sigsuspend, int, history0, int, history1, old_sigset_t, mask) |
59 | { | 59 | { |
60 | mask &= _BLOCKABLE; | 60 | sigset_t blocked; |
61 | spin_lock_irq(¤t->sighand->siglock); | ||
62 | current->saved_sigmask = current->blocked; | ||
63 | siginitset(¤t->blocked, mask); | ||
64 | recalc_sigpending(); | ||
65 | spin_unlock_irq(¤t->sighand->siglock); | ||
66 | 61 | ||
62 | current->saved_sigmask = current->blocked; | ||
63 | mask &= _BLOCKABLE; | ||
64 | siginitset(&blocked, mask); | ||
65 | set_current_blocked(&blocked); | ||
67 | set_current_state(TASK_INTERRUPTIBLE); | 66 | set_current_state(TASK_INTERRUPTIBLE); |
68 | schedule(); | 67 | schedule(); |
69 | set_thread_flag(TIF_RESTORE_SIGMASK); | 68 | set_restore_sigmask(); |
70 | |||
71 | return -ERESTARTNOHAND; | 69 | return -ERESTARTNOHAND; |
72 | } | 70 | } |
73 | 71 | ||
@@ -172,18 +170,11 @@ SYSCALL_DEFINE0(sigreturn) | |||
172 | goto badframe; | 170 | goto badframe; |
173 | if (__copy_from_user(&set.sig, &frame->sc.oldmask, _SIGMASK_COPY_SIZE)) | 171 | if (__copy_from_user(&set.sig, &frame->sc.oldmask, _SIGMASK_COPY_SIZE)) |
174 | goto badframe; | 172 | goto badframe; |
175 | |||
176 | sigdelsetmask(&set, ~_BLOCKABLE); | 173 | sigdelsetmask(&set, ~_BLOCKABLE); |
177 | spin_lock_irq(¤t->sighand->siglock); | 174 | set_current_blocked(&set); |
178 | current->blocked = set; | ||
179 | recalc_sigpending(); | ||
180 | spin_unlock_irq(¤t->sighand->siglock); | ||
181 | |||
182 | if (restore_sigregs(regs, &frame->sregs)) | 175 | if (restore_sigregs(regs, &frame->sregs)) |
183 | goto badframe; | 176 | goto badframe; |
184 | |||
185 | return regs->gprs[2]; | 177 | return regs->gprs[2]; |
186 | |||
187 | badframe: | 178 | badframe: |
188 | force_sig(SIGSEGV, current); | 179 | force_sig(SIGSEGV, current); |
189 | return 0; | 180 | return 0; |
@@ -199,21 +190,14 @@ SYSCALL_DEFINE0(rt_sigreturn) | |||
199 | goto badframe; | 190 | goto badframe; |
200 | if (__copy_from_user(&set.sig, &frame->uc.uc_sigmask, sizeof(set))) | 191 | if (__copy_from_user(&set.sig, &frame->uc.uc_sigmask, sizeof(set))) |
201 | goto badframe; | 192 | goto badframe; |
202 | |||
203 | sigdelsetmask(&set, ~_BLOCKABLE); | 193 | sigdelsetmask(&set, ~_BLOCKABLE); |
204 | spin_lock_irq(¤t->sighand->siglock); | 194 | set_current_blocked(&set); |
205 | current->blocked = set; | ||
206 | recalc_sigpending(); | ||
207 | spin_unlock_irq(¤t->sighand->siglock); | ||
208 | |||
209 | if (restore_sigregs(regs, &frame->uc.uc_mcontext)) | 195 | if (restore_sigregs(regs, &frame->uc.uc_mcontext)) |
210 | goto badframe; | 196 | goto badframe; |
211 | |||
212 | if (do_sigaltstack(&frame->uc.uc_stack, NULL, | 197 | if (do_sigaltstack(&frame->uc.uc_stack, NULL, |
213 | regs->gprs[15]) == -EFAULT) | 198 | regs->gprs[15]) == -EFAULT) |
214 | goto badframe; | 199 | goto badframe; |
215 | return regs->gprs[2]; | 200 | return regs->gprs[2]; |
216 | |||
217 | badframe: | 201 | badframe: |
218 | force_sig(SIGSEGV, current); | 202 | force_sig(SIGSEGV, current); |
219 | return 0; | 203 | return 0; |
@@ -385,14 +369,11 @@ give_sigsegv: | |||
385 | return -EFAULT; | 369 | return -EFAULT; |
386 | } | 370 | } |
387 | 371 | ||
388 | /* | 372 | static int handle_signal(unsigned long sig, struct k_sigaction *ka, |
389 | * OK, we're invoking a handler | 373 | siginfo_t *info, sigset_t *oldset, |
390 | */ | 374 | struct pt_regs *regs) |
391 | |||
392 | static int | ||
393 | handle_signal(unsigned long sig, struct k_sigaction *ka, | ||
394 | siginfo_t *info, sigset_t *oldset, struct pt_regs * regs) | ||
395 | { | 375 | { |
376 | sigset_t blocked; | ||
396 | int ret; | 377 | int ret; |
397 | 378 | ||
398 | /* Set up the stack frame */ | 379 | /* Set up the stack frame */ |
@@ -400,17 +381,13 @@ handle_signal(unsigned long sig, struct k_sigaction *ka, | |||
400 | ret = setup_rt_frame(sig, ka, info, oldset, regs); | 381 | ret = setup_rt_frame(sig, ka, info, oldset, regs); |
401 | else | 382 | else |
402 | ret = setup_frame(sig, ka, oldset, regs); | 383 | ret = setup_frame(sig, ka, oldset, regs); |
403 | 384 | if (ret) | |
404 | if (ret == 0) { | 385 | return ret; |
405 | spin_lock_irq(¤t->sighand->siglock); | 386 | sigorsets(&blocked, ¤t->blocked, &ka->sa.sa_mask); |
406 | sigorsets(¤t->blocked,¤t->blocked,&ka->sa.sa_mask); | 387 | if (!(ka->sa.sa_flags & SA_NODEFER)) |
407 | if (!(ka->sa.sa_flags & SA_NODEFER)) | 388 | sigaddset(&blocked, sig); |
408 | sigaddset(¤t->blocked,sig); | 389 | set_current_blocked(&blocked); |
409 | recalc_sigpending(); | 390 | return 0; |
410 | spin_unlock_irq(¤t->sighand->siglock); | ||
411 | } | ||
412 | |||
413 | return ret; | ||
414 | } | 391 | } |
415 | 392 | ||
416 | /* | 393 | /* |
diff --git a/arch/s390/kernel/smp.c b/arch/s390/kernel/smp.c index a6d85c0a7f20..6ab16ac64d29 100644 --- a/arch/s390/kernel/smp.c +++ b/arch/s390/kernel/smp.c | |||
@@ -452,23 +452,27 @@ out: | |||
452 | */ | 452 | */ |
453 | int __cpuinit start_secondary(void *cpuvoid) | 453 | int __cpuinit start_secondary(void *cpuvoid) |
454 | { | 454 | { |
455 | /* Setup the cpu */ | ||
456 | cpu_init(); | 455 | cpu_init(); |
457 | preempt_disable(); | 456 | preempt_disable(); |
458 | /* Enable TOD clock interrupts on the secondary cpu. */ | ||
459 | init_cpu_timer(); | 457 | init_cpu_timer(); |
460 | /* Enable cpu timer interrupts on the secondary cpu. */ | ||
461 | init_cpu_vtimer(); | 458 | init_cpu_vtimer(); |
462 | /* Enable pfault pseudo page faults on this cpu. */ | ||
463 | pfault_init(); | 459 | pfault_init(); |
464 | 460 | ||
465 | /* call cpu notifiers */ | ||
466 | notify_cpu_starting(smp_processor_id()); | 461 | notify_cpu_starting(smp_processor_id()); |
467 | /* Mark this cpu as online */ | ||
468 | ipi_call_lock(); | 462 | ipi_call_lock(); |
469 | set_cpu_online(smp_processor_id(), true); | 463 | set_cpu_online(smp_processor_id(), true); |
470 | ipi_call_unlock(); | 464 | ipi_call_unlock(); |
471 | /* Switch on interrupts */ | 465 | __ctl_clear_bit(0, 28); /* Disable lowcore protection */ |
466 | S390_lowcore.restart_psw.mask = PSW_BASE_BITS | PSW_DEFAULT_KEY; | ||
467 | S390_lowcore.restart_psw.addr = | ||
468 | PSW_ADDR_AMODE | (unsigned long) psw_restart_int_handler; | ||
469 | __ctl_set_bit(0, 28); /* Enable lowcore protection */ | ||
470 | /* | ||
471 | * Wait until the cpu which brought this one up marked it | ||
472 | * active before enabling interrupts. | ||
473 | */ | ||
474 | while (!cpumask_test_cpu(smp_processor_id(), cpu_active_mask)) | ||
475 | cpu_relax(); | ||
472 | local_irq_enable(); | 476 | local_irq_enable(); |
473 | /* cpu_idle will call schedule for us */ | 477 | /* cpu_idle will call schedule for us */ |
474 | cpu_idle(); | 478 | cpu_idle(); |
@@ -507,7 +511,11 @@ static int __cpuinit smp_alloc_lowcore(int cpu) | |||
507 | memset((char *)lowcore + 512, 0, sizeof(*lowcore) - 512); | 511 | memset((char *)lowcore + 512, 0, sizeof(*lowcore) - 512); |
508 | lowcore->async_stack = async_stack + ASYNC_SIZE; | 512 | lowcore->async_stack = async_stack + ASYNC_SIZE; |
509 | lowcore->panic_stack = panic_stack + PAGE_SIZE; | 513 | lowcore->panic_stack = panic_stack + PAGE_SIZE; |
510 | 514 | lowcore->restart_psw.mask = PSW_BASE_BITS | PSW_DEFAULT_KEY; | |
515 | lowcore->restart_psw.addr = | ||
516 | PSW_ADDR_AMODE | (unsigned long) restart_int_handler; | ||
517 | if (user_mode != HOME_SPACE_MODE) | ||
518 | lowcore->restart_psw.mask |= PSW_ASC_HOME; | ||
511 | #ifndef CONFIG_64BIT | 519 | #ifndef CONFIG_64BIT |
512 | if (MACHINE_HAS_IEEE) { | 520 | if (MACHINE_HAS_IEEE) { |
513 | unsigned long save_area; | 521 | unsigned long save_area; |
diff --git a/arch/s390/mm/maccess.c b/arch/s390/mm/maccess.c index 51e5cd9b906a..5dbbaa6e594c 100644 --- a/arch/s390/mm/maccess.c +++ b/arch/s390/mm/maccess.c | |||
@@ -85,3 +85,19 @@ int memcpy_real(void *dest, void *src, size_t count) | |||
85 | arch_local_irq_restore(flags); | 85 | arch_local_irq_restore(flags); |
86 | return rc; | 86 | return rc; |
87 | } | 87 | } |
88 | |||
89 | /* | ||
90 | * Copy memory to absolute zero | ||
91 | */ | ||
92 | void copy_to_absolute_zero(void *dest, void *src, size_t count) | ||
93 | { | ||
94 | unsigned long cr0; | ||
95 | |||
96 | BUG_ON((unsigned long) dest + count >= sizeof(struct _lowcore)); | ||
97 | preempt_disable(); | ||
98 | __ctl_store(cr0, 0, 0); | ||
99 | __ctl_clear_bit(0, 28); /* disable lowcore protection */ | ||
100 | memcpy_real(dest + store_prefix(), src, count); | ||
101 | __ctl_load(cr0, 0, 0); | ||
102 | preempt_enable(); | ||
103 | } | ||
diff --git a/arch/s390/mm/pgtable.c b/arch/s390/mm/pgtable.c index 2adb23938a7f..4d1f2bce87b3 100644 --- a/arch/s390/mm/pgtable.c +++ b/arch/s390/mm/pgtable.c | |||
@@ -528,6 +528,7 @@ static inline void page_table_free_pgste(unsigned long *table) | |||
528 | static inline unsigned long *page_table_alloc_pgste(struct mm_struct *mm, | 528 | static inline unsigned long *page_table_alloc_pgste(struct mm_struct *mm, |
529 | unsigned long vmaddr) | 529 | unsigned long vmaddr) |
530 | { | 530 | { |
531 | return NULL; | ||
531 | } | 532 | } |
532 | 533 | ||
533 | static inline void page_table_free_pgste(unsigned long *table) | 534 | static inline void page_table_free_pgste(unsigned long *table) |
diff --git a/arch/sh/Kconfig b/arch/sh/Kconfig index 748ff1920068..ff9177c8f643 100644 --- a/arch/sh/Kconfig +++ b/arch/sh/Kconfig | |||
@@ -11,6 +11,7 @@ config SUPERH | |||
11 | select HAVE_DMA_ATTRS | 11 | select HAVE_DMA_ATTRS |
12 | select HAVE_IRQ_WORK | 12 | select HAVE_IRQ_WORK |
13 | select HAVE_PERF_EVENTS | 13 | select HAVE_PERF_EVENTS |
14 | select ARCH_HAVE_NMI_SAFE_CMPXCHG if (GUSA_RB || CPU_SH4A) | ||
14 | select PERF_USE_VMALLOC | 15 | select PERF_USE_VMALLOC |
15 | select HAVE_KERNEL_GZIP | 16 | select HAVE_KERNEL_GZIP |
16 | select HAVE_KERNEL_BZIP2 | 17 | select HAVE_KERNEL_BZIP2 |
diff --git a/arch/sh/Makefile b/arch/sh/Makefile index e3d8170ad00b..99385d0b3f3b 100644 --- a/arch/sh/Makefile +++ b/arch/sh/Makefile | |||
@@ -173,6 +173,7 @@ core-$(CONFIG_HD6446X_SERIES) += arch/sh/cchips/hd6446x/ | |||
173 | cpuincdir-$(CONFIG_CPU_SH2A) += cpu-sh2a | 173 | cpuincdir-$(CONFIG_CPU_SH2A) += cpu-sh2a |
174 | cpuincdir-$(CONFIG_CPU_SH2) += cpu-sh2 | 174 | cpuincdir-$(CONFIG_CPU_SH2) += cpu-sh2 |
175 | cpuincdir-$(CONFIG_CPU_SH3) += cpu-sh3 | 175 | cpuincdir-$(CONFIG_CPU_SH3) += cpu-sh3 |
176 | cpuincdir-$(CONFIG_CPU_SH4A) += cpu-sh4a | ||
176 | cpuincdir-$(CONFIG_CPU_SH4) += cpu-sh4 | 177 | cpuincdir-$(CONFIG_CPU_SH4) += cpu-sh4 |
177 | cpuincdir-$(CONFIG_CPU_SH5) += cpu-sh5 | 178 | cpuincdir-$(CONFIG_CPU_SH5) += cpu-sh5 |
178 | cpuincdir-y += cpu-common # Must be last | 179 | cpuincdir-y += cpu-common # Must be last |
diff --git a/arch/sh/boards/board-apsh4a3a.c b/arch/sh/boards/board-apsh4a3a.c index 8e2a27057bc9..2823619c6006 100644 --- a/arch/sh/boards/board-apsh4a3a.c +++ b/arch/sh/boards/board-apsh4a3a.c | |||
@@ -116,7 +116,7 @@ static int apsh4a3a_clk_init(void) | |||
116 | int ret; | 116 | int ret; |
117 | 117 | ||
118 | clk = clk_get(NULL, "extal"); | 118 | clk = clk_get(NULL, "extal"); |
119 | if (!clk || IS_ERR(clk)) | 119 | if (IS_ERR(clk)) |
120 | return PTR_ERR(clk); | 120 | return PTR_ERR(clk); |
121 | ret = clk_set_rate(clk, 33333000); | 121 | ret = clk_set_rate(clk, 33333000); |
122 | clk_put(clk); | 122 | clk_put(clk); |
diff --git a/arch/sh/boards/board-apsh4ad0a.c b/arch/sh/boards/board-apsh4ad0a.c index e2bd218a054e..b4d6292a9247 100644 --- a/arch/sh/boards/board-apsh4ad0a.c +++ b/arch/sh/boards/board-apsh4ad0a.c | |||
@@ -94,7 +94,7 @@ static int apsh4ad0a_clk_init(void) | |||
94 | int ret; | 94 | int ret; |
95 | 95 | ||
96 | clk = clk_get(NULL, "extal"); | 96 | clk = clk_get(NULL, "extal"); |
97 | if (!clk || IS_ERR(clk)) | 97 | if (IS_ERR(clk)) |
98 | return PTR_ERR(clk); | 98 | return PTR_ERR(clk); |
99 | ret = clk_set_rate(clk, 33333000); | 99 | ret = clk_set_rate(clk, 33333000); |
100 | clk_put(clk); | 100 | clk_put(clk); |
diff --git a/arch/sh/boards/board-sh7785lcr.c b/arch/sh/boards/board-sh7785lcr.c index ee65ff05c558..d879848f3cdd 100644 --- a/arch/sh/boards/board-sh7785lcr.c +++ b/arch/sh/boards/board-sh7785lcr.c | |||
@@ -299,7 +299,7 @@ static int sh7785lcr_clk_init(void) | |||
299 | int ret; | 299 | int ret; |
300 | 300 | ||
301 | clk = clk_get(NULL, "extal"); | 301 | clk = clk_get(NULL, "extal"); |
302 | if (!clk || IS_ERR(clk)) | 302 | if (IS_ERR(clk)) |
303 | return PTR_ERR(clk); | 303 | return PTR_ERR(clk); |
304 | ret = clk_set_rate(clk, 33333333); | 304 | ret = clk_set_rate(clk, 33333333); |
305 | clk_put(clk); | 305 | clk_put(clk); |
diff --git a/arch/sh/boards/board-urquell.c b/arch/sh/boards/board-urquell.c index d81c609decc7..24e3316c5c17 100644 --- a/arch/sh/boards/board-urquell.c +++ b/arch/sh/boards/board-urquell.c | |||
@@ -190,7 +190,7 @@ static int urquell_clk_init(void) | |||
190 | return -EINVAL; | 190 | return -EINVAL; |
191 | 191 | ||
192 | clk = clk_get(NULL, "extal"); | 192 | clk = clk_get(NULL, "extal"); |
193 | if (!clk || IS_ERR(clk)) | 193 | if (IS_ERR(clk)) |
194 | return PTR_ERR(clk); | 194 | return PTR_ERR(clk); |
195 | ret = clk_set_rate(clk, 33333333); | 195 | ret = clk_set_rate(clk, 33333333); |
196 | clk_put(clk); | 196 | clk_put(clk); |
diff --git a/arch/sh/boards/mach-ap325rxa/setup.c b/arch/sh/boards/mach-ap325rxa/setup.c index 1dc924b2f508..d36265758911 100644 --- a/arch/sh/boards/mach-ap325rxa/setup.c +++ b/arch/sh/boards/mach-ap325rxa/setup.c | |||
@@ -332,8 +332,8 @@ static int camera_set_capture(struct soc_camera_platform_info *info, | |||
332 | return ret; | 332 | return ret; |
333 | } | 333 | } |
334 | 334 | ||
335 | static int ap325rxa_camera_add(struct soc_camera_link *icl, struct device *dev); | 335 | static int ap325rxa_camera_add(struct soc_camera_device *icd); |
336 | static void ap325rxa_camera_del(struct soc_camera_link *icl); | 336 | static void ap325rxa_camera_del(struct soc_camera_device *icd); |
337 | 337 | ||
338 | static struct soc_camera_platform_info camera_info = { | 338 | static struct soc_camera_platform_info camera_info = { |
339 | .format_name = "UYVY", | 339 | .format_name = "UYVY", |
@@ -366,24 +366,23 @@ static void ap325rxa_camera_release(struct device *dev) | |||
366 | soc_camera_platform_release(&camera_device); | 366 | soc_camera_platform_release(&camera_device); |
367 | } | 367 | } |
368 | 368 | ||
369 | static int ap325rxa_camera_add(struct soc_camera_link *icl, | 369 | static int ap325rxa_camera_add(struct soc_camera_device *icd) |
370 | struct device *dev) | ||
371 | { | 370 | { |
372 | int ret = soc_camera_platform_add(icl, dev, &camera_device, &camera_link, | 371 | int ret = soc_camera_platform_add(icd, &camera_device, &camera_link, |
373 | ap325rxa_camera_release, 0); | 372 | ap325rxa_camera_release, 0); |
374 | if (ret < 0) | 373 | if (ret < 0) |
375 | return ret; | 374 | return ret; |
376 | 375 | ||
377 | ret = camera_probe(); | 376 | ret = camera_probe(); |
378 | if (ret < 0) | 377 | if (ret < 0) |
379 | soc_camera_platform_del(icl, camera_device, &camera_link); | 378 | soc_camera_platform_del(icd, camera_device, &camera_link); |
380 | 379 | ||
381 | return ret; | 380 | return ret; |
382 | } | 381 | } |
383 | 382 | ||
384 | static void ap325rxa_camera_del(struct soc_camera_link *icl) | 383 | static void ap325rxa_camera_del(struct soc_camera_device *icd) |
385 | { | 384 | { |
386 | soc_camera_platform_del(icl, camera_device, &camera_link); | 385 | soc_camera_platform_del(icd, camera_device, &camera_link); |
387 | } | 386 | } |
388 | #endif /* CONFIG_I2C */ | 387 | #endif /* CONFIG_I2C */ |
389 | 388 | ||
diff --git a/arch/sh/boards/mach-highlander/setup.c b/arch/sh/boards/mach-highlander/setup.c index 87618c91d178..74b8db1b74a9 100644 --- a/arch/sh/boards/mach-highlander/setup.c +++ b/arch/sh/boards/mach-highlander/setup.c | |||
@@ -335,8 +335,6 @@ static struct clk *r7780rp_clocks[] = { | |||
335 | &ivdr_clk, | 335 | &ivdr_clk, |
336 | }; | 336 | }; |
337 | 337 | ||
338 | #define CLKDEV_CON_ID(_id, _clk) { .con_id = _id, .clk = _clk } | ||
339 | |||
340 | static struct clk_lookup lookups[] = { | 338 | static struct clk_lookup lookups[] = { |
341 | /* main clocks */ | 339 | /* main clocks */ |
342 | CLKDEV_CON_ID("ivdr_clk", &ivdr_clk), | 340 | CLKDEV_CON_ID("ivdr_clk", &ivdr_clk), |
diff --git a/arch/sh/boards/mach-sdk7786/setup.c b/arch/sh/boards/mach-sdk7786/setup.c index 1521aa75ee3a..486d1ac3694c 100644 --- a/arch/sh/boards/mach-sdk7786/setup.c +++ b/arch/sh/boards/mach-sdk7786/setup.c | |||
@@ -194,7 +194,7 @@ static int sdk7786_clk_init(void) | |||
194 | return -EINVAL; | 194 | return -EINVAL; |
195 | 195 | ||
196 | clk = clk_get(NULL, "extal"); | 196 | clk = clk_get(NULL, "extal"); |
197 | if (!clk || IS_ERR(clk)) | 197 | if (IS_ERR(clk)) |
198 | return PTR_ERR(clk); | 198 | return PTR_ERR(clk); |
199 | ret = clk_set_rate(clk, 33333333); | 199 | ret = clk_set_rate(clk, 33333333); |
200 | clk_put(clk); | 200 | clk_put(clk); |
diff --git a/arch/sh/drivers/pci/fixups-cayman.c b/arch/sh/drivers/pci/fixups-cayman.c index b68b61d22c6c..edc2fb7a5bb2 100644 --- a/arch/sh/drivers/pci/fixups-cayman.c +++ b/arch/sh/drivers/pci/fixups-cayman.c | |||
@@ -5,7 +5,7 @@ | |||
5 | #include <cpu/irq.h> | 5 | #include <cpu/irq.h> |
6 | #include "pci-sh5.h" | 6 | #include "pci-sh5.h" |
7 | 7 | ||
8 | int __init pcibios_map_platform_irq(struct pci_dev *dev, u8 slot, u8 pin) | 8 | int __init pcibios_map_platform_irq(const struct pci_dev *dev, u8 slot, u8 pin) |
9 | { | 9 | { |
10 | int result = -1; | 10 | int result = -1; |
11 | 11 | ||
diff --git a/arch/sh/drivers/pci/fixups-dreamcast.c b/arch/sh/drivers/pci/fixups-dreamcast.c index 942ef4f155f5..edeea8960c30 100644 --- a/arch/sh/drivers/pci/fixups-dreamcast.c +++ b/arch/sh/drivers/pci/fixups-dreamcast.c | |||
@@ -64,7 +64,7 @@ static void __init gapspci_fixup_resources(struct pci_dev *dev) | |||
64 | } | 64 | } |
65 | DECLARE_PCI_FIXUP_HEADER(PCI_ANY_ID, PCI_ANY_ID, gapspci_fixup_resources); | 65 | DECLARE_PCI_FIXUP_HEADER(PCI_ANY_ID, PCI_ANY_ID, gapspci_fixup_resources); |
66 | 66 | ||
67 | int __init pcibios_map_platform_irq(struct pci_dev *dev, u8 slot, u8 pin) | 67 | int __init pcibios_map_platform_irq(const struct pci_dev *dev, u8 slot, u8 pin) |
68 | { | 68 | { |
69 | /* | 69 | /* |
70 | * The interrupt routing semantics here are quite trivial. | 70 | * The interrupt routing semantics here are quite trivial. |
diff --git a/arch/sh/drivers/pci/fixups-landisk.c b/arch/sh/drivers/pci/fixups-landisk.c index 95c6e2d94a0a..ecb1d1060638 100644 --- a/arch/sh/drivers/pci/fixups-landisk.c +++ b/arch/sh/drivers/pci/fixups-landisk.c | |||
@@ -19,7 +19,7 @@ | |||
19 | #define PCIMCR_MRSET_OFF 0xBFFFFFFF | 19 | #define PCIMCR_MRSET_OFF 0xBFFFFFFF |
20 | #define PCIMCR_RFSH_OFF 0xFFFFFFFB | 20 | #define PCIMCR_RFSH_OFF 0xFFFFFFFB |
21 | 21 | ||
22 | int pcibios_map_platform_irq(struct pci_dev *pdev, u8 slot, u8 pin) | 22 | int pcibios_map_platform_irq(const struct pci_dev *pdev, u8 slot, u8 pin) |
23 | { | 23 | { |
24 | /* | 24 | /* |
25 | * slot0: pin1-4 = irq5,6,7,8 | 25 | * slot0: pin1-4 = irq5,6,7,8 |
diff --git a/arch/sh/drivers/pci/fixups-r7780rp.c b/arch/sh/drivers/pci/fixups-r7780rp.c index 08b2d8658a00..f9370dce0b70 100644 --- a/arch/sh/drivers/pci/fixups-r7780rp.c +++ b/arch/sh/drivers/pci/fixups-r7780rp.c | |||
@@ -18,7 +18,7 @@ static char irq_tab[] __initdata = { | |||
18 | 65, 66, 67, 68, | 18 | 65, 66, 67, 68, |
19 | }; | 19 | }; |
20 | 20 | ||
21 | int __init pcibios_map_platform_irq(struct pci_dev *pdev, u8 slot, u8 pin) | 21 | int __init pcibios_map_platform_irq(const struct pci_dev *pdev, u8 slot, u8 pin) |
22 | { | 22 | { |
23 | return irq_tab[slot]; | 23 | return irq_tab[slot]; |
24 | } | 24 | } |
diff --git a/arch/sh/drivers/pci/fixups-rts7751r2d.c b/arch/sh/drivers/pci/fixups-rts7751r2d.c index e248516118a9..eaddb56c45c6 100644 --- a/arch/sh/drivers/pci/fixups-rts7751r2d.c +++ b/arch/sh/drivers/pci/fixups-rts7751r2d.c | |||
@@ -31,7 +31,7 @@ static char lboxre2_irq_tab[] __initdata = { | |||
31 | IRQ_ETH0, IRQ_ETH1, IRQ_INTA, IRQ_INTD, | 31 | IRQ_ETH0, IRQ_ETH1, IRQ_INTA, IRQ_INTD, |
32 | }; | 32 | }; |
33 | 33 | ||
34 | int __init pcibios_map_platform_irq(struct pci_dev *pdev, u8 slot, u8 pin) | 34 | int __init pcibios_map_platform_irq(const struct pci_dev *pdev, u8 slot, u8 pin) |
35 | { | 35 | { |
36 | if (mach_is_lboxre2()) | 36 | if (mach_is_lboxre2()) |
37 | return lboxre2_irq_tab[slot]; | 37 | return lboxre2_irq_tab[slot]; |
diff --git a/arch/sh/drivers/pci/fixups-sdk7780.c b/arch/sh/drivers/pci/fixups-sdk7780.c index 0930f988ac29..0b8472501b88 100644 --- a/arch/sh/drivers/pci/fixups-sdk7780.c +++ b/arch/sh/drivers/pci/fixups-sdk7780.c | |||
@@ -27,7 +27,7 @@ static char sdk7780_irq_tab[4][16] __initdata = { | |||
27 | { 68, 67, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 }, | 27 | { 68, 67, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 }, |
28 | }; | 28 | }; |
29 | 29 | ||
30 | int __init pcibios_map_platform_irq(struct pci_dev *pdev, u8 slot, u8 pin) | 30 | int __init pcibios_map_platform_irq(const struct pci_dev *pdev, u8 slot, u8 pin) |
31 | { | 31 | { |
32 | return sdk7780_irq_tab[pin-1][slot]; | 32 | return sdk7780_irq_tab[pin-1][slot]; |
33 | } | 33 | } |
diff --git a/arch/sh/drivers/pci/fixups-se7751.c b/arch/sh/drivers/pci/fixups-se7751.c index fd3e6b02f289..2ec146c3fa44 100644 --- a/arch/sh/drivers/pci/fixups-se7751.c +++ b/arch/sh/drivers/pci/fixups-se7751.c | |||
@@ -6,7 +6,7 @@ | |||
6 | #include <linux/io.h> | 6 | #include <linux/io.h> |
7 | #include "pci-sh4.h" | 7 | #include "pci-sh4.h" |
8 | 8 | ||
9 | int __init pcibios_map_platform_irq(struct pci_dev *, u8 slot, u8 pin) | 9 | int __init pcibios_map_platform_irq(const struct pci_dev *, u8 slot, u8 pin) |
10 | { | 10 | { |
11 | switch (slot) { | 11 | switch (slot) { |
12 | case 0: return 13; | 12 | case 0: return 13; |
diff --git a/arch/sh/drivers/pci/fixups-sh03.c b/arch/sh/drivers/pci/fixups-sh03.c index 2e8a18b7ee53..1615e5906168 100644 --- a/arch/sh/drivers/pci/fixups-sh03.c +++ b/arch/sh/drivers/pci/fixups-sh03.c | |||
@@ -3,7 +3,7 @@ | |||
3 | #include <linux/types.h> | 3 | #include <linux/types.h> |
4 | #include <linux/pci.h> | 4 | #include <linux/pci.h> |
5 | 5 | ||
6 | int __init pcibios_map_platform_irq(struct pci_dev *dev, u8 slot, u8 pin) | 6 | int __init pcibios_map_platform_irq(const struct pci_dev *dev, u8 slot, u8 pin) |
7 | { | 7 | { |
8 | int irq; | 8 | int irq; |
9 | 9 | ||
diff --git a/arch/sh/drivers/pci/fixups-snapgear.c b/arch/sh/drivers/pci/fixups-snapgear.c index 5a39ecc1adb8..4a093c648d12 100644 --- a/arch/sh/drivers/pci/fixups-snapgear.c +++ b/arch/sh/drivers/pci/fixups-snapgear.c | |||
@@ -18,7 +18,7 @@ | |||
18 | #include <linux/pci.h> | 18 | #include <linux/pci.h> |
19 | #include "pci-sh4.h" | 19 | #include "pci-sh4.h" |
20 | 20 | ||
21 | int __init pcibios_map_platform_irq(struct pci_dev *pdev, u8 slot, u8 pin) | 21 | int __init pcibios_map_platform_irq(const struct pci_dev *pdev, u8 slot, u8 pin) |
22 | { | 22 | { |
23 | int irq = -1; | 23 | int irq = -1; |
24 | 24 | ||
diff --git a/arch/sh/drivers/pci/fixups-titan.c b/arch/sh/drivers/pci/fixups-titan.c index 3a79fa8254a6..bd1addb1b8be 100644 --- a/arch/sh/drivers/pci/fixups-titan.c +++ b/arch/sh/drivers/pci/fixups-titan.c | |||
@@ -27,7 +27,7 @@ static char titan_irq_tab[] __initdata = { | |||
27 | TITAN_IRQ_USB, | 27 | TITAN_IRQ_USB, |
28 | }; | 28 | }; |
29 | 29 | ||
30 | int __init pcibios_map_platform_irq(struct pci_dev *pdev, u8 slot, u8 pin) | 30 | int __init pcibios_map_platform_irq(const struct pci_dev *pdev, u8 slot, u8 pin) |
31 | { | 31 | { |
32 | int irq = titan_irq_tab[slot]; | 32 | int irq = titan_irq_tab[slot]; |
33 | 33 | ||
diff --git a/arch/sh/drivers/pci/pcie-sh7786.c b/arch/sh/drivers/pci/pcie-sh7786.c index 4418f9070ed1..4df27c4fbf99 100644 --- a/arch/sh/drivers/pci/pcie-sh7786.c +++ b/arch/sh/drivers/pci/pcie-sh7786.c | |||
@@ -466,7 +466,7 @@ static int __init pcie_init(struct sh7786_pcie_port *port) | |||
466 | return 0; | 466 | return 0; |
467 | } | 467 | } |
468 | 468 | ||
469 | int __init pcibios_map_platform_irq(struct pci_dev *pdev, u8 slot, u8 pin) | 469 | int __init pcibios_map_platform_irq(const struct pci_dev *pdev, u8 slot, u8 pin) |
470 | { | 470 | { |
471 | return 71; | 471 | return 71; |
472 | } | 472 | } |
diff --git a/arch/sh/include/asm/pci.h b/arch/sh/include/asm/pci.h index f0efe97f1750..cb21e2399dc1 100644 --- a/arch/sh/include/asm/pci.h +++ b/arch/sh/include/asm/pci.h | |||
@@ -112,7 +112,7 @@ static inline void pci_dma_burst_advice(struct pci_dev *pdev, | |||
112 | #endif | 112 | #endif |
113 | 113 | ||
114 | /* Board-specific fixup routines. */ | 114 | /* Board-specific fixup routines. */ |
115 | int pcibios_map_platform_irq(struct pci_dev *dev, u8 slot, u8 pin); | 115 | int pcibios_map_platform_irq(const struct pci_dev *dev, u8 slot, u8 pin); |
116 | 116 | ||
117 | extern void pcibios_resource_to_bus(struct pci_dev *dev, | 117 | extern void pcibios_resource_to_bus(struct pci_dev *dev, |
118 | struct pci_bus_region *region, struct resource *res); | 118 | struct pci_bus_region *region, struct resource *res); |
diff --git a/arch/sh/include/cpu-sh3/cpu/serial.h b/arch/sh/include/cpu-sh3/cpu/serial.h new file mode 100644 index 000000000000..7766329bc103 --- /dev/null +++ b/arch/sh/include/cpu-sh3/cpu/serial.h | |||
@@ -0,0 +1,10 @@ | |||
1 | #ifndef __CPU_SH3_SERIAL_H | ||
2 | #define __CPU_SH3_SERIAL_H | ||
3 | |||
4 | #include <linux/serial_sci.h> | ||
5 | |||
6 | extern struct plat_sci_port_ops sh770x_sci_port_ops; | ||
7 | extern struct plat_sci_port_ops sh7710_sci_port_ops; | ||
8 | extern struct plat_sci_port_ops sh7720_sci_port_ops; | ||
9 | |||
10 | #endif /* __CPU_SH3_SERIAL_H */ | ||
diff --git a/arch/sh/include/cpu-sh4a/cpu/serial.h b/arch/sh/include/cpu-sh4a/cpu/serial.h new file mode 100644 index 000000000000..ff1bc275d210 --- /dev/null +++ b/arch/sh/include/cpu-sh4a/cpu/serial.h | |||
@@ -0,0 +1,7 @@ | |||
1 | #ifndef __CPU_SH4A_SERIAL_H | ||
2 | #define __CPU_SH4A_SERIAL_H | ||
3 | |||
4 | /* arch/sh/kernel/cpu/sh4a/serial-sh7722.c */ | ||
5 | extern struct plat_sci_port_ops sh7722_sci_port_ops; | ||
6 | |||
7 | #endif /* __CPU_SH4A_SERIAL_H */ | ||
diff --git a/arch/sh/kernel/cpu/clock-cpg.c b/arch/sh/kernel/cpu/clock-cpg.c index 8f63a264a842..f59b1f30d44b 100644 --- a/arch/sh/kernel/cpu/clock-cpg.c +++ b/arch/sh/kernel/cpu/clock-cpg.c | |||
@@ -35,8 +35,6 @@ static struct clk *onchip_clocks[] = { | |||
35 | &cpu_clk, | 35 | &cpu_clk, |
36 | }; | 36 | }; |
37 | 37 | ||
38 | #define CLKDEV_CON_ID(_id, _clk) { .con_id = _id, .clk = _clk } | ||
39 | |||
40 | static struct clk_lookup lookups[] = { | 38 | static struct clk_lookup lookups[] = { |
41 | /* main clocks */ | 39 | /* main clocks */ |
42 | CLKDEV_CON_ID("master_clk", &master_clk), | 40 | CLKDEV_CON_ID("master_clk", &master_clk), |
diff --git a/arch/sh/kernel/cpu/sh3/Makefile b/arch/sh/kernel/cpu/sh3/Makefile index ecab274141a8..6f13f33a35ff 100644 --- a/arch/sh/kernel/cpu/sh3/Makefile +++ b/arch/sh/kernel/cpu/sh3/Makefile | |||
@@ -7,15 +7,15 @@ obj-y := ex.o probe.o entry.o setup-sh3.o | |||
7 | obj-$(CONFIG_HIBERNATION) += swsusp.o | 7 | obj-$(CONFIG_HIBERNATION) += swsusp.o |
8 | 8 | ||
9 | # CPU subtype setup | 9 | # CPU subtype setup |
10 | obj-$(CONFIG_CPU_SUBTYPE_SH7705) += setup-sh7705.o | 10 | obj-$(CONFIG_CPU_SUBTYPE_SH7705) += setup-sh7705.o serial-sh770x.o |
11 | obj-$(CONFIG_CPU_SUBTYPE_SH7706) += setup-sh770x.o | 11 | obj-$(CONFIG_CPU_SUBTYPE_SH7706) += setup-sh770x.o serial-sh770x.o |
12 | obj-$(CONFIG_CPU_SUBTYPE_SH7707) += setup-sh770x.o | 12 | obj-$(CONFIG_CPU_SUBTYPE_SH7707) += setup-sh770x.o serial-sh770x.o |
13 | obj-$(CONFIG_CPU_SUBTYPE_SH7708) += setup-sh770x.o | 13 | obj-$(CONFIG_CPU_SUBTYPE_SH7708) += setup-sh770x.o serial-sh770x.o |
14 | obj-$(CONFIG_CPU_SUBTYPE_SH7709) += setup-sh770x.o | 14 | obj-$(CONFIG_CPU_SUBTYPE_SH7709) += setup-sh770x.o serial-sh770x.o |
15 | obj-$(CONFIG_CPU_SUBTYPE_SH7710) += setup-sh7710.o | 15 | obj-$(CONFIG_CPU_SUBTYPE_SH7710) += setup-sh7710.o serial-sh7710.o |
16 | obj-$(CONFIG_CPU_SUBTYPE_SH7712) += setup-sh7710.o | 16 | obj-$(CONFIG_CPU_SUBTYPE_SH7712) += setup-sh7710.o serial-sh7710.o |
17 | obj-$(CONFIG_CPU_SUBTYPE_SH7720) += setup-sh7720.o | 17 | obj-$(CONFIG_CPU_SUBTYPE_SH7720) += setup-sh7720.o serial-sh7720.o |
18 | obj-$(CONFIG_CPU_SUBTYPE_SH7721) += setup-sh7720.o | 18 | obj-$(CONFIG_CPU_SUBTYPE_SH7721) += setup-sh7720.o serial-sh7720.o |
19 | 19 | ||
20 | # Primary on-chip clocks (common) | 20 | # Primary on-chip clocks (common) |
21 | clock-$(CONFIG_CPU_SH3) := clock-sh3.o | 21 | clock-$(CONFIG_CPU_SH3) := clock-sh3.o |
diff --git a/arch/sh/kernel/cpu/sh3/serial-sh770x.c b/arch/sh/kernel/cpu/sh3/serial-sh770x.c new file mode 100644 index 000000000000..4f7242c676b3 --- /dev/null +++ b/arch/sh/kernel/cpu/sh3/serial-sh770x.c | |||
@@ -0,0 +1,33 @@ | |||
1 | #include <linux/serial_sci.h> | ||
2 | #include <linux/serial_core.h> | ||
3 | #include <linux/io.h> | ||
4 | #include <cpu/serial.h> | ||
5 | |||
6 | #define SCPCR 0xA4000116 | ||
7 | #define SCPDR 0xA4000136 | ||
8 | |||
9 | static void sh770x_sci_init_pins(struct uart_port *port, unsigned int cflag) | ||
10 | { | ||
11 | unsigned short data; | ||
12 | |||
13 | /* We need to set SCPCR to enable RTS/CTS */ | ||
14 | data = __raw_readw(SCPCR); | ||
15 | /* Clear out SCP7MD1,0, SCP6MD1,0, SCP4MD1,0*/ | ||
16 | __raw_writew(data & 0x0fcf, SCPCR); | ||
17 | |||
18 | if (!(cflag & CRTSCTS)) { | ||
19 | /* We need to set SCPCR to enable RTS/CTS */ | ||
20 | data = __raw_readw(SCPCR); | ||
21 | /* Clear out SCP7MD1,0, SCP4MD1,0, | ||
22 | Set SCP6MD1,0 = {01} (output) */ | ||
23 | __raw_writew((data & 0x0fcf) | 0x1000, SCPCR); | ||
24 | |||
25 | data = __raw_readb(SCPDR); | ||
26 | /* Set /RTS2 (bit6) = 0 */ | ||
27 | __raw_writeb(data & 0xbf, SCPDR); | ||
28 | } | ||
29 | } | ||
30 | |||
31 | struct plat_sci_port_ops sh770x_sci_port_ops = { | ||
32 | .init_pins = sh770x_sci_init_pins, | ||
33 | }; | ||
diff --git a/arch/sh/kernel/cpu/sh3/serial-sh7710.c b/arch/sh/kernel/cpu/sh3/serial-sh7710.c new file mode 100644 index 000000000000..42190ef6aebf --- /dev/null +++ b/arch/sh/kernel/cpu/sh3/serial-sh7710.c | |||
@@ -0,0 +1,20 @@ | |||
1 | #include <linux/serial_sci.h> | ||
2 | #include <linux/serial_core.h> | ||
3 | #include <linux/io.h> | ||
4 | #include <cpu/serial.h> | ||
5 | |||
6 | #define PACR 0xa4050100 | ||
7 | #define PBCR 0xa4050102 | ||
8 | |||
9 | static void sh7710_sci_init_pins(struct uart_port *port, unsigned int cflag) | ||
10 | { | ||
11 | if (port->mapbase == 0xA4400000) { | ||
12 | __raw_writew(__raw_readw(PACR) & 0xffc0, PACR); | ||
13 | __raw_writew(__raw_readw(PBCR) & 0x0fff, PBCR); | ||
14 | } else if (port->mapbase == 0xA4410000) | ||
15 | __raw_writew(__raw_readw(PBCR) & 0xf003, PBCR); | ||
16 | } | ||
17 | |||
18 | struct plat_sci_port_ops sh7710_sci_port_ops = { | ||
19 | .init_pins = sh7710_sci_init_pins, | ||
20 | }; | ||
diff --git a/arch/sh/kernel/cpu/sh3/serial-sh7720.c b/arch/sh/kernel/cpu/sh3/serial-sh7720.c new file mode 100644 index 000000000000..8832c526cdf9 --- /dev/null +++ b/arch/sh/kernel/cpu/sh3/serial-sh7720.c | |||
@@ -0,0 +1,37 @@ | |||
1 | #include <linux/serial_sci.h> | ||
2 | #include <linux/serial_core.h> | ||
3 | #include <linux/io.h> | ||
4 | #include <cpu/serial.h> | ||
5 | #include <asm/gpio.h> | ||
6 | |||
7 | static void sh7720_sci_init_pins(struct uart_port *port, unsigned int cflag) | ||
8 | { | ||
9 | unsigned short data; | ||
10 | |||
11 | if (cflag & CRTSCTS) { | ||
12 | /* enable RTS/CTS */ | ||
13 | if (port->mapbase == 0xa4430000) { /* SCIF0 */ | ||
14 | /* Clear PTCR bit 9-2; enable all scif pins but sck */ | ||
15 | data = __raw_readw(PORT_PTCR); | ||
16 | __raw_writew((data & 0xfc03), PORT_PTCR); | ||
17 | } else if (port->mapbase == 0xa4438000) { /* SCIF1 */ | ||
18 | /* Clear PVCR bit 9-2 */ | ||
19 | data = __raw_readw(PORT_PVCR); | ||
20 | __raw_writew((data & 0xfc03), PORT_PVCR); | ||
21 | } | ||
22 | } else { | ||
23 | if (port->mapbase == 0xa4430000) { /* SCIF0 */ | ||
24 | /* Clear PTCR bit 5-2; enable only tx and rx */ | ||
25 | data = __raw_readw(PORT_PTCR); | ||
26 | __raw_writew((data & 0xffc3), PORT_PTCR); | ||
27 | } else if (port->mapbase == 0xa4438000) { /* SCIF1 */ | ||
28 | /* Clear PVCR bit 5-2 */ | ||
29 | data = __raw_readw(PORT_PVCR); | ||
30 | __raw_writew((data & 0xffc3), PORT_PVCR); | ||
31 | } | ||
32 | } | ||
33 | } | ||
34 | |||
35 | struct plat_sci_port_ops sh7720_sci_port_ops = { | ||
36 | .init_pins = sh7720_sci_init_pins, | ||
37 | }; | ||
diff --git a/arch/sh/kernel/cpu/sh3/setup-sh7705.c b/arch/sh/kernel/cpu/sh3/setup-sh7705.c index cd2e702feb7e..2309618c015d 100644 --- a/arch/sh/kernel/cpu/sh3/setup-sh7705.c +++ b/arch/sh/kernel/cpu/sh3/setup-sh7705.c | |||
@@ -15,6 +15,7 @@ | |||
15 | #include <linux/serial_sci.h> | 15 | #include <linux/serial_sci.h> |
16 | #include <linux/sh_timer.h> | 16 | #include <linux/sh_timer.h> |
17 | #include <asm/rtc.h> | 17 | #include <asm/rtc.h> |
18 | #include <cpu/serial.h> | ||
18 | 19 | ||
19 | enum { | 20 | enum { |
20 | UNUSED = 0, | 21 | UNUSED = 0, |
@@ -75,6 +76,8 @@ static struct plat_sci_port scif0_platform_data = { | |||
75 | .scbrr_algo_id = SCBRR_ALGO_4, | 76 | .scbrr_algo_id = SCBRR_ALGO_4, |
76 | .type = PORT_SCIF, | 77 | .type = PORT_SCIF, |
77 | .irqs = { 56, 56, 56 }, | 78 | .irqs = { 56, 56, 56 }, |
79 | .ops = &sh770x_sci_port_ops, | ||
80 | .regtype = SCIx_SH7705_SCIF_REGTYPE, | ||
78 | }; | 81 | }; |
79 | 82 | ||
80 | static struct platform_device scif0_device = { | 83 | static struct platform_device scif0_device = { |
@@ -92,6 +95,8 @@ static struct plat_sci_port scif1_platform_data = { | |||
92 | .scbrr_algo_id = SCBRR_ALGO_4, | 95 | .scbrr_algo_id = SCBRR_ALGO_4, |
93 | .type = PORT_SCIF, | 96 | .type = PORT_SCIF, |
94 | .irqs = { 52, 52, 52 }, | 97 | .irqs = { 52, 52, 52 }, |
98 | .ops = &sh770x_sci_port_ops, | ||
99 | .regtype = SCIx_SH7705_SCIF_REGTYPE, | ||
95 | }; | 100 | }; |
96 | 101 | ||
97 | static struct platform_device scif1_device = { | 102 | static struct platform_device scif1_device = { |
diff --git a/arch/sh/kernel/cpu/sh3/setup-sh770x.c b/arch/sh/kernel/cpu/sh3/setup-sh770x.c index 4551ad647c2c..3f3d5fe5892d 100644 --- a/arch/sh/kernel/cpu/sh3/setup-sh770x.c +++ b/arch/sh/kernel/cpu/sh3/setup-sh770x.c | |||
@@ -19,6 +19,7 @@ | |||
19 | #include <linux/serial.h> | 19 | #include <linux/serial.h> |
20 | #include <linux/serial_sci.h> | 20 | #include <linux/serial_sci.h> |
21 | #include <linux/sh_timer.h> | 21 | #include <linux/sh_timer.h> |
22 | #include <cpu/serial.h> | ||
22 | 23 | ||
23 | enum { | 24 | enum { |
24 | UNUSED = 0, | 25 | UNUSED = 0, |
@@ -108,11 +109,14 @@ static struct platform_device rtc_device = { | |||
108 | 109 | ||
109 | static struct plat_sci_port scif0_platform_data = { | 110 | static struct plat_sci_port scif0_platform_data = { |
110 | .mapbase = 0xfffffe80, | 111 | .mapbase = 0xfffffe80, |
112 | .port_reg = 0xa4000136, | ||
111 | .flags = UPF_BOOT_AUTOCONF, | 113 | .flags = UPF_BOOT_AUTOCONF, |
112 | .scscr = SCSCR_TE | SCSCR_RE, | 114 | .scscr = SCSCR_TE | SCSCR_RE, |
113 | .scbrr_algo_id = SCBRR_ALGO_2, | 115 | .scbrr_algo_id = SCBRR_ALGO_2, |
114 | .type = PORT_SCI, | 116 | .type = PORT_SCI, |
115 | .irqs = { 23, 23, 23, 0 }, | 117 | .irqs = { 23, 23, 23, 0 }, |
118 | .ops = &sh770x_sci_port_ops, | ||
119 | .regshift = 1, | ||
116 | }; | 120 | }; |
117 | 121 | ||
118 | static struct platform_device scif0_device = { | 122 | static struct platform_device scif0_device = { |
@@ -132,6 +136,8 @@ static struct plat_sci_port scif1_platform_data = { | |||
132 | .scbrr_algo_id = SCBRR_ALGO_2, | 136 | .scbrr_algo_id = SCBRR_ALGO_2, |
133 | .type = PORT_SCIF, | 137 | .type = PORT_SCIF, |
134 | .irqs = { 56, 56, 56, 56 }, | 138 | .irqs = { 56, 56, 56, 56 }, |
139 | .ops = &sh770x_sci_port_ops, | ||
140 | .regtype = SCIx_SH3_SCIF_REGTYPE, | ||
135 | }; | 141 | }; |
136 | 142 | ||
137 | static struct platform_device scif1_device = { | 143 | static struct platform_device scif1_device = { |
@@ -146,11 +152,14 @@ static struct platform_device scif1_device = { | |||
146 | defined(CONFIG_CPU_SUBTYPE_SH7709) | 152 | defined(CONFIG_CPU_SUBTYPE_SH7709) |
147 | static struct plat_sci_port scif2_platform_data = { | 153 | static struct plat_sci_port scif2_platform_data = { |
148 | .mapbase = 0xa4000140, | 154 | .mapbase = 0xa4000140, |
155 | .port_reg = SCIx_NOT_SUPPORTED, | ||
149 | .flags = UPF_BOOT_AUTOCONF, | 156 | .flags = UPF_BOOT_AUTOCONF, |
150 | .scscr = SCSCR_TE | SCSCR_RE, | 157 | .scscr = SCSCR_TE | SCSCR_RE, |
151 | .scbrr_algo_id = SCBRR_ALGO_2, | 158 | .scbrr_algo_id = SCBRR_ALGO_2, |
152 | .type = PORT_IRDA, | 159 | .type = PORT_IRDA, |
153 | .irqs = { 52, 52, 52, 52 }, | 160 | .irqs = { 52, 52, 52, 52 }, |
161 | .ops = &sh770x_sci_port_ops, | ||
162 | .regshift = 1, | ||
154 | }; | 163 | }; |
155 | 164 | ||
156 | static struct platform_device scif2_device = { | 165 | static struct platform_device scif2_device = { |
diff --git a/arch/sh/kernel/cpu/sh3/setup-sh7720.c b/arch/sh/kernel/cpu/sh3/setup-sh7720.c index 365b94a6fcb7..94920345c14d 100644 --- a/arch/sh/kernel/cpu/sh3/setup-sh7720.c +++ b/arch/sh/kernel/cpu/sh3/setup-sh7720.c | |||
@@ -20,6 +20,7 @@ | |||
20 | #include <linux/serial_sci.h> | 20 | #include <linux/serial_sci.h> |
21 | #include <linux/sh_timer.h> | 21 | #include <linux/sh_timer.h> |
22 | #include <asm/rtc.h> | 22 | #include <asm/rtc.h> |
23 | #include <cpu/serial.h> | ||
23 | 24 | ||
24 | static struct resource rtc_resources[] = { | 25 | static struct resource rtc_resources[] = { |
25 | [0] = { | 26 | [0] = { |
@@ -55,6 +56,8 @@ static struct plat_sci_port scif0_platform_data = { | |||
55 | .scbrr_algo_id = SCBRR_ALGO_4, | 56 | .scbrr_algo_id = SCBRR_ALGO_4, |
56 | .type = PORT_SCIF, | 57 | .type = PORT_SCIF, |
57 | .irqs = { 80, 80, 80, 80 }, | 58 | .irqs = { 80, 80, 80, 80 }, |
59 | .ops = &sh7720_sci_port_ops, | ||
60 | .regtype = SCIx_SH7705_SCIF_REGTYPE, | ||
58 | }; | 61 | }; |
59 | 62 | ||
60 | static struct platform_device scif0_device = { | 63 | static struct platform_device scif0_device = { |
@@ -72,6 +75,8 @@ static struct plat_sci_port scif1_platform_data = { | |||
72 | .scbrr_algo_id = SCBRR_ALGO_4, | 75 | .scbrr_algo_id = SCBRR_ALGO_4, |
73 | .type = PORT_SCIF, | 76 | .type = PORT_SCIF, |
74 | .irqs = { 81, 81, 81, 81 }, | 77 | .irqs = { 81, 81, 81, 81 }, |
78 | .ops = &sh7720_sci_port_ops, | ||
79 | .regtype = SCIx_SH7705_SCIF_REGTYPE, | ||
75 | }; | 80 | }; |
76 | 81 | ||
77 | static struct platform_device scif1_device = { | 82 | static struct platform_device scif1_device = { |
diff --git a/arch/sh/kernel/cpu/sh4/clock-sh4-202.c b/arch/sh/kernel/cpu/sh4/clock-sh4-202.c index 3f6f8e98635c..f4e262adb39e 100644 --- a/arch/sh/kernel/cpu/sh4/clock-sh4-202.c +++ b/arch/sh/kernel/cpu/sh4/clock-sh4-202.c | |||
@@ -147,8 +147,6 @@ static struct clk *sh4202_onchip_clocks[] = { | |||
147 | &sh4202_shoc_clk, | 147 | &sh4202_shoc_clk, |
148 | }; | 148 | }; |
149 | 149 | ||
150 | #define CLKDEV_CON_ID(_id, _clk) { .con_id = _id, .clk = _clk } | ||
151 | |||
152 | static struct clk_lookup lookups[] = { | 150 | static struct clk_lookup lookups[] = { |
153 | /* main clocks */ | 151 | /* main clocks */ |
154 | CLKDEV_CON_ID("emi_clk", &sh4202_emi_clk), | 152 | CLKDEV_CON_ID("emi_clk", &sh4202_emi_clk), |
diff --git a/arch/sh/kernel/cpu/sh4/setup-sh7750.c b/arch/sh/kernel/cpu/sh4/setup-sh7750.c index e53b4b38bd11..98cc0c794c76 100644 --- a/arch/sh/kernel/cpu/sh4/setup-sh7750.c +++ b/arch/sh/kernel/cpu/sh4/setup-sh7750.c | |||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | * SH7750/SH7751 Setup | 2 | * SH7091/SH7750/SH7750S/SH7750R/SH7751/SH7751R Setup |
3 | * | 3 | * |
4 | * Copyright (C) 2006 Paul Mundt | 4 | * Copyright (C) 2006 Paul Mundt |
5 | * Copyright (C) 2006 Jamie Lenehan | 5 | * Copyright (C) 2006 Jamie Lenehan |
@@ -38,11 +38,13 @@ static struct platform_device rtc_device = { | |||
38 | 38 | ||
39 | static struct plat_sci_port sci_platform_data = { | 39 | static struct plat_sci_port sci_platform_data = { |
40 | .mapbase = 0xffe00000, | 40 | .mapbase = 0xffe00000, |
41 | .port_reg = 0xffe0001C, | ||
41 | .flags = UPF_BOOT_AUTOCONF, | 42 | .flags = UPF_BOOT_AUTOCONF, |
42 | .scscr = SCSCR_TE | SCSCR_RE, | 43 | .scscr = SCSCR_TE | SCSCR_RE, |
43 | .scbrr_algo_id = SCBRR_ALGO_2, | 44 | .scbrr_algo_id = SCBRR_ALGO_2, |
44 | .type = PORT_SCI, | 45 | .type = PORT_SCI, |
45 | .irqs = { 23, 23, 23, 0 }, | 46 | .irqs = { 23, 23, 23, 0 }, |
47 | .regshift = 2, | ||
46 | }; | 48 | }; |
47 | 49 | ||
48 | static struct platform_device sci_device = { | 50 | static struct platform_device sci_device = { |
diff --git a/arch/sh/kernel/cpu/sh4/setup-sh7760.c b/arch/sh/kernel/cpu/sh4/setup-sh7760.c index 78bbf232e391..c0b4c774700e 100644 --- a/arch/sh/kernel/cpu/sh4/setup-sh7760.c +++ b/arch/sh/kernel/cpu/sh4/setup-sh7760.c | |||
@@ -133,6 +133,7 @@ static struct plat_sci_port scif0_platform_data = { | |||
133 | .scbrr_algo_id = SCBRR_ALGO_2, | 133 | .scbrr_algo_id = SCBRR_ALGO_2, |
134 | .type = PORT_SCIF, | 134 | .type = PORT_SCIF, |
135 | .irqs = { 52, 53, 55, 54 }, | 135 | .irqs = { 52, 53, 55, 54 }, |
136 | .regtype = SCIx_SH4_SCIF_FIFODATA_REGTYPE, | ||
136 | }; | 137 | }; |
137 | 138 | ||
138 | static struct platform_device scif0_device = { | 139 | static struct platform_device scif0_device = { |
@@ -150,6 +151,7 @@ static struct plat_sci_port scif1_platform_data = { | |||
150 | .scscr = SCSCR_RE | SCSCR_TE | SCSCR_REIE, | 151 | .scscr = SCSCR_RE | SCSCR_TE | SCSCR_REIE, |
151 | .scbrr_algo_id = SCBRR_ALGO_2, | 152 | .scbrr_algo_id = SCBRR_ALGO_2, |
152 | .irqs = { 72, 73, 75, 74 }, | 153 | .irqs = { 72, 73, 75, 74 }, |
154 | .regtype = SCIx_SH4_SCIF_FIFODATA_REGTYPE, | ||
153 | }; | 155 | }; |
154 | 156 | ||
155 | static struct platform_device scif1_device = { | 157 | static struct platform_device scif1_device = { |
@@ -167,6 +169,7 @@ static struct plat_sci_port scif2_platform_data = { | |||
167 | .scbrr_algo_id = SCBRR_ALGO_2, | 169 | .scbrr_algo_id = SCBRR_ALGO_2, |
168 | .type = PORT_SCIF, | 170 | .type = PORT_SCIF, |
169 | .irqs = { 76, 77, 79, 78 }, | 171 | .irqs = { 76, 77, 79, 78 }, |
172 | .regtype = SCIx_SH4_SCIF_FIFODATA_REGTYPE, | ||
170 | }; | 173 | }; |
171 | 174 | ||
172 | static struct platform_device scif2_device = { | 175 | static struct platform_device scif2_device = { |
@@ -184,6 +187,7 @@ static struct plat_sci_port scif3_platform_data = { | |||
184 | .scbrr_algo_id = SCBRR_ALGO_2, | 187 | .scbrr_algo_id = SCBRR_ALGO_2, |
185 | .type = PORT_SCI, | 188 | .type = PORT_SCI, |
186 | .irqs = { 80, 81, 82, 0 }, | 189 | .irqs = { 80, 81, 82, 0 }, |
190 | .regshift = 2, | ||
187 | }; | 191 | }; |
188 | 192 | ||
189 | static struct platform_device scif3_device = { | 193 | static struct platform_device scif3_device = { |
diff --git a/arch/sh/kernel/cpu/sh4a/Makefile b/arch/sh/kernel/cpu/sh4a/Makefile index cc122b1d3035..c57fb287011e 100644 --- a/arch/sh/kernel/cpu/sh4a/Makefile +++ b/arch/sh/kernel/cpu/sh4a/Makefile | |||
@@ -10,7 +10,7 @@ obj-$(CONFIG_CPU_SUBTYPE_SH7780) += setup-sh7780.o | |||
10 | obj-$(CONFIG_CPU_SUBTYPE_SH7785) += setup-sh7785.o | 10 | obj-$(CONFIG_CPU_SUBTYPE_SH7785) += setup-sh7785.o |
11 | obj-$(CONFIG_CPU_SUBTYPE_SH7786) += setup-sh7786.o intc-shx3.o | 11 | obj-$(CONFIG_CPU_SUBTYPE_SH7786) += setup-sh7786.o intc-shx3.o |
12 | obj-$(CONFIG_CPU_SUBTYPE_SH7343) += setup-sh7343.o | 12 | obj-$(CONFIG_CPU_SUBTYPE_SH7343) += setup-sh7343.o |
13 | obj-$(CONFIG_CPU_SUBTYPE_SH7722) += setup-sh7722.o | 13 | obj-$(CONFIG_CPU_SUBTYPE_SH7722) += setup-sh7722.o serial-sh7722.o |
14 | obj-$(CONFIG_CPU_SUBTYPE_SH7723) += setup-sh7723.o | 14 | obj-$(CONFIG_CPU_SUBTYPE_SH7723) += setup-sh7723.o |
15 | obj-$(CONFIG_CPU_SUBTYPE_SH7724) += setup-sh7724.o | 15 | obj-$(CONFIG_CPU_SUBTYPE_SH7724) += setup-sh7724.o |
16 | obj-$(CONFIG_CPU_SUBTYPE_SH7366) += setup-sh7366.o | 16 | obj-$(CONFIG_CPU_SUBTYPE_SH7366) += setup-sh7366.o |
diff --git a/arch/sh/kernel/cpu/sh4a/clock-sh7343.c b/arch/sh/kernel/cpu/sh4a/clock-sh7343.c index 93c646072c1b..70e45bdaadc7 100644 --- a/arch/sh/kernel/cpu/sh4a/clock-sh7343.c +++ b/arch/sh/kernel/cpu/sh4a/clock-sh7343.c | |||
@@ -194,8 +194,6 @@ static struct clk mstp_clks[MSTP_NR] = { | |||
194 | [MSTP200] = MSTP(&div4_clks[DIV4_B], MSTPCR2, 0, 0), | 194 | [MSTP200] = MSTP(&div4_clks[DIV4_B], MSTPCR2, 0, 0), |
195 | }; | 195 | }; |
196 | 196 | ||
197 | #define CLKDEV_CON_ID(_id, _clk) { .con_id = _id, .clk = _clk } | ||
198 | |||
199 | static struct clk_lookup lookups[] = { | 197 | static struct clk_lookup lookups[] = { |
200 | /* main clocks */ | 198 | /* main clocks */ |
201 | CLKDEV_CON_ID("rclk", &r_clk), | 199 | CLKDEV_CON_ID("rclk", &r_clk), |
@@ -233,32 +231,17 @@ static struct clk_lookup lookups[] = { | |||
233 | CLKDEV_CON_ID("rwdt0", &mstp_clks[MSTP013]), | 231 | CLKDEV_CON_ID("rwdt0", &mstp_clks[MSTP013]), |
234 | CLKDEV_CON_ID("mfi0", &mstp_clks[MSTP011]), | 232 | CLKDEV_CON_ID("mfi0", &mstp_clks[MSTP011]), |
235 | CLKDEV_CON_ID("flctl0", &mstp_clks[MSTP010]), | 233 | CLKDEV_CON_ID("flctl0", &mstp_clks[MSTP010]), |
236 | { | 234 | |
237 | /* SCIF0 */ | 235 | CLKDEV_ICK_ID("sci_fck", "sh-sci.0", &mstp_clks[MSTP007]), |
238 | .dev_id = "sh-sci.0", | 236 | CLKDEV_ICK_ID("sci_fck", "sh-sci.1", &mstp_clks[MSTP006]), |
239 | .con_id = "sci_fck", | 237 | CLKDEV_ICK_ID("sci_fck", "sh-sci.2", &mstp_clks[MSTP005]), |
240 | .clk = &mstp_clks[MSTP007], | 238 | CLKDEV_ICK_ID("sci_fck", "sh-sci.3", &mstp_clks[MSTP004]), |
241 | }, { | 239 | |
242 | /* SCIF1 */ | ||
243 | .dev_id = "sh-sci.1", | ||
244 | .con_id = "sci_fck", | ||
245 | .clk = &mstp_clks[MSTP006], | ||
246 | }, { | ||
247 | /* SCIF2 */ | ||
248 | .dev_id = "sh-sci.2", | ||
249 | .con_id = "sci_fck", | ||
250 | .clk = &mstp_clks[MSTP005], | ||
251 | }, { | ||
252 | /* SCIF3 */ | ||
253 | .dev_id = "sh-sci.3", | ||
254 | .con_id = "sci_fck", | ||
255 | .clk = &mstp_clks[MSTP004], | ||
256 | }, | ||
257 | CLKDEV_CON_ID("sio0", &mstp_clks[MSTP003]), | 240 | CLKDEV_CON_ID("sio0", &mstp_clks[MSTP003]), |
258 | CLKDEV_CON_ID("siof0", &mstp_clks[MSTP002]), | 241 | CLKDEV_CON_ID("siof0", &mstp_clks[MSTP002]), |
259 | CLKDEV_CON_ID("siof1", &mstp_clks[MSTP001]), | 242 | CLKDEV_CON_ID("siof1", &mstp_clks[MSTP001]), |
260 | CLKDEV_CON_ID("i2c0", &mstp_clks[MSTP109]), | 243 | CLKDEV_DEV_ID("i2c-sh_mobile.0", &mstp_clks[MSTP109]), |
261 | CLKDEV_CON_ID("i2c1", &mstp_clks[MSTP108]), | 244 | CLKDEV_DEV_ID("i2c-sh_mobile.1", &mstp_clks[MSTP108]), |
262 | CLKDEV_CON_ID("tpu0", &mstp_clks[MSTP225]), | 245 | CLKDEV_CON_ID("tpu0", &mstp_clks[MSTP225]), |
263 | CLKDEV_CON_ID("irda0", &mstp_clks[MSTP224]), | 246 | CLKDEV_CON_ID("irda0", &mstp_clks[MSTP224]), |
264 | CLKDEV_CON_ID("sdhi0", &mstp_clks[MSTP218]), | 247 | CLKDEV_CON_ID("sdhi0", &mstp_clks[MSTP218]), |
diff --git a/arch/sh/kernel/cpu/sh4a/clock-sh7366.c b/arch/sh/kernel/cpu/sh4a/clock-sh7366.c index 049dc0628ccc..3c3165000c52 100644 --- a/arch/sh/kernel/cpu/sh4a/clock-sh7366.c +++ b/arch/sh/kernel/cpu/sh4a/clock-sh7366.c | |||
@@ -192,8 +192,6 @@ static struct clk mstp_clks[MSTP_NR] = { | |||
192 | [MSTP200] = MSTP(&div4_clks[DIV4_B], MSTPCR2, 0, 0), | 192 | [MSTP200] = MSTP(&div4_clks[DIV4_B], MSTPCR2, 0, 0), |
193 | }; | 193 | }; |
194 | 194 | ||
195 | #define CLKDEV_CON_ID(_id, _clk) { .con_id = _id, .clk = _clk } | ||
196 | |||
197 | static struct clk_lookup lookups[] = { | 195 | static struct clk_lookup lookups[] = { |
198 | /* main clocks */ | 196 | /* main clocks */ |
199 | CLKDEV_CON_ID("rclk", &r_clk), | 197 | CLKDEV_CON_ID("rclk", &r_clk), |
@@ -231,25 +229,14 @@ static struct clk_lookup lookups[] = { | |||
231 | CLKDEV_CON_ID("rwdt0", &mstp_clks[MSTP013]), | 229 | CLKDEV_CON_ID("rwdt0", &mstp_clks[MSTP013]), |
232 | CLKDEV_CON_ID("mfi0", &mstp_clks[MSTP011]), | 230 | CLKDEV_CON_ID("mfi0", &mstp_clks[MSTP011]), |
233 | CLKDEV_CON_ID("flctl0", &mstp_clks[MSTP010]), | 231 | CLKDEV_CON_ID("flctl0", &mstp_clks[MSTP010]), |
234 | { | 232 | |
235 | /* SCIF0 */ | 233 | CLKDEV_ICK_ID("sci_fck", "sh-sci.0", &mstp_clks[MSTP007]), |
236 | .dev_id = "sh-sci.0", | 234 | CLKDEV_ICK_ID("sci_fck", "sh-sci.1", &mstp_clks[MSTP006]), |
237 | .con_id = "sci_fck", | 235 | CLKDEV_ICK_ID("sci_fck", "sh-sci.2", &mstp_clks[MSTP005]), |
238 | .clk = &mstp_clks[MSTP007], | 236 | |
239 | }, { | ||
240 | /* SCIF1 */ | ||
241 | .dev_id = "sh-sci.1", | ||
242 | .con_id = "sci_fck", | ||
243 | .clk = &mstp_clks[MSTP006], | ||
244 | }, { | ||
245 | /* SCIF2 */ | ||
246 | .dev_id = "sh-sci.2", | ||
247 | .con_id = "sci_fck", | ||
248 | .clk = &mstp_clks[MSTP005], | ||
249 | }, | ||
250 | CLKDEV_CON_ID("msiof0", &mstp_clks[MSTP002]), | 237 | CLKDEV_CON_ID("msiof0", &mstp_clks[MSTP002]), |
251 | CLKDEV_CON_ID("sbr0", &mstp_clks[MSTP001]), | 238 | CLKDEV_CON_ID("sbr0", &mstp_clks[MSTP001]), |
252 | CLKDEV_CON_ID("i2c0", &mstp_clks[MSTP109]), | 239 | CLKDEV_DEV_ID("i2c-sh_mobile.0", &mstp_clks[MSTP109]), |
253 | CLKDEV_CON_ID("icb0", &mstp_clks[MSTP227]), | 240 | CLKDEV_CON_ID("icb0", &mstp_clks[MSTP227]), |
254 | CLKDEV_CON_ID("meram0", &mstp_clks[MSTP226]), | 241 | CLKDEV_CON_ID("meram0", &mstp_clks[MSTP226]), |
255 | CLKDEV_CON_ID("dacy1", &mstp_clks[MSTP224]), | 242 | CLKDEV_CON_ID("dacy1", &mstp_clks[MSTP224]), |
diff --git a/arch/sh/kernel/cpu/sh4a/clock-sh7722.c b/arch/sh/kernel/cpu/sh4a/clock-sh7722.c index 9d23a36f0647..c9a48088ad47 100644 --- a/arch/sh/kernel/cpu/sh4a/clock-sh7722.c +++ b/arch/sh/kernel/cpu/sh4a/clock-sh7722.c | |||
@@ -175,8 +175,6 @@ static struct clk mstp_clks[HWBLK_NR] = { | |||
175 | SH_HWBLK_CLK(HWBLK_LCDC, &div4_clks[DIV4_P], 0), | 175 | SH_HWBLK_CLK(HWBLK_LCDC, &div4_clks[DIV4_P], 0), |
176 | }; | 176 | }; |
177 | 177 | ||
178 | #define CLKDEV_CON_ID(_id, _clk) { .con_id = _id, .clk = _clk } | ||
179 | |||
180 | static struct clk_lookup lookups[] = { | 178 | static struct clk_lookup lookups[] = { |
181 | /* main clocks */ | 179 | /* main clocks */ |
182 | CLKDEV_CON_ID("rclk", &r_clk), | 180 | CLKDEV_CON_ID("rclk", &r_clk), |
@@ -201,42 +199,20 @@ static struct clk_lookup lookups[] = { | |||
201 | /* MSTP clocks */ | 199 | /* MSTP clocks */ |
202 | CLKDEV_CON_ID("uram0", &mstp_clks[HWBLK_URAM]), | 200 | CLKDEV_CON_ID("uram0", &mstp_clks[HWBLK_URAM]), |
203 | CLKDEV_CON_ID("xymem0", &mstp_clks[HWBLK_XYMEM]), | 201 | CLKDEV_CON_ID("xymem0", &mstp_clks[HWBLK_XYMEM]), |
204 | { | 202 | |
205 | /* TMU0 */ | 203 | CLKDEV_ICK_ID("tmu_fck", "sh_tmu.0", &mstp_clks[HWBLK_TMU]), |
206 | .dev_id = "sh_tmu.0", | 204 | CLKDEV_ICK_ID("tmu_fck", "sh_tmu.1", &mstp_clks[HWBLK_TMU]), |
207 | .con_id = "tmu_fck", | 205 | CLKDEV_ICK_ID("tmu_fck", "sh_tmu.2", &mstp_clks[HWBLK_TMU]), |
208 | .clk = &mstp_clks[HWBLK_TMU], | 206 | |
209 | }, { | ||
210 | /* TMU1 */ | ||
211 | .dev_id = "sh_tmu.1", | ||
212 | .con_id = "tmu_fck", | ||
213 | .clk = &mstp_clks[HWBLK_TMU], | ||
214 | }, { | ||
215 | /* TMU2 */ | ||
216 | .dev_id = "sh_tmu.2", | ||
217 | .con_id = "tmu_fck", | ||
218 | .clk = &mstp_clks[HWBLK_TMU], | ||
219 | }, | ||
220 | CLKDEV_CON_ID("cmt_fck", &mstp_clks[HWBLK_CMT]), | 207 | CLKDEV_CON_ID("cmt_fck", &mstp_clks[HWBLK_CMT]), |
221 | CLKDEV_CON_ID("rwdt0", &mstp_clks[HWBLK_RWDT]), | 208 | CLKDEV_CON_ID("rwdt0", &mstp_clks[HWBLK_RWDT]), |
222 | CLKDEV_CON_ID("flctl0", &mstp_clks[HWBLK_FLCTL]), | 209 | CLKDEV_CON_ID("flctl0", &mstp_clks[HWBLK_FLCTL]), |
223 | { | 210 | |
224 | /* SCIF0 */ | 211 | CLKDEV_ICK_ID("sci_fck", "sh-sci.0", &mstp_clks[HWBLK_SCIF0]), |
225 | .dev_id = "sh-sci.0", | 212 | CLKDEV_ICK_ID("sci_fck", "sh-sci.1", &mstp_clks[HWBLK_SCIF1]), |
226 | .con_id = "sci_fck", | 213 | CLKDEV_ICK_ID("sci_fck", "sh-sci.2", &mstp_clks[HWBLK_SCIF2]), |
227 | .clk = &mstp_clks[HWBLK_SCIF0], | 214 | |
228 | }, { | 215 | CLKDEV_DEV_ID("i2c-sh_mobile.0", &mstp_clks[HWBLK_IIC]), |
229 | /* SCIF1 */ | ||
230 | .dev_id = "sh-sci.1", | ||
231 | .con_id = "sci_fck", | ||
232 | .clk = &mstp_clks[HWBLK_SCIF1], | ||
233 | }, { | ||
234 | /* SCIF2 */ | ||
235 | .dev_id = "sh-sci.2", | ||
236 | .con_id = "sci_fck", | ||
237 | .clk = &mstp_clks[HWBLK_SCIF2], | ||
238 | }, | ||
239 | CLKDEV_CON_ID("i2c0", &mstp_clks[HWBLK_IIC]), | ||
240 | CLKDEV_CON_ID("rtc0", &mstp_clks[HWBLK_RTC]), | 216 | CLKDEV_CON_ID("rtc0", &mstp_clks[HWBLK_RTC]), |
241 | CLKDEV_CON_ID("sdhi0", &mstp_clks[HWBLK_SDHI]), | 217 | CLKDEV_CON_ID("sdhi0", &mstp_clks[HWBLK_SDHI]), |
242 | CLKDEV_CON_ID("keysc0", &mstp_clks[HWBLK_KEYSC]), | 218 | CLKDEV_CON_ID("keysc0", &mstp_clks[HWBLK_KEYSC]), |
diff --git a/arch/sh/kernel/cpu/sh4a/clock-sh7723.c b/arch/sh/kernel/cpu/sh4a/clock-sh7723.c index 55493cd5bd8f..3cc3827380e3 100644 --- a/arch/sh/kernel/cpu/sh4a/clock-sh7723.c +++ b/arch/sh/kernel/cpu/sh4a/clock-sh7723.c | |||
@@ -200,8 +200,6 @@ static struct clk mstp_clks[] = { | |||
200 | SH_HWBLK_CLK(HWBLK_LCDC, &div4_clks[DIV4_B], 0), | 200 | SH_HWBLK_CLK(HWBLK_LCDC, &div4_clks[DIV4_B], 0), |
201 | }; | 201 | }; |
202 | 202 | ||
203 | #define CLKDEV_CON_ID(_id, _clk) { .con_id = _id, .clk = _clk } | ||
204 | |||
205 | static struct clk_lookup lookups[] = { | 203 | static struct clk_lookup lookups[] = { |
206 | /* main clocks */ | 204 | /* main clocks */ |
207 | CLKDEV_CON_ID("rclk", &r_clk), | 205 | CLKDEV_CON_ID("rclk", &r_clk), |
@@ -305,7 +303,7 @@ static struct clk_lookup lookups[] = { | |||
305 | CLKDEV_CON_ID("msiof0", &mstp_clks[HWBLK_MSIOF0]), | 303 | CLKDEV_CON_ID("msiof0", &mstp_clks[HWBLK_MSIOF0]), |
306 | CLKDEV_CON_ID("msiof1", &mstp_clks[HWBLK_MSIOF1]), | 304 | CLKDEV_CON_ID("msiof1", &mstp_clks[HWBLK_MSIOF1]), |
307 | CLKDEV_CON_ID("meram0", &mstp_clks[HWBLK_MERAM]), | 305 | CLKDEV_CON_ID("meram0", &mstp_clks[HWBLK_MERAM]), |
308 | CLKDEV_CON_ID("i2c0", &mstp_clks[HWBLK_IIC]), | 306 | CLKDEV_DEV_ID("i2c-sh_mobile.0", &mstp_clks[HWBLK_IIC]), |
309 | CLKDEV_CON_ID("rtc0", &mstp_clks[HWBLK_RTC]), | 307 | CLKDEV_CON_ID("rtc0", &mstp_clks[HWBLK_RTC]), |
310 | CLKDEV_CON_ID("atapi0", &mstp_clks[HWBLK_ATAPI]), | 308 | CLKDEV_CON_ID("atapi0", &mstp_clks[HWBLK_ATAPI]), |
311 | CLKDEV_CON_ID("adc0", &mstp_clks[HWBLK_ADC]), | 309 | CLKDEV_CON_ID("adc0", &mstp_clks[HWBLK_ADC]), |
diff --git a/arch/sh/kernel/cpu/sh4a/clock-sh7724.c b/arch/sh/kernel/cpu/sh4a/clock-sh7724.c index d08fa953c88b..8668f557e0ac 100644 --- a/arch/sh/kernel/cpu/sh4a/clock-sh7724.c +++ b/arch/sh/kernel/cpu/sh4a/clock-sh7724.c | |||
@@ -252,8 +252,6 @@ static struct clk mstp_clks[HWBLK_NR] = { | |||
252 | SH_HWBLK_CLK(HWBLK_LCDC, &div4_clks[DIV4_B], 0), | 252 | SH_HWBLK_CLK(HWBLK_LCDC, &div4_clks[DIV4_B], 0), |
253 | }; | 253 | }; |
254 | 254 | ||
255 | #define CLKDEV_CON_ID(_id, _clk) { .con_id = _id, .clk = _clk } | ||
256 | |||
257 | static struct clk_lookup lookups[] = { | 255 | static struct clk_lookup lookups[] = { |
258 | /* main clocks */ | 256 | /* main clocks */ |
259 | CLKDEV_CON_ID("rclk", &r_clk), | 257 | CLKDEV_CON_ID("rclk", &r_clk), |
@@ -289,77 +287,31 @@ static struct clk_lookup lookups[] = { | |||
289 | CLKDEV_CON_ID("sh0", &mstp_clks[HWBLK_SHYWAY]), | 287 | CLKDEV_CON_ID("sh0", &mstp_clks[HWBLK_SHYWAY]), |
290 | CLKDEV_CON_ID("hudi0", &mstp_clks[HWBLK_HUDI]), | 288 | CLKDEV_CON_ID("hudi0", &mstp_clks[HWBLK_HUDI]), |
291 | CLKDEV_CON_ID("ubc0", &mstp_clks[HWBLK_UBC]), | 289 | CLKDEV_CON_ID("ubc0", &mstp_clks[HWBLK_UBC]), |
292 | { | 290 | |
293 | /* TMU0 */ | 291 | CLKDEV_ICK_ID("tmu_fck", "sh_tmu.0", &mstp_clks[HWBLK_TMU0]), |
294 | .dev_id = "sh_tmu.0", | 292 | CLKDEV_ICK_ID("tmu_fck", "sh_tmu.1", &mstp_clks[HWBLK_TMU0]), |
295 | .con_id = "tmu_fck", | 293 | CLKDEV_ICK_ID("tmu_fck", "sh_tmu.2", &mstp_clks[HWBLK_TMU0]), |
296 | .clk = &mstp_clks[HWBLK_TMU0], | 294 | CLKDEV_ICK_ID("tmu_fck", "sh_tmu.3", &mstp_clks[HWBLK_TMU1]), |
297 | }, { | 295 | |
298 | /* TMU1 */ | ||
299 | .dev_id = "sh_tmu.1", | ||
300 | .con_id = "tmu_fck", | ||
301 | .clk = &mstp_clks[HWBLK_TMU0], | ||
302 | }, { | ||
303 | /* TMU2 */ | ||
304 | .dev_id = "sh_tmu.2", | ||
305 | .con_id = "tmu_fck", | ||
306 | .clk = &mstp_clks[HWBLK_TMU0], | ||
307 | }, { | ||
308 | /* TMU3 */ | ||
309 | .dev_id = "sh_tmu.3", | ||
310 | .con_id = "tmu_fck", | ||
311 | .clk = &mstp_clks[HWBLK_TMU1], | ||
312 | }, | ||
313 | CLKDEV_CON_ID("cmt_fck", &mstp_clks[HWBLK_CMT]), | 296 | CLKDEV_CON_ID("cmt_fck", &mstp_clks[HWBLK_CMT]), |
314 | CLKDEV_CON_ID("rwdt0", &mstp_clks[HWBLK_RWDT]), | 297 | CLKDEV_CON_ID("rwdt0", &mstp_clks[HWBLK_RWDT]), |
315 | CLKDEV_CON_ID("dmac1", &mstp_clks[HWBLK_DMAC1]), | 298 | CLKDEV_CON_ID("dmac1", &mstp_clks[HWBLK_DMAC1]), |
316 | { | 299 | |
317 | /* TMU4 */ | 300 | CLKDEV_ICK_ID("tmu_fck", "sh_tmu.4", &mstp_clks[HWBLK_TMU1]), |
318 | .dev_id = "sh_tmu.4", | 301 | CLKDEV_ICK_ID("tmu_fck", "sh_tmu.5", &mstp_clks[HWBLK_TMU1]), |
319 | .con_id = "tmu_fck", | 302 | CLKDEV_ICK_ID("sci_fck", "sh-sci.0", &mstp_clks[HWBLK_SCIF0]), |
320 | .clk = &mstp_clks[HWBLK_TMU1], | 303 | CLKDEV_ICK_ID("sci_fck", "sh-sci.1", &mstp_clks[HWBLK_SCIF1]), |
321 | }, { | 304 | CLKDEV_ICK_ID("sci_fck", "sh-sci.2", &mstp_clks[HWBLK_SCIF2]), |
322 | /* TMU5 */ | 305 | CLKDEV_ICK_ID("sci_fck", "sh-sci.3", &mstp_clks[HWBLK_SCIF3]), |
323 | .dev_id = "sh_tmu.5", | 306 | CLKDEV_ICK_ID("sci_fck", "sh-sci.4", &mstp_clks[HWBLK_SCIF4]), |
324 | .con_id = "tmu_fck", | 307 | CLKDEV_ICK_ID("sci_fck", "sh-sci.5", &mstp_clks[HWBLK_SCIF5]), |
325 | .clk = &mstp_clks[HWBLK_TMU1], | 308 | |
326 | }, { | ||
327 | /* SCIF0 */ | ||
328 | .dev_id = "sh-sci.0", | ||
329 | .con_id = "sci_fck", | ||
330 | .clk = &mstp_clks[HWBLK_SCIF0], | ||
331 | }, { | ||
332 | /* SCIF1 */ | ||
333 | .dev_id = "sh-sci.1", | ||
334 | .con_id = "sci_fck", | ||
335 | .clk = &mstp_clks[HWBLK_SCIF1], | ||
336 | }, { | ||
337 | /* SCIF2 */ | ||
338 | .dev_id = "sh-sci.2", | ||
339 | .con_id = "sci_fck", | ||
340 | .clk = &mstp_clks[HWBLK_SCIF2], | ||
341 | }, { | ||
342 | /* SCIF3 */ | ||
343 | .dev_id = "sh-sci.3", | ||
344 | .con_id = "sci_fck", | ||
345 | .clk = &mstp_clks[HWBLK_SCIF3], | ||
346 | }, { | ||
347 | /* SCIF4 */ | ||
348 | .dev_id = "sh-sci.4", | ||
349 | .con_id = "sci_fck", | ||
350 | .clk = &mstp_clks[HWBLK_SCIF4], | ||
351 | }, { | ||
352 | /* SCIF5 */ | ||
353 | .dev_id = "sh-sci.5", | ||
354 | .con_id = "sci_fck", | ||
355 | .clk = &mstp_clks[HWBLK_SCIF5], | ||
356 | }, | ||
357 | CLKDEV_CON_ID("msiof0", &mstp_clks[HWBLK_MSIOF0]), | 309 | CLKDEV_CON_ID("msiof0", &mstp_clks[HWBLK_MSIOF0]), |
358 | CLKDEV_CON_ID("msiof1", &mstp_clks[HWBLK_MSIOF1]), | 310 | CLKDEV_CON_ID("msiof1", &mstp_clks[HWBLK_MSIOF1]), |
359 | CLKDEV_CON_ID("keysc0", &mstp_clks[HWBLK_KEYSC]), | 311 | CLKDEV_CON_ID("keysc0", &mstp_clks[HWBLK_KEYSC]), |
360 | CLKDEV_CON_ID("rtc0", &mstp_clks[HWBLK_RTC]), | 312 | CLKDEV_CON_ID("rtc0", &mstp_clks[HWBLK_RTC]), |
361 | CLKDEV_CON_ID("i2c0", &mstp_clks[HWBLK_IIC0]), | 313 | CLKDEV_DEV_ID("i2c-sh_mobile.0", &mstp_clks[HWBLK_IIC0]), |
362 | CLKDEV_CON_ID("i2c1", &mstp_clks[HWBLK_IIC1]), | 314 | CLKDEV_DEV_ID("i2c-sh_mobile.1", &mstp_clks[HWBLK_IIC1]), |
363 | CLKDEV_CON_ID("mmc0", &mstp_clks[HWBLK_MMC]), | 315 | CLKDEV_CON_ID("mmc0", &mstp_clks[HWBLK_MMC]), |
364 | CLKDEV_CON_ID("eth0", &mstp_clks[HWBLK_ETHER]), | 316 | CLKDEV_CON_ID("eth0", &mstp_clks[HWBLK_ETHER]), |
365 | CLKDEV_CON_ID("atapi0", &mstp_clks[HWBLK_ATAPI]), | 317 | CLKDEV_CON_ID("atapi0", &mstp_clks[HWBLK_ATAPI]), |
diff --git a/arch/sh/kernel/cpu/sh4a/clock-sh7757.c b/arch/sh/kernel/cpu/sh4a/clock-sh7757.c index eedddad13835..3b097b09a3ba 100644 --- a/arch/sh/kernel/cpu/sh4a/clock-sh7757.c +++ b/arch/sh/kernel/cpu/sh4a/clock-sh7757.c | |||
@@ -101,8 +101,6 @@ static struct clk mstp_clks[MSTP_NR] = { | |||
101 | [MSTP220] = SH_CLK_MSTP32(&div4_clks[DIV4_P], MSTPCR2, 20, 0), | 101 | [MSTP220] = SH_CLK_MSTP32(&div4_clks[DIV4_P], MSTPCR2, 20, 0), |
102 | }; | 102 | }; |
103 | 103 | ||
104 | #define CLKDEV_CON_ID(_id, _clk) { .con_id = _id, .clk = _clk } | ||
105 | |||
106 | static struct clk_lookup lookups[] = { | 104 | static struct clk_lookup lookups[] = { |
107 | /* main clocks */ | 105 | /* main clocks */ |
108 | CLKDEV_CON_ID("extal", &extal_clk), | 106 | CLKDEV_CON_ID("extal", &extal_clk), |
@@ -116,33 +114,13 @@ static struct clk_lookup lookups[] = { | |||
116 | /* MSTP32 clocks */ | 114 | /* MSTP32 clocks */ |
117 | CLKDEV_CON_ID("sdhi0", &mstp_clks[MSTP004]), | 115 | CLKDEV_CON_ID("sdhi0", &mstp_clks[MSTP004]), |
118 | CLKDEV_CON_ID("riic", &mstp_clks[MSTP000]), | 116 | CLKDEV_CON_ID("riic", &mstp_clks[MSTP000]), |
119 | { | 117 | |
120 | /* TMU0 */ | 118 | CLKDEV_ICK_ID("tmu_fck", "sh_tmu.0", &mstp_clks[MSTP113]), |
121 | .dev_id = "sh_tmu.0", | 119 | CLKDEV_ICK_ID("tmu_fck", "sh_tmu.1", &mstp_clks[MSTP114]), |
122 | .con_id = "tmu_fck", | 120 | CLKDEV_ICK_ID("sci_fck", "sh-sci.2", &mstp_clks[MSTP112]), |
123 | .clk = &mstp_clks[MSTP113], | 121 | CLKDEV_ICK_ID("sci_fck", "sh-sci.1", &mstp_clks[MSTP111]), |
124 | }, { | 122 | CLKDEV_ICK_ID("sci_fck", "sh-sci.0", &mstp_clks[MSTP110]), |
125 | /* TMU1 */ | 123 | |
126 | .dev_id = "sh_tmu.1", | ||
127 | .con_id = "tmu_fck", | ||
128 | .clk = &mstp_clks[MSTP114], | ||
129 | }, | ||
130 | { | ||
131 | /* SCIF4 (But, ID is 2) */ | ||
132 | .dev_id = "sh-sci.2", | ||
133 | .con_id = "sci_fck", | ||
134 | .clk = &mstp_clks[MSTP112], | ||
135 | }, { | ||
136 | /* SCIF3 */ | ||
137 | .dev_id = "sh-sci.1", | ||
138 | .con_id = "sci_fck", | ||
139 | .clk = &mstp_clks[MSTP111], | ||
140 | }, { | ||
141 | /* SCIF2 */ | ||
142 | .dev_id = "sh-sci.0", | ||
143 | .con_id = "sci_fck", | ||
144 | .clk = &mstp_clks[MSTP110], | ||
145 | }, | ||
146 | CLKDEV_CON_ID("usb0", &mstp_clks[MSTP102]), | 124 | CLKDEV_CON_ID("usb0", &mstp_clks[MSTP102]), |
147 | CLKDEV_CON_ID("mmc0", &mstp_clks[MSTP220]), | 125 | CLKDEV_CON_ID("mmc0", &mstp_clks[MSTP220]), |
148 | }; | 126 | }; |
diff --git a/arch/sh/kernel/cpu/sh4a/clock-sh7763.c b/arch/sh/kernel/cpu/sh4a/clock-sh7763.c index 599630fc4d3b..2d4c7fd79c02 100644 --- a/arch/sh/kernel/cpu/sh4a/clock-sh7763.c +++ b/arch/sh/kernel/cpu/sh4a/clock-sh7763.c | |||
@@ -91,8 +91,6 @@ static struct clk *sh7763_onchip_clocks[] = { | |||
91 | &sh7763_shyway_clk, | 91 | &sh7763_shyway_clk, |
92 | }; | 92 | }; |
93 | 93 | ||
94 | #define CLKDEV_CON_ID(_id, _clk) { .con_id = _id, .clk = _clk } | ||
95 | |||
96 | static struct clk_lookup lookups[] = { | 94 | static struct clk_lookup lookups[] = { |
97 | /* main clocks */ | 95 | /* main clocks */ |
98 | CLKDEV_CON_ID("shyway_clk", &sh7763_shyway_clk), | 96 | CLKDEV_CON_ID("shyway_clk", &sh7763_shyway_clk), |
diff --git a/arch/sh/kernel/cpu/sh4a/clock-sh7780.c b/arch/sh/kernel/cpu/sh4a/clock-sh7780.c index 8894926479a6..3b53348fe2fc 100644 --- a/arch/sh/kernel/cpu/sh4a/clock-sh7780.c +++ b/arch/sh/kernel/cpu/sh4a/clock-sh7780.c | |||
@@ -97,8 +97,6 @@ static struct clk *sh7780_onchip_clocks[] = { | |||
97 | &sh7780_shyway_clk, | 97 | &sh7780_shyway_clk, |
98 | }; | 98 | }; |
99 | 99 | ||
100 | #define CLKDEV_CON_ID(_id, _clk) { .con_id = _id, .clk = _clk } | ||
101 | |||
102 | static struct clk_lookup lookups[] = { | 100 | static struct clk_lookup lookups[] = { |
103 | /* main clocks */ | 101 | /* main clocks */ |
104 | CLKDEV_CON_ID("shyway_clk", &sh7780_shyway_clk), | 102 | CLKDEV_CON_ID("shyway_clk", &sh7780_shyway_clk), |
diff --git a/arch/sh/kernel/cpu/sh4a/clock-sh7785.c b/arch/sh/kernel/cpu/sh4a/clock-sh7785.c index 2d960247f3eb..e5b420cc1265 100644 --- a/arch/sh/kernel/cpu/sh4a/clock-sh7785.c +++ b/arch/sh/kernel/cpu/sh4a/clock-sh7785.c | |||
@@ -116,8 +116,6 @@ static struct clk mstp_clks[MSTP_NR] = { | |||
116 | [MSTP100] = SH_CLK_MSTP32(NULL, MSTPCR1, 0, 0), | 116 | [MSTP100] = SH_CLK_MSTP32(NULL, MSTPCR1, 0, 0), |
117 | }; | 117 | }; |
118 | 118 | ||
119 | #define CLKDEV_CON_ID(_id, _clk) { .con_id = _id, .clk = _clk } | ||
120 | |||
121 | static struct clk_lookup lookups[] = { | 119 | static struct clk_lookup lookups[] = { |
122 | /* main clocks */ | 120 | /* main clocks */ |
123 | CLKDEV_CON_ID("extal", &extal_clk), | 121 | CLKDEV_CON_ID("extal", &extal_clk), |
@@ -134,74 +132,27 @@ static struct clk_lookup lookups[] = { | |||
134 | CLKDEV_CON_ID("cpu_clk", &div4_clks[DIV4_I]), | 132 | CLKDEV_CON_ID("cpu_clk", &div4_clks[DIV4_I]), |
135 | 133 | ||
136 | /* MSTP32 clocks */ | 134 | /* MSTP32 clocks */ |
137 | { | 135 | CLKDEV_ICK_ID("sci_fck", "sh-sci.5", &mstp_clks[MSTP029]), |
138 | /* SCIF5 */ | 136 | CLKDEV_ICK_ID("sci_fck", "sh-sci.4", &mstp_clks[MSTP028]), |
139 | .dev_id = "sh-sci.5", | 137 | CLKDEV_ICK_ID("sci_fck", "sh-sci.3", &mstp_clks[MSTP027]), |
140 | .con_id = "sci_fck", | 138 | CLKDEV_ICK_ID("sci_fck", "sh-sci.2", &mstp_clks[MSTP026]), |
141 | .clk = &mstp_clks[MSTP029], | 139 | CLKDEV_ICK_ID("sci_fck", "sh-sci.1", &mstp_clks[MSTP025]), |
142 | }, { | 140 | CLKDEV_ICK_ID("sci_fck", "sh-sci.0", &mstp_clks[MSTP024]), |
143 | /* SCIF4 */ | 141 | |
144 | .dev_id = "sh-sci.4", | ||
145 | .con_id = "sci_fck", | ||
146 | .clk = &mstp_clks[MSTP028], | ||
147 | }, { | ||
148 | /* SCIF3 */ | ||
149 | .dev_id = "sh-sci.3", | ||
150 | .con_id = "sci_fck", | ||
151 | .clk = &mstp_clks[MSTP027], | ||
152 | }, { | ||
153 | /* SCIF2 */ | ||
154 | .dev_id = "sh-sci.2", | ||
155 | .con_id = "sci_fck", | ||
156 | .clk = &mstp_clks[MSTP026], | ||
157 | }, { | ||
158 | /* SCIF1 */ | ||
159 | .dev_id = "sh-sci.1", | ||
160 | .con_id = "sci_fck", | ||
161 | .clk = &mstp_clks[MSTP025], | ||
162 | }, { | ||
163 | /* SCIF0 */ | ||
164 | .dev_id = "sh-sci.0", | ||
165 | .con_id = "sci_fck", | ||
166 | .clk = &mstp_clks[MSTP024], | ||
167 | }, | ||
168 | CLKDEV_CON_ID("ssi1_fck", &mstp_clks[MSTP021]), | 142 | CLKDEV_CON_ID("ssi1_fck", &mstp_clks[MSTP021]), |
169 | CLKDEV_CON_ID("ssi0_fck", &mstp_clks[MSTP020]), | 143 | CLKDEV_CON_ID("ssi0_fck", &mstp_clks[MSTP020]), |
170 | CLKDEV_CON_ID("hac1_fck", &mstp_clks[MSTP017]), | 144 | CLKDEV_CON_ID("hac1_fck", &mstp_clks[MSTP017]), |
171 | CLKDEV_CON_ID("hac0_fck", &mstp_clks[MSTP016]), | 145 | CLKDEV_CON_ID("hac0_fck", &mstp_clks[MSTP016]), |
172 | CLKDEV_CON_ID("mmcif_fck", &mstp_clks[MSTP013]), | 146 | CLKDEV_CON_ID("mmcif_fck", &mstp_clks[MSTP013]), |
173 | CLKDEV_CON_ID("flctl_fck", &mstp_clks[MSTP012]), | 147 | CLKDEV_CON_ID("flctl_fck", &mstp_clks[MSTP012]), |
174 | { | 148 | |
175 | /* TMU0 */ | 149 | CLKDEV_ICK_ID("tmu_fck", "sh_tmu.0", &mstp_clks[MSTP008]), |
176 | .dev_id = "sh_tmu.0", | 150 | CLKDEV_ICK_ID("tmu_fck", "sh_tmu.1", &mstp_clks[MSTP008]), |
177 | .con_id = "tmu_fck", | 151 | CLKDEV_ICK_ID("tmu_fck", "sh_tmu.2", &mstp_clks[MSTP008]), |
178 | .clk = &mstp_clks[MSTP008], | 152 | CLKDEV_ICK_ID("tmu_fck", "sh_tmu.3", &mstp_clks[MSTP009]), |
179 | }, { | 153 | CLKDEV_ICK_ID("tmu_fck", "sh_tmu.4", &mstp_clks[MSTP009]), |
180 | /* TMU1 */ | 154 | CLKDEV_ICK_ID("tmu_fck", "sh_tmu.5", &mstp_clks[MSTP009]), |
181 | .dev_id = "sh_tmu.1", | 155 | |
182 | .con_id = "tmu_fck", | ||
183 | .clk = &mstp_clks[MSTP008], | ||
184 | }, { | ||
185 | /* TMU2 */ | ||
186 | .dev_id = "sh_tmu.2", | ||
187 | .con_id = "tmu_fck", | ||
188 | .clk = &mstp_clks[MSTP008], | ||
189 | }, { | ||
190 | /* TMU3 */ | ||
191 | .dev_id = "sh_tmu.3", | ||
192 | .con_id = "tmu_fck", | ||
193 | .clk = &mstp_clks[MSTP009], | ||
194 | }, { | ||
195 | /* TMU4 */ | ||
196 | .dev_id = "sh_tmu.4", | ||
197 | .con_id = "tmu_fck", | ||
198 | .clk = &mstp_clks[MSTP009], | ||
199 | }, { | ||
200 | /* TMU5 */ | ||
201 | .dev_id = "sh_tmu.5", | ||
202 | .con_id = "tmu_fck", | ||
203 | .clk = &mstp_clks[MSTP009], | ||
204 | }, | ||
205 | CLKDEV_CON_ID("siof_fck", &mstp_clks[MSTP003]), | 156 | CLKDEV_CON_ID("siof_fck", &mstp_clks[MSTP003]), |
206 | CLKDEV_CON_ID("hspi_fck", &mstp_clks[MSTP002]), | 157 | CLKDEV_CON_ID("hspi_fck", &mstp_clks[MSTP002]), |
207 | CLKDEV_CON_ID("hudi_fck", &mstp_clks[MSTP119]), | 158 | CLKDEV_CON_ID("hudi_fck", &mstp_clks[MSTP119]), |
diff --git a/arch/sh/kernel/cpu/sh4a/clock-sh7786.c b/arch/sh/kernel/cpu/sh4a/clock-sh7786.c index 42e403be9076..f6c0c3d5599f 100644 --- a/arch/sh/kernel/cpu/sh4a/clock-sh7786.c +++ b/arch/sh/kernel/cpu/sh4a/clock-sh7786.c | |||
@@ -125,8 +125,6 @@ static struct clk mstp_clks[MSTP_NR] = { | |||
125 | [MSTP102] = SH_CLK_MSTP32(NULL, MSTPCR1, 2, 0), | 125 | [MSTP102] = SH_CLK_MSTP32(NULL, MSTPCR1, 2, 0), |
126 | }; | 126 | }; |
127 | 127 | ||
128 | #define CLKDEV_CON_ID(_id, _clk) { .con_id = _id, .clk = _clk } | ||
129 | |||
130 | static struct clk_lookup lookups[] = { | 128 | static struct clk_lookup lookups[] = { |
131 | /* main clocks */ | 129 | /* main clocks */ |
132 | CLKDEV_CON_ID("extal", &extal_clk), | 130 | CLKDEV_CON_ID("extal", &extal_clk), |
@@ -141,37 +139,13 @@ static struct clk_lookup lookups[] = { | |||
141 | CLKDEV_CON_ID("cpu_clk", &div4_clks[DIV4_I]), | 139 | CLKDEV_CON_ID("cpu_clk", &div4_clks[DIV4_I]), |
142 | 140 | ||
143 | /* MSTP32 clocks */ | 141 | /* MSTP32 clocks */ |
144 | { | 142 | CLKDEV_ICK_ID("sci_fck", "sh-sci.5", &mstp_clks[MSTP029]), |
145 | /* SCIF5 */ | 143 | CLKDEV_ICK_ID("sci_fck", "sh-sci.4", &mstp_clks[MSTP028]), |
146 | .dev_id = "sh-sci.5", | 144 | CLKDEV_ICK_ID("sci_fck", "sh-sci.3", &mstp_clks[MSTP027]), |
147 | .con_id = "sci_fck", | 145 | CLKDEV_ICK_ID("sci_fck", "sh-sci.2", &mstp_clks[MSTP026]), |
148 | .clk = &mstp_clks[MSTP029], | 146 | CLKDEV_ICK_ID("sci_fck", "sh-sci.1", &mstp_clks[MSTP025]), |
149 | }, { | 147 | CLKDEV_ICK_ID("sci_fck", "sh-sci.0", &mstp_clks[MSTP024]), |
150 | /* SCIF4 */ | 148 | |
151 | .dev_id = "sh-sci.4", | ||
152 | .con_id = "sci_fck", | ||
153 | .clk = &mstp_clks[MSTP028], | ||
154 | }, { | ||
155 | /* SCIF3 */ | ||
156 | .dev_id = "sh-sci.3", | ||
157 | .con_id = "sci_fck", | ||
158 | .clk = &mstp_clks[MSTP027], | ||
159 | }, { | ||
160 | /* SCIF2 */ | ||
161 | .dev_id = "sh-sci.2", | ||
162 | .con_id = "sci_fck", | ||
163 | .clk = &mstp_clks[MSTP026], | ||
164 | }, { | ||
165 | /* SCIF1 */ | ||
166 | .dev_id = "sh-sci.1", | ||
167 | .con_id = "sci_fck", | ||
168 | .clk = &mstp_clks[MSTP025], | ||
169 | }, { | ||
170 | /* SCIF0 */ | ||
171 | .dev_id = "sh-sci.0", | ||
172 | .con_id = "sci_fck", | ||
173 | .clk = &mstp_clks[MSTP024], | ||
174 | }, | ||
175 | CLKDEV_CON_ID("ssi3_fck", &mstp_clks[MSTP023]), | 149 | CLKDEV_CON_ID("ssi3_fck", &mstp_clks[MSTP023]), |
176 | CLKDEV_CON_ID("ssi2_fck", &mstp_clks[MSTP022]), | 150 | CLKDEV_CON_ID("ssi2_fck", &mstp_clks[MSTP022]), |
177 | CLKDEV_CON_ID("ssi1_fck", &mstp_clks[MSTP021]), | 151 | CLKDEV_CON_ID("ssi1_fck", &mstp_clks[MSTP021]), |
@@ -180,67 +154,20 @@ static struct clk_lookup lookups[] = { | |||
180 | CLKDEV_CON_ID("hac0_fck", &mstp_clks[MSTP016]), | 154 | CLKDEV_CON_ID("hac0_fck", &mstp_clks[MSTP016]), |
181 | CLKDEV_CON_ID("i2c1_fck", &mstp_clks[MSTP015]), | 155 | CLKDEV_CON_ID("i2c1_fck", &mstp_clks[MSTP015]), |
182 | CLKDEV_CON_ID("i2c0_fck", &mstp_clks[MSTP014]), | 156 | CLKDEV_CON_ID("i2c0_fck", &mstp_clks[MSTP014]), |
183 | { | 157 | |
184 | /* TMU0 */ | 158 | CLKDEV_ICK_ID("tmu_fck", "sh_tmu.0", &mstp_clks[MSTP008]), |
185 | .dev_id = "sh_tmu.0", | 159 | CLKDEV_ICK_ID("tmu_fck", "sh_tmu.1", &mstp_clks[MSTP008]), |
186 | .con_id = "tmu_fck", | 160 | CLKDEV_ICK_ID("tmu_fck", "sh_tmu.2", &mstp_clks[MSTP008]), |
187 | .clk = &mstp_clks[MSTP008], | 161 | CLKDEV_ICK_ID("tmu_fck", "sh_tmu.3", &mstp_clks[MSTP009]), |
188 | }, { | 162 | CLKDEV_ICK_ID("tmu_fck", "sh_tmu.4", &mstp_clks[MSTP009]), |
189 | /* TMU1 */ | 163 | CLKDEV_ICK_ID("tmu_fck", "sh_tmu.5", &mstp_clks[MSTP009]), |
190 | .dev_id = "sh_tmu.1", | 164 | CLKDEV_ICK_ID("tmu_fck", "sh_tmu.6", &mstp_clks[MSTP010]), |
191 | .con_id = "tmu_fck", | 165 | CLKDEV_ICK_ID("tmu_fck", "sh_tmu.7", &mstp_clks[MSTP010]), |
192 | .clk = &mstp_clks[MSTP008], | 166 | CLKDEV_ICK_ID("tmu_fck", "sh_tmu.8", &mstp_clks[MSTP010]), |
193 | }, { | 167 | CLKDEV_ICK_ID("tmu_fck", "sh_tmu.9", &mstp_clks[MSTP011]), |
194 | /* TMU2 */ | 168 | CLKDEV_ICK_ID("tmu_fck", "sh_tmu.10", &mstp_clks[MSTP011]), |
195 | .dev_id = "sh_tmu.2", | 169 | CLKDEV_ICK_ID("tmu_fck", "sh_tmu.11", &mstp_clks[MSTP011]), |
196 | .con_id = "tmu_fck", | 170 | |
197 | .clk = &mstp_clks[MSTP008], | ||
198 | }, { | ||
199 | /* TMU3 */ | ||
200 | .dev_id = "sh_tmu.3", | ||
201 | .con_id = "tmu_fck", | ||
202 | .clk = &mstp_clks[MSTP009], | ||
203 | }, { | ||
204 | /* TMU4 */ | ||
205 | .dev_id = "sh_tmu.4", | ||
206 | .con_id = "tmu_fck", | ||
207 | .clk = &mstp_clks[MSTP009], | ||
208 | }, { | ||
209 | /* TMU5 */ | ||
210 | .dev_id = "sh_tmu.5", | ||
211 | .con_id = "tmu_fck", | ||
212 | .clk = &mstp_clks[MSTP009], | ||
213 | }, { | ||
214 | /* TMU6 */ | ||
215 | .dev_id = "sh_tmu.6", | ||
216 | .con_id = "tmu_fck", | ||
217 | .clk = &mstp_clks[MSTP010], | ||
218 | }, { | ||
219 | /* TMU7 */ | ||
220 | .dev_id = "sh_tmu.7", | ||
221 | .con_id = "tmu_fck", | ||
222 | .clk = &mstp_clks[MSTP010], | ||
223 | }, { | ||
224 | /* TMU8 */ | ||
225 | .dev_id = "sh_tmu.8", | ||
226 | .con_id = "tmu_fck", | ||
227 | .clk = &mstp_clks[MSTP010], | ||
228 | }, { | ||
229 | /* TMU9 */ | ||
230 | .dev_id = "sh_tmu.9", | ||
231 | .con_id = "tmu_fck", | ||
232 | .clk = &mstp_clks[MSTP011], | ||
233 | }, { | ||
234 | /* TMU10 */ | ||
235 | .dev_id = "sh_tmu.10", | ||
236 | .con_id = "tmu_fck", | ||
237 | .clk = &mstp_clks[MSTP011], | ||
238 | }, { | ||
239 | /* TMU11 */ | ||
240 | .dev_id = "sh_tmu.11", | ||
241 | .con_id = "tmu_fck", | ||
242 | .clk = &mstp_clks[MSTP011], | ||
243 | }, | ||
244 | CLKDEV_CON_ID("sdif1_fck", &mstp_clks[MSTP005]), | 171 | CLKDEV_CON_ID("sdif1_fck", &mstp_clks[MSTP005]), |
245 | CLKDEV_CON_ID("sdif0_fck", &mstp_clks[MSTP004]), | 172 | CLKDEV_CON_ID("sdif0_fck", &mstp_clks[MSTP004]), |
246 | CLKDEV_CON_ID("hspi_fck", &mstp_clks[MSTP002]), | 173 | CLKDEV_CON_ID("hspi_fck", &mstp_clks[MSTP002]), |
diff --git a/arch/sh/kernel/cpu/sh4a/clock-shx3.c b/arch/sh/kernel/cpu/sh4a/clock-shx3.c index 1afdb93b8ccb..bf2d00b8b908 100644 --- a/arch/sh/kernel/cpu/sh4a/clock-shx3.c +++ b/arch/sh/kernel/cpu/sh4a/clock-shx3.c | |||
@@ -100,8 +100,6 @@ static struct clk mstp_clks[MSTP_NR] = { | |||
100 | [MSTP104] = SH_CLK_MSTP32(NULL, MSTPCR1, 4, 0), | 100 | [MSTP104] = SH_CLK_MSTP32(NULL, MSTPCR1, 4, 0), |
101 | }; | 101 | }; |
102 | 102 | ||
103 | #define CLKDEV_CON_ID(_id, _clk) { .con_id = _id, .clk = _clk } | ||
104 | |||
105 | static struct clk_lookup lookups[] = { | 103 | static struct clk_lookup lookups[] = { |
106 | /* main clocks */ | 104 | /* main clocks */ |
107 | CLKDEV_CON_ID("extal", &extal_clk), | 105 | CLKDEV_CON_ID("extal", &extal_clk), |
@@ -116,62 +114,23 @@ static struct clk_lookup lookups[] = { | |||
116 | CLKDEV_CON_ID("cpu_clk", &div4_clks[DIV4_I]), | 114 | CLKDEV_CON_ID("cpu_clk", &div4_clks[DIV4_I]), |
117 | 115 | ||
118 | /* MSTP32 clocks */ | 116 | /* MSTP32 clocks */ |
119 | { | 117 | CLKDEV_ICK_ID("sci_fck", "sh-sci.3", &mstp_clks[MSTP027]), |
120 | /* SCIF3 */ | 118 | CLKDEV_ICK_ID("sci_fck", "sh-sci.2", &mstp_clks[MSTP026]), |
121 | .dev_id = "sh-sci.3", | 119 | CLKDEV_ICK_ID("sci_fck", "sh-sci.1", &mstp_clks[MSTP025]), |
122 | .con_id = "sci_fck", | 120 | CLKDEV_ICK_ID("sci_fck", "sh-sci.0", &mstp_clks[MSTP024]), |
123 | .clk = &mstp_clks[MSTP027], | 121 | |
124 | }, { | ||
125 | /* SCIF2 */ | ||
126 | .dev_id = "sh-sci.2", | ||
127 | .con_id = "sci_fck", | ||
128 | .clk = &mstp_clks[MSTP026], | ||
129 | }, { | ||
130 | /* SCIF1 */ | ||
131 | .dev_id = "sh-sci.1", | ||
132 | .con_id = "sci_fck", | ||
133 | .clk = &mstp_clks[MSTP025], | ||
134 | }, { | ||
135 | /* SCIF0 */ | ||
136 | .dev_id = "sh-sci.0", | ||
137 | .con_id = "sci_fck", | ||
138 | .clk = &mstp_clks[MSTP024], | ||
139 | }, | ||
140 | CLKDEV_CON_ID("h8ex_fck", &mstp_clks[MSTP003]), | 122 | CLKDEV_CON_ID("h8ex_fck", &mstp_clks[MSTP003]), |
141 | CLKDEV_CON_ID("csm_fck", &mstp_clks[MSTP002]), | 123 | CLKDEV_CON_ID("csm_fck", &mstp_clks[MSTP002]), |
142 | CLKDEV_CON_ID("fe1_fck", &mstp_clks[MSTP001]), | 124 | CLKDEV_CON_ID("fe1_fck", &mstp_clks[MSTP001]), |
143 | CLKDEV_CON_ID("fe0_fck", &mstp_clks[MSTP000]), | 125 | CLKDEV_CON_ID("fe0_fck", &mstp_clks[MSTP000]), |
144 | { | 126 | |
145 | /* TMU0 */ | 127 | CLKDEV_ICK_ID("tmu_fck", "sh_tmu.0", &mstp_clks[MSTP008]), |
146 | .dev_id = "sh_tmu.0", | 128 | CLKDEV_ICK_ID("tmu_fck", "sh_tmu.1", &mstp_clks[MSTP008]), |
147 | .con_id = "tmu_fck", | 129 | CLKDEV_ICK_ID("tmu_fck", "sh_tmu.2", &mstp_clks[MSTP008]), |
148 | .clk = &mstp_clks[MSTP008], | 130 | CLKDEV_ICK_ID("tmu_fck", "sh_tmu.3", &mstp_clks[MSTP009]), |
149 | }, { | 131 | CLKDEV_ICK_ID("tmu_fck", "sh_tmu.4", &mstp_clks[MSTP009]), |
150 | /* TMU1 */ | 132 | CLKDEV_ICK_ID("tmu_fck", "sh_tmu.5", &mstp_clks[MSTP009]), |
151 | .dev_id = "sh_tmu.1", | 133 | |
152 | .con_id = "tmu_fck", | ||
153 | .clk = &mstp_clks[MSTP008], | ||
154 | }, { | ||
155 | /* TMU2 */ | ||
156 | .dev_id = "sh_tmu.2", | ||
157 | .con_id = "tmu_fck", | ||
158 | .clk = &mstp_clks[MSTP008], | ||
159 | }, { | ||
160 | /* TMU3 */ | ||
161 | .dev_id = "sh_tmu.3", | ||
162 | .con_id = "tmu_fck", | ||
163 | .clk = &mstp_clks[MSTP009], | ||
164 | }, { | ||
165 | /* TMU4 */ | ||
166 | .dev_id = "sh_tmu.4", | ||
167 | .con_id = "tmu_fck", | ||
168 | .clk = &mstp_clks[MSTP009], | ||
169 | }, { | ||
170 | /* TMU5 */ | ||
171 | .dev_id = "sh_tmu.5", | ||
172 | .con_id = "tmu_fck", | ||
173 | .clk = &mstp_clks[MSTP009], | ||
174 | }, | ||
175 | CLKDEV_CON_ID("hudi_fck", &mstp_clks[MSTP119]), | 134 | CLKDEV_CON_ID("hudi_fck", &mstp_clks[MSTP119]), |
176 | CLKDEV_CON_ID("dmac_11_6_fck", &mstp_clks[MSTP105]), | 135 | CLKDEV_CON_ID("dmac_11_6_fck", &mstp_clks[MSTP105]), |
177 | CLKDEV_CON_ID("dmac_5_0_fck", &mstp_clks[MSTP104]), | 136 | CLKDEV_CON_ID("dmac_5_0_fck", &mstp_clks[MSTP104]), |
diff --git a/arch/sh/kernel/cpu/sh4a/serial-sh7722.c b/arch/sh/kernel/cpu/sh4a/serial-sh7722.c new file mode 100644 index 000000000000..59bc3a72702e --- /dev/null +++ b/arch/sh/kernel/cpu/sh4a/serial-sh7722.c | |||
@@ -0,0 +1,23 @@ | |||
1 | #include <linux/serial_sci.h> | ||
2 | #include <linux/serial_core.h> | ||
3 | #include <linux/io.h> | ||
4 | |||
5 | #define PSCR 0xA405011E | ||
6 | |||
7 | static void sh7722_sci_init_pins(struct uart_port *port, unsigned int cflag) | ||
8 | { | ||
9 | unsigned short data; | ||
10 | |||
11 | if (port->mapbase == 0xffe00000) { | ||
12 | data = __raw_readw(PSCR); | ||
13 | data &= ~0x03cf; | ||
14 | if (!(cflag & CRTSCTS)) | ||
15 | data |= 0x0340; | ||
16 | |||
17 | __raw_writew(data, PSCR); | ||
18 | } | ||
19 | } | ||
20 | |||
21 | struct plat_sci_port_ops sh7722_sci_port_ops = { | ||
22 | .init_pins = sh7722_sci_init_pins, | ||
23 | }; | ||
diff --git a/arch/sh/kernel/cpu/sh4a/setup-sh7366.c b/arch/sh/kernel/cpu/sh4a/setup-sh7366.c index 82616af64d62..87773869a2f3 100644 --- a/arch/sh/kernel/cpu/sh4a/setup-sh7366.c +++ b/arch/sh/kernel/cpu/sh4a/setup-sh7366.c | |||
@@ -20,6 +20,7 @@ | |||
20 | 20 | ||
21 | static struct plat_sci_port scif0_platform_data = { | 21 | static struct plat_sci_port scif0_platform_data = { |
22 | .mapbase = 0xffe00000, | 22 | .mapbase = 0xffe00000, |
23 | .port_reg = 0xa405013e, | ||
23 | .flags = UPF_BOOT_AUTOCONF, | 24 | .flags = UPF_BOOT_AUTOCONF, |
24 | .scscr = SCSCR_RE | SCSCR_TE | SCSCR_REIE, | 25 | .scscr = SCSCR_RE | SCSCR_TE | SCSCR_REIE, |
25 | .scbrr_algo_id = SCBRR_ALGO_2, | 26 | .scbrr_algo_id = SCBRR_ALGO_2, |
diff --git a/arch/sh/kernel/cpu/sh4a/setup-sh7722.c b/arch/sh/kernel/cpu/sh4a/setup-sh7722.c index 5813d8023619..278a0e572158 100644 --- a/arch/sh/kernel/cpu/sh4a/setup-sh7722.c +++ b/arch/sh/kernel/cpu/sh4a/setup-sh7722.c | |||
@@ -22,6 +22,7 @@ | |||
22 | 22 | ||
23 | #include <cpu/dma-register.h> | 23 | #include <cpu/dma-register.h> |
24 | #include <cpu/sh7722.h> | 24 | #include <cpu/sh7722.h> |
25 | #include <cpu/serial.h> | ||
25 | 26 | ||
26 | static const struct sh_dmae_slave_config sh7722_dmae_slaves[] = { | 27 | static const struct sh_dmae_slave_config sh7722_dmae_slaves[] = { |
27 | { | 28 | { |
@@ -185,6 +186,8 @@ static struct plat_sci_port scif0_platform_data = { | |||
185 | .scbrr_algo_id = SCBRR_ALGO_2, | 186 | .scbrr_algo_id = SCBRR_ALGO_2, |
186 | .type = PORT_SCIF, | 187 | .type = PORT_SCIF, |
187 | .irqs = { 80, 80, 80, 80 }, | 188 | .irqs = { 80, 80, 80, 80 }, |
189 | .ops = &sh7722_sci_port_ops, | ||
190 | .regtype = SCIx_SH4_SCIF_NO_SCSPTR_REGTYPE, | ||
188 | }; | 191 | }; |
189 | 192 | ||
190 | static struct platform_device scif0_device = { | 193 | static struct platform_device scif0_device = { |
@@ -202,6 +205,8 @@ static struct plat_sci_port scif1_platform_data = { | |||
202 | .scbrr_algo_id = SCBRR_ALGO_2, | 205 | .scbrr_algo_id = SCBRR_ALGO_2, |
203 | .type = PORT_SCIF, | 206 | .type = PORT_SCIF, |
204 | .irqs = { 81, 81, 81, 81 }, | 207 | .irqs = { 81, 81, 81, 81 }, |
208 | .ops = &sh7722_sci_port_ops, | ||
209 | .regtype = SCIx_SH4_SCIF_NO_SCSPTR_REGTYPE, | ||
205 | }; | 210 | }; |
206 | 211 | ||
207 | static struct platform_device scif1_device = { | 212 | static struct platform_device scif1_device = { |
@@ -219,6 +224,8 @@ static struct plat_sci_port scif2_platform_data = { | |||
219 | .scbrr_algo_id = SCBRR_ALGO_2, | 224 | .scbrr_algo_id = SCBRR_ALGO_2, |
220 | .type = PORT_SCIF, | 225 | .type = PORT_SCIF, |
221 | .irqs = { 82, 82, 82, 82 }, | 226 | .irqs = { 82, 82, 82, 82 }, |
227 | .ops = &sh7722_sci_port_ops, | ||
228 | .regtype = SCIx_SH4_SCIF_NO_SCSPTR_REGTYPE, | ||
222 | }; | 229 | }; |
223 | 230 | ||
224 | static struct platform_device scif2_device = { | 231 | static struct platform_device scif2_device = { |
diff --git a/arch/sh/kernel/cpu/sh4a/setup-sh7723.c b/arch/sh/kernel/cpu/sh4a/setup-sh7723.c index 072382280f96..3c2810d8f72e 100644 --- a/arch/sh/kernel/cpu/sh4a/setup-sh7723.c +++ b/arch/sh/kernel/cpu/sh4a/setup-sh7723.c | |||
@@ -23,11 +23,13 @@ | |||
23 | /* Serial */ | 23 | /* Serial */ |
24 | static struct plat_sci_port scif0_platform_data = { | 24 | static struct plat_sci_port scif0_platform_data = { |
25 | .mapbase = 0xffe00000, | 25 | .mapbase = 0xffe00000, |
26 | .port_reg = 0xa4050160, | ||
26 | .flags = UPF_BOOT_AUTOCONF, | 27 | .flags = UPF_BOOT_AUTOCONF, |
27 | .scscr = SCSCR_RE | SCSCR_TE | SCSCR_REIE, | 28 | .scscr = SCSCR_RE | SCSCR_TE | SCSCR_REIE, |
28 | .scbrr_algo_id = SCBRR_ALGO_2, | 29 | .scbrr_algo_id = SCBRR_ALGO_2, |
29 | .type = PORT_SCIF, | 30 | .type = PORT_SCIF, |
30 | .irqs = { 80, 80, 80, 80 }, | 31 | .irqs = { 80, 80, 80, 80 }, |
32 | .regtype = SCIx_SH4_SCIF_NO_SCSPTR_REGTYPE, | ||
31 | }; | 33 | }; |
32 | 34 | ||
33 | static struct platform_device scif0_device = { | 35 | static struct platform_device scif0_device = { |
@@ -40,11 +42,13 @@ static struct platform_device scif0_device = { | |||
40 | 42 | ||
41 | static struct plat_sci_port scif1_platform_data = { | 43 | static struct plat_sci_port scif1_platform_data = { |
42 | .mapbase = 0xffe10000, | 44 | .mapbase = 0xffe10000, |
45 | .port_reg = SCIx_NOT_SUPPORTED, | ||
43 | .flags = UPF_BOOT_AUTOCONF, | 46 | .flags = UPF_BOOT_AUTOCONF, |
44 | .scscr = SCSCR_RE | SCSCR_TE | SCSCR_REIE, | 47 | .scscr = SCSCR_RE | SCSCR_TE | SCSCR_REIE, |
45 | .scbrr_algo_id = SCBRR_ALGO_2, | 48 | .scbrr_algo_id = SCBRR_ALGO_2, |
46 | .type = PORT_SCIF, | 49 | .type = PORT_SCIF, |
47 | .irqs = { 81, 81, 81, 81 }, | 50 | .irqs = { 81, 81, 81, 81 }, |
51 | .regtype = SCIx_SH4_SCIF_NO_SCSPTR_REGTYPE, | ||
48 | }; | 52 | }; |
49 | 53 | ||
50 | static struct platform_device scif1_device = { | 54 | static struct platform_device scif1_device = { |
@@ -57,11 +61,13 @@ static struct platform_device scif1_device = { | |||
57 | 61 | ||
58 | static struct plat_sci_port scif2_platform_data = { | 62 | static struct plat_sci_port scif2_platform_data = { |
59 | .mapbase = 0xffe20000, | 63 | .mapbase = 0xffe20000, |
64 | .port_reg = SCIx_NOT_SUPPORTED, | ||
60 | .flags = UPF_BOOT_AUTOCONF, | 65 | .flags = UPF_BOOT_AUTOCONF, |
61 | .scscr = SCSCR_RE | SCSCR_TE | SCSCR_REIE, | 66 | .scscr = SCSCR_RE | SCSCR_TE | SCSCR_REIE, |
62 | .scbrr_algo_id = SCBRR_ALGO_2, | 67 | .scbrr_algo_id = SCBRR_ALGO_2, |
63 | .type = PORT_SCIF, | 68 | .type = PORT_SCIF, |
64 | .irqs = { 82, 82, 82, 82 }, | 69 | .irqs = { 82, 82, 82, 82 }, |
70 | .regtype = SCIx_SH4_SCIF_NO_SCSPTR_REGTYPE, | ||
65 | }; | 71 | }; |
66 | 72 | ||
67 | static struct platform_device scif2_device = { | 73 | static struct platform_device scif2_device = { |
@@ -75,6 +81,7 @@ static struct platform_device scif2_device = { | |||
75 | static struct plat_sci_port scif3_platform_data = { | 81 | static struct plat_sci_port scif3_platform_data = { |
76 | .mapbase = 0xa4e30000, | 82 | .mapbase = 0xa4e30000, |
77 | .flags = UPF_BOOT_AUTOCONF, | 83 | .flags = UPF_BOOT_AUTOCONF, |
84 | .port_reg = SCIx_NOT_SUPPORTED, | ||
78 | .scscr = SCSCR_RE | SCSCR_TE | SCSCR_REIE, | 85 | .scscr = SCSCR_RE | SCSCR_TE | SCSCR_REIE, |
79 | .scbrr_algo_id = SCBRR_ALGO_3, | 86 | .scbrr_algo_id = SCBRR_ALGO_3, |
80 | .type = PORT_SCIFA, | 87 | .type = PORT_SCIFA, |
@@ -91,6 +98,7 @@ static struct platform_device scif3_device = { | |||
91 | 98 | ||
92 | static struct plat_sci_port scif4_platform_data = { | 99 | static struct plat_sci_port scif4_platform_data = { |
93 | .mapbase = 0xa4e40000, | 100 | .mapbase = 0xa4e40000, |
101 | .port_reg = SCIx_NOT_SUPPORTED, | ||
94 | .flags = UPF_BOOT_AUTOCONF, | 102 | .flags = UPF_BOOT_AUTOCONF, |
95 | .scscr = SCSCR_RE | SCSCR_TE | SCSCR_REIE, | 103 | .scscr = SCSCR_RE | SCSCR_TE | SCSCR_REIE, |
96 | .scbrr_algo_id = SCBRR_ALGO_3, | 104 | .scbrr_algo_id = SCBRR_ALGO_3, |
@@ -108,6 +116,7 @@ static struct platform_device scif4_device = { | |||
108 | 116 | ||
109 | static struct plat_sci_port scif5_platform_data = { | 117 | static struct plat_sci_port scif5_platform_data = { |
110 | .mapbase = 0xa4e50000, | 118 | .mapbase = 0xa4e50000, |
119 | .port_reg = SCIx_NOT_SUPPORTED, | ||
111 | .flags = UPF_BOOT_AUTOCONF, | 120 | .flags = UPF_BOOT_AUTOCONF, |
112 | .scscr = SCSCR_RE | SCSCR_TE | SCSCR_REIE, | 121 | .scscr = SCSCR_RE | SCSCR_TE | SCSCR_REIE, |
113 | .scbrr_algo_id = SCBRR_ALGO_3, | 122 | .scbrr_algo_id = SCBRR_ALGO_3, |
diff --git a/arch/sh/kernel/cpu/sh4a/setup-sh7724.c b/arch/sh/kernel/cpu/sh4a/setup-sh7724.c index 134a397b1918..a37dd72c3671 100644 --- a/arch/sh/kernel/cpu/sh4a/setup-sh7724.c +++ b/arch/sh/kernel/cpu/sh4a/setup-sh7724.c | |||
@@ -296,11 +296,13 @@ static struct platform_device dma1_device = { | |||
296 | /* Serial */ | 296 | /* Serial */ |
297 | static struct plat_sci_port scif0_platform_data = { | 297 | static struct plat_sci_port scif0_platform_data = { |
298 | .mapbase = 0xffe00000, | 298 | .mapbase = 0xffe00000, |
299 | .port_reg = SCIx_NOT_SUPPORTED, | ||
299 | .flags = UPF_BOOT_AUTOCONF, | 300 | .flags = UPF_BOOT_AUTOCONF, |
300 | .scscr = SCSCR_RE | SCSCR_TE | SCSCR_REIE, | 301 | .scscr = SCSCR_RE | SCSCR_TE | SCSCR_REIE, |
301 | .scbrr_algo_id = SCBRR_ALGO_2, | 302 | .scbrr_algo_id = SCBRR_ALGO_2, |
302 | .type = PORT_SCIF, | 303 | .type = PORT_SCIF, |
303 | .irqs = { 80, 80, 80, 80 }, | 304 | .irqs = { 80, 80, 80, 80 }, |
305 | .regtype = SCIx_SH4_SCIF_NO_SCSPTR_REGTYPE, | ||
304 | }; | 306 | }; |
305 | 307 | ||
306 | static struct platform_device scif0_device = { | 308 | static struct platform_device scif0_device = { |
@@ -313,11 +315,13 @@ static struct platform_device scif0_device = { | |||
313 | 315 | ||
314 | static struct plat_sci_port scif1_platform_data = { | 316 | static struct plat_sci_port scif1_platform_data = { |
315 | .mapbase = 0xffe10000, | 317 | .mapbase = 0xffe10000, |
318 | .port_reg = SCIx_NOT_SUPPORTED, | ||
316 | .flags = UPF_BOOT_AUTOCONF, | 319 | .flags = UPF_BOOT_AUTOCONF, |
317 | .scscr = SCSCR_RE | SCSCR_TE | SCSCR_REIE, | 320 | .scscr = SCSCR_RE | SCSCR_TE | SCSCR_REIE, |
318 | .scbrr_algo_id = SCBRR_ALGO_2, | 321 | .scbrr_algo_id = SCBRR_ALGO_2, |
319 | .type = PORT_SCIF, | 322 | .type = PORT_SCIF, |
320 | .irqs = { 81, 81, 81, 81 }, | 323 | .irqs = { 81, 81, 81, 81 }, |
324 | .regtype = SCIx_SH4_SCIF_NO_SCSPTR_REGTYPE, | ||
321 | }; | 325 | }; |
322 | 326 | ||
323 | static struct platform_device scif1_device = { | 327 | static struct platform_device scif1_device = { |
@@ -330,11 +334,13 @@ static struct platform_device scif1_device = { | |||
330 | 334 | ||
331 | static struct plat_sci_port scif2_platform_data = { | 335 | static struct plat_sci_port scif2_platform_data = { |
332 | .mapbase = 0xffe20000, | 336 | .mapbase = 0xffe20000, |
337 | .port_reg = SCIx_NOT_SUPPORTED, | ||
333 | .flags = UPF_BOOT_AUTOCONF, | 338 | .flags = UPF_BOOT_AUTOCONF, |
334 | .scscr = SCSCR_RE | SCSCR_TE | SCSCR_REIE, | 339 | .scscr = SCSCR_RE | SCSCR_TE | SCSCR_REIE, |
335 | .scbrr_algo_id = SCBRR_ALGO_2, | 340 | .scbrr_algo_id = SCBRR_ALGO_2, |
336 | .type = PORT_SCIF, | 341 | .type = PORT_SCIF, |
337 | .irqs = { 82, 82, 82, 82 }, | 342 | .irqs = { 82, 82, 82, 82 }, |
343 | .regtype = SCIx_SH4_SCIF_NO_SCSPTR_REGTYPE, | ||
338 | }; | 344 | }; |
339 | 345 | ||
340 | static struct platform_device scif2_device = { | 346 | static struct platform_device scif2_device = { |
@@ -347,6 +353,7 @@ static struct platform_device scif2_device = { | |||
347 | 353 | ||
348 | static struct plat_sci_port scif3_platform_data = { | 354 | static struct plat_sci_port scif3_platform_data = { |
349 | .mapbase = 0xa4e30000, | 355 | .mapbase = 0xa4e30000, |
356 | .port_reg = SCIx_NOT_SUPPORTED, | ||
350 | .flags = UPF_BOOT_AUTOCONF, | 357 | .flags = UPF_BOOT_AUTOCONF, |
351 | .scscr = SCSCR_RE | SCSCR_TE, | 358 | .scscr = SCSCR_RE | SCSCR_TE, |
352 | .scbrr_algo_id = SCBRR_ALGO_3, | 359 | .scbrr_algo_id = SCBRR_ALGO_3, |
@@ -364,6 +371,7 @@ static struct platform_device scif3_device = { | |||
364 | 371 | ||
365 | static struct plat_sci_port scif4_platform_data = { | 372 | static struct plat_sci_port scif4_platform_data = { |
366 | .mapbase = 0xa4e40000, | 373 | .mapbase = 0xa4e40000, |
374 | .port_reg = SCIx_NOT_SUPPORTED, | ||
367 | .flags = UPF_BOOT_AUTOCONF, | 375 | .flags = UPF_BOOT_AUTOCONF, |
368 | .scscr = SCSCR_RE | SCSCR_TE, | 376 | .scscr = SCSCR_RE | SCSCR_TE, |
369 | .scbrr_algo_id = SCBRR_ALGO_3, | 377 | .scbrr_algo_id = SCBRR_ALGO_3, |
@@ -381,6 +389,7 @@ static struct platform_device scif4_device = { | |||
381 | 389 | ||
382 | static struct plat_sci_port scif5_platform_data = { | 390 | static struct plat_sci_port scif5_platform_data = { |
383 | .mapbase = 0xa4e50000, | 391 | .mapbase = 0xa4e50000, |
392 | .port_reg = SCIx_NOT_SUPPORTED, | ||
384 | .flags = UPF_BOOT_AUTOCONF, | 393 | .flags = UPF_BOOT_AUTOCONF, |
385 | .scscr = SCSCR_RE | SCSCR_TE, | 394 | .scscr = SCSCR_RE | SCSCR_TE, |
386 | .scbrr_algo_id = SCBRR_ALGO_3, | 395 | .scbrr_algo_id = SCBRR_ALGO_3, |
diff --git a/arch/sh/kernel/cpu/sh4a/setup-sh7763.c b/arch/sh/kernel/cpu/sh4a/setup-sh7763.c index 593eca6509b5..00113515f233 100644 --- a/arch/sh/kernel/cpu/sh4a/setup-sh7763.c +++ b/arch/sh/kernel/cpu/sh4a/setup-sh7763.c | |||
@@ -23,6 +23,7 @@ static struct plat_sci_port scif0_platform_data = { | |||
23 | .scbrr_algo_id = SCBRR_ALGO_2, | 23 | .scbrr_algo_id = SCBRR_ALGO_2, |
24 | .type = PORT_SCIF, | 24 | .type = PORT_SCIF, |
25 | .irqs = { 40, 40, 40, 40 }, | 25 | .irqs = { 40, 40, 40, 40 }, |
26 | .regtype = SCIx_SH4_SCIF_FIFODATA_REGTYPE, | ||
26 | }; | 27 | }; |
27 | 28 | ||
28 | static struct platform_device scif0_device = { | 29 | static struct platform_device scif0_device = { |
@@ -40,6 +41,7 @@ static struct plat_sci_port scif1_platform_data = { | |||
40 | .scbrr_algo_id = SCBRR_ALGO_2, | 41 | .scbrr_algo_id = SCBRR_ALGO_2, |
41 | .type = PORT_SCIF, | 42 | .type = PORT_SCIF, |
42 | .irqs = { 76, 76, 76, 76 }, | 43 | .irqs = { 76, 76, 76, 76 }, |
44 | .regtype = SCIx_SH4_SCIF_FIFODATA_REGTYPE, | ||
43 | }; | 45 | }; |
44 | 46 | ||
45 | static struct platform_device scif1_device = { | 47 | static struct platform_device scif1_device = { |
@@ -57,6 +59,7 @@ static struct plat_sci_port scif2_platform_data = { | |||
57 | .scbrr_algo_id = SCBRR_ALGO_2, | 59 | .scbrr_algo_id = SCBRR_ALGO_2, |
58 | .type = PORT_SCIF, | 60 | .type = PORT_SCIF, |
59 | .irqs = { 104, 104, 104, 104 }, | 61 | .irqs = { 104, 104, 104, 104 }, |
62 | .regtype = SCIx_SH4_SCIF_FIFODATA_REGTYPE, | ||
60 | }; | 63 | }; |
61 | 64 | ||
62 | static struct platform_device scif2_device = { | 65 | static struct platform_device scif2_device = { |
diff --git a/arch/sh/kernel/cpu/sh4a/setup-sh7780.c b/arch/sh/kernel/cpu/sh4a/setup-sh7780.c index 08add7fa6849..3d4d2075c19a 100644 --- a/arch/sh/kernel/cpu/sh4a/setup-sh7780.c +++ b/arch/sh/kernel/cpu/sh4a/setup-sh7780.c | |||
@@ -14,7 +14,6 @@ | |||
14 | #include <linux/serial_sci.h> | 14 | #include <linux/serial_sci.h> |
15 | #include <linux/sh_dma.h> | 15 | #include <linux/sh_dma.h> |
16 | #include <linux/sh_timer.h> | 16 | #include <linux/sh_timer.h> |
17 | |||
18 | #include <cpu/dma-register.h> | 17 | #include <cpu/dma-register.h> |
19 | 18 | ||
20 | static struct plat_sci_port scif0_platform_data = { | 19 | static struct plat_sci_port scif0_platform_data = { |
@@ -24,6 +23,7 @@ static struct plat_sci_port scif0_platform_data = { | |||
24 | .scbrr_algo_id = SCBRR_ALGO_1, | 23 | .scbrr_algo_id = SCBRR_ALGO_1, |
25 | .type = PORT_SCIF, | 24 | .type = PORT_SCIF, |
26 | .irqs = { 40, 40, 40, 40 }, | 25 | .irqs = { 40, 40, 40, 40 }, |
26 | .regtype = SCIx_SH4_SCIF_FIFODATA_REGTYPE, | ||
27 | }; | 27 | }; |
28 | 28 | ||
29 | static struct platform_device scif0_device = { | 29 | static struct platform_device scif0_device = { |
@@ -41,6 +41,7 @@ static struct plat_sci_port scif1_platform_data = { | |||
41 | .scbrr_algo_id = SCBRR_ALGO_1, | 41 | .scbrr_algo_id = SCBRR_ALGO_1, |
42 | .type = PORT_SCIF, | 42 | .type = PORT_SCIF, |
43 | .irqs = { 76, 76, 76, 76 }, | 43 | .irqs = { 76, 76, 76, 76 }, |
44 | .regtype = SCIx_SH4_SCIF_FIFODATA_REGTYPE, | ||
44 | }; | 45 | }; |
45 | 46 | ||
46 | static struct platform_device scif1_device = { | 47 | static struct platform_device scif1_device = { |
diff --git a/arch/sh/kernel/cpu/sh4a/setup-sh7785.c b/arch/sh/kernel/cpu/sh4a/setup-sh7785.c index 18d8fc136fb2..b29e6340414a 100644 --- a/arch/sh/kernel/cpu/sh4a/setup-sh7785.c +++ b/arch/sh/kernel/cpu/sh4a/setup-sh7785.c | |||
@@ -15,9 +15,7 @@ | |||
15 | #include <linux/mm.h> | 15 | #include <linux/mm.h> |
16 | #include <linux/sh_dma.h> | 16 | #include <linux/sh_dma.h> |
17 | #include <linux/sh_timer.h> | 17 | #include <linux/sh_timer.h> |
18 | |||
19 | #include <asm/mmzone.h> | 18 | #include <asm/mmzone.h> |
20 | |||
21 | #include <cpu/dma-register.h> | 19 | #include <cpu/dma-register.h> |
22 | 20 | ||
23 | static struct plat_sci_port scif0_platform_data = { | 21 | static struct plat_sci_port scif0_platform_data = { |
@@ -27,6 +25,7 @@ static struct plat_sci_port scif0_platform_data = { | |||
27 | .scbrr_algo_id = SCBRR_ALGO_1, | 25 | .scbrr_algo_id = SCBRR_ALGO_1, |
28 | .type = PORT_SCIF, | 26 | .type = PORT_SCIF, |
29 | .irqs = { 40, 40, 40, 40 }, | 27 | .irqs = { 40, 40, 40, 40 }, |
28 | .regtype = SCIx_SH4_SCIF_FIFODATA_REGTYPE, | ||
30 | }; | 29 | }; |
31 | 30 | ||
32 | static struct platform_device scif0_device = { | 31 | static struct platform_device scif0_device = { |
@@ -44,6 +43,7 @@ static struct plat_sci_port scif1_platform_data = { | |||
44 | .scbrr_algo_id = SCBRR_ALGO_1, | 43 | .scbrr_algo_id = SCBRR_ALGO_1, |
45 | .type = PORT_SCIF, | 44 | .type = PORT_SCIF, |
46 | .irqs = { 44, 44, 44, 44 }, | 45 | .irqs = { 44, 44, 44, 44 }, |
46 | .regtype = SCIx_SH4_SCIF_FIFODATA_REGTYPE, | ||
47 | }; | 47 | }; |
48 | 48 | ||
49 | static struct platform_device scif1_device = { | 49 | static struct platform_device scif1_device = { |
@@ -61,6 +61,7 @@ static struct plat_sci_port scif2_platform_data = { | |||
61 | .scbrr_algo_id = SCBRR_ALGO_1, | 61 | .scbrr_algo_id = SCBRR_ALGO_1, |
62 | .type = PORT_SCIF, | 62 | .type = PORT_SCIF, |
63 | .irqs = { 60, 60, 60, 60 }, | 63 | .irqs = { 60, 60, 60, 60 }, |
64 | .regtype = SCIx_SH4_SCIF_FIFODATA_REGTYPE, | ||
64 | }; | 65 | }; |
65 | 66 | ||
66 | static struct platform_device scif2_device = { | 67 | static struct platform_device scif2_device = { |
@@ -78,6 +79,7 @@ static struct plat_sci_port scif3_platform_data = { | |||
78 | .scbrr_algo_id = SCBRR_ALGO_1, | 79 | .scbrr_algo_id = SCBRR_ALGO_1, |
79 | .type = PORT_SCIF, | 80 | .type = PORT_SCIF, |
80 | .irqs = { 61, 61, 61, 61 }, | 81 | .irqs = { 61, 61, 61, 61 }, |
82 | .regtype = SCIx_SH4_SCIF_FIFODATA_REGTYPE, | ||
81 | }; | 83 | }; |
82 | 84 | ||
83 | static struct platform_device scif3_device = { | 85 | static struct platform_device scif3_device = { |
@@ -95,6 +97,7 @@ static struct plat_sci_port scif4_platform_data = { | |||
95 | .scbrr_algo_id = SCBRR_ALGO_1, | 97 | .scbrr_algo_id = SCBRR_ALGO_1, |
96 | .type = PORT_SCIF, | 98 | .type = PORT_SCIF, |
97 | .irqs = { 62, 62, 62, 62 }, | 99 | .irqs = { 62, 62, 62, 62 }, |
100 | .regtype = SCIx_SH4_SCIF_FIFODATA_REGTYPE, | ||
98 | }; | 101 | }; |
99 | 102 | ||
100 | static struct platform_device scif4_device = { | 103 | static struct platform_device scif4_device = { |
@@ -112,6 +115,7 @@ static struct plat_sci_port scif5_platform_data = { | |||
112 | .scbrr_algo_id = SCBRR_ALGO_1, | 115 | .scbrr_algo_id = SCBRR_ALGO_1, |
113 | .type = PORT_SCIF, | 116 | .type = PORT_SCIF, |
114 | .irqs = { 63, 63, 63, 63 }, | 117 | .irqs = { 63, 63, 63, 63 }, |
118 | .regtype = SCIx_SH4_SCIF_FIFODATA_REGTYPE, | ||
115 | }; | 119 | }; |
116 | 120 | ||
117 | static struct platform_device scif5_device = { | 121 | static struct platform_device scif5_device = { |
diff --git a/arch/sh/kernel/cpu/sh4a/setup-sh7786.c b/arch/sh/kernel/cpu/sh4a/setup-sh7786.c index beba32beb6d9..dd5e709f9821 100644 --- a/arch/sh/kernel/cpu/sh4a/setup-sh7786.c +++ b/arch/sh/kernel/cpu/sh4a/setup-sh7786.c | |||
@@ -1,7 +1,7 @@ | |||
1 | /* | 1 | /* |
2 | * SH7786 Setup | 2 | * SH7786 Setup |
3 | * | 3 | * |
4 | * Copyright (C) 2009 - 2010 Renesas Solutions Corp. | 4 | * Copyright (C) 2009 - 2011 Renesas Solutions Corp. |
5 | * Kuninori Morimoto <morimoto.kuninori@renesas.com> | 5 | * Kuninori Morimoto <morimoto.kuninori@renesas.com> |
6 | * Paul Mundt <paul.mundt@renesas.com> | 6 | * Paul Mundt <paul.mundt@renesas.com> |
7 | * | 7 | * |
@@ -33,6 +33,7 @@ static struct plat_sci_port scif0_platform_data = { | |||
33 | .scbrr_algo_id = SCBRR_ALGO_1, | 33 | .scbrr_algo_id = SCBRR_ALGO_1, |
34 | .type = PORT_SCIF, | 34 | .type = PORT_SCIF, |
35 | .irqs = { 40, 41, 43, 42 }, | 35 | .irqs = { 40, 41, 43, 42 }, |
36 | .regtype = SCIx_SH4_SCIF_FIFODATA_REGTYPE, | ||
36 | }; | 37 | }; |
37 | 38 | ||
38 | static struct platform_device scif0_device = { | 39 | static struct platform_device scif0_device = { |
@@ -53,6 +54,7 @@ static struct plat_sci_port scif1_platform_data = { | |||
53 | .scbrr_algo_id = SCBRR_ALGO_1, | 54 | .scbrr_algo_id = SCBRR_ALGO_1, |
54 | .type = PORT_SCIF, | 55 | .type = PORT_SCIF, |
55 | .irqs = { 44, 44, 44, 44 }, | 56 | .irqs = { 44, 44, 44, 44 }, |
57 | .regtype = SCIx_SH4_SCIF_FIFODATA_REGTYPE, | ||
56 | }; | 58 | }; |
57 | 59 | ||
58 | static struct platform_device scif1_device = { | 60 | static struct platform_device scif1_device = { |
@@ -70,6 +72,7 @@ static struct plat_sci_port scif2_platform_data = { | |||
70 | .scbrr_algo_id = SCBRR_ALGO_1, | 72 | .scbrr_algo_id = SCBRR_ALGO_1, |
71 | .type = PORT_SCIF, | 73 | .type = PORT_SCIF, |
72 | .irqs = { 50, 50, 50, 50 }, | 74 | .irqs = { 50, 50, 50, 50 }, |
75 | .regtype = SCIx_SH4_SCIF_FIFODATA_REGTYPE, | ||
73 | }; | 76 | }; |
74 | 77 | ||
75 | static struct platform_device scif2_device = { | 78 | static struct platform_device scif2_device = { |
@@ -87,6 +90,7 @@ static struct plat_sci_port scif3_platform_data = { | |||
87 | .scbrr_algo_id = SCBRR_ALGO_1, | 90 | .scbrr_algo_id = SCBRR_ALGO_1, |
88 | .type = PORT_SCIF, | 91 | .type = PORT_SCIF, |
89 | .irqs = { 51, 51, 51, 51 }, | 92 | .irqs = { 51, 51, 51, 51 }, |
93 | .regtype = SCIx_SH4_SCIF_FIFODATA_REGTYPE, | ||
90 | }; | 94 | }; |
91 | 95 | ||
92 | static struct platform_device scif3_device = { | 96 | static struct platform_device scif3_device = { |
@@ -104,6 +108,7 @@ static struct plat_sci_port scif4_platform_data = { | |||
104 | .scbrr_algo_id = SCBRR_ALGO_1, | 108 | .scbrr_algo_id = SCBRR_ALGO_1, |
105 | .type = PORT_SCIF, | 109 | .type = PORT_SCIF, |
106 | .irqs = { 52, 52, 52, 52 }, | 110 | .irqs = { 52, 52, 52, 52 }, |
111 | .regtype = SCIx_SH4_SCIF_FIFODATA_REGTYPE, | ||
107 | }; | 112 | }; |
108 | 113 | ||
109 | static struct platform_device scif4_device = { | 114 | static struct platform_device scif4_device = { |
@@ -121,6 +126,7 @@ static struct plat_sci_port scif5_platform_data = { | |||
121 | .scbrr_algo_id = SCBRR_ALGO_1, | 126 | .scbrr_algo_id = SCBRR_ALGO_1, |
122 | .type = PORT_SCIF, | 127 | .type = PORT_SCIF, |
123 | .irqs = { 53, 53, 53, 53 }, | 128 | .irqs = { 53, 53, 53, 53 }, |
129 | .regtype = SCIx_SH4_SCIF_FIFODATA_REGTYPE, | ||
124 | }; | 130 | }; |
125 | 131 | ||
126 | static struct platform_device scif5_device = { | 132 | static struct platform_device scif5_device = { |
diff --git a/arch/sh/kernel/idle.c b/arch/sh/kernel/idle.c index 84db0d6ccd0d..32114e0941ae 100644 --- a/arch/sh/kernel/idle.c +++ b/arch/sh/kernel/idle.c | |||
@@ -16,12 +16,13 @@ | |||
16 | #include <linux/thread_info.h> | 16 | #include <linux/thread_info.h> |
17 | #include <linux/irqflags.h> | 17 | #include <linux/irqflags.h> |
18 | #include <linux/smp.h> | 18 | #include <linux/smp.h> |
19 | #include <linux/cpuidle.h> | ||
19 | #include <asm/pgalloc.h> | 20 | #include <asm/pgalloc.h> |
20 | #include <asm/system.h> | 21 | #include <asm/system.h> |
21 | #include <linux/atomic.h> | 22 | #include <linux/atomic.h> |
22 | #include <asm/smp.h> | 23 | #include <asm/smp.h> |
23 | 24 | ||
24 | void (*pm_idle)(void) = NULL; | 25 | static void (*pm_idle)(void); |
25 | 26 | ||
26 | static int hlt_counter; | 27 | static int hlt_counter; |
27 | 28 | ||
@@ -100,7 +101,8 @@ void cpu_idle(void) | |||
100 | local_irq_disable(); | 101 | local_irq_disable(); |
101 | /* Don't trace irqs off for idle */ | 102 | /* Don't trace irqs off for idle */ |
102 | stop_critical_timings(); | 103 | stop_critical_timings(); |
103 | pm_idle(); | 104 | if (cpuidle_idle_call()) |
105 | pm_idle(); | ||
104 | /* | 106 | /* |
105 | * Sanity check to ensure that pm_idle() returns | 107 | * Sanity check to ensure that pm_idle() returns |
106 | * with IRQs enabled | 108 | * with IRQs enabled |
diff --git a/arch/sparc/Kconfig b/arch/sparc/Kconfig index 1074dddcb104..42c67beadcae 100644 --- a/arch/sparc/Kconfig +++ b/arch/sparc/Kconfig | |||
@@ -54,6 +54,7 @@ config SPARC64 | |||
54 | select HAVE_PERF_EVENTS | 54 | select HAVE_PERF_EVENTS |
55 | select PERF_USE_VMALLOC | 55 | select PERF_USE_VMALLOC |
56 | select IRQ_PREFLOW_FASTEOI | 56 | select IRQ_PREFLOW_FASTEOI |
57 | select ARCH_HAVE_NMI_SAFE_CMPXCHG | ||
57 | 58 | ||
58 | config ARCH_DEFCONFIG | 59 | config ARCH_DEFCONFIG |
59 | string | 60 | string |
diff --git a/arch/sparc/include/asm/Kbuild b/arch/sparc/include/asm/Kbuild index 3c93f08ce187..2c2e38821f60 100644 --- a/arch/sparc/include/asm/Kbuild +++ b/arch/sparc/include/asm/Kbuild | |||
@@ -16,3 +16,8 @@ header-y += traps.h | |||
16 | header-y += uctx.h | 16 | header-y += uctx.h |
17 | header-y += utrap.h | 17 | header-y += utrap.h |
18 | header-y += watchdog.h | 18 | header-y += watchdog.h |
19 | |||
20 | generic-y += div64.h | ||
21 | generic-y += local64.h | ||
22 | generic-y += irq_regs.h | ||
23 | generic-y += local.h | ||
diff --git a/arch/sparc/include/asm/bitops_64.h b/arch/sparc/include/asm/bitops_64.h index 325e295d60de..29011cc0e4be 100644 --- a/arch/sparc/include/asm/bitops_64.h +++ b/arch/sparc/include/asm/bitops_64.h | |||
@@ -26,61 +26,28 @@ extern void change_bit(unsigned long nr, volatile unsigned long *addr); | |||
26 | #define smp_mb__before_clear_bit() barrier() | 26 | #define smp_mb__before_clear_bit() barrier() |
27 | #define smp_mb__after_clear_bit() barrier() | 27 | #define smp_mb__after_clear_bit() barrier() |
28 | 28 | ||
29 | #include <asm-generic/bitops/ffz.h> | ||
30 | #include <asm-generic/bitops/__ffs.h> | ||
31 | #include <asm-generic/bitops/fls.h> | 29 | #include <asm-generic/bitops/fls.h> |
32 | #include <asm-generic/bitops/__fls.h> | 30 | #include <asm-generic/bitops/__fls.h> |
33 | #include <asm-generic/bitops/fls64.h> | 31 | #include <asm-generic/bitops/fls64.h> |
34 | 32 | ||
35 | #ifdef __KERNEL__ | 33 | #ifdef __KERNEL__ |
36 | 34 | ||
35 | extern int ffs(int x); | ||
36 | extern unsigned long __ffs(unsigned long); | ||
37 | |||
38 | #include <asm-generic/bitops/ffz.h> | ||
37 | #include <asm-generic/bitops/sched.h> | 39 | #include <asm-generic/bitops/sched.h> |
38 | #include <asm-generic/bitops/ffs.h> | ||
39 | 40 | ||
40 | /* | 41 | /* |
41 | * hweightN: returns the hamming weight (i.e. the number | 42 | * hweightN: returns the hamming weight (i.e. the number |
42 | * of bits set) of a N-bit word | 43 | * of bits set) of a N-bit word |
43 | */ | 44 | */ |
44 | 45 | ||
45 | #ifdef ULTRA_HAS_POPULATION_COUNT | 46 | extern unsigned long __arch_hweight64(__u64 w); |
46 | 47 | extern unsigned int __arch_hweight32(unsigned int w); | |
47 | static inline unsigned int __arch_hweight64(unsigned long w) | 48 | extern unsigned int __arch_hweight16(unsigned int w); |
48 | { | 49 | extern unsigned int __arch_hweight8(unsigned int w); |
49 | unsigned int res; | ||
50 | |||
51 | __asm__ ("popc %1,%0" : "=r" (res) : "r" (w)); | ||
52 | return res; | ||
53 | } | ||
54 | |||
55 | static inline unsigned int __arch_hweight32(unsigned int w) | ||
56 | { | ||
57 | unsigned int res; | ||
58 | |||
59 | __asm__ ("popc %1,%0" : "=r" (res) : "r" (w & 0xffffffff)); | ||
60 | return res; | ||
61 | } | ||
62 | 50 | ||
63 | static inline unsigned int __arch_hweight16(unsigned int w) | ||
64 | { | ||
65 | unsigned int res; | ||
66 | |||
67 | __asm__ ("popc %1,%0" : "=r" (res) : "r" (w & 0xffff)); | ||
68 | return res; | ||
69 | } | ||
70 | |||
71 | static inline unsigned int __arch_hweight8(unsigned int w) | ||
72 | { | ||
73 | unsigned int res; | ||
74 | |||
75 | __asm__ ("popc %1,%0" : "=r" (res) : "r" (w & 0xff)); | ||
76 | return res; | ||
77 | } | ||
78 | |||
79 | #else | ||
80 | |||
81 | #include <asm-generic/bitops/arch_hweight.h> | ||
82 | |||
83 | #endif | ||
84 | #include <asm-generic/bitops/const_hweight.h> | 51 | #include <asm-generic/bitops/const_hweight.h> |
85 | #include <asm-generic/bitops/lock.h> | 52 | #include <asm-generic/bitops/lock.h> |
86 | #endif /* __KERNEL__ */ | 53 | #endif /* __KERNEL__ */ |
diff --git a/arch/sparc/include/asm/div64.h b/arch/sparc/include/asm/div64.h deleted file mode 100644 index 6cd978cefb28..000000000000 --- a/arch/sparc/include/asm/div64.h +++ /dev/null | |||
@@ -1 +0,0 @@ | |||
1 | #include <asm-generic/div64.h> | ||
diff --git a/arch/sparc/include/asm/elf_64.h b/arch/sparc/include/asm/elf_64.h index 64f7a00b3747..7df8b7f544d4 100644 --- a/arch/sparc/include/asm/elf_64.h +++ b/arch/sparc/include/asm/elf_64.h | |||
@@ -59,15 +59,33 @@ | |||
59 | #define R_SPARC_6 45 | 59 | #define R_SPARC_6 45 |
60 | 60 | ||
61 | /* Bits present in AT_HWCAP, primarily for Sparc32. */ | 61 | /* Bits present in AT_HWCAP, primarily for Sparc32. */ |
62 | 62 | #define HWCAP_SPARC_FLUSH 0x00000001 | |
63 | #define HWCAP_SPARC_FLUSH 1 /* CPU supports flush instruction. */ | 63 | #define HWCAP_SPARC_STBAR 0x00000002 |
64 | #define HWCAP_SPARC_STBAR 2 | 64 | #define HWCAP_SPARC_SWAP 0x00000004 |
65 | #define HWCAP_SPARC_SWAP 4 | 65 | #define HWCAP_SPARC_MULDIV 0x00000008 |
66 | #define HWCAP_SPARC_MULDIV 8 | 66 | #define HWCAP_SPARC_V9 0x00000010 |
67 | #define HWCAP_SPARC_V9 16 | 67 | #define HWCAP_SPARC_ULTRA3 0x00000020 |
68 | #define HWCAP_SPARC_ULTRA3 32 | 68 | #define HWCAP_SPARC_BLKINIT 0x00000040 |
69 | #define HWCAP_SPARC_BLKINIT 64 | 69 | #define HWCAP_SPARC_N2 0x00000080 |
70 | #define HWCAP_SPARC_N2 128 | 70 | |
71 | /* Solaris compatible AT_HWCAP bits. */ | ||
72 | #define AV_SPARC_MUL32 0x00000100 /* 32x32 multiply is efficient */ | ||
73 | #define AV_SPARC_DIV32 0x00000200 /* 32x32 divide is efficient */ | ||
74 | #define AV_SPARC_FSMULD 0x00000400 /* 'fsmuld' is efficient */ | ||
75 | #define AV_SPARC_V8PLUS 0x00000800 /* v9 insn available to 32bit */ | ||
76 | #define AV_SPARC_POPC 0x00001000 /* 'popc' is efficient */ | ||
77 | #define AV_SPARC_VIS 0x00002000 /* VIS insns available */ | ||
78 | #define AV_SPARC_VIS2 0x00004000 /* VIS2 insns available */ | ||
79 | #define AV_SPARC_ASI_BLK_INIT 0x00008000 /* block init ASIs available */ | ||
80 | #define AV_SPARC_FMAF 0x00010000 /* fused multiply-add */ | ||
81 | #define AV_SPARC_VIS3 0x00020000 /* VIS3 insns available */ | ||
82 | #define AV_SPARC_HPC 0x00040000 /* HPC insns available */ | ||
83 | #define AV_SPARC_RANDOM 0x00080000 /* 'random' insn available */ | ||
84 | #define AV_SPARC_TRANS 0x00100000 /* transaction insns available */ | ||
85 | #define AV_SPARC_FJFMAU 0x00200000 /* unfused multiply-add */ | ||
86 | #define AV_SPARC_IMA 0x00400000 /* integer multiply-add */ | ||
87 | #define AV_SPARC_ASI_CACHE_SPARING \ | ||
88 | 0x00800000 /* cache sparing ASIs available */ | ||
71 | 89 | ||
72 | #define CORE_DUMP_USE_REGSET | 90 | #define CORE_DUMP_USE_REGSET |
73 | 91 | ||
@@ -162,33 +180,8 @@ typedef struct { | |||
162 | #define ELF_ET_DYN_BASE 0x0000010000000000UL | 180 | #define ELF_ET_DYN_BASE 0x0000010000000000UL |
163 | #define COMPAT_ELF_ET_DYN_BASE 0x0000000070000000UL | 181 | #define COMPAT_ELF_ET_DYN_BASE 0x0000000070000000UL |
164 | 182 | ||
165 | 183 | extern unsigned long sparc64_elf_hwcap; | |
166 | /* This yields a mask that user programs can use to figure out what | 184 | #define ELF_HWCAP sparc64_elf_hwcap |
167 | instruction set this cpu supports. */ | ||
168 | |||
169 | /* On Ultra, we support all of the v8 capabilities. */ | ||
170 | static inline unsigned int sparc64_elf_hwcap(void) | ||
171 | { | ||
172 | unsigned int cap = (HWCAP_SPARC_FLUSH | HWCAP_SPARC_STBAR | | ||
173 | HWCAP_SPARC_SWAP | HWCAP_SPARC_MULDIV | | ||
174 | HWCAP_SPARC_V9); | ||
175 | |||
176 | if (tlb_type == cheetah || tlb_type == cheetah_plus) | ||
177 | cap |= HWCAP_SPARC_ULTRA3; | ||
178 | else if (tlb_type == hypervisor) { | ||
179 | if (sun4v_chip_type == SUN4V_CHIP_NIAGARA1 || | ||
180 | sun4v_chip_type == SUN4V_CHIP_NIAGARA2 || | ||
181 | sun4v_chip_type == SUN4V_CHIP_NIAGARA3) | ||
182 | cap |= HWCAP_SPARC_BLKINIT; | ||
183 | if (sun4v_chip_type == SUN4V_CHIP_NIAGARA2 || | ||
184 | sun4v_chip_type == SUN4V_CHIP_NIAGARA3) | ||
185 | cap |= HWCAP_SPARC_N2; | ||
186 | } | ||
187 | |||
188 | return cap; | ||
189 | } | ||
190 | |||
191 | #define ELF_HWCAP sparc64_elf_hwcap() | ||
192 | 185 | ||
193 | /* This yields a string that ld.so will use to load implementation | 186 | /* This yields a string that ld.so will use to load implementation |
194 | specific libraries for optimization. This is more specific in | 187 | specific libraries for optimization. This is more specific in |
diff --git a/arch/sparc/include/asm/hypervisor.h b/arch/sparc/include/asm/hypervisor.h index 7a5f80df15d0..015a761eaa32 100644 --- a/arch/sparc/include/asm/hypervisor.h +++ b/arch/sparc/include/asm/hypervisor.h | |||
@@ -2927,6 +2927,13 @@ extern unsigned long sun4v_ncs_request(unsigned long request, | |||
2927 | #define HV_FAST_FIRE_GET_PERFREG 0x120 | 2927 | #define HV_FAST_FIRE_GET_PERFREG 0x120 |
2928 | #define HV_FAST_FIRE_SET_PERFREG 0x121 | 2928 | #define HV_FAST_FIRE_SET_PERFREG 0x121 |
2929 | 2929 | ||
2930 | #define HV_FAST_REBOOT_DATA_SET 0x172 | ||
2931 | |||
2932 | #ifndef __ASSEMBLY__ | ||
2933 | extern unsigned long sun4v_reboot_data_set(unsigned long ra, | ||
2934 | unsigned long len); | ||
2935 | #endif | ||
2936 | |||
2930 | /* Function numbers for HV_CORE_TRAP. */ | 2937 | /* Function numbers for HV_CORE_TRAP. */ |
2931 | #define HV_CORE_SET_VER 0x00 | 2938 | #define HV_CORE_SET_VER 0x00 |
2932 | #define HV_CORE_PUTCHAR 0x01 | 2939 | #define HV_CORE_PUTCHAR 0x01 |
@@ -2940,11 +2947,17 @@ extern unsigned long sun4v_ncs_request(unsigned long request, | |||
2940 | #define HV_GRP_CORE 0x0001 | 2947 | #define HV_GRP_CORE 0x0001 |
2941 | #define HV_GRP_INTR 0x0002 | 2948 | #define HV_GRP_INTR 0x0002 |
2942 | #define HV_GRP_SOFT_STATE 0x0003 | 2949 | #define HV_GRP_SOFT_STATE 0x0003 |
2950 | #define HV_GRP_TM 0x0080 | ||
2943 | #define HV_GRP_PCI 0x0100 | 2951 | #define HV_GRP_PCI 0x0100 |
2944 | #define HV_GRP_LDOM 0x0101 | 2952 | #define HV_GRP_LDOM 0x0101 |
2945 | #define HV_GRP_SVC_CHAN 0x0102 | 2953 | #define HV_GRP_SVC_CHAN 0x0102 |
2946 | #define HV_GRP_NCS 0x0103 | 2954 | #define HV_GRP_NCS 0x0103 |
2947 | #define HV_GRP_RNG 0x0104 | 2955 | #define HV_GRP_RNG 0x0104 |
2956 | #define HV_GRP_PBOOT 0x0105 | ||
2957 | #define HV_GRP_TPM 0x0107 | ||
2958 | #define HV_GRP_SDIO 0x0108 | ||
2959 | #define HV_GRP_SDIO_ERR 0x0109 | ||
2960 | #define HV_GRP_REBOOT_DATA 0x0110 | ||
2948 | #define HV_GRP_NIAG_PERF 0x0200 | 2961 | #define HV_GRP_NIAG_PERF 0x0200 |
2949 | #define HV_GRP_FIRE_PERF 0x0201 | 2962 | #define HV_GRP_FIRE_PERF 0x0201 |
2950 | #define HV_GRP_N2_CPU 0x0202 | 2963 | #define HV_GRP_N2_CPU 0x0202 |
diff --git a/arch/sparc/include/asm/irq_regs.h b/arch/sparc/include/asm/irq_regs.h deleted file mode 100644 index 3dd9c0b70270..000000000000 --- a/arch/sparc/include/asm/irq_regs.h +++ /dev/null | |||
@@ -1 +0,0 @@ | |||
1 | #include <asm-generic/irq_regs.h> | ||
diff --git a/arch/sparc/include/asm/leon_pci.h b/arch/sparc/include/asm/leon_pci.h index 42b4b31a82fe..f48527ebdd8f 100644 --- a/arch/sparc/include/asm/leon_pci.h +++ b/arch/sparc/include/asm/leon_pci.h | |||
@@ -12,7 +12,7 @@ struct leon_pci_info { | |||
12 | struct pci_ops *ops; | 12 | struct pci_ops *ops; |
13 | struct resource io_space; | 13 | struct resource io_space; |
14 | struct resource mem_space; | 14 | struct resource mem_space; |
15 | int (*map_irq)(struct pci_dev *dev, u8 slot, u8 pin); | 15 | int (*map_irq)(const struct pci_dev *dev, u8 slot, u8 pin); |
16 | }; | 16 | }; |
17 | 17 | ||
18 | extern void leon_pci_init(struct platform_device *ofdev, | 18 | extern void leon_pci_init(struct platform_device *ofdev, |
diff --git a/arch/sparc/include/asm/local.h b/arch/sparc/include/asm/local.h deleted file mode 100644 index bc80815a435c..000000000000 --- a/arch/sparc/include/asm/local.h +++ /dev/null | |||
@@ -1,6 +0,0 @@ | |||
1 | #ifndef _SPARC_LOCAL_H | ||
2 | #define _SPARC_LOCAL_H | ||
3 | |||
4 | #include <asm-generic/local.h> | ||
5 | |||
6 | #endif | ||
diff --git a/arch/sparc/include/asm/local64.h b/arch/sparc/include/asm/local64.h deleted file mode 100644 index 36c93b5cc239..000000000000 --- a/arch/sparc/include/asm/local64.h +++ /dev/null | |||
@@ -1 +0,0 @@ | |||
1 | #include <asm-generic/local64.h> | ||
diff --git a/arch/sparc/include/asm/tsb.h b/arch/sparc/include/asm/tsb.h index 83c571d8c8a7..1a8afd1ad04f 100644 --- a/arch/sparc/include/asm/tsb.h +++ b/arch/sparc/include/asm/tsb.h | |||
@@ -133,29 +133,6 @@ extern struct tsb_phys_patch_entry __tsb_phys_patch, __tsb_phys_patch_end; | |||
133 | sub TSB, 0x8, TSB; \ | 133 | sub TSB, 0x8, TSB; \ |
134 | TSB_STORE(TSB, TAG); | 134 | TSB_STORE(TSB, TAG); |
135 | 135 | ||
136 | #define KTSB_LOAD_QUAD(TSB, REG) \ | ||
137 | ldda [TSB] ASI_NUCLEUS_QUAD_LDD, REG; | ||
138 | |||
139 | #define KTSB_STORE(ADDR, VAL) \ | ||
140 | stxa VAL, [ADDR] ASI_N; | ||
141 | |||
142 | #define KTSB_LOCK_TAG(TSB, REG1, REG2) \ | ||
143 | 99: lduwa [TSB] ASI_N, REG1; \ | ||
144 | sethi %hi(TSB_TAG_LOCK_HIGH), REG2;\ | ||
145 | andcc REG1, REG2, %g0; \ | ||
146 | bne,pn %icc, 99b; \ | ||
147 | nop; \ | ||
148 | casa [TSB] ASI_N, REG1, REG2;\ | ||
149 | cmp REG1, REG2; \ | ||
150 | bne,pn %icc, 99b; \ | ||
151 | nop; \ | ||
152 | |||
153 | #define KTSB_WRITE(TSB, TTE, TAG) \ | ||
154 | add TSB, 0x8, TSB; \ | ||
155 | stxa TTE, [TSB] ASI_N; \ | ||
156 | sub TSB, 0x8, TSB; \ | ||
157 | stxa TAG, [TSB] ASI_N; | ||
158 | |||
159 | /* Do a kernel page table walk. Leaves physical PTE pointer in | 136 | /* Do a kernel page table walk. Leaves physical PTE pointer in |
160 | * REG1. Jumps to FAIL_LABEL on early page table walk termination. | 137 | * REG1. Jumps to FAIL_LABEL on early page table walk termination. |
161 | * VADDR will not be clobbered, but REG2 will. | 138 | * VADDR will not be clobbered, but REG2 will. |
@@ -239,6 +216,8 @@ extern struct tsb_phys_patch_entry __tsb_phys_patch, __tsb_phys_patch_end; | |||
239 | (KERNEL_TSB_SIZE_BYTES / 16) | 216 | (KERNEL_TSB_SIZE_BYTES / 16) |
240 | #define KERNEL_TSB4M_NENTRIES 4096 | 217 | #define KERNEL_TSB4M_NENTRIES 4096 |
241 | 218 | ||
219 | #define KTSB_PHYS_SHIFT 15 | ||
220 | |||
242 | /* Do a kernel TSB lookup at tl>0 on VADDR+TAG, branch to OK_LABEL | 221 | /* Do a kernel TSB lookup at tl>0 on VADDR+TAG, branch to OK_LABEL |
243 | * on TSB hit. REG1, REG2, REG3, and REG4 are used as temporaries | 222 | * on TSB hit. REG1, REG2, REG3, and REG4 are used as temporaries |
244 | * and the found TTE will be left in REG1. REG3 and REG4 must | 223 | * and the found TTE will be left in REG1. REG3 and REG4 must |
@@ -247,13 +226,22 @@ extern struct tsb_phys_patch_entry __tsb_phys_patch, __tsb_phys_patch_end; | |||
247 | * VADDR and TAG will be preserved and not clobbered by this macro. | 226 | * VADDR and TAG will be preserved and not clobbered by this macro. |
248 | */ | 227 | */ |
249 | #define KERN_TSB_LOOKUP_TL1(VADDR, TAG, REG1, REG2, REG3, REG4, OK_LABEL) \ | 228 | #define KERN_TSB_LOOKUP_TL1(VADDR, TAG, REG1, REG2, REG3, REG4, OK_LABEL) \ |
250 | sethi %hi(swapper_tsb), REG1; \ | 229 | 661: sethi %hi(swapper_tsb), REG1; \ |
251 | or REG1, %lo(swapper_tsb), REG1; \ | 230 | or REG1, %lo(swapper_tsb), REG1; \ |
231 | .section .swapper_tsb_phys_patch, "ax"; \ | ||
232 | .word 661b; \ | ||
233 | .previous; \ | ||
234 | 661: nop; \ | ||
235 | .section .tsb_ldquad_phys_patch, "ax"; \ | ||
236 | .word 661b; \ | ||
237 | sllx REG1, KTSB_PHYS_SHIFT, REG1; \ | ||
238 | sllx REG1, KTSB_PHYS_SHIFT, REG1; \ | ||
239 | .previous; \ | ||
252 | srlx VADDR, PAGE_SHIFT, REG2; \ | 240 | srlx VADDR, PAGE_SHIFT, REG2; \ |
253 | and REG2, (KERNEL_TSB_NENTRIES - 1), REG2; \ | 241 | and REG2, (KERNEL_TSB_NENTRIES - 1), REG2; \ |
254 | sllx REG2, 4, REG2; \ | 242 | sllx REG2, 4, REG2; \ |
255 | add REG1, REG2, REG2; \ | 243 | add REG1, REG2, REG2; \ |
256 | KTSB_LOAD_QUAD(REG2, REG3); \ | 244 | TSB_LOAD_QUAD(REG2, REG3); \ |
257 | cmp REG3, TAG; \ | 245 | cmp REG3, TAG; \ |
258 | be,a,pt %xcc, OK_LABEL; \ | 246 | be,a,pt %xcc, OK_LABEL; \ |
259 | mov REG4, REG1; | 247 | mov REG4, REG1; |
@@ -263,12 +251,21 @@ extern struct tsb_phys_patch_entry __tsb_phys_patch, __tsb_phys_patch_end; | |||
263 | * we can make use of that for the index computation. | 251 | * we can make use of that for the index computation. |
264 | */ | 252 | */ |
265 | #define KERN_TSB4M_LOOKUP_TL1(TAG, REG1, REG2, REG3, REG4, OK_LABEL) \ | 253 | #define KERN_TSB4M_LOOKUP_TL1(TAG, REG1, REG2, REG3, REG4, OK_LABEL) \ |
266 | sethi %hi(swapper_4m_tsb), REG1; \ | 254 | 661: sethi %hi(swapper_4m_tsb), REG1; \ |
267 | or REG1, %lo(swapper_4m_tsb), REG1; \ | 255 | or REG1, %lo(swapper_4m_tsb), REG1; \ |
256 | .section .swapper_4m_tsb_phys_patch, "ax"; \ | ||
257 | .word 661b; \ | ||
258 | .previous; \ | ||
259 | 661: nop; \ | ||
260 | .section .tsb_ldquad_phys_patch, "ax"; \ | ||
261 | .word 661b; \ | ||
262 | sllx REG1, KTSB_PHYS_SHIFT, REG1; \ | ||
263 | sllx REG1, KTSB_PHYS_SHIFT, REG1; \ | ||
264 | .previous; \ | ||
268 | and TAG, (KERNEL_TSB4M_NENTRIES - 1), REG2; \ | 265 | and TAG, (KERNEL_TSB4M_NENTRIES - 1), REG2; \ |
269 | sllx REG2, 4, REG2; \ | 266 | sllx REG2, 4, REG2; \ |
270 | add REG1, REG2, REG2; \ | 267 | add REG1, REG2, REG2; \ |
271 | KTSB_LOAD_QUAD(REG2, REG3); \ | 268 | TSB_LOAD_QUAD(REG2, REG3); \ |
272 | cmp REG3, TAG; \ | 269 | cmp REG3, TAG; \ |
273 | be,a,pt %xcc, OK_LABEL; \ | 270 | be,a,pt %xcc, OK_LABEL; \ |
274 | mov REG4, REG1; | 271 | mov REG4, REG1; |
diff --git a/arch/sparc/kernel/cpu.c b/arch/sparc/kernel/cpu.c index 17cf290dc2bc..9810fd881058 100644 --- a/arch/sparc/kernel/cpu.c +++ b/arch/sparc/kernel/cpu.c | |||
@@ -396,6 +396,7 @@ static int show_cpuinfo(struct seq_file *m, void *__unused) | |||
396 | , cpu_data(0).clock_tick | 396 | , cpu_data(0).clock_tick |
397 | #endif | 397 | #endif |
398 | ); | 398 | ); |
399 | cpucap_info(m); | ||
399 | #ifdef CONFIG_SMP | 400 | #ifdef CONFIG_SMP |
400 | smp_bogo(m); | 401 | smp_bogo(m); |
401 | #endif | 402 | #endif |
diff --git a/arch/sparc/kernel/ds.c b/arch/sparc/kernel/ds.c index dd1342c0a3be..490e5418740d 100644 --- a/arch/sparc/kernel/ds.c +++ b/arch/sparc/kernel/ds.c | |||
@@ -15,12 +15,15 @@ | |||
15 | #include <linux/reboot.h> | 15 | #include <linux/reboot.h> |
16 | #include <linux/cpu.h> | 16 | #include <linux/cpu.h> |
17 | 17 | ||
18 | #include <asm/hypervisor.h> | ||
18 | #include <asm/ldc.h> | 19 | #include <asm/ldc.h> |
19 | #include <asm/vio.h> | 20 | #include <asm/vio.h> |
20 | #include <asm/mdesc.h> | 21 | #include <asm/mdesc.h> |
21 | #include <asm/head.h> | 22 | #include <asm/head.h> |
22 | #include <asm/irq.h> | 23 | #include <asm/irq.h> |
23 | 24 | ||
25 | #include "kernel.h" | ||
26 | |||
24 | #define DRV_MODULE_NAME "ds" | 27 | #define DRV_MODULE_NAME "ds" |
25 | #define PFX DRV_MODULE_NAME ": " | 28 | #define PFX DRV_MODULE_NAME ": " |
26 | #define DRV_MODULE_VERSION "1.0" | 29 | #define DRV_MODULE_VERSION "1.0" |
@@ -828,18 +831,32 @@ void ldom_set_var(const char *var, const char *value) | |||
828 | } | 831 | } |
829 | } | 832 | } |
830 | 833 | ||
834 | static char full_boot_str[256] __attribute__((aligned(32))); | ||
835 | static int reboot_data_supported; | ||
836 | |||
831 | void ldom_reboot(const char *boot_command) | 837 | void ldom_reboot(const char *boot_command) |
832 | { | 838 | { |
833 | /* Don't bother with any of this if the boot_command | 839 | /* Don't bother with any of this if the boot_command |
834 | * is empty. | 840 | * is empty. |
835 | */ | 841 | */ |
836 | if (boot_command && strlen(boot_command)) { | 842 | if (boot_command && strlen(boot_command)) { |
837 | char full_boot_str[256]; | 843 | unsigned long len; |
838 | 844 | ||
839 | strcpy(full_boot_str, "boot "); | 845 | strcpy(full_boot_str, "boot "); |
840 | strcpy(full_boot_str + strlen("boot "), boot_command); | 846 | strcpy(full_boot_str + strlen("boot "), boot_command); |
847 | len = strlen(full_boot_str); | ||
841 | 848 | ||
842 | ldom_set_var("reboot-command", full_boot_str); | 849 | if (reboot_data_supported) { |
850 | unsigned long ra = kimage_addr_to_ra(full_boot_str); | ||
851 | unsigned long hv_ret; | ||
852 | |||
853 | hv_ret = sun4v_reboot_data_set(ra, len); | ||
854 | if (hv_ret != HV_EOK) | ||
855 | pr_err("SUN4V: Unable to set reboot data " | ||
856 | "hv_ret=%lu\n", hv_ret); | ||
857 | } else { | ||
858 | ldom_set_var("reboot-command", full_boot_str); | ||
859 | } | ||
843 | } | 860 | } |
844 | sun4v_mach_sir(); | 861 | sun4v_mach_sir(); |
845 | } | 862 | } |
@@ -1237,6 +1254,15 @@ static struct vio_driver ds_driver = { | |||
1237 | 1254 | ||
1238 | static int __init ds_init(void) | 1255 | static int __init ds_init(void) |
1239 | { | 1256 | { |
1257 | unsigned long hv_ret, major, minor; | ||
1258 | |||
1259 | hv_ret = sun4v_get_version(HV_GRP_REBOOT_DATA, &major, &minor); | ||
1260 | if (hv_ret == HV_EOK) { | ||
1261 | pr_info("SUN4V: Reboot data supported (maj=%lu,min=%lu).\n", | ||
1262 | major, minor); | ||
1263 | reboot_data_supported = 1; | ||
1264 | } | ||
1265 | |||
1240 | kthread_run(ds_thread, NULL, "kldomd"); | 1266 | kthread_run(ds_thread, NULL, "kldomd"); |
1241 | 1267 | ||
1242 | return vio_register_driver(&ds_driver); | 1268 | return vio_register_driver(&ds_driver); |
diff --git a/arch/sparc/kernel/entry.h b/arch/sparc/kernel/entry.h index d1f1361c4167..e27f8ea8656e 100644 --- a/arch/sparc/kernel/entry.h +++ b/arch/sparc/kernel/entry.h | |||
@@ -42,6 +42,20 @@ extern void fpsave(unsigned long *fpregs, unsigned long *fsr, | |||
42 | extern void fpload(unsigned long *fpregs, unsigned long *fsr); | 42 | extern void fpload(unsigned long *fpregs, unsigned long *fsr); |
43 | 43 | ||
44 | #else /* CONFIG_SPARC32 */ | 44 | #else /* CONFIG_SPARC32 */ |
45 | struct popc_3insn_patch_entry { | ||
46 | unsigned int addr; | ||
47 | unsigned int insns[3]; | ||
48 | }; | ||
49 | extern struct popc_3insn_patch_entry __popc_3insn_patch, | ||
50 | __popc_3insn_patch_end; | ||
51 | |||
52 | struct popc_6insn_patch_entry { | ||
53 | unsigned int addr; | ||
54 | unsigned int insns[6]; | ||
55 | }; | ||
56 | extern struct popc_6insn_patch_entry __popc_6insn_patch, | ||
57 | __popc_6insn_patch_end; | ||
58 | |||
45 | extern void __init per_cpu_patch(void); | 59 | extern void __init per_cpu_patch(void); |
46 | extern void __init sun4v_patch(void); | 60 | extern void __init sun4v_patch(void); |
47 | extern void __init boot_cpu_id_too_large(int cpu); | 61 | extern void __init boot_cpu_id_too_large(int cpu); |
diff --git a/arch/sparc/kernel/head_64.S b/arch/sparc/kernel/head_64.S index c752603a7c0d..0eac1b2fc53d 100644 --- a/arch/sparc/kernel/head_64.S +++ b/arch/sparc/kernel/head_64.S | |||
@@ -559,7 +559,7 @@ niagara2_patch: | |||
559 | nop | 559 | nop |
560 | call niagara_patch_bzero | 560 | call niagara_patch_bzero |
561 | nop | 561 | nop |
562 | call niagara2_patch_pageops | 562 | call niagara_patch_pageops |
563 | nop | 563 | nop |
564 | 564 | ||
565 | ba,a,pt %xcc, 80f | 565 | ba,a,pt %xcc, 80f |
diff --git a/arch/sparc/kernel/hvapi.c b/arch/sparc/kernel/hvapi.c index d306e648c33c..c2d055d8ba9e 100644 --- a/arch/sparc/kernel/hvapi.c +++ b/arch/sparc/kernel/hvapi.c | |||
@@ -28,11 +28,17 @@ static struct api_info api_table[] = { | |||
28 | { .group = HV_GRP_CORE, .flags = FLAG_PRE_API }, | 28 | { .group = HV_GRP_CORE, .flags = FLAG_PRE_API }, |
29 | { .group = HV_GRP_INTR, }, | 29 | { .group = HV_GRP_INTR, }, |
30 | { .group = HV_GRP_SOFT_STATE, }, | 30 | { .group = HV_GRP_SOFT_STATE, }, |
31 | { .group = HV_GRP_TM, }, | ||
31 | { .group = HV_GRP_PCI, .flags = FLAG_PRE_API }, | 32 | { .group = HV_GRP_PCI, .flags = FLAG_PRE_API }, |
32 | { .group = HV_GRP_LDOM, }, | 33 | { .group = HV_GRP_LDOM, }, |
33 | { .group = HV_GRP_SVC_CHAN, .flags = FLAG_PRE_API }, | 34 | { .group = HV_GRP_SVC_CHAN, .flags = FLAG_PRE_API }, |
34 | { .group = HV_GRP_NCS, .flags = FLAG_PRE_API }, | 35 | { .group = HV_GRP_NCS, .flags = FLAG_PRE_API }, |
35 | { .group = HV_GRP_RNG, }, | 36 | { .group = HV_GRP_RNG, }, |
37 | { .group = HV_GRP_PBOOT, }, | ||
38 | { .group = HV_GRP_TPM, }, | ||
39 | { .group = HV_GRP_SDIO, }, | ||
40 | { .group = HV_GRP_SDIO_ERR, }, | ||
41 | { .group = HV_GRP_REBOOT_DATA, }, | ||
36 | { .group = HV_GRP_NIAG_PERF, .flags = FLAG_PRE_API }, | 42 | { .group = HV_GRP_NIAG_PERF, .flags = FLAG_PRE_API }, |
37 | { .group = HV_GRP_FIRE_PERF, }, | 43 | { .group = HV_GRP_FIRE_PERF, }, |
38 | { .group = HV_GRP_N2_CPU, }, | 44 | { .group = HV_GRP_N2_CPU, }, |
diff --git a/arch/sparc/kernel/hvcalls.S b/arch/sparc/kernel/hvcalls.S index 8a5f35ffb15e..58d60de4d65b 100644 --- a/arch/sparc/kernel/hvcalls.S +++ b/arch/sparc/kernel/hvcalls.S | |||
@@ -798,3 +798,10 @@ ENTRY(sun4v_niagara2_setperf) | |||
798 | retl | 798 | retl |
799 | nop | 799 | nop |
800 | ENDPROC(sun4v_niagara2_setperf) | 800 | ENDPROC(sun4v_niagara2_setperf) |
801 | |||
802 | ENTRY(sun4v_reboot_data_set) | ||
803 | mov HV_FAST_REBOOT_DATA_SET, %o5 | ||
804 | ta HV_FAST_TRAP | ||
805 | retl | ||
806 | nop | ||
807 | ENDPROC(sun4v_reboot_data_set) | ||
diff --git a/arch/sparc/kernel/ioport.c b/arch/sparc/kernel/ioport.c index 6ffccd6e0156..d0479e2163fa 100644 --- a/arch/sparc/kernel/ioport.c +++ b/arch/sparc/kernel/ioport.c | |||
@@ -65,9 +65,6 @@ static inline void dma_make_coherent(unsigned long pa, unsigned long len) | |||
65 | } | 65 | } |
66 | #endif | 66 | #endif |
67 | 67 | ||
68 | static struct resource *_sparc_find_resource(struct resource *r, | ||
69 | unsigned long); | ||
70 | |||
71 | static void __iomem *_sparc_ioremap(struct resource *res, u32 bus, u32 pa, int sz); | 68 | static void __iomem *_sparc_ioremap(struct resource *res, u32 bus, u32 pa, int sz); |
72 | static void __iomem *_sparc_alloc_io(unsigned int busno, unsigned long phys, | 69 | static void __iomem *_sparc_alloc_io(unsigned int busno, unsigned long phys, |
73 | unsigned long size, char *name); | 70 | unsigned long size, char *name); |
@@ -143,7 +140,11 @@ void iounmap(volatile void __iomem *virtual) | |||
143 | unsigned long vaddr = (unsigned long) virtual & PAGE_MASK; | 140 | unsigned long vaddr = (unsigned long) virtual & PAGE_MASK; |
144 | struct resource *res; | 141 | struct resource *res; |
145 | 142 | ||
146 | if ((res = _sparc_find_resource(&sparc_iomap, vaddr)) == NULL) { | 143 | /* |
144 | * XXX Too slow. Can have 8192 DVMA pages on sun4m in the worst case. | ||
145 | * This probably warrants some sort of hashing. | ||
146 | */ | ||
147 | if ((res = lookup_resource(&sparc_iomap, vaddr)) == NULL) { | ||
147 | printk("free_io/iounmap: cannot free %lx\n", vaddr); | 148 | printk("free_io/iounmap: cannot free %lx\n", vaddr); |
148 | return; | 149 | return; |
149 | } | 150 | } |
@@ -319,7 +320,7 @@ static void sbus_free_coherent(struct device *dev, size_t n, void *p, | |||
319 | struct resource *res; | 320 | struct resource *res; |
320 | struct page *pgv; | 321 | struct page *pgv; |
321 | 322 | ||
322 | if ((res = _sparc_find_resource(&_sparc_dvma, | 323 | if ((res = lookup_resource(&_sparc_dvma, |
323 | (unsigned long)p)) == NULL) { | 324 | (unsigned long)p)) == NULL) { |
324 | printk("sbus_free_consistent: cannot free %p\n", p); | 325 | printk("sbus_free_consistent: cannot free %p\n", p); |
325 | return; | 326 | return; |
@@ -492,7 +493,7 @@ static void pci32_free_coherent(struct device *dev, size_t n, void *p, | |||
492 | { | 493 | { |
493 | struct resource *res; | 494 | struct resource *res; |
494 | 495 | ||
495 | if ((res = _sparc_find_resource(&_sparc_dvma, | 496 | if ((res = lookup_resource(&_sparc_dvma, |
496 | (unsigned long)p)) == NULL) { | 497 | (unsigned long)p)) == NULL) { |
497 | printk("pci_free_consistent: cannot free %p\n", p); | 498 | printk("pci_free_consistent: cannot free %p\n", p); |
498 | return; | 499 | return; |
@@ -715,25 +716,6 @@ static const struct file_operations sparc_io_proc_fops = { | |||
715 | }; | 716 | }; |
716 | #endif /* CONFIG_PROC_FS */ | 717 | #endif /* CONFIG_PROC_FS */ |
717 | 718 | ||
718 | /* | ||
719 | * This is a version of find_resource and it belongs to kernel/resource.c. | ||
720 | * Until we have agreement with Linus and Martin, it lingers here. | ||
721 | * | ||
722 | * XXX Too slow. Can have 8192 DVMA pages on sun4m in the worst case. | ||
723 | * This probably warrants some sort of hashing. | ||
724 | */ | ||
725 | static struct resource *_sparc_find_resource(struct resource *root, | ||
726 | unsigned long hit) | ||
727 | { | ||
728 | struct resource *tmp; | ||
729 | |||
730 | for (tmp = root->child; tmp != 0; tmp = tmp->sibling) { | ||
731 | if (tmp->start <= hit && tmp->end >= hit) | ||
732 | return tmp; | ||
733 | } | ||
734 | return NULL; | ||
735 | } | ||
736 | |||
737 | static void register_proc_sparc_ioport(void) | 719 | static void register_proc_sparc_ioport(void) |
738 | { | 720 | { |
739 | #ifdef CONFIG_PROC_FS | 721 | #ifdef CONFIG_PROC_FS |
diff --git a/arch/sparc/kernel/kernel.h b/arch/sparc/kernel/kernel.h index 6f6544cfa0ef..fd6c36b1df74 100644 --- a/arch/sparc/kernel/kernel.h +++ b/arch/sparc/kernel/kernel.h | |||
@@ -4,12 +4,27 @@ | |||
4 | #include <linux/interrupt.h> | 4 | #include <linux/interrupt.h> |
5 | 5 | ||
6 | #include <asm/traps.h> | 6 | #include <asm/traps.h> |
7 | #include <asm/head.h> | ||
8 | #include <asm/io.h> | ||
7 | 9 | ||
8 | /* cpu.c */ | 10 | /* cpu.c */ |
9 | extern const char *sparc_pmu_type; | 11 | extern const char *sparc_pmu_type; |
10 | extern unsigned int fsr_storage; | 12 | extern unsigned int fsr_storage; |
11 | extern int ncpus_probed; | 13 | extern int ncpus_probed; |
12 | 14 | ||
15 | #ifdef CONFIG_SPARC64 | ||
16 | /* setup_64.c */ | ||
17 | struct seq_file; | ||
18 | extern void cpucap_info(struct seq_file *); | ||
19 | |||
20 | static inline unsigned long kimage_addr_to_ra(const char *p) | ||
21 | { | ||
22 | unsigned long val = (unsigned long) p; | ||
23 | |||
24 | return kern_base + (val - KERNBASE); | ||
25 | } | ||
26 | #endif | ||
27 | |||
13 | #ifdef CONFIG_SPARC32 | 28 | #ifdef CONFIG_SPARC32 |
14 | /* cpu.c */ | 29 | /* cpu.c */ |
15 | extern void cpu_probe(void); | 30 | extern void cpu_probe(void); |
diff --git a/arch/sparc/kernel/ktlb.S b/arch/sparc/kernel/ktlb.S index 1d361477d7d6..79f310364849 100644 --- a/arch/sparc/kernel/ktlb.S +++ b/arch/sparc/kernel/ktlb.S | |||
@@ -47,16 +47,16 @@ kvmap_itlb_tsb_miss: | |||
47 | kvmap_itlb_vmalloc_addr: | 47 | kvmap_itlb_vmalloc_addr: |
48 | KERN_PGTABLE_WALK(%g4, %g5, %g2, kvmap_itlb_longpath) | 48 | KERN_PGTABLE_WALK(%g4, %g5, %g2, kvmap_itlb_longpath) |
49 | 49 | ||
50 | KTSB_LOCK_TAG(%g1, %g2, %g7) | 50 | TSB_LOCK_TAG(%g1, %g2, %g7) |
51 | 51 | ||
52 | /* Load and check PTE. */ | 52 | /* Load and check PTE. */ |
53 | ldxa [%g5] ASI_PHYS_USE_EC, %g5 | 53 | ldxa [%g5] ASI_PHYS_USE_EC, %g5 |
54 | mov 1, %g7 | 54 | mov 1, %g7 |
55 | sllx %g7, TSB_TAG_INVALID_BIT, %g7 | 55 | sllx %g7, TSB_TAG_INVALID_BIT, %g7 |
56 | brgez,a,pn %g5, kvmap_itlb_longpath | 56 | brgez,a,pn %g5, kvmap_itlb_longpath |
57 | KTSB_STORE(%g1, %g7) | 57 | TSB_STORE(%g1, %g7) |
58 | 58 | ||
59 | KTSB_WRITE(%g1, %g5, %g6) | 59 | TSB_WRITE(%g1, %g5, %g6) |
60 | 60 | ||
61 | /* fallthrough to TLB load */ | 61 | /* fallthrough to TLB load */ |
62 | 62 | ||
@@ -102,9 +102,9 @@ kvmap_itlb_longpath: | |||
102 | kvmap_itlb_obp: | 102 | kvmap_itlb_obp: |
103 | OBP_TRANS_LOOKUP(%g4, %g5, %g2, %g3, kvmap_itlb_longpath) | 103 | OBP_TRANS_LOOKUP(%g4, %g5, %g2, %g3, kvmap_itlb_longpath) |
104 | 104 | ||
105 | KTSB_LOCK_TAG(%g1, %g2, %g7) | 105 | TSB_LOCK_TAG(%g1, %g2, %g7) |
106 | 106 | ||
107 | KTSB_WRITE(%g1, %g5, %g6) | 107 | TSB_WRITE(%g1, %g5, %g6) |
108 | 108 | ||
109 | ba,pt %xcc, kvmap_itlb_load | 109 | ba,pt %xcc, kvmap_itlb_load |
110 | nop | 110 | nop |
@@ -112,17 +112,17 @@ kvmap_itlb_obp: | |||
112 | kvmap_dtlb_obp: | 112 | kvmap_dtlb_obp: |
113 | OBP_TRANS_LOOKUP(%g4, %g5, %g2, %g3, kvmap_dtlb_longpath) | 113 | OBP_TRANS_LOOKUP(%g4, %g5, %g2, %g3, kvmap_dtlb_longpath) |
114 | 114 | ||
115 | KTSB_LOCK_TAG(%g1, %g2, %g7) | 115 | TSB_LOCK_TAG(%g1, %g2, %g7) |
116 | 116 | ||
117 | KTSB_WRITE(%g1, %g5, %g6) | 117 | TSB_WRITE(%g1, %g5, %g6) |
118 | 118 | ||
119 | ba,pt %xcc, kvmap_dtlb_load | 119 | ba,pt %xcc, kvmap_dtlb_load |
120 | nop | 120 | nop |
121 | 121 | ||
122 | .align 32 | 122 | .align 32 |
123 | kvmap_dtlb_tsb4m_load: | 123 | kvmap_dtlb_tsb4m_load: |
124 | KTSB_LOCK_TAG(%g1, %g2, %g7) | 124 | TSB_LOCK_TAG(%g1, %g2, %g7) |
125 | KTSB_WRITE(%g1, %g5, %g6) | 125 | TSB_WRITE(%g1, %g5, %g6) |
126 | ba,pt %xcc, kvmap_dtlb_load | 126 | ba,pt %xcc, kvmap_dtlb_load |
127 | nop | 127 | nop |
128 | 128 | ||
@@ -222,16 +222,16 @@ kvmap_linear_patch: | |||
222 | kvmap_dtlb_vmalloc_addr: | 222 | kvmap_dtlb_vmalloc_addr: |
223 | KERN_PGTABLE_WALK(%g4, %g5, %g2, kvmap_dtlb_longpath) | 223 | KERN_PGTABLE_WALK(%g4, %g5, %g2, kvmap_dtlb_longpath) |
224 | 224 | ||
225 | KTSB_LOCK_TAG(%g1, %g2, %g7) | 225 | TSB_LOCK_TAG(%g1, %g2, %g7) |
226 | 226 | ||
227 | /* Load and check PTE. */ | 227 | /* Load and check PTE. */ |
228 | ldxa [%g5] ASI_PHYS_USE_EC, %g5 | 228 | ldxa [%g5] ASI_PHYS_USE_EC, %g5 |
229 | mov 1, %g7 | 229 | mov 1, %g7 |
230 | sllx %g7, TSB_TAG_INVALID_BIT, %g7 | 230 | sllx %g7, TSB_TAG_INVALID_BIT, %g7 |
231 | brgez,a,pn %g5, kvmap_dtlb_longpath | 231 | brgez,a,pn %g5, kvmap_dtlb_longpath |
232 | KTSB_STORE(%g1, %g7) | 232 | TSB_STORE(%g1, %g7) |
233 | 233 | ||
234 | KTSB_WRITE(%g1, %g5, %g6) | 234 | TSB_WRITE(%g1, %g5, %g6) |
235 | 235 | ||
236 | /* fallthrough to TLB load */ | 236 | /* fallthrough to TLB load */ |
237 | 237 | ||
diff --git a/arch/sparc/kernel/leon_pci_grpci2.c b/arch/sparc/kernel/leon_pci_grpci2.c index 44dc093ee33a..fad1bd07cb56 100644 --- a/arch/sparc/kernel/leon_pci_grpci2.c +++ b/arch/sparc/kernel/leon_pci_grpci2.c | |||
@@ -215,7 +215,7 @@ struct grpci2_priv { | |||
215 | DEFINE_SPINLOCK(grpci2_dev_lock); | 215 | DEFINE_SPINLOCK(grpci2_dev_lock); |
216 | struct grpci2_priv *grpci2priv; | 216 | struct grpci2_priv *grpci2priv; |
217 | 217 | ||
218 | int grpci2_map_irq(struct pci_dev *dev, u8 slot, u8 pin) | 218 | int grpci2_map_irq(const struct pci_dev *dev, u8 slot, u8 pin) |
219 | { | 219 | { |
220 | struct grpci2_priv *priv = dev->bus->sysdata; | 220 | struct grpci2_priv *priv = dev->bus->sysdata; |
221 | int irq_group; | 221 | int irq_group; |
diff --git a/arch/sparc/kernel/mdesc.c b/arch/sparc/kernel/mdesc.c index 42f28c7420e1..acaebb63c4fd 100644 --- a/arch/sparc/kernel/mdesc.c +++ b/arch/sparc/kernel/mdesc.c | |||
@@ -508,6 +508,8 @@ const char *mdesc_node_name(struct mdesc_handle *hp, u64 node) | |||
508 | } | 508 | } |
509 | EXPORT_SYMBOL(mdesc_node_name); | 509 | EXPORT_SYMBOL(mdesc_node_name); |
510 | 510 | ||
511 | static u64 max_cpus = 64; | ||
512 | |||
511 | static void __init report_platform_properties(void) | 513 | static void __init report_platform_properties(void) |
512 | { | 514 | { |
513 | struct mdesc_handle *hp = mdesc_grab(); | 515 | struct mdesc_handle *hp = mdesc_grab(); |
@@ -543,8 +545,10 @@ static void __init report_platform_properties(void) | |||
543 | if (v) | 545 | if (v) |
544 | printk("PLATFORM: watchdog-max-timeout [%llu ms]\n", *v); | 546 | printk("PLATFORM: watchdog-max-timeout [%llu ms]\n", *v); |
545 | v = mdesc_get_property(hp, pn, "max-cpus", NULL); | 547 | v = mdesc_get_property(hp, pn, "max-cpus", NULL); |
546 | if (v) | 548 | if (v) { |
547 | printk("PLATFORM: max-cpus [%llu]\n", *v); | 549 | max_cpus = *v; |
550 | printk("PLATFORM: max-cpus [%llu]\n", max_cpus); | ||
551 | } | ||
548 | 552 | ||
549 | #ifdef CONFIG_SMP | 553 | #ifdef CONFIG_SMP |
550 | { | 554 | { |
@@ -715,7 +719,7 @@ static void __cpuinit set_proc_ids(struct mdesc_handle *hp) | |||
715 | } | 719 | } |
716 | 720 | ||
717 | static void __cpuinit get_one_mondo_bits(const u64 *p, unsigned int *mask, | 721 | static void __cpuinit get_one_mondo_bits(const u64 *p, unsigned int *mask, |
718 | unsigned char def) | 722 | unsigned long def, unsigned long max) |
719 | { | 723 | { |
720 | u64 val; | 724 | u64 val; |
721 | 725 | ||
@@ -726,6 +730,9 @@ static void __cpuinit get_one_mondo_bits(const u64 *p, unsigned int *mask, | |||
726 | if (!val || val >= 64) | 730 | if (!val || val >= 64) |
727 | goto use_default; | 731 | goto use_default; |
728 | 732 | ||
733 | if (val > max) | ||
734 | val = max; | ||
735 | |||
729 | *mask = ((1U << val) * 64U) - 1U; | 736 | *mask = ((1U << val) * 64U) - 1U; |
730 | return; | 737 | return; |
731 | 738 | ||
@@ -736,19 +743,28 @@ use_default: | |||
736 | static void __cpuinit get_mondo_data(struct mdesc_handle *hp, u64 mp, | 743 | static void __cpuinit get_mondo_data(struct mdesc_handle *hp, u64 mp, |
737 | struct trap_per_cpu *tb) | 744 | struct trap_per_cpu *tb) |
738 | { | 745 | { |
746 | static int printed; | ||
739 | const u64 *val; | 747 | const u64 *val; |
740 | 748 | ||
741 | val = mdesc_get_property(hp, mp, "q-cpu-mondo-#bits", NULL); | 749 | val = mdesc_get_property(hp, mp, "q-cpu-mondo-#bits", NULL); |
742 | get_one_mondo_bits(val, &tb->cpu_mondo_qmask, 7); | 750 | get_one_mondo_bits(val, &tb->cpu_mondo_qmask, 7, ilog2(max_cpus * 2)); |
743 | 751 | ||
744 | val = mdesc_get_property(hp, mp, "q-dev-mondo-#bits", NULL); | 752 | val = mdesc_get_property(hp, mp, "q-dev-mondo-#bits", NULL); |
745 | get_one_mondo_bits(val, &tb->dev_mondo_qmask, 7); | 753 | get_one_mondo_bits(val, &tb->dev_mondo_qmask, 7, 8); |
746 | 754 | ||
747 | val = mdesc_get_property(hp, mp, "q-resumable-#bits", NULL); | 755 | val = mdesc_get_property(hp, mp, "q-resumable-#bits", NULL); |
748 | get_one_mondo_bits(val, &tb->resum_qmask, 6); | 756 | get_one_mondo_bits(val, &tb->resum_qmask, 6, 7); |
749 | 757 | ||
750 | val = mdesc_get_property(hp, mp, "q-nonresumable-#bits", NULL); | 758 | val = mdesc_get_property(hp, mp, "q-nonresumable-#bits", NULL); |
751 | get_one_mondo_bits(val, &tb->nonresum_qmask, 2); | 759 | get_one_mondo_bits(val, &tb->nonresum_qmask, 2, 2); |
760 | if (!printed++) { | ||
761 | pr_info("SUN4V: Mondo queue sizes " | ||
762 | "[cpu(%u) dev(%u) r(%u) nr(%u)]\n", | ||
763 | tb->cpu_mondo_qmask + 1, | ||
764 | tb->dev_mondo_qmask + 1, | ||
765 | tb->resum_qmask + 1, | ||
766 | tb->nonresum_qmask + 1); | ||
767 | } | ||
752 | } | 768 | } |
753 | 769 | ||
754 | static void * __cpuinit mdesc_iterate_over_cpus(void *(*func)(struct mdesc_handle *, u64, int, void *), void *arg, cpumask_t *mask) | 770 | static void * __cpuinit mdesc_iterate_over_cpus(void *(*func)(struct mdesc_handle *, u64, int, void *), void *arg, cpumask_t *mask) |
diff --git a/arch/sparc/kernel/setup_64.c b/arch/sparc/kernel/setup_64.c index c4dd0999da86..3e9daea1653d 100644 --- a/arch/sparc/kernel/setup_64.c +++ b/arch/sparc/kernel/setup_64.c | |||
@@ -29,6 +29,7 @@ | |||
29 | #include <linux/interrupt.h> | 29 | #include <linux/interrupt.h> |
30 | #include <linux/cpu.h> | 30 | #include <linux/cpu.h> |
31 | #include <linux/initrd.h> | 31 | #include <linux/initrd.h> |
32 | #include <linux/module.h> | ||
32 | 33 | ||
33 | #include <asm/system.h> | 34 | #include <asm/system.h> |
34 | #include <asm/io.h> | 35 | #include <asm/io.h> |
@@ -46,6 +47,8 @@ | |||
46 | #include <asm/mmu.h> | 47 | #include <asm/mmu.h> |
47 | #include <asm/ns87303.h> | 48 | #include <asm/ns87303.h> |
48 | #include <asm/btext.h> | 49 | #include <asm/btext.h> |
50 | #include <asm/elf.h> | ||
51 | #include <asm/mdesc.h> | ||
49 | 52 | ||
50 | #ifdef CONFIG_IP_PNP | 53 | #ifdef CONFIG_IP_PNP |
51 | #include <net/ipconfig.h> | 54 | #include <net/ipconfig.h> |
@@ -269,6 +272,40 @@ void __init sun4v_patch(void) | |||
269 | sun4v_hvapi_init(); | 272 | sun4v_hvapi_init(); |
270 | } | 273 | } |
271 | 274 | ||
275 | static void __init popc_patch(void) | ||
276 | { | ||
277 | struct popc_3insn_patch_entry *p3; | ||
278 | struct popc_6insn_patch_entry *p6; | ||
279 | |||
280 | p3 = &__popc_3insn_patch; | ||
281 | while (p3 < &__popc_3insn_patch_end) { | ||
282 | unsigned long i, addr = p3->addr; | ||
283 | |||
284 | for (i = 0; i < 3; i++) { | ||
285 | *(unsigned int *) (addr + (i * 4)) = p3->insns[i]; | ||
286 | wmb(); | ||
287 | __asm__ __volatile__("flush %0" | ||
288 | : : "r" (addr + (i * 4))); | ||
289 | } | ||
290 | |||
291 | p3++; | ||
292 | } | ||
293 | |||
294 | p6 = &__popc_6insn_patch; | ||
295 | while (p6 < &__popc_6insn_patch_end) { | ||
296 | unsigned long i, addr = p6->addr; | ||
297 | |||
298 | for (i = 0; i < 6; i++) { | ||
299 | *(unsigned int *) (addr + (i * 4)) = p6->insns[i]; | ||
300 | wmb(); | ||
301 | __asm__ __volatile__("flush %0" | ||
302 | : : "r" (addr + (i * 4))); | ||
303 | } | ||
304 | |||
305 | p6++; | ||
306 | } | ||
307 | } | ||
308 | |||
272 | #ifdef CONFIG_SMP | 309 | #ifdef CONFIG_SMP |
273 | void __init boot_cpu_id_too_large(int cpu) | 310 | void __init boot_cpu_id_too_large(int cpu) |
274 | { | 311 | { |
@@ -278,6 +315,154 @@ void __init boot_cpu_id_too_large(int cpu) | |||
278 | } | 315 | } |
279 | #endif | 316 | #endif |
280 | 317 | ||
318 | /* On Ultra, we support all of the v8 capabilities. */ | ||
319 | unsigned long sparc64_elf_hwcap = (HWCAP_SPARC_FLUSH | HWCAP_SPARC_STBAR | | ||
320 | HWCAP_SPARC_SWAP | HWCAP_SPARC_MULDIV | | ||
321 | HWCAP_SPARC_V9); | ||
322 | EXPORT_SYMBOL(sparc64_elf_hwcap); | ||
323 | |||
324 | static const char *hwcaps[] = { | ||
325 | "flush", "stbar", "swap", "muldiv", "v9", | ||
326 | "ultra3", "blkinit", "n2", | ||
327 | |||
328 | /* These strings are as they appear in the machine description | ||
329 | * 'hwcap-list' property for cpu nodes. | ||
330 | */ | ||
331 | "mul32", "div32", "fsmuld", "v8plus", "popc", "vis", "vis2", | ||
332 | "ASIBlkInit", "fmaf", "vis3", "hpc", "random", "trans", "fjfmau", | ||
333 | "ima", "cspare", | ||
334 | }; | ||
335 | |||
336 | void cpucap_info(struct seq_file *m) | ||
337 | { | ||
338 | unsigned long caps = sparc64_elf_hwcap; | ||
339 | int i, printed = 0; | ||
340 | |||
341 | seq_puts(m, "cpucaps\t\t: "); | ||
342 | for (i = 0; i < ARRAY_SIZE(hwcaps); i++) { | ||
343 | unsigned long bit = 1UL << i; | ||
344 | if (caps & bit) { | ||
345 | seq_printf(m, "%s%s", | ||
346 | printed ? "," : "", hwcaps[i]); | ||
347 | printed++; | ||
348 | } | ||
349 | } | ||
350 | seq_putc(m, '\n'); | ||
351 | } | ||
352 | |||
353 | static void __init report_hwcaps(unsigned long caps) | ||
354 | { | ||
355 | int i, printed = 0; | ||
356 | |||
357 | printk(KERN_INFO "CPU CAPS: ["); | ||
358 | for (i = 0; i < ARRAY_SIZE(hwcaps); i++) { | ||
359 | unsigned long bit = 1UL << i; | ||
360 | if (caps & bit) { | ||
361 | printk(KERN_CONT "%s%s", | ||
362 | printed ? "," : "", hwcaps[i]); | ||
363 | if (++printed == 8) { | ||
364 | printk(KERN_CONT "]\n"); | ||
365 | printk(KERN_INFO "CPU CAPS: ["); | ||
366 | printed = 0; | ||
367 | } | ||
368 | } | ||
369 | } | ||
370 | printk(KERN_CONT "]\n"); | ||
371 | } | ||
372 | |||
373 | static unsigned long __init mdesc_cpu_hwcap_list(void) | ||
374 | { | ||
375 | struct mdesc_handle *hp; | ||
376 | unsigned long caps = 0; | ||
377 | const char *prop; | ||
378 | int len; | ||
379 | u64 pn; | ||
380 | |||
381 | hp = mdesc_grab(); | ||
382 | if (!hp) | ||
383 | return 0; | ||
384 | |||
385 | pn = mdesc_node_by_name(hp, MDESC_NODE_NULL, "cpu"); | ||
386 | if (pn == MDESC_NODE_NULL) | ||
387 | goto out; | ||
388 | |||
389 | prop = mdesc_get_property(hp, pn, "hwcap-list", &len); | ||
390 | if (!prop) | ||
391 | goto out; | ||
392 | |||
393 | while (len) { | ||
394 | int i, plen; | ||
395 | |||
396 | for (i = 0; i < ARRAY_SIZE(hwcaps); i++) { | ||
397 | unsigned long bit = 1UL << i; | ||
398 | |||
399 | if (!strcmp(prop, hwcaps[i])) { | ||
400 | caps |= bit; | ||
401 | break; | ||
402 | } | ||
403 | } | ||
404 | |||
405 | plen = strlen(prop) + 1; | ||
406 | prop += plen; | ||
407 | len -= plen; | ||
408 | } | ||
409 | |||
410 | out: | ||
411 | mdesc_release(hp); | ||
412 | return caps; | ||
413 | } | ||
414 | |||
415 | /* This yields a mask that user programs can use to figure out what | ||
416 | * instruction set this cpu supports. | ||
417 | */ | ||
418 | static void __init init_sparc64_elf_hwcap(void) | ||
419 | { | ||
420 | unsigned long cap = sparc64_elf_hwcap; | ||
421 | unsigned long mdesc_caps; | ||
422 | |||
423 | if (tlb_type == cheetah || tlb_type == cheetah_plus) | ||
424 | cap |= HWCAP_SPARC_ULTRA3; | ||
425 | else if (tlb_type == hypervisor) { | ||
426 | if (sun4v_chip_type == SUN4V_CHIP_NIAGARA1 || | ||
427 | sun4v_chip_type == SUN4V_CHIP_NIAGARA2 || | ||
428 | sun4v_chip_type == SUN4V_CHIP_NIAGARA3) | ||
429 | cap |= HWCAP_SPARC_BLKINIT; | ||
430 | if (sun4v_chip_type == SUN4V_CHIP_NIAGARA2 || | ||
431 | sun4v_chip_type == SUN4V_CHIP_NIAGARA3) | ||
432 | cap |= HWCAP_SPARC_N2; | ||
433 | } | ||
434 | |||
435 | cap |= (AV_SPARC_MUL32 | AV_SPARC_DIV32 | AV_SPARC_V8PLUS); | ||
436 | |||
437 | mdesc_caps = mdesc_cpu_hwcap_list(); | ||
438 | if (!mdesc_caps) { | ||
439 | if (tlb_type == spitfire) | ||
440 | cap |= AV_SPARC_VIS; | ||
441 | if (tlb_type == cheetah || tlb_type == cheetah_plus) | ||
442 | cap |= AV_SPARC_VIS | AV_SPARC_VIS2; | ||
443 | if (tlb_type == cheetah_plus) | ||
444 | cap |= AV_SPARC_POPC; | ||
445 | if (tlb_type == hypervisor) { | ||
446 | if (sun4v_chip_type == SUN4V_CHIP_NIAGARA1) | ||
447 | cap |= AV_SPARC_ASI_BLK_INIT; | ||
448 | if (sun4v_chip_type == SUN4V_CHIP_NIAGARA2 || | ||
449 | sun4v_chip_type == SUN4V_CHIP_NIAGARA3) | ||
450 | cap |= (AV_SPARC_VIS | AV_SPARC_VIS2 | | ||
451 | AV_SPARC_ASI_BLK_INIT | | ||
452 | AV_SPARC_POPC); | ||
453 | if (sun4v_chip_type == SUN4V_CHIP_NIAGARA3) | ||
454 | cap |= (AV_SPARC_VIS3 | AV_SPARC_HPC | | ||
455 | AV_SPARC_FMAF); | ||
456 | } | ||
457 | } | ||
458 | sparc64_elf_hwcap = cap | mdesc_caps; | ||
459 | |||
460 | report_hwcaps(sparc64_elf_hwcap); | ||
461 | |||
462 | if (sparc64_elf_hwcap & AV_SPARC_POPC) | ||
463 | popc_patch(); | ||
464 | } | ||
465 | |||
281 | void __init setup_arch(char **cmdline_p) | 466 | void __init setup_arch(char **cmdline_p) |
282 | { | 467 | { |
283 | /* Initialize PROM console and command line. */ | 468 | /* Initialize PROM console and command line. */ |
@@ -337,6 +522,7 @@ void __init setup_arch(char **cmdline_p) | |||
337 | init_cur_cpu_trap(current_thread_info()); | 522 | init_cur_cpu_trap(current_thread_info()); |
338 | 523 | ||
339 | paging_init(); | 524 | paging_init(); |
525 | init_sparc64_elf_hwcap(); | ||
340 | } | 526 | } |
341 | 527 | ||
342 | extern int stop_a_enabled; | 528 | extern int stop_a_enabled; |
diff --git a/arch/sparc/kernel/sparc_ksyms_64.c b/arch/sparc/kernel/sparc_ksyms_64.c index 372ad59c4cba..83b47ab02d96 100644 --- a/arch/sparc/kernel/sparc_ksyms_64.c +++ b/arch/sparc/kernel/sparc_ksyms_64.c | |||
@@ -8,6 +8,7 @@ | |||
8 | #include <linux/module.h> | 8 | #include <linux/module.h> |
9 | #include <linux/pci.h> | 9 | #include <linux/pci.h> |
10 | #include <linux/init.h> | 10 | #include <linux/init.h> |
11 | #include <linux/bitops.h> | ||
11 | 12 | ||
12 | #include <asm/system.h> | 13 | #include <asm/system.h> |
13 | #include <asm/cpudata.h> | 14 | #include <asm/cpudata.h> |
@@ -38,5 +39,15 @@ EXPORT_SYMBOL(sun4v_niagara_setperf); | |||
38 | EXPORT_SYMBOL(sun4v_niagara2_getperf); | 39 | EXPORT_SYMBOL(sun4v_niagara2_getperf); |
39 | EXPORT_SYMBOL(sun4v_niagara2_setperf); | 40 | EXPORT_SYMBOL(sun4v_niagara2_setperf); |
40 | 41 | ||
42 | /* from hweight.S */ | ||
43 | EXPORT_SYMBOL(__arch_hweight8); | ||
44 | EXPORT_SYMBOL(__arch_hweight16); | ||
45 | EXPORT_SYMBOL(__arch_hweight32); | ||
46 | EXPORT_SYMBOL(__arch_hweight64); | ||
47 | |||
48 | /* from ffs_ffz.S */ | ||
49 | EXPORT_SYMBOL(ffs); | ||
50 | EXPORT_SYMBOL(__ffs); | ||
51 | |||
41 | /* Exporting a symbol from /init/main.c */ | 52 | /* Exporting a symbol from /init/main.c */ |
42 | EXPORT_SYMBOL(saved_command_line); | 53 | EXPORT_SYMBOL(saved_command_line); |
diff --git a/arch/sparc/kernel/sstate.c b/arch/sparc/kernel/sstate.c index 8cdbe5946b43..c59af546f522 100644 --- a/arch/sparc/kernel/sstate.c +++ b/arch/sparc/kernel/sstate.c | |||
@@ -14,14 +14,9 @@ | |||
14 | #include <asm/head.h> | 14 | #include <asm/head.h> |
15 | #include <asm/io.h> | 15 | #include <asm/io.h> |
16 | 16 | ||
17 | static int hv_supports_soft_state; | 17 | #include "kernel.h" |
18 | |||
19 | static unsigned long kimage_addr_to_ra(const char *p) | ||
20 | { | ||
21 | unsigned long val = (unsigned long) p; | ||
22 | 18 | ||
23 | return kern_base + (val - KERNBASE); | 19 | static int hv_supports_soft_state; |
24 | } | ||
25 | 20 | ||
26 | static void do_set_sstate(unsigned long state, const char *msg) | 21 | static void do_set_sstate(unsigned long state, const char *msg) |
27 | { | 22 | { |
diff --git a/arch/sparc/kernel/unaligned_64.c b/arch/sparc/kernel/unaligned_64.c index 35cff1673aa4..76e4ac1a13e1 100644 --- a/arch/sparc/kernel/unaligned_64.c +++ b/arch/sparc/kernel/unaligned_64.c | |||
@@ -22,6 +22,7 @@ | |||
22 | #include <linux/bitops.h> | 22 | #include <linux/bitops.h> |
23 | #include <linux/perf_event.h> | 23 | #include <linux/perf_event.h> |
24 | #include <linux/ratelimit.h> | 24 | #include <linux/ratelimit.h> |
25 | #include <linux/bitops.h> | ||
25 | #include <asm/fpumacro.h> | 26 | #include <asm/fpumacro.h> |
26 | 27 | ||
27 | enum direction { | 28 | enum direction { |
@@ -373,16 +374,11 @@ asmlinkage void kernel_unaligned_trap(struct pt_regs *regs, unsigned int insn) | |||
373 | } | 374 | } |
374 | } | 375 | } |
375 | 376 | ||
376 | static char popc_helper[] = { | ||
377 | 0, 1, 1, 2, 1, 2, 2, 3, | ||
378 | 1, 2, 2, 3, 2, 3, 3, 4, | ||
379 | }; | ||
380 | |||
381 | int handle_popc(u32 insn, struct pt_regs *regs) | 377 | int handle_popc(u32 insn, struct pt_regs *regs) |
382 | { | 378 | { |
383 | u64 value; | ||
384 | int ret, i, rd = ((insn >> 25) & 0x1f); | ||
385 | int from_kernel = (regs->tstate & TSTATE_PRIV) != 0; | 379 | int from_kernel = (regs->tstate & TSTATE_PRIV) != 0; |
380 | int ret, rd = ((insn >> 25) & 0x1f); | ||
381 | u64 value; | ||
386 | 382 | ||
387 | perf_sw_event(PERF_COUNT_SW_EMULATION_FAULTS, 1, regs, 0); | 383 | perf_sw_event(PERF_COUNT_SW_EMULATION_FAULTS, 1, regs, 0); |
388 | if (insn & 0x2000) { | 384 | if (insn & 0x2000) { |
@@ -392,10 +388,7 @@ int handle_popc(u32 insn, struct pt_regs *regs) | |||
392 | maybe_flush_windows(0, insn & 0x1f, rd, from_kernel); | 388 | maybe_flush_windows(0, insn & 0x1f, rd, from_kernel); |
393 | value = fetch_reg(insn & 0x1f, regs); | 389 | value = fetch_reg(insn & 0x1f, regs); |
394 | } | 390 | } |
395 | for (ret = 0, i = 0; i < 16; i++) { | 391 | ret = hweight64(value); |
396 | ret += popc_helper[value & 0xf]; | ||
397 | value >>= 4; | ||
398 | } | ||
399 | if (rd < 16) { | 392 | if (rd < 16) { |
400 | if (rd) | 393 | if (rd) |
401 | regs->u_regs[rd] = ret; | 394 | regs->u_regs[rd] = ret; |
diff --git a/arch/sparc/kernel/vmlinux.lds.S b/arch/sparc/kernel/vmlinux.lds.S index c0220759003e..0e1605697b49 100644 --- a/arch/sparc/kernel/vmlinux.lds.S +++ b/arch/sparc/kernel/vmlinux.lds.S | |||
@@ -107,7 +107,26 @@ SECTIONS | |||
107 | *(.sun4v_2insn_patch) | 107 | *(.sun4v_2insn_patch) |
108 | __sun4v_2insn_patch_end = .; | 108 | __sun4v_2insn_patch_end = .; |
109 | } | 109 | } |
110 | 110 | .swapper_tsb_phys_patch : { | |
111 | __swapper_tsb_phys_patch = .; | ||
112 | *(.swapper_tsb_phys_patch) | ||
113 | __swapper_tsb_phys_patch_end = .; | ||
114 | } | ||
115 | .swapper_4m_tsb_phys_patch : { | ||
116 | __swapper_4m_tsb_phys_patch = .; | ||
117 | *(.swapper_4m_tsb_phys_patch) | ||
118 | __swapper_4m_tsb_phys_patch_end = .; | ||
119 | } | ||
120 | .popc_3insn_patch : { | ||
121 | __popc_3insn_patch = .; | ||
122 | *(.popc_3insn_patch) | ||
123 | __popc_3insn_patch_end = .; | ||
124 | } | ||
125 | .popc_6insn_patch : { | ||
126 | __popc_6insn_patch = .; | ||
127 | *(.popc_6insn_patch) | ||
128 | __popc_6insn_patch_end = .; | ||
129 | } | ||
111 | PERCPU_SECTION(SMP_CACHE_BYTES) | 130 | PERCPU_SECTION(SMP_CACHE_BYTES) |
112 | 131 | ||
113 | . = ALIGN(PAGE_SIZE); | 132 | . = ALIGN(PAGE_SIZE); |
diff --git a/arch/sparc/lib/Makefile b/arch/sparc/lib/Makefile index 7f01b8fce8bc..a3fc4375a150 100644 --- a/arch/sparc/lib/Makefile +++ b/arch/sparc/lib/Makefile | |||
@@ -31,13 +31,13 @@ lib-$(CONFIG_SPARC64) += NGmemcpy.o NGcopy_from_user.o NGcopy_to_user.o | |||
31 | lib-$(CONFIG_SPARC64) += NGpatch.o NGpage.o NGbzero.o | 31 | lib-$(CONFIG_SPARC64) += NGpatch.o NGpage.o NGbzero.o |
32 | 32 | ||
33 | lib-$(CONFIG_SPARC64) += NG2memcpy.o NG2copy_from_user.o NG2copy_to_user.o | 33 | lib-$(CONFIG_SPARC64) += NG2memcpy.o NG2copy_from_user.o NG2copy_to_user.o |
34 | lib-$(CONFIG_SPARC64) += NG2patch.o NG2page.o | 34 | lib-$(CONFIG_SPARC64) += NG2patch.o |
35 | 35 | ||
36 | lib-$(CONFIG_SPARC64) += GENmemcpy.o GENcopy_from_user.o GENcopy_to_user.o | 36 | lib-$(CONFIG_SPARC64) += GENmemcpy.o GENcopy_from_user.o GENcopy_to_user.o |
37 | lib-$(CONFIG_SPARC64) += GENpatch.o GENpage.o GENbzero.o | 37 | lib-$(CONFIG_SPARC64) += GENpatch.o GENpage.o GENbzero.o |
38 | 38 | ||
39 | lib-$(CONFIG_SPARC64) += copy_in_user.o user_fixup.o memmove.o | 39 | lib-$(CONFIG_SPARC64) += copy_in_user.o user_fixup.o memmove.o |
40 | lib-$(CONFIG_SPARC64) += mcount.o ipcsum.o xor.o | 40 | lib-$(CONFIG_SPARC64) += mcount.o ipcsum.o xor.o hweight.o ffs.o |
41 | 41 | ||
42 | obj-y += iomap.o | 42 | obj-y += iomap.o |
43 | obj-$(CONFIG_SPARC32) += atomic32.o | 43 | obj-$(CONFIG_SPARC32) += atomic32.o |
diff --git a/arch/sparc/lib/NG2page.S b/arch/sparc/lib/NG2page.S deleted file mode 100644 index 73b6b7c72cbf..000000000000 --- a/arch/sparc/lib/NG2page.S +++ /dev/null | |||
@@ -1,61 +0,0 @@ | |||
1 | /* NG2page.S: Niagara-2 optimized clear and copy page. | ||
2 | * | ||
3 | * Copyright (C) 2007 (davem@davemloft.net) | ||
4 | */ | ||
5 | |||
6 | #include <asm/asi.h> | ||
7 | #include <asm/page.h> | ||
8 | #include <asm/visasm.h> | ||
9 | |||
10 | .text | ||
11 | .align 32 | ||
12 | |||
13 | /* This is heavily simplified from the sun4u variants | ||
14 | * because Niagara-2 does not have any D-cache aliasing issues. | ||
15 | */ | ||
16 | NG2copy_user_page: /* %o0=dest, %o1=src, %o2=vaddr */ | ||
17 | prefetch [%o1 + 0x00], #one_read | ||
18 | prefetch [%o1 + 0x40], #one_read | ||
19 | VISEntryHalf | ||
20 | set PAGE_SIZE, %g7 | ||
21 | sub %o0, %o1, %g3 | ||
22 | 1: stxa %g0, [%o1 + %g3] ASI_BLK_INIT_QUAD_LDD_P | ||
23 | subcc %g7, 64, %g7 | ||
24 | ldda [%o1] ASI_BLK_P, %f0 | ||
25 | stda %f0, [%o1 + %g3] ASI_BLK_P | ||
26 | add %o1, 64, %o1 | ||
27 | bne,pt %xcc, 1b | ||
28 | prefetch [%o1 + 0x40], #one_read | ||
29 | membar #Sync | ||
30 | VISExitHalf | ||
31 | retl | ||
32 | nop | ||
33 | |||
34 | #define BRANCH_ALWAYS 0x10680000 | ||
35 | #define NOP 0x01000000 | ||
36 | #define NG_DO_PATCH(OLD, NEW) \ | ||
37 | sethi %hi(NEW), %g1; \ | ||
38 | or %g1, %lo(NEW), %g1; \ | ||
39 | sethi %hi(OLD), %g2; \ | ||
40 | or %g2, %lo(OLD), %g2; \ | ||
41 | sub %g1, %g2, %g1; \ | ||
42 | sethi %hi(BRANCH_ALWAYS), %g3; \ | ||
43 | sll %g1, 11, %g1; \ | ||
44 | srl %g1, 11 + 2, %g1; \ | ||
45 | or %g3, %lo(BRANCH_ALWAYS), %g3; \ | ||
46 | or %g3, %g1, %g3; \ | ||
47 | stw %g3, [%g2]; \ | ||
48 | sethi %hi(NOP), %g3; \ | ||
49 | or %g3, %lo(NOP), %g3; \ | ||
50 | stw %g3, [%g2 + 0x4]; \ | ||
51 | flush %g2; | ||
52 | |||
53 | .globl niagara2_patch_pageops | ||
54 | .type niagara2_patch_pageops,#function | ||
55 | niagara2_patch_pageops: | ||
56 | NG_DO_PATCH(copy_user_page, NG2copy_user_page) | ||
57 | NG_DO_PATCH(_clear_page, NGclear_page) | ||
58 | NG_DO_PATCH(clear_user_page, NGclear_user_page) | ||
59 | retl | ||
60 | nop | ||
61 | .size niagara2_patch_pageops,.-niagara2_patch_pageops | ||
diff --git a/arch/sparc/lib/NGpage.S b/arch/sparc/lib/NGpage.S index 428920de05ba..b9e790b9c6b8 100644 --- a/arch/sparc/lib/NGpage.S +++ b/arch/sparc/lib/NGpage.S | |||
@@ -16,55 +16,91 @@ | |||
16 | */ | 16 | */ |
17 | 17 | ||
18 | NGcopy_user_page: /* %o0=dest, %o1=src, %o2=vaddr */ | 18 | NGcopy_user_page: /* %o0=dest, %o1=src, %o2=vaddr */ |
19 | prefetch [%o1 + 0x00], #one_read | 19 | save %sp, -192, %sp |
20 | mov 8, %g1 | 20 | rd %asi, %g3 |
21 | mov 16, %g2 | 21 | wr %g0, ASI_BLK_INIT_QUAD_LDD_P, %asi |
22 | mov 24, %g3 | ||
23 | set PAGE_SIZE, %g7 | 22 | set PAGE_SIZE, %g7 |
23 | prefetch [%i1 + 0x00], #one_read | ||
24 | prefetch [%i1 + 0x40], #one_read | ||
24 | 25 | ||
25 | 1: ldda [%o1 + %g0] ASI_BLK_INIT_QUAD_LDD_P, %o2 | 26 | 1: prefetch [%i1 + 0x80], #one_read |
26 | ldda [%o1 + %g2] ASI_BLK_INIT_QUAD_LDD_P, %o4 | 27 | prefetch [%i1 + 0xc0], #one_read |
27 | prefetch [%o1 + 0x40], #one_read | 28 | ldda [%i1 + 0x00] %asi, %o2 |
28 | add %o1, 32, %o1 | 29 | ldda [%i1 + 0x10] %asi, %o4 |
29 | stxa %o2, [%o0 + %g0] ASI_BLK_INIT_QUAD_LDD_P | 30 | ldda [%i1 + 0x20] %asi, %l2 |
30 | stxa %o3, [%o0 + %g1] ASI_BLK_INIT_QUAD_LDD_P | 31 | ldda [%i1 + 0x30] %asi, %l4 |
31 | ldda [%o1 + %g0] ASI_BLK_INIT_QUAD_LDD_P, %o2 | 32 | stxa %o2, [%i0 + 0x00] %asi |
32 | stxa %o4, [%o0 + %g2] ASI_BLK_INIT_QUAD_LDD_P | 33 | stxa %o3, [%i0 + 0x08] %asi |
33 | stxa %o5, [%o0 + %g3] ASI_BLK_INIT_QUAD_LDD_P | 34 | stxa %o4, [%i0 + 0x10] %asi |
34 | ldda [%o1 + %g2] ASI_BLK_INIT_QUAD_LDD_P, %o4 | 35 | stxa %o5, [%i0 + 0x18] %asi |
35 | add %o1, 32, %o1 | 36 | stxa %l2, [%i0 + 0x20] %asi |
36 | add %o0, 32, %o0 | 37 | stxa %l3, [%i0 + 0x28] %asi |
37 | stxa %o2, [%o0 + %g0] ASI_BLK_INIT_QUAD_LDD_P | 38 | stxa %l4, [%i0 + 0x30] %asi |
38 | stxa %o3, [%o0 + %g1] ASI_BLK_INIT_QUAD_LDD_P | 39 | stxa %l5, [%i0 + 0x38] %asi |
39 | stxa %o4, [%o0 + %g2] ASI_BLK_INIT_QUAD_LDD_P | 40 | ldda [%i1 + 0x40] %asi, %o2 |
40 | stxa %o5, [%o0 + %g3] ASI_BLK_INIT_QUAD_LDD_P | 41 | ldda [%i1 + 0x50] %asi, %o4 |
41 | subcc %g7, 64, %g7 | 42 | ldda [%i1 + 0x60] %asi, %l2 |
43 | ldda [%i1 + 0x70] %asi, %l4 | ||
44 | stxa %o2, [%i0 + 0x40] %asi | ||
45 | stxa %o3, [%i0 + 0x48] %asi | ||
46 | stxa %o4, [%i0 + 0x50] %asi | ||
47 | stxa %o5, [%i0 + 0x58] %asi | ||
48 | stxa %l2, [%i0 + 0x60] %asi | ||
49 | stxa %l3, [%i0 + 0x68] %asi | ||
50 | stxa %l4, [%i0 + 0x70] %asi | ||
51 | stxa %l5, [%i0 + 0x78] %asi | ||
52 | add %i1, 128, %i1 | ||
53 | subcc %g7, 128, %g7 | ||
42 | bne,pt %xcc, 1b | 54 | bne,pt %xcc, 1b |
43 | add %o0, 32, %o0 | 55 | add %i0, 128, %i0 |
56 | wr %g3, 0x0, %asi | ||
44 | membar #Sync | 57 | membar #Sync |
45 | retl | 58 | ret |
46 | nop | 59 | restore |
47 | 60 | ||
48 | .globl NGclear_page, NGclear_user_page | 61 | .align 32 |
49 | NGclear_page: /* %o0=dest */ | 62 | NGclear_page: /* %o0=dest */ |
50 | NGclear_user_page: /* %o0=dest, %o1=vaddr */ | 63 | NGclear_user_page: /* %o0=dest, %o1=vaddr */ |
51 | mov 8, %g1 | 64 | rd %asi, %g3 |
52 | mov 16, %g2 | 65 | wr %g0, ASI_BLK_INIT_QUAD_LDD_P, %asi |
53 | mov 24, %g3 | ||
54 | set PAGE_SIZE, %g7 | 66 | set PAGE_SIZE, %g7 |
55 | 67 | ||
56 | 1: stxa %g0, [%o0 + %g0] ASI_BLK_INIT_QUAD_LDD_P | 68 | 1: stxa %g0, [%o0 + 0x00] %asi |
57 | stxa %g0, [%o0 + %g1] ASI_BLK_INIT_QUAD_LDD_P | 69 | stxa %g0, [%o0 + 0x08] %asi |
58 | stxa %g0, [%o0 + %g2] ASI_BLK_INIT_QUAD_LDD_P | 70 | stxa %g0, [%o0 + 0x10] %asi |
59 | stxa %g0, [%o0 + %g3] ASI_BLK_INIT_QUAD_LDD_P | 71 | stxa %g0, [%o0 + 0x18] %asi |
60 | add %o0, 32, %o0 | 72 | stxa %g0, [%o0 + 0x20] %asi |
61 | stxa %g0, [%o0 + %g0] ASI_BLK_INIT_QUAD_LDD_P | 73 | stxa %g0, [%o0 + 0x28] %asi |
62 | stxa %g0, [%o0 + %g1] ASI_BLK_INIT_QUAD_LDD_P | 74 | stxa %g0, [%o0 + 0x30] %asi |
63 | stxa %g0, [%o0 + %g2] ASI_BLK_INIT_QUAD_LDD_P | 75 | stxa %g0, [%o0 + 0x38] %asi |
64 | stxa %g0, [%o0 + %g3] ASI_BLK_INIT_QUAD_LDD_P | 76 | stxa %g0, [%o0 + 0x40] %asi |
65 | subcc %g7, 64, %g7 | 77 | stxa %g0, [%o0 + 0x48] %asi |
78 | stxa %g0, [%o0 + 0x50] %asi | ||
79 | stxa %g0, [%o0 + 0x58] %asi | ||
80 | stxa %g0, [%o0 + 0x60] %asi | ||
81 | stxa %g0, [%o0 + 0x68] %asi | ||
82 | stxa %g0, [%o0 + 0x70] %asi | ||
83 | stxa %g0, [%o0 + 0x78] %asi | ||
84 | stxa %g0, [%o0 + 0x80] %asi | ||
85 | stxa %g0, [%o0 + 0x88] %asi | ||
86 | stxa %g0, [%o0 + 0x90] %asi | ||
87 | stxa %g0, [%o0 + 0x98] %asi | ||
88 | stxa %g0, [%o0 + 0xa0] %asi | ||
89 | stxa %g0, [%o0 + 0xa8] %asi | ||
90 | stxa %g0, [%o0 + 0xb0] %asi | ||
91 | stxa %g0, [%o0 + 0xb8] %asi | ||
92 | stxa %g0, [%o0 + 0xc0] %asi | ||
93 | stxa %g0, [%o0 + 0xc8] %asi | ||
94 | stxa %g0, [%o0 + 0xd0] %asi | ||
95 | stxa %g0, [%o0 + 0xd8] %asi | ||
96 | stxa %g0, [%o0 + 0xe0] %asi | ||
97 | stxa %g0, [%o0 + 0xe8] %asi | ||
98 | stxa %g0, [%o0 + 0xf0] %asi | ||
99 | stxa %g0, [%o0 + 0xf8] %asi | ||
100 | subcc %g7, 256, %g7 | ||
66 | bne,pt %xcc, 1b | 101 | bne,pt %xcc, 1b |
67 | add %o0, 32, %o0 | 102 | add %o0, 256, %o0 |
103 | wr %g3, 0x0, %asi | ||
68 | membar #Sync | 104 | membar #Sync |
69 | retl | 105 | retl |
70 | nop | 106 | nop |
diff --git a/arch/sparc/lib/atomic32.c b/arch/sparc/lib/atomic32.c index 8600eb2461b5..1d32b54089aa 100644 --- a/arch/sparc/lib/atomic32.c +++ b/arch/sparc/lib/atomic32.c | |||
@@ -65,7 +65,7 @@ int __atomic_add_unless(atomic_t *v, int a, int u) | |||
65 | if (ret != u) | 65 | if (ret != u) |
66 | v->counter += a; | 66 | v->counter += a; |
67 | spin_unlock_irqrestore(ATOMIC_HASH(v), flags); | 67 | spin_unlock_irqrestore(ATOMIC_HASH(v), flags); |
68 | return ret != u; | 68 | return ret; |
69 | } | 69 | } |
70 | EXPORT_SYMBOL(__atomic_add_unless); | 70 | EXPORT_SYMBOL(__atomic_add_unless); |
71 | 71 | ||
diff --git a/arch/sparc/lib/ffs.S b/arch/sparc/lib/ffs.S new file mode 100644 index 000000000000..b39389f69899 --- /dev/null +++ b/arch/sparc/lib/ffs.S | |||
@@ -0,0 +1,84 @@ | |||
1 | #include <linux/linkage.h> | ||
2 | |||
3 | .register %g2,#scratch | ||
4 | |||
5 | .text | ||
6 | .align 32 | ||
7 | |||
8 | ENTRY(ffs) | ||
9 | brnz,pt %o0, 1f | ||
10 | mov 1, %o1 | ||
11 | retl | ||
12 | clr %o0 | ||
13 | nop | ||
14 | nop | ||
15 | ENTRY(__ffs) | ||
16 | sllx %o0, 32, %g1 /* 1 */ | ||
17 | srlx %o0, 32, %g2 | ||
18 | |||
19 | clr %o1 /* 2 */ | ||
20 | movrz %g1, %g2, %o0 | ||
21 | |||
22 | movrz %g1, 32, %o1 /* 3 */ | ||
23 | 1: clr %o2 | ||
24 | |||
25 | sllx %o0, (64 - 16), %g1 /* 4 */ | ||
26 | srlx %o0, 16, %g2 | ||
27 | |||
28 | movrz %g1, %g2, %o0 /* 5 */ | ||
29 | clr %o3 | ||
30 | |||
31 | movrz %g1, 16, %o2 /* 6 */ | ||
32 | clr %o4 | ||
33 | |||
34 | and %o0, 0xff, %g1 /* 7 */ | ||
35 | srlx %o0, 8, %g2 | ||
36 | |||
37 | movrz %g1, %g2, %o0 /* 8 */ | ||
38 | clr %o5 | ||
39 | |||
40 | movrz %g1, 8, %o3 /* 9 */ | ||
41 | add %o2, %o1, %o2 | ||
42 | |||
43 | and %o0, 0xf, %g1 /* 10 */ | ||
44 | srlx %o0, 4, %g2 | ||
45 | |||
46 | movrz %g1, %g2, %o0 /* 11 */ | ||
47 | add %o2, %o3, %o2 | ||
48 | |||
49 | movrz %g1, 4, %o4 /* 12 */ | ||
50 | |||
51 | and %o0, 0x3, %g1 /* 13 */ | ||
52 | srlx %o0, 2, %g2 | ||
53 | |||
54 | movrz %g1, %g2, %o0 /* 14 */ | ||
55 | add %o2, %o4, %o2 | ||
56 | |||
57 | movrz %g1, 2, %o5 /* 15 */ | ||
58 | |||
59 | and %o0, 0x1, %g1 /* 16 */ | ||
60 | |||
61 | add %o2, %o5, %o2 /* 17 */ | ||
62 | xor %g1, 0x1, %g1 | ||
63 | |||
64 | retl /* 18 */ | ||
65 | add %o2, %g1, %o0 | ||
66 | ENDPROC(ffs) | ||
67 | ENDPROC(__ffs) | ||
68 | |||
69 | .section .popc_6insn_patch, "ax" | ||
70 | .word ffs | ||
71 | brz,pn %o0, 98f | ||
72 | neg %o0, %g1 | ||
73 | xnor %o0, %g1, %o1 | ||
74 | popc %o1, %o0 | ||
75 | 98: retl | ||
76 | nop | ||
77 | .word __ffs | ||
78 | neg %o0, %g1 | ||
79 | xnor %o0, %g1, %o1 | ||
80 | popc %o1, %o0 | ||
81 | retl | ||
82 | sub %o0, 1, %o0 | ||
83 | nop | ||
84 | .previous | ||
diff --git a/arch/sparc/lib/hweight.S b/arch/sparc/lib/hweight.S new file mode 100644 index 000000000000..95414e0a6808 --- /dev/null +++ b/arch/sparc/lib/hweight.S | |||
@@ -0,0 +1,51 @@ | |||
1 | #include <linux/linkage.h> | ||
2 | |||
3 | .text | ||
4 | .align 32 | ||
5 | ENTRY(__arch_hweight8) | ||
6 | ba,pt %xcc, __sw_hweight8 | ||
7 | nop | ||
8 | nop | ||
9 | ENDPROC(__arch_hweight8) | ||
10 | .section .popc_3insn_patch, "ax" | ||
11 | .word __arch_hweight8 | ||
12 | sllx %o0, 64-8, %g1 | ||
13 | retl | ||
14 | popc %g1, %o0 | ||
15 | .previous | ||
16 | |||
17 | ENTRY(__arch_hweight16) | ||
18 | ba,pt %xcc, __sw_hweight16 | ||
19 | nop | ||
20 | nop | ||
21 | ENDPROC(__arch_hweight16) | ||
22 | .section .popc_3insn_patch, "ax" | ||
23 | .word __arch_hweight16 | ||
24 | sllx %o0, 64-16, %g1 | ||
25 | retl | ||
26 | popc %g1, %o0 | ||
27 | .previous | ||
28 | |||
29 | ENTRY(__arch_hweight32) | ||
30 | ba,pt %xcc, __sw_hweight32 | ||
31 | nop | ||
32 | nop | ||
33 | ENDPROC(__arch_hweight32) | ||
34 | .section .popc_3insn_patch, "ax" | ||
35 | .word __arch_hweight32 | ||
36 | sllx %o0, 64-32, %g1 | ||
37 | retl | ||
38 | popc %g1, %o0 | ||
39 | .previous | ||
40 | |||
41 | ENTRY(__arch_hweight64) | ||
42 | ba,pt %xcc, __sw_hweight64 | ||
43 | nop | ||
44 | nop | ||
45 | ENDPROC(__arch_hweight64) | ||
46 | .section .popc_3insn_patch, "ax" | ||
47 | .word __arch_hweight64 | ||
48 | retl | ||
49 | popc %o0, %o0 | ||
50 | nop | ||
51 | .previous | ||
diff --git a/arch/sparc/mm/init_64.c b/arch/sparc/mm/init_64.c index 3fd8e18bed80..adfac23d976a 100644 --- a/arch/sparc/mm/init_64.c +++ b/arch/sparc/mm/init_64.c | |||
@@ -1597,6 +1597,42 @@ static void __init tsb_phys_patch(void) | |||
1597 | static struct hv_tsb_descr ktsb_descr[NUM_KTSB_DESCR]; | 1597 | static struct hv_tsb_descr ktsb_descr[NUM_KTSB_DESCR]; |
1598 | extern struct tsb swapper_tsb[KERNEL_TSB_NENTRIES]; | 1598 | extern struct tsb swapper_tsb[KERNEL_TSB_NENTRIES]; |
1599 | 1599 | ||
1600 | static void patch_one_ktsb_phys(unsigned int *start, unsigned int *end, unsigned long pa) | ||
1601 | { | ||
1602 | pa >>= KTSB_PHYS_SHIFT; | ||
1603 | |||
1604 | while (start < end) { | ||
1605 | unsigned int *ia = (unsigned int *)(unsigned long)*start; | ||
1606 | |||
1607 | ia[0] = (ia[0] & ~0x3fffff) | (pa >> 10); | ||
1608 | __asm__ __volatile__("flush %0" : : "r" (ia)); | ||
1609 | |||
1610 | ia[1] = (ia[1] & ~0x3ff) | (pa & 0x3ff); | ||
1611 | __asm__ __volatile__("flush %0" : : "r" (ia + 1)); | ||
1612 | |||
1613 | start++; | ||
1614 | } | ||
1615 | } | ||
1616 | |||
1617 | static void ktsb_phys_patch(void) | ||
1618 | { | ||
1619 | extern unsigned int __swapper_tsb_phys_patch; | ||
1620 | extern unsigned int __swapper_tsb_phys_patch_end; | ||
1621 | extern unsigned int __swapper_4m_tsb_phys_patch; | ||
1622 | extern unsigned int __swapper_4m_tsb_phys_patch_end; | ||
1623 | unsigned long ktsb_pa; | ||
1624 | |||
1625 | ktsb_pa = kern_base + ((unsigned long)&swapper_tsb[0] - KERNBASE); | ||
1626 | patch_one_ktsb_phys(&__swapper_tsb_phys_patch, | ||
1627 | &__swapper_tsb_phys_patch_end, ktsb_pa); | ||
1628 | #ifndef CONFIG_DEBUG_PAGEALLOC | ||
1629 | ktsb_pa = (kern_base + | ||
1630 | ((unsigned long)&swapper_4m_tsb[0] - KERNBASE)); | ||
1631 | patch_one_ktsb_phys(&__swapper_4m_tsb_phys_patch, | ||
1632 | &__swapper_4m_tsb_phys_patch_end, ktsb_pa); | ||
1633 | #endif | ||
1634 | } | ||
1635 | |||
1600 | static void __init sun4v_ktsb_init(void) | 1636 | static void __init sun4v_ktsb_init(void) |
1601 | { | 1637 | { |
1602 | unsigned long ktsb_pa; | 1638 | unsigned long ktsb_pa; |
@@ -1716,8 +1752,10 @@ void __init paging_init(void) | |||
1716 | sun4u_pgprot_init(); | 1752 | sun4u_pgprot_init(); |
1717 | 1753 | ||
1718 | if (tlb_type == cheetah_plus || | 1754 | if (tlb_type == cheetah_plus || |
1719 | tlb_type == hypervisor) | 1755 | tlb_type == hypervisor) { |
1720 | tsb_phys_patch(); | 1756 | tsb_phys_patch(); |
1757 | ktsb_phys_patch(); | ||
1758 | } | ||
1721 | 1759 | ||
1722 | if (tlb_type == hypervisor) { | 1760 | if (tlb_type == hypervisor) { |
1723 | sun4v_patch_tlb_handlers(); | 1761 | sun4v_patch_tlb_handlers(); |
diff --git a/arch/tile/Kconfig b/arch/tile/Kconfig index 0249b8b4db54..b30f71ac0d06 100644 --- a/arch/tile/Kconfig +++ b/arch/tile/Kconfig | |||
@@ -12,6 +12,7 @@ config TILE | |||
12 | select GENERIC_PENDING_IRQ if SMP | 12 | select GENERIC_PENDING_IRQ if SMP |
13 | select GENERIC_IRQ_SHOW | 13 | select GENERIC_IRQ_SHOW |
14 | select SYS_HYPERVISOR | 14 | select SYS_HYPERVISOR |
15 | select ARCH_HAVE_NMI_SAFE_CMPXCHG if !M386 | ||
15 | 16 | ||
16 | # FIXME: investigate whether we need/want these options. | 17 | # FIXME: investigate whether we need/want these options. |
17 | # select HAVE_IOREMAP_PROT | 18 | # select HAVE_IOREMAP_PROT |
diff --git a/arch/tile/include/asm/Kbuild b/arch/tile/include/asm/Kbuild index 849ab2fa1f5c..aec60dc06007 100644 --- a/arch/tile/include/asm/Kbuild +++ b/arch/tile/include/asm/Kbuild | |||
@@ -2,3 +2,41 @@ include include/asm-generic/Kbuild.asm | |||
2 | 2 | ||
3 | header-y += ucontext.h | 3 | header-y += ucontext.h |
4 | header-y += hardwall.h | 4 | header-y += hardwall.h |
5 | |||
6 | generic-y += bug.h | ||
7 | generic-y += bugs.h | ||
8 | generic-y += cputime.h | ||
9 | generic-y += device.h | ||
10 | generic-y += div64.h | ||
11 | generic-y += emergency-restart.h | ||
12 | generic-y += errno.h | ||
13 | generic-y += fb.h | ||
14 | generic-y += fcntl.h | ||
15 | generic-y += ioctl.h | ||
16 | generic-y += ioctls.h | ||
17 | generic-y += ipc.h | ||
18 | generic-y += ipcbuf.h | ||
19 | generic-y += irq_regs.h | ||
20 | generic-y += kdebug.h | ||
21 | generic-y += local.h | ||
22 | generic-y += module.h | ||
23 | generic-y += msgbuf.h | ||
24 | generic-y += mutex.h | ||
25 | generic-y += param.h | ||
26 | generic-y += parport.h | ||
27 | generic-y += poll.h | ||
28 | generic-y += posix_types.h | ||
29 | generic-y += resource.h | ||
30 | generic-y += scatterlist.h | ||
31 | generic-y += sembuf.h | ||
32 | generic-y += serial.h | ||
33 | generic-y += shmbuf.h | ||
34 | generic-y += shmparam.h | ||
35 | generic-y += socket.h | ||
36 | generic-y += sockios.h | ||
37 | generic-y += statfs.h | ||
38 | generic-y += termbits.h | ||
39 | generic-y += termios.h | ||
40 | generic-y += types.h | ||
41 | generic-y += ucontext.h | ||
42 | generic-y += xor.h | ||
diff --git a/arch/tile/include/asm/bug.h b/arch/tile/include/asm/bug.h deleted file mode 100644 index b12fd89e42e9..000000000000 --- a/arch/tile/include/asm/bug.h +++ /dev/null | |||
@@ -1 +0,0 @@ | |||
1 | #include <asm-generic/bug.h> | ||
diff --git a/arch/tile/include/asm/bugs.h b/arch/tile/include/asm/bugs.h deleted file mode 100644 index 61791e1ad9f5..000000000000 --- a/arch/tile/include/asm/bugs.h +++ /dev/null | |||
@@ -1 +0,0 @@ | |||
1 | #include <asm-generic/bugs.h> | ||
diff --git a/arch/tile/include/asm/cputime.h b/arch/tile/include/asm/cputime.h deleted file mode 100644 index 6d68ad7e0ea3..000000000000 --- a/arch/tile/include/asm/cputime.h +++ /dev/null | |||
@@ -1 +0,0 @@ | |||
1 | #include <asm-generic/cputime.h> | ||
diff --git a/arch/tile/include/asm/device.h b/arch/tile/include/asm/device.h deleted file mode 100644 index f0a4c256403b..000000000000 --- a/arch/tile/include/asm/device.h +++ /dev/null | |||
@@ -1 +0,0 @@ | |||
1 | #include <asm-generic/device.h> | ||
diff --git a/arch/tile/include/asm/div64.h b/arch/tile/include/asm/div64.h deleted file mode 100644 index 6cd978cefb28..000000000000 --- a/arch/tile/include/asm/div64.h +++ /dev/null | |||
@@ -1 +0,0 @@ | |||
1 | #include <asm-generic/div64.h> | ||
diff --git a/arch/tile/include/asm/emergency-restart.h b/arch/tile/include/asm/emergency-restart.h deleted file mode 100644 index 3711bd9d50bd..000000000000 --- a/arch/tile/include/asm/emergency-restart.h +++ /dev/null | |||
@@ -1 +0,0 @@ | |||
1 | #include <asm-generic/emergency-restart.h> | ||
diff --git a/arch/tile/include/asm/errno.h b/arch/tile/include/asm/errno.h deleted file mode 100644 index 4c82b503d92f..000000000000 --- a/arch/tile/include/asm/errno.h +++ /dev/null | |||
@@ -1 +0,0 @@ | |||
1 | #include <asm-generic/errno.h> | ||
diff --git a/arch/tile/include/asm/fb.h b/arch/tile/include/asm/fb.h deleted file mode 100644 index 3a4988e8df45..000000000000 --- a/arch/tile/include/asm/fb.h +++ /dev/null | |||
@@ -1 +0,0 @@ | |||
1 | #include <asm-generic/fb.h> | ||
diff --git a/arch/tile/include/asm/fcntl.h b/arch/tile/include/asm/fcntl.h deleted file mode 100644 index 46ab12db5739..000000000000 --- a/arch/tile/include/asm/fcntl.h +++ /dev/null | |||
@@ -1 +0,0 @@ | |||
1 | #include <asm-generic/fcntl.h> | ||
diff --git a/arch/tile/include/asm/fixmap.h b/arch/tile/include/asm/fixmap.h index 51537ff9265a..c66f7933beaa 100644 --- a/arch/tile/include/asm/fixmap.h +++ b/arch/tile/include/asm/fixmap.h | |||
@@ -75,12 +75,6 @@ extern void __set_fixmap(enum fixed_addresses idx, | |||
75 | 75 | ||
76 | #define set_fixmap(idx, phys) \ | 76 | #define set_fixmap(idx, phys) \ |
77 | __set_fixmap(idx, phys, PAGE_KERNEL) | 77 | __set_fixmap(idx, phys, PAGE_KERNEL) |
78 | /* | ||
79 | * Some hardware wants to get fixmapped without caching. | ||
80 | */ | ||
81 | #define set_fixmap_nocache(idx, phys) \ | ||
82 | __set_fixmap(idx, phys, PAGE_KERNEL_NOCACHE) | ||
83 | |||
84 | #define clear_fixmap(idx) \ | 78 | #define clear_fixmap(idx) \ |
85 | __set_fixmap(idx, 0, __pgprot(0)) | 79 | __set_fixmap(idx, 0, __pgprot(0)) |
86 | 80 | ||
diff --git a/arch/tile/include/asm/ioctl.h b/arch/tile/include/asm/ioctl.h deleted file mode 100644 index b279fe06dfe5..000000000000 --- a/arch/tile/include/asm/ioctl.h +++ /dev/null | |||
@@ -1 +0,0 @@ | |||
1 | #include <asm-generic/ioctl.h> | ||
diff --git a/arch/tile/include/asm/ioctls.h b/arch/tile/include/asm/ioctls.h deleted file mode 100644 index ec34c760665e..000000000000 --- a/arch/tile/include/asm/ioctls.h +++ /dev/null | |||
@@ -1 +0,0 @@ | |||
1 | #include <asm-generic/ioctls.h> | ||
diff --git a/arch/tile/include/asm/ipc.h b/arch/tile/include/asm/ipc.h deleted file mode 100644 index a46e3d9c2a3f..000000000000 --- a/arch/tile/include/asm/ipc.h +++ /dev/null | |||
@@ -1 +0,0 @@ | |||
1 | #include <asm-generic/ipc.h> | ||
diff --git a/arch/tile/include/asm/ipcbuf.h b/arch/tile/include/asm/ipcbuf.h deleted file mode 100644 index 84c7e51cb6d0..000000000000 --- a/arch/tile/include/asm/ipcbuf.h +++ /dev/null | |||
@@ -1 +0,0 @@ | |||
1 | #include <asm-generic/ipcbuf.h> | ||
diff --git a/arch/tile/include/asm/irq_regs.h b/arch/tile/include/asm/irq_regs.h deleted file mode 100644 index 3dd9c0b70270..000000000000 --- a/arch/tile/include/asm/irq_regs.h +++ /dev/null | |||
@@ -1 +0,0 @@ | |||
1 | #include <asm-generic/irq_regs.h> | ||
diff --git a/arch/tile/include/asm/kdebug.h b/arch/tile/include/asm/kdebug.h deleted file mode 100644 index 6ece1b037665..000000000000 --- a/arch/tile/include/asm/kdebug.h +++ /dev/null | |||
@@ -1 +0,0 @@ | |||
1 | #include <asm-generic/kdebug.h> | ||
diff --git a/arch/tile/include/asm/local.h b/arch/tile/include/asm/local.h deleted file mode 100644 index c11c530f74d0..000000000000 --- a/arch/tile/include/asm/local.h +++ /dev/null | |||
@@ -1 +0,0 @@ | |||
1 | #include <asm-generic/local.h> | ||
diff --git a/arch/tile/include/asm/module.h b/arch/tile/include/asm/module.h deleted file mode 100644 index 1e4b79fe8584..000000000000 --- a/arch/tile/include/asm/module.h +++ /dev/null | |||
@@ -1 +0,0 @@ | |||
1 | #include <asm-generic/module.h> | ||
diff --git a/arch/tile/include/asm/msgbuf.h b/arch/tile/include/asm/msgbuf.h deleted file mode 100644 index 809134c644a6..000000000000 --- a/arch/tile/include/asm/msgbuf.h +++ /dev/null | |||
@@ -1 +0,0 @@ | |||
1 | #include <asm-generic/msgbuf.h> | ||
diff --git a/arch/tile/include/asm/mutex.h b/arch/tile/include/asm/mutex.h deleted file mode 100644 index ff6101aa2c71..000000000000 --- a/arch/tile/include/asm/mutex.h +++ /dev/null | |||
@@ -1 +0,0 @@ | |||
1 | #include <asm-generic/mutex-dec.h> | ||
diff --git a/arch/tile/include/asm/param.h b/arch/tile/include/asm/param.h deleted file mode 100644 index 965d45427975..000000000000 --- a/arch/tile/include/asm/param.h +++ /dev/null | |||
@@ -1 +0,0 @@ | |||
1 | #include <asm-generic/param.h> | ||
diff --git a/arch/tile/include/asm/parport.h b/arch/tile/include/asm/parport.h deleted file mode 100644 index cf252af64590..000000000000 --- a/arch/tile/include/asm/parport.h +++ /dev/null | |||
@@ -1 +0,0 @@ | |||
1 | #include <asm-generic/parport.h> | ||
diff --git a/arch/tile/include/asm/poll.h b/arch/tile/include/asm/poll.h deleted file mode 100644 index c98509d3149e..000000000000 --- a/arch/tile/include/asm/poll.h +++ /dev/null | |||
@@ -1 +0,0 @@ | |||
1 | #include <asm-generic/poll.h> | ||
diff --git a/arch/tile/include/asm/posix_types.h b/arch/tile/include/asm/posix_types.h deleted file mode 100644 index 22cae6230ceb..000000000000 --- a/arch/tile/include/asm/posix_types.h +++ /dev/null | |||
@@ -1 +0,0 @@ | |||
1 | #include <asm-generic/posix_types.h> | ||
diff --git a/arch/tile/include/asm/resource.h b/arch/tile/include/asm/resource.h deleted file mode 100644 index 04bc4db8921b..000000000000 --- a/arch/tile/include/asm/resource.h +++ /dev/null | |||
@@ -1 +0,0 @@ | |||
1 | #include <asm-generic/resource.h> | ||
diff --git a/arch/tile/include/asm/scatterlist.h b/arch/tile/include/asm/scatterlist.h deleted file mode 100644 index 35d786fe93ae..000000000000 --- a/arch/tile/include/asm/scatterlist.h +++ /dev/null | |||
@@ -1 +0,0 @@ | |||
1 | #include <asm-generic/scatterlist.h> | ||
diff --git a/arch/tile/include/asm/sembuf.h b/arch/tile/include/asm/sembuf.h deleted file mode 100644 index 7673b83cfef7..000000000000 --- a/arch/tile/include/asm/sembuf.h +++ /dev/null | |||
@@ -1 +0,0 @@ | |||
1 | #include <asm-generic/sembuf.h> | ||
diff --git a/arch/tile/include/asm/serial.h b/arch/tile/include/asm/serial.h deleted file mode 100644 index a0cb0caff152..000000000000 --- a/arch/tile/include/asm/serial.h +++ /dev/null | |||
@@ -1 +0,0 @@ | |||
1 | #include <asm-generic/serial.h> | ||
diff --git a/arch/tile/include/asm/shmbuf.h b/arch/tile/include/asm/shmbuf.h deleted file mode 100644 index 83c05fc2de38..000000000000 --- a/arch/tile/include/asm/shmbuf.h +++ /dev/null | |||
@@ -1 +0,0 @@ | |||
1 | #include <asm-generic/shmbuf.h> | ||
diff --git a/arch/tile/include/asm/shmparam.h b/arch/tile/include/asm/shmparam.h deleted file mode 100644 index 93f30deb95d0..000000000000 --- a/arch/tile/include/asm/shmparam.h +++ /dev/null | |||
@@ -1 +0,0 @@ | |||
1 | #include <asm-generic/shmparam.h> | ||
diff --git a/arch/tile/include/asm/socket.h b/arch/tile/include/asm/socket.h deleted file mode 100644 index 6b71384b9d8b..000000000000 --- a/arch/tile/include/asm/socket.h +++ /dev/null | |||
@@ -1 +0,0 @@ | |||
1 | #include <asm-generic/socket.h> | ||
diff --git a/arch/tile/include/asm/sockios.h b/arch/tile/include/asm/sockios.h deleted file mode 100644 index def6d4746ee7..000000000000 --- a/arch/tile/include/asm/sockios.h +++ /dev/null | |||
@@ -1 +0,0 @@ | |||
1 | #include <asm-generic/sockios.h> | ||
diff --git a/arch/tile/include/asm/statfs.h b/arch/tile/include/asm/statfs.h deleted file mode 100644 index 0b91fe198c20..000000000000 --- a/arch/tile/include/asm/statfs.h +++ /dev/null | |||
@@ -1 +0,0 @@ | |||
1 | #include <asm-generic/statfs.h> | ||
diff --git a/arch/tile/include/asm/termbits.h b/arch/tile/include/asm/termbits.h deleted file mode 100644 index 3935b106de79..000000000000 --- a/arch/tile/include/asm/termbits.h +++ /dev/null | |||
@@ -1 +0,0 @@ | |||
1 | #include <asm-generic/termbits.h> | ||
diff --git a/arch/tile/include/asm/termios.h b/arch/tile/include/asm/termios.h deleted file mode 100644 index 280d78a9d966..000000000000 --- a/arch/tile/include/asm/termios.h +++ /dev/null | |||
@@ -1 +0,0 @@ | |||
1 | #include <asm-generic/termios.h> | ||
diff --git a/arch/tile/include/asm/types.h b/arch/tile/include/asm/types.h deleted file mode 100644 index b9e79bc580dd..000000000000 --- a/arch/tile/include/asm/types.h +++ /dev/null | |||
@@ -1 +0,0 @@ | |||
1 | #include <asm-generic/types.h> | ||
diff --git a/arch/tile/include/asm/ucontext.h b/arch/tile/include/asm/ucontext.h deleted file mode 100644 index 9bc07b9f30fb..000000000000 --- a/arch/tile/include/asm/ucontext.h +++ /dev/null | |||
@@ -1 +0,0 @@ | |||
1 | #include <asm-generic/ucontext.h> | ||
diff --git a/arch/tile/include/asm/xor.h b/arch/tile/include/asm/xor.h deleted file mode 100644 index c82eb12a5b18..000000000000 --- a/arch/tile/include/asm/xor.h +++ /dev/null | |||
@@ -1 +0,0 @@ | |||
1 | #include <asm-generic/xor.h> | ||
diff --git a/arch/tile/include/hv/drv_srom_intf.h b/arch/tile/include/hv/drv_srom_intf.h new file mode 100644 index 000000000000..6395faa6d9e6 --- /dev/null +++ b/arch/tile/include/hv/drv_srom_intf.h | |||
@@ -0,0 +1,41 @@ | |||
1 | /* | ||
2 | * Copyright 2011 Tilera Corporation. All Rights Reserved. | ||
3 | * | ||
4 | * This program is free software; you can redistribute it and/or | ||
5 | * modify it under the terms of the GNU General Public License | ||
6 | * as published by the Free Software Foundation, version 2. | ||
7 | * | ||
8 | * This program is distributed in the hope that it will be useful, but | ||
9 | * WITHOUT ANY WARRANTY; without even the implied warranty of | ||
10 | * MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE, GOOD TITLE or | ||
11 | * NON INFRINGEMENT. See the GNU General Public License for | ||
12 | * more details. | ||
13 | */ | ||
14 | |||
15 | /** | ||
16 | * @file drv_srom_intf.h | ||
17 | * Interface definitions for the SPI Flash ROM driver. | ||
18 | */ | ||
19 | |||
20 | #ifndef _SYS_HV_INCLUDE_DRV_SROM_INTF_H | ||
21 | #define _SYS_HV_INCLUDE_DRV_SROM_INTF_H | ||
22 | |||
23 | /** Read this offset to get the total device size. */ | ||
24 | #define SROM_TOTAL_SIZE_OFF 0xF0000000 | ||
25 | |||
26 | /** Read this offset to get the device sector size. */ | ||
27 | #define SROM_SECTOR_SIZE_OFF 0xF0000004 | ||
28 | |||
29 | /** Read this offset to get the device page size. */ | ||
30 | #define SROM_PAGE_SIZE_OFF 0xF0000008 | ||
31 | |||
32 | /** Write this offset to flush any pending writes. */ | ||
33 | #define SROM_FLUSH_OFF 0xF1000000 | ||
34 | |||
35 | /** Write this offset, plus the byte offset of the start of a sector, to | ||
36 | * erase a sector. Any write data is ignored, but there must be at least | ||
37 | * one byte of write data. Only applies when the driver is in MTD mode. | ||
38 | */ | ||
39 | #define SROM_ERASE_OFF 0xF2000000 | ||
40 | |||
41 | #endif /* _SYS_HV_INCLUDE_DRV_SROM_INTF_H */ | ||
diff --git a/arch/tile/kernel/pci.c b/arch/tile/kernel/pci.c index 6d4cb5d7a9fd..2a8014cb1ff5 100644 --- a/arch/tile/kernel/pci.c +++ b/arch/tile/kernel/pci.c | |||
@@ -228,7 +228,7 @@ err_cont: | |||
228 | * (pin - 1) converts from the PCI standard's [1:4] convention to | 228 | * (pin - 1) converts from the PCI standard's [1:4] convention to |
229 | * a normal [0:3] range. | 229 | * a normal [0:3] range. |
230 | */ | 230 | */ |
231 | static int tile_map_irq(struct pci_dev *dev, u8 slot, u8 pin) | 231 | static int tile_map_irq(const struct pci_dev *dev, u8 slot, u8 pin) |
232 | { | 232 | { |
233 | struct pci_controller *controller = | 233 | struct pci_controller *controller = |
234 | (struct pci_controller *)dev->sysdata; | 234 | (struct pci_controller *)dev->sysdata; |
diff --git a/arch/tile/kernel/time.c b/arch/tile/kernel/time.c index c4be58cc5d50..f6f50f2a5e37 100644 --- a/arch/tile/kernel/time.c +++ b/arch/tile/kernel/time.c | |||
@@ -78,7 +78,6 @@ static struct clocksource cycle_counter_cs = { | |||
78 | .rating = 300, | 78 | .rating = 300, |
79 | .read = clocksource_get_cycles, | 79 | .read = clocksource_get_cycles, |
80 | .mask = CLOCKSOURCE_MASK(64), | 80 | .mask = CLOCKSOURCE_MASK(64), |
81 | .shift = 22, /* typical value, e.g. x86 tsc uses this */ | ||
82 | .flags = CLOCK_SOURCE_IS_CONTINUOUS, | 81 | .flags = CLOCK_SOURCE_IS_CONTINUOUS, |
83 | }; | 82 | }; |
84 | 83 | ||
@@ -91,8 +90,6 @@ void __init setup_clock(void) | |||
91 | cycles_per_sec = hv_sysconf(HV_SYSCONF_CPU_SPEED); | 90 | cycles_per_sec = hv_sysconf(HV_SYSCONF_CPU_SPEED); |
92 | sched_clock_mult = | 91 | sched_clock_mult = |
93 | clocksource_hz2mult(cycles_per_sec, SCHED_CLOCK_SHIFT); | 92 | clocksource_hz2mult(cycles_per_sec, SCHED_CLOCK_SHIFT); |
94 | cycle_counter_cs.mult = | ||
95 | clocksource_hz2mult(cycles_per_sec, cycle_counter_cs.shift); | ||
96 | } | 93 | } |
97 | 94 | ||
98 | void __init calibrate_delay(void) | 95 | void __init calibrate_delay(void) |
@@ -107,7 +104,7 @@ void __init calibrate_delay(void) | |||
107 | void __init time_init(void) | 104 | void __init time_init(void) |
108 | { | 105 | { |
109 | /* Initialize and register the clock source. */ | 106 | /* Initialize and register the clock source. */ |
110 | clocksource_register(&cycle_counter_cs); | 107 | clocksource_register_hz(&cycle_counter_cs, cycles_per_sec); |
111 | 108 | ||
112 | /* Start up the tile-timer interrupt source on the boot cpu. */ | 109 | /* Start up the tile-timer interrupt source on the boot cpu. */ |
113 | setup_tile_timer(); | 110 | setup_tile_timer(); |
diff --git a/arch/tile/mm/init.c b/arch/tile/mm/init.c index 4e10c4023028..7309988c9794 100644 --- a/arch/tile/mm/init.c +++ b/arch/tile/mm/init.c | |||
@@ -836,8 +836,7 @@ void __init mem_init(void) | |||
836 | #endif | 836 | #endif |
837 | 837 | ||
838 | #ifdef CONFIG_FLATMEM | 838 | #ifdef CONFIG_FLATMEM |
839 | if (!mem_map) | 839 | BUG_ON(!mem_map); |
840 | BUG(); | ||
841 | #endif | 840 | #endif |
842 | 841 | ||
843 | #ifdef CONFIG_HIGHMEM | 842 | #ifdef CONFIG_HIGHMEM |
diff --git a/arch/unicore32/kernel/pci.c b/arch/unicore32/kernel/pci.c index 100eab842e66..4892fbb54ebf 100644 --- a/arch/unicore32/kernel/pci.c +++ b/arch/unicore32/kernel/pci.c | |||
@@ -102,7 +102,7 @@ void pci_puv3_preinit(void) | |||
102 | writel(readl(PCIBRI_CMD) | PCIBRI_CMD_IO | PCIBRI_CMD_MEM, PCIBRI_CMD); | 102 | writel(readl(PCIBRI_CMD) | PCIBRI_CMD_IO | PCIBRI_CMD_MEM, PCIBRI_CMD); |
103 | } | 103 | } |
104 | 104 | ||
105 | static int __init pci_puv3_map_irq(struct pci_dev *dev, u8 slot, u8 pin) | 105 | static int __init pci_puv3_map_irq(const struct pci_dev *dev, u8 slot, u8 pin) |
106 | { | 106 | { |
107 | if (dev->bus->number == 0) { | 107 | if (dev->bus->number == 0) { |
108 | #ifdef CONFIG_ARCH_FPGA /* 4 pci slots */ | 108 | #ifdef CONFIG_ARCH_FPGA /* 4 pci slots */ |
diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig index 153aa6f78299..6a47bb22657f 100644 --- a/arch/x86/Kconfig +++ b/arch/x86/Kconfig | |||
@@ -72,6 +72,7 @@ config X86 | |||
72 | select USE_GENERIC_SMP_HELPERS if SMP | 72 | select USE_GENERIC_SMP_HELPERS if SMP |
73 | select HAVE_BPF_JIT if (X86_64 && NET) | 73 | select HAVE_BPF_JIT if (X86_64 && NET) |
74 | select CLKEVT_I8253 | 74 | select CLKEVT_I8253 |
75 | select ARCH_HAVE_NMI_SAFE_CMPXCHG | ||
75 | 76 | ||
76 | config INSTRUCTION_DECODER | 77 | config INSTRUCTION_DECODER |
77 | def_bool (KPROBES || PERF_EVENTS) | 78 | def_bool (KPROBES || PERF_EVENTS) |
@@ -1905,7 +1906,7 @@ config PCI_BIOS | |||
1905 | # x86-64 doesn't support PCI BIOS access from long mode so always go direct. | 1906 | # x86-64 doesn't support PCI BIOS access from long mode so always go direct. |
1906 | config PCI_DIRECT | 1907 | config PCI_DIRECT |
1907 | def_bool y | 1908 | def_bool y |
1908 | depends on PCI && (X86_64 || (PCI_GODIRECT || PCI_GOANY || PCI_GOOLPC)) | 1909 | depends on PCI && (X86_64 || (PCI_GODIRECT || PCI_GOANY || PCI_GOOLPC || PCI_GOMMCONFIG)) |
1909 | 1910 | ||
1910 | config PCI_MMCONFIG | 1911 | config PCI_MMCONFIG |
1911 | def_bool y | 1912 | def_bool y |
diff --git a/arch/x86/include/asm/io.h b/arch/x86/include/asm/io.h index d02804d650c4..d8e8eefbe24c 100644 --- a/arch/x86/include/asm/io.h +++ b/arch/x86/include/asm/io.h | |||
@@ -40,8 +40,6 @@ | |||
40 | #include <linux/compiler.h> | 40 | #include <linux/compiler.h> |
41 | #include <asm/page.h> | 41 | #include <asm/page.h> |
42 | 42 | ||
43 | #include <xen/xen.h> | ||
44 | |||
45 | #define build_mmio_read(name, size, type, reg, barrier) \ | 43 | #define build_mmio_read(name, size, type, reg, barrier) \ |
46 | static inline type name(const volatile void __iomem *addr) \ | 44 | static inline type name(const volatile void __iomem *addr) \ |
47 | { type ret; asm volatile("mov" size " %1,%0":reg (ret) \ | 45 | { type ret; asm volatile("mov" size " %1,%0":reg (ret) \ |
@@ -334,6 +332,7 @@ extern void fixup_early_ioremap(void); | |||
334 | extern bool is_early_ioremap_ptep(pte_t *ptep); | 332 | extern bool is_early_ioremap_ptep(pte_t *ptep); |
335 | 333 | ||
336 | #ifdef CONFIG_XEN | 334 | #ifdef CONFIG_XEN |
335 | #include <xen/xen.h> | ||
337 | struct bio_vec; | 336 | struct bio_vec; |
338 | 337 | ||
339 | extern bool xen_biovec_phys_mergeable(const struct bio_vec *vec1, | 338 | extern bool xen_biovec_phys_mergeable(const struct bio_vec *vec1, |
diff --git a/arch/x86/include/asm/processor.h b/arch/x86/include/asm/processor.h index 219371546afd..0d1171c97729 100644 --- a/arch/x86/include/asm/processor.h +++ b/arch/x86/include/asm/processor.h | |||
@@ -751,8 +751,6 @@ static inline void __sti_mwait(unsigned long eax, unsigned long ecx) | |||
751 | :: "a" (eax), "c" (ecx)); | 751 | :: "a" (eax), "c" (ecx)); |
752 | } | 752 | } |
753 | 753 | ||
754 | extern void mwait_idle_with_hints(unsigned long eax, unsigned long ecx); | ||
755 | |||
756 | extern void select_idle_routine(const struct cpuinfo_x86 *c); | 754 | extern void select_idle_routine(const struct cpuinfo_x86 *c); |
757 | extern void init_amd_e400_c1e_mask(void); | 755 | extern void init_amd_e400_c1e_mask(void); |
758 | 756 | ||
diff --git a/arch/x86/kernel/acpi/cstate.c b/arch/x86/kernel/acpi/cstate.c index 5812404a0d4c..f50e7fb2a201 100644 --- a/arch/x86/kernel/acpi/cstate.c +++ b/arch/x86/kernel/acpi/cstate.c | |||
@@ -149,6 +149,29 @@ int acpi_processor_ffh_cstate_probe(unsigned int cpu, | |||
149 | } | 149 | } |
150 | EXPORT_SYMBOL_GPL(acpi_processor_ffh_cstate_probe); | 150 | EXPORT_SYMBOL_GPL(acpi_processor_ffh_cstate_probe); |
151 | 151 | ||
152 | /* | ||
153 | * This uses new MONITOR/MWAIT instructions on P4 processors with PNI, | ||
154 | * which can obviate IPI to trigger checking of need_resched. | ||
155 | * We execute MONITOR against need_resched and enter optimized wait state | ||
156 | * through MWAIT. Whenever someone changes need_resched, we would be woken | ||
157 | * up from MWAIT (without an IPI). | ||
158 | * | ||
159 | * New with Core Duo processors, MWAIT can take some hints based on CPU | ||
160 | * capability. | ||
161 | */ | ||
162 | void mwait_idle_with_hints(unsigned long ax, unsigned long cx) | ||
163 | { | ||
164 | if (!need_resched()) { | ||
165 | if (this_cpu_has(X86_FEATURE_CLFLUSH_MONITOR)) | ||
166 | clflush((void *)¤t_thread_info()->flags); | ||
167 | |||
168 | __monitor((void *)¤t_thread_info()->flags, 0, 0); | ||
169 | smp_mb(); | ||
170 | if (!need_resched()) | ||
171 | __mwait(ax, cx); | ||
172 | } | ||
173 | } | ||
174 | |||
152 | void acpi_processor_ffh_cstate_enter(struct acpi_processor_cx *cx) | 175 | void acpi_processor_ffh_cstate_enter(struct acpi_processor_cx *cx) |
153 | { | 176 | { |
154 | unsigned int cpu = smp_processor_id(); | 177 | unsigned int cpu = smp_processor_id(); |
diff --git a/arch/x86/kernel/process.c b/arch/x86/kernel/process.c index e1ba8cb24e4e..e7e3b019c439 100644 --- a/arch/x86/kernel/process.c +++ b/arch/x86/kernel/process.c | |||
@@ -438,29 +438,6 @@ void cpu_idle_wait(void) | |||
438 | } | 438 | } |
439 | EXPORT_SYMBOL_GPL(cpu_idle_wait); | 439 | EXPORT_SYMBOL_GPL(cpu_idle_wait); |
440 | 440 | ||
441 | /* | ||
442 | * This uses new MONITOR/MWAIT instructions on P4 processors with PNI, | ||
443 | * which can obviate IPI to trigger checking of need_resched. | ||
444 | * We execute MONITOR against need_resched and enter optimized wait state | ||
445 | * through MWAIT. Whenever someone changes need_resched, we would be woken | ||
446 | * up from MWAIT (without an IPI). | ||
447 | * | ||
448 | * New with Core Duo processors, MWAIT can take some hints based on CPU | ||
449 | * capability. | ||
450 | */ | ||
451 | void mwait_idle_with_hints(unsigned long ax, unsigned long cx) | ||
452 | { | ||
453 | if (!need_resched()) { | ||
454 | if (this_cpu_has(X86_FEATURE_CLFLUSH_MONITOR)) | ||
455 | clflush((void *)¤t_thread_info()->flags); | ||
456 | |||
457 | __monitor((void *)¤t_thread_info()->flags, 0, 0); | ||
458 | smp_mb(); | ||
459 | if (!need_resched()) | ||
460 | __mwait(ax, cx); | ||
461 | } | ||
462 | } | ||
463 | |||
464 | /* Default MONITOR/MWAIT with no hints, used for default C1 state */ | 441 | /* Default MONITOR/MWAIT with no hints, used for default C1 state */ |
465 | static void mwait_idle(void) | 442 | static void mwait_idle(void) |
466 | { | 443 | { |
diff --git a/arch/x86/kernel/process_32.c b/arch/x86/kernel/process_32.c index a3d0dc59067b..7a3b65107a27 100644 --- a/arch/x86/kernel/process_32.c +++ b/arch/x86/kernel/process_32.c | |||
@@ -38,6 +38,7 @@ | |||
38 | #include <linux/uaccess.h> | 38 | #include <linux/uaccess.h> |
39 | #include <linux/io.h> | 39 | #include <linux/io.h> |
40 | #include <linux/kdebug.h> | 40 | #include <linux/kdebug.h> |
41 | #include <linux/cpuidle.h> | ||
41 | 42 | ||
42 | #include <asm/pgtable.h> | 43 | #include <asm/pgtable.h> |
43 | #include <asm/system.h> | 44 | #include <asm/system.h> |
@@ -109,7 +110,8 @@ void cpu_idle(void) | |||
109 | local_irq_disable(); | 110 | local_irq_disable(); |
110 | /* Don't trace irqs off for idle */ | 111 | /* Don't trace irqs off for idle */ |
111 | stop_critical_timings(); | 112 | stop_critical_timings(); |
112 | pm_idle(); | 113 | if (cpuidle_idle_call()) |
114 | pm_idle(); | ||
113 | start_critical_timings(); | 115 | start_critical_timings(); |
114 | } | 116 | } |
115 | tick_nohz_restart_sched_tick(); | 117 | tick_nohz_restart_sched_tick(); |
diff --git a/arch/x86/kernel/process_64.c b/arch/x86/kernel/process_64.c index ca6f7ab8df33..f693e44e1bf6 100644 --- a/arch/x86/kernel/process_64.c +++ b/arch/x86/kernel/process_64.c | |||
@@ -37,6 +37,7 @@ | |||
37 | #include <linux/uaccess.h> | 37 | #include <linux/uaccess.h> |
38 | #include <linux/io.h> | 38 | #include <linux/io.h> |
39 | #include <linux/ftrace.h> | 39 | #include <linux/ftrace.h> |
40 | #include <linux/cpuidle.h> | ||
40 | 41 | ||
41 | #include <asm/pgtable.h> | 42 | #include <asm/pgtable.h> |
42 | #include <asm/system.h> | 43 | #include <asm/system.h> |
@@ -136,7 +137,8 @@ void cpu_idle(void) | |||
136 | enter_idle(); | 137 | enter_idle(); |
137 | /* Don't trace irqs off for idle */ | 138 | /* Don't trace irqs off for idle */ |
138 | stop_critical_timings(); | 139 | stop_critical_timings(); |
139 | pm_idle(); | 140 | if (cpuidle_idle_call()) |
141 | pm_idle(); | ||
140 | start_critical_timings(); | 142 | start_critical_timings(); |
141 | 143 | ||
142 | /* In many cases the interrupt that ended idle | 144 | /* In many cases the interrupt that ended idle |
diff --git a/arch/x86/pci/acpi.c b/arch/x86/pci/acpi.c index 68c3c1395202..ae3cb23cd89b 100644 --- a/arch/x86/pci/acpi.c +++ b/arch/x86/pci/acpi.c | |||
@@ -246,10 +246,9 @@ static void add_resources(struct pci_root_info *info) | |||
246 | 246 | ||
247 | conflict = insert_resource_conflict(root, res); | 247 | conflict = insert_resource_conflict(root, res); |
248 | if (conflict) | 248 | if (conflict) |
249 | dev_err(&info->bridge->dev, | 249 | dev_info(&info->bridge->dev, |
250 | "address space collision: host bridge window %pR " | 250 | "ignoring host bridge window %pR (conflicts with %s %pR)\n", |
251 | "conflicts with %s %pR\n", | 251 | res, conflict->name, conflict); |
252 | res, conflict->name, conflict); | ||
253 | else | 252 | else |
254 | pci_bus_add_resource(info->bus, res, 0); | 253 | pci_bus_add_resource(info->bus, res, 0); |
255 | } | 254 | } |
diff --git a/arch/x86/pci/ce4100.c b/arch/x86/pci/ce4100.c index 67858be4b52b..99176094500b 100644 --- a/arch/x86/pci/ce4100.c +++ b/arch/x86/pci/ce4100.c | |||
@@ -257,6 +257,7 @@ static int ce4100_conf_read(unsigned int seg, unsigned int bus, | |||
257 | { | 257 | { |
258 | int i; | 258 | int i; |
259 | 259 | ||
260 | WARN_ON(seg); | ||
260 | if (bus == 1) { | 261 | if (bus == 1) { |
261 | for (i = 0; i < ARRAY_SIZE(bus1_fixups); i++) { | 262 | for (i = 0; i < ARRAY_SIZE(bus1_fixups); i++) { |
262 | if (bus1_fixups[i].dev_func == devfn && | 263 | if (bus1_fixups[i].dev_func == devfn && |
@@ -282,6 +283,7 @@ static int ce4100_conf_write(unsigned int seg, unsigned int bus, | |||
282 | { | 283 | { |
283 | int i; | 284 | int i; |
284 | 285 | ||
286 | WARN_ON(seg); | ||
285 | if (bus == 1) { | 287 | if (bus == 1) { |
286 | for (i = 0; i < ARRAY_SIZE(bus1_fixups); i++) { | 288 | for (i = 0; i < ARRAY_SIZE(bus1_fixups); i++) { |
287 | if (bus1_fixups[i].dev_func == devfn && | 289 | if (bus1_fixups[i].dev_func == devfn && |
diff --git a/arch/x86/pci/common.c b/arch/x86/pci/common.c index 5fe75026ecc2..92df322e0b57 100644 --- a/arch/x86/pci/common.c +++ b/arch/x86/pci/common.c | |||
@@ -247,13 +247,6 @@ static const struct dmi_system_id __devinitconst pciprobe_dmi_table[] = { | |||
247 | }, | 247 | }, |
248 | #endif /* __i386__ */ | 248 | #endif /* __i386__ */ |
249 | { | 249 | { |
250 | .callback = find_sort_method, | ||
251 | .ident = "Dell System", | ||
252 | .matches = { | ||
253 | DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc"), | ||
254 | }, | ||
255 | }, | ||
256 | { | ||
257 | .callback = set_bf_sort, | 250 | .callback = set_bf_sort, |
258 | .ident = "Dell PowerEdge 1950", | 251 | .ident = "Dell PowerEdge 1950", |
259 | .matches = { | 252 | .matches = { |
@@ -294,6 +287,13 @@ static const struct dmi_system_id __devinitconst pciprobe_dmi_table[] = { | |||
294 | }, | 287 | }, |
295 | }, | 288 | }, |
296 | { | 289 | { |
290 | .callback = find_sort_method, | ||
291 | .ident = "Dell System", | ||
292 | .matches = { | ||
293 | DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc"), | ||
294 | }, | ||
295 | }, | ||
296 | { | ||
297 | .callback = set_bf_sort, | 297 | .callback = set_bf_sort, |
298 | .ident = "HP ProLiant BL20p G3", | 298 | .ident = "HP ProLiant BL20p G3", |
299 | .matches = { | 299 | .matches = { |
diff --git a/arch/x86/pci/direct.c b/arch/x86/pci/direct.c index e6fd8473fb7b..4f2c70439d7f 100644 --- a/arch/x86/pci/direct.c +++ b/arch/x86/pci/direct.c | |||
@@ -22,7 +22,7 @@ static int pci_conf1_read(unsigned int seg, unsigned int bus, | |||
22 | { | 22 | { |
23 | unsigned long flags; | 23 | unsigned long flags; |
24 | 24 | ||
25 | if ((bus > 255) || (devfn > 255) || (reg > 4095)) { | 25 | if (seg || (bus > 255) || (devfn > 255) || (reg > 4095)) { |
26 | *value = -1; | 26 | *value = -1; |
27 | return -EINVAL; | 27 | return -EINVAL; |
28 | } | 28 | } |
@@ -53,7 +53,7 @@ static int pci_conf1_write(unsigned int seg, unsigned int bus, | |||
53 | { | 53 | { |
54 | unsigned long flags; | 54 | unsigned long flags; |
55 | 55 | ||
56 | if ((bus > 255) || (devfn > 255) || (reg > 4095)) | 56 | if (seg || (bus > 255) || (devfn > 255) || (reg > 4095)) |
57 | return -EINVAL; | 57 | return -EINVAL; |
58 | 58 | ||
59 | raw_spin_lock_irqsave(&pci_config_lock, flags); | 59 | raw_spin_lock_irqsave(&pci_config_lock, flags); |
@@ -97,6 +97,7 @@ static int pci_conf2_read(unsigned int seg, unsigned int bus, | |||
97 | unsigned long flags; | 97 | unsigned long flags; |
98 | int dev, fn; | 98 | int dev, fn; |
99 | 99 | ||
100 | WARN_ON(seg); | ||
100 | if ((bus > 255) || (devfn > 255) || (reg > 255)) { | 101 | if ((bus > 255) || (devfn > 255) || (reg > 255)) { |
101 | *value = -1; | 102 | *value = -1; |
102 | return -EINVAL; | 103 | return -EINVAL; |
@@ -138,6 +139,7 @@ static int pci_conf2_write(unsigned int seg, unsigned int bus, | |||
138 | unsigned long flags; | 139 | unsigned long flags; |
139 | int dev, fn; | 140 | int dev, fn; |
140 | 141 | ||
142 | WARN_ON(seg); | ||
141 | if ((bus > 255) || (devfn > 255) || (reg > 255)) | 143 | if ((bus > 255) || (devfn > 255) || (reg > 255)) |
142 | return -EINVAL; | 144 | return -EINVAL; |
143 | 145 | ||
diff --git a/arch/x86/pci/numaq_32.c b/arch/x86/pci/numaq_32.c index 5c9e2458df4e..512a88c41501 100644 --- a/arch/x86/pci/numaq_32.c +++ b/arch/x86/pci/numaq_32.c | |||
@@ -34,6 +34,7 @@ static int pci_conf1_mq_read(unsigned int seg, unsigned int bus, | |||
34 | unsigned long flags; | 34 | unsigned long flags; |
35 | void *adr __iomem = XQUAD_PORT_ADDR(0xcfc, BUS2QUAD(bus)); | 35 | void *adr __iomem = XQUAD_PORT_ADDR(0xcfc, BUS2QUAD(bus)); |
36 | 36 | ||
37 | WARN_ON(seg); | ||
37 | if (!value || (bus >= MAX_MP_BUSSES) || (devfn > 255) || (reg > 255)) | 38 | if (!value || (bus >= MAX_MP_BUSSES) || (devfn > 255) || (reg > 255)) |
38 | return -EINVAL; | 39 | return -EINVAL; |
39 | 40 | ||
@@ -73,6 +74,7 @@ static int pci_conf1_mq_write(unsigned int seg, unsigned int bus, | |||
73 | unsigned long flags; | 74 | unsigned long flags; |
74 | void *adr __iomem = XQUAD_PORT_ADDR(0xcfc, BUS2QUAD(bus)); | 75 | void *adr __iomem = XQUAD_PORT_ADDR(0xcfc, BUS2QUAD(bus)); |
75 | 76 | ||
77 | WARN_ON(seg); | ||
76 | if ((bus >= MAX_MP_BUSSES) || (devfn > 255) || (reg > 255)) | 78 | if ((bus >= MAX_MP_BUSSES) || (devfn > 255) || (reg > 255)) |
77 | return -EINVAL; | 79 | return -EINVAL; |
78 | 80 | ||
diff --git a/arch/x86/pci/olpc.c b/arch/x86/pci/olpc.c index 13700ec8e2e4..5262603b04d9 100644 --- a/arch/x86/pci/olpc.c +++ b/arch/x86/pci/olpc.c | |||
@@ -206,6 +206,8 @@ static int pci_olpc_read(unsigned int seg, unsigned int bus, | |||
206 | { | 206 | { |
207 | uint32_t *addr; | 207 | uint32_t *addr; |
208 | 208 | ||
209 | WARN_ON(seg); | ||
210 | |||
209 | /* Use the hardware mechanism for non-simulated devices */ | 211 | /* Use the hardware mechanism for non-simulated devices */ |
210 | if (!is_simulated(bus, devfn)) | 212 | if (!is_simulated(bus, devfn)) |
211 | return pci_direct_conf1.read(seg, bus, devfn, reg, len, value); | 213 | return pci_direct_conf1.read(seg, bus, devfn, reg, len, value); |
@@ -264,6 +266,8 @@ static int pci_olpc_read(unsigned int seg, unsigned int bus, | |||
264 | static int pci_olpc_write(unsigned int seg, unsigned int bus, | 266 | static int pci_olpc_write(unsigned int seg, unsigned int bus, |
265 | unsigned int devfn, int reg, int len, uint32_t value) | 267 | unsigned int devfn, int reg, int len, uint32_t value) |
266 | { | 268 | { |
269 | WARN_ON(seg); | ||
270 | |||
267 | /* Use the hardware mechanism for non-simulated devices */ | 271 | /* Use the hardware mechanism for non-simulated devices */ |
268 | if (!is_simulated(bus, devfn)) | 272 | if (!is_simulated(bus, devfn)) |
269 | return pci_direct_conf1.write(seg, bus, devfn, reg, len, value); | 273 | return pci_direct_conf1.write(seg, bus, devfn, reg, len, value); |
diff --git a/arch/x86/pci/pcbios.c b/arch/x86/pci/pcbios.c index a5f7d0d63de0..f68553551467 100644 --- a/arch/x86/pci/pcbios.c +++ b/arch/x86/pci/pcbios.c | |||
@@ -181,6 +181,7 @@ static int pci_bios_read(unsigned int seg, unsigned int bus, | |||
181 | unsigned long flags; | 181 | unsigned long flags; |
182 | unsigned long bx = (bus << 8) | devfn; | 182 | unsigned long bx = (bus << 8) | devfn; |
183 | 183 | ||
184 | WARN_ON(seg); | ||
184 | if (!value || (bus > 255) || (devfn > 255) || (reg > 255)) | 185 | if (!value || (bus > 255) || (devfn > 255) || (reg > 255)) |
185 | return -EINVAL; | 186 | return -EINVAL; |
186 | 187 | ||
@@ -247,6 +248,7 @@ static int pci_bios_write(unsigned int seg, unsigned int bus, | |||
247 | unsigned long flags; | 248 | unsigned long flags; |
248 | unsigned long bx = (bus << 8) | devfn; | 249 | unsigned long bx = (bus << 8) | devfn; |
249 | 250 | ||
251 | WARN_ON(seg); | ||
250 | if ((bus > 255) || (devfn > 255) || (reg > 255)) | 252 | if ((bus > 255) || (devfn > 255) || (reg > 255)) |
251 | return -EINVAL; | 253 | return -EINVAL; |
252 | 254 | ||
diff --git a/arch/x86/pci/visws.c b/arch/x86/pci/visws.c index 03008f72eb04..6f2f8eeed171 100644 --- a/arch/x86/pci/visws.c +++ b/arch/x86/pci/visws.c | |||
@@ -24,7 +24,7 @@ static void pci_visws_disable_irq(struct pci_dev *dev) { } | |||
24 | 24 | ||
25 | unsigned int pci_bus0, pci_bus1; | 25 | unsigned int pci_bus0, pci_bus1; |
26 | 26 | ||
27 | static int __init visws_map_irq(struct pci_dev *dev, u8 slot, u8 pin) | 27 | static int __init visws_map_irq(const struct pci_dev *dev, u8 slot, u8 pin) |
28 | { | 28 | { |
29 | int irq, bus = dev->bus->number; | 29 | int irq, bus = dev->bus->number; |
30 | 30 | ||
diff --git a/arch/x86/platform/mrst/Makefile b/arch/x86/platform/mrst/Makefile index f61ccdd49341..1ea38775a6d3 100644 --- a/arch/x86/platform/mrst/Makefile +++ b/arch/x86/platform/mrst/Makefile | |||
@@ -1,3 +1,4 @@ | |||
1 | obj-$(CONFIG_X86_MRST) += mrst.o | 1 | obj-$(CONFIG_X86_MRST) += mrst.o |
2 | obj-$(CONFIG_X86_MRST) += vrtc.o | 2 | obj-$(CONFIG_X86_MRST) += vrtc.o |
3 | obj-$(CONFIG_EARLY_PRINTK_MRST) += early_printk_mrst.o | 3 | obj-$(CONFIG_EARLY_PRINTK_MRST) += early_printk_mrst.o |
4 | obj-$(CONFIG_X86_MRST) += pmu.o | ||
diff --git a/arch/x86/platform/mrst/pmu.c b/arch/x86/platform/mrst/pmu.c new file mode 100644 index 000000000000..9281da7d91bd --- /dev/null +++ b/arch/x86/platform/mrst/pmu.c | |||
@@ -0,0 +1,817 @@ | |||
1 | /* | ||
2 | * mrst/pmu.c - driver for MRST Power Management Unit | ||
3 | * | ||
4 | * Copyright (c) 2011, Intel Corporation. | ||
5 | * | ||
6 | * This program is free software; you can redistribute it and/or modify it | ||
7 | * under the terms and conditions of the GNU General Public License, | ||
8 | * version 2, as published by the Free Software Foundation. | ||
9 | * | ||
10 | * This program is distributed in the hope it will be useful, but WITHOUT | ||
11 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ||
12 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for | ||
13 | * more details. | ||
14 | * | ||
15 | * You should have received a copy of the GNU General Public License along with | ||
16 | * this program; if not, write to the Free Software Foundation, Inc., | ||
17 | * 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA. | ||
18 | */ | ||
19 | |||
20 | #include <linux/cpuidle.h> | ||
21 | #include <linux/debugfs.h> | ||
22 | #include <linux/delay.h> | ||
23 | #include <linux/interrupt.h> | ||
24 | #include <linux/module.h> | ||
25 | #include <linux/pci.h> | ||
26 | #include <linux/seq_file.h> | ||
27 | #include <linux/sfi.h> | ||
28 | #include <asm/intel_scu_ipc.h> | ||
29 | #include "pmu.h" | ||
30 | |||
31 | #define IPCMSG_FW_REVISION 0xF4 | ||
32 | |||
33 | struct mrst_device { | ||
34 | u16 pci_dev_num; /* DEBUG only */ | ||
35 | u16 lss; | ||
36 | u16 latest_request; | ||
37 | unsigned int pci_state_counts[PCI_D3cold + 1]; /* DEBUG only */ | ||
38 | }; | ||
39 | |||
40 | /* | ||
41 | * comlete list of MRST PCI devices | ||
42 | */ | ||
43 | static struct mrst_device mrst_devs[] = { | ||
44 | /* 0 */ { 0x0800, LSS_SPI0 }, /* Moorestown SPI Ctrl 0 */ | ||
45 | /* 1 */ { 0x0801, LSS_SPI1 }, /* Moorestown SPI Ctrl 1 */ | ||
46 | /* 2 */ { 0x0802, LSS_I2C0 }, /* Moorestown I2C 0 */ | ||
47 | /* 3 */ { 0x0803, LSS_I2C1 }, /* Moorestown I2C 1 */ | ||
48 | /* 4 */ { 0x0804, LSS_I2C2 }, /* Moorestown I2C 2 */ | ||
49 | /* 5 */ { 0x0805, LSS_KBD }, /* Moorestown Keyboard Ctrl */ | ||
50 | /* 6 */ { 0x0806, LSS_USB_HC }, /* Moorestown USB Ctrl */ | ||
51 | /* 7 */ { 0x0807, LSS_SD_HC0 }, /* Moorestown SD Host Ctrl 0 */ | ||
52 | /* 8 */ { 0x0808, LSS_SD_HC1 }, /* Moorestown SD Host Ctrl 1 */ | ||
53 | /* 9 */ { 0x0809, LSS_NAND }, /* Moorestown NAND Ctrl */ | ||
54 | /* 10 */ { 0x080a, LSS_AUDIO }, /* Moorestown Audio Ctrl */ | ||
55 | /* 11 */ { 0x080b, LSS_IMAGING }, /* Moorestown ISP */ | ||
56 | /* 12 */ { 0x080c, LSS_SECURITY }, /* Moorestown Security Controller */ | ||
57 | /* 13 */ { 0x080d, LSS_DISPLAY }, /* Moorestown External Displays */ | ||
58 | /* 14 */ { 0x080e, 0 }, /* Moorestown SCU IPC */ | ||
59 | /* 15 */ { 0x080f, LSS_GPIO }, /* Moorestown GPIO Controller */ | ||
60 | /* 16 */ { 0x0810, 0 }, /* Moorestown Power Management Unit */ | ||
61 | /* 17 */ { 0x0811, LSS_USB_OTG }, /* Moorestown OTG Ctrl */ | ||
62 | /* 18 */ { 0x0812, LSS_SPI2 }, /* Moorestown SPI Ctrl 2 */ | ||
63 | /* 19 */ { 0x0813, 0 }, /* Moorestown SC DMA */ | ||
64 | /* 20 */ { 0x0814, LSS_AUDIO_LPE }, /* Moorestown LPE DMA */ | ||
65 | /* 21 */ { 0x0815, LSS_AUDIO_SSP }, /* Moorestown SSP0 */ | ||
66 | |||
67 | /* 22 */ { 0x084F, LSS_SD_HC2 }, /* Moorestown SD Host Ctrl 2 */ | ||
68 | |||
69 | /* 23 */ { 0x4102, 0 }, /* Lincroft */ | ||
70 | /* 24 */ { 0x4110, 0 }, /* Lincroft */ | ||
71 | }; | ||
72 | |||
73 | /* n.b. We ignore PCI-id 0x815 in LSS9 b/c MeeGo has no driver for it */ | ||
74 | static u16 mrst_lss9_pci_ids[] = {0x080a, 0x0814, 0}; | ||
75 | static u16 mrst_lss10_pci_ids[] = {0x0800, 0x0801, 0x0802, 0x0803, | ||
76 | 0x0804, 0x0805, 0x080f, 0}; | ||
77 | |||
78 | /* handle concurrent SMP invokations of pmu_pci_set_power_state() */ | ||
79 | static spinlock_t mrst_pmu_power_state_lock; | ||
80 | |||
81 | static unsigned int wake_counters[MRST_NUM_LSS]; /* DEBUG only */ | ||
82 | static unsigned int pmu_irq_stats[INT_INVALID + 1]; /* DEBUG only */ | ||
83 | |||
84 | static int graphics_is_off; | ||
85 | static int lss_s0i3_enabled; | ||
86 | static bool mrst_pmu_s0i3_enable; | ||
87 | |||
88 | /* debug counters */ | ||
89 | static u32 pmu_wait_ready_calls; | ||
90 | static u32 pmu_wait_ready_udelays; | ||
91 | static u32 pmu_wait_ready_udelays_max; | ||
92 | static u32 pmu_wait_done_calls; | ||
93 | static u32 pmu_wait_done_udelays; | ||
94 | static u32 pmu_wait_done_udelays_max; | ||
95 | static u32 pmu_set_power_state_entry; | ||
96 | static u32 pmu_set_power_state_send_cmd; | ||
97 | |||
98 | static struct mrst_device *pci_id_2_mrst_dev(u16 pci_dev_num) | ||
99 | { | ||
100 | int index = 0; | ||
101 | |||
102 | if ((pci_dev_num >= 0x0800) && (pci_dev_num <= 0x815)) | ||
103 | index = pci_dev_num - 0x800; | ||
104 | else if (pci_dev_num == 0x084F) | ||
105 | index = 22; | ||
106 | else if (pci_dev_num == 0x4102) | ||
107 | index = 23; | ||
108 | else if (pci_dev_num == 0x4110) | ||
109 | index = 24; | ||
110 | |||
111 | if (pci_dev_num != mrst_devs[index].pci_dev_num) { | ||
112 | WARN_ONCE(1, FW_BUG "Unknown PCI device 0x%04X\n", pci_dev_num); | ||
113 | return 0; | ||
114 | } | ||
115 | |||
116 | return &mrst_devs[index]; | ||
117 | } | ||
118 | |||
119 | /** | ||
120 | * mrst_pmu_validate_cstates | ||
121 | * @dev: cpuidle_device | ||
122 | * | ||
123 | * Certain states are not appropriate for governor to pick in some cases. | ||
124 | * This function will be called as cpuidle_device's prepare callback and | ||
125 | * thus tells governor to ignore such states when selecting the next state | ||
126 | * to enter. | ||
127 | */ | ||
128 | |||
129 | #define IDLE_STATE4_IS_C6 4 | ||
130 | #define IDLE_STATE5_IS_S0I3 5 | ||
131 | |||
132 | int mrst_pmu_invalid_cstates(void) | ||
133 | { | ||
134 | int cpu = smp_processor_id(); | ||
135 | |||
136 | /* | ||
137 | * Demote to C4 if the PMU is busy. | ||
138 | * Since LSS changes leave the busy bit clear... | ||
139 | * busy means either the PMU is waiting for an ACK-C6 that | ||
140 | * isn't coming due to an MWAIT that returned immediately; | ||
141 | * or we returned from S0i3 successfully, and the PMU | ||
142 | * is not done sending us interrupts. | ||
143 | */ | ||
144 | if (pmu_read_busy_status()) | ||
145 | return 1 << IDLE_STATE4_IS_C6 | 1 << IDLE_STATE5_IS_S0I3; | ||
146 | |||
147 | /* | ||
148 | * Disallow S0i3 if: PMU is not initialized, or CPU1 is active, | ||
149 | * or if device LSS is insufficient, or the GPU is active, | ||
150 | * or if it has been explicitly disabled. | ||
151 | */ | ||
152 | if (!pmu_reg || !cpumask_equal(cpu_online_mask, cpumask_of(cpu)) || | ||
153 | !lss_s0i3_enabled || !graphics_is_off || !mrst_pmu_s0i3_enable) | ||
154 | return 1 << IDLE_STATE5_IS_S0I3; | ||
155 | else | ||
156 | return 0; | ||
157 | } | ||
158 | |||
159 | /* | ||
160 | * pmu_update_wake_counters(): read PM_WKS, update wake_counters[] | ||
161 | * DEBUG only. | ||
162 | */ | ||
163 | static void pmu_update_wake_counters(void) | ||
164 | { | ||
165 | int lss; | ||
166 | u32 wake_status; | ||
167 | |||
168 | wake_status = pmu_read_wks(); | ||
169 | |||
170 | for (lss = 0; lss < MRST_NUM_LSS; ++lss) { | ||
171 | if (wake_status & (1 << lss)) | ||
172 | wake_counters[lss]++; | ||
173 | } | ||
174 | } | ||
175 | |||
176 | int mrst_pmu_s0i3_entry(void) | ||
177 | { | ||
178 | int status; | ||
179 | |||
180 | /* Clear any possible error conditions */ | ||
181 | pmu_write_ics(0x300); | ||
182 | |||
183 | /* set wake control to current D-states */ | ||
184 | pmu_write_wssc(S0I3_SSS_TARGET); | ||
185 | |||
186 | status = mrst_s0i3_entry(PM_S0I3_COMMAND, &pmu_reg->pm_cmd); | ||
187 | pmu_update_wake_counters(); | ||
188 | return status; | ||
189 | } | ||
190 | |||
191 | /* poll for maximum of 5ms for busy bit to clear */ | ||
192 | static int pmu_wait_ready(void) | ||
193 | { | ||
194 | int udelays; | ||
195 | |||
196 | pmu_wait_ready_calls++; | ||
197 | |||
198 | for (udelays = 0; udelays < 500; ++udelays) { | ||
199 | if (udelays > pmu_wait_ready_udelays_max) | ||
200 | pmu_wait_ready_udelays_max = udelays; | ||
201 | |||
202 | if (pmu_read_busy_status() == 0) | ||
203 | return 0; | ||
204 | |||
205 | udelay(10); | ||
206 | pmu_wait_ready_udelays++; | ||
207 | } | ||
208 | |||
209 | /* | ||
210 | * if this fires, observe | ||
211 | * /sys/kernel/debug/mrst_pmu_wait_ready_calls | ||
212 | * /sys/kernel/debug/mrst_pmu_wait_ready_udelays | ||
213 | */ | ||
214 | WARN_ONCE(1, "SCU not ready for 5ms"); | ||
215 | return -EBUSY; | ||
216 | } | ||
217 | /* poll for maximum of 50ms us for busy bit to clear */ | ||
218 | static int pmu_wait_done(void) | ||
219 | { | ||
220 | int udelays; | ||
221 | |||
222 | pmu_wait_done_calls++; | ||
223 | |||
224 | for (udelays = 0; udelays < 500; ++udelays) { | ||
225 | if (udelays > pmu_wait_done_udelays_max) | ||
226 | pmu_wait_done_udelays_max = udelays; | ||
227 | |||
228 | if (pmu_read_busy_status() == 0) | ||
229 | return 0; | ||
230 | |||
231 | udelay(100); | ||
232 | pmu_wait_done_udelays++; | ||
233 | } | ||
234 | |||
235 | /* | ||
236 | * if this fires, observe | ||
237 | * /sys/kernel/debug/mrst_pmu_wait_done_calls | ||
238 | * /sys/kernel/debug/mrst_pmu_wait_done_udelays | ||
239 | */ | ||
240 | WARN_ONCE(1, "SCU not done for 50ms"); | ||
241 | return -EBUSY; | ||
242 | } | ||
243 | |||
244 | u32 mrst_pmu_msi_is_disabled(void) | ||
245 | { | ||
246 | return pmu_msi_is_disabled(); | ||
247 | } | ||
248 | |||
249 | void mrst_pmu_enable_msi(void) | ||
250 | { | ||
251 | pmu_msi_enable(); | ||
252 | } | ||
253 | |||
254 | /** | ||
255 | * pmu_irq - pmu driver interrupt handler | ||
256 | * Context: interrupt context | ||
257 | */ | ||
258 | static irqreturn_t pmu_irq(int irq, void *dummy) | ||
259 | { | ||
260 | union pmu_pm_ics pmu_ics; | ||
261 | |||
262 | pmu_ics.value = pmu_read_ics(); | ||
263 | |||
264 | if (!pmu_ics.bits.pending) | ||
265 | return IRQ_NONE; | ||
266 | |||
267 | switch (pmu_ics.bits.cause) { | ||
268 | case INT_SPURIOUS: | ||
269 | case INT_CMD_DONE: | ||
270 | case INT_CMD_ERR: | ||
271 | case INT_WAKE_RX: | ||
272 | case INT_SS_ERROR: | ||
273 | case INT_S0IX_MISS: | ||
274 | case INT_NO_ACKC6: | ||
275 | pmu_irq_stats[pmu_ics.bits.cause]++; | ||
276 | break; | ||
277 | default: | ||
278 | pmu_irq_stats[INT_INVALID]++; | ||
279 | } | ||
280 | |||
281 | pmu_write_ics(pmu_ics.value); /* Clear pending interrupt */ | ||
282 | |||
283 | return IRQ_HANDLED; | ||
284 | } | ||
285 | |||
286 | /* | ||
287 | * Translate PCI power management to MRST LSS D-states | ||
288 | */ | ||
289 | static int pci_2_mrst_state(int lss, pci_power_t pci_state) | ||
290 | { | ||
291 | switch (pci_state) { | ||
292 | case PCI_D0: | ||
293 | if (SSMSK(D0i1, lss) & D0I1_ACG_SSS_TARGET) | ||
294 | return D0i1; | ||
295 | else | ||
296 | return D0; | ||
297 | case PCI_D1: | ||
298 | return D0i1; | ||
299 | case PCI_D2: | ||
300 | return D0i2; | ||
301 | case PCI_D3hot: | ||
302 | case PCI_D3cold: | ||
303 | return D0i3; | ||
304 | default: | ||
305 | WARN(1, "pci_state %d\n", pci_state); | ||
306 | return 0; | ||
307 | } | ||
308 | } | ||
309 | |||
310 | static int pmu_issue_command(u32 pm_ssc) | ||
311 | { | ||
312 | union pmu_pm_set_cfg_cmd_t command; | ||
313 | |||
314 | if (pmu_read_busy_status()) { | ||
315 | pr_debug("pmu is busy, Operation not permitted\n"); | ||
316 | return -1; | ||
317 | } | ||
318 | |||
319 | /* | ||
320 | * enable interrupts in PMU so that interrupts are | ||
321 | * propagated when ioc bit for a particular set | ||
322 | * command is set | ||
323 | */ | ||
324 | |||
325 | pmu_irq_enable(); | ||
326 | |||
327 | /* Configure the sub systems for pmu2 */ | ||
328 | |||
329 | pmu_write_ssc(pm_ssc); | ||
330 | |||
331 | /* | ||
332 | * Send the set config command for pmu its configured | ||
333 | * for mode CM_IMMEDIATE & hence with No Trigger | ||
334 | */ | ||
335 | |||
336 | command.pmu2_params.d_param.cfg_mode = CM_IMMEDIATE; | ||
337 | command.pmu2_params.d_param.cfg_delay = 0; | ||
338 | command.pmu2_params.d_param.rsvd = 0; | ||
339 | |||
340 | /* construct the command to send SET_CFG to particular PMU */ | ||
341 | command.pmu2_params.d_param.cmd = SET_CFG_CMD; | ||
342 | command.pmu2_params.d_param.ioc = 0; | ||
343 | command.pmu2_params.d_param.mode_id = 0; | ||
344 | command.pmu2_params.d_param.sys_state = SYS_STATE_S0I0; | ||
345 | |||
346 | /* write the value of PM_CMD into particular PMU */ | ||
347 | pr_debug("pmu command being written %x\n", | ||
348 | command.pmu_pm_set_cfg_cmd_value); | ||
349 | |||
350 | pmu_write_cmd(command.pmu_pm_set_cfg_cmd_value); | ||
351 | |||
352 | return 0; | ||
353 | } | ||
354 | |||
355 | static u16 pmu_min_lss_pci_req(u16 *ids, u16 pci_state) | ||
356 | { | ||
357 | u16 existing_request; | ||
358 | int i; | ||
359 | |||
360 | for (i = 0; ids[i]; ++i) { | ||
361 | struct mrst_device *mrst_dev; | ||
362 | |||
363 | mrst_dev = pci_id_2_mrst_dev(ids[i]); | ||
364 | if (unlikely(!mrst_dev)) | ||
365 | continue; | ||
366 | |||
367 | existing_request = mrst_dev->latest_request; | ||
368 | if (existing_request < pci_state) | ||
369 | pci_state = existing_request; | ||
370 | } | ||
371 | return pci_state; | ||
372 | } | ||
373 | |||
374 | /** | ||
375 | * pmu_pci_set_power_state - Callback function is used by all the PCI devices | ||
376 | * for a platform specific device power on/shutdown. | ||
377 | */ | ||
378 | |||
379 | int pmu_pci_set_power_state(struct pci_dev *pdev, pci_power_t pci_state) | ||
380 | { | ||
381 | u32 old_sss, new_sss; | ||
382 | int status = 0; | ||
383 | struct mrst_device *mrst_dev; | ||
384 | |||
385 | pmu_set_power_state_entry++; | ||
386 | |||
387 | BUG_ON(pdev->vendor != PCI_VENDOR_ID_INTEL); | ||
388 | BUG_ON(pci_state < PCI_D0 || pci_state > PCI_D3cold); | ||
389 | |||
390 | mrst_dev = pci_id_2_mrst_dev(pdev->device); | ||
391 | if (unlikely(!mrst_dev)) | ||
392 | return -ENODEV; | ||
393 | |||
394 | mrst_dev->pci_state_counts[pci_state]++; /* count invocations */ | ||
395 | |||
396 | /* PMU driver calls self as part of PCI initialization, ignore */ | ||
397 | if (pdev->device == PCI_DEV_ID_MRST_PMU) | ||
398 | return 0; | ||
399 | |||
400 | BUG_ON(!pmu_reg); /* SW bug if called before initialized */ | ||
401 | |||
402 | spin_lock(&mrst_pmu_power_state_lock); | ||
403 | |||
404 | if (pdev->d3_delay) { | ||
405 | dev_dbg(&pdev->dev, "d3_delay %d, should be 0\n", | ||
406 | pdev->d3_delay); | ||
407 | pdev->d3_delay = 0; | ||
408 | } | ||
409 | /* | ||
410 | * If Lincroft graphics, simply remember state | ||
411 | */ | ||
412 | if ((pdev->class >> 16) == PCI_BASE_CLASS_DISPLAY | ||
413 | && !((pdev->class & PCI_SUB_CLASS_MASK) >> 8)) { | ||
414 | if (pci_state == PCI_D0) | ||
415 | graphics_is_off = 0; | ||
416 | else | ||
417 | graphics_is_off = 1; | ||
418 | goto ret; | ||
419 | } | ||
420 | |||
421 | if (!mrst_dev->lss) | ||
422 | goto ret; /* device with no LSS */ | ||
423 | |||
424 | if (mrst_dev->latest_request == pci_state) | ||
425 | goto ret; /* no change */ | ||
426 | |||
427 | mrst_dev->latest_request = pci_state; /* record latest request */ | ||
428 | |||
429 | /* | ||
430 | * LSS9 and LSS10 contain multiple PCI devices. | ||
431 | * Use the lowest numbered (highest power) state in the LSS | ||
432 | */ | ||
433 | if (mrst_dev->lss == 9) | ||
434 | pci_state = pmu_min_lss_pci_req(mrst_lss9_pci_ids, pci_state); | ||
435 | else if (mrst_dev->lss == 10) | ||
436 | pci_state = pmu_min_lss_pci_req(mrst_lss10_pci_ids, pci_state); | ||
437 | |||
438 | status = pmu_wait_ready(); | ||
439 | if (status) | ||
440 | goto ret; | ||
441 | |||
442 | old_sss = pmu_read_sss(); | ||
443 | new_sss = old_sss & ~SSMSK(3, mrst_dev->lss); | ||
444 | new_sss |= SSMSK(pci_2_mrst_state(mrst_dev->lss, pci_state), | ||
445 | mrst_dev->lss); | ||
446 | |||
447 | if (new_sss == old_sss) | ||
448 | goto ret; /* nothing to do */ | ||
449 | |||
450 | pmu_set_power_state_send_cmd++; | ||
451 | |||
452 | status = pmu_issue_command(new_sss); | ||
453 | |||
454 | if (unlikely(status != 0)) { | ||
455 | dev_err(&pdev->dev, "Failed to Issue a PM command\n"); | ||
456 | goto ret; | ||
457 | } | ||
458 | |||
459 | if (pmu_wait_done()) | ||
460 | goto ret; | ||
461 | |||
462 | lss_s0i3_enabled = | ||
463 | ((pmu_read_sss() & S0I3_SSS_TARGET) == S0I3_SSS_TARGET); | ||
464 | ret: | ||
465 | spin_unlock(&mrst_pmu_power_state_lock); | ||
466 | return status; | ||
467 | } | ||
468 | |||
469 | #ifdef CONFIG_DEBUG_FS | ||
470 | static char *d0ix_names[] = {"D0", "D0i1", "D0i2", "D0i3"}; | ||
471 | |||
472 | static inline const char *d0ix_name(int state) | ||
473 | { | ||
474 | return d0ix_names[(int) state]; | ||
475 | } | ||
476 | |||
477 | static int debug_mrst_pmu_show(struct seq_file *s, void *unused) | ||
478 | { | ||
479 | struct pci_dev *pdev = NULL; | ||
480 | u32 cur_pmsss; | ||
481 | int lss; | ||
482 | |||
483 | seq_printf(s, "0x%08X D0I1_ACG_SSS_TARGET\n", D0I1_ACG_SSS_TARGET); | ||
484 | |||
485 | cur_pmsss = pmu_read_sss(); | ||
486 | |||
487 | seq_printf(s, "0x%08X S0I3_SSS_TARGET\n", S0I3_SSS_TARGET); | ||
488 | |||
489 | seq_printf(s, "0x%08X Current SSS ", cur_pmsss); | ||
490 | seq_printf(s, lss_s0i3_enabled ? "\n" : "[BLOCKS s0i3]\n"); | ||
491 | |||
492 | if (cpumask_equal(cpu_online_mask, cpumask_of(0))) | ||
493 | seq_printf(s, "cpu0 is only cpu online\n"); | ||
494 | else | ||
495 | seq_printf(s, "cpu0 is NOT only cpu online [BLOCKS S0i3]\n"); | ||
496 | |||
497 | seq_printf(s, "GFX: %s\n", graphics_is_off ? "" : "[BLOCKS s0i3]"); | ||
498 | |||
499 | |||
500 | for_each_pci_dev(pdev) { | ||
501 | int pos; | ||
502 | u16 pmcsr; | ||
503 | struct mrst_device *mrst_dev; | ||
504 | int i; | ||
505 | |||
506 | mrst_dev = pci_id_2_mrst_dev(pdev->device); | ||
507 | |||
508 | seq_printf(s, "%s %04x/%04X %-16.16s ", | ||
509 | dev_name(&pdev->dev), | ||
510 | pdev->vendor, pdev->device, | ||
511 | dev_driver_string(&pdev->dev)); | ||
512 | |||
513 | if (unlikely (!mrst_dev)) { | ||
514 | seq_printf(s, " UNKNOWN\n"); | ||
515 | continue; | ||
516 | } | ||
517 | |||
518 | if (mrst_dev->lss) | ||
519 | seq_printf(s, "LSS %2d %-4s ", mrst_dev->lss, | ||
520 | d0ix_name(((cur_pmsss >> | ||
521 | (mrst_dev->lss * 2)) & 0x3))); | ||
522 | else | ||
523 | seq_printf(s, " "); | ||
524 | |||
525 | /* PCI PM config space setting */ | ||
526 | pos = pci_find_capability(pdev, PCI_CAP_ID_PM); | ||
527 | if (pos != 0) { | ||
528 | pci_read_config_word(pdev, pos + PCI_PM_CTRL, &pmcsr); | ||
529 | seq_printf(s, "PCI-%-4s", | ||
530 | pci_power_name(pmcsr & PCI_PM_CTRL_STATE_MASK)); | ||
531 | } else { | ||
532 | seq_printf(s, " "); | ||
533 | } | ||
534 | |||
535 | seq_printf(s, " %s ", pci_power_name(mrst_dev->latest_request)); | ||
536 | for (i = 0; i <= PCI_D3cold; ++i) | ||
537 | seq_printf(s, "%d ", mrst_dev->pci_state_counts[i]); | ||
538 | |||
539 | if (mrst_dev->lss) { | ||
540 | unsigned int lssmask; | ||
541 | |||
542 | lssmask = SSMSK(D0i3, mrst_dev->lss); | ||
543 | |||
544 | if ((lssmask & S0I3_SSS_TARGET) && | ||
545 | ((lssmask & cur_pmsss) != | ||
546 | (lssmask & S0I3_SSS_TARGET))) | ||
547 | seq_printf(s , "[BLOCKS s0i3]"); | ||
548 | } | ||
549 | |||
550 | seq_printf(s, "\n"); | ||
551 | } | ||
552 | seq_printf(s, "Wake Counters:\n"); | ||
553 | for (lss = 0; lss < MRST_NUM_LSS; ++lss) | ||
554 | seq_printf(s, "LSS%d %d\n", lss, wake_counters[lss]); | ||
555 | |||
556 | seq_printf(s, "Interrupt Counters:\n"); | ||
557 | seq_printf(s, | ||
558 | "INT_SPURIOUS \t%8u\n" "INT_CMD_DONE \t%8u\n" | ||
559 | "INT_CMD_ERR \t%8u\n" "INT_WAKE_RX \t%8u\n" | ||
560 | "INT_SS_ERROR \t%8u\n" "INT_S0IX_MISS\t%8u\n" | ||
561 | "INT_NO_ACKC6 \t%8u\n" "INT_INVALID \t%8u\n", | ||
562 | pmu_irq_stats[INT_SPURIOUS], pmu_irq_stats[INT_CMD_DONE], | ||
563 | pmu_irq_stats[INT_CMD_ERR], pmu_irq_stats[INT_WAKE_RX], | ||
564 | pmu_irq_stats[INT_SS_ERROR], pmu_irq_stats[INT_S0IX_MISS], | ||
565 | pmu_irq_stats[INT_NO_ACKC6], pmu_irq_stats[INT_INVALID]); | ||
566 | |||
567 | seq_printf(s, "mrst_pmu_wait_ready_calls %8d\n", | ||
568 | pmu_wait_ready_calls); | ||
569 | seq_printf(s, "mrst_pmu_wait_ready_udelays %8d\n", | ||
570 | pmu_wait_ready_udelays); | ||
571 | seq_printf(s, "mrst_pmu_wait_ready_udelays_max %8d\n", | ||
572 | pmu_wait_ready_udelays_max); | ||
573 | seq_printf(s, "mrst_pmu_wait_done_calls %8d\n", | ||
574 | pmu_wait_done_calls); | ||
575 | seq_printf(s, "mrst_pmu_wait_done_udelays %8d\n", | ||
576 | pmu_wait_done_udelays); | ||
577 | seq_printf(s, "mrst_pmu_wait_done_udelays_max %8d\n", | ||
578 | pmu_wait_done_udelays_max); | ||
579 | seq_printf(s, "mrst_pmu_set_power_state_entry %8d\n", | ||
580 | pmu_set_power_state_entry); | ||
581 | seq_printf(s, "mrst_pmu_set_power_state_send_cmd %8d\n", | ||
582 | pmu_set_power_state_send_cmd); | ||
583 | seq_printf(s, "SCU busy: %d\n", pmu_read_busy_status()); | ||
584 | |||
585 | return 0; | ||
586 | } | ||
587 | |||
588 | static int debug_mrst_pmu_open(struct inode *inode, struct file *file) | ||
589 | { | ||
590 | return single_open(file, debug_mrst_pmu_show, NULL); | ||
591 | } | ||
592 | |||
593 | static const struct file_operations devices_state_operations = { | ||
594 | .open = debug_mrst_pmu_open, | ||
595 | .read = seq_read, | ||
596 | .llseek = seq_lseek, | ||
597 | .release = single_release, | ||
598 | }; | ||
599 | #endif /* DEBUG_FS */ | ||
600 | |||
601 | /* | ||
602 | * Validate SCU PCI shim PCI vendor capability byte | ||
603 | * against LSS hard-coded in mrst_devs[] above. | ||
604 | * DEBUG only. | ||
605 | */ | ||
606 | static void pmu_scu_firmware_debug(void) | ||
607 | { | ||
608 | struct pci_dev *pdev = NULL; | ||
609 | |||
610 | for_each_pci_dev(pdev) { | ||
611 | struct mrst_device *mrst_dev; | ||
612 | u8 pci_config_lss; | ||
613 | int pos; | ||
614 | |||
615 | mrst_dev = pci_id_2_mrst_dev(pdev->device); | ||
616 | if (unlikely(!mrst_dev)) { | ||
617 | printk(KERN_ERR FW_BUG "pmu: Unknown " | ||
618 | "PCI device 0x%04X\n", pdev->device); | ||
619 | continue; | ||
620 | } | ||
621 | |||
622 | if (mrst_dev->lss == 0) | ||
623 | continue; /* no LSS in our table */ | ||
624 | |||
625 | pos = pci_find_capability(pdev, PCI_CAP_ID_VNDR); | ||
626 | if (!pos != 0) { | ||
627 | printk(KERN_ERR FW_BUG "pmu: 0x%04X " | ||
628 | "missing PCI Vendor Capability\n", | ||
629 | pdev->device); | ||
630 | continue; | ||
631 | } | ||
632 | pci_read_config_byte(pdev, pos + 4, &pci_config_lss); | ||
633 | if (!(pci_config_lss & PCI_VENDOR_CAP_LOG_SS_MASK)) { | ||
634 | printk(KERN_ERR FW_BUG "pmu: 0x%04X " | ||
635 | "invalid PCI Vendor Capability 0x%x " | ||
636 | " expected LSS 0x%X\n", | ||
637 | pdev->device, pci_config_lss, mrst_dev->lss); | ||
638 | continue; | ||
639 | } | ||
640 | pci_config_lss &= PCI_VENDOR_CAP_LOG_ID_MASK; | ||
641 | |||
642 | if (mrst_dev->lss == pci_config_lss) | ||
643 | continue; | ||
644 | |||
645 | printk(KERN_ERR FW_BUG "pmu: 0x%04X LSS = %d, expected %d\n", | ||
646 | pdev->device, pci_config_lss, mrst_dev->lss); | ||
647 | } | ||
648 | } | ||
649 | |||
650 | /** | ||
651 | * pmu_probe | ||
652 | */ | ||
653 | static int __devinit pmu_probe(struct pci_dev *pdev, | ||
654 | const struct pci_device_id *pci_id) | ||
655 | { | ||
656 | int ret; | ||
657 | struct mrst_pmu_reg *pmu; | ||
658 | |||
659 | /* Init the device */ | ||
660 | ret = pci_enable_device(pdev); | ||
661 | if (ret) { | ||
662 | dev_err(&pdev->dev, "Unable to Enable PCI device\n"); | ||
663 | return ret; | ||
664 | } | ||
665 | |||
666 | ret = pci_request_regions(pdev, MRST_PMU_DRV_NAME); | ||
667 | if (ret < 0) { | ||
668 | dev_err(&pdev->dev, "Cannot obtain PCI resources, aborting\n"); | ||
669 | goto out_err1; | ||
670 | } | ||
671 | |||
672 | /* Map the memory of PMU reg base */ | ||
673 | pmu = pci_iomap(pdev, 0, 0); | ||
674 | if (!pmu) { | ||
675 | dev_err(&pdev->dev, "Unable to map the PMU address space\n"); | ||
676 | ret = -ENOMEM; | ||
677 | goto out_err2; | ||
678 | } | ||
679 | |||
680 | #ifdef CONFIG_DEBUG_FS | ||
681 | /* /sys/kernel/debug/mrst_pmu */ | ||
682 | (void) debugfs_create_file("mrst_pmu", S_IFREG | S_IRUGO, | ||
683 | NULL, NULL, &devices_state_operations); | ||
684 | #endif | ||
685 | pmu_reg = pmu; /* success */ | ||
686 | |||
687 | if (request_irq(pdev->irq, pmu_irq, 0, MRST_PMU_DRV_NAME, NULL)) { | ||
688 | dev_err(&pdev->dev, "Registering isr has failed\n"); | ||
689 | ret = -1; | ||
690 | goto out_err3; | ||
691 | } | ||
692 | |||
693 | pmu_scu_firmware_debug(); | ||
694 | |||
695 | pmu_write_wkc(S0I3_WAKE_SOURCES); /* Enable S0i3 wakeup sources */ | ||
696 | |||
697 | pmu_wait_ready(); | ||
698 | |||
699 | pmu_write_ssc(D0I1_ACG_SSS_TARGET); /* Enable Auto-Clock_Gating */ | ||
700 | pmu_write_cmd(0x201); | ||
701 | |||
702 | spin_lock_init(&mrst_pmu_power_state_lock); | ||
703 | |||
704 | /* Enable the hardware interrupt */ | ||
705 | pmu_irq_enable(); | ||
706 | return 0; | ||
707 | |||
708 | out_err3: | ||
709 | free_irq(pdev->irq, NULL); | ||
710 | pci_iounmap(pdev, pmu_reg); | ||
711 | pmu_reg = NULL; | ||
712 | out_err2: | ||
713 | pci_release_region(pdev, 0); | ||
714 | out_err1: | ||
715 | pci_disable_device(pdev); | ||
716 | return ret; | ||
717 | } | ||
718 | |||
719 | static void __devexit pmu_remove(struct pci_dev *pdev) | ||
720 | { | ||
721 | dev_err(&pdev->dev, "Mid PM pmu_remove called\n"); | ||
722 | |||
723 | /* Freeing up the irq */ | ||
724 | free_irq(pdev->irq, NULL); | ||
725 | |||
726 | pci_iounmap(pdev, pmu_reg); | ||
727 | pmu_reg = NULL; | ||
728 | |||
729 | /* disable the current PCI device */ | ||
730 | pci_release_region(pdev, 0); | ||
731 | pci_disable_device(pdev); | ||
732 | } | ||
733 | |||
734 | static DEFINE_PCI_DEVICE_TABLE(pmu_pci_ids) = { | ||
735 | { PCI_VDEVICE(INTEL, PCI_DEV_ID_MRST_PMU), 0 }, | ||
736 | { } | ||
737 | }; | ||
738 | |||
739 | MODULE_DEVICE_TABLE(pci, pmu_pci_ids); | ||
740 | |||
741 | static struct pci_driver driver = { | ||
742 | .name = MRST_PMU_DRV_NAME, | ||
743 | .id_table = pmu_pci_ids, | ||
744 | .probe = pmu_probe, | ||
745 | .remove = __devexit_p(pmu_remove), | ||
746 | }; | ||
747 | |||
748 | /** | ||
749 | * pmu_pci_register - register the PMU driver as PCI device | ||
750 | */ | ||
751 | static int __init pmu_pci_register(void) | ||
752 | { | ||
753 | return pci_register_driver(&driver); | ||
754 | } | ||
755 | |||
756 | /* Register and probe via fs_initcall() to preceed device_initcall() */ | ||
757 | fs_initcall(pmu_pci_register); | ||
758 | |||
759 | static void __exit mid_pci_cleanup(void) | ||
760 | { | ||
761 | pci_unregister_driver(&driver); | ||
762 | } | ||
763 | |||
764 | static int ia_major; | ||
765 | static int ia_minor; | ||
766 | |||
767 | static int pmu_sfi_parse_oem(struct sfi_table_header *table) | ||
768 | { | ||
769 | struct sfi_table_simple *sb; | ||
770 | |||
771 | sb = (struct sfi_table_simple *)table; | ||
772 | ia_major = (sb->pentry[1] >> 0) & 0xFFFF; | ||
773 | ia_minor = (sb->pentry[1] >> 16) & 0xFFFF; | ||
774 | printk(KERN_INFO "mrst_pmu: IA FW version v%x.%x\n", | ||
775 | ia_major, ia_minor); | ||
776 | |||
777 | return 0; | ||
778 | } | ||
779 | |||
780 | static int __init scu_fw_check(void) | ||
781 | { | ||
782 | int ret; | ||
783 | u32 fw_version; | ||
784 | |||
785 | if (!pmu_reg) | ||
786 | return 0; /* this driver didn't probe-out */ | ||
787 | |||
788 | sfi_table_parse("OEMB", NULL, NULL, pmu_sfi_parse_oem); | ||
789 | |||
790 | if (ia_major < 0x6005 || ia_minor < 0x1525) { | ||
791 | WARN(1, "mrst_pmu: IA FW version too old\n"); | ||
792 | return -1; | ||
793 | } | ||
794 | |||
795 | ret = intel_scu_ipc_command(IPCMSG_FW_REVISION, 0, NULL, 0, | ||
796 | &fw_version, 1); | ||
797 | |||
798 | if (ret) { | ||
799 | WARN(1, "mrst_pmu: IPC FW version? %d\n", ret); | ||
800 | } else { | ||
801 | int scu_major = (fw_version >> 8) & 0xFF; | ||
802 | int scu_minor = (fw_version >> 0) & 0xFF; | ||
803 | |||
804 | printk(KERN_INFO "mrst_pmu: firmware v%x\n", fw_version); | ||
805 | |||
806 | if ((scu_major >= 0xC0) && (scu_minor >= 0x49)) { | ||
807 | printk(KERN_INFO "mrst_pmu: enabling S0i3\n"); | ||
808 | mrst_pmu_s0i3_enable = true; | ||
809 | } else { | ||
810 | WARN(1, "mrst_pmu: S0i3 disabled, old firmware %X.%X", | ||
811 | scu_major, scu_minor); | ||
812 | } | ||
813 | } | ||
814 | return 0; | ||
815 | } | ||
816 | late_initcall(scu_fw_check); | ||
817 | module_exit(mid_pci_cleanup); | ||
diff --git a/arch/x86/platform/mrst/pmu.h b/arch/x86/platform/mrst/pmu.h new file mode 100644 index 000000000000..bfbfe64b167b --- /dev/null +++ b/arch/x86/platform/mrst/pmu.h | |||
@@ -0,0 +1,234 @@ | |||
1 | /* | ||
2 | * mrst/pmu.h - private definitions for MRST Power Management Unit mrst/pmu.c | ||
3 | * | ||
4 | * Copyright (c) 2011, Intel Corporation. | ||
5 | * | ||
6 | * This program is free software; you can redistribute it and/or modify it | ||
7 | * under the terms and conditions of the GNU General Public License, | ||
8 | * version 2, as published by the Free Software Foundation. | ||
9 | * | ||
10 | * This program is distributed in the hope it will be useful, but WITHOUT | ||
11 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ||
12 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for | ||
13 | * more details. | ||
14 | * | ||
15 | * You should have received a copy of the GNU General Public License along with | ||
16 | * this program; if not, write to the Free Software Foundation, Inc., | ||
17 | * 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA. | ||
18 | */ | ||
19 | |||
20 | #ifndef _MRST_PMU_H_ | ||
21 | #define _MRST_PMU_H_ | ||
22 | |||
23 | #define PCI_DEV_ID_MRST_PMU 0x0810 | ||
24 | #define MRST_PMU_DRV_NAME "mrst_pmu" | ||
25 | #define PCI_SUB_CLASS_MASK 0xFF00 | ||
26 | |||
27 | #define PCI_VENDOR_CAP_LOG_ID_MASK 0x7F | ||
28 | #define PCI_VENDOR_CAP_LOG_SS_MASK 0x80 | ||
29 | |||
30 | #define SUB_SYS_ALL_D0I1 0x01155555 | ||
31 | #define S0I3_WAKE_SOURCES 0x00001FFF | ||
32 | |||
33 | #define PM_S0I3_COMMAND \ | ||
34 | ((0 << 31) | /* Reserved */ \ | ||
35 | (0 << 30) | /* Core must be idle */ \ | ||
36 | (0xc2 << 22) | /* ACK C6 trigger */ \ | ||
37 | (3 << 19) | /* Trigger on DMI message */ \ | ||
38 | (3 << 16) | /* Enter S0i3 */ \ | ||
39 | (0 << 13) | /* Numeric mode ID (sw) */ \ | ||
40 | (3 << 9) | /* Trigger mode */ \ | ||
41 | (0 << 8) | /* Do not interrupt */ \ | ||
42 | (1 << 0)) /* Set configuration */ | ||
43 | |||
44 | #define LSS_DMI 0 | ||
45 | #define LSS_SD_HC0 1 | ||
46 | #define LSS_SD_HC1 2 | ||
47 | #define LSS_NAND 3 | ||
48 | #define LSS_IMAGING 4 | ||
49 | #define LSS_SECURITY 5 | ||
50 | #define LSS_DISPLAY 6 | ||
51 | #define LSS_USB_HC 7 | ||
52 | #define LSS_USB_OTG 8 | ||
53 | #define LSS_AUDIO 9 | ||
54 | #define LSS_AUDIO_LPE 9 | ||
55 | #define LSS_AUDIO_SSP 9 | ||
56 | #define LSS_I2C0 10 | ||
57 | #define LSS_I2C1 10 | ||
58 | #define LSS_I2C2 10 | ||
59 | #define LSS_KBD 10 | ||
60 | #define LSS_SPI0 10 | ||
61 | #define LSS_SPI1 10 | ||
62 | #define LSS_SPI2 10 | ||
63 | #define LSS_GPIO 10 | ||
64 | #define LSS_SRAM 11 /* used by SCU, do not touch */ | ||
65 | #define LSS_SD_HC2 12 | ||
66 | /* LSS hardware bits 15,14,13 are hardwired to 0, thus unusable */ | ||
67 | #define MRST_NUM_LSS 13 | ||
68 | |||
69 | #define MIN(a, b) (((a) < (b)) ? (a) : (b)) | ||
70 | |||
71 | #define SSMSK(mask, lss) ((mask) << ((lss) * 2)) | ||
72 | #define D0 0 | ||
73 | #define D0i1 1 | ||
74 | #define D0i2 2 | ||
75 | #define D0i3 3 | ||
76 | |||
77 | #define S0I3_SSS_TARGET ( \ | ||
78 | SSMSK(D0i1, LSS_DMI) | \ | ||
79 | SSMSK(D0i3, LSS_SD_HC0) | \ | ||
80 | SSMSK(D0i3, LSS_SD_HC1) | \ | ||
81 | SSMSK(D0i3, LSS_NAND) | \ | ||
82 | SSMSK(D0i3, LSS_SD_HC2) | \ | ||
83 | SSMSK(D0i3, LSS_IMAGING) | \ | ||
84 | SSMSK(D0i3, LSS_SECURITY) | \ | ||
85 | SSMSK(D0i3, LSS_DISPLAY) | \ | ||
86 | SSMSK(D0i3, LSS_USB_HC) | \ | ||
87 | SSMSK(D0i3, LSS_USB_OTG) | \ | ||
88 | SSMSK(D0i3, LSS_AUDIO) | \ | ||
89 | SSMSK(D0i1, LSS_I2C0)) | ||
90 | |||
91 | /* | ||
92 | * D0i1 on Langwell is Autonomous Clock Gating (ACG). | ||
93 | * Enable ACG on every LSS except camera and audio | ||
94 | */ | ||
95 | #define D0I1_ACG_SSS_TARGET \ | ||
96 | (SUB_SYS_ALL_D0I1 & ~SSMSK(D0i1, LSS_IMAGING) & ~SSMSK(D0i1, LSS_AUDIO)) | ||
97 | |||
98 | enum cm_mode { | ||
99 | CM_NOP, /* ignore the config mode value */ | ||
100 | CM_IMMEDIATE, | ||
101 | CM_DELAY, | ||
102 | CM_TRIGGER, | ||
103 | CM_INVALID | ||
104 | }; | ||
105 | |||
106 | enum sys_state { | ||
107 | SYS_STATE_S0I0, | ||
108 | SYS_STATE_S0I1, | ||
109 | SYS_STATE_S0I2, | ||
110 | SYS_STATE_S0I3, | ||
111 | SYS_STATE_S3, | ||
112 | SYS_STATE_S5 | ||
113 | }; | ||
114 | |||
115 | #define SET_CFG_CMD 1 | ||
116 | |||
117 | enum int_status { | ||
118 | INT_SPURIOUS = 0, | ||
119 | INT_CMD_DONE = 1, | ||
120 | INT_CMD_ERR = 2, | ||
121 | INT_WAKE_RX = 3, | ||
122 | INT_SS_ERROR = 4, | ||
123 | INT_S0IX_MISS = 5, | ||
124 | INT_NO_ACKC6 = 6, | ||
125 | INT_INVALID = 7, | ||
126 | }; | ||
127 | |||
128 | /* PMU register interface */ | ||
129 | static struct mrst_pmu_reg { | ||
130 | u32 pm_sts; /* 0x00 */ | ||
131 | u32 pm_cmd; /* 0x04 */ | ||
132 | u32 pm_ics; /* 0x08 */ | ||
133 | u32 _resv1; /* 0x0C */ | ||
134 | u32 pm_wkc[2]; /* 0x10 */ | ||
135 | u32 pm_wks[2]; /* 0x18 */ | ||
136 | u32 pm_ssc[4]; /* 0x20 */ | ||
137 | u32 pm_sss[4]; /* 0x30 */ | ||
138 | u32 pm_wssc[4]; /* 0x40 */ | ||
139 | u32 pm_c3c4; /* 0x50 */ | ||
140 | u32 pm_c5c6; /* 0x54 */ | ||
141 | u32 pm_msi_disable; /* 0x58 */ | ||
142 | } *pmu_reg; | ||
143 | |||
144 | static inline u32 pmu_read_sts(void) { return readl(&pmu_reg->pm_sts); } | ||
145 | static inline u32 pmu_read_ics(void) { return readl(&pmu_reg->pm_ics); } | ||
146 | static inline u32 pmu_read_wks(void) { return readl(&pmu_reg->pm_wks[0]); } | ||
147 | static inline u32 pmu_read_sss(void) { return readl(&pmu_reg->pm_sss[0]); } | ||
148 | |||
149 | static inline void pmu_write_cmd(u32 arg) { writel(arg, &pmu_reg->pm_cmd); } | ||
150 | static inline void pmu_write_ics(u32 arg) { writel(arg, &pmu_reg->pm_ics); } | ||
151 | static inline void pmu_write_wkc(u32 arg) { writel(arg, &pmu_reg->pm_wkc[0]); } | ||
152 | static inline void pmu_write_ssc(u32 arg) { writel(arg, &pmu_reg->pm_ssc[0]); } | ||
153 | static inline void pmu_write_wssc(u32 arg) | ||
154 | { writel(arg, &pmu_reg->pm_wssc[0]); } | ||
155 | |||
156 | static inline void pmu_msi_enable(void) { writel(0, &pmu_reg->pm_msi_disable); } | ||
157 | static inline u32 pmu_msi_is_disabled(void) | ||
158 | { return readl(&pmu_reg->pm_msi_disable); } | ||
159 | |||
160 | union pmu_pm_ics { | ||
161 | struct { | ||
162 | u32 cause:8; | ||
163 | u32 enable:1; | ||
164 | u32 pending:1; | ||
165 | u32 reserved:22; | ||
166 | } bits; | ||
167 | u32 value; | ||
168 | }; | ||
169 | |||
170 | static inline void pmu_irq_enable(void) | ||
171 | { | ||
172 | union pmu_pm_ics pmu_ics; | ||
173 | |||
174 | pmu_ics.value = pmu_read_ics(); | ||
175 | pmu_ics.bits.enable = 1; | ||
176 | pmu_write_ics(pmu_ics.value); | ||
177 | } | ||
178 | |||
179 | union pmu_pm_status { | ||
180 | struct { | ||
181 | u32 pmu_rev:8; | ||
182 | u32 pmu_busy:1; | ||
183 | u32 mode_id:4; | ||
184 | u32 Reserved:19; | ||
185 | } pmu_status_parts; | ||
186 | u32 pmu_status_value; | ||
187 | }; | ||
188 | |||
189 | static inline int pmu_read_busy_status(void) | ||
190 | { | ||
191 | union pmu_pm_status result; | ||
192 | |||
193 | result.pmu_status_value = pmu_read_sts(); | ||
194 | |||
195 | return result.pmu_status_parts.pmu_busy; | ||
196 | } | ||
197 | |||
198 | /* pmu set config parameters */ | ||
199 | struct cfg_delay_param_t { | ||
200 | u32 cmd:8; | ||
201 | u32 ioc:1; | ||
202 | u32 cfg_mode:4; | ||
203 | u32 mode_id:3; | ||
204 | u32 sys_state:3; | ||
205 | u32 cfg_delay:8; | ||
206 | u32 rsvd:5; | ||
207 | }; | ||
208 | |||
209 | struct cfg_trig_param_t { | ||
210 | u32 cmd:8; | ||
211 | u32 ioc:1; | ||
212 | u32 cfg_mode:4; | ||
213 | u32 mode_id:3; | ||
214 | u32 sys_state:3; | ||
215 | u32 cfg_trig_type:3; | ||
216 | u32 cfg_trig_val:8; | ||
217 | u32 cmbi:1; | ||
218 | u32 rsvd1:1; | ||
219 | }; | ||
220 | |||
221 | union pmu_pm_set_cfg_cmd_t { | ||
222 | union { | ||
223 | struct cfg_delay_param_t d_param; | ||
224 | struct cfg_trig_param_t t_param; | ||
225 | } pmu2_params; | ||
226 | u32 pmu_pm_set_cfg_cmd_value; | ||
227 | }; | ||
228 | |||
229 | #ifdef FUTURE_PATCH | ||
230 | extern int mrst_s0i3_entry(u32 regval, u32 *regaddr); | ||
231 | #else | ||
232 | static inline int mrst_s0i3_entry(u32 regval, u32 *regaddr) { return -1; } | ||
233 | #endif | ||
234 | #endif | ||
diff --git a/arch/x86/xen/setup.c b/arch/x86/xen/setup.c index 02ffd9e48c9f..df118a825f39 100644 --- a/arch/x86/xen/setup.c +++ b/arch/x86/xen/setup.c | |||
@@ -9,6 +9,7 @@ | |||
9 | #include <linux/mm.h> | 9 | #include <linux/mm.h> |
10 | #include <linux/pm.h> | 10 | #include <linux/pm.h> |
11 | #include <linux/memblock.h> | 11 | #include <linux/memblock.h> |
12 | #include <linux/cpuidle.h> | ||
12 | 13 | ||
13 | #include <asm/elf.h> | 14 | #include <asm/elf.h> |
14 | #include <asm/vdso.h> | 15 | #include <asm/vdso.h> |
@@ -424,7 +425,7 @@ void __init xen_arch_setup(void) | |||
424 | #ifdef CONFIG_X86_32 | 425 | #ifdef CONFIG_X86_32 |
425 | boot_cpu_data.hlt_works_ok = 1; | 426 | boot_cpu_data.hlt_works_ok = 1; |
426 | #endif | 427 | #endif |
427 | pm_idle = default_idle; | 428 | disable_cpuidle(); |
428 | boot_option_idle_override = IDLE_HALT; | 429 | boot_option_idle_override = IDLE_HALT; |
429 | 430 | ||
430 | fiddle_vdso(); | 431 | fiddle_vdso(); |