From mboxrd@z Thu Jan 1 00:00:00 1970 From: Timur Tabi Date: Tue, 30 Mar 2010 13:42:45 -0500 Subject: [U-Boot] [PATCH v2] mpc86xx: set the DDR BATs after calculating true DDR size In-Reply-To: <582D759A-EECE-4F12-9DC2-DE114BF717A9@kernel.crashing.org> References: <1269959143-15581-1-git-send-email-galak@kernel.crashing.org> <582D759A-EECE-4F12-9DC2-DE114BF717A9@kernel.crashing.org> Message-ID: <4BB24625.3090004@freescale.com> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de Becky Bruce wrote: > At the very least, fix this comment to mention the problem with not > being able to map all the RAM as well, if you're going to leave it > that way. Isn't that what the comment already says? "region mapped by DBAT0" == "map all the RAM"? > Can you test a board with a strange amount of RAM (1.5GB, > or something), and see what happens with this patch? I really don't > like leaving things this way. I'm pretty sure that U-Boot will machine check during relocation. That's what the comment says. I haven't tried it though. I could probably set up bullwinkle later this week with 1.5GB and try it. >> +#define TO_BATU_BL(x) \ >> + (u32)((((1ull << __ilog2_u64((u64)x)) / (128 * 1024)) - 1) * 4) > > It's a nit, but can we change the *4 to << 2 ? I know most modern > compilers should optimize this, but I think it makes the code easier > to read and is logically more sensical, and if you've got to change > the patch, anyway, we might as well clean this up. I used a spreadsheet to help me figure out the algorithm, so I wouldn't say that << 2 is more sensical, but I don't really care either way. I don't see how it improves the readability, though. -- Timur Tabi Linux kernel developer@Freescale