From mboxrd@z Thu Jan 1 00:00:00 1970 From: Tom Rini Date: Fri, 14 Mar 2014 14:59:46 -0400 Subject: [U-Boot] [PATCH v1 3/9] sunxi: initial sun7i dram setup support In-Reply-To: <53233B26.2070904@gmail.com> References: <1394793212.13270.89.camel@hastur.hellion.org.uk> <1394793231-11922-3-git-send-email-ijc@hellion.org.uk> <20140314141707.GG16360@bill-the-cat> <53233B26.2070904@gmail.com> Message-ID: <20140314185946.GR16360@bill-the-cat> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de On Fri, Mar 14, 2014 at 12:23:50PM -0500, Alex G. wrote: > -----BEGIN PGP SIGNED MESSAGE----- > Hash: SHA1 > > On 03/14/2014 09:17 AM, Tom Rini wrote: > > On Fri, Mar 14, 2014 at 10:33:45AM +0000, Ian Campbell wrote: > > > > [snip] > >> +static void mctl_ddr3_reset(void) +{ + struct sunxi_dram_reg > >> *dram = + (struct sunxi_dram_reg *)SUNXI_DRAMC_BASE; + + { + > >> clrbits_le32(&dram->mcr, DRAM_MCR_RESET); + udelay(2); + > >> setbits_le32(&dram->mcr, DRAM_MCR_RESET); + } > > > > That seems like an odd construction, why the extra braces? > > > This originally had a conditional depending on the SoC family. (Yeah, > they need to reset the ram differently). It seems it wasn't removed > properly. > > > And as for the rest of the code, lots of magic numbers to #define > > what/why (why udelay(2) and 22?) > > > Before going into more detail, remember this is ram initialization > code. That's always going to be a pain :(. > There's nothing magic here. It's just a fact of life. Every step is > going to need a different delay. No need to bloat the headers by > #defining each. It also makes raminit code more unreadable. > > We got these numbers from allwinner code dumps. We used to have these > as sdelay() numbers, which usually meant units of 2 clock cycles. So > we had to convert them to udelay() to at least make the delays > independent of CPU clock. The old sdelay() numbers made no sense either. Yeah, I can accept a certain amount of black magic here. We need to make sure things are commented as much as it can be. -- Tom -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 836 bytes Desc: Digital signature URL: