Received: by 2002:ab2:6203:0:b0:1f5:f2ab:c469 with SMTP id o3csp3105754lqt; Tue, 23 Apr 2024 10:23:03 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUMrJ64j2+QP7h4JKOZITL5S7si8Qy3apFBkjcClGRgk4eal7IZtygdBtTd2oxjWZfygSUJ0m9VFZJKoAb7ELj9sVDRyt+m0tCSH6v+zg== X-Google-Smtp-Source: AGHT+IEkrYwevGT25ohtOwX8ALkXZRp3K2XqSUy5TUa5+PhYaltzWzGIgry/jcSbUph4PW43HXsV X-Received: by 2002:ad4:4f13:0:b0:699:3a91:e25 with SMTP id fb19-20020ad44f13000000b006993a910e25mr28859qvb.11.1713892982945; Tue, 23 Apr 2024 10:23:02 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1713892982; cv=pass; d=google.com; s=arc-20160816; b=lzqLuVrd6T+FXZt6k9HCaG5oc03BIskqd8TAeMvAruRKP5q/loQ5PsM5J34W3pKZ2/ Tv1UdZId3OPrl6KWNoPCodvAE5682IKxJw65vIZWZcVwDnXdtkRniKH660xTbpzzNBXm aG4D/ECwhnbVimacJ7qDmQmKo5u1mk7b3O2/slkmbadXLdn6PsZV76IAMqZ+0pZYCzmd xlgOp3iPi5qB1Oz4fpboe9L2a8rmql3SVj3INfon2lFoqUib8NBTcb1ij9QtSMoKOutC G4UdQJFtDtVe3R9dhbyiN89PTS87QRigOq7RkOBwRbVI2k300yybAdI5hD8Cs8LxNYYK 2m/w== 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=rjHHhbG5XlrDdkV/64HBXWk6MZi0zfg9LUhwFj5amWA=; fh=cSbJU49VqgP4DI3exA/0TlPdvpXcA7q43QbWqEjoomk=; b=mwnyCVi7PSQITTVDnE0fG7LZX3KZjJZRuBSg4VlYpM+1qXjlLk86Sxyd9GV20glObk RhtYf2re6VdeMZEEXWUlV+1EYX8vSD062d+NvFm97qulgCjgjVLUV/H+oZEzGLKUd0hd GtC5NwDe1lxRdVnl7wb+B5ElzG3bJbx74NgYAEKEElEPnkIcub6OiU4ZYdus0DC4gKd1 uWAZTBSN2OBtGNdeopdNqXotCPD5mnK0OkDMThT+J6ztEqU9Ia3X+o6NV+G8q2/pVHOq zXjASeJ+YEl0zwPdZqRSecA454oTn0Nu39mLwDZj8fj+IZ7HBKuWt85+W5XUhI2JJRR2 M2tg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=b1Qzbplr; arc=pass (i=1 dkim=pass dkdomain=intel.com dmarc=pass fromdomain=linux.intel.com); spf=pass (google.com: domain of linux-kernel+bounces-155666-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-155666-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id gi4-20020a056214248400b0069b4ddd24afsi13460876qvb.237.2024.04.23.10.23.02 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 23 Apr 2024 10:23:02 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-155666-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=b1Qzbplr; arc=pass (i=1 dkim=pass dkdomain=intel.com dmarc=pass fromdomain=linux.intel.com); spf=pass (google.com: domain of linux-kernel+bounces-155666-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-155666-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 ny.mirrors.kernel.org (Postfix) with ESMTPS id C8DD11C228DF for ; Tue, 23 Apr 2024 17:23:00 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 47B7B13E03F; Tue, 23 Apr 2024 17:22:24 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="b1Qzbplr" Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.10]) (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 788BC13D8BE; Tue, 23 Apr 2024 17:22:20 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=192.198.163.10 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713892943; cv=none; b=ePZ8e2M6KfNKrDLsIDb3quwRH4Lc7vkVhUK4SxnulbSwXkdmAZ/mDRo74o+CspoQFO0HrwatYGowmkpctSkIZxZf48Q8/u+7+1r+BV6fHjapR/rItKyUKv6q9nG2AqOdBqIRpQBev5qXI8ZahuoW8uDiW/cZHvlPVXXqP5KWqjw= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713892943; c=relaxed/simple; bh=SGMALI4QdYtZABn10T5pVJnncfss1vQ8bKDWh3dyHOM=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=ZimzvXnLpWSSmiMuLEGWGzu5XVTgMBMIvmTMe45vSB7XKjP4OuFamb+WzGh21wV4PLOwsGSJ1hHB0liE3tNVYTmD6nXTRH7h1SXMJ+E9DCtc1dqb0bXG4tKe7Krpl3nX4BkY6uA2xpxy+dr9igIr+7tHmwmSQN9lVPmCiPvnRQg= 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=b1Qzbplr; arc=none smtp.client-ip=192.198.163.10 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=1713892942; x=1745428942; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=SGMALI4QdYtZABn10T5pVJnncfss1vQ8bKDWh3dyHOM=; b=b1QzbplrnKGM2wd8jCWcqM8DOLGCe//hFb9oxfrP/nREgg6Zsa6nS3ml +1VTActs9ITVR1N6kVOqOHviQvNoyEg5StZKIdyqnQGUXX0BusgmJk/Hg WBiCMjrrSJ9evgVP27ES9mXaf+rh/hH23nNK4hGSVcZi1nMhpL834PKAE dO3KQWOrBypyNDeJtEqrFLIzhegGCE3C2AIcartKQUaJz9+6SFpor2bAr wHqV3zm5wsjmvmN9L3k/wEo4bBphhmL9dg4hTeTEChW9/tzAuRy2XQKvD JigvcE2eGLizaJsBZW+WYnQiXIAV61wbhxPmDSl3+KJC3TUSM9CGwanDd g==; X-CSE-ConnectionGUID: oprZXTfPRlueHWV3Yyyxtg== X-CSE-MsgGUID: UceEPdHHSBGAQREApATYew== X-IronPort-AV: E=McAfee;i="6600,9927,11053"; a="20898266" X-IronPort-AV: E=Sophos;i="6.07,222,1708416000"; d="scan'208";a="20898266" Received: from orviesa002.jf.intel.com ([10.64.159.142]) by fmvoesa104.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 23 Apr 2024 10:22:19 -0700 X-CSE-ConnectionGUID: w7mCtatXRLWlZOakw9eLkg== X-CSE-MsgGUID: iMjDsOr7TGGBt8XsjZZ7wg== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.07,222,1708416000"; d="scan'208";a="55410232" Received: from black.fi.intel.com ([10.237.72.28]) by orviesa002.jf.intel.com with ESMTP; 23 Apr 2024 10:22:11 -0700 Received: by black.fi.intel.com (Postfix, from userid 1003) id 9ACD5489; Tue, 23 Apr 2024 20:22:10 +0300 (EEST) From: Andy Shevchenko To: Manivannan Sadhasivam , Frank Li , =?UTF-8?q?Krzysztof=20Wilczy=C5=84ski?= , Andy Shevchenko , =?UTF-8?q?Uwe=20Kleine-K=C3=B6nig?= , 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?= Subject: [PATCH v2 3/4] PCI: imx6: Convert to agnostic GPIO API Date: Tue, 23 Apr 2024 20:19:06 +0300 Message-ID: <20240423172208.2723892-4-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.43.0.rc1.1336.g36b5255a03ac In-Reply-To: <20240423172208.2723892-1-andriy.shevchenko@linux.intel.com> References: <20240423172208.2723892-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. Signed-off-by: Andy Shevchenko --- drivers/pci/controller/dwc/pci-imx6.c | 37 ++++++++++----------------- 1 file changed, 14 insertions(+), 23 deletions(-) diff --git a/drivers/pci/controller/dwc/pci-imx6.c b/drivers/pci/controller/dwc/pci-imx6.c index 917c69edee1d..d620f1e1a43c 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,7 +106,7 @@ struct imx6_pcie_drvdata { struct imx6_pcie { struct dw_pcie *pci; - int reset_gpio; + struct gpio_desc *reset_gpiod; bool gpio_active_high; bool link_is_up; struct clk_bulk_data clks[IMX6_PCIE_MAX_CLKS]; @@ -721,9 +720,8 @@ 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_raw_value_cansleep(imx6_pcie->reset_gpiod, + imx6_pcie->gpio_active_high); } static int imx6_pcie_deassert_core_reset(struct imx6_pcie *imx6_pcie) @@ -771,10 +769,10 @@ 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_raw_value_cansleep(imx6_pcie->reset_gpiod, + !imx6_pcie->gpio_active_high); /* Wait for 100ms after PERST# deassertion (PCIe r5.0, 6.6.1) */ msleep(100); } @@ -1285,22 +1283,15 @@ 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", + imx6_pcie->gpio_active_high ? GPIOD_OUT_HIGH : GPIOD_OUT_LOW); + 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