From patchwork Wed Nov 20 17:38:00 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ulrich Hecht X-Patchwork-Id: 3214011 Return-Path: X-Original-To: patchwork-linux-sh@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id D7BA2C045B for ; Wed, 20 Nov 2013 17:39:18 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id C2E8F2075F for ; Wed, 20 Nov 2013 17:39:17 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id DDBEC2076C for ; Wed, 20 Nov 2013 17:39:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753698Ab3KTRjP (ORCPT ); Wed, 20 Nov 2013 12:39:15 -0500 Received: from mail-bk0-f44.google.com ([209.85.214.44]:39565 "EHLO mail-bk0-f44.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753952Ab3KTRjN (ORCPT ); Wed, 20 Nov 2013 12:39:13 -0500 Received: by mail-bk0-f44.google.com with SMTP id d7so3437094bkh.3 for ; Wed, 20 Nov 2013 09:39:12 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=6vE6SFfOv6dDtgx+vJTieIdx6RdkzrzFlseV5HJ2C/I=; b=Qs63/2yvlighE5g2F4JGR7ohXKGR+okp7zONVW8g0YtxQmX7I0veUrrUQyBwfDt1O8 754ijEQ+Om3NbUsmmKpnFtM51MunMKGbXm9Ej7/fn56ZAWx4AarwQ5siG1vEvehY8/QB fAlbNiikGiwRIZXgKNDiRWT1bQcZ1b5JMj6Jdib2ZzlXlfCR9q9RrHpsWuByPVKv+O9G o1kbrK7CwJuZfyJ9E3vjEmTK5Msr4CvzZEmoLWQE7QvZ7RphqzbZpFLZLiF/kCsO+bQ7 KxYMC+7Ku/MNO8AMWvlOsAxPC85FAUBuXD5kIU8831vpBZ8k0Ee632AT3cfulkEBla3i wRlw== X-Received: by 10.205.37.132 with SMTP id te4mr739915bkb.29.1384969152317; Wed, 20 Nov 2013 09:39:12 -0800 (PST) Received: from groucho.site ([109.201.152.7]) by mx.google.com with ESMTPSA id no2sm24117885bkb.15.2013.11.20.09.39.10 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 20 Nov 2013 09:39:11 -0800 (PST) From: Ulrich Hecht To: Simon Horman Cc: linux-sh@vger.kernel.org, Magnus Damm , Kuninori Morimoto , Laurent Pinchart , Valentine Barshak , linux-usb@vger.kernel.org, Felipe Balbi , Alan Stern Subject: [PATCH 3/9] usb: hcd: Initialize USB phy if needed Date: Wed, 20 Nov 2013 18:38:00 +0100 Message-Id: <1384969086-8920-4-git-send-email-ulrich.hecht@gmail.com> X-Mailer: git-send-email 1.8.4 In-Reply-To: <1384969086-8920-1-git-send-email-ulrich.hecht@gmail.com> References: <1384969086-8920-1-git-send-email-ulrich.hecht@gmail.com> Sender: linux-sh-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-sh@vger.kernel.org X-Spam-Status: No, score=-7.3 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, T_DKIM_INVALID, UNPARSEABLE_RELAY autolearn=ham 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 From: Valentine Barshak This adds external USB phy support to USB HCD driver that allows to find and initialize external USB phy, bound to the HCD, when the HCD is added. The usb_add_hcd function returns -EPROBE_DEFER if the USB phy, bound to the HCD, is not ready. If no USB phy is bound, the HCD is initialized as usual. Signed-off-by: Valentine Barshak Acked-by: Alan Stern --- drivers/usb/core/hcd.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/drivers/usb/core/hcd.c b/drivers/usb/core/hcd.c index d939521..fd09ec6 100644 --- a/drivers/usb/core/hcd.c +++ b/drivers/usb/core/hcd.c @@ -2597,6 +2597,26 @@ int usb_add_hcd(struct usb_hcd *hcd, int retval; struct usb_device *rhdev; +#ifdef CONFIG_USB_PHY + if (!hcd->phy) { + struct usb_phy *phy = usb_get_phy_dev(hcd->self.controller, 0); + + if (IS_ERR(phy)) { + retval = PTR_ERR(phy); + if (retval == -EPROBE_DEFER) + return retval; + } else { + retval = usb_phy_init(phy); + if (retval) { + usb_put_phy(phy); + return retval; + } + hcd->phy = phy; + hcd->remove_phy = 1; + } + } +#endif + dev_info(hcd->self.controller, "%s\n", hcd->product_desc); /* Keep old behaviour if authorized_default is not in [0, 1]. */