From patchwork Tue Nov 25 13:11:44 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: George Cherian X-Patchwork-Id: 5378991 Return-Path: X-Original-To: patchwork-linux-omap@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 01C8AC11AC for ; Tue, 25 Nov 2014 13:20:34 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 6AFA720108 for ; Tue, 25 Nov 2014 13:20:29 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id B7E42201BB for ; Tue, 25 Nov 2014 13:20:24 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752721AbaKYNQN (ORCPT ); Tue, 25 Nov 2014 08:16:13 -0500 Received: from arroyo.ext.ti.com ([192.94.94.40]:37184 "EHLO arroyo.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751990AbaKYNQK (ORCPT ); Tue, 25 Nov 2014 08:16:10 -0500 Received: from dlelxv90.itg.ti.com ([172.17.2.17]) by arroyo.ext.ti.com (8.13.7/8.13.7) with ESMTP id sAPDF8Pv022495; Tue, 25 Nov 2014 07:15:08 -0600 Received: from DLEE70.ent.ti.com (dlemailx.itg.ti.com [157.170.170.113]) by dlelxv90.itg.ti.com (8.14.3/8.13.8) with ESMTP id sAPDF81h031750; Tue, 25 Nov 2014 07:15:08 -0600 Received: from dlep33.itg.ti.com (157.170.170.75) by DLEE70.ent.ti.com (157.170.170.113) with Microsoft SMTP Server id 14.3.174.1; Tue, 25 Nov 2014 07:15:05 -0600 Received: from george-pc.apr.dhcp.ti.com (ileax41-snat.itg.ti.com [10.172.224.153]) by dlep33.itg.ti.com (8.14.3/8.13.8) with ESMTP id sAPDEBE1020093; Tue, 25 Nov 2014 07:15:00 -0600 From: George Cherian To: , , , , CC: , , , , , , , , , , , , , , , George Cherian Subject: [PATCH 08/19] usb: dwc3: core: Add dwc3_drd_helper function Date: Tue, 25 Nov 2014 18:41:44 +0530 Message-ID: <1416921115-10467-9-git-send-email-george.cherian@ti.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1416921115-10467-1-git-send-email-george.cherian@ti.com> References: <1416921115-10467-1-git-send-email-george.cherian@ti.com> MIME-Version: 1.0 Sender: linux-omap-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-omap@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, T_RP_MATCHES_RCVD, 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 This helper function, facilitates to re-initialize the event buffers. It re-initilizes the event buffers while switching role from HOST to DEVICE mode. The DWC3 IP shares internal RAM for both HOST and Device specific registers. So while switching roles from HOST to Device modes, it's required to re-initialize the EVENT buffer registers for the Device mode to continue work properly. dwc3_event_buffers_setup() is exported out from core.c via wrapper dwc3_core_gadget_helper() which will be invoked from dwc3 otg driver. Signed-off-by: George Cherian --- drivers/usb/dwc3/core.c | 5 +++++ drivers/usb/dwc3/core.h | 1 + 2 files changed, 6 insertions(+) diff --git a/drivers/usb/dwc3/core.c b/drivers/usb/dwc3/core.c index 25ddc39..fadd767 100644 --- a/drivers/usb/dwc3/core.c +++ b/drivers/usb/dwc3/core.c @@ -254,6 +254,11 @@ static void dwc3_event_buffers_cleanup(struct dwc3 *dwc) } } +int dwc3_core_gadget_helper(struct dwc3 *dwc) +{ + return dwc3_event_buffers_setup(dwc); +} + static int dwc3_alloc_scratch_buffers(struct dwc3 *dwc) { if (!dwc->has_hibernation) diff --git a/drivers/usb/dwc3/core.h b/drivers/usb/dwc3/core.h index 4bb9aa6..6b38223 100644 --- a/drivers/usb/dwc3/core.h +++ b/drivers/usb/dwc3/core.h @@ -981,6 +981,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_core_gadget_helper(struct dwc3 *dwc); #if IS_ENABLED(CONFIG_USB_DWC3_HOST) || IS_ENABLED(CONFIG_USB_DWC3_DUAL_ROLE) int dwc3_host_init(struct dwc3 *dwc);