[U-Boot] building enc28j60 for omap3: SILICON ERRATA

Anatolij Gustschin agust at denx.de
Wed Feb 23 23:32:01 CET 2011


Hi,

On Tue, 22 Feb 2011 17:34:30 +0100
jacopo mondi <j.mondi at voltaelectronics.com> wrote:
...
> Second issue is related to enc identification.
> The following code section:
> 
> 	phid1 = phy_read(enc, PHY_REG_PHID1);
> 	phid2 = phy_read(enc, PHY_REG_PHID2) & ENC_PHID2_MASK;
> 	if (phid1 != ENC_PHID1_VALUE || phid2 != ENC_PHID2_VALUE) {
> 		printf("%s: failed to identify PHY. Found
> 		%04x:%04x\n",			enc->dev->name,
> 		phid1, phid2);
> 	 return -1;
> 	}
> 
> fails because phy_read instructions return 0 or random values (0xB0B0
> or 0xB000).
> Linux driver does not perform such tests, so I've tried removing them.

No, please do not remove them. Fix the register access
problem instead.

> Anyway all read and write to enc fails.
> Could that be related to omap3_spi implementation?

Yes. If you use the omap3_spi driver in current mainline tree,
then definitely the omap3_spi driver is the problem. enc28j60
register and buffer access can not work with this current driver
version.

We experienced problems with enc28j60 register access on a iMX31
based board as there were among other things some byte order issues
in the spi driver. When using spi clock above 2 MHz we also have
seen seemingly random data when reading the enc registers. Be aware
that there are two kinds of spi transfers for enc register access:
two bytes long transfers and three bytes long transfers with a dummy
byte. The spi chip select signal have to be active as long as
these tx/rx transfers didn't completed and may not be deactivated
in between. Also the spi transfer is full-duplex for enc28j60
register and buffers access. With a properly working spi driver
the enc28j60 driver in U-Boot works well.
 
> I can confirm that same same board I'm using for test works great
> under Linux, so it is not an hardware issue.

This is the omap3_spi driver issue. You can apply the attached
patch for enc28j60 driver to be able to start single register
accesses on the U-Boot command line. Then you can start fixing
the spi driver code. Implement fixes in the spi driver and test
the register access using the enc commands added by the path.

You will have to implement the Master Transmit-Receive Mode
(full-duplex) in the omap3_spi driver for proper enc28j60 register
and buffer access. Currently this driver is using Tx-Only Mode
for transmitting a Rx-Only Mode for receiving. But it shouldn't
be too hard to fix the spi driver. What is needed is a kind
of merge of omap3_spi_read/omap3_spi_write routines.

HTH
Anatolij
-------------- next part --------------
A non-text attachment was scrubbed...
Name: commands-for-ENC28J60-SPI-register-access-tests.patch
Type: text/x-patch
Size: 2008 bytes
Desc: not available
Url : http://lists.denx.de/pipermail/u-boot/attachments/20110223/cccdd98d/attachment.bin 


More information about the U-Boot mailing list