Writing device drivers for SoC's without official documentation - is it hell?

Started by BrianBrianBrian, September 28, 2015, 05:55:46 AM

Previous topic - Next topic

BrianBrianBrian

What's it like trying to do linux kernel/driver development on a SoC that has no official documentation from the vendor?  In the Olimex product line, I guess this includes the AllWinner and Rockchip SoC's.  I can't even imagine doing it which is why I find myself gravitating towards the TI SoC.  However, I think I am biased due to my experience with bare-metal embedded development - there is always complete documentation.  My next project is going to be my first foray into Linux embedded development, however and I see a lot of people making good progress without any documentation from the vendor and this surprises me!  How do you people do it?  Is it a huge time sink?  If so, does the extra time required to do the reverse-engineering offset the cheaper costs?

As you can see I have lots of questions.  ;D Hopefully we can have a good discussion about this! 


BrianBrianBrian

Oh and if you can think of a better place to post this question, please let me know.

JohnS

But you guess wrong.  Doc exist.

I wonder, though, why you put your post here rather than (say) somewhere dedicated to the chip and its drivers etc.

John

BrianBrianBrian

I'm surprised to hear that!  I am aware of sites like linux-sunxi.org for the AllWinner chips but these are crowd-sourced documentation not from the vendor right?  ???

Just for example, where is the datasheet that describes how to implement audio streams over I2S via DMA?  As far as I can tell, the only option is to hope someone has done a driver for a similar codec and try to port their code to your own codec.  Is this not the case?

I definitely open to suggestions! Where would you suggest I post this question that is not specific to any chip?

JohnS

Allwinner dump things on github, as an example.

The site you mention has a busy ML all about drivers etc whereas Olimex are mainly a hardware seller.

Learning Chinese would probably get you a bit further but translation works fairly well.

John

qq

It is unfortunate, that few SoC manufacturers care to publish their documentation. https://github.com/allwinner-zh/documents has some data sheets and user manuals for Allwinner's A series SoCs, but it is unclear, were linux-sunxi.org obtained the links for the H3 SoC data sheet (which might also be the user manual), which it links to on its H3 wiki page, and were first information comes from.

Rockchip, last thing I read is, they don't provide any documentation about their products, which I consider pretty silly. There are some data sheets and manuals for some of their older SoCs on http://rockchip.fr/, but I don't know, where people would obtain documentation for their newer SoCs. So, what are people supposed to do? Not buy their newer products, because there's no manual about how to use them? Does Rockchip not want people to buy new Rockchip SoCs? I really don't understand this.

Since this forum section is actually about new product wishes, I suggest, that Olimex writes and publishes an examplary tutorial about implementting SoC functionality support. Such a tutorial should mention the SoC user manual page, where the feature is described and should explain, how to use this information to implement a driver, that uses the feature. For example, if the SoC has hardware to support I2C, that is documented in its user manual, the tutorial should describe the implementation of a driver for that, that offers user software an abstract interface, to use this feature. I believe, if it were more widely known, how to do it, drivers for that feature for other SoCs would be available faster in the future. At present, there seems to be a lack of manpower, because people who know, how to do it, keep their knowledge for themselves (or are just to lazy to bother to write about it).

Of course, the tutorial should pick a feature, that is reasonably simple to describe in a tutorial. Adding USB support might not be a suitable feature, because a shitload of registers seems to require manipulation, which would appear to be a tedious, mechanical task, that would only obscure the actual nature of driver implementation, which shloud therefore be demonstrated on a simpler example.

So, @Olimex, please produce a tutorial! :)

BrianBrianBrian

I like the idea about tutorials, however I worry that Olimex does not have the manpower or money to do them.  Like JohnS implies, Olimex probably prefers to concentrate on developing hardware and rely on the open-source community to provide the software/tutorials.  Perhaps Olimex can step in and clarify their intentions/manifesto on this matter?

First, I just want to emphasize that my purpose for this thread is not to complain about the decisions of Olimex or Allwinner or Rockchip or any other business. 

Second, usually it would be an obvious decision (to me): if there is no vendor documentation for a vendor product then stay away.  However, it seems this is not really true anymore because when it comes to products that live in a vibrant open source community (embedded linux for example), the crowd-sourced documentation can often be of higher quality than the vendor's documentation.

Third, I felt that the Olimex forum was a great place for this discussion because there was a cross-section of people here who are working on TI/NXP/Atmel stuff vs AllWinner/Rockchip and thus could possibly provide valuable perspective and comparisons on the development experience.

Fourth, I have no ego when it comes to these matters.  So if turns out that I am just completely wrong I would be very thankful for any corrections.


JohnS

There are many many resources around the net on driver and kernel hacking, plus books, magazines, etc.  Those who really want to do such things generally put effort in to find them and of course that includes reading the sources and datasheets.

Some don't put much effort in and realistically are in effect choosing not to do those things.

I would not expect Olimex to provide any of the tutorials mentioned, though they are probably happy to host them if anyone posts such things.

A fair few people don't have any idea about interrupts, races, critical sections, writing solid code, following kernel rules, etc etc.  Yet there are books, tutorials, examples, etc if they put effort in...

Anyone who does is generally welcomed on IRC/ML/etc if they have sensible questions showing they know what they're talking about.

On SoC documentation in general, some is subject to NDA.  You may need to commit to buy 10,000 or 100,000 chips before you can even negotiate to get the NDA.

Such issues do not help with writing open source drivers.

John