Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752153AbbEFTSH (ORCPT ); Wed, 6 May 2015 15:18:07 -0400 Received: from mout.kundenserver.de ([212.227.126.187]:50504 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750965AbbEFTRt (ORCPT ); Wed, 6 May 2015 15:17:49 -0400 From: Arnd Bergmann To: Brian Norris Cc: linux-mtd@lists.infradead.org, Dmitry Torokhov , Anatol Pomazao , Ray Jui , Corneliu Doban , Jonathan Richardson , Scott Branden , Florian Fainelli , =?utf-8?B?UmFmYcWCIE1pxYJlY2tp?= , bcm-kernel-feedback-list@broadcom.com, Dan Ehrenberg , Gregory Fong , devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, Kevin Cernekee Subject: Re: [PATCH v3 03/10] mtd: nand: add NAND driver for Broadcom STB NAND controller Date: Wed, 06 May 2015 21:17:36 +0200 Message-ID: <2114576.uWbXPVDdyI@wuerfel> User-Agent: KMail/4.11.5 (Linux/3.16.0-10-generic; KDE/4.11.5; x86_64; ; ) In-Reply-To: <1430935194-7579-4-git-send-email-computersforpeace@gmail.com> References: <1430935194-7579-1-git-send-email-computersforpeace@gmail.com> <1430935194-7579-4-git-send-email-computersforpeace@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" X-Provags-ID: V03:K0:CY+Fe/OEIMO3xBfDBF7u7BcON3Gz4XWl3FRIt83v4cuyR6GsQeg sTW7DbItvLAqaOiDVUdigV2SXzXUeE14ipBC9QjlZogf1gcjRu68K4vfqBlsw9oqS4KKi7c lnfwygMz61Vw36G/bYkrZDxXINaYIVtrQSwZae/iFyuyT5H3EFvY8MCewHaJoknJUkvNeGj HYGACg6i9k7PyFKvoIqpw== X-UI-Out-Filterresults: notjunk:1; Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1364 Lines: 33 On Wednesday 06 May 2015 10:59:47 Brian Norris wrote: > + > +static inline u32 nand_readreg(struct brcmnand_controller *ctrl, u32 offs) > +{ > + return __raw_readl(ctrl->nand_base + offs); > +} > + > +static inline void nand_writereg(struct brcmnand_controller *ctrl, u32 offs, > + u32 val) > +{ > + __raw_writel(val, ctrl->nand_base + offs); > +} > + > You had mentioned previously that there might be an endianess issue in this driver. I think this won't work on big-endian architectures other than MIPS, so it would be good to either list in the DT the endianess of the device and use appropriate accessors here, or hardcode it based on the architecture (using ioread32_be in big-endian mips, but readl elsewhere). Using __raw_writel has another problem regarding the DMA capability of this driver, as it will not flush any write buffers or synchronize caches before sending data off to the device, so you risk data corruption. Also, the compiler can choose to split up the 32-bit word access into byte accesses, which on most hardware does not do what you want. Arnd -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/