aboutsummaryrefslogtreecommitdiffstats
path: root/arch/m68k
diff options
context:
space:
mode:
Diffstat (limited to 'arch/m68k')
-rw-r--r--arch/m68k/Kconfig60
-rw-r--r--arch/m68k/amiga/config.c9
-rw-r--r--arch/m68k/atari/Makefile3
-rw-r--r--arch/m68k/atari/ataints.c6
-rw-r--r--arch/m68k/atari/atakeyb.c12
-rw-r--r--arch/m68k/atari/config.c37
-rw-r--r--arch/m68k/atari/hades-pci.c440
-rw-r--r--arch/m68k/atari/time.c38
-rw-r--r--arch/m68k/bvme6000/config.c15
-rw-r--r--arch/m68k/bvme6000/rtc.c30
-rw-r--r--arch/m68k/kernel/Makefile1
-rw-r--r--arch/m68k/kernel/bios32.c514
-rw-r--r--arch/m68k/kernel/dma.c4
-rw-r--r--arch/m68k/kernel/ints.c3
-rw-r--r--arch/m68k/kernel/process.c2
-rw-r--r--arch/m68k/kernel/traps.c9
-rw-r--r--arch/m68k/kernel/vmlinux-std.lds9
-rw-r--r--arch/m68k/mm/kmap.c4
-rw-r--r--arch/m68k/mvme16x/rtc.c26
-rw-r--r--arch/m68k/q40/config.c12
-rw-r--r--arch/m68k/sun3x/time.c28
21 files changed, 126 insertions, 1136 deletions
diff --git a/arch/m68k/Kconfig b/arch/m68k/Kconfig
index 41e5bf02e230..677c93a490f6 100644
--- a/arch/m68k/Kconfig
+++ b/arch/m68k/Kconfig
@@ -105,21 +105,9 @@ config PCMCIA
105 To compile this driver as modules, choose M here: the 105 To compile this driver as modules, choose M here: the
106 modules will be called pcmcia_core and ds. 106 modules will be called pcmcia_core and ds.
107 107
108config SUN3
109 bool "Sun3 support"
110 select M68020
111 select MMU_SUN3 if MMU
112 help
113 This option enables support for the Sun 3 series of workstations
114 (3/50, 3/60, 3/1xx, 3/2xx systems). Enabling this option requires
115 that all other hardware types must be disabled, as Sun 3 kernels
116 are incompatible with all other m68k targets (including Sun 3x!).
117
118 If you don't want to compile a kernel exclusively for a Sun 3, say N.
119
120config AMIGA 108config AMIGA
121 bool "Amiga support" 109 bool "Amiga support"
122 depends on !MMU_SUN3 110 select MMU_MOTOROLA if MMU
123 help 111 help
124 This option enables support for the Amiga series of computers. If 112 This option enables support for the Amiga series of computers. If
125 you plan to use this kernel on an Amiga, say Y here and browse the 113 you plan to use this kernel on an Amiga, say Y here and browse the
@@ -127,33 +115,16 @@ config AMIGA
127 115
128config ATARI 116config ATARI
129 bool "Atari support" 117 bool "Atari support"
130 depends on !MMU_SUN3 118 select MMU_MOTOROLA if MMU
131 help 119 help
132 This option enables support for the 68000-based Atari series of 120 This option enables support for the 68000-based Atari series of
133 computers (including the TT, Falcon and Medusa). If you plan to use 121 computers (including the TT, Falcon and Medusa). If you plan to use
134 this kernel on an Atari, say Y here and browse the material 122 this kernel on an Atari, say Y here and browse the material
135 available in <file:Documentation/m68k>; otherwise say N. 123 available in <file:Documentation/m68k>; otherwise say N.
136 124
137config HADES
138 bool "Hades support"
139 depends on ATARI && BROKEN
140 help
141 This option enables support for the Hades Atari clone. If you plan
142 to use this kernel on a Hades, say Y here; otherwise say N.
143
144config PCI
145 bool
146 depends on HADES
147 default y
148 help
149 Find out whether you have a PCI motherboard. PCI is the name of a
150 bus system, i.e. the way the CPU talks to the other stuff inside
151 your box. Other bus systems are ISA, EISA, MicroChannel (MCA) or
152 VESA. If you have PCI, say Y, otherwise N.
153
154config MAC 125config MAC
155 bool "Macintosh support" 126 bool "Macintosh support"
156 depends on !MMU_SUN3 127 select MMU_MOTOROLA if MMU
157 help 128 help
158 This option enables support for the Apple Macintosh series of 129 This option enables support for the Apple Macintosh series of
159 computers (yes, there is experimental support now, at least for part 130 computers (yes, there is experimental support now, at least for part
@@ -174,14 +145,14 @@ config M68K_L2_CACHE
174 145
175config APOLLO 146config APOLLO
176 bool "Apollo support" 147 bool "Apollo support"
177 depends on !MMU_SUN3 148 select MMU_MOTOROLA if MMU
178 help 149 help
179 Say Y here if you want to run Linux on an MC680x0-based Apollo 150 Say Y here if you want to run Linux on an MC680x0-based Apollo
180 Domain workstation such as the DN3500. 151 Domain workstation such as the DN3500.
181 152
182config VME 153config VME
183 bool "VME (Motorola and BVM) support" 154 bool "VME (Motorola and BVM) support"
184 depends on !MMU_SUN3 155 select MMU_MOTOROLA if MMU
185 help 156 help
186 Say Y here if you want to build a kernel for a 680x0 based VME 157 Say Y here if you want to build a kernel for a 680x0 based VME
187 board. Boards currently supported include Motorola boards MVME147, 158 board. Boards currently supported include Motorola boards MVME147,
@@ -218,7 +189,7 @@ config BVME6000
218 189
219config HP300 190config HP300
220 bool "HP9000/300 and HP9000/400 support" 191 bool "HP9000/300 and HP9000/400 support"
221 depends on !MMU_SUN3 192 select MMU_MOTOROLA if MMU
222 help 193 help
223 This option enables support for the HP9000/300 and HP9000/400 series 194 This option enables support for the HP9000/300 and HP9000/400 series
224 of workstations. Support for these machines is still somewhat 195 of workstations. Support for these machines is still somewhat
@@ -237,7 +208,7 @@ config DIO
237 208
238config SUN3X 209config SUN3X
239 bool "Sun3x support" 210 bool "Sun3x support"
240 depends on !MMU_SUN3 211 select MMU_MOTOROLA if MMU
241 select M68030 212 select M68030
242 help 213 help
243 This option enables support for the Sun 3x series of workstations. 214 This option enables support for the Sun 3x series of workstations.
@@ -250,7 +221,7 @@ config SUN3X
250 221
251config Q40 222config Q40
252 bool "Q40/Q60 support" 223 bool "Q40/Q60 support"
253 depends on !MMU_SUN3 224 select MMU_MOTOROLA if MMU
254 help 225 help
255 The Q40 is a Motorola 68040-based successor to the Sinclair QL 226 The Q40 is a Motorola 68040-based successor to the Sinclair QL
256 manufactured in Germany. There is an official Q40 home page at 227 manufactured in Germany. There is an official Q40 home page at
@@ -258,6 +229,19 @@ config Q40
258 Q60. Select your CPU below. For 68LC060 don't forget to enable FPU 229 Q60. Select your CPU below. For 68LC060 don't forget to enable FPU
259 emulation. 230 emulation.
260 231
232config SUN3
233 bool "Sun3 support"
234 depends on !MMU_MOTOROLA
235 select MMU_SUN3 if MMU
236 select M68020
237 help
238 This option enables support for the Sun 3 series of workstations
239 (3/50, 3/60, 3/1xx, 3/2xx systems). Enabling this option requires
240 that all other hardware types must be disabled, as Sun 3 kernels
241 are incompatible with all other m68k targets (including Sun 3x!).
242
243 If you don't want to compile a kernel exclusively for a Sun 3, say N.
244
261comment "Processor type" 245comment "Processor type"
262 246
263config M68020 247config M68020
@@ -295,10 +279,10 @@ config M68060
295config MMU_MOTOROLA 279config MMU_MOTOROLA
296 bool 280 bool
297 depends on MMU && !MMU_SUN3 281 depends on MMU && !MMU_SUN3
298 default y
299 282
300config MMU_SUN3 283config MMU_SUN3
301 bool 284 bool
285 depends on MMU && !MMU_MOTOROLA
302 286
303config M68KFPU_EMU 287config M68KFPU_EMU
304 bool "Math emulation support (EXPERIMENTAL)" 288 bool "Math emulation support (EXPERIMENTAL)"
diff --git a/arch/m68k/amiga/config.c b/arch/m68k/amiga/config.c
index df679d96b1cb..0a3f9e8ebde0 100644
--- a/arch/m68k/amiga/config.c
+++ b/arch/m68k/amiga/config.c
@@ -24,6 +24,7 @@
24#include <linux/interrupt.h> 24#include <linux/interrupt.h>
25#include <linux/zorro.h> 25#include <linux/zorro.h>
26#include <linux/module.h> 26#include <linux/module.h>
27#include <linux/keyboard.h>
27 28
28#include <asm/bootinfo.h> 29#include <asm/bootinfo.h>
29#include <asm/setup.h> 30#include <asm/setup.h>
@@ -984,3 +985,11 @@ static int amiga_get_hardware_list(char *buffer)
984 985
985 return len; 986 return len;
986} 987}
988
989/*
990 * The Amiga keyboard driver needs key_maps, but we cannot export it in
991 * drivers/char/defkeymap.c, as it is autogenerated
992 */
993#ifdef CONFIG_HW_CONSOLE
994EXPORT_SYMBOL_GPL(key_maps);
995#endif
diff --git a/arch/m68k/atari/Makefile b/arch/m68k/atari/Makefile
index 2cd905efe63a..0cac723306f9 100644
--- a/arch/m68k/atari/Makefile
+++ b/arch/m68k/atari/Makefile
@@ -5,7 +5,4 @@
5obj-y := config.o time.o debug.o ataints.o stdma.o \ 5obj-y := config.o time.o debug.o ataints.o stdma.o \
6 atasound.o stram.o 6 atasound.o stram.o
7 7
8ifeq ($(CONFIG_PCI),y)
9obj-$(CONFIG_HADES) += hades-pci.o
10endif
11obj-$(CONFIG_ATARI_KBD_CORE) += atakeyb.o 8obj-$(CONFIG_ATARI_KBD_CORE) += atakeyb.o
diff --git a/arch/m68k/atari/ataints.c b/arch/m68k/atari/ataints.c
index b45593a60bdd..dba4afabb444 100644
--- a/arch/m68k/atari/ataints.c
+++ b/arch/m68k/atari/ataints.c
@@ -407,10 +407,8 @@ void __init atari_init_IRQ(void)
407 * gets overruns) 407 * gets overruns)
408 */ 408 */
409 409
410 if (!MACH_IS_HADES) { 410 vectors[VEC_INT2] = falcon_hblhandler;
411 vectors[VEC_INT2] = falcon_hblhandler; 411 vectors[VEC_INT4] = falcon_hblhandler;
412 vectors[VEC_INT4] = falcon_hblhandler;
413 }
414 } 412 }
415 413
416 if (ATARIHW_PRESENT(PCM_8BIT) && ATARIHW_PRESENT(MICROWIRE)) { 414 if (ATARIHW_PRESENT(PCM_8BIT) && ATARIHW_PRESENT(MICROWIRE)) {
diff --git a/arch/m68k/atari/atakeyb.c b/arch/m68k/atari/atakeyb.c
index bb959fbab2dc..c038b7c7eff0 100644
--- a/arch/m68k/atari/atakeyb.c
+++ b/arch/m68k/atari/atakeyb.c
@@ -635,15 +635,3 @@ int atari_keyb_init(void)
635 return 0; 635 return 0;
636} 636}
637EXPORT_SYMBOL_GPL(atari_keyb_init); 637EXPORT_SYMBOL_GPL(atari_keyb_init);
638
639int atari_kbd_translate(unsigned char keycode, unsigned char *keycodep, char raw_mode)
640{
641#ifdef CONFIG_MAGIC_SYSRQ
642 /* ALT+HELP pressed? */
643 if ((keycode == 98) && ((shift_state & 0xff) == 8))
644 *keycodep = 0xff;
645 else
646#endif
647 *keycodep = keycode;
648 return 1;
649}
diff --git a/arch/m68k/atari/config.c b/arch/m68k/atari/config.c
index 5945e1505558..af031855f796 100644
--- a/arch/m68k/atari/config.c
+++ b/arch/m68k/atari/config.c
@@ -231,7 +231,7 @@ void __init config_atari(void)
231 */ 231 */
232 232
233 printk("Atari hardware found: "); 233 printk("Atari hardware found: ");
234 if (MACH_IS_MEDUSA || MACH_IS_HADES) { 234 if (MACH_IS_MEDUSA) {
235 /* There's no Atari video hardware on the Medusa, but all the 235 /* There's no Atari video hardware on the Medusa, but all the
236 * addresses below generate a DTACK so no bus error occurs! */ 236 * addresses below generate a DTACK so no bus error occurs! */
237 } else if (hwreg_present(f030_xreg)) { 237 } else if (hwreg_present(f030_xreg)) {
@@ -269,10 +269,6 @@ void __init config_atari(void)
269 ATARIHW_SET(SCSI_DMA); 269 ATARIHW_SET(SCSI_DMA);
270 printk("TT_SCSI_DMA "); 270 printk("TT_SCSI_DMA ");
271 } 271 }
272 if (!MACH_IS_HADES && hwreg_present(&st_dma.dma_hi)) {
273 ATARIHW_SET(STND_DMA);
274 printk("STND_DMA ");
275 }
276 /* 272 /*
277 * The ST-DMA address registers aren't readable 273 * The ST-DMA address registers aren't readable
278 * on all Medusas, so the test below may fail 274 * on all Medusas, so the test below may fail
@@ -294,12 +290,11 @@ void __init config_atari(void)
294 ATARIHW_SET(YM_2149); 290 ATARIHW_SET(YM_2149);
295 printk("YM2149 "); 291 printk("YM2149 ");
296 } 292 }
297 if (!MACH_IS_MEDUSA && !MACH_IS_HADES && 293 if (!MACH_IS_MEDUSA && hwreg_present(&tt_dmasnd.ctrl)) {
298 hwreg_present(&tt_dmasnd.ctrl)) {
299 ATARIHW_SET(PCM_8BIT); 294 ATARIHW_SET(PCM_8BIT);
300 printk("PCM "); 295 printk("PCM ");
301 } 296 }
302 if (!MACH_IS_HADES && hwreg_present(&falcon_codec.unused5)) { 297 if (hwreg_present(&falcon_codec.unused5)) {
303 ATARIHW_SET(CODEC); 298 ATARIHW_SET(CODEC);
304 printk("CODEC "); 299 printk("CODEC ");
305 } 300 }
@@ -313,7 +308,7 @@ void __init config_atari(void)
313 (tt_scc_dma.dma_ctrl = 0x01, (tt_scc_dma.dma_ctrl & 1) == 1) && 308 (tt_scc_dma.dma_ctrl = 0x01, (tt_scc_dma.dma_ctrl & 1) == 1) &&
314 (tt_scc_dma.dma_ctrl = 0x00, (tt_scc_dma.dma_ctrl & 1) == 0) 309 (tt_scc_dma.dma_ctrl = 0x00, (tt_scc_dma.dma_ctrl & 1) == 0)
315#else 310#else
316 !MACH_IS_MEDUSA && !MACH_IS_HADES 311 !MACH_IS_MEDUSA
317#endif 312#endif
318 ) { 313 ) {
319 ATARIHW_SET(SCC_DMA); 314 ATARIHW_SET(SCC_DMA);
@@ -327,10 +322,7 @@ void __init config_atari(void)
327 ATARIHW_SET(ST_ESCC); 322 ATARIHW_SET(ST_ESCC);
328 printk("ST_ESCC "); 323 printk("ST_ESCC ");
329 } 324 }
330 if (MACH_IS_HADES) { 325 if (hwreg_present(&tt_scu.sys_mask)) {
331 ATARIHW_SET(VME);
332 printk("VME ");
333 } else if (hwreg_present(&tt_scu.sys_mask)) {
334 ATARIHW_SET(SCU); 326 ATARIHW_SET(SCU);
335 /* Assume a VME bus if there's a SCU */ 327 /* Assume a VME bus if there's a SCU */
336 ATARIHW_SET(VME); 328 ATARIHW_SET(VME);
@@ -340,7 +332,7 @@ void __init config_atari(void)
340 ATARIHW_SET(ANALOG_JOY); 332 ATARIHW_SET(ANALOG_JOY);
341 printk("ANALOG_JOY "); 333 printk("ANALOG_JOY ");
342 } 334 }
343 if (!MACH_IS_HADES && hwreg_present(blitter.halftone)) { 335 if (hwreg_present(blitter.halftone)) {
344 ATARIHW_SET(BLITTER); 336 ATARIHW_SET(BLITTER);
345 printk("BLITTER "); 337 printk("BLITTER ");
346 } 338 }
@@ -349,8 +341,7 @@ void __init config_atari(void)
349 printk("IDE "); 341 printk("IDE ");
350 } 342 }
351#if 1 /* This maybe wrong */ 343#if 1 /* This maybe wrong */
352 if (!MACH_IS_MEDUSA && !MACH_IS_HADES && 344 if (!MACH_IS_MEDUSA && hwreg_present(&tt_microwire.data) &&
353 hwreg_present(&tt_microwire.data) &&
354 hwreg_present(&tt_microwire.mask) && 345 hwreg_present(&tt_microwire.mask) &&
355 (tt_microwire.mask = 0x7ff, 346 (tt_microwire.mask = 0x7ff,
356 udelay(1), 347 udelay(1),
@@ -369,19 +360,18 @@ void __init config_atari(void)
369 mach_hwclk = atari_tt_hwclk; 360 mach_hwclk = atari_tt_hwclk;
370 mach_set_clock_mmss = atari_tt_set_clock_mmss; 361 mach_set_clock_mmss = atari_tt_set_clock_mmss;
371 } 362 }
372 if (!MACH_IS_HADES && hwreg_present(&mste_rtc.sec_ones)) { 363 if (hwreg_present(&mste_rtc.sec_ones)) {
373 ATARIHW_SET(MSTE_CLK); 364 ATARIHW_SET(MSTE_CLK);
374 printk("MSTE_CLK "); 365 printk("MSTE_CLK ");
375 mach_hwclk = atari_mste_hwclk; 366 mach_hwclk = atari_mste_hwclk;
376 mach_set_clock_mmss = atari_mste_set_clock_mmss; 367 mach_set_clock_mmss = atari_mste_set_clock_mmss;
377 } 368 }
378 if (!MACH_IS_MEDUSA && !MACH_IS_HADES && 369 if (!MACH_IS_MEDUSA && hwreg_present(&dma_wd.fdc_speed) &&
379 hwreg_present(&dma_wd.fdc_speed) &&
380 hwreg_write(&dma_wd.fdc_speed, 0)) { 370 hwreg_write(&dma_wd.fdc_speed, 0)) {
381 ATARIHW_SET(FDCSPEED); 371 ATARIHW_SET(FDCSPEED);
382 printk("FDC_SPEED "); 372 printk("FDC_SPEED ");
383 } 373 }
384 if (!MACH_IS_HADES && !ATARIHW_PRESENT(ST_SCSI)) { 374 if (!ATARIHW_PRESENT(ST_SCSI)) {
385 ATARIHW_SET(ACSI); 375 ATARIHW_SET(ACSI);
386 printk("ACSI "); 376 printk("ACSI ");
387 } 377 }
@@ -449,7 +439,7 @@ void __init config_atari(void)
449 * 0xFFxxxxxx -> 0x00xxxxxx, so that the first 16MB is accessible 439 * 0xFFxxxxxx -> 0x00xxxxxx, so that the first 16MB is accessible
450 * in the last 16MB of the address space. 440 * in the last 16MB of the address space.
451 */ 441 */
452 tos_version = (MACH_IS_MEDUSA || MACH_IS_HADES) ? 442 tos_version = (MACH_IS_MEDUSA) ?
453 0xfff : *(unsigned short *)0xff000002; 443 0xfff : *(unsigned short *)0xff000002;
454 atari_rtc_year_offset = (tos_version < 0x306) ? 70 : 68; 444 atari_rtc_year_offset = (tos_version < 0x306) ? 70 : 68;
455} 445}
@@ -511,8 +501,7 @@ static void atari_reset(void)
511 * On the Medusa, phys. 0x4 may contain garbage because it's no 501 * On the Medusa, phys. 0x4 may contain garbage because it's no
512 * ROM. See above for explanation why we cannot use PTOV(4). 502 * ROM. See above for explanation why we cannot use PTOV(4).
513 */ 503 */
514 reset_addr = MACH_IS_HADES ? 0x7fe00030 : 504 reset_addr = MACH_IS_MEDUSA || MACH_IS_AB40 ? 0xe00030 :
515 MACH_IS_MEDUSA || MACH_IS_AB40 ? 0xe00030 :
516 *(unsigned long *) 0xff000004; 505 *(unsigned long *) 0xff000004;
517 506
518 /* reset ACIA for switch off OverScan, if it's active */ 507 /* reset ACIA for switch off OverScan, if it's active */
@@ -606,8 +595,6 @@ static void atari_get_model(char *model)
606 if (MACH_IS_MEDUSA) 595 if (MACH_IS_MEDUSA)
607 /* Medusa has TT _MCH cookie */ 596 /* Medusa has TT _MCH cookie */
608 strcat(model, "Medusa"); 597 strcat(model, "Medusa");
609 else if (MACH_IS_HADES)
610 strcat(model, "Hades");
611 else 598 else
612 strcat(model, "TT"); 599 strcat(model, "TT");
613 break; 600 break;
diff --git a/arch/m68k/atari/hades-pci.c b/arch/m68k/atari/hades-pci.c
deleted file mode 100644
index 2bbabc008708..000000000000
--- a/arch/m68k/atari/hades-pci.c
+++ /dev/null
@@ -1,440 +0,0 @@
1/*
2 * hades-pci.c - Hardware specific PCI BIOS functions the Hades Atari clone.
3 *
4 * Written by Wout Klaren.
5 */
6
7#include <linux/init.h>
8#include <linux/kernel.h>
9#include <asm/io.h>
10
11#if 0
12# define DBG_DEVS(args) printk args
13#else
14# define DBG_DEVS(args)
15#endif
16
17#if defined(CONFIG_PCI) && defined(CONFIG_HADES)
18
19#include <linux/slab.h>
20#include <linux/mm.h>
21#include <linux/pci.h>
22
23#include <asm/atarihw.h>
24#include <asm/atariints.h>
25#include <asm/byteorder.h>
26#include <asm/pci.h>
27
28#define HADES_MEM_BASE 0x80000000
29#define HADES_MEM_SIZE 0x20000000
30#define HADES_CONFIG_BASE 0xA0000000
31#define HADES_CONFIG_SIZE 0x10000000
32#define HADES_IO_BASE 0xB0000000
33#define HADES_IO_SIZE 0x10000000
34#define HADES_VIRT_IO_SIZE 0x00010000 /* Only 64k is remapped and actually used. */
35
36#define N_SLOTS 4 /* Number of PCI slots. */
37
38static const char pci_mem_name[] = "PCI memory space";
39static const char pci_io_name[] = "PCI I/O space";
40static const char pci_config_name[] = "PCI config space";
41
42static struct resource config_space = {
43 .name = pci_config_name,
44 .start = HADES_CONFIG_BASE,
45 .end = HADES_CONFIG_BASE + HADES_CONFIG_SIZE - 1
46};
47static struct resource io_space = {
48 .name = pci_io_name,
49 .start = HADES_IO_BASE,
50 .end = HADES_IO_BASE + HADES_IO_SIZE - 1
51};
52
53static const unsigned long pci_conf_base_phys[] = {
54 0xA0080000, 0xA0040000, 0xA0020000, 0xA0010000
55};
56static unsigned long pci_conf_base_virt[N_SLOTS];
57static unsigned long pci_io_base_virt;
58
59/*
60 * static void *mk_conf_addr(unsigned char bus, unsigned char device_fn,
61 * unsigned char where)
62 *
63 * Calculate the address of the PCI configuration area of the given
64 * device.
65 *
66 * BUG: boards with multiple functions are probably not correctly
67 * supported.
68 */
69
70static void *mk_conf_addr(struct pci_dev *dev, int where)
71{
72 int device = dev->devfn >> 3, function = dev->devfn & 7;
73 void *result;
74
75 DBG_DEVS(("mk_conf_addr(bus=%d ,device_fn=0x%x, where=0x%x, pci_addr=0x%p)\n",
76 dev->bus->number, dev->devfn, where, pci_addr));
77
78 if (device > 3)
79 {
80 DBG_DEVS(("mk_conf_addr: device (%d) > 3, returning NULL\n", device));
81 return NULL;
82 }
83
84 if (dev->bus->number != 0)
85 {
86 DBG_DEVS(("mk_conf_addr: bus (%d) > 0, returning NULL\n", device));
87 return NULL;
88 }
89
90 result = (void *) (pci_conf_base_virt[device] | (function << 8) | (where));
91 DBG_DEVS(("mk_conf_addr: returning pci_addr 0x%lx\n", (unsigned long) result));
92 return result;
93}
94
95static int hades_read_config_byte(struct pci_dev *dev, int where, u8 *value)
96{
97 volatile unsigned char *pci_addr;
98
99 *value = 0xff;
100
101 if ((pci_addr = (unsigned char *) mk_conf_addr(dev, where)) == NULL)
102 return PCIBIOS_DEVICE_NOT_FOUND;
103
104 *value = *pci_addr;
105
106 return PCIBIOS_SUCCESSFUL;
107}
108
109static int hades_read_config_word(struct pci_dev *dev, int where, u16 *value)
110{
111 volatile unsigned short *pci_addr;
112
113 *value = 0xffff;
114
115 if (where & 0x1)
116 return PCIBIOS_BAD_REGISTER_NUMBER;
117
118 if ((pci_addr = (unsigned short *) mk_conf_addr(dev, where)) == NULL)
119 return PCIBIOS_DEVICE_NOT_FOUND;
120
121 *value = le16_to_cpu(*pci_addr);
122
123 return PCIBIOS_SUCCESSFUL;
124}
125
126static int hades_read_config_dword(struct pci_dev *dev, int where, u32 *value)
127{
128 volatile unsigned int *pci_addr;
129 unsigned char header_type;
130 int result;
131
132 *value = 0xffffffff;
133
134 if (where & 0x3)
135 return PCIBIOS_BAD_REGISTER_NUMBER;
136
137 if ((pci_addr = (unsigned int *) mk_conf_addr(dev, where)) == NULL)
138 return PCIBIOS_DEVICE_NOT_FOUND;
139
140 *value = le32_to_cpu(*pci_addr);
141
142 /*
143 * Check if the value is an address on the bus. If true, add the
144 * base address of the PCI memory or PCI I/O area on the Hades.
145 */
146
147 if ((result = hades_read_config_byte(dev, PCI_HEADER_TYPE,
148 &header_type)) != PCIBIOS_SUCCESSFUL)
149 return result;
150
151 if (((where >= PCI_BASE_ADDRESS_0) && (where <= PCI_BASE_ADDRESS_1)) ||
152 ((header_type != PCI_HEADER_TYPE_BRIDGE) && ((where >= PCI_BASE_ADDRESS_2) &&
153 (where <= PCI_BASE_ADDRESS_5))))
154 {
155 if ((*value & PCI_BASE_ADDRESS_SPACE) == PCI_BASE_ADDRESS_SPACE_IO)
156 {
157 /*
158 * Base address register that contains an I/O address. If the
159 * address is valid on the Hades (0 <= *value < HADES_VIRT_IO_SIZE),
160 * add 'pci_io_base_virt' to the value.
161 */
162
163 if (*value < HADES_VIRT_IO_SIZE)
164 *value += pci_io_base_virt;
165 }
166 else
167 {
168 /*
169 * Base address register that contains an memory address. If the
170 * address is valid on the Hades (0 <= *value < HADES_MEM_SIZE),
171 * add HADES_MEM_BASE to the value.
172 */
173
174 if (*value == 0)
175 {
176 /*
177 * Base address is 0. Test if this base
178 * address register is used.
179 */
180
181 *pci_addr = 0xffffffff;
182 if (*pci_addr != 0)
183 {
184 *pci_addr = *value;
185 if (*value < HADES_MEM_SIZE)
186 *value += HADES_MEM_BASE;
187 }
188 }
189 else
190 {
191 if (*value < HADES_MEM_SIZE)
192 *value += HADES_MEM_BASE;
193 }
194 }
195 }
196
197 return PCIBIOS_SUCCESSFUL;
198}
199
200static int hades_write_config_byte(struct pci_dev *dev, int where, u8 value)
201{
202 volatile unsigned char *pci_addr;
203
204 if ((pci_addr = (unsigned char *) mk_conf_addr(dev, where)) == NULL)
205 return PCIBIOS_DEVICE_NOT_FOUND;
206
207 *pci_addr = value;
208
209 return PCIBIOS_SUCCESSFUL;
210}
211
212static int hades_write_config_word(struct pci_dev *dev, int where, u16 value)
213{
214 volatile unsigned short *pci_addr;
215
216 if ((pci_addr = (unsigned short *) mk_conf_addr(dev, where)) == NULL)
217 return PCIBIOS_DEVICE_NOT_FOUND;
218
219 *pci_addr = cpu_to_le16(value);
220
221 return PCIBIOS_SUCCESSFUL;
222}
223
224static int hades_write_config_dword(struct pci_dev *dev, int where, u32 value)
225{
226 volatile unsigned int *pci_addr;
227 unsigned char header_type;
228 int result;
229
230 if ((pci_addr = (unsigned int *) mk_conf_addr(dev, where)) == NULL)
231 return PCIBIOS_DEVICE_NOT_FOUND;
232
233 /*
234 * Check if the value is an address on the bus. If true, subtract the
235 * base address of the PCI memory or PCI I/O area on the Hades.
236 */
237
238 if ((result = hades_read_config_byte(dev, PCI_HEADER_TYPE,
239 &header_type)) != PCIBIOS_SUCCESSFUL)
240 return result;
241
242 if (((where >= PCI_BASE_ADDRESS_0) && (where <= PCI_BASE_ADDRESS_1)) ||
243 ((header_type != PCI_HEADER_TYPE_BRIDGE) && ((where >= PCI_BASE_ADDRESS_2) &&
244 (where <= PCI_BASE_ADDRESS_5))))
245 {
246 if ((value & PCI_BASE_ADDRESS_SPACE) ==
247 PCI_BASE_ADDRESS_SPACE_IO)
248 {
249 /*
250 * I/O address. Check if the address is valid address on
251 * the Hades (pci_io_base_virt <= value < pci_io_base_virt +
252 * HADES_VIRT_IO_SIZE) or if the value is 0xffffffff. If not
253 * true do not write the base address register. If it is a
254 * valid base address subtract 'pci_io_base_virt' from the value.
255 */
256
257 if ((value >= pci_io_base_virt) && (value < (pci_io_base_virt +
258 HADES_VIRT_IO_SIZE)))
259 value -= pci_io_base_virt;
260 else
261 {
262 if (value != 0xffffffff)
263 return PCIBIOS_SET_FAILED;
264 }
265 }
266 else
267 {
268 /*
269 * Memory address. Check if the address is valid address on
270 * the Hades (HADES_MEM_BASE <= value < HADES_MEM_BASE + HADES_MEM_SIZE) or
271 * if the value is 0xffffffff. If not true do not write
272 * the base address register. If it is a valid base address
273 * subtract HADES_MEM_BASE from the value.
274 */
275
276 if ((value >= HADES_MEM_BASE) && (value < (HADES_MEM_BASE + HADES_MEM_SIZE)))
277 value -= HADES_MEM_BASE;
278 else
279 {
280 if (value != 0xffffffff)
281 return PCIBIOS_SET_FAILED;
282 }
283 }
284 }
285
286 *pci_addr = cpu_to_le32(value);
287
288 return PCIBIOS_SUCCESSFUL;
289}
290
291/*
292 * static inline void hades_fixup(void)
293 *
294 * Assign IRQ numbers as used by Linux to the interrupt pins
295 * of the PCI cards.
296 */
297
298static void __init hades_fixup(int pci_modify)
299{
300 char irq_tab[4] = {
301 [0] = IRQ_TT_MFP_IO0, /* Slot 0. */
302 [1] = IRQ_TT_MFP_IO1, /* Slot 1. */
303 [2] = IRQ_TT_MFP_SCC, /* Slot 2. */
304 [3] = IRQ_TT_MFP_SCSIDMA /* Slot 3. */
305 };
306 struct pci_dev *dev = NULL;
307 unsigned char slot;
308
309 /*
310 * Go through all devices, fixing up irqs as we see fit:
311 */
312
313 while ((dev = pci_get_device(PCI_ANY_ID, PCI_ANY_ID, dev)) != NULL)
314 {
315 if (dev->class >> 16 != PCI_BASE_CLASS_BRIDGE)
316 {
317 slot = PCI_SLOT(dev->devfn); /* Determine slot number. */
318 dev->irq = irq_tab[slot];
319 if (pci_modify)
320 pci_write_config_byte(dev, PCI_INTERRUPT_LINE, dev->irq);
321 }
322 }
323}
324
325/*
326 * static void hades_conf_device(struct pci_dev *dev)
327 *
328 * Machine dependent Configure the given device.
329 *
330 * Parameters:
331 *
332 * dev - the pci device.
333 */
334
335static void __init hades_conf_device(struct pci_dev *dev)
336{
337 pci_write_config_byte(dev, PCI_CACHE_LINE_SIZE, 0);
338}
339
340static struct pci_ops hades_pci_ops = {
341 .read_byte = hades_read_config_byte,
342 .read_word = hades_read_config_word,
343 .read_dword = hades_read_config_dword,
344 .write_byte = hades_write_config_byte,
345 .write_word = hades_write_config_word,
346 .write_dword = hades_write_config_dword
347};
348
349/*
350 * struct pci_bus_info *init_hades_pci(void)
351 *
352 * Machine specific initialisation:
353 *
354 * - Allocate and initialise a 'pci_bus_info' structure
355 * - Initialise hardware
356 *
357 * Result: pointer to 'pci_bus_info' structure.
358 */
359
360struct pci_bus_info * __init init_hades_pci(void)
361{
362 struct pci_bus_info *bus;
363 int i;
364
365 /*
366 * Remap I/O and configuration space.
367 */
368
369 pci_io_base_virt = (unsigned long) ioremap(HADES_IO_BASE, HADES_VIRT_IO_SIZE);
370
371 for (i = 0; i < N_SLOTS; i++)
372 pci_conf_base_virt[i] = (unsigned long) ioremap(pci_conf_base_phys[i], 0x10000);
373
374 /*
375 * Allocate memory for bus info structure.
376 */
377
378 bus = kzalloc(sizeof(struct pci_bus_info), GFP_KERNEL);
379 if (unlikely(!bus))
380 goto iounmap_base_virt;
381
382 /*
383 * Claim resources. The m68k has no separate I/O space, both
384 * PCI memory space and PCI I/O space are in memory space. Therefore
385 * the I/O resources are requested in memory space as well.
386 */
387
388 if (unlikely(request_resource(&iomem_resource, &config_space) != 0))
389 goto free_bus;
390
391 if (unlikely(request_resource(&iomem_resource, &io_space) != 0))
392 goto release_config_space;
393
394 bus->mem_space.start = HADES_MEM_BASE;
395 bus->mem_space.end = HADES_MEM_BASE + HADES_MEM_SIZE - 1;
396 bus->mem_space.name = pci_mem_name;
397#if 1
398 if (unlikely(request_resource(&iomem_resource, &bus->mem_space) != 0))
399 goto release_io_space;
400#endif
401 bus->io_space.start = pci_io_base_virt;
402 bus->io_space.end = pci_io_base_virt + HADES_VIRT_IO_SIZE - 1;
403 bus->io_space.name = pci_io_name;
404#if 1
405 if (unlikely(request_resource(&ioport_resource, &bus->io_space) != 0))
406 goto release_bus_mem_space;
407#endif
408 /*
409 * Set hardware dependent functions.
410 */
411
412 bus->m68k_pci_ops = &hades_pci_ops;
413 bus->fixup = hades_fixup;
414 bus->conf_device = hades_conf_device;
415
416 /*
417 * Select high to low edge for PCI interrupts.
418 */
419
420 tt_mfp.active_edge &= ~0x27;
421
422 return bus;
423
424release_bus_mem_space:
425 release_resource(&bus->mem_space);
426release_io_space:
427 release_resource(&io_space);
428release_config_space:
429 release_resource(&config_space);
430free_bus:
431 kfree(bus);
432iounmap_base_virt:
433 iounmap((void *)pci_io_base_virt);
434
435 for (i = 0; i < N_SLOTS; i++)
436 iounmap((void *)pci_conf_base_virt[i]);
437
438 return NULL;
439}
440#endif
diff --git a/arch/m68k/atari/time.c b/arch/m68k/atari/time.c
index e0d3c8bfb408..1edde27fa32d 100644
--- a/arch/m68k/atari/time.c
+++ b/arch/m68k/atari/time.c
@@ -20,6 +20,9 @@
20 20
21#include <asm/atariints.h> 21#include <asm/atariints.h>
22 22
23DEFINE_SPINLOCK(rtc_lock);
24EXPORT_SYMBOL_GPL(rtc_lock);
25
23void __init 26void __init
24atari_sched_init(irq_handler_t timer_routine) 27atari_sched_init(irq_handler_t timer_routine)
25{ 28{
@@ -191,13 +194,14 @@ int atari_tt_hwclk( int op, struct rtc_time *t )
191 } 194 }
192 195
193 if (!(ctrl & RTC_DM_BINARY)) { 196 if (!(ctrl & RTC_DM_BINARY)) {
194 BIN_TO_BCD(sec); 197 sec = bin2bcd(sec);
195 BIN_TO_BCD(min); 198 min = bin2bcd(min);
196 BIN_TO_BCD(hour); 199 hour = bin2bcd(hour);
197 BIN_TO_BCD(day); 200 day = bin2bcd(day);
198 BIN_TO_BCD(mon); 201 mon = bin2bcd(mon);
199 BIN_TO_BCD(year); 202 year = bin2bcd(year);
200 if (wday >= 0) BIN_TO_BCD(wday); 203 if (wday >= 0)
204 wday = bin2bcd(wday);
201 } 205 }
202 } 206 }
203 207
@@ -252,13 +256,13 @@ int atari_tt_hwclk( int op, struct rtc_time *t )
252 } 256 }
253 257
254 if (!(ctrl & RTC_DM_BINARY)) { 258 if (!(ctrl & RTC_DM_BINARY)) {
255 BCD_TO_BIN(sec); 259 sec = bcd2bin(sec);
256 BCD_TO_BIN(min); 260 min = bcd2bin(min);
257 BCD_TO_BIN(hour); 261 hour = bcd2bin(hour);
258 BCD_TO_BIN(day); 262 day = bcd2bin(day);
259 BCD_TO_BIN(mon); 263 mon = bcd2bin(mon);
260 BCD_TO_BIN(year); 264 year = bcd2bin(year);
261 BCD_TO_BIN(wday); 265 wday = bcd2bin(wday);
262 } 266 }
263 267
264 if (!(ctrl & RTC_24H)) { 268 if (!(ctrl & RTC_24H)) {
@@ -318,7 +322,7 @@ int atari_tt_set_clock_mmss (unsigned long nowtime)
318 322
319 rtc_minutes = RTC_READ (RTC_MINUTES); 323 rtc_minutes = RTC_READ (RTC_MINUTES);
320 if (!(save_control & RTC_DM_BINARY)) 324 if (!(save_control & RTC_DM_BINARY))
321 BCD_TO_BIN (rtc_minutes); 325 rtc_minutes = bcd2bin(rtc_minutes);
322 326
323 /* Since we're only adjusting minutes and seconds, don't interfere 327 /* Since we're only adjusting minutes and seconds, don't interfere
324 with hour overflow. This avoids messing with unknown time zones 328 with hour overflow. This avoids messing with unknown time zones
@@ -329,8 +333,8 @@ int atari_tt_set_clock_mmss (unsigned long nowtime)
329 { 333 {
330 if (!(save_control & RTC_DM_BINARY)) 334 if (!(save_control & RTC_DM_BINARY))
331 { 335 {
332 BIN_TO_BCD (real_seconds); 336 real_seconds = bin2bcd(real_seconds);
333 BIN_TO_BCD (real_minutes); 337 real_minutes = bin2bcd(real_minutes);
334 } 338 }
335 RTC_WRITE (RTC_SECONDS, real_seconds); 339 RTC_WRITE (RTC_SECONDS, real_seconds);
336 RTC_WRITE (RTC_MINUTES, real_minutes); 340 RTC_WRITE (RTC_MINUTES, real_minutes);
diff --git a/arch/m68k/bvme6000/config.c b/arch/m68k/bvme6000/config.c
index 9433a88a33c4..65c9204ab9ac 100644
--- a/arch/m68k/bvme6000/config.c
+++ b/arch/m68k/bvme6000/config.c
@@ -25,6 +25,7 @@
25#include <linux/genhd.h> 25#include <linux/genhd.h>
26#include <linux/rtc.h> 26#include <linux/rtc.h>
27#include <linux/interrupt.h> 27#include <linux/interrupt.h>
28#include <linux/bcd.h>
28 29
29#include <asm/bootinfo.h> 30#include <asm/bootinfo.h>
30#include <asm/system.h> 31#include <asm/system.h>
@@ -46,9 +47,6 @@ extern void bvme6000_reset (void);
46extern void bvme6000_waitbut(void); 47extern void bvme6000_waitbut(void);
47void bvme6000_set_vectors (void); 48void bvme6000_set_vectors (void);
48 49
49static unsigned char bcd2bin (unsigned char b);
50static unsigned char bin2bcd (unsigned char b);
51
52/* Save tick handler routine pointer, will point to do_timer() in 50/* Save tick handler routine pointer, will point to do_timer() in
53 * kernel/sched.c, called via bvme6000_process_int() */ 51 * kernel/sched.c, called via bvme6000_process_int() */
54 52
@@ -264,17 +262,6 @@ unsigned long bvme6000_gettimeoffset (void)
264 return v; 262 return v;
265} 263}
266 264
267static unsigned char bcd2bin (unsigned char b)
268{
269 return ((b>>4)*10 + (b&15));
270}
271
272static unsigned char bin2bcd (unsigned char b)
273{
274 return (((b/10)*16) + (b%10));
275}
276
277
278/* 265/*
279 * Looks like op is non-zero for setting the clock, and zero for 266 * Looks like op is non-zero for setting the clock, and zero for
280 * reading the clock. 267 * reading the clock.
diff --git a/arch/m68k/bvme6000/rtc.c b/arch/m68k/bvme6000/rtc.c
index e8ac3f7d72df..808c9018b115 100644
--- a/arch/m68k/bvme6000/rtc.c
+++ b/arch/m68k/bvme6000/rtc.c
@@ -57,16 +57,16 @@ static int rtc_ioctl(struct inode *inode, struct file *file, unsigned int cmd,
57 rtc->msr = 0x40; 57 rtc->msr = 0x40;
58 memset(&wtime, 0, sizeof(struct rtc_time)); 58 memset(&wtime, 0, sizeof(struct rtc_time));
59 do { 59 do {
60 wtime.tm_sec = BCD2BIN(rtc->bcd_sec); 60 wtime.tm_sec = bcd2bin(rtc->bcd_sec);
61 wtime.tm_min = BCD2BIN(rtc->bcd_min); 61 wtime.tm_min = bcd2bin(rtc->bcd_min);
62 wtime.tm_hour = BCD2BIN(rtc->bcd_hr); 62 wtime.tm_hour = bcd2bin(rtc->bcd_hr);
63 wtime.tm_mday = BCD2BIN(rtc->bcd_dom); 63 wtime.tm_mday = bcd2bin(rtc->bcd_dom);
64 wtime.tm_mon = BCD2BIN(rtc->bcd_mth)-1; 64 wtime.tm_mon = bcd2bin(rtc->bcd_mth)-1;
65 wtime.tm_year = BCD2BIN(rtc->bcd_year); 65 wtime.tm_year = bcd2bin(rtc->bcd_year);
66 if (wtime.tm_year < 70) 66 if (wtime.tm_year < 70)
67 wtime.tm_year += 100; 67 wtime.tm_year += 100;
68 wtime.tm_wday = BCD2BIN(rtc->bcd_dow)-1; 68 wtime.tm_wday = bcd2bin(rtc->bcd_dow)-1;
69 } while (wtime.tm_sec != BCD2BIN(rtc->bcd_sec)); 69 } while (wtime.tm_sec != bcd2bin(rtc->bcd_sec));
70 rtc->msr = msr; 70 rtc->msr = msr;
71 local_irq_restore(flags); 71 local_irq_restore(flags);
72 return copy_to_user(argp, &wtime, sizeof wtime) ? 72 return copy_to_user(argp, &wtime, sizeof wtime) ?
@@ -114,14 +114,14 @@ static int rtc_ioctl(struct inode *inode, struct file *file, unsigned int cmd,
114 114
115 rtc->t0cr_rtmr = yrs%4; 115 rtc->t0cr_rtmr = yrs%4;
116 rtc->bcd_tenms = 0; 116 rtc->bcd_tenms = 0;
117 rtc->bcd_sec = BIN2BCD(sec); 117 rtc->bcd_sec = bin2bcd(sec);
118 rtc->bcd_min = BIN2BCD(min); 118 rtc->bcd_min = bin2bcd(min);
119 rtc->bcd_hr = BIN2BCD(hrs); 119 rtc->bcd_hr = bin2bcd(hrs);
120 rtc->bcd_dom = BIN2BCD(day); 120 rtc->bcd_dom = bin2bcd(day);
121 rtc->bcd_mth = BIN2BCD(mon); 121 rtc->bcd_mth = bin2bcd(mon);
122 rtc->bcd_year = BIN2BCD(yrs%100); 122 rtc->bcd_year = bin2bcd(yrs%100);
123 if (rtc_tm.tm_wday >= 0) 123 if (rtc_tm.tm_wday >= 0)
124 rtc->bcd_dow = BIN2BCD(rtc_tm.tm_wday+1); 124 rtc->bcd_dow = bin2bcd(rtc_tm.tm_wday+1);
125 rtc->t0cr_rtmr = yrs%4 | 0x08; 125 rtc->t0cr_rtmr = yrs%4 | 0x08;
126 126
127 rtc->msr = msr; 127 rtc->msr = msr;
diff --git a/arch/m68k/kernel/Makefile b/arch/m68k/kernel/Makefile
index 3a7f62225504..55d5d6b680a2 100644
--- a/arch/m68k/kernel/Makefile
+++ b/arch/m68k/kernel/Makefile
@@ -14,5 +14,4 @@ obj-y := entry.o process.o traps.o ints.o signal.o ptrace.o module.o \
14 14
15devres-y = ../../../kernel/irq/devres.o 15devres-y = ../../../kernel/irq/devres.o
16 16
17obj-$(CONFIG_PCI) += bios32.o
18obj-y$(CONFIG_MMU_SUN3) += dma.o # no, it's not a typo 17obj-y$(CONFIG_MMU_SUN3) += dma.o # no, it's not a typo
diff --git a/arch/m68k/kernel/bios32.c b/arch/m68k/kernel/bios32.c
deleted file mode 100644
index af170c2be735..000000000000
--- a/arch/m68k/kernel/bios32.c
+++ /dev/null
@@ -1,514 +0,0 @@
1/*
2 * bios32.c - PCI BIOS functions for m68k systems.
3 *
4 * Written by Wout Klaren.
5 *
6 * Based on the DEC Alpha bios32.c by Dave Rusling and David Mosberger.
7 */
8
9#include <linux/init.h>
10#include <linux/kernel.h>
11
12#if 0
13# define DBG_DEVS(args) printk args
14#else
15# define DBG_DEVS(args)
16#endif
17
18#ifdef CONFIG_PCI
19
20/*
21 * PCI support for Linux/m68k. Currently only the Hades is supported.
22 *
23 * The support for PCI bridges in the DEC Alpha version has
24 * been removed in this version.
25 */
26
27#include <linux/pci.h>
28#include <linux/slab.h>
29#include <linux/mm.h>
30
31#include <asm/io.h>
32#include <asm/pci.h>
33#include <asm/uaccess.h>
34
35#define KB 1024
36#define MB (1024*KB)
37#define GB (1024*MB)
38
39#define MAJOR_REV 0
40#define MINOR_REV 5
41
42/*
43 * Align VAL to ALIGN, which must be a power of two.
44 */
45
46#define ALIGN(val,align) (((val) + ((align) - 1)) & ~((align) - 1))
47
48/*
49 * Offsets relative to the I/O and memory base addresses from where resources
50 * are allocated.
51 */
52
53#define IO_ALLOC_OFFSET 0x00004000
54#define MEM_ALLOC_OFFSET 0x04000000
55
56/*
57 * Declarations of hardware specific initialisation functions.
58 */
59
60extern struct pci_bus_info *init_hades_pci(void);
61
62/*
63 * Bus info structure of the PCI bus. A pointer to this structure is
64 * put in the sysdata member of the pci_bus structure.
65 */
66
67static struct pci_bus_info *bus_info;
68
69static int pci_modify = 1; /* If set, layout the PCI bus ourself. */
70static int skip_vga; /* If set do not modify base addresses
71 of vga cards.*/
72static int disable_pci_burst; /* If set do not allow PCI bursts. */
73
74static unsigned int io_base;
75static unsigned int mem_base;
76
77/*
78 * static void disable_dev(struct pci_dev *dev)
79 *
80 * Disable PCI device DEV so that it does not respond to I/O or memory
81 * accesses.
82 *
83 * Parameters:
84 *
85 * dev - device to disable.
86 */
87
88static void __init disable_dev(struct pci_dev *dev)
89{
90 unsigned short cmd;
91
92 if (((dev->class >> 8 == PCI_CLASS_NOT_DEFINED_VGA) ||
93 (dev->class >> 8 == PCI_CLASS_DISPLAY_VGA) ||
94 (dev->class >> 8 == PCI_CLASS_DISPLAY_XGA)) && skip_vga)
95 return;
96
97 pci_read_config_word(dev, PCI_COMMAND, &cmd);
98
99 cmd &= (~PCI_COMMAND_IO & ~PCI_COMMAND_MEMORY & ~PCI_COMMAND_MASTER);
100 pci_write_config_word(dev, PCI_COMMAND, cmd);
101}
102
103/*
104 * static void layout_dev(struct pci_dev *dev)
105 *
106 * Layout memory and I/O for a device.
107 *
108 * Parameters:
109 *
110 * device - device to layout memory and I/O for.
111 */
112
113static void __init layout_dev(struct pci_dev *dev)
114{
115 unsigned short cmd;
116 unsigned int base, mask, size, reg;
117 unsigned int alignto;
118 int i;
119
120 /*
121 * Skip video cards if requested.
122 */
123
124 if (((dev->class >> 8 == PCI_CLASS_NOT_DEFINED_VGA) ||
125 (dev->class >> 8 == PCI_CLASS_DISPLAY_VGA) ||
126 (dev->class >> 8 == PCI_CLASS_DISPLAY_XGA)) && skip_vga)
127 return;
128
129 pci_read_config_word(dev, PCI_COMMAND, &cmd);
130
131 for (reg = PCI_BASE_ADDRESS_0, i = 0; reg <= PCI_BASE_ADDRESS_5; reg += 4, i++)
132 {
133 /*
134 * Figure out how much space and of what type this
135 * device wants.
136 */
137
138 pci_write_config_dword(dev, reg, 0xffffffff);
139 pci_read_config_dword(dev, reg, &base);
140
141 if (!base)
142 {
143 /* this base-address register is unused */
144 dev->resource[i].start = 0;
145 dev->resource[i].end = 0;
146 dev->resource[i].flags = 0;
147 continue;
148 }
149
150 /*
151 * We've read the base address register back after
152 * writing all ones and so now we must decode it.
153 */
154
155 if (base & PCI_BASE_ADDRESS_SPACE_IO)
156 {
157 /*
158 * I/O space base address register.
159 */
160
161 cmd |= PCI_COMMAND_IO;
162
163 base &= PCI_BASE_ADDRESS_IO_MASK;
164 mask = (~base << 1) | 0x1;
165 size = (mask & base) & 0xffffffff;
166
167 /*
168 * Align to multiple of size of minimum base.
169 */
170
171 alignto = max_t(unsigned int, 0x040, size);
172 base = ALIGN(io_base, alignto);
173 io_base = base + size;
174 pci_write_config_dword(dev, reg, base | PCI_BASE_ADDRESS_SPACE_IO);
175
176 dev->resource[i].start = base;
177 dev->resource[i].end = dev->resource[i].start + size - 1;
178 dev->resource[i].flags = IORESOURCE_IO | PCI_BASE_ADDRESS_SPACE_IO;
179
180 DBG_DEVS(("layout_dev: IO address: %lX\n", base));
181 }
182 else
183 {
184 unsigned int type;
185
186 /*
187 * Memory space base address register.
188 */
189
190 cmd |= PCI_COMMAND_MEMORY;
191 type = base & PCI_BASE_ADDRESS_MEM_TYPE_MASK;
192 base &= PCI_BASE_ADDRESS_MEM_MASK;
193 mask = (~base << 1) | 0x1;
194 size = (mask & base) & 0xffffffff;
195 switch (type)
196 {
197 case PCI_BASE_ADDRESS_MEM_TYPE_32:
198 case PCI_BASE_ADDRESS_MEM_TYPE_64:
199 break;
200
201 case PCI_BASE_ADDRESS_MEM_TYPE_1M:
202 printk("bios32 WARNING: slot %d, function %d "
203 "requests memory below 1MB---don't "
204 "know how to do that.\n",
205 PCI_SLOT(dev->devfn),
206 PCI_FUNC(dev->devfn));
207 continue;
208 }
209
210 /*
211 * Align to multiple of size of minimum base.
212 */
213
214 alignto = max_t(unsigned int, 0x1000, size);
215 base = ALIGN(mem_base, alignto);
216 mem_base = base + size;
217 pci_write_config_dword(dev, reg, base);
218
219 dev->resource[i].start = base;
220 dev->resource[i].end = dev->resource[i].start + size - 1;
221 dev->resource[i].flags = IORESOURCE_MEM;
222
223 if (type == PCI_BASE_ADDRESS_MEM_TYPE_64)
224 {
225 /*
226 * 64-bit address, set the highest 32 bits
227 * to zero.
228 */
229
230 reg += 4;
231 pci_write_config_dword(dev, reg, 0);
232
233 i++;
234 dev->resource[i].start = 0;
235 dev->resource[i].end = 0;
236 dev->resource[i].flags = 0;
237 }
238 }
239 }
240
241 /*
242 * Enable device:
243 */
244
245 if (dev->class >> 8 == PCI_CLASS_NOT_DEFINED ||
246 dev->class >> 8 == PCI_CLASS_NOT_DEFINED_VGA ||
247 dev->class >> 8 == PCI_CLASS_DISPLAY_VGA ||
248 dev->class >> 8 == PCI_CLASS_DISPLAY_XGA)
249 {
250 /*
251 * All of these (may) have I/O scattered all around
252 * and may not use i/o-base address registers at all.
253 * So we just have to always enable I/O to these
254 * devices.
255 */
256 cmd |= PCI_COMMAND_IO;
257 }
258
259 pci_write_config_word(dev, PCI_COMMAND, cmd | PCI_COMMAND_MASTER);
260
261 pci_write_config_byte(dev, PCI_LATENCY_TIMER, (disable_pci_burst) ? 0 : 32);
262
263 if (bus_info != NULL)
264 bus_info->conf_device(dev); /* Machine dependent configuration. */
265
266 DBG_DEVS(("layout_dev: bus %d slot 0x%x VID 0x%x DID 0x%x class 0x%x\n",
267 dev->bus->number, PCI_SLOT(dev->devfn), dev->vendor, dev->device, dev->class));
268}
269
270/*
271 * static void layout_bus(struct pci_bus *bus)
272 *
273 * Layout memory and I/O for all devices on the given bus.
274 *
275 * Parameters:
276 *
277 * bus - bus.
278 */
279
280static void __init layout_bus(struct pci_bus *bus)
281{
282 unsigned int bio, bmem;
283 struct pci_dev *dev;
284
285 DBG_DEVS(("layout_bus: starting bus %d\n", bus->number));
286
287 if (!bus->devices && !bus->children)
288 return;
289
290 /*
291 * Align the current bases on appropriate boundaries (4K for
292 * IO and 1MB for memory).
293 */
294
295 bio = io_base = ALIGN(io_base, 4*KB);
296 bmem = mem_base = ALIGN(mem_base, 1*MB);
297
298 /*
299 * PCI devices might have been setup by a PCI BIOS emulation
300 * running under TOS. In these cases there is a
301 * window during which two devices may have an overlapping
302 * address range. To avoid this causing trouble, we first
303 * turn off the I/O and memory address decoders for all PCI
304 * devices. They'll be re-enabled only once all address
305 * decoders are programmed consistently.
306 */
307
308 DBG_DEVS(("layout_bus: disable_dev for bus %d\n", bus->number));
309
310 for (dev = bus->devices; dev; dev = dev->sibling)
311 {
312 if ((dev->class >> 16 != PCI_BASE_CLASS_BRIDGE) ||
313 (dev->class >> 8 == PCI_CLASS_BRIDGE_PCMCIA))
314 disable_dev(dev);
315 }
316
317 /*
318 * Allocate space to each device:
319 */
320
321 DBG_DEVS(("layout_bus: starting bus %d devices\n", bus->number));
322
323 for (dev = bus->devices; dev; dev = dev->sibling)
324 {
325 if ((dev->class >> 16 != PCI_BASE_CLASS_BRIDGE) ||
326 (dev->class >> 8 == PCI_CLASS_BRIDGE_PCMCIA))
327 layout_dev(dev);
328 }
329
330 DBG_DEVS(("layout_bus: bus %d finished\n", bus->number));
331}
332
333/*
334 * static void pcibios_fixup(void)
335 *
336 * Layout memory and I/O of all devices on the PCI bus if 'pci_modify' is
337 * true. This might be necessary because not every m68k machine with a PCI
338 * bus has a PCI BIOS. This function should be called right after
339 * pci_scan_bus() in pcibios_init().
340 */
341
342static void __init pcibios_fixup(void)
343{
344 if (pci_modify)
345 {
346 /*
347 * Set base addresses for allocation of I/O and memory space.
348 */
349
350 io_base = bus_info->io_space.start + IO_ALLOC_OFFSET;
351 mem_base = bus_info->mem_space.start + MEM_ALLOC_OFFSET;
352
353 /*
354 * Scan the tree, allocating PCI memory and I/O space.
355 */
356
357 layout_bus(pci_bus_b(pci_root.next));
358 }
359
360 /*
361 * Fix interrupt assignments, etc.
362 */
363
364 bus_info->fixup(pci_modify);
365}
366
367/*
368 * static void pcibios_claim_resources(struct pci_bus *bus)
369 *
370 * Claim all resources that are assigned to devices on the given bus.
371 *
372 * Parameters:
373 *
374 * bus - bus.
375 */
376
377static void __init pcibios_claim_resources(struct pci_bus *bus)
378{
379 struct pci_dev *dev;
380 int i;
381
382 while (bus)
383 {
384 for (dev = bus->devices; (dev != NULL); dev = dev->sibling)
385 {
386 for (i = 0; i < PCI_NUM_RESOURCES; i++)
387 {
388 struct resource *r = &dev->resource[i];
389 struct resource *pr;
390 struct pci_bus_info *bus_info = (struct pci_bus_info *) dev->sysdata;
391
392 if ((r->start == 0) || (r->parent != NULL))
393 continue;
394#if 1
395 if (r->flags & IORESOURCE_IO)
396 pr = &bus_info->io_space;
397 else
398 pr = &bus_info->mem_space;
399#else
400 if (r->flags & IORESOURCE_IO)
401 pr = &ioport_resource;
402 else
403 pr = &iomem_resource;
404#endif
405 if (request_resource(pr, r) < 0)
406 {
407 printk(KERN_ERR "PCI: Address space collision on region %d of device %s\n", i, dev->name);
408 }
409 }
410 }
411
412 if (bus->children)
413 pcibios_claim_resources(bus->children);
414
415 bus = bus->next;
416 }
417}
418
419/*
420 * int pcibios_assign_resource(struct pci_dev *dev, int i)
421 *
422 * Assign a new address to a PCI resource.
423 *
424 * Parameters:
425 *
426 * dev - device.
427 * i - resource.
428 *
429 * Result: 0 if successful.
430 */
431
432int __init pcibios_assign_resource(struct pci_dev *dev, int i)
433{
434 struct resource *r = &dev->resource[i];
435 struct resource *pr = pci_find_parent_resource(dev, r);
436 unsigned long size = r->end + 1;
437
438 if (!pr)
439 return -EINVAL;
440
441 if (r->flags & IORESOURCE_IO)
442 {
443 if (size > 0x100)
444 return -EFBIG;
445
446 if (allocate_resource(pr, r, size, bus_info->io_space.start +
447 IO_ALLOC_OFFSET, bus_info->io_space.end, 1024))
448 return -EBUSY;
449 }
450 else
451 {
452 if (allocate_resource(pr, r, size, bus_info->mem_space.start +
453 MEM_ALLOC_OFFSET, bus_info->mem_space.end, size))
454 return -EBUSY;
455 }
456
457 if (i < 6)
458 pci_write_config_dword(dev, PCI_BASE_ADDRESS_0 + 4 * i, r->start);
459
460 return 0;
461}
462
463void __init pcibios_fixup_bus(struct pci_bus *bus)
464{
465 struct pci_dev *dev;
466 void *sysdata;
467
468 sysdata = (bus->parent) ? bus->parent->sysdata : bus->sysdata;
469
470 for (dev = bus->devices; (dev != NULL); dev = dev->sibling)
471 dev->sysdata = sysdata;
472}
473
474void __init pcibios_init(void)
475{
476 printk("Linux/m68k PCI BIOS32 revision %x.%02x\n", MAJOR_REV, MINOR_REV);
477
478 bus_info = NULL;
479#ifdef CONFIG_HADES
480 if (MACH_IS_HADES)
481 bus_info = init_hades_pci();
482#endif
483 if (bus_info != NULL)
484 {
485 printk("PCI: Probing PCI hardware\n");
486 pci_scan_bus(0, bus_info->m68k_pci_ops, bus_info);
487 pcibios_fixup();
488 pcibios_claim_resources(pci_root);
489 }
490 else
491 printk("PCI: No PCI bus detected\n");
492}
493
494char * __init pcibios_setup(char *str)
495{
496 if (!strcmp(str, "nomodify"))
497 {
498 pci_modify = 0;
499 return NULL;
500 }
501 else if (!strcmp(str, "skipvga"))
502 {
503 skip_vga = 1;
504 return NULL;
505 }
506 else if (!strcmp(str, "noburst"))
507 {
508 disable_pci_burst = 1;
509 return NULL;
510 }
511
512 return str;
513}
514#endif /* CONFIG_PCI */
diff --git a/arch/m68k/kernel/dma.c b/arch/m68k/kernel/dma.c
index 6f8c080dd9f9..2bb4245404d8 100644
--- a/arch/m68k/kernel/dma.c
+++ b/arch/m68k/kernel/dma.c
@@ -66,8 +66,8 @@ void dma_free_coherent(struct device *dev, size_t size,
66} 66}
67EXPORT_SYMBOL(dma_free_coherent); 67EXPORT_SYMBOL(dma_free_coherent);
68 68
69inline void dma_sync_single_for_device(struct device *dev, dma_addr_t handle, size_t size, 69void dma_sync_single_for_device(struct device *dev, dma_addr_t handle,
70 enum dma_data_direction dir) 70 size_t size, enum dma_data_direction dir)
71{ 71{
72 switch (dir) { 72 switch (dir) {
73 case DMA_TO_DEVICE: 73 case DMA_TO_DEVICE:
diff --git a/arch/m68k/kernel/ints.c b/arch/m68k/kernel/ints.c
index ded7dd2f67b2..7e8a0d394e61 100644
--- a/arch/m68k/kernel/ints.c
+++ b/arch/m68k/kernel/ints.c
@@ -429,8 +429,9 @@ int show_interrupts(struct seq_file *p, void *v)
429 return 0; 429 return 0;
430} 430}
431 431
432#ifdef CONFIG_PROC_FS
432void init_irq_proc(void) 433void init_irq_proc(void)
433{ 434{
434 /* Insert /proc/irq driver here */ 435 /* Insert /proc/irq driver here */
435} 436}
436 437#endif
diff --git a/arch/m68k/kernel/process.c b/arch/m68k/kernel/process.c
index 7888cdf91f5d..3042c2bc8c58 100644
--- a/arch/m68k/kernel/process.c
+++ b/arch/m68k/kernel/process.c
@@ -78,7 +78,7 @@ unsigned long thread_saved_pc(struct task_struct *tsk)
78static void default_idle(void) 78static void default_idle(void)
79{ 79{
80 if (!need_resched()) 80 if (!need_resched())
81#if defined(MACH_ATARI_ONLY) && !defined(CONFIG_HADES) 81#if defined(MACH_ATARI_ONLY)
82 /* block out HSYNC on the atari (falcon) */ 82 /* block out HSYNC on the atari (falcon) */
83 __asm__("stop #0x2200" : : : "cc"); 83 __asm__("stop #0x2200" : : : "cc");
84#else 84#else
diff --git a/arch/m68k/kernel/traps.c b/arch/m68k/kernel/traps.c
index 75b8340b254b..6d813de2baf1 100644
--- a/arch/m68k/kernel/traps.c
+++ b/arch/m68k/kernel/traps.c
@@ -883,8 +883,7 @@ void show_trace(unsigned long *stack)
883 if (i % 5 == 0) 883 if (i % 5 == 0)
884 printk("\n "); 884 printk("\n ");
885#endif 885#endif
886 printk(" [<%08lx>]", addr); 886 printk(" [<%08lx>] %pS\n", addr, (void *)addr);
887 print_symbol(" %s\n", addr);
888 i++; 887 i++;
889 } 888 }
890 } 889 }
@@ -900,10 +899,8 @@ void show_registers(struct pt_regs *regs)
900 int i; 899 int i;
901 900
902 print_modules(); 901 print_modules();
903 printk("PC: [<%08lx>]",regs->pc); 902 printk("PC: [<%08lx>] %pS\n", regs->pc, (void *)regs->pc);
904 print_symbol(" %s", regs->pc); 903 printk("SR: %04x SP: %p a2: %08lx\n", regs->sr, regs, regs->a2);
905 printk("\nSR: %04x SP: %p a2: %08lx\n",
906 regs->sr, regs, regs->a2);
907 printk("d0: %08lx d1: %08lx d2: %08lx d3: %08lx\n", 904 printk("d0: %08lx d1: %08lx d2: %08lx d3: %08lx\n",
908 regs->d0, regs->d1, regs->d2, regs->d3); 905 regs->d0, regs->d1, regs->d2, regs->d3);
909 printk("d4: %08lx d5: %08lx a0: %08lx a1: %08lx\n", 906 printk("d4: %08lx d5: %08lx a0: %08lx a1: %08lx\n",
diff --git a/arch/m68k/kernel/vmlinux-std.lds b/arch/m68k/kernel/vmlinux-std.lds
index 99b0784c0552..f846d4e3e5e1 100644
--- a/arch/m68k/kernel/vmlinux-std.lds
+++ b/arch/m68k/kernel/vmlinux-std.lds
@@ -34,10 +34,10 @@ SECTIONS
34 CONSTRUCTORS 34 CONSTRUCTORS
35 } 35 }
36 36
37 .bss : { *(.bss) } /* BSS */
38
39 . = ALIGN(16); 37 . = ALIGN(16);
40 .data.cacheline_aligned : { *(.data.cacheline_aligned) } :data 38 .data.cacheline_aligned : { *(.data.cacheline_aligned) }
39
40 .bss : { *(.bss) } /* BSS */
41 41
42 _edata = .; /* End of data section */ 42 _edata = .; /* End of data section */
43 43
@@ -48,7 +48,7 @@ SECTIONS
48 _sinittext = .; 48 _sinittext = .;
49 INIT_TEXT 49 INIT_TEXT
50 _einittext = .; 50 _einittext = .;
51 } 51 } :data
52 .init.data : { INIT_DATA } 52 .init.data : { INIT_DATA }
53 . = ALIGN(16); 53 . = ALIGN(16);
54 __setup_start = .; 54 __setup_start = .;
@@ -74,6 +74,7 @@ SECTIONS
74 .init.ramfs : { *(.init.ramfs) } 74 .init.ramfs : { *(.init.ramfs) }
75 __initramfs_end = .; 75 __initramfs_end = .;
76#endif 76#endif
77 NOTES
77 . = ALIGN(8192); 78 . = ALIGN(8192);
78 __init_end = .; 79 __init_end = .;
79 80
diff --git a/arch/m68k/mm/kmap.c b/arch/m68k/mm/kmap.c
index 46b7d6035aab..df620ac2a296 100644
--- a/arch/m68k/mm/kmap.c
+++ b/arch/m68k/mm/kmap.c
@@ -66,8 +66,10 @@ static struct vm_struct *get_io_area(unsigned long size)
66 for (p = &iolist; (tmp = *p) ; p = &tmp->next) { 66 for (p = &iolist; (tmp = *p) ; p = &tmp->next) {
67 if (size + addr < (unsigned long)tmp->addr) 67 if (size + addr < (unsigned long)tmp->addr)
68 break; 68 break;
69 if (addr > KMAP_END-size) 69 if (addr > KMAP_END-size) {
70 kfree(area);
70 return NULL; 71 return NULL;
72 }
71 addr = tmp->size + (unsigned long)tmp->addr; 73 addr = tmp->size + (unsigned long)tmp->addr;
72 } 74 }
73 area->addr = (void *)addr; 75 area->addr = (void *)addr;
diff --git a/arch/m68k/mvme16x/rtc.c b/arch/m68k/mvme16x/rtc.c
index 432a9f13b2ed..cea5e3e4e636 100644
--- a/arch/m68k/mvme16x/rtc.c
+++ b/arch/m68k/mvme16x/rtc.c
@@ -52,15 +52,15 @@ static int rtc_ioctl(struct inode *inode, struct file *file, unsigned int cmd,
52 /* Ensure clock and real-time-mode-register are accessible */ 52 /* Ensure clock and real-time-mode-register are accessible */
53 rtc->ctrl = RTC_READ; 53 rtc->ctrl = RTC_READ;
54 memset(&wtime, 0, sizeof(struct rtc_time)); 54 memset(&wtime, 0, sizeof(struct rtc_time));
55 wtime.tm_sec = BCD2BIN(rtc->bcd_sec); 55 wtime.tm_sec = bcd2bin(rtc->bcd_sec);
56 wtime.tm_min = BCD2BIN(rtc->bcd_min); 56 wtime.tm_min = bcd2bin(rtc->bcd_min);
57 wtime.tm_hour = BCD2BIN(rtc->bcd_hr); 57 wtime.tm_hour = bcd2bin(rtc->bcd_hr);
58 wtime.tm_mday = BCD2BIN(rtc->bcd_dom); 58 wtime.tm_mday = bcd2bin(rtc->bcd_dom);
59 wtime.tm_mon = BCD2BIN(rtc->bcd_mth)-1; 59 wtime.tm_mon = bcd2bin(rtc->bcd_mth)-1;
60 wtime.tm_year = BCD2BIN(rtc->bcd_year); 60 wtime.tm_year = bcd2bin(rtc->bcd_year);
61 if (wtime.tm_year < 70) 61 if (wtime.tm_year < 70)
62 wtime.tm_year += 100; 62 wtime.tm_year += 100;
63 wtime.tm_wday = BCD2BIN(rtc->bcd_dow)-1; 63 wtime.tm_wday = bcd2bin(rtc->bcd_dow)-1;
64 rtc->ctrl = 0; 64 rtc->ctrl = 0;
65 local_irq_restore(flags); 65 local_irq_restore(flags);
66 return copy_to_user(argp, &wtime, sizeof wtime) ? 66 return copy_to_user(argp, &wtime, sizeof wtime) ?
@@ -104,12 +104,12 @@ static int rtc_ioctl(struct inode *inode, struct file *file, unsigned int cmd,
104 local_irq_save(flags); 104 local_irq_save(flags);
105 rtc->ctrl = RTC_WRITE; 105 rtc->ctrl = RTC_WRITE;
106 106
107 rtc->bcd_sec = BIN2BCD(sec); 107 rtc->bcd_sec = bin2bcd(sec);
108 rtc->bcd_min = BIN2BCD(min); 108 rtc->bcd_min = bin2bcd(min);
109 rtc->bcd_hr = BIN2BCD(hrs); 109 rtc->bcd_hr = bin2bcd(hrs);
110 rtc->bcd_dom = BIN2BCD(day); 110 rtc->bcd_dom = bin2bcd(day);
111 rtc->bcd_mth = BIN2BCD(mon); 111 rtc->bcd_mth = bin2bcd(mon);
112 rtc->bcd_year = BIN2BCD(yrs%100); 112 rtc->bcd_year = bin2bcd(yrs%100);
113 113
114 rtc->ctrl = 0; 114 rtc->ctrl = 0;
115 local_irq_restore(flags); 115 local_irq_restore(flags);
diff --git a/arch/m68k/q40/config.c b/arch/m68k/q40/config.c
index be9de2f3dc48..9c7eefa3f98a 100644
--- a/arch/m68k/q40/config.c
+++ b/arch/m68k/q40/config.c
@@ -23,6 +23,7 @@
23#include <linux/serial_reg.h> 23#include <linux/serial_reg.h>
24#include <linux/rtc.h> 24#include <linux/rtc.h>
25#include <linux/vt_kern.h> 25#include <linux/vt_kern.h>
26#include <linux/bcd.h>
26 27
27#include <asm/io.h> 28#include <asm/io.h>
28#include <asm/rtc.h> 29#include <asm/rtc.h>
@@ -216,17 +217,6 @@ int q40_parse_bootinfo(const struct bi_record *rec)
216} 217}
217 218
218 219
219static inline unsigned char bcd2bin(unsigned char b)
220{
221 return (b >> 4) * 10 + (b & 15);
222}
223
224static inline unsigned char bin2bcd(unsigned char b)
225{
226 return (b / 10) * 16 + (b % 10);
227}
228
229
230static unsigned long q40_gettimeoffset(void) 220static unsigned long q40_gettimeoffset(void)
231{ 221{
232 return 5000 * (ql_ticks != 0); 222 return 5000 * (ql_ticks != 0);
diff --git a/arch/m68k/sun3x/time.c b/arch/m68k/sun3x/time.c
index f5eaafb00d21..536a04aaf22f 100644
--- a/arch/m68k/sun3x/time.c
+++ b/arch/m68k/sun3x/time.c
@@ -47,23 +47,23 @@ int sun3x_hwclk(int set, struct rtc_time *t)
47 47
48 if(set) { 48 if(set) {
49 h->csr |= C_WRITE; 49 h->csr |= C_WRITE;
50 h->sec = BIN2BCD(t->tm_sec); 50 h->sec = bin2bcd(t->tm_sec);
51 h->min = BIN2BCD(t->tm_min); 51 h->min = bin2bcd(t->tm_min);
52 h->hour = BIN2BCD(t->tm_hour); 52 h->hour = bin2bcd(t->tm_hour);
53 h->wday = BIN2BCD(t->tm_wday); 53 h->wday = bin2bcd(t->tm_wday);
54 h->mday = BIN2BCD(t->tm_mday); 54 h->mday = bin2bcd(t->tm_mday);
55 h->month = BIN2BCD(t->tm_mon); 55 h->month = bin2bcd(t->tm_mon);
56 h->year = BIN2BCD(t->tm_year); 56 h->year = bin2bcd(t->tm_year);
57 h->csr &= ~C_WRITE; 57 h->csr &= ~C_WRITE;
58 } else { 58 } else {
59 h->csr |= C_READ; 59 h->csr |= C_READ;
60 t->tm_sec = BCD2BIN(h->sec); 60 t->tm_sec = bcd2bin(h->sec);
61 t->tm_min = BCD2BIN(h->min); 61 t->tm_min = bcd2bin(h->min);
62 t->tm_hour = BCD2BIN(h->hour); 62 t->tm_hour = bcd2bin(h->hour);
63 t->tm_wday = BCD2BIN(h->wday); 63 t->tm_wday = bcd2bin(h->wday);
64 t->tm_mday = BCD2BIN(h->mday); 64 t->tm_mday = bcd2bin(h->mday);
65 t->tm_mon = BCD2BIN(h->month); 65 t->tm_mon = bcd2bin(h->month);
66 t->tm_year = BCD2BIN(h->year); 66 t->tm_year = bcd2bin(h->year);
67 h->csr &= ~C_READ; 67 h->csr &= ~C_READ;
68 } 68 }
69 69