dbau1500.c revision 1.1
11.1Sgdamore/* $NetBSD: dbau1500.c,v 1.1 2006/02/08 09:04:01 gdamore Exp $ */ 21.1Sgdamore 31.1Sgdamore/*- 41.1Sgdamore * Copyright (c) 2006 Itronix Inc. 51.1Sgdamore * All rights reserved. 61.1Sgdamore * 71.1Sgdamore * Written by Garrett D'Amore for Itronix Inc. 81.1Sgdamore * 91.1Sgdamore * Redistribution and use in source and binary forms, with or without 101.1Sgdamore * modification, are permitted provided that the following conditions 111.1Sgdamore * are met: 121.1Sgdamore * 1. Redistributions of source code must retain the above copyright 131.1Sgdamore * notice, this list of conditions and the following disclaimer. 141.1Sgdamore * 2. Redistributions in binary form must reproduce the above copyright 151.1Sgdamore * notice, this list of conditions and the following disclaimer in the 161.1Sgdamore * documentation and/or other materials provided with the distribution. 171.1Sgdamore * 3. The name of Itronix Inc. may not be used to endorse 181.1Sgdamore * or promote products derived from this software without specific 191.1Sgdamore * prior written permission. 201.1Sgdamore * 211.1Sgdamore * THIS SOFTWARE IS PROVIDED BY ITRONIX INC. ``AS IS'' AND 221.1Sgdamore * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 231.1Sgdamore * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 241.1Sgdamore * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL ITRONIX INC. BE LIABLE FOR ANY 251.1Sgdamore * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 261.1Sgdamore * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 271.1Sgdamore * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 281.1Sgdamore * ON ANY THEORY OF LIABILITY, WHETHER IN 291.1Sgdamore * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 301.1Sgdamore * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 311.1Sgdamore * POSSIBILITY OF SUCH DAMAGE. 321.1Sgdamore */ 331.1Sgdamore 341.1Sgdamore#include <sys/cdefs.h> 351.1Sgdamore__KERNEL_RCSID(0, "$NetBSD: dbau1500.c,v 1.1 2006/02/08 09:04:01 gdamore Exp $"); 361.1Sgdamore 371.1Sgdamore#include <sys/param.h> 381.1Sgdamore#include <machine/bus.h> 391.1Sgdamore#include <machine/locore.h> 401.1Sgdamore#include <evbmips/alchemy/obiovar.h> 411.1Sgdamore#include <evbmips/alchemy/board.h> 421.1Sgdamore#include <evbmips/alchemy/dbau1500reg.h> 431.1Sgdamore 441.1Sgdamorestatic void dbau1500_init(void); 451.1Sgdamorestatic int dbau1500_pci_intr_map(struct pci_attach_args *, 461.1Sgdamore pci_intr_handle_t *); 471.1Sgdamore 481.1Sgdamorestatic const struct obiodev dbau1500_devices[] = { 491.1Sgdamore#if 0 501.1Sgdamore { "aupcmcia", -1, -1 }, 511.1Sgdamore { "auaudio", -1, -1 }, 521.1Sgdamore#endif 531.1Sgdamore { NULL }, 541.1Sgdamore}; 551.1Sgdamore 561.1Sgdamorestatic struct alchemy_board dbau1500_info = { 571.1Sgdamore "AMD Alchemy DBAu1500", 581.1Sgdamore dbau1500_devices, 591.1Sgdamore dbau1500_init, 601.1Sgdamore dbau1500_pci_intr_map, 611.1Sgdamore}; 621.1Sgdamore 631.1Sgdamoreconst struct alchemy_board * 641.1Sgdamoreboard_info(void) 651.1Sgdamore{ 661.1Sgdamore 671.1Sgdamore return &dbau1500_info; 681.1Sgdamore} 691.1Sgdamore 701.1Sgdamorevoid 711.1Sgdamoredbau1500_init(void) 721.1Sgdamore{ 731.1Sgdamore uint32_t whoami; 741.1Sgdamore 751.1Sgdamore if (MIPS_PRID_COPTS(cpu_id) != MIPS_AU1500) 761.1Sgdamore panic("dbau1500: CPU not an AU1500!"); 771.1Sgdamore 781.1Sgdamore /* check the whoami register for a match */ 791.1Sgdamore whoami = *((volatile uint32_t *)DBAU1500_WHOAMI); 801.1Sgdamore 811.1Sgdamore if (DBAU1500_WHOAMI_BOARD(whoami) != DBAU1500_WHOAMI_DBAU1500) 821.1Sgdamore panic("dbau1500: WHOAMI (%x) not DBAu1500!", whoami); 831.1Sgdamore 841.1Sgdamore printf("DBAu1500 (zinfandel), CPLDv%d, ", 851.1Sgdamore DBAU1500_WHOAMI_CPLD(whoami)); 861.1Sgdamore 871.1Sgdamore if (DBAU1500_WHOAMI_DAUGHTER(whoami) != 0xf) 881.1Sgdamore printf("daughtercard 0x%x\n", 891.1Sgdamore DBAU1500_WHOAMI_DAUGHTER(whoami)); 901.1Sgdamore else 911.1Sgdamore printf("no daughtercard\n"); 921.1Sgdamore 931.1Sgdamore /* leave console and clocks alone -- YAMON should have got it right! */ 941.1Sgdamore 951.1Sgdamore} 961.1Sgdamore 971.1Sgdamoreint 981.1Sgdamoredbau1500_pci_intr_map(struct pci_attach_args *pa, pci_intr_handle_t *ihp) 991.1Sgdamore{ 1001.1Sgdamore /* 1011.1Sgdamore * This platform has PCI slot and IDE interrupts mapped 1021.1Sgdamore * identically. So we just need to look at which of the four 1031.1Sgdamore * PCI interrupts it is. 1041.1Sgdamore */ 1051.1Sgdamore 1061.1Sgdamore switch (pa->pa_intrpin) { 1071.1Sgdamore case 0: 1081.1Sgdamore /* not used */ 1091.1Sgdamore return 1; 1101.1Sgdamore case 1: 1111.1Sgdamore *ihp = 1; 1121.1Sgdamore break; 1131.1Sgdamore case 2: 1141.1Sgdamore *ihp = 2; 1151.1Sgdamore break; 1161.1Sgdamore case 3: 1171.1Sgdamore *ihp = 4; 1181.1Sgdamore break; 1191.1Sgdamore case 4: 1201.1Sgdamore *ihp = 5; 1211.1Sgdamore break; 1221.1Sgdamore default: 1231.1Sgdamore printf("pci: bad interrupt pin %d\n", pa->pa_intrpin); 1241.1Sgdamore return 1; 1251.1Sgdamore } 1261.1Sgdamore return 0; 1271.1Sgdamore} 128