2009-03-27 05:08:48     Using driver under driver

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

2009-03-27 05:08:48     Using driver under driver

Sergey Kuznetsov (RUSSIAN FEDERATION)

Message: 71678   

 

Hi all!!

 

I`ve got a question, induced by a lack of understanding.

 

I have ethernet driver bfin_mac. I have to blink diodes (using gpio driver) when I send a packet or enter open() function. The question is how can I implement it?

 

Sorry for nub question.

 

Thnak you!

QuoteReplyEditDelete

 

 

2009-03-27 05:44:28     Using driver under driver

Michael Hennerich (GERMANY)

Message: 71683   

 

There are different ways to do that.

Write a user space application that evaluates the net proc entries and then toggles LEDS/GPIOS using the LED Driver framework or the simple-gpio char driver.

 

On the other side you can hack the bfin_mac driver.

 

It's up to you...

 

If you decide doing this -

Simply use the kernel GPIO framework

 

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

 

 

int gpio_request(unsigned gpio, const char *label);

void gpio_free(unsigned gpio);

gpio_direction_output(GPIO_PG8, 1);

gpio_set_value(GPIO_PG8, 0);

 

and friends ...

 

-Michael

QuoteReplyEditDelete

 

 

2009-03-27 06:10:04     Re: Using driver under driver

Sergey Kuznetsov (RUSSIAN FEDERATION)

Message: 71685   

 

Thank you, Michael!

 

And there is another question- what should I do if I have to hack bfin_mac to make it send smth via uart, i2c, spi (using existing and loaded to the kernel drivers)? Somehow I have to connect bfin_mac to uart, i2c, spi and use standart drivers. For example, to use spi I have to have pointer to spi_master, and I don`t know how to implement it, i mean how it is generally done... I`ve searched over LDD3, I could make a simple eth driver. Than, i tried to send smth over spi in case of open().  That means, i have to use spi driver`s write functions, and they use spi_master structure. But i don`t know how to get it, where to get it from...

 

I would be very thankful for explanations or link...

 

Sergey

QuoteReplyEditDelete

 

 

2009-03-27 06:33:15     Re: Using driver under driver

Michael Hennerich (GERMANY)

Message: 71688   

 

I have no idea what your are trying to achieve - it sounds strange to me.

 

SPI and I2C are buses therefore have both kernel level bus driver APIs.

 

A good example is the AD7879 touch screen driver. Since it has an option to either communicate via I2C or SPI.

 

Take a look here:

 

blackfin.uclinux.org/gf/project/linux-kernel/scmsvn/?action=browse&path=%2Ftrunk%2Fdrivers%2Finput%2Ftouchscreen%2Fad7879.c&revision=6166&view=markup

 

-Michael

QuoteReplyEditDelete

 

 

2009-03-27 09:06:09     Re: Using driver under driver

Sergey Kuznetsov (RUSSIAN FEDERATION)

Message: 71694   

 

Thank you, Michael, i`m reading it!

QuoteReplyEditDelete

 

 

2009-03-27 12:21:40     Re: Using driver under driver

Mike Frysinger (UNITED STATES)

Message: 71702   

 

you can also search the wiki for specific peripherals

 

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

Attachments

    Outcomes