Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp3005219yba; Sun, 28 Apr 2019 14:41:04 -0700 (PDT) X-Google-Smtp-Source: APXvYqyybRC9MXQxIz58QroYGlAXkcEXGzrhOy+FTWtRrcMVRkU+e8CS1aFCUvNCbaPd2aI6Mh8e X-Received: by 2002:a17:902:28ab:: with SMTP id f40mr41578281plb.297.1556487663935; Sun, 28 Apr 2019 14:41:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1556487663; cv=none; d=google.com; s=arc-20160816; b=Zr/G2AYQ7cwmVFq5HjwSFnCtZZNG+R5r+CTkpoZ5GD6CN14Z1EYHlMDGiLdXU3EH3c z2eDW3/x0qSuNjjB4z4589PvY5RiEbkcgci/XXO8piLHhJHc4C4SoX+V7oEy1jGqddi/ ptFiuKvVpdDyAUkVQ9rg9i7oKuGSm0BxFKrAOx9t8W3/wSI7X0ose2aJ4E5kTmVZtFYd 5TEtUbLKu9LbNQxd65zqv/s14+gdpTfywPUX/55rZymXaGJVyg3JtpKlWeBSC+PKWXGr 7a6hXMoot9hkIQcMhyQ6Vu+OrUn/P/UaDSPq7Z2gLqFExNweTIFhKNWAYUvcWj5v7T42 OmVA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=PnqF8Dtp+flDP5H9TP2AcXcWxkqTTmkbq8gal0T0aO4=; b=kzp8qqmWwAAGSkOt87fRXV3otgyJSSk/J1R6VfUZJh1E2/mpNe1BFva7WR/Ace/qfb gdkUjn9xknvjTfUCM8/LHOkhpfyjVlJGOMtYpEy7MkD6AMY/hi0mPfENC8U8/WYEcW1t iPG7ySEG3guP+BZLLuLgT/k86BKdBy1r1DDsLvGeoLBxZiYjoJe491NbD3vi+wPyRNkT bYvH/P6eUV9/N4eOu1/numrEHgcSrIT0f9fTO2J1vviVIvVyloowfvKaXcLln+eokH0n pu+bV9U4SswKAKzMNoYRiVv3ZKENJJyGMEiYLq4UbyidQ+CRPCIr1N4tOFbNQapGBBAG AXgQ== 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 a20si29376287pgw.465.2019.04.28.14.40.48; Sun, 28 Apr 2019 14:41:03 -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 S1726566AbfD1Vj6 (ORCPT + 99 others); Sun, 28 Apr 2019 17:39:58 -0400 Received: from ec2-18-194-220-216.eu-central-1.compute.amazonaws.com ([18.194.220.216]:33308 "EHLO sysam.it" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726393AbfD1Vj6 (ORCPT ); Sun, 28 Apr 2019 17:39:58 -0400 X-Greylist: delayed 513 seconds by postgrey-1.27 at vger.kernel.org; Sun, 28 Apr 2019 17:39:56 EDT Received: from localhost (localhost [127.0.0.1]) by sysam.it (Postfix) with ESMTP id E021E208A9; Sun, 28 Apr 2019 21:31:22 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at ip-172-31-46-226.eu-central-1.compute.internal Received: from sysam.it ([127.0.0.1]) by localhost (sysam.it [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id bX89ryN5tB7a; Sun, 28 Apr 2019 21:31:04 +0000 (UTC) Received: from jerusalem (host105-39-dynamic.47-79-r.retail.telecomitalia.it [79.47.39.105]) by sysam.it (Postfix) with ESMTPSA id E7C14208A6; Sun, 28 Apr 2019 21:31:03 +0000 (UTC) Date: Sun, 28 Apr 2019 23:31:02 +0200 From: Angelo Dureghello To: Arnd Bergmann Cc: Greg Ungerer , Geert Uytterhoeven , Logan Gunthorpe , Thomas Gleixner , Kate Stewart , Philippe Ombredanne , Greg KH , Linux/m68k , Linux-Arch , Linux Kernel Mailing List Subject: Re: endianness swapped Message-ID: <20190428213102.GA27051@jerusalem> References: <20190427153222.GA9613@jerusalem> <20190427202150.GB9613@jerusalem> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi all, On Sun, Apr 28, 2019 at 08:44:03PM +0200, Arnd Bergmann wrote: > 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. > Yes, this seems confirmed also from the drivers/dma/fsl-edma-common.h comment: /* * R/W functions for big- or little-endian registers: * The eDMA controller's endian is independent of the CPU core's endian. * For the big-endian IP module, the offset for 8-bit or 16-bit registers * should also be swapped opposite to that in little-endian IP. */ > > 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? > I can list those i worked on i2c-imx.c spi-fsl-dspi.c mcf-edma.c + fsl-edma.common.c now working on a sdhci-esdhc-mcf.c And about mcf5441x, some other drivers as usb or probably can have still to be enabled/mainlined. > 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 Regards, Angelo