From patchwork Wed Jul 9 10:01:34 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vivek Gautam X-Patchwork-Id: 4513041 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 05A769F3FF for ; Wed, 9 Jul 2014 10:06:24 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 238482015A for ; Wed, 9 Jul 2014 10:06:23 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 33A5D20145 for ; Wed, 9 Jul 2014 10:06:22 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1X4ohi-0006SN-DR; Wed, 09 Jul 2014 10:02:22 +0000 Received: from mail-pa0-x232.google.com ([2607:f8b0:400e:c03::232]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1X4ohX-0006E0-47 for linux-arm-kernel@lists.infradead.org; Wed, 09 Jul 2014 10:02:14 +0000 Received: by mail-pa0-f50.google.com with SMTP id bj1so9063509pad.9 for ; Wed, 09 Jul 2014 03:01:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references; bh=lbaxZ4YiXR4Qwp6KYCVPpnFmP4VB9wp+H5adejSbWj8=; b=F6mDUu+tfG3mswEXeGEqhkBU4yjZWK2GpD68PlheoIqAoyH14KoThoViZixXpzH4pU N7yeZ+78DcPh60oPMW2SKnRf9ZCbA/FEAiRduAuTxBYcnJ+wUHgtlypxI62pyj28gSbC LAKKifb2lC/G1W/09AMGFBzzD8+DimYu37FKNiF8j7M6Z/5rEvxfZcTl1+Mb/cja51jQ EmMOj6Y57KBpuCibdk5PzaCL+n476WRBo9dI5WfIIwyMuXtXWQALt+ehDaGy+XulSfZl 6Y65Gt4ouuwARhOrG76cl7o+CwATES/jEEXN+MvBnpVIU1kUUqpHvq15fVzXqZ6ft6TJ 6SWA== X-Received: by 10.70.130.164 with SMTP id of4mr10258228pdb.59.1404900114410; Wed, 09 Jul 2014 03:01:54 -0700 (PDT) Received: from vivek-linuxpc.sisodomain.com ([14.140.216.146]) by mx.google.com with ESMTPSA id co3sm58341286pbb.89.2014.07.09.03.01.50 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 09 Jul 2014 03:01:53 -0700 (PDT) From: Vivek Gautam To: linux-usb@vger.kernel.org, linux-samsung-soc@vger.kernel.org Subject: [PATCH v2 2/4] usb: host: xhci-plat: Get PHYs for xhci's hcds Date: Wed, 9 Jul 2014 15:31:34 +0530 Message-Id: <1404900096-1721-3-git-send-email-gautam.vivek@samsung.com> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1404900096-1721-1-git-send-email-gautam.vivek@samsung.com> References: <1404900096-1721-1-git-send-email-gautam.vivek@samsung.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20140709_030211_210227_60AB76E8 X-CRM114-Status: GOOD ( 13.95 ) X-Spam-Score: -0.4 (/) Cc: pratyush.anand@st.com, kgene.kim@samsung.com, sergei.shtylyov@cogentembedded.com, mathias.nyman@intel.com, gregkh@linuxfoundation.org, linux-kernel@vger.kernel.org, kishon@ti.com, heikki.krogerus@linux.intel.com, Vivek Gautam , jwerner@chromium.org, linux-arm-kernel@lists.infradead.org X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-2.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, RP_MATCHES_RCVD, T_DKIM_INVALID, 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 The host controller by itself may sometimes need to handle PHY and/or calibrate some of the PHY settings to get full support out of the PHY controller. The PHY core provides a calibration funtionality now to do so. Therefore, facilitate getting the two possible PHYs, viz. USB 2.0 type (UTMI+) and USB 3.0 type (PIPE3), provided by the parent - Synopsys's DWC3 controller Signed-off-by: Vivek Gautam --- drivers/usb/host/xhci-plat.c | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) diff --git a/drivers/usb/host/xhci-plat.c b/drivers/usb/host/xhci-plat.c index 29d8adb..e50bd7d 100644 --- a/drivers/usb/host/xhci-plat.c +++ b/drivers/usb/host/xhci-plat.c @@ -16,6 +16,7 @@ #include #include #include +#include #include #include "xhci.h" @@ -101,6 +102,7 @@ static int xhci_plat_probe(struct platform_device *pdev) struct clk *clk; int ret; int irq; + struct device *parent; if (usb_disabled()) return -ENODEV; @@ -165,6 +167,23 @@ static int xhci_plat_probe(struct platform_device *pdev) goto unmap_registers; } + parent = pdev->dev.parent; + /* + * Get possile USB 2.0 type PHY (UTMI+) registered by xhci's parent: + * Synopsys-dwc3 + */ + if (of_device_is_compatible(parent->of_node, "synopsys,dwc3") || + of_device_is_compatible(parent->of_node, "snps,dwc3")) { + hcd->gen_phy = devm_phy_get(&pdev->dev, "usb2-phy"); + if (IS_ERR(hcd->gen_phy)) { + ret = PTR_ERR(hcd->gen_phy); + if (ret != -ENOSYS && ret != -ENODEV) { + dev_err(&pdev->dev, "no usb2 phy configured\n"); + return ret; + } + } + } + ret = usb_add_hcd(hcd, irq, IRQF_SHARED); if (ret) goto disable_clk; @@ -191,6 +210,23 @@ static int xhci_plat_probe(struct platform_device *pdev) if (HCC_MAX_PSA(xhci->hcc_params) >= 4) xhci->shared_hcd->can_do_streams = 1; + /* + * Get possile USB 3.0 type PHY (PIPE3) registered by xhci's parent: + * Synopsys-dwc3 + */ + if (of_device_is_compatible(parent->of_node, "synopsys,dwc3") || + of_device_is_compatible(parent->of_node, "snps,dwc3")) { + xhci->shared_hcd->gen_phy = devm_phy_get(&pdev->dev, + "usb3-phy"); + if (IS_ERR(xhci->shared_hcd->gen_phy)) { + ret = PTR_ERR(xhci->shared_hcd->gen_phy); + if (ret != -ENOSYS && ret != -ENODEV) { + dev_err(&pdev->dev, "no usb3 phy configured\n"); + return ret; + } + } + } + ret = usb_add_hcd(xhci->shared_hcd, irq, IRQF_SHARED); if (ret) goto put_usb3_hcd;