From patchwork Thu May 14 04:01:12 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Macpaul Lin X-Patchwork-Id: 11547729 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 9E877912 for ; Thu, 14 May 2020 04:01:38 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 833F720575 for ; Thu, 14 May 2020 04:01:38 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=mediatek.com header.i=@mediatek.com header.b="W0Bs7A4J" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1725788AbgENEBa (ORCPT ); Thu, 14 May 2020 00:01:30 -0400 Received: from mailgw02.mediatek.com ([210.61.82.184]:55251 "EHLO mailgw02.mediatek.com" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1725290AbgENEB3 (ORCPT ); Thu, 14 May 2020 00:01:29 -0400 X-UUID: 2d07cbdbd61b41e19992e24d852812ac-20200514 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=mediatek.com; s=dk; h=Content-Transfer-Encoding:Content-Type:MIME-Version:Message-ID:Date:Subject:CC:To:From; bh=Vq25CpGWDu4hIaBmnMbm4KOdW3U78xl9MWNuHHP8T8w=; b=W0Bs7A4Jn2c2RwT1+rEF3uzTWZ5LFHb0PuxVMa6PhglatDohufz/Hhi9W7q/kG0AiwVvZc8lIyN1FXVXTWJO/3pHf8/Cqp/cEwiId1OT9Pzz9d5VW+fQTQLgtX4PL50gB/Myhh+p/f+E1l1nsC7D91JatSF72695Izozx0KJm3Q=; X-UUID: 2d07cbdbd61b41e19992e24d852812ac-20200514 Received: from mtkcas07.mediatek.inc [(172.21.101.84)] by mailgw02.mediatek.com (envelope-from ) (Cellopoint E-mail Firewall v4.1.10 Build 0809 with TLS) with ESMTP id 1918152551; Thu, 14 May 2020 12:01:25 +0800 Received: from mtkcas08.mediatek.inc (172.21.101.126) by mtkmbs01n2.mediatek.inc (172.21.101.79) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Thu, 14 May 2020 12:01:20 +0800 Received: from mtkswgap22.mediatek.inc (172.21.77.33) by mtkcas08.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.0.1497.2 via Frontend Transport; Thu, 14 May 2020 12:01:19 +0800 From: Macpaul Lin To: Min Guo , Chunfeng Yun , Hans de Goede , Bin Liu , Greg Kroah-Hartman , Matthias Brugger , , , , CC: Mediatek WSD Upstream , Macpaul Lin , Macpaul Lin Subject: [PATCH] usb: musb: mediatek: add reset FADDR to zero in reset interrupt handle Date: Thu, 14 May 2020 12:01:12 +0800 Message-ID: <1589428872-29282-1-git-send-email-macpaul.lin@mediatek.com> X-Mailer: git-send-email 1.7.9.5 MIME-Version: 1.0 X-TM-SNTS-SMTP: 7786936E7E97A400A420A3B5D83AA16F375A89018EEAA40ED48FEFC21FA816762000:8 X-MTK: N Sender: linux-usb-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.kernel.org When receiving reset interrupt, FADDR need to be reset to zero in periphearl mode. Otherwise ep0 cannot do enumeration when re-pluging USB cable. Signed-off-by: Macpaul Lin Acked-by:Min Guo --- drivers/usb/musb/mediatek.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/drivers/usb/musb/mediatek.c b/drivers/usb/musb/mediatek.c index 6196b0e..eebeadd 100644 --- a/drivers/usb/musb/mediatek.c +++ b/drivers/usb/musb/mediatek.c @@ -208,6 +208,12 @@ static irqreturn_t generic_interrupt(int irq, void *__hci) musb->int_rx = musb_clearw(musb->mregs, MUSB_INTRRX); musb->int_tx = musb_clearw(musb->mregs, MUSB_INTRTX); + if ((musb->int_usb & MUSB_INTR_RESET) && !is_host_active(musb)) { + /* ep0 FADDR must be 0 when (re)entering peripheral mode */ + musb_ep_select(musb->mregs, 0); + musb_writeb(musb->mregs, MUSB_FADDR, 0); + } + if (musb->int_usb || musb->int_tx || musb->int_rx) retval = musb_interrupt(musb);