2 * linux/arch/m68k/sun3/config.c
4 * Copyright (C) 1996,1997 Pekka Pietik{inen
6 * This file is subject to the terms and conditions of the GNU General Public
7 * License. See the file COPYING in the main directory of this archive
11 #include <linux/types.h>
12 #include <linux/kernel.h>
14 #include <linux/seq_file.h>
15 #include <linux/tty.h>
16 #include <linux/console.h>
17 #include <linux/init.h>
18 #include <linux/bootmem.h>
19 #include <linux/platform_device.h>
21 #include <asm/oplib.h>
22 #include <asm/setup.h>
23 #include <asm/contregs.h>
25 #include <asm/pgtable.h>
26 #include <asm/pgalloc.h>
27 #include <asm/sun3-head.h>
28 #include <asm/sun3mmu.h>
29 #include <asm/machdep.h>
30 #include <asm/machines.h>
31 #include <asm/idprom.h>
32 #include <asm/intersil.h>
34 #include <asm/sections.h>
35 #include <asm/segment.h>
36 #include <asm/sun3ints.h>
38 char sun3_reserved_pmeg
[SUN3_PMEGS_NUM
];
40 extern u32
sun3_gettimeoffset(void);
41 static void sun3_sched_init(irq_handler_t handler
);
42 extern void sun3_get_model (char* model
);
43 extern int sun3_hwclk(int set
, struct rtc_time
*t
);
45 volatile char* clock_va
;
46 extern unsigned long availmem
;
47 unsigned long num_pages
;
49 static void sun3_get_hardware_list(struct seq_file
*m
)
51 seq_printf(m
, "PROM Revision:\t%s\n", romvec
->pv_monid
);
54 void __init
sun3_init(void)
56 unsigned char enable_register
;
59 m68k_machtype
= MACH_SUN3
;
60 m68k_cputype
= CPU_68020
;
61 m68k_fputype
= FPU_68881
; /* mc68881 actually */
62 m68k_mmutype
= MMU_SUN3
;
63 clock_va
= (char *) 0xfe06000; /* dark */
64 sun3_intreg
= (unsigned char *) 0xfe0a000; /* magic */
65 sun3_disable_interrupts();
67 prom_init((void *)LINUX_OPPROM_BEGVM
);
69 GET_CONTROL_BYTE(AC_SENABLE
,enable_register
);
70 enable_register
|= 0x50; /* Enable FPU */
71 SET_CONTROL_BYTE(AC_SENABLE
,enable_register
);
72 GET_CONTROL_BYTE(AC_SENABLE
,enable_register
);
74 /* This code looks suspicious, because it doesn't subtract
75 memory belonging to the kernel from the available space */
78 memset(sun3_reserved_pmeg
, 0, sizeof(sun3_reserved_pmeg
));
80 /* Reserve important PMEGS */
81 /* FIXME: These should be probed instead of hardcoded */
83 for (i
=0; i
<8; i
++) /* Kernel PMEGs */
84 sun3_reserved_pmeg
[i
] = 1;
86 sun3_reserved_pmeg
[247] = 1; /* ROM mapping */
87 sun3_reserved_pmeg
[248] = 1; /* AMD Ethernet */
88 sun3_reserved_pmeg
[251] = 1; /* VB area */
89 sun3_reserved_pmeg
[254] = 1; /* main I/O */
91 sun3_reserved_pmeg
[249] = 1;
92 sun3_reserved_pmeg
[252] = 1;
93 sun3_reserved_pmeg
[253] = 1;
97 /* Without this, Bad Things happen when something calls arch_reset. */
98 static void sun3_reboot (void)
100 prom_reboot ("vmlinux");
103 static void sun3_halt (void)
108 /* sun3 bootmem allocation */
110 static void __init
sun3_bootmem_alloc(unsigned long memory_start
,
111 unsigned long memory_end
)
113 unsigned long start_page
;
115 /* align start/end to page boundaries */
116 memory_start
= ((memory_start
+ (PAGE_SIZE
-1)) & PAGE_MASK
);
117 memory_end
= memory_end
& PAGE_MASK
;
119 start_page
= __pa(memory_start
) >> PAGE_SHIFT
;
120 max_pfn
= num_pages
= __pa(memory_end
) >> PAGE_SHIFT
;
122 high_memory
= (void *)memory_end
;
123 availmem
= memory_start
;
129 void __init
config_sun3(void)
131 unsigned long memory_start
, memory_end
;
133 pr_info("ARCH: SUN3\n");
136 /* Subtract kernel memory from available memory */
138 mach_sched_init
= sun3_sched_init
;
139 mach_init_IRQ
= sun3_init_IRQ
;
140 mach_reset
= sun3_reboot
;
141 arch_gettimeoffset
= sun3_gettimeoffset
;
142 mach_get_model
= sun3_get_model
;
143 mach_hwclk
= sun3_hwclk
;
144 mach_halt
= sun3_halt
;
145 mach_get_hardware_list
= sun3_get_hardware_list
;
147 memory_start
= ((((unsigned long)_end
) + 0x2000) & ~0x1fff);
148 // PROM seems to want the last couple of physical pages. --m
149 memory_end
= *(romvec
->pv_sun3mem
) + PAGE_OFFSET
- 2*PAGE_SIZE
;
152 m68k_memory
[0].size
=*(romvec
->pv_sun3mem
);
154 sun3_bootmem_alloc(memory_start
, memory_end
);
157 static void __init
sun3_sched_init(irq_handler_t timer_routine
)
159 sun3_disable_interrupts();
160 intersil_clock
->cmd_reg
=(INTERSIL_RUN
|INTERSIL_INT_DISABLE
|INTERSIL_24H_MODE
);
161 intersil_clock
->int_reg
=INTERSIL_HZ_100_MASK
;
164 intersil_clock
->cmd_reg
=(INTERSIL_RUN
|INTERSIL_INT_ENABLE
|INTERSIL_24H_MODE
);
165 sun3_enable_interrupts();
169 #if IS_ENABLED(CONFIG_SUN3_SCSI)
171 static const struct resource sun3_scsi_vme_rsrc
[] __initconst
= {
173 .flags
= IORESOURCE_IRQ
,
174 .start
= SUN3_VEC_VMESCSI0
,
175 .end
= SUN3_VEC_VMESCSI0
,
177 .flags
= IORESOURCE_MEM
,
181 .flags
= IORESOURCE_IRQ
,
182 .start
= SUN3_VEC_VMESCSI1
,
183 .end
= SUN3_VEC_VMESCSI1
,
185 .flags
= IORESOURCE_MEM
,
192 * Int: level 2 autovector
193 * IO: type 1, base 0x00140000, 5 bits phys space: A<4..0>
195 static const struct resource sun3_scsi_rsrc
[] __initconst
= {
197 .flags
= IORESOURCE_IRQ
,
201 .flags
= IORESOURCE_MEM
,
207 int __init
sun3_platform_init(void)
209 switch (idprom
->id_machtype
) {
210 case SM_SUN3
| SM_3_160
:
211 case SM_SUN3
| SM_3_260
:
212 platform_device_register_simple("sun3_scsi_vme", -1,
213 sun3_scsi_vme_rsrc
, ARRAY_SIZE(sun3_scsi_vme_rsrc
));
215 case SM_SUN3
| SM_3_50
:
216 case SM_SUN3
| SM_3_60
:
217 platform_device_register_simple("sun3_scsi", -1,
218 sun3_scsi_rsrc
, ARRAY_SIZE(sun3_scsi_rsrc
));
224 arch_initcall(sun3_platform_init
);