xref: /netbsd-src/sys/arch/evbppc/walnut/autoconf.c (revision 735442fdd93f6b5c4c4c765a9047d63370131deb)
1*735442fdSrin /*	$NetBSD: autoconf.c,v 1.26 2021/03/30 05:14:00 rin Exp $	*/
25448df2eSscw 
35448df2eSscw /*
45448df2eSscw  * Copyright (C) 1995, 1996 Wolfgang Solfrank.
55448df2eSscw  * Copyright (C) 1995, 1996 TooLs GmbH.
65448df2eSscw  * All rights reserved.
75448df2eSscw  *
85448df2eSscw  * Redistribution and use in source and binary forms, with or without
95448df2eSscw  * modification, are permitted provided that the following conditions
105448df2eSscw  * are met:
115448df2eSscw  * 1. Redistributions of source code must retain the above copyright
125448df2eSscw  *    notice, this list of conditions and the following disclaimer.
135448df2eSscw  * 2. Redistributions in binary form must reproduce the above copyright
145448df2eSscw  *    notice, this list of conditions and the following disclaimer in the
155448df2eSscw  *    documentation and/or other materials provided with the distribution.
165448df2eSscw  * 3. All advertising materials mentioning features or use of this software
175448df2eSscw  *    must display the following acknowledgement:
185448df2eSscw  *	This product includes software developed by TooLs GmbH.
195448df2eSscw  * 4. The name of TooLs GmbH may not be used to endorse or promote products
205448df2eSscw  *    derived from this software without specific prior written permission.
215448df2eSscw  *
225448df2eSscw  * THIS SOFTWARE IS PROVIDED BY TOOLS GMBH ``AS IS'' AND ANY EXPRESS OR
235448df2eSscw  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
245448df2eSscw  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
255448df2eSscw  * IN NO EVENT SHALL TOOLS GMBH BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
265448df2eSscw  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
275448df2eSscw  * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
285448df2eSscw  * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
295448df2eSscw  * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
305448df2eSscw  * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
315448df2eSscw  * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
325448df2eSscw  */
335448df2eSscw 
3414172728Slukem #include <sys/cdefs.h>
35*735442fdSrin __KERNEL_RCSID(0, "$NetBSD: autoconf.c,v 1.26 2021/03/30 05:14:00 rin Exp $");
3614172728Slukem 
375448df2eSscw #include <sys/param.h>
385448df2eSscw #include <sys/device.h>
395448df2eSscw #include <sys/systm.h>
405448df2eSscw 
41d796e65eSthorpej #include <dev/ic/comreg.h>	/* For COM_FREQ */
42d796e65eSthorpej 
43*735442fdSrin #include <powerpc/spr.h>
44*735442fdSrin #include <powerpc/ibm4xx/spr.h>
45*735442fdSrin 
4651a2be50Smatt #include <powerpc/ibm4xx/cpu.h>
47b105a186Skiyohara #include <powerpc/ibm4xx/dcr4xx.h>
485448df2eSscw #include <powerpc/ibm4xx/dev/plbvar.h>
495448df2eSscw 
505448df2eSscw /*
515448df2eSscw  * List of port-specific devices to attach to the processor local bus.
525448df2eSscw  */
535448df2eSscw static const struct plb_dev local_plb_devs [] = {
54b105a186Skiyohara 	{ IBM405GP, "pbus", },
55b105a186Skiyohara 	{ 0, NULL }
565448df2eSscw };
575448df2eSscw 
585448df2eSscw /*
595448df2eSscw  * Determine device configuration for a machine.
605448df2eSscw  */
615448df2eSscw void
cpu_configure(void)625448df2eSscw cpu_configure(void)
635448df2eSscw {
645448df2eSscw 
655448df2eSscw 	intr_init();
665448df2eSscw 	calc_delayconst();
675448df2eSscw 
685448df2eSscw 	/* Make sure that timers run at CPU frequency */
695448df2eSscw 	mtdcr(DCR_CPC0_CR1, mfdcr(DCR_CPC0_CR1) & ~CPC0_CR1_CETE);
705448df2eSscw 
71b5268e27Sjoerg 	if (config_rootfound("plb", __UNCONST(&local_plb_devs)) == NULL)
725448df2eSscw 		panic("configure: plb not configured");
735448df2eSscw 
7458300879Srin 	genppc_cpu_configure();
755448df2eSscw }
765448df2eSscw 
771a4648d9Sthorpej void
device_register(device_t dev,void * aux)7851a2be50Smatt device_register(device_t dev, void *aux)
791a4648d9Sthorpej {
80d796e65eSthorpej 
8136cc5934Srin 	ibm4xx_device_register(dev, aux, COM_FREQ * 6);
821a4648d9Sthorpej }
83