LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Embedded & Single-board computer (https://www.linuxquestions.org/questions/linux-embedded-and-single-board-computer-78/)
-   -   Question on start up and initialization (https://www.linuxquestions.org/questions/linux-embedded-and-single-board-computer-78/question-on-start-up-and-initialization-658191/)

Gnu2Linux2 07-25-2008 08:01 AM

Question on start up and initialization
 
Another noob question here.

I have a need to do some one time initialization of a device over i2c after a reset. I am curious as to how the best way to handle this in embedded linux (or linux for that matter).

It has to be done before USB and ethernet come up, but obviously after the i2c driver is loaded.

1)How are these types of things typically handled in embedded linux systems?
2)Do you write a little application that is called at some point, or what? 3)If so, how would have it get called?
4)How do control the order of driver loading for the requirement above?


Thanks In Advance.

belcor 08-07-2008 03:43 AM

Here are some answers from my recent experiences

I needed a camera driver. The camera driver uses an I2C interface, and camera interface. Before any camera functions are done the first thing is to identify the device. ( camera). This is done via the i2c.
On booting when the kernel is loaded it will search for drivers you have installed/created. ie. camera_driver. It will register the driver and 'probe' automatically. During the __init the probing of the device is done, at this time you can reset/send commands via the i2c.
See /linux/drivers/media/video/monahans/mt9d111_hw.c for an example.
it's not that apparent, so you'll have to follow the code through.
also read /linux/documentation/driver-model.txt. See http://lwn.net/Kernel/LDD3/
So the short answer to your question is on kernel boot-up the drivers are loaded, and devices are initialized.


All times are GMT -5. The time now is 07:17 AM.