1 /* $NetBSD: p_nec_j96a.c,v 1.2 2002/12/07 13:09:46 tsutsui Exp $ */ 2 3 /*- 4 * Copyright (C) 2002 Izumi Tsutsui. All rights reserved. 5 * 6 * Redistribution and use in source and binary forms, with or without 7 * modification, are permitted provided that the following conditions 8 * are met: 9 * 1. Redistributions of source code must retain the above copyright 10 * notice, this list of conditions and the following disclaimer. 11 * 2. Redistributions in binary form must reproduce the above copyright 12 * notice, this list of conditions and the following disclaimer in the 13 * documentation and/or other materials provided with the distribution. 14 * 3. The name of the author may not be used to endorse or promote products 15 * derived from this software without specific prior written permission. 16 * 17 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 18 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 19 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 20 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 21 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 22 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 23 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 24 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 26 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27 */ 28 29 #include <sys/param.h> 30 #include <sys/systm.h> 31 #include <sys/device.h> 32 33 #include <machine/autoconf.h> 34 #include <machine/pio.h> 35 #include <machine/platform.h> 36 37 #include <arc/jazz/rd94.h> 38 #include <arc/jazz/jazziovar.h> 39 #include <arc/dev/mcclockvar.h> 40 #include <arc/jazz/mcclock_jazziovar.h> 41 42 u_int mc_nec_j96a_read __P((struct mcclock_softc *, u_int)); 43 void mc_nec_j96a_write __P((struct mcclock_softc *, u_int, u_int)); 44 45 void p_nec_j96a_init __P((void)); 46 47 struct platform platform_nec_j96a = { 48 "NEC-J96A", 49 "NEC W&S", 50 " R4400 EISA", 51 "Express5800/240", 52 "NEC", 53 200, /* MHz */ 54 c_jazz_eisa_mainbusdevs, 55 platform_generic_match, 56 p_nec_j96a_init, 57 c_jazz_eisa_cons_init, 58 jazzio_reset, 59 c_nec_jazz_set_intr, 60 }; 61 62 static struct mcclock_jazzio_config mcclock_nec_j96a_conf = { 63 0x80004000, 1, 64 { mc_nec_j96a_read, mc_nec_j96a_write } 65 }; 66 67 u_int 68 mc_nec_j96a_read(sc, reg) 69 struct mcclock_softc *sc; 70 u_int reg; 71 { 72 int i, as; 73 74 as = in32(RD94_SYS_EISA_AS) & 0x80; 75 out32(RD94_SYS_EISA_AS, as | reg); 76 i = bus_space_read_1(sc->sc_iot, sc->sc_ioh, 0); 77 return i; 78 } 79 80 void 81 mc_nec_j96a_write(sc, reg, datum) 82 struct mcclock_softc *sc; 83 u_int reg, datum; 84 { 85 int as; 86 87 as = in32(RD94_SYS_EISA_AS) & 0x80; 88 out32(RD94_SYS_EISA_AS, as | reg); 89 bus_space_write_1(sc->sc_iot, sc->sc_ioh, 0, datum); 90 } 91 92 void 93 p_nec_j96a_init() 94 { 95 96 c_nec_eisa_init(); 97 98 mcclock_jazzio_conf = &mcclock_nec_j96a_conf; 99 } 100