Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp3397613yba; Mon, 29 Apr 2019 01:20:57 -0700 (PDT) X-Google-Smtp-Source: APXvYqxgSTMZ+lMXrULLXg68Sy9Kf7gsBaDT0+NlXtgN+de12KA9HEi/ut6C2vX7Ccyy50gdSSJR X-Received: by 2002:a17:902:8345:: with SMTP id z5mr7686536pln.255.1556526057858; Mon, 29 Apr 2019 01:20:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1556526057; cv=none; d=google.com; s=arc-20160816; b=nIEwKUVhmrPZ8b1mYhXnMRp+5WvP518vQrYk/k9Qnm9Y74fNeULHIeW4pCCyznpqNI 47K1Xi9C3SOx9OA/ejUxO8uJ+kTP7l+UEShDHLspqB376Zrya5oGlMMCPYdT8Q2mlD0O 7r24wWXa0Zk8GyeaAoLxKgQFwlEqwc84q4ZqvVAIfEF1efKmSUJXq1JhPzJRqexvaliY ZY3U/LbzAibenOSzyrAAym3QCMgALphpsXG1rwzEZ12IDpskWBk1pl9c9yPAP3hxclgh cX8ol4RBcX5v708bnQ+dwV8USipc4cBF2GfPrg/upl9au5M/kdIqy9jK3HO+GVcOMu+R 4FnQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from; bh=AMOBp0blDVArODlnRLWVscCFljYqQV/V+jNmmIKcR4o=; b=Wi80Y4GNIlghfbTdsL3WoCm4VmEeJ30NXXNJ4aeFhPjP7NWEiAsXhuP2XGHv8lP1DG jyWfvvFgjlaJwrp1+e+Tw+l6DJBJ1WsX55WA8sD8i4hE+6PL2CQtdsq4CU3hZaiy7Wsa U07BLd+AFHZ5komCaz713lTSFv4DDUYHEZXQLTpYd5Q0B7d6a7361Vm0DHcg81Pt/ktL gzOwEBwoSkPDMCvNchBrMHnUGiQTMJJc+PU3JY01CVul+9Mc/sPVS7kIqlVoGQ4pQVyu yyV3aJghRyqJvkYAuLUJSRfuHQvQ15aTuB9TgqyzP/d19SZ2LRwVMalN5HCwMIWl7C6E +X3Q== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id h8si33776361plb.282.2019.04.29.01.20.42; Mon, 29 Apr 2019 01:20:57 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727663AbfD2ITo (ORCPT + 99 others); Mon, 29 Apr 2019 04:19:44 -0400 Received: from michel.telenet-ops.be ([195.130.137.88]:42586 "EHLO michel.telenet-ops.be" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727531AbfD2ITo (ORCPT ); Mon, 29 Apr 2019 04:19:44 -0400 Received: from ramsan ([84.194.111.163]) by michel.telenet-ops.be with bizsmtp id 68Ki2000F3XaVaC068KiL0; Mon, 29 Apr 2019 10:19:42 +0200 Received: from rox.of.borg ([192.168.97.57]) by ramsan with esmtp (Exim 4.90_1) (envelope-from ) id 1hL1Vm-0000l4-2n; Mon, 29 Apr 2019 10:19:42 +0200 Received: from geert by rox.of.borg with local (Exim 4.90_1) (envelope-from ) id 1hL1Vm-0001yb-0Q; Mon, 29 Apr 2019 10:19:42 +0200 From: Geert Uytterhoeven To: Greg Ungerer , Angelo Dureghello Cc: Logan Gunthorpe , Arnd Bergmann , linux-m68k@lists.linux-m68k.org, linux-kernel@vger.kernel.org, Geert Uytterhoeven Subject: [PATCH] m68k: io: Fix io{read,write}{16,32}be() for Coldfire peripherals Date: Mon, 29 Apr 2019 10:19:37 +0200 Message-Id: <20190429081937.7544-1-geert@linux-m68k.org> X-Mailer: git-send-email 2.17.1 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The generic definitions of mmio_{read,write}{16,32}be() in lib/iomap.c assume that the {read,write}[wl]() I/O accessors always use little endian accesses, and swap the result. However, the Coldfire versions of the {read,write}[wl]() I/O accessors are special, in that they use native big endian instead of little endian for accesses to the on-SoC peripheral block, thus violating the assumption. Fix this by providing our own variants, using the raw accessors, reinstating the old behavior. This is fine on m68k, as no special barriers are needed, and also avoids swapping data twice. Reported-by: Angelo Dureghello Fixes: aecc787c06f4300f ("iomap: Use non-raw io functions for io{read|write}XXbe") Signed-off-by: Geert Uytterhoeven --- This can be reverted later, after this oddity of the Coldfire I/O support has been fixed, and drivers have been updated. --- arch/m68k/include/asm/io.h | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/arch/m68k/include/asm/io.h b/arch/m68k/include/asm/io.h index aabe6420ead2a599..d47e7384681ab1cd 100644 --- a/arch/m68k/include/asm/io.h +++ b/arch/m68k/include/asm/io.h @@ -8,6 +8,12 @@ #include #endif +#define mmio_read16be(addr) __raw_readw(addr) +#define mmio_read32be(addr) __raw_readl(addr) + +#define mmio_write16be(val, port) __raw_writew((val), (port)) +#define mmio_write32be(val, port) __raw_writel((val), (port)) + #include #endif /* _M68K_IO_H */ -- 2.17.1