Received: by 2002:a25:7ec1:0:0:0:0:0 with SMTP id z184csp6881993ybc; Thu, 28 Nov 2019 07:05:40 -0800 (PST) X-Google-Smtp-Source: APXvYqyTuEkL/+ac5sLLcePirG4XxAWsO12nEtwVASnmI2p4R+1BZnYGfunthYs8DCGFcFX3/nS5 X-Received: by 2002:a17:906:ae85:: with SMTP id md5mr8602036ejb.151.1574953540742; Thu, 28 Nov 2019 07:05:40 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1574953540; cv=none; d=google.com; s=arc-20160816; b=0EN2KPyb6LrFRwPK4aQbiTX4ncylPZ3+p6oKy58ihUfg8GxY50WP//AMUOa8UR8oeb xvMEiu9c5FF9Ns6OYwqCZogXMlmfDqM0HSJbukzRPVd85sUmPn/lSfWnzt864IhO4RXh xqBy+CasOOEGcG1tKoyWz50zBAgZTBPMjmzoVy4ytv7jQhCAtqCbOM9c9JCKbihwmB+L oeICo6ncFCgRix8JDw0U46s2YHDvEt6mSfWszI2O2L5AdgFC3Oqg/Qzv5uKmVWyq7FNt 5FYRjxQ5MUKLf1UHnKx+ktzc4yN8BmQqrHOHBOpAPC/s6lztKPpX7Q2adATHFUIf/lrA v7vw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=aHcxJAOlM2E0UFcUrH5w2LsmH/UDe+R/7sRutoa3dpE=; b=M23zhaLjzor/NgAmmqNkn/JW9czZrse5esGTZqWwztNAWk9NAHASgCCuQ82+2py51b a/x1ZG5w/pSGk6uUxFd5J6l4NJtJqBOyp3YOWfK1ZifSpWKcKoNaiKmniWf+Kk2ZIy9L nrPu4NK6sftKCBbZMOFRYDH8rvFG7BRIQyDWBD+8++jj0Rlprurw1ywYobCTolxwJ4mi njv7WkckCzOe8YKxLcmOD3VgYLdnMAkBabuD2/WJ786LDr/Fn4Fp/4bTi/qNGtJLv6Th 583qsVzaM/Tg3UDtS3gLGaPOFHCk8+qJ8wLFVxM++mp88HLrKQY7ZZBAvoHCo5mTFG/X HT5A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@rasmusvillemoes.dk header.s=google header.b=EUb+p9no; 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 v2si15654685ede.61.2019.11.28.07.05.12; Thu, 28 Nov 2019 07:05:40 -0800 (PST) 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; dkim=pass header.i=@rasmusvillemoes.dk header.s=google header.b=EUb+p9no; 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 S1727318AbfK1PAH (ORCPT + 99 others); Thu, 28 Nov 2019 10:00:07 -0500 Received: from mail-lj1-f196.google.com ([209.85.208.196]:35400 "EHLO mail-lj1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726876AbfK1O5L (ORCPT ); Thu, 28 Nov 2019 09:57:11 -0500 Received: by mail-lj1-f196.google.com with SMTP id j6so19824175lja.2 for ; Thu, 28 Nov 2019 06:57:10 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rasmusvillemoes.dk; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=aHcxJAOlM2E0UFcUrH5w2LsmH/UDe+R/7sRutoa3dpE=; b=EUb+p9no9foRs+pvYVwlrkYjz0fIfmXYCIjBTuSuxtOBtWIiWlYQ1uvB7/qAonIE1k K3i+BDhjX2g6iUXYxdzFfaU1TNKhMk2zUbebWU2iemsINp4YzlAnTuA+W9YPQqPaaqT5 oFbfA9tonS+865p0uSAYUJsqrcPYJt9uB6U/E= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=aHcxJAOlM2E0UFcUrH5w2LsmH/UDe+R/7sRutoa3dpE=; b=pgsrz9sK2pSK3XaJIXMMtAeX/m2jP2BwXHbyViDCgzopyCZs4s/12uDswl9fKXyt8+ yKkNNzX/0GtVW0BMg6M5bVG3fxPXaKCoEkVRjaimbSSxiGOz4yIz5zlbmdGM8dF4/g2t /rAxFF+BpdsA511cOeIZmm3/z0BrwUXwaCiAQVKABPHTJUr2ZMkt4jxD67rFQydBp8jM msSrojnp5t6xJ9nWbCU2CLZe2pEpd5TPHU4dwjXTvoBoB9qDQNQ2GqRvIKRKmpzfWauO 3CdsqOad9yS4yGW0xx5D7FnvA01ThkTmzIdKTuhs9F6kNM3B3lIoNB4a6+dGIlJ268IV IrSw== X-Gm-Message-State: APjAAAVBs2+SgvjIr0BIV4ACs7lu20254fzXmnrQPtkanc4r6oMe2iX7 xW6iVdtB0fExmt2WW68wSOcvkg== X-Received: by 2002:a2e:9985:: with SMTP id w5mr4973026lji.162.1574953029303; Thu, 28 Nov 2019 06:57:09 -0800 (PST) Received: from prevas-ravi.prevas.se ([81.216.59.226]) by smtp.gmail.com with ESMTPSA id u2sm2456803lfl.18.2019.11.28.06.57.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 28 Nov 2019 06:57:08 -0800 (PST) From: Rasmus Villemoes To: Qiang Zhao , Li Yang , Christophe Leroy Cc: linuxppc-dev@lists.ozlabs.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Scott Wood , Timur Tabi , Rasmus Villemoes Subject: [PATCH v6 04/49] soc: fsl: qe: introduce qe_io{read,write}* wrappers Date: Thu, 28 Nov 2019 15:55:09 +0100 Message-Id: <20191128145554.1297-5-linux@rasmusvillemoes.dk> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20191128145554.1297-1-linux@rasmusvillemoes.dk> References: <20191128145554.1297-1-linux@rasmusvillemoes.dk> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The QUICC engine drivers use the powerpc-specific out_be32() etc. In order to allow those drivers to build for other architectures, those must be replaced by iowrite32be(). However, on powerpc, out_be32() is a simple inline function while iowrite32be() is out-of-line. So in order not to introduce a performance regression on powerpc when making the drivers work on other architectures, introduce qe_io* helpers. Also define the qe_{clr,set,clrset}bits* helpers in terms of these new macros. Reviewed-by: Timur Tabi Signed-off-by: Rasmus Villemoes --- include/soc/fsl/qe/qe.h | 34 +++++++++++++++++++++++++--------- 1 file changed, 25 insertions(+), 9 deletions(-) diff --git a/include/soc/fsl/qe/qe.h b/include/soc/fsl/qe/qe.h index a1aa4eb28f0c..9cac04c692fd 100644 --- a/include/soc/fsl/qe/qe.h +++ b/include/soc/fsl/qe/qe.h @@ -241,21 +241,37 @@ static inline int qe_alive_during_sleep(void) #define qe_muram_offset cpm_muram_offset #define qe_muram_dma cpm_muram_dma -#define qe_setbits_be32(_addr, _v) iowrite32be(ioread32be(_addr) | (_v), (_addr)) -#define qe_clrbits_be32(_addr, _v) iowrite32be(ioread32be(_addr) & ~(_v), (_addr)) +#ifdef CONFIG_PPC32 +#define qe_iowrite8(val, addr) out_8(addr, val) +#define qe_iowrite16be(val, addr) out_be16(addr, val) +#define qe_iowrite32be(val, addr) out_be32(addr, val) +#define qe_ioread8(addr) in_8(addr) +#define qe_ioread16be(addr) in_be16(addr) +#define qe_ioread32be(addr) in_be32(addr) +#else +#define qe_iowrite8(val, addr) iowrite8(val, addr) +#define qe_iowrite16be(val, addr) iowrite16be(val, addr) +#define qe_iowrite32be(val, addr) iowrite32be(val, addr) +#define qe_ioread8(addr) ioread8(addr) +#define qe_ioread16be(addr) ioread16be(addr) +#define qe_ioread32be(addr) ioread32be(addr) +#endif + +#define qe_setbits_be32(_addr, _v) qe_iowrite32be(qe_ioread32be(_addr) | (_v), (_addr)) +#define qe_clrbits_be32(_addr, _v) qe_iowrite32be(qe_ioread32be(_addr) & ~(_v), (_addr)) -#define qe_setbits_be16(_addr, _v) iowrite16be(ioread16be(_addr) | (_v), (_addr)) -#define qe_clrbits_be16(_addr, _v) iowrite16be(ioread16be(_addr) & ~(_v), (_addr)) +#define qe_setbits_be16(_addr, _v) qe_iowrite16be(qe_ioread16be(_addr) | (_v), (_addr)) +#define qe_clrbits_be16(_addr, _v) qe_iowrite16be(qe_ioread16be(_addr) & ~(_v), (_addr)) -#define qe_setbits_8(_addr, _v) iowrite8(ioread8(_addr) | (_v), (_addr)) -#define qe_clrbits_8(_addr, _v) iowrite8(ioread8(_addr) & ~(_v), (_addr)) +#define qe_setbits_8(_addr, _v) qe_iowrite8(qe_ioread8(_addr) | (_v), (_addr)) +#define qe_clrbits_8(_addr, _v) qe_iowrite8(qe_ioread8(_addr) & ~(_v), (_addr)) #define qe_clrsetbits_be32(addr, clear, set) \ - iowrite32be((ioread32be(addr) & ~(clear)) | (set), (addr)) + qe_iowrite32be((qe_ioread32be(addr) & ~(clear)) | (set), (addr)) #define qe_clrsetbits_be16(addr, clear, set) \ - iowrite16be((ioread16be(addr) & ~(clear)) | (set), (addr)) + qe_iowrite16be((qe_ioread16be(addr) & ~(clear)) | (set), (addr)) #define qe_clrsetbits_8(addr, clear, set) \ - iowrite8((ioread8(addr) & ~(clear)) | (set), (addr)) + qe_iowrite8((qe_ioread8(addr) & ~(clear)) | (set), (addr)) /* Structure that defines QE firmware binary files. * -- 2.23.0