Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/arch/evbarm/iq80310 We were already cheating w/ CPLD reg...
details: https://anonhg.NetBSD.org/src/rev/2dcd03891660
branches: trunk
changeset: 517102:2dcd03891660
user: thorpej <thorpej%NetBSD.org@localhost>
date: Wed Nov 07 02:24:18 2001 +0000
description:
We were already cheating w/ CPLD register access, so cheat all the
way and use pointer derefs rather than bus_space to access them.
diffstat:
sys/arch/evbarm/iq80310/iq80310_7seg.c | 6 +++---
sys/arch/evbarm/iq80310/iq80310_intr.c | 10 ++++------
sys/arch/evbarm/iq80310/iq80310_timer.c | 28 ++++++++++++----------------
sys/arch/evbarm/iq80310/iq80310reg.h | 9 ++++++++-
sys/arch/evbarm/iq80310/obio.c | 8 ++++----
5 files changed, 31 insertions(+), 30 deletions(-)
diffs (158 lines):
diff -r 9bbfe9d626a3 -r 2dcd03891660 sys/arch/evbarm/iq80310/iq80310_7seg.c
--- a/sys/arch/evbarm/iq80310/iq80310_7seg.c Wed Nov 07 02:06:37 2001 +0000
+++ b/sys/arch/evbarm/iq80310/iq80310_7seg.c Wed Nov 07 02:24:18 2001 +0000
@@ -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 @@
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);
}
diff -r 9bbfe9d626a3 -r 2dcd03891660 sys/arch/evbarm/iq80310/iq80310_intr.c
--- a/sys/arch/evbarm/iq80310/iq80310_intr.c Wed Nov 07 02:06:37 2001 +0000
+++ b/sys/arch/evbarm/iq80310/iq80310_intr.c Wed Nov 07 02:24:18 2001 +0000
@@ -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 @@
{
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 @@
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
diff -r 9bbfe9d626a3 -r 2dcd03891660 sys/arch/evbarm/iq80310/iq80310_timer.c
--- a/sys/arch/evbarm/iq80310/iq80310_timer.c Wed Nov 07 02:06:37 2001 +0000
+++ b/sys/arch/evbarm/iq80310/iq80310_timer.c Wed Nov 07 02:24:18 2001 +0000
@@ -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 @@
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 @@
* 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 @@
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);
}
/*
diff -r 9bbfe9d626a3 -r 2dcd03891660 sys/arch/evbarm/iq80310/iq80310reg.h
--- a/sys/arch/evbarm/iq80310/iq80310reg.h Wed Nov 07 02:06:37 2001 +0000
+++ b/sys/arch/evbarm/iq80310/iq80310reg.h Wed Nov 07 02:24:18 2001 +0000
@@ -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
diff -r 9bbfe9d626a3 -r 2dcd03891660 sys/arch/evbarm/iq80310/obio.c
--- a/sys/arch/evbarm/iq80310/obio.c Wed Nov 07 02:06:37 2001 +0000
+++ b/sys/arch/evbarm/iq80310/obio.c Wed Nov 07 02:24:18 2001 +0000
@@ -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 @@
* 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),
Home |
Main Index |
Thread Index |
Old Index