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: 4824511 Return-Path: X-Original-To: patchwork-linux-samsung-soc@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 7D5F59F2ED for ; Tue, 2 Sep 2014 11:13:44 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 98D2220172 for ; Tue, 2 Sep 2014 11:13:43 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id A4C47200FF for ; Tue, 2 Sep 2014 11:13:42 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752599AbaIBLMt (ORCPT ); Tue, 2 Sep 2014 07:12:49 -0400 Received: from mail-pd0-f175.google.com ([209.85.192.175]:52680 "EHLO mail-pd0-f175.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753890AbaIBLMr (ORCPT ); Tue, 2 Sep 2014 07:12:47 -0400 Received: by mail-pd0-f175.google.com with SMTP id ft15so8406208pdb.34 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 Cc: linux-samsung-soc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, gregkh@linuxfoundation.org, kishon@ti.com, balbi@ti.com, stern@rowland.harvard.edu, kgene.kim@samsung.com, heikki.krogerus@linux.intel.com, mathias.nyman@intel.com, sergei.shtylyov@cogentembedded.com, jg1.han@samsung.com, Vivek Gautam 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> Sender: linux-samsung-soc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-samsung-soc@vger.kernel.org X-Spam-Status: No, score=-8.5 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,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;