obs266_autoconf.c revision 1.3
11.3Sshige/* $NetBSD: obs266_autoconf.c,v 1.3 2006/05/15 15:56:54 shige Exp $ */ 21.1Sshige 31.1Sshige/* 41.1Sshige * Copyright 2004 Shigeyuki Fukushima. 51.1Sshige * All rights reserved. 61.1Sshige * 71.1Sshige * Written by Shigeyuki Fukushima for The NetBSD Project. 81.1Sshige * 91.1Sshige * Redistribution and use in source and binary forms, with or without 101.1Sshige * modification, are permitted provided that the following conditions 111.1Sshige * are met: 121.1Sshige * 1. Redistributions of source code must retain the above copyright 131.1Sshige * notice, this list of conditions and the following disclaimer. 141.1Sshige * 2. Redistributions in binary form must reproduce the above 151.1Sshige * copyright notice, this list of conditions and the following 161.1Sshige * disclaimer in the documentation and/or other materials provided 171.1Sshige * with the distribution. 181.1Sshige * 3. The name of the author may not be used to endorse or promote 191.1Sshige * products derived from this software without specific prior 201.1Sshige * written permission. 211.1Sshige * 221.1Sshige * THIS SOFTWARE IS PROVIDED THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 231.1Sshige * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 241.1Sshige * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 251.1Sshige * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE 261.1Sshige * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 271.1Sshige * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT 281.1Sshige * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; 291.1Sshige * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 301.1Sshige * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 311.1Sshige * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE 321.1Sshige * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH 331.1Sshige * DAMAGE. 341.1Sshige */ 351.1Sshige#include <sys/cdefs.h> 361.3Sshige__KERNEL_RCSID(0, "$NetBSD: obs266_autoconf.c,v 1.3 2006/05/15 15:56:54 shige Exp $"); 371.1Sshige 381.1Sshige#include <sys/systm.h> 391.1Sshige#include <sys/device.h> 401.1Sshige 411.1Sshige#include <machine/obs266.h> 421.1Sshige 431.3Sshige#include <powerpc/ibm4xx/dcr405gp.h> 441.3Sshige 451.3Sshige 461.3Sshige/* 471.3Sshige * Determine device configuration for a machine. 481.3Sshige */ 491.3Sshigevoid 501.3Sshigecpu_configure(void) 511.3Sshige{ 521.3Sshige 531.3Sshige intr_init(); 541.3Sshige calc_delayconst(); 551.3Sshige 561.3Sshige /* Make sure that timers run at CPU frequency */ 571.3Sshige mtdcr(DCR_CPC0_CR1, mfdcr(DCR_CPC0_CR1) & ~CPC0_CR1_CETE); 581.3Sshige 591.3Sshige if (config_rootfound("plb", NULL) == NULL) 601.3Sshige panic("configure: mainbus not configured"); 611.3Sshige 621.3Sshige printf("biomask %x netmask %x ttymask %x\n", (u_short)imask[IPL_BIO], 631.3Sshige (u_short)imask[IPL_NET], (u_short)imask[IPL_TTY]); 641.3Sshige 651.3Sshige (void)spl0(); 661.3Sshige 671.3Sshige /* 681.3Sshige * Now allow hardware interrupts. 691.3Sshige */ 701.3Sshige __asm volatile ("wrteei 1"); 711.3Sshige} 721.3Sshige 731.1Sshigevoid device_register(struct device *dev, void *aux) 741.1Sshige{ 751.1Sshige 761.1Sshige obs405_device_register(dev, aux, OBS266_COM_FREQ); 771.1Sshige} 78