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: 4512991 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 D79B89F36A for ; Wed, 9 Jul 2014 10:03:06 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 04A1A202E6 for ; Wed, 9 Jul 2014 10:03:06 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 0D166202B4 for ; Wed, 9 Jul 2014 10:03:05 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755385AbaGIKB5 (ORCPT ); Wed, 9 Jul 2014 06:01:57 -0400 Received: from mail-pa0-f49.google.com ([209.85.220.49]:59935 "EHLO mail-pa0-f49.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755355AbaGIKBz (ORCPT ); Wed, 9 Jul 2014 06:01:55 -0400 Received: by mail-pa0-f49.google.com with SMTP id lj1so8839119pab.8 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 Cc: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, gregkh@linuxfoundation.org, kishon@ti.com, kgene.kim@samsung.com, mathias.nyman@intel.com, jwerner@chromium.org, sergei.shtylyov@cogentembedded.com, heikki.krogerus@linux.intel.com, pratyush.anand@st.com, Vivek Gautam 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> 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=-7.4 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), 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;