[U-Boot-Users] [PATCH] smc91111 - Add I/O functions, remove environment calls

This patch makes the following hanges to the smc91111 driver, detailed description(s) follow:
1) adds I/O functions (SMC_inb, SMC_outb, SMC_inw, SMC_outw, SMC_insw, SMC_outsw ) since some hardware will not work with the macro I/O (Logic LH7A400).
2) backs out/modifies a recent change putting calls to getenv and setenv in 'smc_get_ethaddr'.
3) restores CTL_DEFAULT definition to the register default and or's CTL_AUTO_RELEASE in smc_reset.
4) removes packet number and ptr register 'saving and restoral'. You don't have to do this unless you're changing these in an interrupt handler. This driver is polled.
5) adds proper handling of tx interrupt status and autorelease
Description: ------------
1) Using the I/O macros on the Logic LH7A400 SDK does not work and puts the MAC in an unknown state. Symptoms being data being shifted on the wire, packets being sent twice, MAC unable to free packets. Receive works just fine while all this is going on.
It seems multiple word writes are happening to fast for the SMC while all other access modes work fine. It could be the IO function calls add just enough delay to make the SMC happy. Its not my hardware and our board will be different so I didn't want to spend any more time on this. No code is added for boards that don't enable the functions. This is done by defining 'CONFIG_SMC_USE_IOFUNCS' in the board config.
2) I don't think there should be calls to environment functions from the ethernet driver.
The value being read is already passed into the function in the board info structure. If you haven't set an ethernet address in your environment this will be all zeros. If you have set an address in your environment it will be in the board info struct. If either of these is not true, your board is not set up correctly.
I don't want a driver changing my environment, period. Changing the board info ethaddr value is fine but don't touch the environment.
I've modified the code to use the value in board info, and modify that same value if needed.
3) Autorelease is NOT the control register default
4) again, this driver is polled not interrupt driven, no need to save/restore these registers
5) Moved tx interrupt status handling to the poll4int function. If autorelease not enabled we only care about IM_TX_INT and must free packets on either success or failure. If autorelease enabled we have to look for IM_TX_EMPTY_INT or IM_TX_INT...the former indicates tx was successfull, the latter indicates an error. In error case the packet must still be freed manually.
----- Paul Ruhland (pruhland@microwavedata.com) Software Engineer Microwave Data Systems, Inc. Rochester, NY 14620
participants (1)
-
Paul Ruhland