
Dear Reinhard Meyer,
In message 4C66EECA.5020509@emk-elektronik.de you wrote:
Have the first add that file, and the second assume it comes later in the sequence.
You don't mean by "sequence" PATCH 1/n, 2/n, etc? The drivers are so independent that that would not really make sense...
Then just write in the comment part of the second patch that the other one has to be applied first...
That's a thin line. Although I need only one register of the DBU (for example) I think its wise to define all registers in it, and not to _reserve[] the unused ones....
Right. If you add a function, add all the registers in it. But don't bother to explain each and every bit in the registers you never refer to, nor add completely unrelated blocks.
Anyway, is the method of (for example!)
#define DBU_ADDR 0xsomething (in a SoC header file)
dbu_t *dbu = (dbu_t *)DBU_ADDR; (in a function)
OK?
Yes.
Or do we need to further encapsulate that in a function like
No.
I was even thinking of something like
struct soc { u32 xyz[0x80]; /* XYZ unit */ u32 dbu[0x80]; /* Debug Unit */ u32 rstc[0x80]; /* Reset Controller */ and so on.
This is what PPC used to do; I like that - but ARM people always explained to me that it makes no sense because address space on ARM SoC is only sparely populated.
Then in a driver one could write dbu_t *dbu = (dbu_t *)soc.dbu; or something along that line
I think this looks nice, but as mentioned before - I'm not an ARM expert. They tend to do it differently.
Best regards,
Wolfgang Denk