autoconf.c revision 1.1
11.1Srin/*	$NetBSD: autoconf.c,v 1.1 2021/04/02 07:00:33 rin Exp $	*/
21.1Srin
31.1Srin/*
41.1Srin * Taken from src/sys/arch/evbppc/walnut/autoconf.c:
51.1Srin *	NetBSD: autoconf.c,v 1.26 2021/03/30 05:14:00 rin Exp
61.1Srin */
71.1Srin
81.1Srin/*
91.1Srin * Copyright (C) 1995, 1996 Wolfgang Solfrank.
101.1Srin * Copyright (C) 1995, 1996 TooLs GmbH.
111.1Srin * All rights reserved.
121.1Srin *
131.1Srin * Redistribution and use in source and binary forms, with or without
141.1Srin * modification, are permitted provided that the following conditions
151.1Srin * are met:
161.1Srin * 1. Redistributions of source code must retain the above copyright
171.1Srin *    notice, this list of conditions and the following disclaimer.
181.1Srin * 2. Redistributions in binary form must reproduce the above copyright
191.1Srin *    notice, this list of conditions and the following disclaimer in the
201.1Srin *    documentation and/or other materials provided with the distribution.
211.1Srin * 3. All advertising materials mentioning features or use of this software
221.1Srin *    must display the following acknowledgement:
231.1Srin *	This product includes software developed by TooLs GmbH.
241.1Srin * 4. The name of TooLs GmbH may not be used to endorse or promote products
251.1Srin *    derived from this software without specific prior written permission.
261.1Srin *
271.1Srin * THIS SOFTWARE IS PROVIDED BY TOOLS GMBH ``AS IS'' AND ANY EXPRESS OR
281.1Srin * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
291.1Srin * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
301.1Srin * IN NO EVENT SHALL TOOLS GMBH BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
311.1Srin * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
321.1Srin * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
331.1Srin * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
341.1Srin * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
351.1Srin * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
361.1Srin * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
371.1Srin */
381.1Srin
391.1Srin#include <sys/cdefs.h>
401.1Srin__KERNEL_RCSID(0, "$NetBSD: autoconf.c,v 1.1 2021/04/02 07:00:33 rin Exp $");
411.1Srin
421.1Srin#include <sys/param.h>
431.1Srin#include <sys/device.h>
441.1Srin#include <sys/systm.h>
451.1Srin
461.1Srin#include <machine/dht.h>
471.1Srin
481.1Srin#include <powerpc/spr.h>
491.1Srin#include <powerpc/ibm4xx/spr.h>
501.1Srin
511.1Srin#include <powerpc/ibm4xx/cpu.h>
521.1Srin#include <powerpc/ibm4xx/dcr4xx.h>
531.1Srin#include <powerpc/ibm4xx/dev/plbvar.h>
541.1Srin
551.1Srin/*
561.1Srin * Determine device configuration for a machine.
571.1Srin */
581.1Srinvoid
591.1Srincpu_configure(void)
601.1Srin{
611.1Srin
621.1Srin	intr_init();
631.1Srin	calc_delayconst();
641.1Srin
651.1Srin	/* Make sure that timers run at CPU frequency */
661.1Srin	mtdcr(DCR_CPC0_CR1, mfdcr(DCR_CPC0_CR1) & ~CPC0_CR1_CETE);
671.1Srin
681.1Srin	if (config_rootfound("plb", NULL) == NULL)
691.1Srin		panic("%s: plb not configured", __func__);
701.1Srin
711.1Srin	genppc_cpu_configure();
721.1Srin}
731.1Srin
741.1Srinvoid
751.1Srindevice_register(device_t dev, void *aux)
761.1Srin{
771.1Srin
781.1Srin	ibm4xx_device_register(dev, aux, DHT_COM_FREQ);
791.1Srin}
80