From patchwork Wed May 11 16:33:11 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Griffin X-Patchwork-Id: 67608 Delivered-To: patch@linaro.org Received: by 10.140.92.199 with SMTP id b65csp316759qge; Wed, 11 May 2016 09:33:33 -0700 (PDT) X-Received: by 10.98.55.129 with SMTP id e123mr6370755pfa.4.1462984410989; Wed, 11 May 2016 09:33:30 -0700 (PDT) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id qe4si10777454pab.195.2016.05.11.09.33.30; Wed, 11 May 2016 09:33:30 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932724AbcEKQdU (ORCPT + 29 others); Wed, 11 May 2016 12:33:20 -0400 Received: from mail-wm0-f52.google.com ([74.125.82.52]:38173 "EHLO mail-wm0-f52.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932484AbcEKQdR (ORCPT ); Wed, 11 May 2016 12:33:17 -0400 Received: by mail-wm0-f52.google.com with SMTP id g17so92411142wme.1 for ; Wed, 11 May 2016 09:33:16 -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=YvGcZMe/ScOGzIzlsUmETzXHv39V+QzxIQeQnzvLp9Q=; b=RC7Vw+F7NGKoaOgPeO+5OhulOo8xV4gzty2LaUddFWgSxN0gcWEs6Z1LWOgZS2KJWu eOetJ3J2QUcGBIL8JTWjow5lTe3loKtsehZ/LK2BuvZzCPgAjK9uoo8cmbD+1uBg8jcn hCh27QJfCr2AgI9vBaBRMbURmESSy+veUDvXE= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=YvGcZMe/ScOGzIzlsUmETzXHv39V+QzxIQeQnzvLp9Q=; b=GnIiUqFun06w/bWI8KSPnKvrezoHVmoYTXfxy/Ia+7YVGkDAoWAqgcilzSzzkNZ62v CB0CuzGRvbGaZnONuVtb+y2pD8oWluIfCBUNeeqRRzQF06U7AmXtpFQFIsjx0hNWNerd ztfsZyXDsMeXku6MZwKo7XEI9vxJSqeH/istmKbu4DTR5S5C6HwX0QOC5fKLwDOxnQMh NrBTtQ7armIy4zhJqeUZxytEQw77zTGyBDoolko+cxH1S36VvVMc71depWWJF4400q5D kvPyQuuUsgnK1sU8c/Ha/Kb5/eHz+3/aoJU4/VswOcM/Cb2qbH7PrZKZThBGYGB7SqHL 66Lw== X-Gm-Message-State: AOPr4FX/FnMmfOtDIKGkaeKKQqXct/qe1g+lJ9zgNSNV24tFy1/RWRax5ZFOvmqk3J1UyuKI X-Received: by 10.28.52.75 with SMTP id b72mr5357427wma.98.1462984395632; Wed, 11 May 2016 09:33:15 -0700 (PDT) Received: from localhost.localdomain (cpc84787-aztw28-2-0-cust15.18-1.cable.virginm.net. [82.37.140.16]) by smtp.gmail.com with ESMTPSA id ug8sm8895123wjc.42.2016.05.11.09.33.13 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 11 May 2016 09:33:14 -0700 (PDT) From: Peter Griffin To: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, srinivas.kandagatla@gmail.com, maxime.coquelin@st.com, patrice.chotard@st.com, balbi@kernel.org, gregkh@linuxfoundation.org Cc: peter.griffin@linaro.org, lee.jones@linaro.org, linux-usb@vger.kernel.org Subject: [PATCH] usb: dwc3: st: Fix USB_DR_MODE_PERIPHERAL configuration. Date: Wed, 11 May 2016 17:33:11 +0100 Message-Id: <1462984391-605-1-git-send-email-peter.griffin@linaro.org> X-Mailer: git-send-email 1.9.1 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Set USB3_FORCE_VBUSVALID when configured for USB_DR_MODE_PERIPHERAL mode, as it is required to have a working setup. This worked on the internal driver by relying on the reset value of the syscfg register as the bits aren't explicity cleared and set like the upstream driver. Also add a comment about what setting this bit means. Signed-off-by: Peter Griffin --- drivers/usb/dwc3/dwc3-st.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) -- 1.9.1 diff --git a/drivers/usb/dwc3/dwc3-st.c b/drivers/usb/dwc3/dwc3-st.c index 5c0adb9..50d6ae6 100644 --- a/drivers/usb/dwc3/dwc3-st.c +++ b/drivers/usb/dwc3/dwc3-st.c @@ -129,12 +129,18 @@ static int st_dwc3_drd_init(struct st_dwc3 *dwc3_data) switch (dwc3_data->dr_mode) { case USB_DR_MODE_PERIPHERAL: - val &= ~(USB3_FORCE_VBUSVALID | USB3_DELAY_VBUSVALID + val &= ~(USB3_DELAY_VBUSVALID | USB3_SEL_FORCE_OPMODE | USB3_FORCE_OPMODE(0x3) | USB3_SEL_FORCE_DPPULLDOWN2 | USB3_FORCE_DPPULLDOWN2 | USB3_SEL_FORCE_DMPULLDOWN2 | USB3_FORCE_DMPULLDOWN2); - val |= USB3_DEVICE_NOT_HOST; + /* + * USB3_PORT2_FORCE_VBUSVALID When '1' and when + * USB3_PORT2_DEVICE_NOT_HOST = 1, forces VBUSVLDEXT2 input + * of the pico PHY to 1. + */ + + val |= USB3_DEVICE_NOT_HOST | USB3_FORCE_VBUSVALID; break; case USB_DR_MODE_HOST: