From: Jens Scharsig Date: Thu, 29 Oct 2009 08:40:23 +0100 Subject: [U-Boot] [PATCH] ARM AT91 new board EB+CPUx9K2 In-Reply-To: <20091028143524.B7AD7E916D6@gemini.denx.de> References: <4AE6B186.9030301@bus-elektronik.de> <20091027110234.A0787E916D5@gemini.denx.de> <20091027183506.20010E916D5@gemini.denx.de> <4AE81893.30506@bus-elektronik.de> <20091028143524.B7AD7E916D6@gemini.denx.de> Message-ID: <4AE946E7.4050404@bus-elektronik.de> 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 Denk >> writel(AT91C_PA23_TXD2, AT91C_PIOA_OER); >> >> is the most correct way. > > "most correct way" are big words. No, this is not "correct" at all. > > The whole set of address / offset definitions in > include/asm-arm/arch-at91rm9200/AT91RM9200.h should be turned into a C > struct. I've got you misunderstood, what real pointer variable means. If I understand you correctly now? The train goes in the opposite direction. in the AT91RM9200.h a port is defined as typedef struct _AT91S_PIO { ... AT91_REG PIO_OER; /* Output Enable Register */ ... } AT91S_PIO, *AT91PS_PIO; and #define AT91C_BASE_PIOC ((AT91PS_PIO) 0xFFFFF800) So the access should be AT91PS_PIO pioa = AT91C_BASE_PIOA; ... writel(AT91C_PA23_TXD2, &pioa->PIO_OER); or writel(AT91C_PA23_TXD2, &AT91C_BASE_PIOA->PIO_OER); instead of writel(AT91C_PA23_TXD2, ((AT91PS_PIO) AT91C_BASE_PIOA)->PIO_OER) or writel(AT91C_PA23_TXD2, AT91C_PIOA_OER) The result, if all the board are adjusted, it can be removed individual register definitions like #define AT91C_PIOD_OWER ((AT91_REG *) 0xFFFFFAA0) I'm right? Best regards, Jens Scharsig