From nobody Sun May 11 22:45:09 2025 Delivered-To: importer2@patchew.org Received-SPF: pass (zohomail.com: domain of vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; envelope-from=linux-kernel-owner@vger.kernel.org; helo=vger.kernel.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass(p=none dis=none) header.from=kernel.org ARC-Seal: i=1; a=rsa-sha256; t=1612335808; cv=none; d=zohomail.com; s=zohoarc; b=kB1HqJoFzsuPEVvyGcE8Zt9sjjs6eJER/d7baZngCAJmJELQafn/hWq/z2hS1JlhMj/WIYAewFzyW3g1fTIsMDC1tKOeqFz+nQBeEaV4ttesvksl0M5UNrmKwWU7y6jvrHdak0SLceTQHm9dimMgCltl8sLzfuzJ3JcHnly4HN4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1612335808; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Id:MIME-Version:Message-ID:References:Sender:Subject:To; bh=E1tdf1q6bH2NdSMM45w9KJ138huZj08lwisg8G/9tm4=; b=LT4r3D3jrKstkZNpFgTOsQATwaeeu5wevdt4lXolHqKAdV6n02zyjKuCxxucr6vLeJzT/cXgdbXqEQSJhP0zLV5KRJTw/Ae752ntcE9/l5szHHtcoj4f6MKocyO73uJu4runDdh9asNjkJFYfmtslw9bgAUFz7rhi5pqd1hkgp0= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mx.zohomail.com with SMTP id 1612335807896273.2198499188761; Tue, 2 Feb 2021 23:03:27 -0800 (PST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231944AbhBCHCu (ORCPT ); Wed, 3 Feb 2021 02:02:50 -0500 Received: from mail.kernel.org ([198.145.29.99]:34050 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231659AbhBCHCl (ORCPT ); Wed, 3 Feb 2021 02:02:41 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id 59F6B64F58; Wed, 3 Feb 2021 07:02:00 +0000 (UTC) Received: by mail.kernel.org with local (Exim 4.94) (envelope-from ) id 1l7CAo-001CAd-73; Wed, 03 Feb 2021 08:01:58 +0100 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1612335720; bh=aiSfGloGjZNBvqVkuwBAlS4U5H6KEaC6gLpGGLAMPa4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=tj73VGPQysEec8IsoH6FwOU1UcsJVNL1MG8RzNtmfxB6fB9eDdqcEepaT0+oVSgvw wvJnWmhAG94UIWr2RFQJ+5x2W9jE8AX2P0KLg57/3XBdqiy6emkS2mYPu7+MIjDqL/ mIsbx0141Vpfq9zd8ERJGQmhxhNG8Sztp2xO2yXOPbszlltznt9l0OtcUazx/xDYxy BdfDjQhlwC1NtcniAXH63QpQ6dvOGF2s2kucTroJQjCIsra3S6+7alr91lqrHTTafq jLsSOi2/BqR9rGHeL/8gnF7qcWSPqyJap47+BsgdJa8/S2RUwJ1dB3Y/HHWAxJOu9b 3C1pKwFxb07RA== From: Mauro Carvalho Chehab Cc: Mauro Carvalho Chehab , Binghui Wang , Bjorn Helgaas , Lorenzo Pieralisi , Rob Herring , Xiaowei Song , linux-kernel@vger.kernel.org, linux-pci@vger.kernel.org Subject: [PATCH v2 07/11] PCI: dwc: pcie-kirin: place common init code altogether Date: Wed, 3 Feb 2021 08:01:51 +0100 Message-Id: <768a60e538735a426c18c4fd1b3f95d53f678eac.1612335031.git.mchehab+huawei@kernel.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Sender: Mauro Carvalho Chehab To: unlisted-recipients:; (no To-header on input) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" Both Kirin 960 and Kirin 970 need to do ioremap for apb, phy and dbi. So, use a shared code for those. It should be noticed that the dbi remap is now done by dwc core, so it can simply be removed from kirin970_pcie_get_resource(). Signed-off-by: Mauro Carvalho Chehab --- drivers/pci/controller/dwc/pcie-kirin.c | 45 +++++++++++-------------- 1 file changed, 20 insertions(+), 25 deletions(-) diff --git a/drivers/pci/controller/dwc/pcie-kirin.c b/drivers/pci/controll= er/dwc/pcie-kirin.c index e1ebe0747978..2bce6e3750d4 100644 --- a/drivers/pci/controller/dwc/pcie-kirin.c +++ b/drivers/pci/controller/dwc/pcie-kirin.c @@ -292,21 +292,27 @@ static void kirin970_pcie_set_eyeparam(struct kirin_p= cie *kirin_pcie) kirin_apb_natural_phy_writel(kirin_pcie, val, LANEN_DIG_ASIC_TX_OVRD_IN_1= ); } =20 +static long kirin_common_pcie_get_resource(struct kirin_pcie *kirin_pcie, + struct platform_device *pdev) +{ + kirin_pcie->apb_base =3D devm_platform_ioremap_resource_byname(pdev, + "apb"); + if (IS_ERR(kirin_pcie->apb_base)) + return PTR_ERR(kirin_pcie->apb_base); + + kirin_pcie->phy_base =3D devm_platform_ioremap_resource_byname(pdev, + "phy"); + if (IS_ERR(kirin_pcie->phy_base)) + return PTR_ERR(kirin_pcie->phy_base); + + return 0; +} + static long kirin960_pcie_get_resource(struct kirin_pcie *kirin_pcie, struct platform_device *pdev) { struct device *dev =3D &pdev->dev; =20 - kirin_pcie->apb_base =3D devm_platform_ioremap_resource_byname(pdev, - "apb"); - if (IS_ERR(kirin_pcie->apb_base)) - return PTR_ERR(kirin_pcie->apb_base); - - kirin_pcie->phy_base =3D devm_platform_ioremap_resource_byname(pdev, - "phy"); - if (IS_ERR(kirin_pcie->phy_base)) - return PTR_ERR(kirin_pcie->phy_base); - kirin_pcie->crgctrl =3D syscon_regmap_lookup_by_compatible("hisilicon,hi3660-crgctrl"); if (IS_ERR(kirin_pcie->crgctrl)) @@ -331,21 +337,6 @@ static long kirin970_pcie_get_resource(struct kirin_pc= ie *kirin_pcie, struct device *dev =3D &pdev->dev; int ret; =20 - kirin_pcie->apb_base =3D devm_platform_ioremap_resource_byname(pdev, - "apb"); - if (IS_ERR(kirin_pcie->apb_base)) - return PTR_ERR(kirin_pcie->apb_base); - - kirin_pcie->phy_base =3D devm_platform_ioremap_resource_byname(pdev, - "phy"); - if (IS_ERR(kirin_pcie->phy_base)) - return PTR_ERR(kirin_pcie->phy_base); - - kirin_pcie->pci->dbi_base =3D devm_platform_ioremap_resource_byname(pdev, - "dbi"); - if (IS_ERR(kirin_pcie->pci->dbi_base)) - return PTR_ERR(kirin_pcie->pci->dbi_base); - kirin970_pcie_get_eyeparam(kirin_pcie); =20 kirin_pcie->gpio_id_reset[0] =3D of_get_named_gpio(dev->of_node, @@ -1141,6 +1132,10 @@ static int kirin_pcie_probe(struct platform_device *= pdev) if (ret) return ret; =20 + ret =3D kirin_common_pcie_get_resource(kirin_pcie, pdev); + if (ret) + return ret; + ret =3D ops->get_resource(kirin_pcie, pdev); if (ret) return ret; --=20 2.29.2