From patchwork Mon Jun 19 10:00:00 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ryder Lee X-Patchwork-Id: 9795667 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 51D0B600C5 for ; Mon, 19 Jun 2017 10:05:40 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3EEA11FF2D for ; Mon, 19 Jun 2017 10:05:40 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 3211220410; Mon, 19 Jun 2017 10:05:40 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,UNPARSEABLE_RELAY autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [65.50.211.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 6CF871FF2D for ; Mon, 19 Jun 2017 10:05:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=/+1r5twP/fGy7lrTsf9Vx86qftx+WKMRCzd+sajLutQ=; b=rrXdkH10crE+9O XbUfotuT8H+dW5VEHzBukL+QRi00iPj0974e/uB0vtpBi7g+U0SKeMnrjuURNtgqbT3bDafEZ4zEv 84nIqzaz7vgv7YJL/9EK8GOSZ+A863x0YFda/jvneYZi0Jduee8l7T/vFFLP5FYVRwTWhc9aW0P6t 1LNcWDZXB9kA3k+6ThZ6Qvt4dPG1omRs9CLYp/79okdU3z8cTgFpEn/HhUyU9M7SQtIhFExWTujKf DPj6PycPNDRrf7kZJfsfv7GiM/ONlZxJQtZ/XL4WFkKh9yInRdcxX/+73sNfGE2DFL2OuA/xOwaSX 92yxVbgJTik0eXOoEjEQ==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux)) id 1dMtYq-0004RH-40; Mon, 19 Jun 2017 10:05:32 +0000 Received: from [210.61.82.184] (helo=mailgw02.mediatek.com) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1dMtTw-00023D-Om; Mon, 19 Jun 2017 10:00:31 +0000 Received: from mtkcas09.mediatek.inc [(172.21.101.178)] by mailgw02.mediatek.com (envelope-from ) (mhqrelay.mediatek.com ESMTP with TLS) with ESMTP id 73508393; Mon, 19 Jun 2017 18:00:04 +0800 Received: from mtkexhb02.mediatek.inc (172.21.101.103) by mtkmbs08n2.mediatek.inc (172.21.101.56) with Microsoft SMTP Server (TLS) id 15.0.1210.3; Mon, 19 Jun 2017 18:00:03 +0800 Received: from mtkslt306.mediatek.inc (10.21.14.136) by mtkexhb02.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.0.1210.3 via Frontend Transport; Mon, 19 Jun 2017 18:00:03 +0800 From: Ryder Lee To: Bjorn Helgaas Subject: [PATCH 3/3] PCI: mediatek: make some properties optioanl Date: Mon, 19 Jun 2017 18:00:00 +0800 Message-ID: <1497866400-41844-4-git-send-email-ryder.lee@mediatek.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1497866400-41844-1-git-send-email-ryder.lee@mediatek.com> References: <1497866400-41844-1-git-send-email-ryder.lee@mediatek.com> MIME-Version: 1.0 X-MTK: N X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20170619_030028_953705_345CA3CA X-CRM114-Status: GOOD ( 12.86 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-pci@vger.kernel.org, Ryder Lee , linux-mediatek@lists.infradead.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP Some properties for PCIe controller are optional and therefore change to use *optional* function. Signed-off-by: Ryder Lee --- drivers/pci/host/pcie-mediatek.c | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/drivers/pci/host/pcie-mediatek.c b/drivers/pci/host/pcie-mediatek.c index d256263..91a6328 100644 --- a/drivers/pci/host/pcie-mediatek.c +++ b/drivers/pci/host/pcie-mediatek.c @@ -306,18 +306,15 @@ static int mtk_pcie_parse_ports(struct mtk_pcie *pcie, } snprintf(name, sizeof(name), "pcie-rst%d", index); - port->reset = devm_reset_control_get(dev, name); - if (IS_ERR(port->reset)) { - dev_err(dev, "failed to get port%d reset\n", index); + port->reset = devm_reset_control_get_optional(dev, name); + if (PTR_ERR(port->reset) == -EPROBE_DEFER) return PTR_ERR(port->reset); - } + /* some platforms may use default PHY setting */ snprintf(name, sizeof(name), "pcie-phy%d", index); - port->phy = devm_phy_get(dev, name); - if (IS_ERR(port->phy)) { - dev_err(dev, "failed to get port%d phy\n", index); + port->phy = devm_phy_optional_get(dev, name); + if (IS_ERR(port->phy)) return PTR_ERR(port->phy); - } port->index = index; port->pcie = pcie; @@ -345,8 +342,10 @@ static int mtk_pcie_subsys_powerup(struct mtk_pcie *pcie) pcie->free_ck = devm_clk_get(dev, "free_ck"); if (IS_ERR(pcie->free_ck)) { - dev_err(dev, "failed to get free_ck\n"); - return PTR_ERR(pcie->free_ck); + if (PTR_ERR(pcie->free_ck) == -EPROBE_DEFER) + return -EPROBE_DEFER; + + pcie->free_ck = NULL; } if (dev->pm_domain) {