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: 136501 Delivered-To: patches@linaro.org Received: by 2002:a2e:9706:0:0:0:0:0 with SMTP id r6-v6csp719532lji; Mon, 21 May 2018 12:58:24 -0700 (PDT) X-Received: by 2002:a63:6e8e:: with SMTP id j136-v6mr17124668pgc.450.1526932704007; Mon, 21 May 2018 12:58:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1526932704; cv=none; d=google.com; s=arc-20160816; b=NsmQMLfiFAE2I79eERuhBqGkL+4JNqYMAQvixXfBWILfpeYp8/lkq+NE1cSm9B0XXX Llwn5xczLq2nsd9adjEZe7phhmYWAtAWXBkQbwizM5v2yNzICjGIYQ5lM5IUq9aP2mtw +t30gHvstVmBtYHDOaQkxKwVH9IFBami4tAyy/vAnHebcWHa1VfsQTH1BdZMU8Eu1+hC IQ8yiVonOrXuWP0isJAb+80Xba4ABjfXvGTIIFSmK1lYJXjcrwBj97ZgKo8Bekjh9g/K frwJ/T7NKCVxlRe9x//giddtY1IB/wXBMlEB7xpsC9Nqx69wZcjNMd/5XAhT2hedCG4v 4QbQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=message-id:date:subject:cc:to:from:dkim-signature :arc-authentication-results; bh=oPkRK+zhRj52+4+X2JyWpW+9iAiXlHGzGgpLGCvsyCM=; b=YFaz1egBHqLpTys1kFyvsz/KALUOJdm7sRk+3X/V2CVlA0IZ5wey7bnrbC4HFT+OKo /hq/3WKeJnFio/xdhRSs3ZUp2iqieCtSPFEhgbMbsk3YLuy12web9265qPWl4k4dbqJK q5WUQQhMpziP4f8JAvqMzT6EdDChwEZzuOV1P4VDgKqQf50nwmyPTRjXTFEeZySuQ1O0 /XuBWicRZgPrd8yctKrMZ+80iuN2EvRPlUvr4lJImrQfJfz8tzaH/6VUJNIA46l0JJFV Iw9otod/5IQ5z4xBzXBrnTA4kyRjgP7yy8KMKBrcKVeSQ7xR2yEYVIs74Hbcstxb5/O+ PQ5A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=jl8JmkVT; spf=pass (google.com: domain of john.stultz@linaro.org designates 209.85.220.65 as permitted sender) smtp.mailfrom=john.stultz@linaro.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from mail-sor-f65.google.com (mail-sor-f65.google.com. [209.85.220.65]) by mx.google.com with SMTPS id 8-v6sor6057812pfa.103.2018.05.21.12.58.23 for (Google Transport Security); Mon, 21 May 2018 12:58:23 -0700 (PDT) Received-SPF: pass (google.com: domain of john.stultz@linaro.org designates 209.85.220.65 as permitted sender) client-ip=209.85.220.65; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=jl8JmkVT; spf=pass (google.com: domain of john.stultz@linaro.org designates 209.85.220.65 as permitted sender) smtp.mailfrom=john.stultz@linaro.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org 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=HY7aqRmkxJpTzFVbXmaOwvjjpeMgGu1FcclTKZiSeLy7YdYF5zKO+AjMjy4tUjx5W6 zYdcz8ACbmXzcX13J6am9GyJCUaFKIjBVbe0oxkPayYYUGsfKoLa3dzvx5Gi+qunM68L INA4Zozds885V7ON0+4Ec/gBh5OIgFLvdQjdSlsTb51AHlvgABUSycTbkSO9c927GoGa cvHJc0yCwtQHhMaKjLcZ03ZSRZKxJCREUXxFluWk6g+ZZHq6Sp8M8CXcGV4w/Ib5Oxdk zfhvLzYljkYKUrpLt3wuMxMs1iMnBLSO9ufi6AWBb3eUXjJbsBr1j1uil8J7R/y63ED9 Uucw== X-Gm-Message-State: ALKqPwenXSY1b3m4/w9tZkerdRmyndrukExukbbm6hDFpSrawIvmdJg/ vhTqd5agfb2Q0oPUJkLex5eEMyv7 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) Return-Path: 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 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(+) -- 2.7.4 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)