Subject: Re: LAN Adapter driver
To: None <port-dreamcast@netbsd.org>
From: Christian Groessler <cpg@aladdin.de>
List: port-dreamcast
Date: 09/28/2002 23:58:17
Hi,

new patch on
ftp://ftp.groessler.org/pub/chris/dreamcast/netbsd/lan-adapter/lana-diff-sep-28.gz

On 09/29/2002 12:54:14 AM ZE9 Izumi Tsutsui wrote:
>
>In article <87fzvv329t.fsf@power.cnet.aladdin.de>
>cpg@aladdin.de wrote:
>
>> What is "FE_D7_IDENT_NICE"? Is it that nice? According to my data
>> sheet,
>>
>> #define FE_D7_IDENT_86960       0x00
>> #define FE_D7_IDENT_86964       0x40
>> #define FE_D7_IDENT_86967       0x80
>> #define FE_D7_IDENT_86965       0xC0
>>
>> in dev/ic/mb86960reg.h would make more sense.
>
>Then please also fix mb86960reg.h and add it to your patch ;-)

Ok, I've added them. The only place one of the old devices was used,
was in mb86860.c (FE_D7_IDENT_EC):

        switch (sc->type) {
        case MB86960_TYPE_86960:
                sc->proto_dlcr7 = FE_D7_BYTSWP_LH | FE_D7_IDENT_EC;
                break;

Since I don't understand what is going on here, I left it as it is
(and kept the FE_D7_IDENT_EC define).
My data sheet (for the 86967) says that bits 6 and 7 of DLCR7
shouldn't be written. It says "Writing to these bits is invalid." I
take this as "Writing _ones_ to these bits is invalid."
So the above line is at least suspect.


>There is still fmv ASIC related code:
>
>>>	/* Is this really needs to be done here? XXX */
>>>	/* Turn the "master interrupt control" flag of ASIC on. */
>>>	bus_space_write_1(memt, memh, FE_FMV3, FE_FMV3_ENABLE_FLAG);

Removed (and it still works :-)


>> >- It also includes dev/ic/ate_subr.c, but is it needed?
>> >  (Maybe we need to cleanup register configuration of mbe vs fmv.)
>>
>> I need it for the ate_read_eeprom() function. There is the mac address
>> stored in the eeprom.
>
>Hmm, if the EEPROM routine is common for all MB86965 chips,
>we should move it into sys/dev/ic/mb86960.c and nuke ate_subr.c.
>
>As noted above ate and fmv drivers should be reorganized,
>but for now the easiest way is to copy the EEPROM routine into
>if_mbe_g2.c until all other MB8696x drivers are cleaned up.
>If you still want to use current dev/ic/ate_subr.c,
>you should declare it in dreamcast/conf/files.dreamcast like:
>>> file dev/ic/ate_subr.c mbe_g2bus
>rather than including it directly from if_mbe_g2.c.

This didn't work, config reported an error about this file used twice.
I did this change in conf/files:


--- sys/conf/files      Thu Sep 26 16:54:26 2002
+++ sys.new/conf/files  Sat Sep 28 22:22:27 2002
@@ -750,7 +750,7 @@
 # Allied-Telesis Ethernet driver based on Fujitsu MB8696xA controllers
 #
 device ate: arp, ether, ifnet, mb86960
-file   dev/ic/ate_subr.c               ate
+file   dev/ic/ate_subr.c               ate | mbe_g2bus
 
 # Crystal Semiconductor CS8900, CS8920, and CS8920M Ethernet
 #


I don't know if this is correct and doesn't break other things...

regards,
chris