Date: Sat, 06 May 2000 22:17:15 +0100 (BST) From: Duncan Barclay <dmlb@ragnet.demon.co.uk> To: Warner Losh <imp@village.org>, freebsd-mobile@freebsd.org Subject: Xircom Realport in -current Message-ID: <XFMail.000506221715.dmlb@computer.my.domain>
index | next in thread | raw e-mail
[-- Attachment #1 --]
Hi Warner,
I'm trying to get my Realport working with if_xe.c. I've got the cem56fix
re-written (it was actually easy) and the driver dances around abit trying to
find a phy but doesn't actually get one.
I think that the problem is in the IO space allocation in xe_activate. In
cem56fix the IO address is written to a register on the card
old:
xe_memwrite( scp->dev, DINGO_EBAR0, ioport & 0xff );
xe_memwrite( scp->dev, DINGO_EBAR1, (ioport >> 8) & 0xff );
my re-write:
bus_space_write_1(bst, bsh, DINGO_EBAR0, ioport & 0xff);
bus_space_write_1(bst, bsh, DINGO_EBAR1, (ioport >> 8) & 0xff);
However, EBAR0 always has bits 3:0 set to 0. I need a 16bit aligned io port
from xe_activate. How do I do it?
Thanks
Duncan
---
________________________________________________________________________
Duncan Barclay | God smiles upon the little children,
dmlb@ragnet.demon.co.uk | the alcoholics, and the permanently stoned.
________________________________________________________________________
[-- Attachment #2 --]
Index: if_xe.c
===================================================================
RCS file: /steer/ncvs/src/sys/dev/xe/if_xe.c,v
retrieving revision 1.18
diff -u -r1.18 if_xe.c
--- if_xe.c 2000/05/01 04:41:04 1.18
+++ if_xe.c 2000/05/06 21:15:43
@@ -205,6 +205,7 @@
/*
* Debug functions
*/
+#define XE_DEBUG 2
#ifdef XE_DEBUG
#define XE_REG_DUMP(scp) xe_reg_dump((scp))
#define XE_MII_DUMP(scp) xe_mii_dump((scp))
@@ -234,7 +235,7 @@
* Hacking for RealPort cards
*/
static int
-xe_cem56fix(struct xe_softc *scp)
+xe_cem56fix(device_t dev)
{
#if XXX /* Need to revisit */
int ioport, fail;
@@ -299,7 +300,54 @@
/* success! */
return 0;
#else
- return -1;
+ struct xe_softc *sc = (struct xe_softc *) device_get_softc(dev);
+ bus_space_tag_t bst;
+ bus_space_handle_t bsh;
+ struct resource *r;
+ int rid;
+ int ioport;
+
+#ifdef XE_DEBUG
+ device_printf(dev, "Hacking your Realport, master\n");
+#endif
+
+ ioport = bus_get_resource_start(dev, SYS_RES_IOPORT, sc->port_rid);
+#ifdef XE_DEBUG
+ device_printf(dev, "ioport 0x%0x, length 0x%0lx\n", ioport, bus_get_resource_
count(dev, SYS_RES_IOPORT, sc->port_rid));
+#endif
+
+ rid = 0;
+ r = bus_alloc_resource(dev, SYS_RES_MEMORY, &rid, 0, ~0, 4 << 10, RF_ACTIVE);
+ if (!r) {
+#ifdef XE_DEBUG
+ device_printf(dev, "Can't map in attribute memory\n");
+#endif
+ return -1;
+ }
+
+ bsh = rman_get_bushandle(r);
+ bst = rman_get_bustag(r);
+
+ CARD_SET_RES_FLAGS(device_get_parent(dev), dev, SYS_RES_MEMORY, rid,
+ PCCARD_A_MEM_ATTR);
+
+ bus_space_write_1(bst, bsh, DINGO_ECOR, DINGO_ECOR_IRQ_LEVEL |
+ DINGO_ECOR_INT_ENABLE |
+ DINGO_ECOR_IOB_ENABLE |
+ DINGO_ECOR_ETH_ENABLE);
+ bus_space_write_1(bst, bsh, DINGO_EBAR0, ioport & 0xff);
+ bus_space_write_1(bst, bsh, DINGO_EBAR1, (ioport >> 8) & 0xff);
+
+ bus_space_write_1(bst, bsh, DINGO_DCOR0, DINGO_DCOR0_SF_INT);
+ bus_space_write_1(bst, bsh, DINGO_DCOR1, DINGO_DCOR1_INT_LEVEL |
+ DINGO_DCOR1_EEDIO);
+ bus_space_write_1(bst, bsh, DINGO_DCOR2, 0x00);
+ bus_space_write_1(bst, bsh, DINGO_DCOR3, 0x00);
+ bus_space_write_1(bst, bsh, DINGO_DCOR4, 0x00);
+
+ bus_release_resource(dev, SYS_RES_MEMORY, rid, r);
+
+ return 0;
#endif /* XXX */
}
@@ -532,7 +580,7 @@
scp->autoneg_status = 0;
/* Hack RealPorts into submission */
- if (scp->dingo && xe_cem56fix(scp) < 0) {
+ if (scp->dingo && xe_cem56fix(dev) < 0) {
device_printf(dev, "Unable to fix your RealPort\n");
xe_deactivate(dev);
return ENODEV;
help
Want to link to this message? Use this
URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?XFMail.000506221715.dmlb>
