1*1a6eafb9Srin /* $NetBSD: obs266_autoconf.c,v 1.10 2021/03/30 04:11:29 rin Exp $ */
2b55107dcSshige
3b55107dcSshige /*
4b55107dcSshige * Copyright 2004 Shigeyuki Fukushima.
5b55107dcSshige * All rights reserved.
6b55107dcSshige *
7b55107dcSshige * Written by Shigeyuki Fukushima for The NetBSD Project.
8b55107dcSshige *
9b55107dcSshige * Redistribution and use in source and binary forms, with or without
10b55107dcSshige * modification, are permitted provided that the following conditions
11b55107dcSshige * are met:
12b55107dcSshige * 1. Redistributions of source code must retain the above copyright
13b55107dcSshige * notice, this list of conditions and the following disclaimer.
14b55107dcSshige * 2. Redistributions in binary form must reproduce the above
15b55107dcSshige * copyright notice, this list of conditions and the following
16b55107dcSshige * disclaimer in the documentation and/or other materials provided
17b55107dcSshige * with the distribution.
18b55107dcSshige * 3. The name of the author may not be used to endorse or promote
19b55107dcSshige * products derived from this software without specific prior
20b55107dcSshige * written permission.
21b55107dcSshige *
22b55107dcSshige * THIS SOFTWARE IS PROVIDED THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
23b55107dcSshige * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
24b55107dcSshige * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
25b55107dcSshige * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE
26b55107dcSshige * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
27b55107dcSshige * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
28b55107dcSshige * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
29b55107dcSshige * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
30b55107dcSshige * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
31b55107dcSshige * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
32b55107dcSshige * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
33b55107dcSshige * DAMAGE.
34b55107dcSshige */
35b55107dcSshige #include <sys/cdefs.h>
36*1a6eafb9Srin __KERNEL_RCSID(0, "$NetBSD: obs266_autoconf.c,v 1.10 2021/03/30 04:11:29 rin Exp $");
37b55107dcSshige
38*1a6eafb9Srin #include <sys/param.h>
39b55107dcSshige #include <sys/device.h>
40*1a6eafb9Srin #include <sys/systm.h>
41b55107dcSshige
42b55107dcSshige #include <machine/obs266.h>
43b55107dcSshige
44b105a186Skiyohara #include <powerpc/ibm4xx/cpu.h>
45b105a186Skiyohara #include <powerpc/ibm4xx/dcr4xx.h>
46b105a186Skiyohara
47b920e23dSshige /*
48b920e23dSshige * Determine device configuration for a machine.
49b920e23dSshige */
50b920e23dSshige void
cpu_configure(void)51b920e23dSshige cpu_configure(void)
52b920e23dSshige {
53b920e23dSshige
54b920e23dSshige intr_init();
55b920e23dSshige calc_delayconst();
56b920e23dSshige
57b920e23dSshige /* Make sure that timers run at CPU frequency */
58b920e23dSshige mtdcr(DCR_CPC0_CR1, mfdcr(DCR_CPC0_CR1) & ~CPC0_CR1_CETE);
59b920e23dSshige
60b920e23dSshige if (config_rootfound("plb", NULL) == NULL)
61b920e23dSshige panic("configure: mainbus not configured");
62b920e23dSshige
631f194d9aSrin genppc_cpu_configure();
64b920e23dSshige }
65b920e23dSshige
6651a2be50Smatt void
device_register(device_t dev,void * aux)6751a2be50Smatt device_register(device_t dev, void *aux)
68b55107dcSshige {
69b55107dcSshige
7036cc5934Srin ibm4xx_device_register(dev, aux, OBS266_COM_FREQ);
71b55107dcSshige }
72