From mboxrd@z Thu Jan 1 00:00:00 1970 From: Magnus Lilja Date: Mon, 18 May 2009 18:59:18 +0200 Subject: [U-Boot] [PATCH 01/10] mx27: basic cpu support In-Reply-To: <20090514094212.2E760832E416@gemini.denx.de> References: <1241634633-13917-1-git-send-email-yanok@emcraft.com> <1241634633-13917-2-git-send-email-yanok@emcraft.com> <20090506211604.289C483420E8@gemini.denx.de> <4A0B4F9A.8030503@emcraft.com> <20090514081007.AF05C832E416@gemini.denx.de> <4A0BE30F.9070902@emcraft.com> <20090514094212.2E760832E416@gemini.denx.de> Message-ID: <59b21cf20905180959p4e736d52g566b0e826e17c07a@mail.gmail.com> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de Dear Wolfgang, 2009/5/14 Wolfgang Denk : >> I see. PowerPC in Linux uses C structs too. But there are still a lot of >> code that uses registers offsets in Linux, so my arguments are the same: >> requirement to convert offsets to C struct brings additional >> difficulties to porting (and maintaining already ported) drivers from Linux. > > I understand your argument, but the decision has been made. We want to > get rid of this pointer stuff in U-Boot, and do not accept any new > code like this any more. After having browsed some powerpc code I can find two different ways the struct-thing is used: Variant A, all members declared volatile: struct controller_reg { volatile uint32_t reg1; volatile uint32_t reg2; } struct controller_reg *controller = 0xCAFE0000; Or variant B: struct controller_reg { uint32_t reg1; uint32_t reg2; } volatile struct controller_reg *controller = 0xCAFE0000; Also, is it OK to access the registers using reg = controller->reg1 or should we use reg = readl(&controller->reg1)? I ask this since I don't want to iterate the patches on the mailing list too many times... Regards, Magnus