From patchwork Fri Jul 20 12:05:58 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Crispin X-Patchwork-Id: 10536601 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 75617602CA for ; Fri, 20 Jul 2018 12:06:11 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 60E98292BF for ; Fri, 20 Jul 2018 12:06:11 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 550E2296CD; Fri, 20 Jul 2018 12:06:11 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00, MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B591B292BF for ; Fri, 20 Jul 2018 12:06:10 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727749AbeGTMyD (ORCPT ); Fri, 20 Jul 2018 08:54:03 -0400 Received: from nbd.name ([46.4.11.11]:51260 "EHLO nbd.name" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727693AbeGTMyD (ORCPT ); Fri, 20 Jul 2018 08:54:03 -0400 From: John Crispin To: Minas Harutyunyan , Greg Kroah-Hartman Cc: linux-usb@vger.kernel.org, Serge Vasilugin , John Crispin Subject: [PATCH/RFC] usb: dwc2: awake rt305x USB controller Date: Fri, 20 Jul 2018 14:05:58 +0200 Message-Id: <20180720120558.8831-1-john@phrozen.org> X-Mailer: git-send-email 2.11.0 Sender: linux-usb-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Serge Vasilugin The Ralink uboot sets the USB controller into sleep mode. This patch checks this condition and awakes controller before any register access. Signed-off-by: Serge Vasilugin Signed-off-by: John Crispin --- Hi, we have been carrying this patch inside OpenWrt for half a decade. The USB driver that is included in the Ralink SDK does a mdelay(25) after this call but it works without apparently. John drivers/usb/dwc2/platform.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/drivers/usb/dwc2/platform.c b/drivers/usb/dwc2/platform.c index 4c0819554bcd..0bc9fd65e29e 100644 --- a/drivers/usb/dwc2/platform.c +++ b/drivers/usb/dwc2/platform.c @@ -419,6 +419,10 @@ static int dwc2_driver_probe(struct platform_device *dev) if (retval) return retval; + /* Enable USB port before any regs access */ + if (dwc2_readl(hsotg->regs + PCGCTL) & 0x0f) + dwc2_writel(0x00, hsotg->regs + PCGCTL); + retval = dwc2_get_dr_mode(hsotg); if (retval) goto error;