This is the mail archive of the ecos-discuss@sources.redhat.com mailing list for the eCos project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: SMSC LAN91CXX driver



(I'm answering both your messages here; I see Gary has addressed the 2nd
 message already, good.)

Jordi Colomer <jco@ict.es> writes:
> I plan to use the driver for the ethernet controller
> SMSC LAN91CXX (91C96, in my case), but it seems that
> it hasn't been used in any platforms; at least, it
> is not included in any templates.

We're talking about the package in PACKAGES/devs/eth/smsc/lan91cxx/VERSION,
called CYGPKG_DEVS_ETH_SMSC_LAN91CXX, right?

We use it for a customer board that's like an assabet but not quite; the
details are not public, so the module that instantiates the 91cxx driver is
not available in anoncvs.

> Has anyone used this driver with success
> in any platforms ?  After a quick look at the code,

Yes, there's one on my desk right now that I use quite a lot.

> it seems to me that it wouldn't work on an Assabet
> and Neponset boards. In that board, the device's A0
> line is wired to the SA-1110's A2 line, therefore 
> register addresses must be shifted 2 bits, but
> in the driver they are shifted only 1 bit (assuming
> 16-bit access, which is the most natural way to 
> connect the chip).

I believe it may not work on an assabet anyway.  The assabet is rather
untested IME; after our customer asked Intel enough times they admitted
that the ethernet device isn't tested and is not actually connected up
correctly.  (IIRC - this from memory, disclaimers apply... could be only
early versions of assabet that are not good - or it could be that address
wiring "feature" that stopped us! ;-> )

> Can anyone suggest an "elegant" way to modify the 
> driver (it case it really needs to be modified) 
> to make it compatible with word and double-word
> alignments ?

Changing the type of "base" in struct lan91cxx_priv_data {} to "unsigned
long *" would probably do it!  Use a #define that your .inl file can set to
tell it to use long addressing instead of short.

> One more question: why isn't this driver available 
> as a package (CYGPKG_ETH_SMSC_LAN91CXX) in ecos.db ?

That's a simple oversight which I shall correct right now.

The clause to add is:

  package CYGPKG_DEVS_ETH_SMSC_LAN91CXX {
	alias 		{ "SMSC LAN91CXX ethernet driver" lan91cxx_eth_driver lan9000_eth_driver }
	hardware
	directory	devs/eth/smsc/lan91cxx
	script		smsc_lan91cxx_eth_drivers.cdl
        description     "Ethernet driver for SMSC LAN91CXX (LAN9000) controller."
  }

anywhere in ecos.db

(Your 2nd message: )

> 2. Is the SMSC/LAN91CXX driver tested in any
> platforms ? It seems that my platform-specific adapter
> code can't cause this sort of problems.

Yes, answered above.
 
> The platform-specific code only does the following :
> 
> 1. Set up the GPIO interrupt (falling-edge)
> 2. Shift the chip addresses by two bits, because in the
> Neponset board the SMC A0 line is wired to the SA-1110's
> A2 line (double-word alignment).
> 3. Set the chip base address.

That's about all you need to do.  An example for the contents of the .inl
file for our platform "thingy" follows below...  (with no address size
control of course)

	- Huge


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
#include <cyg/hal/hal_intr.h>           // CYGNUM_HAL_INTERRUPT_ETHR
#include <cyg/hal/thingy.h>

static lan91cxx_priv_data lan91cxx_eth0_priv_data = { 
    // The "0x300" offset from the base is ignored in PCMCIA mode
    base : (unsigned short*) 0x20000000,
    interrupt: CYGNUM_HAL_INTR_SMSC_ETHER,
#ifdef CYGSEM_DEVS_ETH_CPUTYPE_THINGY_SMSC_ETH0_STATIC_ESA
    enaddr : CYGDAT_DEVS_ETH_CPUTYPE_THINGY_SMSC_ETH0_ESA,
#endif
    config_enaddr : NULL              // rely on the hardwired address for now
};

ETH_DRV_SC(smsc_lan91cxx_sc,
           &lan91cxx_eth0_priv_data, // Driver specific data
           CYGDAT_DEVS_ETH_CPUTYPE_THINGY_SMSC_ETH0_NAME,
           lan91cxx_start,
           lan91cxx_stop,
           lan91cxx_control,
           lan91cxx_can_send,
           lan91cxx_send,
           lan91cxx_recv,
           lan91cxx_deliver,     // "pseudoDSR" called from fast net thread
           lan91cxx_poll,        // poll function, encapsulates ISR and DSR
           lan91cxx_int_vector);

NETDEVTAB_ENTRY(smsc_netdev, 
                "smsc_eth0",
                smsc_lan91cxx_init, 
                &smsc_lan91cxx_sc);

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]