
Dear Kumar Gala,
In message 7E86BC8F-7E3F-49B1-B1C5-B21991303AF5@kernel.crashing.org you wrote:
galak@kernel.crashing.org wrote:
+#ifdef CONFIG_FSL_NGPIXIS +#include "ngpixis.h" +#define PIXIS_VSYSCLK0 offsetof(struct ngpixis, sclk[0]) +#define PIXIS_VSYSCLK1 offsetof(struct ngpixis, sclk[1]) +#define PIXIS_VSYSCLK2 offsetof(struct ngpixis, sclk[2]) +#define PIXIS_VDDRCLK0 offsetof(struct ngpixis, dclk[0]) +#define PIXIS_VDDRCLK1 offsetof(struct ngpixis, dclk[1]) +#define PIXIS_VDDRCLK2 offsetof(struct ngpixis, dclk[2]) +#endif
Yuck. I specifically created the ngpixis_t structure because Wolfgang objected to the use of macros for offsets.
But I understand why you did it. It's the easiest way to maintain compatibility between pixis and ngpixis.
Wolfgang, is this an issue?
This, in itself, it not an issue.
The issue comes when you wrote code like this:
+ return ics307_clk_freq ( + in_8(pixis_base + PIXIS_VSYSCLK0), + in_8(pixis_base + PIXIS_VSYSCLK1), + in_8(pixis_base + PIXIS_VSYSCLK2) + ); +} + +unsigned long get_board_ddr_clk(void) +{ + u8 *pixis_base = (u8 *)PIXIS_BASE; + + return ics307_clk_freq ( + in_8(pixis_base + PIXIS_VDDRCLK0), + in_8(pixis_base + PIXIS_VDDRCLK1), + in_8(pixis_base + PIXIS_VDDRCLK2) + );
This clearly gets a NAK because you should use a struct, and not base address + offset notation.
The other option is have 3 different structs:
On p2020: #define PIXIS_VSYSCLK0 offsetof(struct ngpixis, > sclk[0]) on 8572: #define PIXIS_VSYSCLK0 0x1C on 8536: #define PIXIS_VSYSCLK0 0x1A
I see #defines here, no structs.
I'm not sure if you need different structs (haven't looked into these), or if clever notation of the struct is sufficient.
Best regards,
Wolfgang Denk