After a period of time-driven personal sentiment, no matter what drive, to less detours, common driving workflow should be as follows:
1, reading, look at the data, understand the driving principle: the kernel of this type of drive architecture, working mechanism, etc., recommended must read the document is the Linux kernel source code in the documents directory of this driver txt document, here the document most direct, the most core, the most critical ... That's all there is.
2, see Datasheet,datasheet often a lot of pages, need to look now? No, now look at the overall content, first understand the PIN definition, understand the overall architecture, understand register or memory allocation. Master the basic working principle of hardware.
The above two steps do not want to lazy skip, even if you have a ready to write a good driver, to debug to your platform to normal work, to the end of the N more detours will find that you do not read the document and save to any time, instead of wasting n more time. There is a saying is very right: "In the lakes and rivers mixed, sooner or later will have to also." ”
3, see example Drive, Linux kernel driver, generally have a relatively simple example code, specifically, see the first step of the TXT document. With this simple example code, we further clarify how the drive works.
4, good, ready to work to complete, here should formally start. Write it yourself? No, or secretly lazy, online to find ready-made, there is just your chip driver, really lucky, direct use, of course, often can not be used directly, to debug under the next line. No? Find the same series of chip drivers, modified under use, but also more fortunate. Or not? Be honest and start writing on the framework provided by the example code!
5, debugging process encountered problems? Honestly look at the relevant parts of datasheet, this related part is often not in the same chapter, most of the time will be distributed in many chapters, do not miss the details. Are your registers set to the right? All right? Use oscilloscope, logic Analyzer to catch the waveform, analyze the timing, see the hardware is not Luo. No, just look for the hardware engineer. Not yet? To the chip official website, see your datasheet is the latest version? There are no errata documents. Maybe you have errors in the documentation you have, of course you can't tune it!