1 /* $NetBSD: autoconf.c,v 1.1 2021/04/02 07:00:33 rin Exp $ */
2
3 /*
4 * Taken from src/sys/arch/evbppc/walnut/autoconf.c:
5 * NetBSD: autoconf.c,v 1.26 2021/03/30 05:14:00 rin Exp
6 */
7
8 /*
9 * Copyright (C) 1995, 1996 Wolfgang Solfrank.
10 * Copyright (C) 1995, 1996 TooLs GmbH.
11 * All rights reserved.
12 *
13 * Redistribution and use in source and binary forms, with or without
14 * modification, are permitted provided that the following conditions
15 * are met:
16 * 1. Redistributions of source code must retain the above copyright
17 * notice, this list of conditions and the following disclaimer.
18 * 2. Redistributions in binary form must reproduce the above copyright
19 * notice, this list of conditions and the following disclaimer in the
20 * documentation and/or other materials provided with the distribution.
21 * 3. All advertising materials mentioning features or use of this software
22 * must display the following acknowledgement:
23 * This product includes software developed by TooLs GmbH.
24 * 4. The name of TooLs GmbH may not be used to endorse or promote products
25 * derived from this software without specific prior written permission.
26 *
27 * THIS SOFTWARE IS PROVIDED BY TOOLS GMBH ``AS IS'' AND ANY EXPRESS OR
28 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
29 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
30 * IN NO EVENT SHALL TOOLS GMBH BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
31 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
32 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
33 * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
34 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
35 * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
36 * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
37 */
38
39 #include <sys/cdefs.h>
40 __KERNEL_RCSID(0, "$NetBSD: autoconf.c,v 1.1 2021/04/02 07:00:33 rin Exp $");
41
42 #include <sys/param.h>
43 #include <sys/device.h>
44 #include <sys/systm.h>
45
46 #include <machine/dht.h>
47
48 #include <powerpc/spr.h>
49 #include <powerpc/ibm4xx/spr.h>
50
51 #include <powerpc/ibm4xx/cpu.h>
52 #include <powerpc/ibm4xx/dcr4xx.h>
53 #include <powerpc/ibm4xx/dev/plbvar.h>
54
55 /*
56 * Determine device configuration for a machine.
57 */
58 void
cpu_configure(void)59 cpu_configure(void)
60 {
61
62 intr_init();
63 calc_delayconst();
64
65 /* Make sure that timers run at CPU frequency */
66 mtdcr(DCR_CPC0_CR1, mfdcr(DCR_CPC0_CR1) & ~CPC0_CR1_CETE);
67
68 if (config_rootfound("plb", NULL) == NULL)
69 panic("%s: plb not configured", __func__);
70
71 genppc_cpu_configure();
72 }
73
74 void
device_register(device_t dev,void * aux)75 device_register(device_t dev, void *aux)
76 {
77
78 ibm4xx_device_register(dev, aux, DHT_COM_FREQ);
79 }
80