Received: by 2002:a25:31c3:0:0:0:0:0 with SMTP id x186csp520508ybx; Fri, 1 Nov 2019 07:10:35 -0700 (PDT) X-Google-Smtp-Source: APXvYqwv8bsHVkeZ7+hWGdE03YqDQF2ydh0g7Wfn+UzoCRgkH7rtSfPyykrlzlmGA0ntXyKbW6Ys X-Received: by 2002:a50:ef0d:: with SMTP id m13mr12661732eds.210.1572617435442; Fri, 01 Nov 2019 07:10:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1572617435; cv=none; d=google.com; s=arc-20160816; b=SOyvLtKIQCoyP/mn4OwiGlCXeLo3TLLUcpVzOMbc2wKSjFrcPew4cvcCsN+WEsnxdg LUc9bvKfvnCKAq3xRUsQedQMM2/ORgZQQt8UR5tEDXHCneyb1J/TFRrcIvYnKWJ/PHF6 HSbU0Ko5y2oeHeHtG/zOK7QgPlHXXY+ZhkLjH9pvguT4D8Gof9/Dxqm6PQ1HQuKIm616 eP9WA8SzOR1Y5chwQwl1MRvlcxkLSV1feiwYk5+uLMVpMvMhAY1BRvPxWrdHZ6mMnd+Z 4oughO/9xUTQlPVPGsqYOPqA8VFJK0B67Y7DYYUgzRHvq80ahzMmZahPM4vjtdJIrO/D Dj2Q== 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=KoynnpqyM2T+oZqn3mX12olVYK6D1zjkp8rnCkTSUvs=; b=hq4Rhd1BFQxQZZLS/eHn2IGPXvuE+N9Zr7+gkQNi/wra9eT+eFZyUgr2dC8vF0vtEj +4KshZiLfk07GV0cRz0Fak8KDTUyRa2maSN5m+2/BOuIwDe76sDrSifEJ7lFwJRXwiQR SMrk/jHT+y5GoUJQ4Ds68+2EOHYqmodDisi10OviTAKDb621mZRfVKx1vynEAXlJhXuK xdsOBbmtYn8cDADmVcTXZY6Nbw+l4Lijew205cKyP29MNak8AnVobwbiucUtHKOGZojm hCIb/59sxzA3aE4nMewuSLdN2T8gmY2v481asdcyxBc8wb/+luP/Ktrld3vfln2o9cPU iIdg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@rasmusvillemoes.dk header.s=google header.b=CWGeGhOU; 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 t3si3249313eji.178.2019.11.01.07.09.57; Fri, 01 Nov 2019 07:10:35 -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; dkim=pass header.i=@rasmusvillemoes.dk header.s=google header.b=CWGeGhOU; 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 S1728334AbfKAMoi (ORCPT + 99 others); Fri, 1 Nov 2019 08:44:38 -0400 Received: from mail-lj1-f195.google.com ([209.85.208.195]:45125 "EHLO mail-lj1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730399AbfKAMmV (ORCPT ); Fri, 1 Nov 2019 08:42:21 -0400 Received: by mail-lj1-f195.google.com with SMTP id q64so10064510ljb.12 for ; Fri, 01 Nov 2019 05:42:20 -0700 (PDT) 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=KoynnpqyM2T+oZqn3mX12olVYK6D1zjkp8rnCkTSUvs=; b=CWGeGhOUOfo2AFIHEEWuQxqX6VgxVBh/BpU+Br3Rpgka1waa0SwWVNBeCQs/PMXHoc nHtviTJ9T/uF4Pe4nYXuFg75fgiMDaw7zOVyazH/cHqqL63Zxcj77cEruZHmjEpiZyhF uyTSYxXMbA0spLkqoYy6bZwn/qMlhBBcr9ce8= 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=KoynnpqyM2T+oZqn3mX12olVYK6D1zjkp8rnCkTSUvs=; b=WC9BUMW0ntmpB5fVgI5OPMOkgpKz51rJlGmSvzeeKi0YntavMj9Vm2IoV9TfzifazO LWhLemB48AkFRnkj9pbH4tbc4xiLmexI2+IYWSvLKS+mrJ4HqED75JHJ1+qXM5UEVWGc 99TqWwrwpiBAhvPFnHlPloA6ZA8p3yIgt07Slw6TCDcJ16vBgzvgurjNP7v+VnaBc5FX bgOfJ1u4eaTR7DqVKBjAJFMun0Plw1OWr9XKTns4D2v2Fyk+SuLsT+C0trQ0LJURUeCz nPntWnnELYW4i3XRKRUCaKAKFkSKWKugFiSsK8G72KoMLKhZkGCT4YKboJLwx/CySEDb PLkQ== X-Gm-Message-State: APjAAAU5pgdyxifNvP7MinFQOnsuVjOhmNtVR+jZdbPcxNQOJGikJVQ6 LlmZkCvFTp/3fjThTdv4VDnK/g== X-Received: by 2002:a2e:7204:: with SMTP id n4mr579072ljc.139.1572612139565; Fri, 01 Nov 2019 05:42:19 -0700 (PDT) Received: from prevas-ravi.prevas.se ([81.216.59.226]) by smtp.gmail.com with ESMTPSA id o26sm2458540lfi.57.2019.11.01.05.42.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 01 Nov 2019 05:42:19 -0700 (PDT) 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 , Rasmus Villemoes Subject: [PATCH v3 04/36] soc: fsl: qe: introduce qe_io{read,write}* wrappers Date: Fri, 1 Nov 2019 13:41:38 +0100 Message-Id: <20191101124210.14510-5-linux@rasmusvillemoes.dk> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20191101124210.14510-1-linux@rasmusvillemoes.dk> References: <20191018125234.21825-1-linux@rasmusvillemoes.dk> <20191101124210.14510-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. 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