Subject: Re: LAN adapter driver
To: None <port-dreamcast@netbsd.org>
From: Christian Groessler <cpg@aladdin.de>
List: port-dreamcast
Date: 06/11/2002 23:51:26
Marcus wrote:
> Christian Groessler <cpg@aladdin.de> writes:
>
> > > implementation. Also, you should check if the LAN adapter doesn't use
> > > the same PCI bridge chip (the GAPSPCI) as the BBA, in that case you
> >
> > How can I do this? Can I detect GAPSPCI's presence?
>
> The gapspci driver will autodetect it if connected to the G2 bus. You
> should see it in your dmesg. (Of course, it could be a different
> version of the glue chip that does not match the autodetection.)
I think there's no GAPSPCI. (Please see the appended boot messages of
the same kernel binary, one with the bba and the other one with the
lan adapter).
>
> >
> > > can use that driver too, and use an existing PCI driver for the
> > > ethernet chip.
> >
> > I haven't found an existing NetBSD PCI driver using this chip
> > (mb86960.c).
>
> Hm. You are right. There are only PCMCIA drivers for it. I wonder
> if that means that the LAN adapter has a PCMCIA bridge chip instead?
> You wouldn't mind opening it up to check what interface logic it
> uses?
I'm reluctant to open it at this time. I intend to sell it once the
driver is finished. (I only bought it by mistake, I wanted a bba.)
> Anyway, the correct driver layering is the following:
>
> chip specific driver = mb86960.c
> interface specific driver = if_mbe_pcmcia.c / something else
> depending on actual interface
> glue chip driver = gapspci.c / something else depending on
> actual glue chip used
> peripheral bus driver = g2bus.c
> CPU bus driver = shb.c
>
> All layers should be present. In particular, it is not allowed to
> bypass the g2bus.c driver for devices connected via the G2 bus.
Here is an excerpt from kos library's
kernel/arch/dreamcast/hardware/network/lan_adapter.c:
---------- snippet -----------
The DC Lan Adapter is an 8-bit G2 peripheral with the following block
diagram:
G2 <---> Altera PLD <---> MB86967 Ethernet <---> TDK "Pulse Transformer"
^ ^
| |
v v
M5M5278DVP RAM 10BT ethernet
Its IO base is located at 0xa060xxxx, like the modem, and the register
interface seems very similar (I suspect they actually use the exact same
PLD in both, to save money).
As for the Fujitsu ethernet chip, the latest updated driver in BSD was
for FreeBSD 2.x (!!) and was for PCMCIA, so a bit of interpolation was
required. Fortunately the Fujitsu chip is _much_ simpler and easier to
work with than the later RTL chip, but unfortunately, that simplicity
comes at a cost. Each packet to be send or received must be processed
over a PIO interface one byte at a time. This is probably why Sega dumped
it for the RTL design later on, because you can imagine the system load
to do that while trying to process 3D graphics and such...
---------- snippet -----------
So I think there is no PCI involved, only this "Altera PLD" which
hangs off the G2 bus.
But if I attach to g2bus, I don't know how to solve the register
addressing of the chip without bringing major changes to the mi
mb86960.c file.
regards,
chris
----------- here's the bba dmesg ---------------
[ no symbols available ]
Copyright (c) 1996, 1997, 1998, 1999, 2000, 2001, 2002
The NetBSD Foundation, Inc. All rights reserved.
Copyright (c) 1982, 1986, 1989, 1991, 1993
The Regents of the University of California. All rights reserved.
NetBSD 1.6A (DREAMS.LANA) #234: Fri Jun 7 23:38:42 CEST 2002
chris@power.cnet.aladdin.de:/net/swamp/zeug/netbsd-chkout/sys/arch/dreamcast/compile/DREAMS.LANA
SEGA Dreamcast
general exception handler: 308 byte
TLB miss exception handler: 224 byte
interrupt exception handler: 228 byte
total memory = 16384 KB
avail memory = 14032 KB
using 230 buffers containing 920 KB of memory
mainbus0 (root)
shb0 at mainbus0
scif0 at shb0
maple0 at shb0
mapleA at maple0 port 0: Dreamcast Controller
mapleB at maple0 port 1: Dreamcast Controller
mapleB1 at maple0 port 1 subunit 1: Visual Memory
mapleC at maple0 port 2: Keyboard
mkbd0 at mapleC: Unknown keyboard 4
wskbd0 at mkbd0 (mux ignored): console keyboard
pvr0 at shb0: 640 x 480, 16bpp, VGA, RGB
wsdisplay0 at pvr0 (kbdmux ignored): console (80x30, vt100 emulation), using wskbd0
gdrom0 at shb0: SH4 IRL 9
g2bus0 at shb0
gapspci0 at g2bus0: SEGA GAPS PCI Bridge
pci0 at gapspci0 bus 0
pci0: memory space enabled
rtk0 at pci0 dev 0 function 0: SEGA Broadband Adapter
rtk0: interrupting at SH4 IRL 11
rtk0: Ethernet address 00:d0:f1:02:9c:38
ukphy0 at rtk0 phy 7: Generic IEEE 802.3u media interface
ukphy0: OUI 0x000000, model 0x0000, rev. 0
ukphy0: 10baseT, 10baseT-FDX, 100baseTX, 100baseTX-FDX, auto
Ethernet address: 00:00:00:00:00:00
lana_detect: invalid ethernet address
lana_match: lana_detect failed
root on rtk0
nfs_boot: trying DHCP/BOOTP
nfs_boot: DHCP next-server: 10.23.1.22
nfs_boot: my_name=dreamcast
nfs_boot: my_domain=cnet.aladdin.de
nfs_boot: my_addr=10.23.1.26
nfs_boot: my_mask=255.255.255.0
nfs_boot: gateway=10.23.1.6
root on 10.23.1.22:/local/dreamcast
root time: 0x3d066b71
inittodr: 2002/6/11/22/32/56(2)
init: copying out path `/sbin/init' 11
resettodr: 2002/6/11/21/28/53(2) rtc_offset 0
--------------- bba dmesg end ------------------
----------- here's the lana dmesg ---------------
[ no symbols available ]
Copyright (c) 1996, 1997, 1998, 1999, 2000, 2001, 2002
The NetBSD Foundation, Inc. All rights reserved.
Copyright (c) 1982, 1986, 1989, 1991, 1993
The Regents of the University of California. All rights reserved.
NetBSD 1.6A (DREAMS.LANA) #234: Fri Jun 7 23:38:42 CEST 2002
chris@power.cnet.aladdin.de:/net/swamp/zeug/netbsd-chkout/sys/arch/dreamcast/compile/DREAMS.LANA
SEGA Dreamcast
general exception handler: 308 byte
TLB miss exception handler: 224 byte
interrupt exception handler: 228 byte
total memory = 16384 KB
avail memory = 14032 KB
using 230 buffers containing 920 KB of memory
mainbus0 (root)
shb0 at mainbus0
scif0 at shb0
maple0 at shb0
mapleA at maple0 port 0: Dreamcast Controller
mapleB at maple0 port 1: Dreamcast Controller
mapleB1 at maple0 port 1 subunit 1: Visual Memory
mapleC at maple0 port 2: Keyboard
mkbd0 at mapleC: Unknown keyboard 4
wskbd0 at mkbd0 (mux ignored): console keyboard
pvr0 at shb0: 640 x 480, 16bpp, VGA, RGB
wsdisplay0 at pvr0 (kbdmux ignored): console (80x30, vt100 emulation), using wskbd0
gdrom0 at shb0: SH4 IRL 9
g2bus0 at shb0
Ethernet address: 00:d0:f1:02:19:0b
lana0 at shb0
Ethernet address: 00:d0:f1:02:19:0b
lana0: Sega LAN-Adapter Ethernet
lana0: Ethernet address 00:d0:f1:02:19:0b
root on lana0
nfs_boot: trying DHCP/BOOTP
nfs_boot: DHCP next-server: 10.23.1.22
nfs_boot: my_name=dreamcast
nfs_boot: my_domain=cnet.aladdin.de
nfs_boot: my_addr=10.23.1.26
nfs_boot: my_mask=255.255.255.0
nfs_boot: gateway=10.23.1.6
root on 10.23.1.22:/local/dreamcast
root time: 0x3d066a5c
inittodr: 2002/6/11/22/28/20(2)
init: copying out path `/sbin/init' 11
resettodr: 2002/6/11/21/24/17(2) rtc_offset 0
--------------- lana dmesg end ------------------