2009-03-04 02:42:59     Hotplug new module(eth driver)

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

2009-03-04 02:42:59     Hotplug new module(eth driver)

Sergey Kuznetsov (RUSSIAN FEDERATION)

Message: 70329   

 

Good time of the day!

 

By now I have a question and would appreciate your help.

 

I have started writing my first eth driver(through spi) and I feel lack of understanding about the process kernel probes new hardware when I insmod this driver. When I include it directly to the kernel (compiling all), at the beginning of the boot process, kernel probes and adds my new interface. But I do not know how to do this with my new driver(module) added. I have read some books and found abstract, general phrases, such as "and now the kernel probes that function in your driver", but haven`t found the answer yet.

 

As far as I know, things were different in earlier kernel, without sysfs, "platform devices".

 

Could anybody help me with that theory?

 

Thank you very much.

QuoteReplyEditDelete

 

 

2009-03-04 02:49:18     Re: Hotplug new module(eth driver)

Mike Frysinger (UNITED STATES)

Message: 70332   

 

have you read LDD3 ?  it covers this stuff

 

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

QuoteReplyEditDelete

 

 

2009-03-04 02:58:15     Re: Hotplug new module(eth driver)

Sergey Kuznetsov (RUSSIAN FEDERATION)

Message: 70336   

 

Mike, thank for your extremely fast reply.

 

Yes, I`ve read it...I think I should read it more carefull if you ask me that, thanks!

QuoteReplyEditDelete

 

 

2009-03-04 03:06:06     Re: Hotplug new module(eth driver)

Mike Frysinger (UNITED STATES)

Message: 70337   

 

chapter two covers basic module init/exit.  specifically page 16.

 

you can also try this page:

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

QuoteReplyEditDelete

 

 

2009-03-04 03:37:10     Re: Hotplug new module(eth driver)

Sergey Kuznetsov (RUSSIAN FEDERATION)

Message: 70341   

 

Yes, that truly explains how to insmod and rmmod, but the question is how probe is done, or even, how the kernel does this at a boot time?

 

Simple module explains rmmod and insmod with the _init and _exit functions in that module. But more complex modules have _probe as well.

 

I see, that adding device explanation in, for example, stamp.c, makes the kernel init and probe my, loaded to the kernel, module. But I do not understand how to make a loadable module be probed any time I want after I insmod it...

QuoteReplyEditDelete

 

 

2009-03-04 03:44:50     Re: Hotplug new module(eth driver)

Mike Frysinger (UNITED STATES)

Message: 70342   

 

the probe/remove functions are part of the device driver model.  read chapter 14 of LDD3 (you can prob skip down to page 375 as the kset/sysfs stuff isnt really needed).

 

in the embedded world, most things live on the platform bus.

QuoteReplyEditDelete

 

 

2009-03-04 03:49:14     Re: Hotplug new module(eth driver)

Sergey Kuznetsov (RUSSIAN FEDERATION)

Message: 70343   

 

Thank you very much, I`m going to read it careful.

QuoteReplyEditDelete

 

 

2009-03-05 02:34:42     Re: Hotplug new module(eth driver)

Sergey Kuznetsov (RUSSIAN FEDERATION)

Message: 70406   

 

By now I realized, that digging into this just to make working process faster is a bad idea. Also it is better for eth device be up at the boot time, as it is not a hotpluggable device(at least for my device) and nothing can create hotplug event..

 

I`ve got a knew question, closely related to the first question, so I didn`t make a new thread.I would be very pleased if you help me once again.

 

AFAIK, I am able to run only kernel-space functions in me eth driver. Since it should use spi, I have to use functions from spi drivers (for instance bfin_spi_adc in order to use dma) or to mix new spi driver( I mean to go deeper, to use io functions and memory) with my driver.

 

If I go first way, I should use open(), it gives me fd of the particular spi, and after use spi_ioc_tranfer. But I am not sure whether I can usr spi_ioc_tranfer, whether it is a userspace function.

 

If I go another way, there won`t be a question of using userspace functions, but it leads to writting another, even more complex for a newbie, driver.

 

Thank you very much.

QuoteReplyEditDelete

 

 

2009-03-05 02:38:35     Re: Hotplug new module(eth driver)

Mike Frysinger (UNITED STATES)

Message: 70407   

 

userspace should not be involved at all.  network drivers are not real files in the sense of /dev/ device nodes.

 

if you want to know more about using the kernel SPI functions, then please review this doc:

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

QuoteReplyEditDelete

 

 

2009-03-05 02:44:54     Re: Hotplug new module(eth driver)

Sergey Kuznetsov (RUSSIAN FEDERATION)

Message: 70409   

 

Thank you once again!

Attachments

    Outcomes