From mboxrd@z Thu Jan 1 00:00:00 1970 From: Dirk Eibach Date: Tue, 07 May 2013 14:08:23 +0200 Subject: [U-Boot] [PATCH v2 06/10] powerpc/ppc4xx: Use generic FPGA accessors on all gdsys 405ep/ex boards In-Reply-To: <20130507113609.7D3F038119A@gemini.denx.de> References: <1367847325-21463-1-git-send-email-dirk.eibach@gdsys.cc> <1367847325-21463-7-git-send-email-dirk.eibach@gdsys.cc> <20130506141000.81015380E1C@gemini.denx.de> <20130506152259.E8260380E6C@gemini.denx.de> <449c45a6a9978c55e84d3fe7efe6f0ac@gdsys.cc> <20130506192356.7929A380E1C@gemini.denx.de> <20130507113609.7D3F038119A@gemini.denx.de> Message-ID: List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de Am 07.05.2013 13:36, schrieb Wolfgang Denk: > Dear Dirk Eibach, > > In message 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