Linux Audio

Check our new training course

Loading...
v5.4
  1/*
  2 *  linux/arch/m68k/sun3/config.c
  3 *
  4 *  Copyright (C) 1996,1997 Pekka Pietik{inen
  5 *
  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
  8 * for more details.
  9 */
 10
 11#include <linux/types.h>
 12#include <linux/kernel.h>
 13#include <linux/mm.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/memblock.h>
 19#include <linux/platform_device.h>
 
 20
 21#include <asm/oplib.h>
 22#include <asm/setup.h>
 23#include <asm/contregs.h>
 24#include <asm/movs.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>
 33#include <asm/irq.h>
 34#include <asm/sections.h>
 35#include <asm/segment.h>
 36#include <asm/sun3ints.h>
 
 
 
 37
 38char sun3_reserved_pmeg[SUN3_PMEGS_NUM];
 39
 40static void sun3_sched_init(irq_handler_t handler);
 41extern void sun3_get_model (char* model);
 42extern int sun3_hwclk(int set, struct rtc_time *t);
 43
 44volatile char* clock_va;
 45extern unsigned long availmem;
 46unsigned long num_pages;
 47
 48static void sun3_get_hardware_list(struct seq_file *m)
 49{
 50	seq_printf(m, "PROM Revision:\t%s\n", romvec->pv_monid);
 51}
 52
 53void __init sun3_init(void)
 54{
 55	unsigned char enable_register;
 56	int i;
 57
 58	m68k_machtype= MACH_SUN3;
 59	m68k_cputype = CPU_68020;
 60	m68k_fputype = FPU_68881; /* mc68881 actually */
 61	m68k_mmutype = MMU_SUN3;
 62	clock_va    =          (char *) 0xfe06000;	/* dark  */
 63	sun3_intreg = (unsigned char *) 0xfe0a000;	/* magic */
 64	sun3_disable_interrupts();
 65
 66	prom_init((void *)LINUX_OPPROM_BEGVM);
 67
 68	GET_CONTROL_BYTE(AC_SENABLE,enable_register);
 69	enable_register |= 0x50; /* Enable FPU */
 70	SET_CONTROL_BYTE(AC_SENABLE,enable_register);
 71	GET_CONTROL_BYTE(AC_SENABLE,enable_register);
 72
 73	/* This code looks suspicious, because it doesn't subtract
 74           memory belonging to the kernel from the available space */
 75
 76
 77	memset(sun3_reserved_pmeg, 0, sizeof(sun3_reserved_pmeg));
 78
 79	/* Reserve important PMEGS */
 80	/* FIXME: These should be probed instead of hardcoded */
 81
 82	for (i=0; i<8; i++)		/* Kernel PMEGs */
 83		sun3_reserved_pmeg[i] = 1;
 84
 85	sun3_reserved_pmeg[247] = 1;	/* ROM mapping  */
 86	sun3_reserved_pmeg[248] = 1;	/* AMD Ethernet */
 87	sun3_reserved_pmeg[251] = 1;	/* VB area      */
 88	sun3_reserved_pmeg[254] = 1;	/* main I/O     */
 89
 90	sun3_reserved_pmeg[249] = 1;
 91	sun3_reserved_pmeg[252] = 1;
 92	sun3_reserved_pmeg[253] = 1;
 93	set_fs(KERNEL_DS);
 94}
 95
 96/* Without this, Bad Things happen when something calls arch_reset. */
 97static void sun3_reboot (void)
 98{
 99	prom_reboot ("vmlinux");
100}
101
102static void sun3_halt (void)
103{
104	prom_halt ();
105}
106
107/* sun3 bootmem allocation */
108
109static void __init sun3_bootmem_alloc(unsigned long memory_start,
110				      unsigned long memory_end)
111{
112	unsigned long start_page;
113
114	/* align start/end to page boundaries */
115	memory_start = ((memory_start + (PAGE_SIZE-1)) & PAGE_MASK);
116	memory_end = memory_end & PAGE_MASK;
117
118	start_page = __pa(memory_start) >> PAGE_SHIFT;
119	max_pfn = num_pages = __pa(memory_end) >> PAGE_SHIFT;
120
121	high_memory = (void *)memory_end;
122	availmem = memory_start;
123
124	m68k_setup_node(0);
125}
126
127
128void __init config_sun3(void)
129{
130	unsigned long memory_start, memory_end;
131
132	pr_info("ARCH: SUN3\n");
133	idprom_init();
134
135	/* Subtract kernel memory from available memory */
136
137        mach_sched_init      =  sun3_sched_init;
138        mach_init_IRQ        =  sun3_init_IRQ;
139        mach_reset           =  sun3_reboot;
140	mach_get_model	     =  sun3_get_model;
141	mach_hwclk           =  sun3_hwclk;
142	mach_halt	     =  sun3_halt;
143	mach_get_hardware_list = sun3_get_hardware_list;
144
145	memory_start = ((((unsigned long)_end) + 0x2000) & ~0x1fff);
146// PROM seems to want the last couple of physical pages. --m
147	memory_end   = *(romvec->pv_sun3mem) + PAGE_OFFSET - 2*PAGE_SIZE;
148
149	m68k_num_memory=1;
150        m68k_memory[0].size=*(romvec->pv_sun3mem);
151
152	sun3_bootmem_alloc(memory_start, memory_end);
153}
154
155static void __init sun3_sched_init(irq_handler_t timer_routine)
156{
157	sun3_disable_interrupts();
158        intersil_clock->cmd_reg=(INTERSIL_RUN|INTERSIL_INT_DISABLE|INTERSIL_24H_MODE);
159        intersil_clock->int_reg=INTERSIL_HZ_100_MASK;
160	intersil_clear();
161        sun3_enable_irq(5);
162        intersil_clock->cmd_reg=(INTERSIL_RUN|INTERSIL_INT_ENABLE|INTERSIL_24H_MODE);
163        sun3_enable_interrupts();
164        intersil_clear();
165}
166
167#if IS_ENABLED(CONFIG_SUN3_SCSI)
168
169static const struct resource sun3_scsi_vme_rsrc[] __initconst = {
170	{
171		.flags = IORESOURCE_IRQ,
172		.start = SUN3_VEC_VMESCSI0,
173		.end   = SUN3_VEC_VMESCSI0,
174	}, {
175		.flags = IORESOURCE_MEM,
176		.start = 0xff200000,
177		.end   = 0xff200021,
178	}, {
179		.flags = IORESOURCE_IRQ,
180		.start = SUN3_VEC_VMESCSI1,
181		.end   = SUN3_VEC_VMESCSI1,
182	}, {
183		.flags = IORESOURCE_MEM,
184		.start = 0xff204000,
185		.end   = 0xff204021,
186	},
187};
188
189/*
190 * Int: level 2 autovector
191 * IO: type 1, base 0x00140000, 5 bits phys space: A<4..0>
192 */
193static const struct resource sun3_scsi_rsrc[] __initconst = {
194	{
195		.flags = IORESOURCE_IRQ,
196		.start = 2,
197		.end   = 2,
198	}, {
199		.flags = IORESOURCE_MEM,
200		.start = 0x00140000,
201		.end   = 0x0014001f,
202	},
203};
204
205int __init sun3_platform_init(void)
206{
207	switch (idprom->id_machtype) {
208	case SM_SUN3 | SM_3_160:
209	case SM_SUN3 | SM_3_260:
210		platform_device_register_simple("sun3_scsi_vme", -1,
211			sun3_scsi_vme_rsrc, ARRAY_SIZE(sun3_scsi_vme_rsrc));
212		break;
213	case SM_SUN3 | SM_3_50:
214	case SM_SUN3 | SM_3_60:
215		platform_device_register_simple("sun3_scsi", -1,
216			sun3_scsi_rsrc, ARRAY_SIZE(sun3_scsi_rsrc));
217		break;
218	}
219	return 0;
220}
221
222arch_initcall(sun3_platform_init);
223
224#endif
v6.13.7
  1/*
  2 *  linux/arch/m68k/sun3/config.c
  3 *
  4 *  Copyright (C) 1996,1997 Pekka Pietik{inen
  5 *
  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
  8 * for more details.
  9 */
 10
 11#include <linux/types.h>
 12#include <linux/kernel.h>
 13#include <linux/mm.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/memblock.h>
 19#include <linux/platform_device.h>
 20#include <linux/linkage.h>
 21
 22#include <asm/oplib.h>
 23#include <asm/setup.h>
 24#include <asm/contregs.h>
 25#include <asm/movs.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>
 33#include <asm/irq.h>
 34#include <asm/sections.h>
 
 35#include <asm/sun3ints.h>
 36#include <asm/config.h>
 37
 38#include "sun3.h"
 39
 40char sun3_reserved_pmeg[SUN3_PMEGS_NUM];
 41
 42static void sun3_sched_init(void);
 
 
 43
 44volatile char* clock_va;
 45extern unsigned long availmem;
 46unsigned long num_pages;
 47
 48static void sun3_get_hardware_list(struct seq_file *m)
 49{
 50	seq_printf(m, "PROM Revision:\t%s\n", romvec->pv_monid);
 51}
 52
 53asmlinkage void __init sun3_init(void)
 54{
 55	unsigned char enable_register;
 56	int i;
 57
 58	m68k_machtype= MACH_SUN3;
 59	m68k_cputype = CPU_68020;
 60	m68k_fputype = FPU_68881; /* mc68881 actually */
 61	m68k_mmutype = MMU_SUN3;
 62	clock_va    =          (char *) 0xfe06000;	/* dark  */
 63	sun3_intreg = (unsigned char *) 0xfe0a000;	/* magic */
 64	sun3_disable_interrupts();
 65
 66	prom_init((void *)LINUX_OPPROM_BEGVM);
 67
 68	GET_CONTROL_BYTE(AC_SENABLE,enable_register);
 69	enable_register |= 0x50; /* Enable FPU */
 70	SET_CONTROL_BYTE(AC_SENABLE,enable_register);
 71	GET_CONTROL_BYTE(AC_SENABLE,enable_register);
 72
 73	/* This code looks suspicious, because it doesn't subtract
 74           memory belonging to the kernel from the available space */
 75
 76
 77	memset(sun3_reserved_pmeg, 0, sizeof(sun3_reserved_pmeg));
 78
 79	/* Reserve important PMEGS */
 80	/* FIXME: These should be probed instead of hardcoded */
 81
 82	for (i=0; i<8; i++)		/* Kernel PMEGs */
 83		sun3_reserved_pmeg[i] = 1;
 84
 85	sun3_reserved_pmeg[247] = 1;	/* ROM mapping  */
 86	sun3_reserved_pmeg[248] = 1;	/* AMD Ethernet */
 87	sun3_reserved_pmeg[251] = 1;	/* VB area      */
 88	sun3_reserved_pmeg[254] = 1;	/* main I/O     */
 89
 90	sun3_reserved_pmeg[249] = 1;
 91	sun3_reserved_pmeg[252] = 1;
 92	sun3_reserved_pmeg[253] = 1;
 93	set_fc(USER_DATA);
 94}
 95
 96/* Without this, Bad Things happen when something calls arch_reset. */
 97static void sun3_reboot (void)
 98{
 99	prom_reboot ("vmlinux");
100}
101
102static void sun3_halt (void)
103{
104	prom_halt ();
105}
106
107/* sun3 bootmem allocation */
108
109static void __init sun3_bootmem_alloc(unsigned long memory_start,
110				      unsigned long memory_end)
111{
 
 
112	/* align start/end to page boundaries */
113	memory_start = ((memory_start + (PAGE_SIZE-1)) & PAGE_MASK);
114	memory_end = memory_end & PAGE_MASK;
115
 
116	max_pfn = num_pages = __pa(memory_end) >> PAGE_SHIFT;
117
118	high_memory = (void *)memory_end;
119	availmem = memory_start;
120
121	m68k_setup_node(0);
122}
123
124
125void __init config_sun3(void)
126{
127	unsigned long memory_start, memory_end;
128
129	pr_info("ARCH: SUN3\n");
130	idprom_init();
131
132	/* Subtract kernel memory from available memory */
133
134        mach_sched_init      =  sun3_sched_init;
135        mach_init_IRQ        =  sun3_init_IRQ;
136        mach_reset           =  sun3_reboot;
137	mach_get_model	     =  sun3_get_model;
138	mach_hwclk           =  sun3_hwclk;
139	mach_halt	     =  sun3_halt;
140	mach_get_hardware_list = sun3_get_hardware_list;
141
142	memory_start = ((((unsigned long)_end) + 0x2000) & ~0x1fff);
143// PROM seems to want the last couple of physical pages. --m
144	memory_end   = *(romvec->pv_sun3mem) + PAGE_OFFSET - 2*PAGE_SIZE;
145
146	m68k_num_memory=1;
147        m68k_memory[0].size=*(romvec->pv_sun3mem);
148
149	sun3_bootmem_alloc(memory_start, memory_end);
150}
151
152static void __init sun3_sched_init(void)
153{
154	sun3_disable_interrupts();
155        intersil_clock->cmd_reg=(INTERSIL_RUN|INTERSIL_INT_DISABLE|INTERSIL_24H_MODE);
156        intersil_clock->int_reg=INTERSIL_HZ_100_MASK;
157	intersil_clear();
158        sun3_enable_irq(5);
159        intersil_clock->cmd_reg=(INTERSIL_RUN|INTERSIL_INT_ENABLE|INTERSIL_24H_MODE);
160        sun3_enable_interrupts();
161        intersil_clear();
162}
163
164#if IS_ENABLED(CONFIG_SUN3_SCSI)
165
166static const struct resource sun3_scsi_vme_rsrc[] __initconst = {
167	{
168		.flags = IORESOURCE_IRQ,
169		.start = SUN3_VEC_VMESCSI0,
170		.end   = SUN3_VEC_VMESCSI0,
171	}, {
172		.flags = IORESOURCE_MEM,
173		.start = 0xff200000,
174		.end   = 0xff200021,
175	}, {
176		.flags = IORESOURCE_IRQ,
177		.start = SUN3_VEC_VMESCSI1,
178		.end   = SUN3_VEC_VMESCSI1,
179	}, {
180		.flags = IORESOURCE_MEM,
181		.start = 0xff204000,
182		.end   = 0xff204021,
183	},
184};
185
186/*
187 * Int: level 2 autovector
188 * IO: type 1, base 0x00140000, 5 bits phys space: A<4..0>
189 */
190static const struct resource sun3_scsi_rsrc[] __initconst = {
191	{
192		.flags = IORESOURCE_IRQ,
193		.start = 2,
194		.end   = 2,
195	}, {
196		.flags = IORESOURCE_MEM,
197		.start = 0x00140000,
198		.end   = 0x0014001f,
199	},
200};
201
202static int __init sun3_platform_init(void)
203{
204	switch (idprom->id_machtype) {
205	case SM_SUN3 | SM_3_160:
206	case SM_SUN3 | SM_3_260:
207		platform_device_register_simple("sun3_scsi_vme", -1,
208			sun3_scsi_vme_rsrc, ARRAY_SIZE(sun3_scsi_vme_rsrc));
209		break;
210	case SM_SUN3 | SM_3_50:
211	case SM_SUN3 | SM_3_60:
212		platform_device_register_simple("sun3_scsi", -1,
213			sun3_scsi_rsrc, ARRAY_SIZE(sun3_scsi_rsrc));
214		break;
215	}
216	return 0;
217}
218
219arch_initcall(sun3_platform_init);
220
221#endif