From patchwork Tue Sep 2 11:12:16 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vivek Gautam X-Patchwork-Id: 4824531 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 7641F9F2ED for ; Tue, 2 Sep 2014 11:15:37 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 5422020170 for ; Tue, 2 Sep 2014 11:15:36 +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 0AEA7200FF for ; Tue, 2 Sep 2014 11:15:35 +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 1XOm1S-0000tc-MO; Tue, 02 Sep 2014 11:13:14 +0000 Received: from mail-pa0-x22f.google.com ([2607:f8b0:400e:c03::22f]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1XOm1M-0000nk-EX for linux-arm-kernel@lists.infradead.org; Tue, 02 Sep 2014 11:13:08 +0000 Received: by mail-pa0-f47.google.com with SMTP id hz1so14425640pad.20 for ; Tue, 02 Sep 2014 04:12:47 -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=jo1XTEuNbUl+c5j20/TTQM7INPy3Y0eJJ02iFMIAeFg=; b=sKLJhlEwhLig84s+evVX3RVC6ktp/pD27BHS+xCDdhEUKU+hgcLfisBs7woICLFd6Z MU2rH9kkeuAkIG+4LRx8YUafvF6147GY8UZbWTEztLBSj7GvL70eaIWXee+PZDMNxhgp irCY8FQnzaQLO2g5KpDRQno5BRNyvm2dQvqooj1B/iBbv1tNvZFo23k/ucu+8YCMTnIo F3DBCSap1Z7ZUdgsbli+RfzxLtc1ajSkROqSFE5yzZm8/2KXg7M766oltKRFQmf53MsZ niK//QpKrUZE9jVamka8EZtoMEr/ZfbDaOSVFPEOFhM53cxNjlDfTkO1Ere6NqvYRLPc nlYQ== X-Received: by 10.66.121.200 with SMTP id lm8mr46427048pab.1.1409656367234; Tue, 02 Sep 2014 04:12:47 -0700 (PDT) Received: from vivek-linuxpc.sisodomain.com ([14.140.216.146]) by mx.google.com with ESMTPSA id ry9sm3602503pbc.94.2014.09.02.04.12.42 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 02 Sep 2014 04:12:46 -0700 (PDT) From: Vivek Gautam To: linux-usb@vger.kernel.org Subject: [PATCH v6 2/4] usb: host: xhci-plat: Get PHYs for xhci's hcds Date: Tue, 2 Sep 2014 16:42:16 +0530 Message-Id: <1409656338-20337-3-git-send-email-gautam.vivek@samsung.com> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1409656338-20337-1-git-send-email-gautam.vivek@samsung.com> References: <1409656338-20337-1-git-send-email-gautam.vivek@samsung.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20140902_041308_517298_989441C9 X-CRM114-Status: GOOD ( 12.71 ) X-Spam-Score: -0.4 (/) Cc: linux-samsung-soc@vger.kernel.org, sergei.shtylyov@cogentembedded.com, mathias.nyman@intel.com, gregkh@linuxfoundation.org, jg1.han@samsung.com, linux-kernel@vger.kernel.org, balbi@ti.com, kishon@ti.com, kgene.kim@samsung.com, stern@rowland.harvard.edu, Vivek Gautam , heikki.krogerus@linux.intel.com, 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=-3.5 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_NONE,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). Signed-off-by: Vivek Gautam --- drivers/usb/host/xhci-plat.c | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/drivers/usb/host/xhci-plat.c b/drivers/usb/host/xhci-plat.c index 1a0cf9f..6afd508 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 @@ -180,6 +181,19 @@ static int xhci_plat_probe(struct platform_device *pdev) goto put_hcd; } + /* Get possile USB 2.0 type PHY (UTMI+) available with xhci */ + hcd->gen_phy = devm_phy_get(&pdev->dev, "usb2-phy"); + if (IS_ERR(hcd->gen_phy)) { + ret = PTR_ERR(hcd->gen_phy); + if (ret == -EPROBE_DEFER) { + return ret; + } else if (ret != -ENOSYS && ret != -ENODEV) { + hcd->gen_phy = NULL; + dev_warn(&pdev->dev, + "Error retrieving usb2 phy: %d\n", ret); + } + } + ret = usb_add_hcd(hcd, irq, IRQF_SHARED); if (ret) goto disable_clk; @@ -209,6 +223,19 @@ 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) available with xhci */ + 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 == -EPROBE_DEFER) { + return ret; + } else if (ret != -ENOSYS && ret != -ENODEV) { + xhci->shared_hcd->gen_phy = NULL; + dev_warn(&pdev->dev, + "Error retrieving usb3 phy: %d\n", ret); + } + } + ret = usb_add_hcd(xhci->shared_hcd, irq, IRQF_SHARED); if (ret) goto put_usb3_hcd;