2011-02-03 06:21:58     spi_eth_drivers_ksz8851_enc28j60

Document created by Aaronwu Employee on Sep 25, 2013
Version 1Show Document
  • View in full screen mode

2011-02-03 06:21:58     spi_eth_drivers_ksz8851_enc28j60

Vitaliy Popov (RUSSIAN FEDERATION)

Message: 97899   

 

hello all!

 

 

 

I worked on custom bf548 board (similar as bf548-ezkit)

 

and use spi ethernet chips ksz8851snl and enc28j60. I ported driver for this chip for blackfin u-boot, and I think it will be intresting for somebody:

 

for ksz8851:

in /u-boot-2010.06-2010R1-RC2/

add to /drivers/net/Makefile line: COBJS-$(CONFIG_KS8851) += ks8851.o

in /include/config/"board name".h add: #define CONFIG_KS8851 1

in /board/"board name"/"board name".c add:

#ifdef CONFIG_KS8851

int board_eth_init(bd_t *bis)

{

    return ks8851_initialize(bis);

}

#endif

 

 

for enc28j60 is similar.

 

ping and tftp working ok.

 

u-boot_spi_eth.tar.bz2

QuoteReplyEditDelete

 

 

2011-02-03 11:49:23     Re: spi_eth_drivers_ksz8851_enc28j60

Mike Frysinger (UNITED STATES)

Message: 97903   

 

enc28j60 has already been ported to common SPI framework in u-boot trunk and been verified to work on Blackfin devices

 

the ks8851 driver looks like a good start, but it'll need some clean up before it can be merged

 

do you want to try to get the driver and your board port actually merged ?

QuoteReplyEditDelete

 

 

2011-02-14 05:01:35     Re: spi_eth_drivers_ksz8851_enc28j60

Vitaliy Popov (RUSSIAN FEDERATION)

Message: 98154   

 

enc28j60 has already been ported to common SPI framework in u-boot trunk and been verified to work on Blackfin devices

 

- I don't known about enc driver. I download it and try to work with them, but it not work! driver starts ok, but hang when I do ping or tftp...

QuoteReplyEditDelete

 

 

2011-02-14 12:40:33     Re: spi_eth_drivers_ksz8851_enc28j60

Mike Frysinger (UNITED STATES)

Message: 98161   

 

sorry, but i dont know what you're talking about.  are you only using latest trunk ?  or are you trying to take random files from trunk and make them work in your older release ?

 

ive tested it on a BF537-STAMP board and it seemed to work fine for me.  but you have to use a GPIO CS and use it in SPI mode 0.

QuoteReplyEditDelete

 

 

2011-02-18 04:47:14     Re: spi_eth_drivers_ksz8851_enc28j60

Vitaliy Popov (RUSSIAN FEDERATION)

Message: 98250   

 

Hello Mike,

 

before I trying to take enc28j60.c file from trunk and add it to u-boot-2010.06-2010R1-RC2.

 

Now I get all u-boot _trunk, compile it and result is same, enc hang when I ping or tftp...

 

I add  #define DEBUG in enc28j60.c, this is the output:

 

U-Boot 2010.12-svn2590 (ADI-2011R1-pre) (Feb 18 2011 - 08:27:03)

 

CPU:   ADSP bf548-0.2 (Detected Rev: 0.2) (spi flash boot)

Board: BF548 board

       Support: http://blackfin.uclinux.org/

Clock: VCO: 503.808 MHz, Core: 503.808 MHz, System: 125.952 MHz

RAM:   64 MiB

Flash: 0 Bytes

SF: Detected M25P128 with page size 256, total 16 MiB

In:    serial

Out:   serial

Err:   serial

Net:   enc1.109

Hit any key to stop autoboot:  0

bfin> ping 192.168.0.125

enc1.109: link up, 10Mbps half-duplex

Using enc1.109 device

Tx:

00000000: ff ff ff ff ff ff 92 68 00 51 00 00 08 06 00 01    .......h.Q......

00000010: 08 00 06 04 00 01 92 68 00 51 00 00 c0 a8 01 fc    .......h.Q......

00000020: 00 00 00 00 00 00 c0 a8 00 7d    .........}

Rx:

00000000: 46 00 40 00 c0 00    F.@...

 

I can not start reworking ks8851 driver without understanding how is it must working.

 

I can connect enc28j60 and ks8851 chip to one board for comparing and testing.

 

in my board.c file:

 

#ifdef CONFIG_ENC28J60

int board_eth_init(bd_t *bis)

{

    return enc28j60_initialize(ENC_SPI_BUS, ENC_CS_NUM + MAX_CTRL_CS,ENC_SPI_CLOCK, SPI_MODE_0);

}

#endif

 

and in board.h :

 

#define CONFIG_CLKIN_HZ            12288000

#define CONFIG_VCO_MULT            41

#define CONFIG_CCLK_DIV            1

#define CONFIG_SCLK_DIV            4

 

 

#define ADI_CMDS_NETWORK    1

#define CONFIG_NET_MULTI

#define CONFIG_ENC28J60

#define ENC_SPI_BUS        1

#define ENC_CS_NUM        GPIO_PG5

#define ENC_SPI_CLOCK    1000000

 

/*

* SPI Settings

*/

#define CONFIG_BFIN_SPI

#define CONFIG_ENV_SPI_MAX_HZ    30000000

#define CONFIG_SF_DEFAULT_SPEED    30000000

#define CONFIG_SPI_FLASH

#define CONFIG_SPI_FLASH_STMICRO

 

 

my board use spi flash boot, may be it is the problem of not working of enc driver?can you explane board configuration witch you are test?

QuoteReplyEditDelete

 

 

2011-03-09 18:28:52     Re: spi_eth_drivers_ksz8851_enc28j60

Mike Frysinger (UNITED STATES)

Message: 98800   

 

i cant really tell you why it isnt working in the 2010R1 branch.  the driver certainly wasnt developed or tested against that version.  it does however work fine in svn trunk.

 

just had to add this to board/bf537-stamp/bf537-stamp.c:board_eth_init():

    enc28j60_initialize(0, GPIO_PF10 + MAX_CTRL_CS, 20000000, SPI_MODE_0);

 

U-Boot 2010.12-00000-gb0554da-dirty (ADI-2011R1-pre) (Mar 09 2011 - 18:19:51)

 

CPU:   ADSP bf537-0.2 (Detected Rev: 0.2) (bypass boot)

Board: ADI BF537 stamp board

       Support: http://blackfin.uclinux.org/

Clock: VCO: 500 MHz, Core: 500 MHz, System: 125 MHz

RAM:   64 MiB

Flash: 4 MiB

MMC:

In:    serial

Out:   serial

Err:   serial

KGDB:  [on serial] ready

Net:   enc0.18, bfin_mac

Hit any key to stop autoboot:  0

 

bfin> print ethact

ethact=enc0.18

 

bfin> ping 192.168.1.2

Using enc0.18 device

host 192.168.1.2 is alive

bfin> ping 192.168.1.2

Using enc0.18 device

host 192.168.1.2 is alive

QuoteReplyEditDelete

 

 

2011-07-24 15:13:43     Re: spi_eth_drivers_ksz8851_enc28j60

Vitaliy Popov (RUSSIAN FEDERATION)

Message: 102652   

 

hello all,

I rework ksz8851 driver with common SPI framework, new version is attached, also need add to board file:

#ifdef CONFIG_KS8851

int board_eth_init(bd_t *bis)

{

return ks8851_initialize(0, GPIO_PE5 + MAX_CTRL_CS, 25000000, SPI_MODE_0);

}

#endif

and also one, common SPI framework work incorrect in SPI DMA for SPI channel diferent from 0, SPI DMA number is hardcoded in u-boot/drivers/spi/bfin-spi.c - this is problem of not working enc28j60 in my start(it was conected to SPI1).

 

bfin_spi.c

ks8851.h

ks8851.c

Outcomes