Received: by 2002:a05:7412:98c1:b0:fa:551:50a7 with SMTP id kc1csp966851rdb; Sat, 6 Jan 2024 19:23:10 -0800 (PST) X-Google-Smtp-Source: AGHT+IHkER+8fFPKFSh17ySovMeMyWPHXM3hQCiA9WigoRnf0Bs1VfFqX16tJ/j4+cPw96rpDMEa X-Received: by 2002:a05:600c:3b07:b0:40b:5e21:cc27 with SMTP id m7-20020a05600c3b0700b0040b5e21cc27mr859378wms.82.1704597790059; Sat, 06 Jan 2024 19:23:10 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1704597790; cv=none; d=google.com; s=arc-20160816; b=O8jn0jRebvLx//gEOggujGX1a8n6fRXlt70arxKkqujfhD8zU4GHaJxBje20h8Mf5X DPbR1UOy4xgz+WZXhtnY5iMvXIKxvEBOwz+4+kQw/oUs9JD1kSLDg0OA/gISqDYmETIZ /cPptWY5TvFFYMjGfB8iDV+MufWxre0oP4/Qa9fqli5c2l1miTMRILyLVuMDhrcivFOu XUd3qumGx71PTPDMs8Wi7LejSEyHznX5tBHw7ZHWXNSzF9Aoj0iBTg/wE7Tq8rznEfF2 R4vanAWRBlqxlfWDHKcSvQlSXhXZAkTC3VCVYr8jnxlsPyQTZu+wpRwu9tNYG+1I3RY+ 5mWw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:list-unsubscribe:list-subscribe:list-id:precedence :references:message-id:subject:cc:to:from:date:dkim-signature; bh=ZIgdoPCMR+IJzRuNyLi5sJHouzirHwH/wc+njy54058=; fh=iWBv4He8s+xpzrJY93iuua2RS8H3PW0G6YXgJrUCrjQ=; b=eLDSDFfZKgknIeojUELAto1kYHj/9kMrjlxE8zjChR92FnRR9Z1QZJ+gNm+vkHqmhl xraEtvqo0uNqbu0NR/1pLLp/zMqf9DF5R7G49v+LXnCVdLrx1KUirmAzwaMbTsZcEY2b a/PSaykXvtsFcFxUt5NXqnGm14TwU9NAqcPF8x4LCIUaO4gzI8Kigp5siPEdSY2GpwM9 bKUnTZQObL1MQfByRFYWqJ70SpDwk3O9/CIA8P8kvMFEKw4csVAFKjUdXG1AGlNPB9F0 bxP7jr0ycn+fIA4a7w+d7I0nKbaO2+NnB65+5AtYkyjTN5lZt7DzUFydGH/KYXUvBKby TC3g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=tdW+K43B; spf=pass (google.com: domain of linux-kernel+bounces-18771-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-18771-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id bj6-20020a170906b04600b00a28ce1ffa1bsi2013704ejb.933.2024.01.06.19.23.10 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 06 Jan 2024 19:23:10 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-18771-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=tdW+K43B; spf=pass (google.com: domain of linux-kernel+bounces-18771-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-18771-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id BA43A1F22130 for ; Sun, 7 Jan 2024 03:23:09 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id A23B1111B0; Sun, 7 Jan 2024 03:23:00 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="tdW+K43B" X-Original-To: linux-kernel@vger.kernel.org Received: from mail-oa1-f42.google.com (mail-oa1-f42.google.com [209.85.160.42]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 6930411198 for ; Sun, 7 Jan 2024 03:22:58 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Received: by mail-oa1-f42.google.com with SMTP id 586e51a60fabf-2044d093b3fso734290fac.3 for ; Sat, 06 Jan 2024 19:22:58 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1704597777; x=1705202577; darn=vger.kernel.org; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:references:message-id:subject:cc:to:from:date:from:to :cc:subject:date:message-id:reply-to; bh=ZIgdoPCMR+IJzRuNyLi5sJHouzirHwH/wc+njy54058=; b=tdW+K43BQnYuPMqrgncumMc16XNaV6S5i2g/6Yr6Ui0Eec0tiLi5OFX3wO3oSGdu0Q egxfOOpmGkhkv4tdnEixN4QqoKtJdO+5xwjuyYYoBi0kVtSD70BzTJVnI6Im9XqxXWGr E9zphI0FKakjbZKS+5hGLrH4AWwnzinvBZGWYfoGMFaVGcw4GZBjpOQHMac/7nxgDb7d qPsafS90j2HtEgHdhPApBZ9VXF2XKBEm+joyr6RkTvxlOw1ddqaskvhdLl/z2U72LuFO hEtDiq/cWZj0O8z+cBzW7wgI1pDZTpnptcgSskp3ZYEiwol+3MhWUBMRqlW6tOi/JJhA IJDw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1704597777; x=1705202577; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=ZIgdoPCMR+IJzRuNyLi5sJHouzirHwH/wc+njy54058=; b=pTObZnXA+v1QZ3lyCDVqi+1fgPJAUoUsT3ei379i2lMlon3L0DJjfFkMIK1yP6D1jl yqGjPcB+44KkKeC+/0iTN41p060hrEwUwE3WEt//JHprXoYek5V6i5Pm1UQczyWjmI8m V32EFaCA8Xvaix0foBYuv+BxT43QbdpTnjIXBwYoe3BZjasJvayjr0J7F5VEVVBxXklz rAFFlrGJDDtjD0ItWxM2e6RsiobdiUVPjtiIAsQxRGKLFrW9GTOqDDA33Pt/gqTsi6OJ 9EJW18glkx3FDb5KZaAXMSPGwgOAKoJz3trCMbjAxEO5Bnjg/VKA2ZsQW+H8xw3c58Fd kfCw== X-Gm-Message-State: AOJu0YyyjNGzVBiuptaYoIUg7OAQLLqcAZDo46aG6EI6aVkskSfBv7NB v882jl4gT0kKm1LfVuYCalnGZJjGdCSa X-Received: by 2002:a05:6870:1b07:b0:206:b2a:78be with SMTP id hl7-20020a0568701b0700b002060b2a78bemr1655818oab.105.1704597777369; Sat, 06 Jan 2024 19:22:57 -0800 (PST) Received: from thinkpad ([103.197.115.97]) by smtp.gmail.com with ESMTPSA id c5-20020a63ef45000000b005cda7a1d72dsm3839469pgk.74.2024.01.06.19.22.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 06 Jan 2024 19:22:56 -0800 (PST) Date: Sun, 7 Jan 2024 08:52:48 +0530 From: Manivannan Sadhasivam To: Frank Li Cc: krzysztof.kozlowski@linaro.org, bhelgaas@google.com, conor+dt@kernel.org, devicetree@vger.kernel.org, festevam@gmail.com, helgaas@kernel.org, hongxing.zhu@nxp.com, imx@lists.linux.dev, kernel@pengutronix.de, krzysztof.kozlowski+dt@linaro.org, kw@linux.com, l.stach@pengutronix.de, linux-arm-kernel@lists.infradead.org, linux-imx@nxp.com, linux-kernel@vger.kernel.org, linux-pci@vger.kernel.org, lpieralisi@kernel.org, robh@kernel.org, s.hauer@pengutronix.de, shawnguo@kernel.org Subject: Re: [PATCH v7 05/16] PCI: imx6: Using "linux,pci-domain" as slot ID Message-ID: <20240107032248.GD3416@thinkpad> References: <20231227182727.1747435-1-Frank.Li@nxp.com> <20231227182727.1747435-6-Frank.Li@nxp.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20231227182727.1747435-6-Frank.Li@nxp.com> On Wed, Dec 27, 2023 at 01:27:16PM -0500, Frank Li wrote: > Avoid use get slot id by compared with register physical address. If there > are more than 2 slots, compared logic will become complex. > > "linux,pci-domain" already exist at dts since commit: > commit (c0b70f05c87f3b arm64: dts: imx8mq: use_dt_domains for pci node). > > So it is safe to remove compare basic address code: > ... > if (dbi_base->start == IMX8MQ_PCIE2_BASE_ADDR) > imx6_pcie->controller_id = 1; > ... > > Signed-off-by: Frank Li One comment below. With that fixed, Reviewed-by: Manivannan Sadhasivam > --- > > Notes: > Change from v3 to v4 > - remove compare basic address logic > Change from v2 to v3 > - none > Change from v1 to v2 > - fix of_get_pci_domain_nr return value check logic > > drivers/pci/controller/dwc/pci-imx6.c | 17 +++++++++-------- > 1 file changed, 9 insertions(+), 8 deletions(-) > > diff --git a/drivers/pci/controller/dwc/pci-imx6.c b/drivers/pci/controller/dwc/pci-imx6.c > index 294f61a9c6fd9..332c392f8e5bc 100644 > --- a/drivers/pci/controller/dwc/pci-imx6.c > +++ b/drivers/pci/controller/dwc/pci-imx6.c > @@ -33,6 +33,7 @@ > #include > #include > > +#include "../../pci.h" > #include "pcie-designware.h" > > #define IMX8MQ_GPR_PCIE_REF_USE_PAD BIT(9) > @@ -40,7 +41,6 @@ > #define IMX8MQ_GPR_PCIE_CLK_REQ_OVERRIDE BIT(11) > #define IMX8MQ_GPR_PCIE_VREG_BYPASS BIT(12) > #define IMX8MQ_GPR12_PCIE2_CTRL_DEVICE_TYPE GENMASK(11, 8) > -#define IMX8MQ_PCIE2_BASE_ADDR 0x33c00000 > > #define to_imx6_pcie(x) dev_get_drvdata((x)->dev) > > @@ -1279,13 +1279,14 @@ static int imx6_pcie_probe(struct platform_device *pdev) > "Failed to get PCIEPHY reset control\n"); > } > > - switch (imx6_pcie->drvdata->variant) { > - case IMX7D: > - if (dbi_base->start == IMX8MQ_PCIE2_BASE_ADDR) > - imx6_pcie->controller_id = 1; > - default: > - break; > - } > + /* Using linux,pci-domain as PCI slot id */ > + imx6_pcie->controller_id = of_get_pci_domain_nr(node); > + /* If there are not "linux,pci-domain" in dts file, means only 1 controller */ "If there are no "linux,pci-domain" property specified in DT, then assume only one controller is available." - Mani > + if (imx6_pcie->controller_id == -EINVAL) > + imx6_pcie->controller_id = 0; > + else if (imx6_pcie->controller_id < 0) > + return dev_err_probe(dev, imx6_pcie->controller_id, > + "linux,pci-domain have wrong value\n"); > > /* Grab turnoff reset */ > imx6_pcie->turnoff_reset = devm_reset_control_get_optional_exclusive(dev, "turnoff"); > -- > 2.34.1 > -- மணிவண்ணன் சதாசிவம்