From patchwork Tue Sep 15 13:04:26 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kishon Vijay Abraham I X-Patchwork-Id: 53647 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-lb0-f197.google.com (mail-lb0-f197.google.com [209.85.217.197]) by patches.linaro.org (Postfix) with ESMTPS id 6016122A22 for ; Tue, 15 Sep 2015 13:08:00 +0000 (UTC) Received: by lbot4 with SMTP id t4sf8229649lbo.0 for ; Tue, 15 Sep 2015 06:07:59 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:delivered-to:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-type:sender:precedence :list-id:x-original-sender:x-original-authentication-results :mailing-list:list-post:list-help:list-archive:list-unsubscribe; bh=svVT3OZl7w/Ky0+R8iymQn3VjCn4mAt9Cj+O7xa3o7g=; b=fY/0q0jkMAWm5135wV5dbZ2jmUhj3qXqyMqdK39zksqz5FkNIjNpAJfTKSOdpEvFu1 7JUkcnBSR8BtYGfD55iVrI8C2ehgkocC9FmvFCAU6N8ICsqkKhw601N+4RpCa3pIHPxS +qxM7V6Y4+JxwImJEl/xVDtka318DPGRAllZwiaIhv9hcF1xwifLTiMnt8ahwb2jO4jO +wUEY1muGSONDLEiF3b7fIxz/aAryD4FbN2s/LzWtj843rzfUqFkSd11mqDzWSnag0q2 jk7SnKKxO6cfgPyml/vrT+PdlyKoHzafpbg2GHZrFF/ILSgymjbxGh2ouvfVhWjJLe2T rxKQ== X-Gm-Message-State: ALoCoQnK1KIJHraga+zlxJV0x4kBB7VRNdUV3gkUynDdJhRFyQSGUQAcV7TzQrcUdObxzFg2hbHF X-Received: by 10.152.9.36 with SMTP id w4mr1717183laa.7.1442322479326; Tue, 15 Sep 2015 06:07:59 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.5.164 with SMTP id t4ls679240lat.84.gmail; Tue, 15 Sep 2015 06:07:59 -0700 (PDT) X-Received: by 10.152.236.12 with SMTP id uq12mr15109391lac.35.1442322479152; Tue, 15 Sep 2015 06:07:59 -0700 (PDT) Received: from mail-lb0-f171.google.com (mail-lb0-f171.google.com. [209.85.217.171]) by mx.google.com with ESMTPS id rc5si13485493lac.42.2015.09.15.06.07.59 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 15 Sep 2015 06:07:59 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.171 as permitted sender) client-ip=209.85.217.171; Received: by lbbmp1 with SMTP id mp1so84668589lbb.1 for ; Tue, 15 Sep 2015 06:07:59 -0700 (PDT) X-Received: by 10.112.51.142 with SMTP id k14mr19422990lbo.76.1442322479046; Tue, 15 Sep 2015 06:07:59 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.112.59.35 with SMTP id w3csp1793939lbq; Tue, 15 Sep 2015 06:07:58 -0700 (PDT) X-Received: by 10.68.109.97 with SMTP id hr1mr46850352pbb.110.1442322477702; Tue, 15 Sep 2015 06:07:57 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id dk5si31863800pbc.22.2015.09.15.06.07.56; Tue, 15 Sep 2015 06:07:57 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752560AbbIONFM (ORCPT + 29 others); Tue, 15 Sep 2015 09:05:12 -0400 Received: from comal.ext.ti.com ([198.47.26.152]:49417 "EHLO comal.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752257AbbIONFI (ORCPT ); Tue, 15 Sep 2015 09:05:08 -0400 Received: from dflxv15.itg.ti.com ([128.247.5.124]) by comal.ext.ti.com (8.13.7/8.13.7) with ESMTP id t8FD4oCk017685; Tue, 15 Sep 2015 08:04:50 -0500 Received: from DLEE71.ent.ti.com (dlee71.ent.ti.com [157.170.170.114]) by dflxv15.itg.ti.com (8.14.3/8.13.8) with ESMTP id t8FD4oKU012120; Tue, 15 Sep 2015 08:04:50 -0500 Received: from dflp33.itg.ti.com (10.64.6.16) by DLEE71.ent.ti.com (157.170.170.114) with Microsoft SMTP Server id 14.3.224.2; Tue, 15 Sep 2015 08:04:50 -0500 Received: from a0393678ub.india.ti.com (ileax41-snat.itg.ti.com [10.172.224.153]) by dflp33.itg.ti.com (8.14.3/8.13.8) with ESMTP id t8FD4Vrd016139; Tue, 15 Sep 2015 08:04:46 -0500 From: Kishon Vijay Abraham I To: , CC: , , , , , , , , Subject: [PATCH v2 4/9] phy: ti-pipe3: move mem resource initialization to a separate function Date: Tue, 15 Sep 2015 18:34:26 +0530 Message-ID: <1442322271-26230-5-git-send-email-kishon@ti.com> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1442322271-26230-1-git-send-email-kishon@ti.com> References: <1442322271-26230-1-git-send-email-kishon@ti.com> MIME-Version: 1.0 Sender: linux-kernel-owner@vger.kernel.org Precedence: list List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: kishon@ti.com X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.171 as permitted sender) smtp.mailfrom=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , No functional change. Moved mem resource initialization done in probe to a separate function as part of cleaning up ti_pipe3_probe. Signed-off-by: Kishon Vijay Abraham I --- drivers/phy/phy-ti-pipe3.c | 52 ++++++++++++++++++++++++++++---------------- 1 file changed, 33 insertions(+), 19 deletions(-) diff --git a/drivers/phy/phy-ti-pipe3.c b/drivers/phy/phy-ti-pipe3.c index 3154da0..1991efd 100644 --- a/drivers/phy/phy-ti-pipe3.c +++ b/drivers/phy/phy-ti-pipe3.c @@ -418,14 +418,42 @@ static int ti_pipe3_get_sysctrl(struct ti_pipe3 *phy) return 0; } +static int ti_pipe3_get_pll_base(struct ti_pipe3 *phy) +{ + struct resource *res; + const struct of_device_id *match; + struct device *dev = phy->dev; + struct device_node *node = dev->of_node; + struct platform_device *pdev = to_platform_device(dev); + + if (of_device_is_compatible(node, "ti,phy-pipe3-pcie")) + return 0; + + match = of_match_device(ti_pipe3_id_table, dev); + if (!match) + return -EINVAL; + + phy->dpll_map = (struct pipe3_dpll_map *)match->data; + if (!phy->dpll_map) { + dev_err(dev, "no DPLL data\n"); + return -EINVAL; + } + + res = platform_get_resource_byname(pdev, IORESOURCE_MEM, + "pll_ctrl"); + phy->pll_ctrl_base = devm_ioremap_resource(dev, res); + if (IS_ERR(phy->pll_ctrl_base)) + return PTR_ERR(phy->pll_ctrl_base); + + return 0; +} + static int ti_pipe3_probe(struct platform_device *pdev) { struct ti_pipe3 *phy; struct phy *generic_phy; struct phy_provider *phy_provider; - struct resource *res; struct device_node *node = pdev->dev.of_node; - const struct of_device_id *match; struct device *dev = &pdev->dev; int ret; @@ -435,23 +463,9 @@ static int ti_pipe3_probe(struct platform_device *pdev) phy->dev = dev; - if (!of_device_is_compatible(node, "ti,phy-pipe3-pcie")) { - match = of_match_device(ti_pipe3_id_table, dev); - if (!match) - return -EINVAL; - - phy->dpll_map = (struct pipe3_dpll_map *)match->data; - if (!phy->dpll_map) { - dev_err(dev, "no DPLL data\n"); - return -EINVAL; - } - - res = platform_get_resource_byname(pdev, IORESOURCE_MEM, - "pll_ctrl"); - phy->pll_ctrl_base = devm_ioremap_resource(dev, res); - if (IS_ERR(phy->pll_ctrl_base)) - return PTR_ERR(phy->pll_ctrl_base); - } + ret = ti_pipe3_get_pll_base(phy); + if (ret) + return ret; ret = ti_pipe3_get_sysctrl(phy); if (ret)