From mboxrd@z Thu Jan 1 00:00:00 1970 From: Troy Kisky Date: Wed, 28 Nov 2012 11:18:43 -0700 Subject: [U-Boot] [PATCH V4 01/11] imximage: mx53 needs transfer length a multiple of 512 In-Reply-To: <20121128092758.D8E4F20104E@gemini.denx.de> References: <1349315254-21151-9-git-send-email-troy.kisky@boundarydevices.com> <1354066303-29762-1-git-send-email-troy.kisky@boundarydevices.com> <1354066303-29762-2-git-send-email-troy.kisky@boundarydevices.com> <20121128092758.D8E4F20104E@gemini.denx.de> Message-ID: <50B65583.1070309@boundarydevices.com> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de On 11/28/2012 2:27 AM, Wolfgang Denk wrote: > Dear Troy Kisky, > > In message <1354066303-29762-2-git-send-email-troy.kisky@boundarydevices.com> you wrote: >> The mx53 ROM will truncate the length at a multiple of 512. >> Transferring too much is not a problem, so round up. > What about other SoCs using the same code? > >> +#define ALIGN(a, b) (((a) + (b) - 1) & ~((b) - 1)) > NAK. This macro is mis-named; it has nothing to do with alignment - > you write yourself: "round up". > > > And you don't have to re-invent the wheel. Please use the existing > macros for this purpose. > > Best regards, > > Wolfgang Denk > Oddly enough, I originally called it ROUND_UP. But then I saw these lines in include/common.h #define ALIGN(x,a) __ALIGN_MASK((x),(typeof(x))(a)-1) #define __ALIGN_MASK(x,mask) (((x)+(mask))&~(mask)) So, I deleted my definition of ROUND_UP and used ALIGN. But imximage.c did not automatically include common.h. Instead of trying to include common.h and all the files it pulled in, I added the ALIGN definition. Troy