use access functions to mess with obio's registers

This commit is contained in:
macallan 2008-09-26 03:38:25 +00:00
parent e3856204b9
commit b8ae2bc305
2 changed files with 17 additions and 16 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: if_bm.c,v 1.36 2008/01/19 22:10:15 dyoung Exp $ */
/* $NetBSD: if_bm.c,v 1.37 2008/09/26 03:39:23 macallan Exp $ */
/*-
* Copyright (C) 1998, 1999, 2000 Tsubai Masanari. All rights reserved.
@ -27,7 +27,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: if_bm.c,v 1.36 2008/01/19 22:10:15 dyoung Exp $");
__KERNEL_RCSID(0, "$NetBSD: if_bm.c,v 1.37 2008/09/26 03:39:23 macallan Exp $");
#include "opt_inet.h"
#include "bpfilter.h"
@ -71,6 +71,7 @@ __KERNEL_RCSID(0, "$NetBSD: if_bm.c,v 1.36 2008/01/19 22:10:15 dyoung Exp $");
#include <macppc/dev/dbdma.h>
#include <macppc/dev/if_bmreg.h>
#include <macppc/dev/obiovar.h>
#define BMAC_TXBUFS 2
#define BMAC_RXBUFS 16
@ -98,8 +99,6 @@ struct bmac_softc {
#define BMAC_BMACPLUS 0x01
#define BMAC_DEBUGFLAG 0x02
extern volatile uint32_t *heathrow_FCR;
int bmac_match(struct device *, struct cfdata *, void *);
void bmac_attach(struct device *, struct device *, void *);
void bmac_reset_chip(struct bmac_softc *);
@ -276,21 +275,21 @@ bmac_reset_chip(sc)
dbdma_reset(sc->sc_txdma);
dbdma_reset(sc->sc_rxdma);
v = in32rb(heathrow_FCR);
v = obio_read_4(HEATHROW_FCR);
v |= EnetEnable;
out32rb(heathrow_FCR, v);
obio_write_4(HEATHROW_FCR, v);
delay(50000);
v |= ResetEnetCell;
out32rb(heathrow_FCR, v);
obio_write_4(HEATHROW_FCR, v);
delay(50000);
v &= ~ResetEnetCell;
out32rb(heathrow_FCR, v);
obio_write_4(HEATHROW_FCR, v);
delay(50000);
out32rb(heathrow_FCR, v);
obio_write_4(HEATHROW_FCR, v);
}
void

View File

@ -1,4 +1,4 @@
/* $NetBSD: snapper.c,v 1.29 2008/09/26 03:20:30 macallan Exp $ */
/* $NetBSD: snapper.c,v 1.30 2008/09/26 03:38:25 macallan Exp $ */
/* Id: snapper.c,v 1.11 2002/10/31 17:42:13 tsubai Exp */
/* Id: i2s.c,v 1.12 2005/01/15 14:32:35 tsubai Exp */
@ -35,7 +35,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: snapper.c,v 1.29 2008/09/26 03:20:30 macallan Exp $");
__KERNEL_RCSID(0, "$NetBSD: snapper.c,v 1.30 2008/09/26 03:38:25 macallan Exp $");
#include <sys/param.h>
#include <sys/audioio.h>
@ -56,6 +56,7 @@ __KERNEL_RCSID(0, "$NetBSD: snapper.c,v 1.29 2008/09/26 03:20:30 macallan Exp $"
#include <machine/pio.h>
#include <macppc/dev/deqvar.h>
#include <macppc/dev/obiovar.h>
#ifdef SNAPPER_DEBUG
# define DPRINTF printf
@ -1745,9 +1746,9 @@ snapper_set_rate(struct snapper_softc *sc)
/* Clear CLKSTOPPEND. */
bus_space_write_4(sc->sc_tag, sc->sc_bsh, I2S_INT, I2S_INT_CLKSTOPPEND);
x = in32rb(sc->sc_baseaddr + KEYLARGO_FCR1); /* FCR */
x = obio_read_4(KEYLARGO_FCR1); /* FCR */
x &= ~I2S0CLKEN; /* XXX I2S0 */
out32rb(sc->sc_baseaddr + KEYLARGO_FCR1, x);
obio_write_4(KEYLARGO_FCR1, x);
/* Wait until clock is stopped. */
for (timo = 1000; timo > 0; timo--) {
@ -1760,9 +1761,9 @@ snapper_set_rate(struct snapper_softc *sc)
done:
bus_space_write_4(sc->sc_tag, sc->sc_bsh, I2S_FORMAT, reg);
x = in32rb(sc->sc_baseaddr + KEYLARGO_FCR1);
x = obio_read_4(KEYLARGO_FCR1);
x |= I2S0CLKEN;
out32rb(sc->sc_baseaddr + KEYLARGO_FCR1, x);
obio_write_4(KEYLARGO_FCR1, x);
return 0;
}
@ -2021,7 +2022,8 @@ snapper_init(struct snapper_softc *sc, int node)
#ifdef SNAPPER_DEBUG
char fcr[32];
bitmask_snprintf(in32rb(sc->sc_baseaddr + KEYLARGO_FCR1), FCR3C_BITMASK, fcr, sizeof fcr);
bitmask_snprintf(obio_read_4(KEYLARGO_FCR1), FCR3C_BITMASK,
fcr, sizeof fcr);
printf("FCR(0x3c) 0x%s\n", fcr);
#endif
headphone_detect_intr = -1;