From patchwork Fri Jun 6 12:12:13 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vivek Gautam X-Patchwork-Id: 4311411 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 951E69F170 for ; Fri, 6 Jun 2014 12:13:51 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id C2253201DD for ; Fri, 6 Jun 2014 12:13:50 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id EA017201BC for ; Fri, 6 Jun 2014 12:13:49 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751608AbaFFMMp (ORCPT ); Fri, 6 Jun 2014 08:12:45 -0400 Received: from mail-pd0-f176.google.com ([209.85.192.176]:47206 "EHLO mail-pd0-f176.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751578AbaFFMMn (ORCPT ); Fri, 6 Jun 2014 08:12:43 -0400 Received: by mail-pd0-f176.google.com with SMTP id p10so2342890pdj.35 for ; Fri, 06 Jun 2014 05:12:42 -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=1a+oaz9Waa2ATNmBJ8E12R+P2bYtk0umSD3S6rGk9xI=; b=l+lFWIYuZpuHvhrz85aBx+uu6pQn4wtgVMMNvaGlDbOWdxDsbUAwYFpHKK51CrH5M3 hnytGxbKSkBQVgzakcItYKDxGWquMSu3tVfwiu8qV8qZtQCyrig6b1H8Sk8A38zyiHay 4e+1a35mZgs9cwTUBMinIwSUIvexrjVP93MV2DKc8bfGk3WrZaifS2bN5s8lMruHJC6M wOK5oMI2ZJm52R2e+yTxSrXlopYHw+LwaWWU6+ZmugKeEiHNbzPGzaILAtPpXVjpussU MTdvutLU2j9ivD+oaMDLqNhH9IAnRSuxQlD/Vn7lX9V75MzHtnvTowNhAcU3pOSXJG+G TeVg== X-Received: by 10.68.103.165 with SMTP id fx5mr118770pbb.118.1402056762884; Fri, 06 Jun 2014 05:12:42 -0700 (PDT) Received: from vivek-linuxpc.sisodomain.com ([14.140.216.146]) by mx.google.com with ESMTPSA id su8sm35172740pbc.72.2014.06.06.05.12.38 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 06 Jun 2014 05:12:42 -0700 (PDT) From: Vivek Gautam To: linux-usb@vger.kernel.org, linux-samsung-soc@vger.kernel.org, gregkh@linuxfoundation.org, kishon@ti.com, mathias.nyman@intel.com Cc: linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, kgene.kim@samsung.com, jwerner@chromium.org, Vivek Gautam Subject: [PATCH 2/4] usb: host: xhci-plat: Add support to get PHYs Date: Fri, 6 Jun 2014 17:42:13 +0530 Message-Id: <1402056736-12674-3-git-send-email-gautam.vivek@samsung.com> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1402056736-12674-1-git-send-email-gautam.vivek@samsung.com> References: <1402056736-12674-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 PHY types for xhci controller, viz. USB 2.0 type (UTMI+) and USB 3.0 type (PIPE3) from its parent. Signed-off-by: Vivek Gautam --- drivers/usb/host/xhci-plat.c | 24 ++++++++++++++++++++++++ drivers/usb/host/xhci.h | 3 +++ 2 files changed, 27 insertions(+) diff --git a/drivers/usb/host/xhci-plat.c b/drivers/usb/host/xhci-plat.c index 29d8adb..e7145b5 100644 --- a/drivers/usb/host/xhci-plat.c +++ b/drivers/usb/host/xhci-plat.c @@ -17,6 +17,7 @@ #include #include #include +#include #include "xhci.h" #include "xhci-mvebu.h" @@ -183,6 +184,29 @@ static int xhci_plat_probe(struct platform_device *pdev) } /* + * Get possile USB 2.0 type PHY (UTMI+), as well as + * USB 3.0 type PHY (PIPE3). + * The host controller may need to handle PHYs by itself too + * sometimes, so as to calibrate it based on the need. + */ + xhci->phy2_gen = devm_phy_get(&pdev->dev, "usb2-phy"); + if (IS_ERR(xhci->phy2_gen)) { + ret = PTR_ERR(xhci->phy2_gen); + if (ret != -ENOSYS && ret != -ENODEV) { + dev_err(&pdev->dev, "no usb2 phy configured\n"); + return ret; + } + } + xhci->phy3_gen = devm_phy_get(&pdev->dev, "usb3-phy"); + if (IS_ERR(xhci->phy3_gen)) { + ret = PTR_ERR(xhci->phy3_gen); + if (ret != -ENOSYS && ret != -ENODEV) { + dev_err(&pdev->dev, "no usb3 phy configured\n"); + return ret; + } + } + + /* * Set the xHCI pointer before xhci_plat_setup() (aka hcd_driver.reset) * is called by usb_add_hcd(). */ diff --git a/drivers/usb/host/xhci.h b/drivers/usb/host/xhci.h index 9ffecd5..453d89e 100644 --- a/drivers/usb/host/xhci.h +++ b/drivers/usb/host/xhci.h @@ -1582,6 +1582,9 @@ struct xhci_hcd { u32 port_status_u0; /* Compliance Mode Timer Triggered every 2 seconds */ #define COMP_MODE_RCVRY_MSECS 2000 + /* phys for the controller */ + struct phy *phy2_gen; + struct phy *phy3_gen; }; /* convert between an HCD pointer and the corresponding EHCI_HCD */