We were already cheating w/ CPLD register access, so cheat all the

way and use pointer derefs rather than bus_space to access them.
This commit is contained in:
thorpej 2001-11-07 02:24:18 +00:00
parent 4a2c5fd66d
commit 0ea59754f1
5 changed files with 31 additions and 30 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: iq80310_7seg.c,v 1.1 2001/11/07 00:33:23 thorpej Exp $ */
/* $NetBSD: iq80310_7seg.c,v 1.2 2001/11/07 02:24:18 thorpej Exp $ */
/*
* Copyright (c) 2001 Wasabi Systems, Inc.
@ -187,6 +187,6 @@ iq80310_7seg(char a, char b)
else
lsb = asciimap[b - ASCIIMAP_START] | SEG_DP;
bus_space_write_1(&obio_bs_tag, IQ80310_7SEG_MSB, 0, msb);
bus_space_write_1(&obio_bs_tag, IQ80310_7SEG_LSB, 0, lsb);
CPLD_WRITE(IQ80310_7SEG_MSB, msb);
CPLD_WRITE(IQ80310_7SEG_LSB, lsb);
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: iq80310_intr.c,v 1.2 2001/11/07 02:06:37 thorpej Exp $ */
/* $NetBSD: iq80310_intr.c,v 1.3 2001/11/07 02:24:18 thorpej Exp $ */
/*
* Copyright (c) 2001 Wasabi Systems, Inc.
@ -115,11 +115,9 @@ iq80310_intstat_read(void)
{
uint32_t intstat;
intstat = bus_space_read_1(&obio_bs_tag, IQ80310_XINT3_STATUS,
0) & 0x1f;
intstat = CPLD_READ(IQ80310_XINT3_STATUS) & 0x1f;
if (1/*rev F or later board*/)
intstat |= (bus_space_read_1(&obio_bs_tag,
IQ80310_XINT0_STATUS, 0) & 0x7) << 5;
intstat |= (CPLD_READ(IQ80310_XINT0_STATUS) & 0x7) << 5;
return (intstat);
}
@ -141,7 +139,7 @@ irq_setmasks_nointr(void)
if (disabled >> 5)
disabled |= XINT3_SINTD;
bus_space_write_1(&obio_bs_tag, IQ80310_XINT_MASK, 0, disabled & 0x1f);
CPLD_WRITE(IQ80310_XINT_MASK, disabled & 0x1f);
}
void

View File

@ -1,4 +1,4 @@
/* $NetBSD: iq80310_timer.c,v 1.1 2001/11/07 00:33:24 thorpej Exp $ */
/* $NetBSD: iq80310_timer.c,v 1.2 2001/11/07 02:24:18 thorpej Exp $ */
/*
* Copyright (c) 2001 Wasabi Systems, Inc.
@ -71,16 +71,16 @@ static __inline void
timer_enable(uint8_t bit)
{
bus_space_write_1(&obio_bs_tag, IQ80310_TIMER_ENABLE, 0,
bus_space_read_1(&obio_bs_tag, IQ80310_TIMER_ENABLE, 0) | bit);
CPLD_WRITE(IQ80310_TIMER_ENABLE,
CPLD_READ(IQ80310_TIMER_ENABLE) | bit);
}
static __inline void
timer_disable(uint8_t bit)
{
bus_space_write_1(&obio_bs_tag, IQ80310_TIMER_ENABLE, 0,
bus_space_read_1(&obio_bs_tag, IQ80310_TIMER_ENABLE, 0) & ~bit);
CPLD_WRITE(IQ80310_TIMER_ENABLE,
CPLD_READ(IQ80310_TIMER_ENABLE) & ~bit);
}
static __inline uint32_t
@ -95,12 +95,11 @@ timer_read(void)
* latched. The loop appears to work around the problem.
*/
do {
la[0] =
bus_space_read_1(&obio_bs_tag, IQ80310_TIMER_LA0, 0) & 0x5f;
la[0] = CPLD_READ(IQ80310_TIMER_LA0) & 0x5f;
} while (la[0] == 0);
la[1] = bus_space_read_1(&obio_bs_tag, IQ80310_TIMER_LA1, 0) & 0x5f;
la[2] = bus_space_read_1(&obio_bs_tag, IQ80310_TIMER_LA2, 0) & 0x5f;
la[3] = bus_space_read_1(&obio_bs_tag, IQ80310_TIMER_LA3, 0) & 0x0f;
la[1] = CPLD_READ(IQ80310_TIMER_LA1) & 0x5f;
la[2] = CPLD_READ(IQ80310_TIMER_LA2) & 0x5f;
la[3] = CPLD_READ(IQ80310_TIMER_LA3) & 0x0f;
#define SWIZZLE(x) \
x = (((x) & 0x40) >> 1) | ((x) | 0x1f)
@ -118,12 +117,9 @@ static __inline void
timer_write(uint32_t x)
{
bus_space_write_1(&obio_bs_tag, IQ80310_TIMER_LA0, 0,
x & 0xff);
bus_space_write_1(&obio_bs_tag, IQ80310_TIMER_LA1, 0,
(x >> 8) & 0xff);
bus_space_write_1(&obio_bs_tag, IQ80310_TIMER_LA2, 0,
(x >> 16) & 0x3f);
CPLD_WRITE(IQ80310_TIMER_LA0, x & 0xff);
CPLD_WRITE(IQ80310_TIMER_LA1, (x >> 8) & 0xff);
CPLD_WRITE(IQ80310_TIMER_LA2, (x >> 16) & 0x3f);
}
/*

View File

@ -1,4 +1,4 @@
/* $NetBSD: iq80310reg.h,v 1.1 2001/11/07 00:33:24 thorpej Exp $ */
/* $NetBSD: iq80310reg.h,v 1.2 2001/11/07 02:24:18 thorpej Exp $ */
/*
* Copyright (c) 2001 Wasabi Systems, Inc.
@ -72,6 +72,13 @@
* 0000 0000 ------------------------------
*/
/*
* We map the CPLD registers VA==PA, so we go ahead and cheat
* with register access.
*/
#define CPLD_READ(x) *((__volatile uint8_t *)(x))
#define CPLD_WRITE(x, v) *((__volatile uint8_t *)(x)) = (v)
#define IQ80310_OBIO_BASE 0xfe800000UL
#define IQ80310_OBIO_SIZE 0x00100000UL

View File

@ -1,4 +1,4 @@
/* $NetBSD: obio.c,v 1.1 2001/11/07 00:33:25 thorpej Exp $ */
/* $NetBSD: obio.c,v 1.2 2001/11/07 02:24:18 thorpej Exp $ */
/*
* Copyright (c) 2001 Wasabi Systems, Inc.
@ -114,9 +114,9 @@ obio_attach(struct device *parent, struct device *self, void *aux)
* Yes, we're using knowledge of the obio bus space internals,
* here.
*/
board_rev = bus_space_read_1(&obio_bs_tag, IQ80310_BOARD_REV, 0);
cpld_rev = bus_space_read_1(&obio_bs_tag, IQ80310_CPLD_REV, 0);
backplane = bus_space_read_1(&obio_bs_tag, IQ80310_BACKPLANE_DET, 0);
board_rev = CPLD_READ(IQ80310_BOARD_REV);
cpld_rev = CPLD_READ(IQ80310_CPLD_REV);
backplane = CPLD_READ(IQ80310_BACKPLANE_DET);
printf(": board rev. %c, CPLD rev. %c, backplane %spresent\n",
BOARD_REV(board_rev), CPLD_REV(cpld_rev),