2011-03-28 16:13:44     How to load driver for ENC28J60 like spi0.0 using 2010R1

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

2011-03-28 16:13:44     How to load driver for ENC28J60 like spi0.0 using 2010R1

David Demcak (CZECH REPUBLIC)

Message: 99381   

 

Hi there,

 

I'm trying to configure  ENC28J60 struct (in stamp.c, using 2010R1) to be loaded as

 

enc28j60 spi0.0: enc28j60 Ethernet driver 1.01 loaded

 

instead

 

enc28j60 spi0.5: enc28j60 Ethernet driver 1.01 loaded.

 

Let me describe my stituation, I'm using to comunicate with ENC28J60 PF5 pin on BF-532, so my struct looks like:

 

{

 

.modalias = "enc28j60",

 

.max_speed_hz = 20000000,     /* max spi clock (SCK) speed in HZ */

 

.irq = IRQ_PF5,

 

.bus_num = 0,

 

.chip_select = 5, /* GPIO controlled SSEL */

 

.controller_data = &enc28j60_spi_chip_info,

 

.mode = SPI_MODE_3,

 

},

 

Everything's fine, driver is loaded, eth0 interface is created.

 

But it's not possible to ping my pc from the BF-532 board or from my pc I'm not able to ping the BF-532 board. (It's not about ping, ftp, tftp and so... the ENC28J60 was founded, but that's all :(... )

 

I've already read some threads and I agree that the configuration the struct in OLD-WAY from the website

 

  docs.blackfin.uclinux.org/doku.php?id=spi

 

is needed.

 

I've tried, but there is a problem because in bfin5xx_spi.h .cs_gpio property in bfin5xx_spi_chip is missing in new uCLinux release 2010R1.

 

I would like to know if there is some possibility how to configure ENC28J60 with CS connected to PF5 pin, like device with enc28j60 spi0.0 or use something else to make things run

 

Thanks a lot for your time and your advice!

 

David

QuoteReplyEditDelete

 

 

2011-03-28 16:21:20     Re: How to load driver for ENC28J60 like spi0.0 using 2010R1

David Demcak (CZECH REPUBLIC)

Message: 99382   

 

Sorry, I've made a mistake...

 

In the configuration I have .irq = IRQ_PF4,

 

Thanks a lot!

 

David

QuoteReplyEditDelete

 

 

2011-03-28 16:38:56     Re: How to load driver for ENC28J60 like spi0.0 using 2010R1

Mike Frysinger (UNITED STATES)

Message: 99383   

 

you looked at the section labeled "old way".  did you try the section labeled "new way" ?

QuoteReplyEditDelete

 

 

2011-03-29 04:22:49     Re: How to load driver for ENC28J60 like spi0.0 using 2010R1

David Demcak (CZECH REPUBLIC)

Message: 99423   

 

Hi Mike,

thaks for your reply.

 

Yes, I had tried it before I've started to make it old-way.

 

#if defined(CONFIG_ENC28J60) || defined(CONFIG_ENC28J60_MODULE)

{

.modalias = "enc28j60",

.max_speed_hz = 20000000,     /* max spi clock (SCK) speed in HZ */

.irq = IRQ_PF4,

.bus_num = 0,

.chip_select = GPIO_PF5 + MAX_CTRL_CS, /* GPIO controlled SSEL */

.controller_data = &enc28j60_spi_chip_info,

.mode = SPI_MODE_3,

},

#endif

 

and the result after booting:

...

Blackfin DMA Controller

stamp_init(): registering device resources

bio: create slab <bio-0> at 0

bfin-spi bfin-spi.0: cs13 >= max 8

bfin-spi bfin-spi.0: Blackfin on-chip SPI Controller Driver, Version 1.0, regs_base@ffc00500, dma channel@5

Switching to clocksource bfin_cs_cycles

...

 

with the

#if defined(CONFIG_ENC28J60) || defined(CONFIG_ENC28J60_MODULE)

{

.modalias = "enc28j60",

.max_speed_hz = 20000000,     /* max spi clock (SCK) speed in HZ */

.irq = IRQ_PF4,

.bus_num = 0,

.chip_select = 5, /* or .chip_select = PF5, */

.controller_data = &enc28j60_spi_chip_info,

.mode = SPI_MODE_3,

},

#endif

 

works fine, after boot I've got

enc28j60 spi0.5: enc28j60 Ethernet driver 1.01 loaded

net eth0: enc28j60 driver registered

and the result is that I'm not able to recieve interrupts:

 

root: /> cat /proc/interrupts

...

37: 0 GPIO enc28j60

 

and clearly the services like PING does'n work.

There is a thread about that

  blackfin.uclinux.org/gf/project/uclinux-dist/forum/?_forum_action=ForumMessageBrowse&thread_id=33682&action=ForumBrowse

but with no answer

I've followed the instruction given by the thread and the wiring is OK, pull-up also there, but the same problem

no interrupts.

 

Thanks a lot for your time and your advice.

David

 

 

 

 

QuoteReplyEditDelete

 

 

2011-03-29 14:11:09     Re: How to load driver for ENC28J60 like spi0.0 using 2010R1

Mike Frysinger (UNITED STATES)

Message: 99436   

 

make sure the num_chipselect field for your bfin_spi bus is set high enough.  you probably need to change it to something like:

.num_chipselect = MAX_CTRL_CS + MAX_BLACKFIN_GPIOS,

QuoteReplyEditDelete

 

 

2011-03-29 20:08:53     Re: How to load driver for ENC28J60 like spi0.0 using 2010R1

David Demcak (CZECH REPUBLIC)

Message: 99439   

THANKS A LOT MIKE!!!!

You're right!

 

/* SPI controller data */

static struct bfin5xx_spi_master bfin_spi0_info = {

    .num_chipselect = MAX_CTRL_CS + MAX_BLACKFIN_GPIOS,

    .enable_dma = 1,  /* master has the ability to do dma transfer */

    .pin_req = {P_SPI0_SCK, P_SPI0_MISO, P_SPI0_MOSI, 0},

};

 

I changed the .num_chipselect and also change the SPI mode...

 

#if defined(CONFIG_ENC28J60) || defined(CONFIG_ENC28J60_MODULE)

    {

        .modalias = "enc28j60",

        .max_speed_hz = 20000000,     /* max spi clock (SCK) speed in HZ */

        .irq = IRQ_PF4,

        .bus_num = 0,

        .chip_select = GPIO_PF5 + MAX_CTRL_CS,    /* GPIO controlled SSEL */

        .controller_data = &enc28j60_spi_chip_info,

        .mode = SPI_MODE_0,

    },

#endif

 

and everything's fine

I'm recieving interrupts and all services is working

 

THANK YOU SOOOO MUCH, Mike!

I really appreciate your advice!

 

I wish you all the best.

David

Attachments

    Outcomes