From patchwork Mon Oct 19 18:57:20 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: WingMan Kwok X-Patchwork-Id: 7439231 X-Patchwork-Delegate: bhelgaas@google.com Return-Path: X-Original-To: patchwork-linux-pci@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 91BEFBEEA4 for ; Mon, 19 Oct 2015 18:59:41 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id A7C2520793 for ; Mon, 19 Oct 2015 18:59:40 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id BAA2C2077D for ; Mon, 19 Oct 2015 18:59:39 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753628AbbJSS6J (ORCPT ); Mon, 19 Oct 2015 14:58:09 -0400 Received: from devils.ext.ti.com ([198.47.26.153]:44770 "EHLO devils.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753584AbbJSS6I (ORCPT ); Mon, 19 Oct 2015 14:58:08 -0400 Received: from dlelxv90.itg.ti.com ([172.17.2.17]) by devils.ext.ti.com (8.13.7/8.13.7) with ESMTP id t9JIvUdj002523; Mon, 19 Oct 2015 13:57:30 -0500 Received: from DLEE70.ent.ti.com (dlemailx.itg.ti.com [157.170.170.113]) by dlelxv90.itg.ti.com (8.14.3/8.13.8) with ESMTP id t9JIvUu4020330; Mon, 19 Oct 2015 13:57:30 -0500 Received: from dlep32.itg.ti.com (157.170.170.100) by DLEE70.ent.ti.com (157.170.170.113) with Microsoft SMTP Server id 14.3.224.2; Mon, 19 Oct 2015 13:57:30 -0500 Received: from udb0216549.am.dhcp.ti.com (ileax41-snat.itg.ti.com [10.172.224.153]) by dlep32.itg.ti.com (8.14.3/8.13.8) with ESMTP id t9JIvTIl023396; Mon, 19 Oct 2015 13:57:29 -0500 Received: from a0216549local by udb0216549.am.dhcp.ti.com with local (Exim 4.76) (envelope-from ) id 1ZoFcf-0003qb-I3; Mon, 19 Oct 2015 14:57:29 -0400 From: WingMan Kwok To: , , , , , , , , , , , , , , CC: WingMan Kwok Subject: [PATCH v2 2/2] PCI: keystone: update to use generic keystone serdes driver Date: Mon, 19 Oct 2015 14:57:20 -0400 Message-ID: <1445281040-14742-3-git-send-email-w-kwok2@ti.com> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1445281040-14742-1-git-send-email-w-kwok2@ti.com> References: <1445281040-14742-1-git-send-email-w-kwok2@ti.com> MIME-Version: 1.0 Sender: linux-pci-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pci@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP This patch updates the Keystone PCI driver to use the generic Keystone serdes driver for serdes initialization and configuration. The generic serdes driver supports peripherals on Keystone platforms that require serdes. Signed-off-by: WingMan Kwok --- drivers/pci/host/pci-keystone.c | 24 ++++++++++++++---------- drivers/pci/host/pci-keystone.h | 1 + 2 files changed, 15 insertions(+), 10 deletions(-) diff --git a/drivers/pci/host/pci-keystone.c b/drivers/pci/host/pci-keystone.c index 0aa81bd..4cc8faa 100644 --- a/drivers/pci/host/pci-keystone.c +++ b/drivers/pci/host/pci-keystone.c @@ -335,6 +335,7 @@ static int __exit ks_pcie_remove(struct platform_device *pdev) { struct keystone_pcie *ks_pcie = platform_get_drvdata(pdev); + phy_exit(ks_pcie->serdes_phy); clk_disable_unprepare(ks_pcie->clk); return 0; @@ -342,12 +343,12 @@ static int __exit ks_pcie_remove(struct platform_device *pdev) static int __init ks_pcie_probe(struct platform_device *pdev) { + struct device_node *node = pdev->dev.of_node; struct device *dev = &pdev->dev; struct keystone_pcie *ks_pcie; struct pcie_port *pp; struct resource *res; void __iomem *reg_p; - struct phy *phy; int ret = 0; ks_pcie = devm_kzalloc(&pdev->dev, sizeof(*ks_pcie), @@ -357,14 +358,6 @@ static int __init ks_pcie_probe(struct platform_device *pdev) pp = &ks_pcie->pp; - /* initialize SerDes Phy if present */ - phy = devm_phy_get(dev, "pcie-phy"); - if (!IS_ERR_OR_NULL(phy)) { - ret = phy_init(phy); - if (ret < 0) - return ret; - } - /* index 2 is to read PCI DEVICE_ID */ res = platform_get_resource(pdev, IORESOURCE_MEM, 2); reg_p = devm_ioremap_resource(dev, res); @@ -385,6 +378,17 @@ static int __init ks_pcie_probe(struct platform_device *pdev) if (ret) return ret; + ks_pcie->serdes_phy = devm_of_phy_get(dev, node, NULL); + if (IS_ERR(ks_pcie->serdes_phy)) { + dev_err(dev, "No %s serdes driver found: %ld\n", + node->name, PTR_ERR(ks_pcie->serdes_phy)); + goto fail_clk; + } + + ret = phy_init(ks_pcie->serdes_phy); + if (ret < 0) + goto fail_clk; + ret = ks_add_pcie_port(ks_pcie, pdev); if (ret < 0) goto fail_clk; @@ -392,7 +396,7 @@ static int __init ks_pcie_probe(struct platform_device *pdev) return 0; fail_clk: clk_disable_unprepare(ks_pcie->clk); - + phy_exit(ks_pcie->serdes_phy); return ret; } diff --git a/drivers/pci/host/pci-keystone.h b/drivers/pci/host/pci-keystone.h index 478d932..1e6d122 100644 --- a/drivers/pci/host/pci-keystone.h +++ b/drivers/pci/host/pci-keystone.h @@ -33,6 +33,7 @@ struct keystone_pcie { /* Application register space */ void __iomem *va_app_base; struct resource app; + struct phy *serdes_phy; }; /* Keystone DW specific MSI controller APIs/definitions */