From mboxrd@z Thu Jan 1 00:00:00 1970 From: Hans de Goede Date: Fri, 19 Dec 2014 17:56:40 +0100 Subject: [U-Boot] [PATCH 11/14] sunxi: Fill memory before comparing it when doing dram init on sun6i In-Reply-To: <20141219120844.6255d87c@i7> References: <1418761900-14035-1-git-send-email-hdegoede@redhat.com> <1418761900-14035-11-git-send-email-hdegoede@redhat.com> <1418929933.26985.106.camel@hellion.org.uk> <20141219120844.6255d87c@i7> Message-ID: <549458C8.8040506@redhat.com> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de Hi, On 19-12-14 11:08, Siarhei Siamashka wrote: > On Thu, 18 Dec 2014 19:12:13 +0000 > Ian Campbell wrote: > >> On Tue, 2014-12-16 at 21:31 +0100, Hans de Goede wrote: >>> The sun8i boot0 code fills the DRAM with a "random" pattern before comparing >>> it at different offsets to do columns, etc. detection. The sun6i boot0 code >>> does not do it, but it seems like a good idea to do this regardless. >> >> Is this the right way round? The existing sun6i code (which you are >> moving here) seems to _rely_ on something having written a useful >> pattern, which I would have assumed to have been boot0. Or else how does >> it work now? Chance? > > It appears that this code is just trying to find the first address line, > which is not connected anywhere. If the address line is not connected, > then having the corresponding bit set or clear in the memory address > does not matter and we are effectively accessing the same location. Correct. > Both sun6i and sun8i code is incorrect and only works because of relying > on luck. > > The sun6i code is incorrect because it is just reading memory without > initializing it at all. Probably relying on having some unique garbage > there in a natural way. > > The newer sun8i code is still incorrect because it is not safeguarding > against accidentally encountering the same test pattern at an unrelated > memory location. Yes, the probability is extremely low, but still not > zero. The probability is so low that it really does not matter, so I've no intention to fix this. Regards, Hans