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: 9795657 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 76B9960381 for ; Mon, 19 Jun 2017 10:00:46 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 82DF926D08 for ; Mon, 19 Jun 2017 10:00:46 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 77C1526E75; Mon, 19 Jun 2017 10:00:46 +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 57E7F27CF9 for ; Mon, 19 Jun 2017 10:00:44 +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=gUTSSDiVkBafu/B1Xvcb58kv9XcJGWxlv8lllaF0jnQ=; b=hRWssze350EtII VYOHbuwgOln0N4apmvl8szzo/Jc0lfm3ePbJ5IzIBMg1EBkUqjiHRfO9UAT/FG1cvx3aW97iXWAeM A6oyKGC0ZrrTEx+9Gch5HFGDSmLWoVKQEKX5IkkTJpZ3sxERLG4S+0FZNDYC0jHeHqVrD3JGXc/F1 SyH48iHFPAscU61URhw0syaxrGp6vlbMikge6r7w0RRtwQ9VrSrhBKQ5+4DRxa6QroR4g9sdxVwsr yBJaPDh9eleZosoPiuixttpxbLQOtxcLFWveCCQ9aBNJ1g7FBT6caDnH1eQYYKgAhptBZx/9GCFE1 dLy+3SCkPgSU/wqiEFpg==; 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 1dMtUA-0002KM-3j; Mon, 19 Jun 2017 10:00:42 +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-mediatek@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-mediatek" Errors-To: linux-mediatek-bounces+patchwork-linux-mediatek=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) {