On Tue, Nov 18, 2014 at 11:34:01AM +0000, Lee Jones wrote:
On Mon, 17 Nov 2014, Mark Brown wrote:
On Mon, Nov 17, 2014 at 12:54:33PM +0000, Richard Fitzgerald wrote:
On Mon, Nov 17, 2014 at 12:16:48PM +0000, Lee Jones wrote:
Looks like I was a little hasty with my comments. However 8000 lines over 4 platforms just to describe which registers are readable is all a little bit grim. Is there any way you can use ranges instead of listing every single register on the chip? How many gaps are there?
It's debatable. Ranges would be possible but there are a lot of gaps. Personally, speaking as someone who has to maintain these drivers, I like that fact that I can look at this file and see exactly which registers are readable and volatile because they are all explicitly listed. It's also useful that the files are searchable for specific registers.
I'll point Charles at this to get his opinion.
It's probably also worth pointing out that while ranges do compress the data a bit they make it harder to answer questions like "is this register mapped properly" since the question becomes "is the numeric value of this symbol between the numeric values of any of these other pairs of symbols we have listed here". I generally find it harder to review drivers using ranges since when checking that things are mapped voatile or whatever you have to do lookups like that.
Very well, thanks Mark and Charles.
How about we go back to my original idea then and chucking all of these massive tables into a nice header file in include?
I think perhaps the problem here is that because we group these all as "arizona" and the tables look similar, there's an assumption that they all share most of a core set of registers which we could factor out and be left with only a few trivial differences between chips. Actually the arizona platform is just a collection of IP blocks from which devices can be built, any device can contain any selection of these blocks. There's blocks that appear on most devices but nothing that could be called "core" set - even the shared blocks are actually slightly different across the different chips that use them. Also the address map is sparse to allow IP blocks to grow, or have different groups of registers on different chips, without having to move its address around, which is why ranges won't reduce the code size much.
There's a lot of similarity between the tables but also lots of differences. If we moved it to a header file it just means we move 8000+ lines from .c to .h and then the .c #includes them all back again.
In the end, these big files aren't aesthetically pleasing, but ease of maintenance is important and they aren't total duplicates.
-- Lee Jones Linaro STMicroelectronics Landing Team Lead Linaro.org │ Open source software for ARM SoCs Follow Linaro: Facebook | Twitter | Blog