From patchwork Mon May 21 19:58:18 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Stultz X-Patchwork-Id: 10416267 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 7680E60365 for ; Mon, 21 May 2018 19:58:27 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5C7B4274D0 for ; Mon, 21 May 2018 19:58:27 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 510F727FA5; Mon, 21 May 2018 19:58:27 +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.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI, T_DKIM_INVALID 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 90225274D0 for ; Mon, 21 May 2018 19:58:26 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751429AbeEUT6Y (ORCPT ); Mon, 21 May 2018 15:58:24 -0400 Received: from mail-pg0-f67.google.com ([74.125.83.67]:35528 "EHLO mail-pg0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750977AbeEUT6Y (ORCPT ); Mon, 21 May 2018 15:58:24 -0400 Received: by mail-pg0-f67.google.com with SMTP id 11-v6so5175021pge.2 for ; Mon, 21 May 2018 12:58:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id; bh=oPkRK+zhRj52+4+X2JyWpW+9iAiXlHGzGgpLGCvsyCM=; b=jl8JmkVTpSfAKujnbXUbjpHhOZeLTP/Wa4AsbrXmfSlRnMoMFceUb5Mmqg+TvRMmfE 9iU2Kj1AfQWPEjhYwjUgGPax7PlfjbnsT3WjQ32kHLSu1DQqV3QD90jO2OlSUxl7pzwK gNTDcvPbbJXBxrt+4CHBziIZrrtWVVFmrCIrc= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=oPkRK+zhRj52+4+X2JyWpW+9iAiXlHGzGgpLGCvsyCM=; b=LuKTfJVvkCpTKvXFY5F+niZuzkxxeCjp/oxxHjh2WJLvqH3JGNpHg7bzXBuipowQ2e 5JRB5Qodj9m52oq8OMhsqPC16vYqA6YfEMt+IdvKnLMBu+YcZpHUFJ+Yx82gezTVZ1iK H2TUkQN0Rq3DFUyuEtDEA4qgEwBucuY/WBbnD46tsmuawobGURXDhwRAti8MYbK44PnT XUzrZuWtk7qswi94WsBDrZWdhEEkr1w2igHwlO/ZbDfW8GD0Txpz4YtxgFy+O8wkdOa6 sC3ixW2EjlnC7kHY8Z7tx/JDygSj/cgrsHMX/6QFvjIGBff7gBMxbvJXNWJQ8QpHQx3d ngXw== X-Gm-Message-State: ALKqPwcwjakgu2+KivtPVfLOVTG0Sg8XjWZ1aoHJDxZQqVznAHGxQqhp Lj7Bi2YoMNe8DGBzp3UfCv6znw== X-Google-Smtp-Source: AB8JxZrPseJsKk/hhKvKuTsWxBcOrcRTZo0dBhXtESCp2Ya69xcLZN2RR8gINCPiJ69d4ph5np8GSw== X-Received: by 2002:a63:2a89:: with SMTP id q131-v6mr16573995pgq.379.1526932703285; Mon, 21 May 2018 12:58:23 -0700 (PDT) Received: from localhost.localdomain ([2601:1c2:600:5100:4e72:b9ff:fe99:466a]) by smtp.gmail.com with ESMTPSA id p84-v6sm31611278pfi.66.2018.05.21.12.58.21 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 21 May 2018 12:58:22 -0700 (PDT) From: John Stultz To: lkml Cc: John Stultz , John Youn , Minas Harutyunyan , Artur Petrosyan , Grigor Tovmasyan , Felipe Balbi , linux-usb@vger.kernel.org Subject: [PATCH v2] usb: dwc2: Fix HiKey regression caused by power_down feature Date: Mon, 21 May 2018 12:58:18 -0700 Message-Id: <1526932698-28285-1-git-send-email-john.stultz@linaro.org> X-Mailer: git-send-email 2.7.4 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 In 4.17-rc, commit 03ea6d6e9e1f ("usb: dwc2: Enable power down") caused the HiKey board to not correctly handle switching between usb-gadget and usb-host mode. Unplugging the OTG port would result in: [ 42.240973] dwc2 f72c0000.usb: dwc2_restore_host_registers: no host registers to restore [ 42.249066] dwc2 f72c0000.usb: dwc2_host_exit_hibernation: failed to restore host registers And the USB-host ports would not function. And plugging in the OTG port, we would see: [ 46.046557] WARNING: CPU: 3 PID: 6 at drivers/usb/dwc2/gadget.c:260 dwc2_hsotg_init_fifo+0x194/0x1a0 [ 46.055761] CPU: 3 PID: 6 Comm: kworker/u16:0 Not tainted 4.17.0-rc5-00030-ge67da8c #231 [ 46.055767] Hardware name: HiKey Development Board (DT) [ 46.055784] Workqueue: dwc2 dwc2_conn_id_status_change ... Thus, this patch sets the hisi params to disable the power_down flag by default, and gets thing working again. Cc: John Youn Cc: Minas Harutyunyan Cc: Artur Petrosyan Cc: Grigor Tovmasyan Cc: Felipe Balbi Cc: linux-usb@vger.kernel.org Signed-off-by: John Stultz --- v2: Use DWC2_POWER_DOWN_PARAM_NONE as suggested by Minas --- drivers/usb/dwc2/params.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/usb/dwc2/params.c b/drivers/usb/dwc2/params.c index f03e418..d38871c 100644 --- a/drivers/usb/dwc2/params.c +++ b/drivers/usb/dwc2/params.c @@ -70,6 +70,7 @@ static void dwc2_set_his_params(struct dwc2_hsotg *hsotg) GAHBCFG_HBSTLEN_SHIFT; p->uframe_sched = false; p->change_speed_quirk = true; + p->power_down = DWC2_POWER_DOWN_PARAM_NONE; } static void dwc2_set_rk_params(struct dwc2_hsotg *hsotg)