How are devices addressed in a custom embedded board
Lets say there is a ARM application processor based custom board and it has three I2C interfaces and i were porting linux kernel to it. If i were to connect a I2C device like a digital thermometer from "I2C interface 1" then how does the linux kernel know through which pins it is connected to the system. where should the pin multiplexing and addressing be set. Is it done by editing I/O and memory registers in the device drivers? if yes then does that mean if i connect it via other pins then the same driver wouldn't work? or am i missing something? I worked with PIC microcontrollers before but in it all of the code is just written into JUST 1 single FILE, so i just write the pin addressing in it. In a linux kernel how is this done? where should i edit the code? is it in the device driver or somewhere else like a separate configuration file?
|
GPIO support in the kernel should controll it.
The driver (LKM) should support the connected device. A driver don't have to know at which pin the device is connected to. |
Quote:
#define pin_name <pin_number> in the board.c file. So my new question is are the pins defined in the above mentioned file used to develop the drivers? like if (pin_name == 1){....code}; else{..code}; is that how drivers work irrespective of how the device is connected? |
No, drivers should use an interface (file) to talk to the device.
If the kernel needs a special device file (block, char) in /dev it can be created with mknod. Have a look to Linux Device Drivers, Third Edition. |
All times are GMT -5. The time now is 05:10 PM. |