I am newbie on linux driver development. I wonder how same linux drivers work on different chips. For instance, same uart driver work on allwinner and sitara socs?Do allwinner and sitara socs have same uart peripheral?
Basically how things are working is based on layering concept as shown below in Image.
Kernel source is layered so that we don't have to write it again and again for every system and to increase its re usability.
Approach behind this is, architect depended code on bottom layer, then comes layer of bus drivers (SPI, I2C, etc.) and then comes adapter or device drivers.
So suppose if a board is using company A's NAND Flash over SPI or any similar interface, we can use same device driver for this company A - NAND Flash on any given board, irrespective of whatever SPI apapter present, but only thing need to be concerned is SPI bus driver should be present as platform driver.
Here while probing, SPI will give access to the device driver with NAND Flash's Address. Here SPI driver knows how to communicate with SPI devices and NAND Flash driver keep on telling to SPI Driver what to transfer to NAND flash and SPI takes responsibility for how to transfer. In this SPI Platform driver may differ with different platforms but NAND Flash driver remains same.
With this approach same device driver for a device can be used in different systems without any dependencies for hardware specification.

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With