From patchwork Thu Jul 17 17:13:33 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lee Jones X-Patchwork-Id: 33798 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-ie0-f197.google.com (mail-ie0-f197.google.com [209.85.223.197]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 0E10D20969 for ; Thu, 17 Jul 2014 17:13:51 +0000 (UTC) Received: by mail-ie0-f197.google.com with SMTP id rp18sf23844951iec.0 for ; Thu, 17 Jul 2014 10:13:50 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:delivered-to:from:to:cc:subject :date:message-id:sender:precedence:list-id:x-original-sender :x-original-authentication-results:mailing-list:list-post:list-help :list-archive:list-unsubscribe; bh=cxa6ryy4cpT1jsBRkbH60C0E6pHnMMI35dnn02Vq4jc=; b=kjuuw+yaC6396PK8xlzXDVYq+U6NwzMbRDlkDLK9q3Tcvr9Ig2oNCBTcgWrszUZ4ho N/kL2KlT9xE2bKYqgKUoTE1UtJXFitUNWQnhjQrl/KEzf2tLoS5fH3qjyqbA1TbH+JAU LfjgyqBeUGqNyjAA5xoEwycZvOmL36B/HqhZ2A1b3B/pCOn1OhXHrASxVP/LXWmoIYTo AxOkax+jBzh7D6+2C5Z10oUaHLamsKv+bF5UIoSdLfzOtSdAyrwfFicTSZzjMolqD5LM TXag9ZpPiae9ZcJLQp3b3ziUVan/Mv7OPh4V0dt/GuXcFxQJLF+UnEYAvaagqJqH3jk0 bncA== X-Gm-Message-State: ALoCoQngwnI/cgruWI81Ua21vD7WhD5HXNWvFaSZbIGvZpQCFgAFmyOvCV3iKDYVZQWxsWqElkAV X-Received: by 10.183.10.133 with SMTP id ea5mr19852200obd.24.1405617230553; Thu, 17 Jul 2014 10:13:50 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.47.113 with SMTP id l104ls777264qga.61.gmail; Thu, 17 Jul 2014 10:13:50 -0700 (PDT) X-Received: by 10.236.53.69 with SMTP id f45mr64246691yhc.53.1405617230465; Thu, 17 Jul 2014 10:13:50 -0700 (PDT) Received: from mail-vc0-f180.google.com (mail-vc0-f180.google.com [209.85.220.180]) by mx.google.com with ESMTPS id w24si7885711yhf.170.2014.07.17.10.13.50 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 17 Jul 2014 10:13:50 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.220.180 as permitted sender) client-ip=209.85.220.180; Received: by mail-vc0-f180.google.com with SMTP id ij19so5181130vcb.11 for ; Thu, 17 Jul 2014 10:13:50 -0700 (PDT) X-Received: by 10.52.244.138 with SMTP id xg10mr17390685vdc.40.1405617230273; Thu, 17 Jul 2014 10:13:50 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.221.37.5 with SMTP id tc5csp53407vcb; Thu, 17 Jul 2014 10:13:49 -0700 (PDT) X-Received: by 10.68.226.4 with SMTP id ro4mr3841215pbc.8.1405617229435; Thu, 17 Jul 2014 10:13:49 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id f10si1495205pdn.487.2014.07.17.10.13.48; Thu, 17 Jul 2014 10:13:48 -0700 (PDT) Received-SPF: none (google.com: linux-kernel-owner@vger.kernel.org does not designate permitted sender hosts) client-ip=209.132.180.67; Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757783AbaGQRNq (ORCPT + 23 others); Thu, 17 Jul 2014 13:13:46 -0400 Received: from mail-qg0-f42.google.com ([209.85.192.42]:51762 "EHLO mail-qg0-f42.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1757733AbaGQRNp (ORCPT ); Thu, 17 Jul 2014 13:13:45 -0400 Received: by mail-qg0-f42.google.com with SMTP id j5so2269793qga.15 for ; Thu, 17 Jul 2014 10:13:44 -0700 (PDT) X-Received: by 10.140.38.169 with SMTP id t38mr20179349qgt.3.1405617224326; Thu, 17 Jul 2014 10:13:44 -0700 (PDT) Received: from localhost.localdomain (host109-148-232-149.range109-148.btcentralplus.com. [109.148.232.149]) by mx.google.com with ESMTPSA id q68sm3354616qgq.36.2014.07.17.10.13.42 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 17 Jul 2014 10:13:43 -0700 (PDT) From: Lee Jones To: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Cc: lee.jones@linaro.org, kernel@stlinux.com, balbi@ti.com, gregkh@linuxfoundation.org, linux-usb@vger.kernel.org, peter.griffin+familyguy@linaro.org Subject: [RFC PATCH] usb: dwc3: core: allow vendor drivers to check probe status Date: Thu, 17 Jul 2014 18:13:33 +0100 Message-Id: <1405617213-27360-1-git-send-email-lee.jones@linaro.org> X-Mailer: git-send-email 1.8.3.2 Sender: linux-kernel-owner@vger.kernel.org Precedence: list List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: lee.jones@linaro.org X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.220.180 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , This patch provides mechanism for subordinate devices to check whether the DWC3 core probed successfully or otherwise. Useful if PHYs are required to configure controllers, but aren't yet available. The DWC3 core driver will defer probe if PHYs are unavailable, however subordinate DWC3 drivers currently do not have any visibility or means to check status - until now. Another way to do this would be to *_phy_get*(), but if every driver did this it would create a high level of code duplication. Signed-off-by: Lee Jones --- drivers/usb/dwc3/core.c | 12 ++++++++++++ drivers/usb/dwc3/core.h | 1 + 2 files changed, 13 insertions(+) diff --git a/drivers/usb/dwc3/core.c b/drivers/usb/dwc3/core.c index eb69eb9..171ca52 100644 --- a/drivers/usb/dwc3/core.c +++ b/drivers/usb/dwc3/core.c @@ -47,6 +47,14 @@ /* -------------------------------------------------------------------------- */ +static bool is_enabled = false; + +int dwc3_is_enabled(void) +{ + return is_enabled; +} +EXPORT_SYMBOL(dwc3_is_enabled); + void dwc3_set_mode(struct dwc3 *dwc, u32 mode) { u32 reg; @@ -757,6 +765,8 @@ static int dwc3_probe(struct platform_device *pdev) pm_runtime_allow(dev); + is_enabled = true; + return 0; err3: @@ -786,6 +796,8 @@ static int dwc3_remove(struct platform_device *pdev) { struct dwc3 *dwc = platform_get_drvdata(pdev); + is_enabled = false; + usb_phy_set_suspend(dwc->usb2_phy, 1); usb_phy_set_suspend(dwc->usb3_phy, 1); phy_power_off(dwc->usb2_generic_phy); diff --git a/drivers/usb/dwc3/core.h b/drivers/usb/dwc3/core.h index 57332e3..94dee86 100644 --- a/drivers/usb/dwc3/core.h +++ b/drivers/usb/dwc3/core.h @@ -906,6 +906,7 @@ struct dwc3_gadget_ep_cmd_params { /* prototypes */ void dwc3_set_mode(struct dwc3 *dwc, u32 mode); int dwc3_gadget_resize_tx_fifos(struct dwc3 *dwc); +int dwc3_is_enabled(void); #if IS_ENABLED(CONFIG_USB_DWC3_HOST) || IS_ENABLED(CONFIG_USB_DWC3_DUAL_ROLE) int dwc3_host_init(struct dwc3 *dwc);