Received: by 2002:a89:288:0:b0:1f7:eeee:6653 with SMTP id j8csp63967lqh; Mon, 6 May 2024 11:19:27 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWuPYvgDYCfneS+gA2Zwpvuvr6vX+ryxI4QPdx+cxWVvDaQRGgAKZL3/rLWQFAj8fEVZevQGasZTmVWX/rgDLeBZUKy9dGesxW+SEyh/Q== X-Google-Smtp-Source: AGHT+IGmbAZd1C8qW6CJks0CTKUnB8pHxAH1Odlx3ymS4k7tpLsGfqZ4QHHOo6MJDjTwbUkqkB4p X-Received: by 2002:a05:6a20:9f43:b0:1af:a468:8168 with SMTP id ml3-20020a056a209f4300b001afa4688168mr4637958pzb.43.1715019567228; Mon, 06 May 2024 11:19:27 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1715019567; cv=pass; d=google.com; s=arc-20160816; b=W4FqJikf8b+eDzKR6Su7hm9/rDFvZdqPVg1jZVgXUjNmTmQaww9IPniX55qO6OUoLS b9beW6rynv51udn2MEXaTczLRAOTbFZz2QsV+WEeSfqD03tpmsKwDgb8hrNcR72c4NPu RYQkdubydIo3n2+afNYgZBkZsELTLh+hp7kmukIpOV1cUCmP8fq7mKQtFSTuvVTPoheF I241D5kRVyBTsrTXgRQAcpkQjPRtTBS4gbHOeWOuO2JTLhAQ6JO6Ki9sKH+2QWMx27NP 2OKOfiDznrhZUWm8yf/2kWMrGlRxbo1nGiMdhcvdRB52g1vH4gfPjELtioWPg3awvORU H8pg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=JWryCKnzMYbZaiEohD15tfJvoFcBmDKPIROQVckFRbM=; fh=wfDtCpdYlGoPZyjjDlXqNd0Hpf8hJR8yzXrnU87jcx8=; b=mLtkjhoTkiMJuSfy/cmvv+h6UOVuJIfryvbz+n7YyYORr2xCXJ3MPw/h58kNtL/mGl 1A9OwfkuJQSJFbJ/quHP1zZvabo2R4ArH+uGcNCiQ0tmqky0V/734Gbcga3RaDneUtmN DocesyIgy0TNkYkiEAnhF8/w0ElMaVW46cWX/0bcNU+kcS75voaFwKa1dOf3w9QjzOp9 W2nHF2bCyoSA6CmPtxDAh1rZBV12o4273KPQybWcXhJvIHX+CM7JbW+2UnmBupb6k0BV S8CHZ+GeHevLIII4ThEyMMMwo2TaBQJeFzwv7+HHtpUn1wdzGBqlu8hvgnUasOPqd7I+ nGsg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=PJQfj2UB; arc=pass (i=1 dkim=pass dkdomain=intel.com dmarc=pass fromdomain=linux.intel.com); spf=pass (google.com: domain of linux-kernel+bounces-169980-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-169980-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id b11-20020a056a000ccb00b006f459785639si5342435pfv.159.2024.05.06.11.19.26 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 06 May 2024 11:19:27 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-169980-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=PJQfj2UB; arc=pass (i=1 dkim=pass dkdomain=intel.com dmarc=pass fromdomain=linux.intel.com); spf=pass (google.com: domain of linux-kernel+bounces-169980-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-169980-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com 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 sv.mirrors.kernel.org (Postfix) with ESMTPS id 961E428AAFB for ; Mon, 6 May 2024 14:24:40 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 2F3D813E3FE; Mon, 6 May 2024 14:21:58 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="PJQfj2UB" Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 4E76E13DDDE; Mon, 6 May 2024 14:21:55 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=192.198.163.17 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715005317; cv=none; b=PRLmoR2YIwbDrhuYknpztYcIOJicVucvjDmPmOZ+En12DfAMvKmMR5QgKkCiCC9dffsP6fEh47ltvoKc1c9UXufAQR7qG1BJb9GFY9SbAjZghuMHkXYRSeBLrHQaRofyHohBl+2XCoeLI+XAYCJDTxNoNutvHw8+FcHg2adgDJE= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715005317; c=relaxed/simple; bh=Z57pGJjnjRVkYzZo0wihsvwiTkK/ndmlOsPxrIGszlo=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=Wmw6hL35ERU4Nb1qlSxYHL+bWmLWKqInuv0kJcQLDnpDKP55aXlH/5wRDzPPDn/FbW0dWBsrec7ek4QbQaYlim+ePJUrW1vWruHv28EgNs90TrD0fg5COcIdAN0SlAktW1KHHh7lFW7jwXYqkQ9qytIEVjQ7wUPphbHmIEn0B3o= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com; spf=none smtp.mailfrom=linux.intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=PJQfj2UB; arc=none smtp.client-ip=192.198.163.17 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=linux.intel.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1715005315; x=1746541315; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=Z57pGJjnjRVkYzZo0wihsvwiTkK/ndmlOsPxrIGszlo=; b=PJQfj2UBc2BQOWoIMgV+SULBeSneeLuUNTbyDM0Yof13UvxGsFHTMEJ8 BGKLtPpN50F5YswrhIUrRS4B9rSKvwx9Z/MJbWr8etRGpfmI7DDiJ8Zg/ J5NXdLwuDBlBVpb1VgAtByVarbct9blWllb4Kk9vck3MM0mKoA6luraL+ rakqtnq/8cXcWE7ZbZORxfIdRrQb7Hhqz8kVu8XZG9/LPdjcjROupTv3w BPe2oz0xuuJR6HLYXLtgsMkxlRyVon316FeT+G7fnIXmyiUoFcJoAv2PX 2hNyO/1GjYOiY1UzIAqRrd90NW5hxPXL3TTVs734leC+MEUaPAIVzrRVb A==; X-CSE-ConnectionGUID: Fj2IlTLJRl64imAvJ/+Fbw== X-CSE-MsgGUID: N4qwcJx5QyeXSL4xa9XhZQ== X-IronPort-AV: E=McAfee;i="6600,9927,11065"; a="10631857" X-IronPort-AV: E=Sophos;i="6.07,258,1708416000"; d="scan'208";a="10631857" Received: from fmviesa005.fm.intel.com ([10.60.135.145]) by fmvoesa111.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 06 May 2024 07:21:52 -0700 X-CSE-ConnectionGUID: LmUtZS9TRKi6vdTo+P+jMQ== X-CSE-MsgGUID: SSFBTkBWSVaqnxNR9fDPHQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.07,258,1708416000"; d="scan'208";a="32652262" Received: from black.fi.intel.com ([10.237.72.28]) by fmviesa005.fm.intel.com with ESMTP; 06 May 2024 07:21:44 -0700 Received: by black.fi.intel.com (Postfix, from userid 1003) id 341DB537; Mon, 06 May 2024 17:21:43 +0300 (EEST) From: Andy Shevchenko To: Manivannan Sadhasivam , Frank Li , =?UTF-8?q?Krzysztof=20Wilczy=C5=84ski?= , Andy Shevchenko , linux-omap@vger.kernel.org, linux-pci@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, imx@lists.linux.dev, linux-amlogic@lists.infradead.org, linux-arm-msm@vger.kernel.org, linux-tegra@vger.kernel.org Cc: Vignesh Raghavendra , Siddharth Vadapalli , Lorenzo Pieralisi , =?UTF-8?q?Krzysztof=20Wilczy=C5=84ski?= , Rob Herring , Bjorn Helgaas , Richard Zhu , Lucas Stach , Shawn Guo , Sascha Hauer , Pengutronix Kernel Team , Fabio Estevam , Yue Wang , Neil Armstrong , Kevin Hilman , Jerome Brunet , Martin Blumenstingl , Xiaowei Song , Binghui Wang , Thierry Reding , Jonathan Hunter , Thomas Petazzoni , =?UTF-8?q?Pali=20Roh=C3=A1r?= , Linus Walleij Subject: [PATCH v4 4/5] PCI: imx6: Convert to agnostic GPIO API Date: Mon, 6 May 2024 17:20:40 +0300 Message-ID: <20240506142142.4042810-5-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.43.0.rc1.1336.g36b5255a03ac In-Reply-To: <20240506142142.4042810-1-andriy.shevchenko@linux.intel.com> References: <20240506142142.4042810-1-andriy.shevchenko@linux.intel.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit The of_gpio.h is going to be removed. In preparation of that convert the driver to the agnostic API. Reviewed-by: Manivannan Sadhasivam Reviewed-by: Frank Li Signed-off-by: Andy Shevchenko --- drivers/pci/controller/dwc/pci-imx6.c | 36 ++++++++------------------- 1 file changed, 10 insertions(+), 26 deletions(-) diff --git a/drivers/pci/controller/dwc/pci-imx6.c b/drivers/pci/controller/dwc/pci-imx6.c index 917c69edee1d..62a4994c5501 100644 --- a/drivers/pci/controller/dwc/pci-imx6.c +++ b/drivers/pci/controller/dwc/pci-imx6.c @@ -11,14 +11,13 @@ #include #include #include -#include +#include #include #include #include #include #include #include -#include #include #include #include @@ -107,8 +106,7 @@ struct imx6_pcie_drvdata { struct imx6_pcie { struct dw_pcie *pci; - int reset_gpio; - bool gpio_active_high; + struct gpio_desc *reset_gpiod; bool link_is_up; struct clk_bulk_data clks[IMX6_PCIE_MAX_CLKS]; struct regmap *iomuxc_gpr; @@ -721,9 +719,7 @@ static void imx6_pcie_assert_core_reset(struct imx6_pcie *imx6_pcie) } /* Some boards don't have PCIe reset GPIO. */ - if (gpio_is_valid(imx6_pcie->reset_gpio)) - gpio_set_value_cansleep(imx6_pcie->reset_gpio, - imx6_pcie->gpio_active_high); + gpiod_set_value_cansleep(imx6_pcie->reset_gpiod, 1); } static int imx6_pcie_deassert_core_reset(struct imx6_pcie *imx6_pcie) @@ -771,10 +767,9 @@ static int imx6_pcie_deassert_core_reset(struct imx6_pcie *imx6_pcie) } /* Some boards don't have PCIe reset GPIO. */ - if (gpio_is_valid(imx6_pcie->reset_gpio)) { + if (imx6_pcie->reset_gpiod) { msleep(100); - gpio_set_value_cansleep(imx6_pcie->reset_gpio, - !imx6_pcie->gpio_active_high); + gpiod_set_value_cansleep(imx6_pcie->reset_gpiod, 0); /* Wait for 100ms after PERST# deassertion (PCIe r5.0, 6.6.1) */ msleep(100); } @@ -1285,22 +1280,11 @@ static int imx6_pcie_probe(struct platform_device *pdev) return PTR_ERR(pci->dbi_base); /* Fetch GPIOs */ - imx6_pcie->reset_gpio = of_get_named_gpio(node, "reset-gpio", 0); - imx6_pcie->gpio_active_high = of_property_read_bool(node, - "reset-gpio-active-high"); - if (gpio_is_valid(imx6_pcie->reset_gpio)) { - ret = devm_gpio_request_one(dev, imx6_pcie->reset_gpio, - imx6_pcie->gpio_active_high ? - GPIOF_OUT_INIT_HIGH : - GPIOF_OUT_INIT_LOW, - "PCIe reset"); - if (ret) { - dev_err(dev, "unable to get reset gpio\n"); - return ret; - } - } else if (imx6_pcie->reset_gpio == -EPROBE_DEFER) { - return imx6_pcie->reset_gpio; - } + imx6_pcie->reset_gpiod = devm_gpiod_get_optional(dev, "reset", GPIOD_OUT_HIGH); + if (IS_ERR(imx6_pcie->reset_gpiod)) + return dev_err_probe(dev, PTR_ERR(imx6_pcie->reset_gpiod), + "unable to get reset gpio\n"); + gpiod_set_consumer_name(imx6_pcie->reset_gpiod, "PCIe reset"); if (imx6_pcie->drvdata->clks_cnt >= IMX6_PCIE_MAX_CLKS) return dev_err_probe(dev, -ENOMEM, "clks_cnt is too big\n"); -- 2.43.0.rc1.1336.g36b5255a03ac