Home | History | Annotate | Line # | Download | only in obs405
obs200_autoconf.c revision 1.3
      1 /*	$NetBSD: obs200_autoconf.c,v 1.3 2006/05/15 15:56:54 shige Exp $	*/
      2 
      3 /*
      4  * Copyright 2004 Shigeyuki Fukushima.
      5  * All rights reserved.
      6  *
      7  * Written by Shigeyuki Fukushima for The NetBSD Project.
      8  *
      9  * Redistribution and use in source and binary forms, with or without
     10  * modification, are permitted provided that the following conditions
     11  * are met:
     12  * 1. Redistributions of source code must retain the above copyright
     13  *    notice, this list of conditions and the following disclaimer.
     14  * 2. Redistributions in binary form must reproduce the above
     15  *    copyright notice, this list of conditions and the following
     16  *    disclaimer in the documentation and/or other materials provided
     17  *    with the distribution.
     18  * 3. The name of the author may not be used to endorse or promote
     19  *    products derived from this software without specific prior
     20  *    written permission.
     21  *
     22  * THIS SOFTWARE IS PROVIDED THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
     23  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
     24  * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
     25  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR BE LIABLE
     26  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
     27  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
     28  * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
     29  * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
     30  * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
     31  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
     32  * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
     33  * DAMAGE.
     34  */
     35 #include <sys/cdefs.h>
     36 __KERNEL_RCSID(0, "$NetBSD: obs200_autoconf.c,v 1.3 2006/05/15 15:56:54 shige Exp $");
     37 
     38 #include <sys/systm.h>
     39 #include <sys/device.h>
     40 
     41 #include <machine/obs200.h>
     42 
     43 #include <powerpc/ibm4xx/dcr405gp.h>
     44 
     45 
     46 /*
     47  * Determine device configuration for a machine.
     48  */
     49 void
     50 cpu_configure(void)
     51 {
     52 
     53 	intr_init();
     54 	calc_delayconst();
     55 
     56 	/* Make sure that timers run at CPU frequency */
     57 	mtdcr(DCR_CPC0_CR1, mfdcr(DCR_CPC0_CR1) & ~CPC0_CR1_CETE);
     58 
     59 	if (config_rootfound("plb", NULL) == NULL)
     60 		panic("configure: mainbus not configured");
     61 
     62 	printf("biomask %x netmask %x ttymask %x\n", (u_short)imask[IPL_BIO],
     63 		(u_short)imask[IPL_NET], (u_short)imask[IPL_TTY]);
     64 
     65 	(void)spl0();
     66 
     67 	/*
     68 	 * Now allow hardware interrupts.
     69 	 */
     70 	__asm volatile ("wrteei 1");
     71 }
     72 
     73 void device_register(struct device *dev, void *aux)
     74 {
     75 
     76 	obs405_device_register(dev, aux, OBS200_COM_FREQ);
     77 }
     78