summaryrefslogtreecommitdiff
path: root/sys/dev/isa
diff options
context:
space:
mode:
authorjdolecek <jdolecek@NetBSD.org>2001-03-31 00:26:53 +0000
committerjdolecek <jdolecek@NetBSD.org>2001-03-31 00:26:53 +0000
commit592dfdc76b6eb3f6c2def35728af6a3d274d63f4 (patch)
tree96a45fefc0f227ac2e0cb33d737b61c352e58b96 /sys/dev/isa
parentd04f4ebff1297850af69ab4e0c875636815f6a5f (diff)
Prepare for MCA attachment:
* split off sharable stuff to dev/ic/ate_subr.[ch], move ate(4) device definition to conf/files * cosmetic: attach with ate_isa
Diffstat (limited to 'sys/dev/isa')
-rw-r--r--sys/dev/isa/files.isa6
-rw-r--r--sys/dev/isa/if_ate.c109
2 files changed, 7 insertions, 108 deletions
diff --git a/sys/dev/isa/files.isa b/sys/dev/isa/files.isa
index d800a48f32a..2dace721012 100644
--- a/sys/dev/isa/files.isa
+++ b/sys/dev/isa/files.isa
@@ -1,4 +1,4 @@
-# $NetBSD: files.isa,v 1.112 2001/03/23 19:41:34 jdolecek Exp $
+# $NetBSD: files.isa,v 1.113 2001/03/31 00:26:54 jdolecek Exp $
#
# Config file and device description for machine-independent ISA code.
# Included by ports that need it. Requires that the SCSI files be
@@ -197,8 +197,8 @@ file dev/isa/if_ntwoc_isa.c ntwoc_isa
# Allied Telesis MB8695-based boards
# (Allied Telesis AT1700)
-device ate: arp, ether, ifnet, mb86960
-attach ate at isa
+# device in sys/conf/files
+attach ate at isa with ate_isa
file dev/isa/if_ate.c ate
# Crystal Semiconductor CS8900, CS8920, and CS8920M Ethernet
diff --git a/sys/dev/isa/if_ate.c b/sys/dev/isa/if_ate.c
index ed75cdde6c1..34392c4246f 100644
--- a/sys/dev/isa/if_ate.c
+++ b/sys/dev/isa/if_ate.c
@@ -1,4 +1,4 @@
-/* $NetBSD: if_ate.c,v 1.24 2000/05/29 17:37:17 jhawk Exp $ */
+/* $NetBSD: if_ate.c,v 1.25 2001/03/31 00:26:54 jdolecek Exp $ */
/*
* All Rights Reserved, Copyright (C) Fujitsu Limited 1995
@@ -46,6 +46,7 @@
#include <dev/ic/mb86960reg.h>
#include <dev/ic/mb86960var.h>
+#include <dev/ic/ate_subr.h>
#include <dev/isa/isavar.h>
#include <dev/isa/if_fereg.h> /* XXX */
@@ -60,12 +61,12 @@ struct ate_softc {
void *sc_ih; /* interrupt cookie */
};
-struct cfattach ate_ca = {
+struct cfattach ate_isa_ca = {
sizeof(struct ate_softc), ate_match, ate_attach
};
#if NetBSD <= 199712
-struct cfdriver ate_cd = {
+struct cfdriver ate_isa_cd = {
NULL, "ate", DV_IFNET
};
#endif
@@ -78,9 +79,6 @@ struct fe_simple_probe_struct {
static __inline__ int fe_simple_probe __P((bus_space_tag_t,
bus_space_handle_t, struct fe_simple_probe_struct const *));
-static __inline__ void ate_strobe __P((bus_space_tag_t, bus_space_handle_t));
-static void ate_read_eeprom __P((bus_space_tag_t, bus_space_handle_t,
- u_char *));
static int ate_find __P((bus_space_tag_t, bus_space_handle_t, int *,
int *));
static int ate_detect __P((bus_space_tag_t, bus_space_handle_t,
@@ -205,105 +203,6 @@ fe_simple_probe (iot, ioh, sp)
}
/*
- * Routines to read all bytes from the config EEPROM through MB86965A.
- * I'm not sure what exactly I'm doing here... I was told just to follow
- * the steps, and it worked. Could someone tell me why the following
- * code works? (Or, why all similar codes I tried previously doesn't
- * work.) FIXME.
- */
-
-static __inline__ void
-ate_strobe (iot, ioh)
- bus_space_tag_t iot;
- bus_space_handle_t ioh;
-{
-
- /*
- * Output same value twice. To speed-down execution?
- */
- bus_space_write_1(iot, ioh, FE_BMPR16, FE_B16_SELECT);
- bus_space_write_1(iot, ioh, FE_BMPR16, FE_B16_SELECT);
- bus_space_write_1(iot, ioh, FE_BMPR16, FE_B16_SELECT | FE_B16_CLOCK);
- bus_space_write_1(iot, ioh, FE_BMPR16, FE_B16_SELECT | FE_B16_CLOCK);
- bus_space_write_1(iot, ioh, FE_BMPR16, FE_B16_SELECT);
- bus_space_write_1(iot, ioh, FE_BMPR16, FE_B16_SELECT);
-}
-
-static void
-ate_read_eeprom(iot, ioh, data)
- bus_space_tag_t iot;
- bus_space_handle_t ioh;
- u_char *data;
-{
- int n, count;
- u_char val, bit;
-
- /* Read bytes from EEPROM; two bytes per an iterration. */
- for (n = 0; n < FE_EEPROM_SIZE / 2; n++) {
- /* Reset the EEPROM interface. */
- bus_space_write_1(iot, ioh, FE_BMPR16, 0x00);
- bus_space_write_1(iot, ioh, FE_BMPR17, 0x00);
- bus_space_write_1(iot, ioh, FE_BMPR16, FE_B16_SELECT);
-
- /* Start EEPROM access. */
- bus_space_write_1(iot, ioh, FE_BMPR17, FE_B17_DATA);
- ate_strobe(iot, ioh);
-
- /* Pass the iterration count to the chip. */
- count = 0x80 | n;
- for (bit = 0x80; bit != 0x00; bit >>= 1) {
- bus_space_write_1(iot, ioh, FE_BMPR17,
- (count & bit) ? FE_B17_DATA : 0);
- ate_strobe(iot, ioh);
- }
- bus_space_write_1(iot, ioh, FE_BMPR17, 0x00);
-
- /* Read a byte. */
- val = 0;
- for (bit = 0x80; bit != 0x00; bit >>= 1) {
- ate_strobe(iot, ioh);
- if (bus_space_read_1(iot, ioh, FE_BMPR17) &
- FE_B17_DATA)
- val |= bit;
- }
- *data++ = val;
-
- /* Read one more byte. */
- val = 0;
- for (bit = 0x80; bit != 0x00; bit >>= 1) {
- ate_strobe(iot, ioh);
- if (bus_space_read_1(iot, ioh, FE_BMPR17) &
- FE_B17_DATA)
- val |= bit;
- }
- *data++ = val;
- }
-
- /* Make sure the EEPROM is turned off. */
- bus_space_write_1(iot, ioh, FE_BMPR16, 0);
- bus_space_write_1(iot, ioh, FE_BMPR17, 0);
-
-#if ATE_DEBUG >= 3
- /* Report what we got. */
- data -= FE_EEPROM_SIZE;
- log(LOG_INFO, "ate_read_eeprom: EEPROM at %04x:"
- " %02x%02x%02x%02x %02x%02x%02x%02x -"
- " %02x%02x%02x%02x %02x%02x%02x%02x -"
- " %02x%02x%02x%02x %02x%02x%02x%02x -"
- " %02x%02x%02x%02x %02x%02x%02x%02x\n",
- (int) ioh, /* XXX */
- data[ 0], data[ 1], data[ 2], data[ 3],
- data[ 4], data[ 5], data[ 6], data[ 7],
- data[ 8], data[ 9], data[10], data[11],
- data[12], data[13], data[14], data[15],
- data[16], data[17], data[18], data[19],
- data[20], data[21], data[22], data[23],
- data[24], data[25], data[26], data[27],
- data[28], data[29], data[30], data[31]);
-#endif
-}
-
-/*
* Hardware (vendor) specific probe routines.
*/