Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp3104654pxk; Mon, 7 Sep 2020 03:23:54 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzi2OBjA5irUFxPPPoMw0c+37tIj2pSJBhGpaHf/55/QuPRQUGb9xEUMjWhytxHBri5kOiw X-Received: by 2002:a50:e004:: with SMTP id e4mr20800238edl.114.1599474233960; Mon, 07 Sep 2020 03:23:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1599474233; cv=none; d=google.com; s=arc-20160816; b=COAfpaNoCnxqyogTdzqBen/cpBkzQuEyJ9p16ELWpDUuCiOE8HA4kwY/C0knNx7rt7 XqOia2YLzrl0U2gkmm0iBga0aqG8WsvObqQGAPNoD4Dc9fp9Qoz+nzF3n0u0FUVOJ2yw N8JAt6IuDqh80B8PYag0BWCCguldtMOF2Hkb+dHGVFhYyS6DhWqoacUtpoBUvmHpsywL DX8Sk4LCds0vVDUJeWddvQOpe2NxNpxpGsbtxei7EmFDJtU4FXkS5IYvDDy0iseS7MO0 /BfffL0hVxYNkUi6Ml5hXsC3fPRtvUpfNIIBJfHMpUYYeSGG+6/MfCRsZ96j7Z19LBtM QBwg== 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=a6r4qRpyiPjYoazUXrGcYGUllitYhB0RC4eGKhazF9E=; b=t8M2joe0KVfiI3r/dHdM7Pi8JFyq/C+Q38Hxai8bAQOMjTlTTPlV/MEwUebBxJJN3a d2W3DtSamk9efoEYvRrv0hhnG9+LN2iotFHC79s7ET/7fExRofPAy4VIbs9Vzj3X3y91 OblGITT2XivW94IY2ZGU2loInJj6XU8mpqbIZM0LdipVVDGQYt+Ln2MrATqdCCuKKJzl xJ7JOv1m9m7X4bzxFt+cTlseqhKLrtWrddbKW3HSrDbNtjwfwK+zzMghLgwtylWFgEjb drKolLv2z3ZnCs6Bsl4QOJfEkiIk3lBMQX+nuExTmbPYq5uutB2ZO0WZKVI7sL5cjqN/ +mhg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@baylibre-com.20150623.gappssmtp.com header.s=20150623 header.b=VxIbSxKh; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id oy13si9565194ejb.481.2020.09.07.03.23.31; Mon, 07 Sep 2020 03:23:53 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@baylibre-com.20150623.gappssmtp.com header.s=20150623 header.b=VxIbSxKh; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728852AbgIGKVo (ORCPT + 99 others); Mon, 7 Sep 2020 06:21:44 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60580 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728795AbgIGKRB (ORCPT ); Mon, 7 Sep 2020 06:17:01 -0400 Received: from mail-wr1-x441.google.com (mail-wr1-x441.google.com [IPv6:2a00:1450:4864:20::441]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E78E9C061755 for ; Mon, 7 Sep 2020 03:16:59 -0700 (PDT) Received: by mail-wr1-x441.google.com with SMTP id z4so15213926wrr.4 for ; Mon, 07 Sep 2020 03:16:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=a6r4qRpyiPjYoazUXrGcYGUllitYhB0RC4eGKhazF9E=; b=VxIbSxKhSrWc+F+oc18qEnTOaZd41KDrz5frjSOA/RXEGtv8Rkpmq3MmHG5a3Ke2/6 qxO6UBZoWo74fLIBwgG12aBOvgWUFfo+dNHTaPST+7WpVEmKjhtqw/e7onJ5yiYoZR+Y oLzYytplhw+JUDu4TMDVxz59bsx5yUvNQUFh+wCbrAJs8wNSMSP0ADg5yqkMd/JHk4NW BT3MePh7FTSUT6DSBOvFRKhkY+G2S7YrM03g0hceBVZoyA8kGvIzPEyGKygq9Rx3jfEG tIZjBwOwQonMxWYr9Y5d4Lb5cNx7LfNmZVGq7BWtx05JuotJ7L7ctpDHxGMa789PGlXA TV9A== 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=a6r4qRpyiPjYoazUXrGcYGUllitYhB0RC4eGKhazF9E=; b=IzPfKpD45/sBEWbZnldd1oGDmWLoivXh9U/vB0PSp0jvZYZtaIIZV70bOMctPLvZRw C1b2Wd2UCLUYweqxIgm1jlz7bYqyYh6siCOLKPIzbjcyMUgMNCnnqIIcFEdnrhJ81+Qw /BBy3+SM4sR54FVMAqO9uHcCalREXKYB5iwTcnvWBYg6ppcaF4IseXJhR5VVUUIFOrUl d+KYms399nV8I2NcDec2h0O/+Bv35lcwdjNWijlDTkIkPgNuxOxh2hFc3QYlRAhp2a4c FeLGe/yXMOvllrMWrHEoU9IFWwLyaKH+SnvOnRF/u5WhJSrfrnr1Pp+Gz3V7KJsPTFkS xwrg== X-Gm-Message-State: AOAM530SzPTlcVovi/CNqH8TdRqFk3t8r2LKJEf+kmsXaXl6Lbu4f/7z /nrPHxWyWhcFHNbi4iW/fX9LEA== X-Received: by 2002:adf:e6c8:: with SMTP id y8mr22515101wrm.229.1599473818648; Mon, 07 Sep 2020 03:16:58 -0700 (PDT) Received: from localhost.localdomain (122.105.23.93.rev.sfr.net. [93.23.105.122]) by smtp.gmail.com with ESMTPSA id j7sm28728689wrw.35.2020.09.07.03.16.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 07 Sep 2020 03:16:58 -0700 (PDT) From: Fabien Parent To: iommu@lists.linux-foundation.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org Cc: joro@8bytes.org, robh+dt@kernel.org, matthias.bgg@gmail.com, yong.wu@mediatek.com, miles.chen@mediatek.com, Fabien Parent Subject: [PATCH v4 2/3] iommu/mediatek: add flag for legacy ivrp paddr Date: Mon, 7 Sep 2020 12:16:48 +0200 Message-Id: <20200907101649.1573134-2-fparent@baylibre.com> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20200907101649.1573134-1-fparent@baylibre.com> References: <20200907101649.1573134-1-fparent@baylibre.com> 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 Add a new flag in order to select which IVRP_PADDR format is used by an SoC. Signed-off-by: Fabien Parent Reviewed-by: Yong Wu --- v4: no change v3: set LEGACY_IVRP_PADDR as a flag instead of platform data v2: new patch --- drivers/iommu/mtk_iommu.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/iommu/mtk_iommu.c b/drivers/iommu/mtk_iommu.c index 785b228d39a6..b1f85a7e9346 100644 --- a/drivers/iommu/mtk_iommu.c +++ b/drivers/iommu/mtk_iommu.c @@ -116,6 +116,7 @@ #define OUT_ORDER_WR_EN BIT(4) #define HAS_SUB_COMM BIT(5) #define WR_THROT_EN BIT(6) +#define HAS_LEGACY_IVRP_PADDR BIT(7) #define MTK_IOMMU_HAS_FLAG(pdata, _x) \ ((((pdata)->flags) & (_x)) == (_x)) @@ -582,7 +583,7 @@ static int mtk_iommu_hw_init(const struct mtk_iommu_data *data) F_INT_PRETETCH_TRANSATION_FIFO_FAULT; writel_relaxed(regval, data->base + REG_MMU_INT_MAIN_CONTROL); - if (data->plat_data->m4u_plat == M4U_MT8173) + if (MTK_IOMMU_HAS_FLAG(data->plat_data, HAS_LEGACY_IVRP_PADDR)) regval = (data->protect_base >> 1) | (data->enable_4GB << 31); else regval = lower_32_bits(data->protect_base) | @@ -818,7 +819,8 @@ static const struct mtk_iommu_plat_data mt6779_data = { static const struct mtk_iommu_plat_data mt8173_data = { .m4u_plat = M4U_MT8173, - .flags = HAS_4GB_MODE | HAS_BCLK | RESET_AXI, + .flags = HAS_4GB_MODE | HAS_BCLK | RESET_AXI | + HAS_LEGACY_IVRP_PADDR, .inv_sel_reg = REG_MMU_INV_SEL_GEN1, .larbid_remap = {{0}, {1}, {2}, {3}, {4}, {5}}, /* Linear mapping. */ }; -- 2.28.0