Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754685AbdGUUjU (ORCPT ); Fri, 21 Jul 2017 16:39:20 -0400 Received: from mout.kundenserver.de ([217.72.192.74]:61774 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752091AbdGUUjT (ORCPT ); Fri, 21 Jul 2017 16:39:19 -0400 From: Arnd Bergmann To: Boris Brezillon , David Woodhouse , Brian Norris , Marek Vasut , Richard Weinberger , Cyrille Pitchen Cc: Arnd Bergmann , Jingoo Han , Simon Baatz , Masahiro Yamada , Arvind Yadav , linux-mtd@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH] mtd: orion-nand: fix build error with ARMv4 Date: Fri, 21 Jul 2017 22:38:06 +0200 Message-Id: <20170721203814.3363448-1-arnd@arndb.de> X-Mailer: git-send-email 2.9.0 X-Provags-ID: V03:K0:T6cYBdFcGzwg40/BBLK+W6XANHTn8xjpfsevEvlUtVW5ZkwEebZ +aGumXFvx+KHwRO60K699+Y3WKW1pm+bG0ySM742mHsh2b2Jbg2kty16E0xCpTrlgta0hg3 Eylu2P+QUqEqX+ZG1uyt5AjrSarUNZVgk836XVJB97WOWZBiCpFUhlNyrAHKVGibHX+vcwN 01PxfqS/z7nE/tqX6m+MA== X-UI-Out-Filterresults: notjunk:1;V01:K0:on7CUUZc8Zo=:h75WajUruFqyP3Uh2PAcZL bfQndnJeBcwPu9kA+P1s25D5hKF6ViWGCGSCHx9cui7pralQqjHwlabcfpRgQhq1kZg8Zgh3e vlZ2EQChgsK8cSGZEtOeZHBxeTF93kLkctutUSM0R0Cz001+gbtQdrASQDVR3QCn9X70UBoOp gGZwdkqWg8C2GZ1MAewH3qysuNHr3uesJmr8r32lScBEN8S5faOGwk68VDyfgSfL/nK5oWtQU rYMrcFYhykGeSbgg3TasEL80xk1GqsMl8IyN1NPaVeHDRFpKScavg0pS2uQHgsUDL6Tfstinc 0aqII0npxb74NcMSaELXDC43TAoeOcZ4Y8bWt+leWBlF8jUG06X6RFYJXsJ3IEWshjLiAiREU N1AGqNqsx7b1EoE69wzZpH3h0ffC9+ckSEKzg0v5ht1l9/QXya2PpQYOYF2JK8yEeBfY3RUan mYDNu7sxfksxrJPDlJQ8K1XHKyUHRwwg/xriQZFDk5jHRPWTgzB3lXYEjja9y+izBVT1vD3eV P7+cEDzGb7T+J2G7qjHMCoiOuMxvgf3UTzeyhyyXZWnQ3ed9cgDMmnXZA+mRG6Tef9GTjJ0zP +dM9cBxqOXLbTJHZq6NskEF+GZYQA7XTCkX1O2hVFYSkrVrp/ddLqay9QXaLkr9Cg9ge46Ke2 h/AZsbJMP6/CpzX+1izZNeS+Z9/9Hzdpc0P6xSvVp/LkPWDKW4TsJu966ioUhtu11uvQIvh1z JfC60zU4WjRZ3yD7Ux9x30eWTgFqfABNUn36Bw== Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1735 Lines: 56 orion_nand_read_buf uses an inline assembly with the "ldrd" instruction, which is only available from ARMv5 upwards. This used to be fine, since all users have an ARMv5 or ARMv7 CPU, but now we can also build a multiplatform kernel with ARMv4 support enabled in addition to the "kirkwood" (mvebu) platform. This provides an alternative to call the readsl() function that is supposed to have the same effect and is also optimized for performance. I first posted a version of this patch back in 2014, and there was some discussion about it then. This fixes the bugs identified back then and should be a reasonable alternative for the rare corner case. Link: https://patchwork.kernel.org/patch/4144791/ Cc: Jingoo Han Signed-off-by: Arnd Bergmann --- drivers/mtd/nand/orion_nand.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/drivers/mtd/nand/orion_nand.c b/drivers/mtd/nand/orion_nand.c index 209170ed2b76..41cb7acfc044 100644 --- a/drivers/mtd/nand/orion_nand.c +++ b/drivers/mtd/nand/orion_nand.c @@ -54,13 +54,16 @@ static void orion_nand_read_buf(struct mtd_info *mtd, uint8_t *buf, int len) { struct nand_chip *chip = mtd_to_nand(mtd); void __iomem *io_base = chip->IO_ADDR_R; +#if __LINUX_ARM_ARCH__ >= 5 uint64_t *buf64; +#endif int i = 0; while (len && (unsigned long)buf & 7) { *buf++ = readb(io_base); len--; } +#if __LINUX_ARM_ARCH__ >= 5 buf64 = (uint64_t *)buf; while (i < len/8) { /* @@ -74,6 +77,10 @@ static void orion_nand_read_buf(struct mtd_info *mtd, uint8_t *buf, int len) buf64[i++] = x; } i *= 8; +#else + readsl(io_base, buf, len/4); + i = len / 4 * 4; +#endif while (i < len) buf[i++] = readb(io_base); } -- 2.9.0