From mboxrd@z Thu Jan 1 00:00:00 1970 From: Marek Vasut Date: Fri, 17 Jul 2015 00:13:26 +0200 Subject: [U-Boot] [PATCH 1/4] sunxi: nand: Add basic sunxi NAND driver with DMA support In-Reply-To: <1437084735.2993.178.camel@freescale.com> References: <1437045915-25755-1-git-send-email-pzierhoffer@antmicro.com> <201507170006.29312.marex@denx.de> <1437084735.2993.178.camel@freescale.com> Message-ID: <201507170013.26956.marex@denx.de> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de On Friday, July 17, 2015 at 12:12:15 AM, Scott Wood wrote: > On Fri, 2015-07-17 at 00:06 +0200, Marek Vasut wrote: > > On Thursday, July 16, 2015 at 11:36:08 PM, Scott Wood wrote: > > > On Thu, 2015-07-16 at 23:26 +0200, Marek Vasut wrote: > > > > On Thursday, July 16, 2015 at 11:15:58 PM, Scott Wood wrote: > > > > > > > > [...] > > > > > > > > > > +/* temporary buffer in internal ram */ > > > > > > +#ifdef CONFIG_SPL_BUILD > > > > > > +/* in SPL temporary buffer cannot be @ 0x0 */ > > > > > > +unsigned char temp_buf[SPL_WRITE_SIZE] __aligned(0x10) > > > > > > __section(".text#"); +#else > > > > > > +/* put temporary buffer @ 0x0 */ > > > > > > +unsigned char *temp_buf = (unsigned char *)0x0; > > > > > > +#endif > > > > > > > > > > If 0x0 is the address of an SRAM, its address should be > > > > > symbolically defined. Also consider mapping it to a different > > > > > virtual address, to avoid potential compiler mischief. > > > > > > > > The DMA I believe accesses it via PA anyway, so mapping it elsewhere > > > > would only confuse everyone who's hacking on the driver. Just my 5 > > > > cents ;-) > > > > > > Hey, if it wakes people up to the fact that they ought to be using > > > virt_to_phys() (or better yet, something that distinguishes DMA > > > addresses from physical), great! :-) > > > > Not really useful here, but whatever. > > > > > And yes, people go on to do the same "everything is u32" crap in > > > non-platform- specific files. Just look at drivers/block/ahci.c. > > > > Errr, this file is platform specific. > > (I'm assuming that by "this file" you mean the sunxi file, not the ahci > file.) > > The point is that establishing good habits everywhere reduces the > likelihood of the bad habits migrating to places where things break. > > And no, I don't seriously expect my suggestion of remapping the virtual > address to be implemented, but GCC has been known to do all sorts of weird > stuff when it thinks it knows a NULL pointer is being dereferenced. OK, you have a point there. Best regards, Marek Vasut