Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp2901638yba; Sun, 28 Apr 2019 11:48:51 -0700 (PDT) X-Google-Smtp-Source: APXvYqxAwsaU9MG1aV1CO/ZjOYA7J+TxbF9NpGC8dgmaGedy46QUKbaiVAokFHhnCOyXB2Vgt2LO X-Received: by 2002:a62:5885:: with SMTP id m127mr24884822pfb.33.1556477331126; Sun, 28 Apr 2019 11:48:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1556477331; cv=none; d=google.com; s=arc-20160816; b=VzIpk/jhJ7hi4LJPBYc+tIz9f0rIwH0w/yaG+YZcdns46vSxWMm9+s56pz2EMW48db CrRfkH4ueKvxamXt6zIonxHxdJYPPpNMjMVxUQdAPmkiFuxoMekl6mNfOMwcxMtGw1Is TwkTueXLkfFiBCvAYs+mZIhfW6mQY1rb177wZeq36mapaZju/T6YaQy5wuV5Rnl+8ulb u0FXRQDn6vg1o1PrUczRooNx4KyyatbEuLJ4EHWdvQ+udNEfTBKkYt5gMnxiE0WDlb8+ 77MxQgpxC7i2se1FHpYrZfYPH/TNAw0YTHyc531ARHcWaU9rCvHdJ/aWmbuMSBaEfePb DRbw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version; bh=2qIZb4MEtnuaQO412PRiKeuotlIUz5RFI6XjQg/gCwk=; b=iERhsuMBahMT3SwlhQSoir1Rls19x9be7qQQnIRi9PpiqLM35yRpUjG1aSEi0xeKn8 lSol9nwbhDf0lZVhQw5FiybUk7FnhAfHrSPaUyQT5bDVC2gu+fOSA3qW1a6GMqp63NSc +WCLKv43jra0SrpB4PPekXji1ORgPGMtLdgROCgSrGPN1lk0TBFZWiNyNzp1SLgZSe80 EnGTuLwi0KSibxFy/MjOwiIe6dkkP5GRs0OinhIGrdT67hT7cJzcv1BUTcG7pcRiYsB1 0V7OGig2jNq6O6JUtOG3LeQaEe3D6jUOTC3RkYd5jCSfuH6LIGG4Yl2sUK/6bak8ehGz 7wXg== 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 o123si33345269pfb.116.2019.04.28.11.48.25; Sun, 28 Apr 2019 11:48:51 -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 S1727159AbfD1SoV (ORCPT + 99 others); Sun, 28 Apr 2019 14:44:21 -0400 Received: from mail-qt1-f196.google.com ([209.85.160.196]:41246 "EHLO mail-qt1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726299AbfD1SoV (ORCPT ); Sun, 28 Apr 2019 14:44:21 -0400 Received: by mail-qt1-f196.google.com with SMTP id f25so9643968qtc.8; Sun, 28 Apr 2019 11:44:20 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=2qIZb4MEtnuaQO412PRiKeuotlIUz5RFI6XjQg/gCwk=; b=rt1upsKIz0+BHjI1Uv5p9nPm8EY14iETDOi0HgPreITuBSyRxhgFkzzeDqxYz05iAE Tf/pbl9qjQXK9iM6TyFuH15KgDc5o6rEP7edXdJ/DuPs1G1APDeLxPl9q4DOxhQTRxOl 0sNApjegfxiHeHVtyrDmPLuFT+wCGCrD/tXl/FgmuDExVxvxsRqnWBrzeubY1YRQH0yr UewER1zN4vzrYQ4BjWo2f30+ZZTc+NGUnKZUZu74x70NoAU3wgLNz1Q1+6wFKG1FuP4U NL3spbhiY7Dl/97Ko+Bi7HUCPF63UftzTZTom7J8S/ktV+vVRcEjNonR+Vs8lGQuRLW/ Ni2g== X-Gm-Message-State: APjAAAWpGkkhef/BIR/6B9u68SZPc/U+ImMQPVHUknmWPlp6LlT4GRmO nX+QjjHbhqAN13zRUNUXkk/Ioaj9Jqqu1QRgIBHD88KfOw4= X-Received: by 2002:ac8:2924:: with SMTP id y33mr44874396qty.212.1556477060147; Sun, 28 Apr 2019 11:44:20 -0700 (PDT) MIME-Version: 1.0 References: <20190427153222.GA9613@jerusalem> <20190427202150.GB9613@jerusalem> In-Reply-To: From: Arnd Bergmann Date: Sun, 28 Apr 2019 20:44:03 +0200 Message-ID: Subject: Re: endianness swapped To: Greg Ungerer Cc: Geert Uytterhoeven , Angelo Dureghello , Logan Gunthorpe , Thomas Gleixner , Kate Stewart , Philippe Ombredanne , Greg KH , "Linux/m68k" , Linux-Arch , Linux Kernel Mailing List Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sun, Apr 28, 2019 at 3:59 PM Greg Ungerer wrote: > On 28/4/19 7:21 pm, Arnd Bergmann wrote: > > On Sun, Apr 28, 2019 at 10:46 AM Geert Uytterhoeven > > wrote: > >> On Sat, Apr 27, 2019 at 10:22 PM Angelo Dureghello wrote: > >>> On Sat, Apr 27, 2019 at 05:32:22PM +0200, Angelo Dureghello wrote: > > > > Coldfire makes the behavior of readw()/readl() depend on the > > MMIO address, presumably since that was the easiest way to > > get drivers working originally, but it breaks the assumption > > in the asm-generic code. > > Yes, that is right. > > There is a number of common hardware modules that Freescale have > used in the ColdFire SoC parts and in their ARM based parts (iMX > families). The ARM parts are pretty much always little endian, and > the ColdFire is always big endian. The hardware registers in those > hardware blocks are always accessed in native endian of the processor. In later Freescale/NXP ARM SoCs (i.MX and Layerscape), we also get a lot of devices pulled over from PowerPC, with random endianess. In some cases, the same device that had big-endian registers originally ends up in two different ARM products and one of them uses big-endian while the other one uses little-endian registers. > So the address range checks are to deal with those internal > hardware blocks (i2c, spi, dma, etc), since we know those are > at fixed addresses. That leaves the usual endian swapping in place for > other general (ie external) devices (PCI devices, network chips, etc). Is there a complete list of coldfire on-chip device drivers? Looking at some of the drivers: - drivers/i2c/busses/i2c-imx.c uses only 8-bit accesses and works either way, same for drivers/tty/serial/mcf.c - drivers/spi/spi-coldfire-qspi.c is apparently coldfire-only and could use ioread32be for a portable to do big-endian register access. - edma-common has a wrapper to support both big-endian and little-endian configurations in the same kernel image, but the mcf interrupt handler is hardcoded to the (normally) little-endian ioread32 function. - drivers/net/ethernet/freescale/fec_main.c is shared between coldfire and i.MX (but not mpc52xx), and is hardcoded to readl/writel, and would need the same trick as edma to make it portable. Arnd