Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp3706322imm; Mon, 18 Jun 2018 02:40:50 -0700 (PDT) X-Google-Smtp-Source: ADUXVKJ0iKdNICrJMCvzBSh3JbCn0cHUz41HqZOMCT6mOS4W9zGqNlNXVd9sQUV0BNWehvVLMpno X-Received: by 2002:a17:902:7c16:: with SMTP id x22-v6mr12986329pll.77.1529314850396; Mon, 18 Jun 2018 02:40:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1529314850; cv=none; d=google.com; s=arc-20160816; b=Cqoqksdf9OMsJ/RDnU558B2BAKXjkLVR9WnsBtDIeorMCMGw4sQKOZj5mLJxrAle0H MpkApmtEqIk385c80duUf6yn9Kcc67z/IuocSrTrpGivk56j+PaCIYJgX6Tj0EmMR9+h fZNg9jZFqWYUORg2ay+9fEuRz02/bvXksl9AsNDIasrCCE8Ar27gMrYVhvCqCbbaZCoa +wTop3wcKjY42tt8V1rllSzAloXjIPYW/dUhvFHTwM7xOydEON6x8b8vuoQ79VG876f7 +3pBkY1PCfsntXeZxcK8botazP+QX3NFWNwDN6z1n98jHpsSGPH3uFxUQMh8Qi4g1Ke1 /4bQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-language :content-transfer-encoding:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:arc-authentication-results; bh=AjAMo8PBVtQ+/3IE9XXOf7KBDAPIDYVlhaz6LcYdvRU=; b=FVTUOWj3m3sgGFQpSImISnN3dcRZDjrBcI4DP8Vh9OyH9sunleSiRfjtcQwrglZrl0 u5fgIQBH2RKwVT5KCX5cF7QJXa/queBwRa9mUeraNsXhbgTEIsvUToBGoHCUQ4RY8wBo HukfKXVPGbut72Rea5hHlaNUzikTbUmtbdOR5YqbtmplkRzvSriXeEsCTQ0wxD7gNr5j qmbp8ToWu2Cgf0k1DcZev4+Oe6A69ZLzxEbNDRjnadNo4OfgAms1Hym9zqLkTD6lMQ94 nss0QOhr+k1CSvtsoj8z/eNTJ1+6SqeEYb/s1NzgkWydh9VuO2UBu43kyAwQjz97jp/U 5mEw== 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id h71-v6si14199677pfe.332.2018.06.18.02.40.37; Mon, 18 Jun 2018 02:40:50 -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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S936014AbeFRJkD (ORCPT + 99 others); Mon, 18 Jun 2018 05:40:03 -0400 Received: from mga09.intel.com ([134.134.136.24]:61495 "EHLO mga09.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755259AbeFRJj7 (ORCPT ); Mon, 18 Jun 2018 05:39:59 -0400 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by orsmga102.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 18 Jun 2018 02:39:58 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.51,238,1526367600"; d="scan'208";a="58488512" Received: from songjunw-mobl1.ger.corp.intel.com (HELO [10.226.39.15]) ([10.226.39.15]) by fmsmga002.fm.intel.com with ESMTP; 18 Jun 2018 02:39:54 -0700 Subject: Re: [PATCH 4/7] tty: serial: lantiq: Always use readl()/writel() To: Arnd Bergmann Cc: hua.ma@linux.intel.com, yixin.zhu@linux.intel.com, chuanhua.lei@intel.com, "open list:RALINK MIPS ARCHITECTURE" , qi-ming.wu@intel.com, linux-clk , linux-serial@vger.kernel.org, DTML , James Hogan , Jiri Slaby , Linux Kernel Mailing List , Greg Kroah-Hartman , Ralf Baechle References: <20180612054034.4969-1-songjun.wu@linux.intel.com> <20180612054034.4969-5-songjun.wu@linux.intel.com> From: "Wu, Songjun" Message-ID: Date: Mon, 18 Jun 2018 17:39:53 +0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.3.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Content-Language: en-US Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 6/14/2018 6:07 PM, Arnd Bergmann wrote: > On Tue, Jun 12, 2018 at 7:40 AM, Songjun Wu wrote: >> Previous implementation uses platform-dependent functions >> ltq_w32()/ltq_r32() to access registers. Those functions are not >> available for other SoC which uses the same IP. >> Change to OS provided readl()/writel() and readb()/writeb(), so >> that different SoCs can use the same driver. >> >> Signed-off-by: Songjun Wu > Are there any big-endian machines using this driver? The original definition > of ltq_r32() uses non-byteswapping __raw_readl() etc, which suggests > that the registers might be wired up in a way that matches the CPU > endianess (this is usally a bad idea in hardware design, but nothing > we can influence in the OS). > > When you change it to readl(), that will breaks all machines that rely > on the old behavior on big-endian kernels. > > Arnd It will not break existing big-endian SoC as SWAP_IO_SPACE is disabled. Disable SWAP_IO_SPACE will not impact ltq_r32 as it uses non-byte swapping __raw_readl() and it makes readl work in big-endian kernel too. The old Lantiq platform enable SWAP_IO_SPACE to support PCI as it's a little-endian bus plus PCI TX/RX swap enable impacted both data and control path. Alternatively PCI device driver has to do endian swap, It is better to let PCI device driver to do endian swap instead because SWAP_IO_SPACE is global wide macro. Once we set it, other peripheral such as USB has to change its register access as well