[U-Boot] [PATCH v2 06/10] powerpc/ppc4xx: Use generic FPGA accessors on all gdsys 405ep/ex boards

Dirk Eibach dirk.eibach at gdsys.cc
Tue May 7 14:08:23 CEST 2013



Am 07.05.2013 13:36, schrieb Wolfgang Denk:
> Dear Dirk Eibach,
> 
> In message <cf2913653766edc89705f49e08758df7 at gdsys.cc> you wrote:
>> 
>>> OK - but I don't see why mclink_send() could not be used in the same
>>> way, i. e. taking a struct member as argument?
>> 
>> Certainly it *can* be used using *pointers* to struct members as
>> argument.
>> 
>> What I stated yesterday was:
>> "We have FPGAs that are memory mapped and others that are not. They
>> must be accessed by the same drivers. So the alternative would be to
>> create FPGA instances at address NULL and getting the register 
>> offesets
>> by casting pointers to u16. Not very nice either."
> 
> Yes, you wrote that.  I did not understand it then, nor do I
> understand it now.  What do you mean by "create FPGA instances at
> address NULL"?  in any case, "getting the register offsets by casting
> pointers to u16" makes no sense, as this is exactly what we try to
> avoid.  By referencing a C struct you do NOT use any offsets.  You use
> references to struct elements; where needed, you let the compiler to
> the address calculations (and the type checking).
> 
> No offsets. No casts.

OK. Once more. 3 of our 4 FPGAs are *not* memory mapped. There is no 
base address. This is what I want to show by:
>>    struct ihs_fpga system_fpgas[] = {
>> 	(struct ihs_fpga *)CONFIG_SYS_FPGA_BASE(0),
>> 	(struct ihs_fpga *)NULL,
>> 	(struct ihs_fpga *)NULL,
>> 	(struct ihs_fpga *)NULL,
>>    };

For accessing registers of those (not memory mapped) FPGAs I need an 
u16 register-index. That is what I want to show by:
>> mclink_send(fpga - 1, (u16)addr, data);

This is the cast I am talking about.

This is the reason why I still need the fpga index parameter.

Cheers
Dirk



More information about the U-Boot mailing list