From patchwork Thu Oct 30 10:30:19 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yoshihiro Shimoda X-Patchwork-Id: 5195491 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 A05E5C11AC for ; Thu, 30 Oct 2014 10:30:50 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id B412B2024C for ; Thu, 30 Oct 2014 10:30:49 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id AB50820122 for ; Thu, 30 Oct 2014 10:30:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1758847AbaJ3Kaq (ORCPT ); Thu, 30 Oct 2014 06:30:46 -0400 Received: from relmlor4.renesas.com ([210.160.252.174]:7974 "EHLO relmlie3.idc.renesas.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1758830AbaJ3Kao (ORCPT ); Thu, 30 Oct 2014 06:30:44 -0400 Received: from unknown (HELO relmlir2.idc.renesas.com) ([10.200.68.152]) by relmlie3.idc.renesas.com with ESMTP; 30 Oct 2014 19:30:43 +0900 Received: from relmlac2.idc.renesas.com (relmlac2.idc.renesas.com [10.200.69.22]) by relmlir2.idc.renesas.com (Postfix) with ESMTP id 2ECFD4BF2A; Thu, 30 Oct 2014 19:30:43 +0900 (JST) Received: by relmlac2.idc.renesas.com (Postfix, from userid 0) id 1FD302806E; Thu, 30 Oct 2014 19:30:43 +0900 (JST) Received: from relmlac2.idc.renesas.com (localhost [127.0.0.1]) by relmlac2.idc.renesas.com (Postfix) with ESMTP id 1869B2806D; Thu, 30 Oct 2014 19:30:43 +0900 (JST) Received: from relmlii1.idc.renesas.com [10.200.68.65] by relmlac2.idc.renesas.com with ESMTP id VBA27776; Thu, 30 Oct 2014 19:30:43 +0900 X-IronPort-AV: E=Sophos;i="5.07,284,1413212400"; d="scan'208";a="172476735" Received: from mail-sg1lp0092.outbound.protection.outlook.com (HELO APAC01-SG1-obe.outbound.protection.outlook.com) ([207.46.51.92]) by relmlii1.idc.renesas.com with ESMTP/TLS/AES256-SHA; 30 Oct 2014 19:30:42 +0900 Received: from localhost (211.11.155.147) by SINPR06MB329.apcprd06.prod.outlook.com (10.141.110.15) with Microsoft SMTP Server (TLS) id 15.1.6.9; Thu, 30 Oct 2014 10:30:41 +0000 From: Yoshihiro Shimoda To: , CC: , , Yoshihiro Shimoda Subject: [PATCH v3 4/4] usb: renesas_usbhs: fix usbhs_pipe_clear() for DCP PIPE Date: Thu, 30 Oct 2014 19:30:19 +0900 Message-ID: <1414665019-1340-5-git-send-email-yoshihiro.shimoda.uh@renesas.com> X-Mailer: git-send-email 1.9.4.msysgit.1 In-Reply-To: <1414665019-1340-1-git-send-email-yoshihiro.shimoda.uh@renesas.com> References: <1414665019-1340-1-git-send-email-yoshihiro.shimoda.uh@renesas.com> MIME-Version: 1.0 X-Originating-IP: [211.11.155.147] X-ClientProxiedBy: SIXPR06CA0058.apcprd06.prod.outlook.com (25.160.171.176) To SINPR06MB329.apcprd06.prod.outlook.com (10.141.110.15) X-MS-Exchange-Transport-FromEntityHeader: Hosted X-Microsoft-Antispam: UriScan:; X-Microsoft-Antispam: BCL:0;PCL:0;RULEID:;SRVR:SINPR06MB329; X-Forefront-PRVS: 038002787A X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10019020)(6069001)(6009001)(199003)(189002)(87286001)(87976001)(50226001)(50986999)(93916002)(92566001)(575784001)(36756003)(120916001)(85852003)(33646002)(42382002)(76482002)(99396003)(19580405001)(19580395003)(122386002)(64706001)(4396001)(50466002)(102836001)(62966002)(77096002)(97736003)(76506005)(48376002)(101416001)(77156001)(20776003)(76176999)(47776003)(66066001)(92726001)(85306004)(42186005)(104166001)(80022003)(46102003)(40100003)(105586002)(21056001)(95666004)(88136002)(31966008)(106356001)(229853001)(107046002)(78352002)(89996001)(88662002); DIR:OUT; SFP:1102; SCL:1; SRVR:SINPR06MB329; H:localhost; FPR:; MLV:sfv; PTR:InfoNoRecords; A:0; MX:0; LANG:; X-OriginatorOrg: renesas.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.5 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, 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 Since the DCPCTR doesn't have the ACLRM bit, the usbus_pipe_clear() should not call the usbhsp_pipectrl_set() with ACLRM. So, this patch fixes this issue to add the usbhs_fifo_clear_dcp() in fifo.c because the controller needs the CFIFO to clear the the DCP PIPE. Signed-off-by: Yoshihiro Shimoda --- drivers/usb/renesas_usbhs/fifo.c | 18 ++++++++++++++++++ drivers/usb/renesas_usbhs/fifo.h | 1 + drivers/usb/renesas_usbhs/mod_gadget.c | 2 +- drivers/usb/renesas_usbhs/mod_host.c | 2 +- drivers/usb/renesas_usbhs/pipe.c | 8 ++++++-- 5 files changed, 27 insertions(+), 4 deletions(-) diff --git a/drivers/usb/renesas_usbhs/fifo.c b/drivers/usb/renesas_usbhs/fifo.c index 0e07925..9b48384 100644 --- a/drivers/usb/renesas_usbhs/fifo.c +++ b/drivers/usb/renesas_usbhs/fifo.c @@ -1160,6 +1160,24 @@ static void usbhsf_dma_complete(void *arg) usbhs_pipe_number(pipe), ret); } +void usbhs_fifo_clear_dcp(struct usbhs_pipe *pipe) +{ + struct usbhs_priv *priv = usbhs_pipe_to_priv(pipe); + struct usbhs_fifo *fifo = usbhsf_get_cfifo(priv); /* CFIFO */ + + /* clear DCP FIFO of transmission */ + if (usbhsf_fifo_select(pipe, fifo, 1) < 0) + return; + usbhsf_fifo_clear(pipe, fifo); + usbhsf_fifo_unselect(pipe, fifo); + + /* clear DCP FIFO of reception */ + if (usbhsf_fifo_select(pipe, fifo, 0) < 0) + return; + usbhsf_fifo_clear(pipe, fifo); + usbhsf_fifo_unselect(pipe, fifo); +} + /* * fifo init */ diff --git a/drivers/usb/renesas_usbhs/fifo.h b/drivers/usb/renesas_usbhs/fifo.h index a168a17..79ad5f9 100644 --- a/drivers/usb/renesas_usbhs/fifo.h +++ b/drivers/usb/renesas_usbhs/fifo.h @@ -74,6 +74,7 @@ int usbhs_fifo_probe(struct usbhs_priv *priv); void usbhs_fifo_remove(struct usbhs_priv *priv); void usbhs_fifo_init(struct usbhs_priv *priv); void usbhs_fifo_quit(struct usbhs_priv *priv); +void usbhs_fifo_clear_dcp(struct usbhs_pipe *pipe); /* * packet info diff --git a/drivers/usb/renesas_usbhs/mod_gadget.c b/drivers/usb/renesas_usbhs/mod_gadget.c index c46641a..878334d 100644 --- a/drivers/usb/renesas_usbhs/mod_gadget.c +++ b/drivers/usb/renesas_usbhs/mod_gadget.c @@ -782,9 +782,9 @@ static int usbhsg_try_start(struct usbhs_priv *priv, u32 status) /* * pipe initialize and enable DCP */ + usbhs_fifo_init(priv); usbhs_pipe_init(priv, usbhsg_dma_map_ctrl); - usbhs_fifo_init(priv); /* dcp init instead of usbhsg_ep_enable() */ dcp->pipe = usbhs_dcp_malloc(priv); diff --git a/drivers/usb/renesas_usbhs/mod_host.c b/drivers/usb/renesas_usbhs/mod_host.c index 10e1ded..f0d3231 100644 --- a/drivers/usb/renesas_usbhs/mod_host.c +++ b/drivers/usb/renesas_usbhs/mod_host.c @@ -1474,9 +1474,9 @@ static int usbhsh_start(struct usbhs_priv *priv) /* * pipe initialize and enable DCP */ + usbhs_fifo_init(priv); usbhs_pipe_init(priv, usbhsh_dma_map_ctrl); - usbhs_fifo_init(priv); usbhsh_pipe_init_for_host(priv); /* diff --git a/drivers/usb/renesas_usbhs/pipe.c b/drivers/usb/renesas_usbhs/pipe.c index 040bcef..007f45a 100644 --- a/drivers/usb/renesas_usbhs/pipe.c +++ b/drivers/usb/renesas_usbhs/pipe.c @@ -618,8 +618,12 @@ void usbhs_pipe_data_sequence(struct usbhs_pipe *pipe, int sequence) void usbhs_pipe_clear(struct usbhs_pipe *pipe) { - usbhsp_pipectrl_set(pipe, ACLRM, ACLRM); - usbhsp_pipectrl_set(pipe, ACLRM, 0); + if (usbhs_pipe_is_dcp(pipe)) { + usbhs_fifo_clear_dcp(pipe); + } else { + usbhsp_pipectrl_set(pipe, ACLRM, ACLRM); + usbhsp_pipectrl_set(pipe, ACLRM, 0); + } } static struct usbhs_pipe *usbhsp_get_pipe(struct usbhs_priv *priv, u32 type)