From patchwork Mon Oct 28 21:59:11 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Stultz X-Patchwork-Id: 177969 Delivered-To: patches@linaro.org Received: by 2002:a92:409a:0:0:0:0:0 with SMTP id d26csp3978280ill; Mon, 28 Oct 2019 14:59:25 -0700 (PDT) X-Received: by 2002:a63:e750:: with SMTP id j16mr23879433pgk.30.1572299964950; Mon, 28 Oct 2019 14:59:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1572299964; cv=none; d=google.com; s=arc-20160816; b=MoTSN4fi1lNg+yhbw8NFPiCqEJ9k/gHmapYxyBuxYdCftnSphsEYSGJAeaixhdk53m Lv7fU0q0WYMpeCvxiMbmE/7LqX9Q2ZEwNAStoea6MJGyGViqmmeFBYmfiI35fSvCnMr8 FGdcJr/hrx1IXpKWBdjyD0lVAh6/FSgp5niSd22Guwo9RpPHSZhx03dJcHgrw8M29k/c JCQC+y9FlP0EXaPVAW3/rrBI95FiySjch1L5SQx/OhqkfCykwltBj78k9D3+ixCmqWK4 M4cHVU9FE3xtdxSmcI1OUzMN85f08WjckXTZcGu4aZBGeZAnk7xqqGZU4++2uL8QT6GG PrQg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=GYRc8Evk3wu8EUiuELp77RSTyUut+SJabJSgyybQCKc=; b=numkmsCTV7Zu/ZgV4W2sFVL18xICYbEvImdYQWWDQJ4OiG8kMlOpuSeI3DtqHcZAY5 hnSxAgnpxz32OfXCJxfUWLR2NztK+SHgD2d7ShNVbOpicAOJAiy8T4PmYzbpwpClE8d+ KX6hjGMoQCD9TfWTCdMLhEA1Y4BMyVVGu3IO4euVd2LU4kMDuyFc3ceqKI/Krca4vFkN ALub6FE8do4sqinkDYjCVq8QSox0wuRwRc7O/2E1X4KJigGXjP9IzcwCFuSGHAcPBMG1 NPAgeAmS8zRyVqbrvVFirIckm23DXqmDE3UVvOQkcpH+7shFY7umN9CI/VZxlmd8gsk0 x9Mw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=aiGKojzf; 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 a30sor11546970pgb.48.2019.10.28.14.59.24 for (Google Transport Security); Mon, 28 Oct 2019 14:59:24 -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=aiGKojzf; 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:in-reply-to:references; bh=GYRc8Evk3wu8EUiuELp77RSTyUut+SJabJSgyybQCKc=; b=aiGKojzfX0avTva88b+Xf7Ycb1D84K+JUiiDZe8pxySNsgiNblOjP/0rEBus9uVwFy ry7jgeDbO5rYlhDY3nigJVxjosnZT+JsbJwQQMwTADrRUPh1W6luNUOyK/bKwsZop+V0 tv4rLM+oQ4ikK7IlwEgNicJh1z7AL3q/L+EPrECleyeatF29bxEdswku9u4yzoZ5Aexs ULxCVuo4HEcivtAM8axTxG7Dx6uqJKmuwi48dMUCXUdQF0n/EcPJlK/HDz9pYQ9UH0Vx 6BPRmIG4CPgtqSxeBpJc0cZx/KCEIewJ4TbVg8G0KbGRGmaEZcHxjTLjezesX65OejFs FLcw== 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:in-reply-to :references; bh=GYRc8Evk3wu8EUiuELp77RSTyUut+SJabJSgyybQCKc=; b=f2ZA3l6SrhBUetlH6UtnqmPb5d8QJfGjvDdZ8XdieqO3XZeBBVWOsyBnt2W/YJAhyp wapCHoNlnIByCCupoDyLYsNi5GqLI8bUlWUsf98+RbXuMvGK/5H9hO+g/fh17Oi6PduU RgwOapfEokPPOFQ8oSAC82bBGtQdsLU6/uEorDeL93H6UUu9IaWLLESUfvRK4T2Mdsz0 e+N3aO75afzeLraSxS8FZhHHj5bv5ai3HL9W0cvc6VvsZXNN7UPU6hhi/sPedDPaqKtR X9X7lhheEX9eW5cktuyfElMhO/FuaBWpbT7ncb6eVJOWgkFctaXOMuDM5c1IE2vzjBAm zhGQ== X-Gm-Message-State: APjAAAVKxcQLMfy8O5PBoQ8XCMgEokowcqBZN6lxmsZOaQaIlHs3aAwd giEhEgLkBSpj1Oz4F+V04oWyqjOH X-Google-Smtp-Source: APXvYqyBQEq+GyX9s9DcVAsO/5XEDStC7aBeHJL3KSIfp2K/5xIaHqQr6/nGowmVcOrYfSGZ5tHZhA== X-Received: by 2002:a65:4bcd:: with SMTP id p13mr23366871pgr.80.1572299964451; Mon, 28 Oct 2019 14:59:24 -0700 (PDT) Return-Path: Received: from localhost.localdomain (c-67-170-172-113.hsd1.or.comcast.net. [67.170.172.113]) by smtp.gmail.com with ESMTPSA id f12sm10880612pfn.152.2019.10.28.14.59.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 28 Oct 2019 14:59:23 -0700 (PDT) From: John Stultz To: lkml Cc: John Stultz , Greg Kroah-Hartman , Rob Herring , Mark Rutland , ShuFan Lee , Heikki Krogerus , Suzuki K Poulose , Chunfeng Yun , Yu Chen , Felipe Balbi , Hans de Goede , Andy Shevchenko , Jun Li , Valentin Schneider , linux-usb@vger.kernel.org, devicetree@vger.kernel.org Subject: [PATCH v4 1/9] dt-bindings: usb: rt1711h: Add connector bindings Date: Mon, 28 Oct 2019 21:59:11 +0000 Message-Id: <20191028215919.83697-2-john.stultz@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20191028215919.83697-1-john.stultz@linaro.org> References: <20191028215919.83697-1-john.stultz@linaro.org> Add connector binding documentation for Richtek RT1711H Type-C chip driver It was noted by Rob Herring that the rt1711h binding docs doesn't include the connector binding. Thus this patch adds such documentation following the details in Documentation/devicetree/bindings/usb/typec-tcpci.txt Cc: Greg Kroah-Hartman Cc: Rob Herring Cc: Mark Rutland CC: ShuFan Lee Cc: Heikki Krogerus Cc: Suzuki K Poulose Cc: Chunfeng Yun Cc: Yu Chen Cc: Felipe Balbi Cc: Hans de Goede Cc: Andy Shevchenko Cc: Jun Li Cc: Valentin Schneider Cc: linux-usb@vger.kernel.org Cc: devicetree@vger.kernel.org Reviewed-by: Rob Herring Signed-off-by: John Stultz --- .../bindings/usb/richtek,rt1711h.txt | 29 +++++++++++++++++++ 1 file changed, 29 insertions(+) -- 2.17.1 diff --git a/Documentation/devicetree/bindings/usb/richtek,rt1711h.txt b/Documentation/devicetree/bindings/usb/richtek,rt1711h.txt index d4cf53c071d9..e3fc57e605ed 100644 --- a/Documentation/devicetree/bindings/usb/richtek,rt1711h.txt +++ b/Documentation/devicetree/bindings/usb/richtek,rt1711h.txt @@ -6,10 +6,39 @@ Required properties: - interrupts : where a is the interrupt number and b represents an encoding of the sense and level information for the interrupt. +Required sub-node: +- connector: The "usb-c-connector" attached to the tcpci chip, the bindings + of connector node are specified in + Documentation/devicetree/bindings/connector/usb-connector.txt + Example : rt1711h@4e { compatible = "richtek,rt1711h"; reg = <0x4e>; interrupt-parent = <&gpio26>; interrupts = <0 IRQ_TYPE_LEVEL_LOW>; + + usb_con: connector { + compatible = "usb-c-connector"; + label = "USB-C"; + data-role = "dual"; + power-role = "dual"; + try-power-role = "sink"; + source-pdos = ; + sink-pdos = ; + op-sink-microwatt = <10000000>; + + ports { + #address-cells = <1>; + #size-cells = <0>; + + port@1 { + reg = <1>; + usb_con_ss: endpoint { + remote-endpoint = <&usb3_data_ss>; + }; + }; + }; + }; }; From patchwork Mon Oct 28 21:59:12 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Stultz X-Patchwork-Id: 177970 Delivered-To: patches@linaro.org Received: by 2002:a92:409a:0:0:0:0:0 with SMTP id d26csp3978300ill; Mon, 28 Oct 2019 14:59:26 -0700 (PDT) X-Received: by 2002:a17:902:362:: with SMTP id 89mr282650pld.71.1572299966265; Mon, 28 Oct 2019 14:59:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1572299966; cv=none; d=google.com; s=arc-20160816; b=TcZYjiFTfrwvmK+1hD32ar084YUt1hWNnJdZc68hoYJ6tKgKhlqVe6wAx+53Lm95Tp wiZCNEZbFAY2lw0EFAd8VRKAhES1oisBZ3y2tSQXVKu9kxrnzMoYVFyEUqHaQOcqzVqf i1qfhUh2Yuk0d7E3/h1j1wJKwtQgquKp3h52SESI84OjevyjPEykdV35dexma6G9Y+yn XHMjb2OTGmtoWKjjF4WPbAZ7TDuq8lVQFWaSqZyZ+c7S1zD81xRtStZIdDyDPC0W4RpD kLBrLfiwYjbPHY3jqUTyHtVWh4WYEVYu4Dln6jeKVG1qaOuBsCViZguQPto0POkXtZtl 19AA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=+L6QotxBXClg8Fe4NEIvH2M7vhWfz5AENh5gfCd6GV4=; b=xfLwM8MfbF5GgsEqFF4k67tGxLF/V+sP9/bUSmGq7MXz1ydwSp+G25cunxavVfvtan P2/cLV5tSAvVilM564E6KHVBGa7V9mgSIVdpe0GMzypW6pzBVxiahFb0OYYZZxS/TIEZ UJn5E8zpyUv56gvCgmKHOICuKG0qlnk+kCKogUjYPrGzTQLU0nb5BPGjSTPuJXH8n4h+ THv/0VW99iJ7MW+bsLFDeuvx8G+z1qvWLhr054e6GU/nNJNRktNP3fXYg4tpCUaQQfpw oIf0dT4uCH+zIu5thUWsAxiQJ7lvRSgF8LY+m952mkg6GfEMjKzxUQehT9Xiw/MtfIaJ euHA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=uaUmY97o; 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 25sor12887159pfh.26.2019.10.28.14.59.26 for (Google Transport Security); Mon, 28 Oct 2019 14:59:26 -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=uaUmY97o; 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:in-reply-to:references; bh=+L6QotxBXClg8Fe4NEIvH2M7vhWfz5AENh5gfCd6GV4=; b=uaUmY97oSQxJQiygHKDaQ20ZTGg8dHh2CBe6oCjliV/RN29TrGpIx4ib9OqXas8o3L VGfHqIuml3QwWjby0s2prmA2YMmiKWQVFFb1lAwmvGl498yOYU5Uls0CSQZ34KDFix43 G6JAmKHK8ywTaqFjTUQP00S7zXpDubMfH1Tir+VrVpTGeF7pp/x/zIimRziEyXRoQMht x7W2cxF8KEa5n6o6m8KFmj7LejeivOjoMf2XtSHXLftGcJYpn6KXhdcqvG0pZZJ4idlx kQxDcknr/f6WferMNpA/Vd7V+YIZo/bspA5ekOGZIugueMatX0phDtpfNMw5J5ckn8sF 6leg== 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:in-reply-to :references; bh=+L6QotxBXClg8Fe4NEIvH2M7vhWfz5AENh5gfCd6GV4=; b=eJI7Q2LEsyoskaXjODz+D/QhITiOqCj91aDmJIxy2V4yHsUWlG6+BRaM8T+dV6YMIp FTbPRRRy4B2eTMk9D1JuBqLymJgYEgumyc4s9sopVJPzYVEdZdLD6KAs/9Jh65wvnkbR /2i3Njc4xgJG6LWCtXYbbdBAz7jOyyStz/MFX5GF0hKvrkTznMsL1NmT5Jkgb6OC6MGe fjQBeYWumNSWW4SgnQWK82NTfBqw1clqd6ZzbPig+ptD9+ajK6zD9fbMrnqu0lf61C9X VAAx0GYvE+oWd0cFkP1870Mi3aDiuLTO+Bt2tseYOPzUrJKSBNGV2hcpoIcNzhLZWBr0 cG5w== X-Gm-Message-State: APjAAAW/6XiiGzwegRYUtcfBcGUx/+FEifVs9F4RdjJCnhF3BlAN1f56 W0K1Lvl3JuYDqxk3mAVA7nVTm4hL X-Google-Smtp-Source: APXvYqwoT7ayq2aO4CF8CK+7fEOHyKKj3eXU3Enm6OGIp8+0wievgg8RmOqjN0WXhlj2nCmqsIIU7g== X-Received: by 2002:a63:f923:: with SMTP id h35mr23802494pgi.323.1572299965657; Mon, 28 Oct 2019 14:59:25 -0700 (PDT) Return-Path: Received: from localhost.localdomain (c-67-170-172-113.hsd1.or.comcast.net. [67.170.172.113]) by smtp.gmail.com with ESMTPSA id f12sm10880612pfn.152.2019.10.28.14.59.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 28 Oct 2019 14:59:25 -0700 (PDT) From: John Stultz To: lkml Cc: Yu Chen , Greg Kroah-Hartman , Rob Herring , Mark Rutland , ShuFan Lee , Heikki Krogerus , Suzuki K Poulose , Chunfeng Yun , Felipe Balbi , Hans de Goede , Andy Shevchenko , Jun Li , Valentin Schneider , Jack Pham , linux-usb@vger.kernel.org, devicetree@vger.kernel.org, John Stultz Subject: [PATCH v4 2/9] usb: dwc3: Execute GCTL Core Soft Reset while switch modes Date: Mon, 28 Oct 2019 21:59:12 +0000 Message-Id: <20191028215919.83697-3-john.stultz@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20191028215919.83697-1-john.stultz@linaro.org> References: <20191028215919.83697-1-john.stultz@linaro.org> From: Yu Chen On the HiKey960, we need to do a GCTL soft reset when switching modes. Jack Pham also noted that in the Synopsys databook it mentions performing a GCTL CoreSoftReset when changing the PrtCapDir between device & host modes. So this patch always does a GCTL Core Soft Reset when changing the mode. Cc: Greg Kroah-Hartman Cc: Rob Herring Cc: Mark Rutland CC: ShuFan Lee Cc: Heikki Krogerus Cc: Suzuki K Poulose Cc: Chunfeng Yun Cc: Yu Chen Cc: Felipe Balbi Cc: Hans de Goede Cc: Andy Shevchenko Cc: Jun Li Cc: Valentin Schneider Cc: Jack Pham Cc: linux-usb@vger.kernel.org Cc: devicetree@vger.kernel.org Signed-off-by: Yu Chen Signed-off-by: John Stultz --- v3: Remove quirk conditional, as Jack Pham noted the Synopsis databook states this should be done generally. Also, at Jacks' suggestion, make the reset call before changing the prtcap direction. --- drivers/usb/dwc3/core.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) -- 2.17.1 diff --git a/drivers/usb/dwc3/core.c b/drivers/usb/dwc3/core.c index 999ce5e84d3c..a039e35ec7ad 100644 --- a/drivers/usb/dwc3/core.c +++ b/drivers/usb/dwc3/core.c @@ -112,6 +112,19 @@ void dwc3_set_prtcap(struct dwc3 *dwc, u32 mode) dwc->current_dr_role = mode; } +static void dwc3_gctl_core_soft_reset(struct dwc3 *dwc) +{ + u32 reg; + + reg = dwc3_readl(dwc->regs, DWC3_GCTL); + reg |= DWC3_GCTL_CORESOFTRESET; + dwc3_writel(dwc->regs, DWC3_GCTL, reg); + + reg = dwc3_readl(dwc->regs, DWC3_GCTL); + reg &= ~DWC3_GCTL_CORESOFTRESET; + dwc3_writel(dwc->regs, DWC3_GCTL, reg); +} + static void __dwc3_set_mode(struct work_struct *work) { struct dwc3 *dwc = work_to_dwc(work); @@ -154,6 +167,9 @@ static void __dwc3_set_mode(struct work_struct *work) spin_lock_irqsave(&dwc->lock, flags); + /* Execute a GCTL Core Soft Reset when switch mode */ + dwc3_gctl_core_soft_reset(dwc); + dwc3_set_prtcap(dwc, dwc->desired_dr_role); spin_unlock_irqrestore(&dwc->lock, flags); From patchwork Mon Oct 28 21:59:13 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Stultz X-Patchwork-Id: 177971 Delivered-To: patches@linaro.org Received: by 2002:a92:409a:0:0:0:0:0 with SMTP id d26csp3978317ill; Mon, 28 Oct 2019 14:59:27 -0700 (PDT) X-Received: by 2002:a65:41c5:: with SMTP id b5mr6641890pgq.78.1572299967567; Mon, 28 Oct 2019 14:59:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1572299967; cv=none; d=google.com; s=arc-20160816; b=Vdpz3030pRWJ6hstm/muPPXtpI8UQ6mNpI0AgweO4Zl7biKpkFyXlhWPQVBwfv9Oeq z3xVLE3/RWGPiEflHzHcv4isbrgiya/ELrP19IEoLZE0UooV9xqhaiNvEZTSxCcRftBa LKbdY8WwZhHHoDZzS2M/u9LGzv65wTl1Yk+VRIjCDp0m08KgyhtFE0nXXNXvZ0xuOJ78 exc4o52rUaRc49pqE4MDvvi7R0912LmigMduM76y2C1W7lxDYkypGlc2Hz5gKvTl0kwD SAmnfI9zVdjqplgYA8iqkNcBlezwaAc+jI9b0UG4TJbY3CXvKVTXBSyP3DHBh5eYEb1T wm7A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=NtLLzsDOIuiH39rP2uuMmF0oaTj9DHzaakbaIjXt74A=; b=Juk0mkJQGP8NvwISdsdgUqs3ZNeQZRgUfX5aWphyYacu4ov6oCWP4qGEddNyRQKi02 Nc9c+W/u806/BfRP244923o49WV8Doi+BNjY+vaqNpkB/Kc4f7Y4gJsBfk6WPlysJHZA DJc3nDiLykzKWqMF6fLh+LqHglr1xDxzYVY4iBbr3GjbHRaXfZAxRqzjBAVQij14A0mZ sQVmBA0HqUjPcTu2WMc4bl4DPTQuM75DFFIpXdz0Q0AtQFaoQkBCZY5SHNvOa/bCWCg0 D5qitKbhfOwxBFjIqGKDQWJCIgXe+8up30clS49sl/qoG5p3whjVK9tCEBCwZRFM0MmH udQg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=eKVqOuBe; 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 c69sor3160991pfc.14.2019.10.28.14.59.27 for (Google Transport Security); Mon, 28 Oct 2019 14:59:27 -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=eKVqOuBe; 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:in-reply-to:references; bh=NtLLzsDOIuiH39rP2uuMmF0oaTj9DHzaakbaIjXt74A=; b=eKVqOuBe2qG/OSWZsaD3gbQVQnORi6YUJToqthQFixtmU1bAKAXU6V1ldupWC6VvTw RsTMuqOIvs7Az8gxZhBzjgrhkGKRmX9qGZW+fIrHiDuDEeJLZMgyj+Yiz23bw9wfOREr 1gy4gtJ5MEfAGjn5SKvx5ks/STelDtQ4g6DKlAX9MLoSJ7+ETf+rl3nxipwO/X0YbJ04 kid2Lg+PjKbhGtco88Xw2DyknmmFVdZYVERdIKGLgbwv1F2AXXjq7WjmRyIVT9oJRoR5 I+dQGFLedmEvEqVeXZO4y+jfXBTe37AQds4D07d5UF/oXDarJbpUt6Jj34ERRyreJ5JA JttQ== 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:in-reply-to :references; bh=NtLLzsDOIuiH39rP2uuMmF0oaTj9DHzaakbaIjXt74A=; b=GdI5PVxkvfELez+O13+LAZb+R3/NkqQMm4EAm2+ePFqPqi12fkYML2YAaxrlkHzAT5 rDFORBLTaIv1idKYMJPhqi5jVmTRLZwM4/mB8ULZXEZk47ric4XnKpoutaiKLEqtggW8 DGh0n/72NmXudKKHG7XP3O8aNRHcG3CpDUCCQJFyd4I8vXwZdRD3oaOXkjFcBaVijlhP /qtPrMM0bSy04o1LzGuUFkK2gPf8Yrow85EzqQ7DgVSuQnvt9psPtTY2Ero7ql/8oQ5j s6EdQ/jlAmonMW0L6YxAGBVy9QFtmndYIHVGGPfFDyKQAT5B7/q8waV69WY/rynJVSys MN0g== X-Gm-Message-State: APjAAAUftBSsUJdeuOHXz4HNkLJYewZ3Orcs6UPG50YC7ntyKn5hOb9G zDrhwRttBtnRs7IjJxSHpxggwTs/ X-Google-Smtp-Source: APXvYqygibWkWPMAb7wZK/7S2yus1n7uqa1S6UdpudK6pIw6iG7qeF5t6FQaHX/vFB83z9Il5b0N2g== X-Received: by 2002:a63:67c3:: with SMTP id b186mr12427931pgc.152.1572299967053; Mon, 28 Oct 2019 14:59:27 -0700 (PDT) Return-Path: Received: from localhost.localdomain (c-67-170-172-113.hsd1.or.comcast.net. [67.170.172.113]) by smtp.gmail.com with ESMTPSA id f12sm10880612pfn.152.2019.10.28.14.59.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 28 Oct 2019 14:59:26 -0700 (PDT) From: John Stultz To: lkml Cc: Yu Chen , Greg Kroah-Hartman , Rob Herring , Mark Rutland , ShuFan Lee , Heikki Krogerus , Suzuki K Poulose , Chunfeng Yun , Felipe Balbi , Hans de Goede , Andy Shevchenko , Jun Li , Valentin Schneider , Jack Pham , linux-usb@vger.kernel.org, devicetree@vger.kernel.org, John Stultz Subject: [PATCH v4 3/9] usb: dwc3: Increase timeout for CmdAct cleared by device controller Date: Mon, 28 Oct 2019 21:59:13 +0000 Message-Id: <20191028215919.83697-4-john.stultz@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20191028215919.83697-1-john.stultz@linaro.org> References: <20191028215919.83697-1-john.stultz@linaro.org> From: Yu Chen It needs more time for the device controller to clear the CmdAct of DEPCMD on Hisilicon Kirin Soc. Cc: Greg Kroah-Hartman Cc: Rob Herring Cc: Mark Rutland CC: ShuFan Lee Cc: Heikki Krogerus Cc: Suzuki K Poulose Cc: Chunfeng Yun Cc: Yu Chen Cc: Felipe Balbi Cc: Hans de Goede Cc: Andy Shevchenko Cc: Jun Li Cc: Valentin Schneider Cc: Jack Pham Cc: linux-usb@vger.kernel.org Cc: devicetree@vger.kernel.org Signed-off-by: Yu Chen Signed-off-by: John Stultz --- drivers/usb/dwc3/gadget.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -- 2.17.1 diff --git a/drivers/usb/dwc3/gadget.c b/drivers/usb/dwc3/gadget.c index 86dc1db788a9..168eb4a0a9b0 100644 --- a/drivers/usb/dwc3/gadget.c +++ b/drivers/usb/dwc3/gadget.c @@ -270,7 +270,7 @@ int dwc3_send_gadget_ep_cmd(struct dwc3_ep *dep, unsigned cmd, { const struct usb_endpoint_descriptor *desc = dep->endpoint.desc; struct dwc3 *dwc = dep->dwc; - u32 timeout = 1000; + u32 timeout = 5000; u32 saved_config = 0; u32 reg; From patchwork Mon Oct 28 21:59:14 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Stultz X-Patchwork-Id: 177972 Delivered-To: patches@linaro.org Received: by 2002:a92:409a:0:0:0:0:0 with SMTP id d26csp3978341ill; Mon, 28 Oct 2019 14:59:29 -0700 (PDT) X-Received: by 2002:a63:9d47:: with SMTP id i68mr23271970pgd.28.1572299968818; Mon, 28 Oct 2019 14:59:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1572299968; cv=none; d=google.com; s=arc-20160816; b=hEdH13i+A11ruYSjjQX4TnzW4G8aRVmz6HBR6wgwDWTM6d1ZmB0CCr7fYeWuWOVAnl bUFedZW+G6uGfbvtQYJ3OpQCcEBTg5GlQOKqw+uaTb+wRjV98LofLn6gqhulpQ9ryIM3 xe/WG83X0qWYHbthYzgBvc68VdLDLwKzURmiLND+hCYt5yXB9hlihwW4tRidKj7MTGkG bemeWnSl4m6mDGF+YhxBixc3fkmz5/s5+9h/YB838xpmIZ6UWZd6e87gbW55uqPvx8l0 ++Bm+/JQngN9jH/fm9PknXbfnH+AWzLQumkJndrhPZv+sj2pEoXrRFHGerzioQZKdmQY x0aw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=0d8c9xxXfq9azaoIMnpd7T7O6Htbc+6dqNsLBH6goLs=; b=cXKYNmUSB/XmlonfP/QF5SdkEqRbVtfwBeF0gEGovQ8XowOXhZKnIEs16zuT7f1knv Pkhyin5mCK8vF0zbyW6ScJj6+8aFULghEJxwuS2iafnPDB5J8Iob0bM56/YN/fQOUDSh KzMyjGdQfOGH2ayPTIf5i0zmdhYDgWD7pqaEIZlu+aZGBIxadJOn++5L8qyybOj9L6Ht fqb7XLMfkCpnn7jmSIMiJAAmIDtThqqbjmqLp1prK/AU+v1LY5Lov96ikBkM1P+JjLYD 0PhxXozkPTw+cIkYzfUfHCgMIs0d0ZNC29s0+FL2fTkS8vluOqk/joaj23qSN7mASTD9 cPQQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=OooiMpJl; 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 h15sor1152618pjt.15.2019.10.28.14.59.28 for (Google Transport Security); Mon, 28 Oct 2019 14:59:28 -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=OooiMpJl; 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:in-reply-to:references; bh=0d8c9xxXfq9azaoIMnpd7T7O6Htbc+6dqNsLBH6goLs=; b=OooiMpJlnthfCoHkNbKk5+ZkhnJ4zgwcMFUsDAdDdjsrni+Ym/oIzxMeoxGTl3a3Ma pj0Kyj2In07BwtHsqyedhyDIRyzCFk8VWca0Obw0bNYJee8KpxoiSfVZn9h/lVDEimRR 5Q7G8PZYX9o9NcyIuCmaj57UB8KFcVl0IMa/vqB9XHsr6tObAeq8UoChUCRlr0A+tg+y FDiVVTyCiU7MPfSums1k96+5GW/yFF3TomG9NIwun5QiuwETMTfBqMgs5F+ynDLBgAis N6Yvgsv0rfanq46H8AWZ5R45RtHTXclUhZzTB9Vxgy8K7aSh8KBxgHcQ7X1TH0E3GqOh ZeMg== 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:in-reply-to :references; bh=0d8c9xxXfq9azaoIMnpd7T7O6Htbc+6dqNsLBH6goLs=; b=SKaOeNXsGkx5OYJIYqD+8/ws8GXRaF7EBvt6+qoD6o82JUH4pjCRXx9GICsQKYSise Z2wsbVwjLNcKF8TYDr2yPUk6fNDLBL0V4RDNi/QeRJTVjDraFlmOagkMHf6h8CTf05rI CSq+zv27ubFK6J9+E51YYMITBbR/U5qj5v1/Dp2S2VyszQt1MuNpW73MaimL5m8zDa45 rT8+URCLrZrALcrs9t+aMBLW0ZHXMZyMoHQFUUUybGUnRJUu2CJu4yaQgrpJcb4kyoMv uVnwYjGw4jOElBbYnlBgpMzNVfGJCiJZbscXP1kas6vhMSaM9zUisRpRjcu/QN6lOu8E Lemg== X-Gm-Message-State: APjAAAU1YQwr7lNAyUvubEd3hByklk8Y1pnJbfrH46uoCs7pZIx6AtuE E2eopd+Gg+OuBzlgWIyCPE/+Y8gj X-Google-Smtp-Source: APXvYqxETt1r4GGA30YA4LQzxZEzUJ5jkilalooGWqJqTN8Hrs56L/j9noamumHZ8snA1JUFcFgYqA== X-Received: by 2002:a17:90a:8d82:: with SMTP id d2mr1932147pjo.31.1572299968324; Mon, 28 Oct 2019 14:59:28 -0700 (PDT) Return-Path: Received: from localhost.localdomain (c-67-170-172-113.hsd1.or.comcast.net. [67.170.172.113]) by smtp.gmail.com with ESMTPSA id f12sm10880612pfn.152.2019.10.28.14.59.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 28 Oct 2019 14:59:27 -0700 (PDT) From: John Stultz To: lkml Cc: John Stultz , Greg Kroah-Hartman , Rob Herring , Mark Rutland , ShuFan Lee , Heikki Krogerus , Suzuki K Poulose , Chunfeng Yun , Yu Chen , Felipe Balbi , Hans de Goede , Andy Shevchenko , Jun Li , Valentin Schneider , Jack Pham , linux-usb@vger.kernel.org, devicetree@vger.kernel.org Subject: [PATCH v4 4/9] dt-bindings: usb: dwc3: Allow clock list & resets to be more flexible Date: Mon, 28 Oct 2019 21:59:14 +0000 Message-Id: <20191028215919.83697-5-john.stultz@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20191028215919.83697-1-john.stultz@linaro.org> References: <20191028215919.83697-1-john.stultz@linaro.org> Rather then adding another device specific binding to support hikey960, Rob Herring suggested we expand the current dwc3 binding to allow for variable numbers of clocks and resets. Cc: Greg Kroah-Hartman Cc: Rob Herring Cc: Mark Rutland CC: ShuFan Lee Cc: Heikki Krogerus Cc: Suzuki K Poulose Cc: Chunfeng Yun Cc: Yu Chen Cc: Felipe Balbi Cc: Hans de Goede Cc: Andy Shevchenko Cc: Jun Li Cc: Valentin Schneider Cc: Jack Pham Cc: linux-usb@vger.kernel.org Cc: devicetree@vger.kernel.org Suggested-by: Rob Herring Reviewed-by: Rob Herring Signed-off-by: John Stultz --- Documentation/devicetree/bindings/usb/dwc3.txt | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) -- 2.17.1 diff --git a/Documentation/devicetree/bindings/usb/dwc3.txt b/Documentation/devicetree/bindings/usb/dwc3.txt index 66780a47ad85..29768b0ca923 100644 --- a/Documentation/devicetree/bindings/usb/dwc3.txt +++ b/Documentation/devicetree/bindings/usb/dwc3.txt @@ -7,7 +7,8 @@ Required properties: - compatible: must be "snps,dwc3" - reg : Address and length of the register set for the device - interrupts: Interrupts used by the dwc3 controller. - - clock-names: should contain "ref", "bus_early", "suspend" + - clock-names: list of clock names. Ideally should be "ref", + "bus_early", "suspend" but may be less or more. - clocks: list of phandle and clock specifier pairs corresponding to entries in the clock-names property. @@ -36,7 +37,7 @@ Optional properties: - phys: from the *Generic PHY* bindings - phy-names: from the *Generic PHY* bindings; supported names are "usb2-phy" or "usb3-phy". - - resets: a single pair of phandle and reset specifier + - resets: set of phandle and reset specifier pairs - snps,usb2-lpm-disable: indicate if we don't want to enable USB2 HW LPM - snps,usb3_lpm_capable: determines if platform is USB3 LPM capable - snps,dis-start-transfer-quirk: when set, disable isoc START TRANSFER command From patchwork Mon Oct 28 21:59:15 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Stultz X-Patchwork-Id: 177973 Delivered-To: patches@linaro.org Received: by 2002:a92:409a:0:0:0:0:0 with SMTP id d26csp3978356ill; Mon, 28 Oct 2019 14:59:30 -0700 (PDT) X-Received: by 2002:a65:554e:: with SMTP id t14mr21059775pgr.370.1572299969886; Mon, 28 Oct 2019 14:59:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1572299969; cv=none; d=google.com; s=arc-20160816; b=Fes8OnSF4vz37IAkmkdVOn5GX34yGs56fmlMiV2cQSQv/SFOMWxTvAyicjYwmMgJ+k d8/82sidrRSZ0P3C/i3K2O5yhL2ZGy12ay4vt6fBeckv51frlkKrHoNeCm4Lt9ErrGNl YvkgQHMovGGW+JXiI2j6HKaOMX5G+Bnx4XNASxjIiB7+OHeJ66x9uWLqIdAUxbABPVwc nHfAP8EeO53oMZjl+ymJs91iIi0GUcauFZca6ZK1UumoN0zaDU6yzz+pVFs/5+5uIWPt M94LHE/Ap4sL2ipCL0CafQ2tbZR6vql2tXrhDziUs3slyJm0+5/i7AyFrcqUHjSAsPzk J8gQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=Sf5eKNCSIBpNdFo6pBKVICUJYVHElXUrV/RD8eO146c=; b=dUPKJmVU90UxzIWWkyHEj2HClLjsGPMuhts0clpcLlScEP+zqadeO4r9UJ3znH2Lzv gOc6ESTTdpWx8kgA6NBuFO3EiGKX0h6/BagM+WJxvtmw/aBr0L85QD9Ag55/2FI5TXmz FFHcasLWdliGZLH2JDNclsD9yVaT2g1UcVMaVCcAI+73UIHGSnwFlkXtp2pkvCPR6oFj OIfX/Zg7JAf9/7ztbgFdCPyPApSwGvFXpAUs3ff/UED0Umn4/NxIBMuX688u/51QjdXL JF1V9fW2l5Q/oKBNnp1lDRgknu0vKO2IbuDoc/BHXjbBgqRfrrwtVnZG/jfSA2n/OwSY LWmA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=lMEc5oJe; 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 r75sor13113432pfr.42.2019.10.28.14.59.29 for (Google Transport Security); Mon, 28 Oct 2019 14:59:29 -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=lMEc5oJe; 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:in-reply-to:references; bh=Sf5eKNCSIBpNdFo6pBKVICUJYVHElXUrV/RD8eO146c=; b=lMEc5oJeuYWUcVxXpphSMAIRavQ29nAcI5d2oKIF5KsDKcFZnIO8Rcwx8rlC2A8Zf/ CF5EjelirIgQYnWaDQFgrG7r+Oh+liDGWYseTgIuogkTucMwvA9ZsP/LheVHE/zFsbcS MpnCEZ0dr7M6+w8sAnEgZXE/TPEx6kssrdjMLA9cAPy4zvF/Q7Z084sRASR5cfwrE156 Dq2WaWlxclZJyvBepM8NvQKGSkQV4UrmPKJjFOsfHATm/IoZihLaQwjrWyKTuHXgICUq DI5KCli3WtY+muIL2MpvQmZSAfF1FcdKcY0GT06yRWMhwtT4FmfKoizuKQyE3WTTIj8a t4yw== 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:in-reply-to :references; bh=Sf5eKNCSIBpNdFo6pBKVICUJYVHElXUrV/RD8eO146c=; b=TOoPltBlOdJ40vwdhhO7zIgXap51OTP33N0V6zX75TQnmjK9Rl9c2Dgxq6t5sqeaRg vilQ0bldmeFazQZwTcoUfPQLmmBXBwJKCV2XXca3SfiKkxW1WBfOoA+1XpLuKUOa/kqw FsQuRinHOnj/BfPLX/WD6ARsuofVgB8zxoGBiNNXKts1oZ9rcY3f18uExjtbFOLo5Ff8 NB9lFtxf8ObkMARD8Q8K1fEtGUQa7yEGxvrnBtwZUslAyyDpsJM6PCqHzzOzEEie3HQg R5JS7zxhRHKd8HIYUcMHcr/oO+Lb5RmX4sgURQMrtNoE+gKhNJS8+foFbX8fbMFCg7xk vQ1Q== X-Gm-Message-State: APjAAAWFRXjSQ/mifSoiq6zjU0+u9QiLxnPHY81HTBz4CCVGqC81mtwj fu+7G78qRb4SJkt57xApnzmqHLjd X-Google-Smtp-Source: APXvYqzV4dIrv4WayXRoBFG9n15lx1cNIer3M6DVGTDjqIPPzgjtWxEe21YsXYhKjId/Zy5mg6XkmQ== X-Received: by 2002:a62:5c07:: with SMTP id q7mr22638078pfb.159.1572299969484; Mon, 28 Oct 2019 14:59:29 -0700 (PDT) Return-Path: Received: from localhost.localdomain (c-67-170-172-113.hsd1.or.comcast.net. [67.170.172.113]) by smtp.gmail.com with ESMTPSA id f12sm10880612pfn.152.2019.10.28.14.59.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 28 Oct 2019 14:59:28 -0700 (PDT) From: John Stultz To: lkml Cc: John Stultz , Greg Kroah-Hartman , Rob Herring , Mark Rutland , ShuFan Lee , Heikki Krogerus , Suzuki K Poulose , Chunfeng Yun , Yu Chen , Felipe Balbi , Hans de Goede , Andy Shevchenko , Jun Li , Valentin Schneider , Jack Pham , linux-usb@vger.kernel.org, devicetree@vger.kernel.org Subject: [PATCH v4 5/9] usb: dwc3: Rework clock initialization to be more flexible Date: Mon, 28 Oct 2019 21:59:15 +0000 Message-Id: <20191028215919.83697-6-john.stultz@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20191028215919.83697-1-john.stultz@linaro.org> References: <20191028215919.83697-1-john.stultz@linaro.org> The dwc3 core binding specifies three clocks: ref, bus_early, and suspend which are all controlled in the driver together. However some variants of the hardware my not have all three clks So this patch reworks the reading of the clks from the dts to use devm_clk_bulk_get_all() will will fetch all the clocks specified in the dts together. This patch was reccomended by Rob Herring as an alternative to creating multiple bindings for each variant of hardware when the only unique bits were clocks and resets. Cc: Greg Kroah-Hartman Cc: Rob Herring Cc: Mark Rutland CC: ShuFan Lee Cc: Heikki Krogerus Cc: Suzuki K Poulose Cc: Chunfeng Yun Cc: Yu Chen Cc: Felipe Balbi Cc: Hans de Goede Cc: Andy Shevchenko Cc: Jun Li Cc: Valentin Schneider Cc: Jack Pham Cc: linux-usb@vger.kernel.org Cc: devicetree@vger.kernel.org Suggested-by: Rob Herring Signed-off-by: John Stultz --- v3: Rework dwc3 core rather then adding another dwc-of-simple binding. --- drivers/usb/dwc3/core.c | 20 +++++--------------- 1 file changed, 5 insertions(+), 15 deletions(-) -- 2.17.1 diff --git a/drivers/usb/dwc3/core.c b/drivers/usb/dwc3/core.c index a039e35ec7ad..4d4f1836b62c 100644 --- a/drivers/usb/dwc3/core.c +++ b/drivers/usb/dwc3/core.c @@ -305,12 +305,6 @@ static int dwc3_core_soft_reset(struct dwc3 *dwc) return 0; } -static const struct clk_bulk_data dwc3_core_clks[] = { - { .id = "ref" }, - { .id = "bus_early" }, - { .id = "suspend" }, -}; - /* * dwc3_frame_length_adjustment - Adjusts frame length if required * @dwc3: Pointer to our controller context structure @@ -1418,11 +1412,6 @@ static int dwc3_probe(struct platform_device *pdev) if (!dwc) return -ENOMEM; - dwc->clks = devm_kmemdup(dev, dwc3_core_clks, sizeof(dwc3_core_clks), - GFP_KERNEL); - if (!dwc->clks) - return -ENOMEM; - dwc->dev = dev; res = platform_get_resource(pdev, IORESOURCE_MEM, 0); @@ -1458,17 +1447,18 @@ static int dwc3_probe(struct platform_device *pdev) return PTR_ERR(dwc->reset); if (dev->of_node) { - dwc->num_clks = ARRAY_SIZE(dwc3_core_clks); - - ret = devm_clk_bulk_get(dev, dwc->num_clks, dwc->clks); + ret = devm_clk_bulk_get_all(dev, &dwc->clks); if (ret == -EPROBE_DEFER) return ret; /* * Clocks are optional, but new DT platforms should support all * clocks as required by the DT-binding. */ - if (ret) + if (ret < 0) dwc->num_clks = 0; + else + dwc->num_clks = ret; + } ret = reset_control_deassert(dwc->reset); From patchwork Mon Oct 28 21:59:16 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Stultz X-Patchwork-Id: 177974 Delivered-To: patches@linaro.org Received: by 2002:a92:409a:0:0:0:0:0 with SMTP id d26csp3978380ill; Mon, 28 Oct 2019 14:59:31 -0700 (PDT) X-Received: by 2002:a63:29c1:: with SMTP id p184mr19643156pgp.174.1572299971061; Mon, 28 Oct 2019 14:59:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1572299971; cv=none; d=google.com; s=arc-20160816; b=KyfupVR18E4PqFGpIOMEL8hbbu2pxFhBJSny6PpKPwFbeXmEzuPbONLmj1yb1s2zPl tSCYxBqsHAqElUQDcJFs2dZrrfoFhwTtup+Gm2dOoZgs63SE+vanVvc7HGQs1IOSBKYI JY7HEW88/LdgL/zZ6cxV0eMSMCwFbPyZ5PmiTwyw2hi+u3MafWBUfmDHePZNKQ3h5Hci InuR7fZcQUPaQR26ksxs9o08iN06SsX+BFHcLa9aKGyTg47BhOpYwKMoDzFflfSYO2Ru PGC5ohmWO+fj+0T8dGGrZqJz8FjUqUAvdXXB7PAKCE8+JPA019IeYf/8Zz1wF6aBgYdI v6bw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=7OkAbKqeK5UAQaAqjCwbs8uW675j/BSDdsRWiE3W8aU=; b=DIbRG+Aslo55JYxRG8VoTx4s3Eg3520W1747JI/Acy6fpwHYFxddP8kt2K/HmK3trh 6Rs7ziA3938XpGfl+I4fOPUADb0+a3mBi/bxJLM02ib2Z6WfEit6Hz3boM+GgEMEpPAL 9puJz/ww/n3ZctoD7rvW0aeY/Z/C4k5aKAfpSKkIe5xQGst/VW/aW8Al+FMfxkKcSlxW FKCAZuVOnfrHKDEshY9aBkGM87DffNsY7kMpZBZVuaSEEOANkxbDgdeuZvERDbmD6j4P 9O0OmeuC8AHYfwPCFsdHNiXsB+n3912++JyGB0Fcp5J9o//Jnv33nO5eeu6vjnddOsBP /++A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Ai1HB2gk; 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 f100sor1112077pje.25.2019.10.28.14.59.30 for (Google Transport Security); Mon, 28 Oct 2019 14:59:31 -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=Ai1HB2gk; 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:in-reply-to:references; bh=7OkAbKqeK5UAQaAqjCwbs8uW675j/BSDdsRWiE3W8aU=; b=Ai1HB2gk9lrqHztEC4ZHzPtyWt6AhILNoXDJsOU4uocb3Mo/r7ybCc2lWBLviVG2N4 2WfVuv1aWQtHng83gZz0etX1FhVI9HBvVDGvYj4oHX7GLNHq6c7IqOVFfFmlsEJ3u6V2 01kHeUfxJOkJsRUMTL7H/2IMUmPIRLQyYYkYzgYMM7GYjCFqWaEsAfxq9yg2r0HLw5gx d+dlFHHWxtXtR7TBChXd90oVqVYIHxOgcRJyOiw3zfcoappJREjdXKXhbPPe700BWOHl vKLkbx8vDz8s5mBsPYA/b56+OkDHPAHSKuWohftBaNZf+cnRCSNHOkBwDpEWHEe2MWd3 zEgQ== 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:in-reply-to :references; bh=7OkAbKqeK5UAQaAqjCwbs8uW675j/BSDdsRWiE3W8aU=; b=XGce97l13e7uxjVMt6Nm9yIGKJV1tVX/9TALEUbaFXpB3WzSC3hpNWm+tNput36IhO 4+Z9UyMM2+c++4Hqi5VcvAuLEyHgmfKnLzKUsjU0yb1FMrb3Q1t4X5Ifka6AGQTJDGwp NuqVoP2zdc3UtTvMEnLAVYFzt0k3oM36OGmMRdf+OUW+xg6WHHyEp5HpRRLuWtA43Tk0 IZ64MvjMPUmsncR87qI6JCX+P2RGxr1HTc5dYNSTjfof0+1/BVjj355cT2qm3zVFtOGY GNXO+OQTaVq8XHlEfOL52n8i1WWtGWOyVuhB01xCPt+259IydyFK1GOdcE+Lmz92BgVm HUbA== X-Gm-Message-State: APjAAAWiXElio7Ftt9h5mbLbQ2aBZM5OpeMCRIN6pHpt0YTYSUY6gVbC vZDo3GCJRDUaEWqH+UrEveRdIRxU X-Google-Smtp-Source: APXvYqxHxifqq5Xfv4B4vIzQhfZKh/YWkRZppo1k5WzU2a3NOH7qey4U6MAmtNictRTF7mgCEmNVYg== X-Received: by 2002:a17:90a:a406:: with SMTP id y6mr1962404pjp.106.1572299970594; Mon, 28 Oct 2019 14:59:30 -0700 (PDT) Return-Path: Received: from localhost.localdomain (c-67-170-172-113.hsd1.or.comcast.net. [67.170.172.113]) by smtp.gmail.com with ESMTPSA id f12sm10880612pfn.152.2019.10.28.14.59.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 28 Oct 2019 14:59:30 -0700 (PDT) From: John Stultz To: lkml Cc: John Stultz , Greg Kroah-Hartman , Rob Herring , Mark Rutland , ShuFan Lee , Heikki Krogerus , Suzuki K Poulose , Chunfeng Yun , Yu Chen , Felipe Balbi , Hans de Goede , Andy Shevchenko , Jun Li , Valentin Schneider , Jack Pham , linux-usb@vger.kernel.org, devicetree@vger.kernel.org Subject: [PATCH v4 6/9] usb: dwc3: Rework resets initialization to be more flexible Date: Mon, 28 Oct 2019 21:59:16 +0000 Message-Id: <20191028215919.83697-7-john.stultz@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20191028215919.83697-1-john.stultz@linaro.org> References: <20191028215919.83697-1-john.stultz@linaro.org> The dwc3 core binding specifies one reset. However some variants of the hardware my not have more. So this patch reworks the reading of the resets to fetch all the resets specified in the dts together. This patch was reccomended by Rob Herring as an alternative to creating multiple bindings for each variant of hardware when the only unique bits were clocks and resets. Cc: Greg Kroah-Hartman Cc: Rob Herring Cc: Mark Rutland CC: ShuFan Lee Cc: Heikki Krogerus Cc: Suzuki K Poulose Cc: Chunfeng Yun Cc: Yu Chen Cc: Felipe Balbi Cc: Hans de Goede Cc: Andy Shevchenko Cc: Jun Li Cc: Valentin Schneider Cc: Jack Pham Cc: linux-usb@vger.kernel.org Cc: devicetree@vger.kernel.org Suggested-by: Rob Herring Signed-off-by: John Stultz --- v3: Rework dwc3 core rather then adding another dwc-of-simple binding. --- drivers/usb/dwc3/core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -- 2.17.1 diff --git a/drivers/usb/dwc3/core.c b/drivers/usb/dwc3/core.c index 4d4f1836b62c..ef52ffa5d6cb 100644 --- a/drivers/usb/dwc3/core.c +++ b/drivers/usb/dwc3/core.c @@ -1442,7 +1442,7 @@ static int dwc3_probe(struct platform_device *pdev) dwc3_get_properties(dwc); - dwc->reset = devm_reset_control_get_optional_shared(dev, NULL); + dwc->reset = devm_reset_control_array_get(dev, true, true); if (IS_ERR(dwc->reset)) return PTR_ERR(dwc->reset); From patchwork Mon Oct 28 21:59:17 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Stultz X-Patchwork-Id: 177975 Delivered-To: patches@linaro.org Received: by 2002:a92:409a:0:0:0:0:0 with SMTP id d26csp3978397ill; Mon, 28 Oct 2019 14:59:32 -0700 (PDT) X-Received: by 2002:a65:6492:: with SMTP id e18mr23637401pgv.111.1572299972152; Mon, 28 Oct 2019 14:59:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1572299972; cv=none; d=google.com; s=arc-20160816; b=QnXjeP5i/ud3DeH5NNStTYdvINPvI2EKTlwpAxWNO6wjGto6RfSpKnFWBis4NylwcN DG5JXS2xwOjfWXmq1X2mtH+8ayXQk3DDEWKwBhkOupErjdUTOk1gxi797uV+qtkstrpf ioIxzr88qa192MwIjIRJue7N3Q1BL1wKs3kV8bIVKfEOJ5fHPg4xjRcT0eoH6hEIOdQZ 6fqbIbEoiK4D5iK4Tr8cPqhrnrbjdcJYoTjjYbq9izOJPtxw/sRNU232nGAH78qABknI nCZw5qY0jjxEoTPrx6VV6WJi3AL6oxSmIy7vMLbIQvI/7Uxnee9mUNLi+aWE/Ds3S5wo nK8Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=2PoKh0+SG7fHxZLJh2y0Lp0GiZzbHmOzaEb4WWk+/NM=; b=rJRddzmp0GY0op9Ysm48Y8v4Z9iKApju4JVQvUEs01bRZUpneSor2vyYnmsm4JWcAe s+gbWrnDM0orG91wf4aCP7O42aLScDqjQH8U8D+YjGHiX3dVsyiRNY9kyKFj2EbYSI05 7Gjnnr+pgxyz+ofG6HXNpWfYnETlGgBKo/MPSqpS/eiTsiusuFjcikSQ1+oICTHR363U jPoa8RDGNYOfmSkeJor4cg3MDVFCV30L/J4x2kyAsFyHbGKQcSRvP+LJOVQiJBEPEpMX ORqLqUsfZLxKo1B0hHdMF6jDcvpne6ArrJniuiDfQ3/KJv8fUHVRt5b6TaR4aP+CDpz6 J/tA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=jtq8DkDU; 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 x125sor12918959pfx.15.2019.10.28.14.59.32 for (Google Transport Security); Mon, 28 Oct 2019 14:59:32 -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=jtq8DkDU; 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:in-reply-to:references; bh=2PoKh0+SG7fHxZLJh2y0Lp0GiZzbHmOzaEb4WWk+/NM=; b=jtq8DkDU85+tWa5fMiuxfSrNXrOQgEmC8+IDRnrHBezQLj247d9yekLtAIznO6Prie wPUz7MSxEShqqeJSanC/nCU7uStI9N8Lk2om8Wh/BJaRZjP3HAaB3BOi97vojCn5RFy2 KGz5xu43Vt0XSePO993dqP8VwNOOdXzgk+0ycp50RguFNhXcYWqitoF0HNR1fCs4kQqi a3f+DCBzla+HnfQ5FoKqIZdnXYXfT3ZNnMcMSqukeWLdSdO/9HkMXPeUATZ5LIDj6Fgz lGFxZWIKIK+ipsTqIe4ZZI/MHbNgC6Tvq991FpdeTZVkp8uAmWhOJ0WoXrFpvsnYyMVw 3jsw== 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:in-reply-to :references; bh=2PoKh0+SG7fHxZLJh2y0Lp0GiZzbHmOzaEb4WWk+/NM=; b=JSi10wZQG/264Z/GLwd72jJxvbV+MvE4HwSHU+JutxKMLQbvqk0+LSfJFkAwmSz5OF y0hFhCMiYQBozqSCkNC3pZf0wXx4/Att1cj+DSUzmFeSMF4oL0HmVwVL7k64wcHoUQks gyiuUZM8LyTp8gv4DxoMVOFA5L+uKKwT0VfLi/C9/+L8A7QCi2BeSfczirdndfQj05kp KA1OlrfotAZaw2bGZUgsllSt7OpEFnK/p9BUb+dXVYITa+CcrzwNuAdDaFWaPJu7GwE7 zWfybkj4tJ9pkQ5kOllA+aPvF3S6XiKf5KtquOfn2n8CEa6SohTX87UAD5Oe+JLU2ASU EUEg== X-Gm-Message-State: APjAAAUvb52MD+7iFS9mhwoNVuz0FwtoPL2rSfM0Q4r6AGyJZNe9IQmk 91UJ++uakKnFrGG10I3GS7g4FONk X-Google-Smtp-Source: APXvYqyB0veo2JoPN5PQxtdCEJGuF1tkFG2bXoqpXtYA4SKF7I8LnvDDhFJGFXhzdbKdmtPQDJMhkA== X-Received: by 2002:a62:e10c:: with SMTP id q12mr13903809pfh.248.1572299971714; Mon, 28 Oct 2019 14:59:31 -0700 (PDT) Return-Path: Received: from localhost.localdomain (c-67-170-172-113.hsd1.or.comcast.net. [67.170.172.113]) by smtp.gmail.com with ESMTPSA id f12sm10880612pfn.152.2019.10.28.14.59.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 28 Oct 2019 14:59:31 -0700 (PDT) From: John Stultz To: lkml Cc: Yu Chen , Greg Kroah-Hartman , Rob Herring , Mark Rutland , ShuFan Lee , Heikki Krogerus , Suzuki K Poulose , Chunfeng Yun , Felipe Balbi , Hans de Goede , Andy Shevchenko , Jun Li , Valentin Schneider , Jack Pham , linux-usb@vger.kernel.org, devicetree@vger.kernel.org, John Stultz Subject: [PATCH v4 7/9] usb: dwc3: Registering a role switch in the DRD code. Date: Mon, 28 Oct 2019 21:59:17 +0000 Message-Id: <20191028215919.83697-8-john.stultz@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20191028215919.83697-1-john.stultz@linaro.org> References: <20191028215919.83697-1-john.stultz@linaro.org> From: Yu Chen The Type-C drivers use USB role switch API to inform the system about the negotiated data role, so registering a role switch in the DRD code in order to support platforms with USB Type-C connectors. Cc: Greg Kroah-Hartman Cc: Rob Herring Cc: Mark Rutland CC: ShuFan Lee Cc: Heikki Krogerus Cc: Suzuki K Poulose Cc: Chunfeng Yun Cc: Yu Chen Cc: Felipe Balbi Cc: Hans de Goede Cc: Andy Shevchenko Cc: Jun Li Cc: Valentin Schneider Cc: Jack Pham Cc: linux-usb@vger.kernel.org Cc: devicetree@vger.kernel.org Suggested-by: Heikki Krogerus Signed-off-by: Yu Chen Signed-off-by: John Stultz --- v2: Fix role_sw and role_switch_default_mode descriptions as reported by kbuild test robot v3: Split out the role-switch-default-host logic into its own patch --- drivers/usb/dwc3/Kconfig | 1 + drivers/usb/dwc3/core.h | 3 ++ drivers/usb/dwc3/drd.c | 66 +++++++++++++++++++++++++++++++++++++++- 3 files changed, 69 insertions(+), 1 deletion(-) -- 2.17.1 diff --git a/drivers/usb/dwc3/Kconfig b/drivers/usb/dwc3/Kconfig index 89abc6078703..1104745c41a9 100644 --- a/drivers/usb/dwc3/Kconfig +++ b/drivers/usb/dwc3/Kconfig @@ -44,6 +44,7 @@ config USB_DWC3_DUAL_ROLE bool "Dual Role mode" depends on ((USB=y || USB=USB_DWC3) && (USB_GADGET=y || USB_GADGET=USB_DWC3)) depends on (EXTCON=y || EXTCON=USB_DWC3) + select USB_ROLE_SWITCH help This is the default mode of working of DWC3 controller where both host and gadget features are enabled. diff --git a/drivers/usb/dwc3/core.h b/drivers/usb/dwc3/core.h index 1c8b349379af..6f19e9891767 100644 --- a/drivers/usb/dwc3/core.h +++ b/drivers/usb/dwc3/core.h @@ -25,6 +25,7 @@ #include #include #include +#include #include #include @@ -951,6 +952,7 @@ struct dwc3_scratchpad_array { * @hsphy_mode: UTMI phy mode, one of following: * - USBPHY_INTERFACE_MODE_UTMI * - USBPHY_INTERFACE_MODE_UTMIW + * @role_sw: usb_role_switch handle * @usb2_phy: pointer to USB2 PHY * @usb3_phy: pointer to USB3 PHY * @usb2_generic_phy: pointer to USB2 PHY @@ -1084,6 +1086,7 @@ struct dwc3 { struct extcon_dev *edev; struct notifier_block edev_nb; enum usb_phy_interface hsphy_mode; + struct usb_role_switch *role_sw; u32 fladj; u32 irq_gadget; diff --git a/drivers/usb/dwc3/drd.c b/drivers/usb/dwc3/drd.c index c946d64142ad..61d4fd8aead4 100644 --- a/drivers/usb/dwc3/drd.c +++ b/drivers/usb/dwc3/drd.c @@ -476,6 +476,52 @@ static struct extcon_dev *dwc3_get_extcon(struct dwc3 *dwc) return edev; } +static int dwc3_usb_role_switch_set(struct device *dev, enum usb_role role) +{ + struct dwc3 *dwc = dev_get_drvdata(dev); + u32 mode; + + switch (role) { + case USB_ROLE_HOST: + mode = DWC3_GCTL_PRTCAP_HOST; + break; + case USB_ROLE_DEVICE: + mode = DWC3_GCTL_PRTCAP_DEVICE; + break; + default: + mode = DWC3_GCTL_PRTCAP_DEVICE; + break; + } + + dwc3_set_mode(dwc, mode); + return 0; +} + +static enum usb_role dwc3_usb_role_switch_get(struct device *dev) +{ + struct dwc3 *dwc = dev_get_drvdata(dev); + unsigned long flags; + enum usb_role role; + + spin_lock_irqsave(&dwc->lock, flags); + switch (dwc->current_dr_role) { + case DWC3_GCTL_PRTCAP_HOST: + role = USB_ROLE_HOST; + break; + case DWC3_GCTL_PRTCAP_DEVICE: + role = USB_ROLE_DEVICE; + break; + case DWC3_GCTL_PRTCAP_OTG: + role = dwc->current_otg_role; + break; + default: + role = USB_ROLE_DEVICE; + break; + } + spin_unlock_irqrestore(&dwc->lock, flags); + return role; +} + int dwc3_drd_init(struct dwc3 *dwc) { int ret, irq; @@ -484,7 +530,22 @@ int dwc3_drd_init(struct dwc3 *dwc) if (IS_ERR(dwc->edev)) return PTR_ERR(dwc->edev); - if (dwc->edev) { + if (device_property_read_bool(dwc->dev, "usb-role-switch")) { + struct usb_role_switch_desc dwc3_role_switch = {NULL}; + u32 mode; + + mode = DWC3_GCTL_PRTCAP_DEVICE; + + dwc3_role_switch.fwnode = dev_fwnode(dwc->dev); + dwc3_role_switch.set = dwc3_usb_role_switch_set; + dwc3_role_switch.get = dwc3_usb_role_switch_get; + dwc->role_sw = usb_role_switch_register(dwc->dev, + &dwc3_role_switch); + if (IS_ERR(dwc->role_sw)) + return PTR_ERR(dwc->role_sw); + + dwc3_set_mode(dwc, mode); + } else if (dwc->edev) { dwc->edev_nb.notifier_call = dwc3_drd_notifier; ret = extcon_register_notifier(dwc->edev, EXTCON_USB_HOST, &dwc->edev_nb); @@ -531,6 +592,9 @@ void dwc3_drd_exit(struct dwc3 *dwc) { unsigned long flags; + if (dwc->role_sw) + usb_role_switch_unregister(dwc->role_sw); + if (dwc->edev) extcon_unregister_notifier(dwc->edev, EXTCON_USB_HOST, &dwc->edev_nb); From patchwork Mon Oct 28 21:59:18 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Stultz X-Patchwork-Id: 177977 Delivered-To: patches@linaro.org Received: by 2002:a92:409a:0:0:0:0:0 with SMTP id d26csp3978418ill; Mon, 28 Oct 2019 14:59:33 -0700 (PDT) X-Received: by 2002:a17:90a:2470:: with SMTP id h103mr2035508pje.12.1572299973399; Mon, 28 Oct 2019 14:59:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1572299973; cv=none; d=google.com; s=arc-20160816; b=wgmsiiYnwoRfF2pPecJR2ah6U4Z8GAmMqPM4pSzyv/gLM9L1Hjmw67WNbgVVpZRe68 50hWS0htCAuSQLI8Zki3M7i9iXF0NLXwAfE438eoHyRwB5d+0ITyPvSiBOAy9Kn7Vowz XGa9QNNwZIwkhxZ7qwhriWp8uD2qAuhLCQHsuxiXoMltU9hLeg/kvxPsjnxqBYopXRW9 acn8ngpCUUsi9llOX6xWsbC1IVsNNPB8I7AzArCU0z13qvltyY10C64qUT2FsfHm9sYh ouvj3+uTajWYHutq3btmQnv9O7usphHTbuJHccGTn4mFaMhg/zZNmJz9bnza+mUMhZte o51A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=PwMMZk9WZCsU4Du96enXrC4F3u/XmD+gFRyu+Xx8uI0=; b=UTrsOXTHoc4M0jY02bp30p3b+tD1/wzPl0lcWTZ0V6PpTOWwL3duuzZd26F8PfpXIJ IGFd5k58qZDXx+rpDfK2PVVAv5fSyDfLKQ55Rz5qXvdYADd8whJrTuf1p/kQFeAMy4dq 5eJ7QbnZYSkcXyUgRZvfcM/BMe0f8GlhH2rALgrlIYJXyczzumQUkHNkBp4HtbDnOi0U 5PJgV4WG5NMHjM6W/llp3qFXqvjv0+6Mq8RBRYjDeDmLGCHkcvBsjj5/WHCjJ9/4dVEs /Lrm7xByiFgkoYRx/vutuyYmZs16KbLYb4iRohjOdsQISgbfEaTK4MaFFN1Rh6srZZE2 t4iA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=yK8XTi+y; 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 b99sor1138585pjc.27.2019.10.28.14.59.33 for (Google Transport Security); Mon, 28 Oct 2019 14:59:33 -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=yK8XTi+y; 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:in-reply-to:references; bh=PwMMZk9WZCsU4Du96enXrC4F3u/XmD+gFRyu+Xx8uI0=; b=yK8XTi+yTqTvJtzBmsrxxZLC61ETTwPZxqGYnTbkgxYjA6GIs/gPQoC01K2sxBxzFl MMEwxtYn+EJXpjSvIP6eGGl7wmPAW+jGbqWOHspOj7EiQko05VJsEfSp1MN18G1jOUEU /5vTuSj/FWaKNs2T4pu58ii6asJl3R5vuhWgK6r81QFP2V0ka7iE7k4OCpik8Nm6QAy/ 60it1XUz8BIpKv+SwD5N6xFqcNCU49JuBRhvm4ufv4JLjR081Bk5Hwi2cJwsZDpPF1/P DuxqNluasrbfqixUPmc41KVHc9FIFjCHiqGdjiSmYwyl9wuBRQpRJs6hkDEtjHnf22EU /0MQ== 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:in-reply-to :references; bh=PwMMZk9WZCsU4Du96enXrC4F3u/XmD+gFRyu+Xx8uI0=; b=Dn1r4FQNlrBjZfLq/xs5JtyHy2etyUsAcmQOh6Sy8aTXHk/K+HwHADSuzAXZ9SK9WE 2DvbI72oWhTBv6rEfXp/ojuCeYK87kceYXwQcpw5EXNkupEApBTxmI5qTqaJTWlALayt hzN/JIXEFSnvK+sjLTIq4PWUH8srBq3kFaJR4q6WGuiU+oIhfKzMC6ZEuAXaz0Kegecs u/7n+q15X4wPksHVIY8L7Nozt17ge2S/xVvvRFNpYIw6eVRW/fpwu/1PWZT4UC1TZEsJ CFV5cCkgcf/HkiVxmy3kNrseKOaSCkoTRq4OczsuI9qkXfKkKd2x+pniVqDjTq9jnemd Uesg== X-Gm-Message-State: APjAAAUxxqRBeylY+1lvmmYrxLk0U1vOVpf4smCbujWKJa2751Clu9xT CkfSMzy0u13yqhgcPmIVAw/DyBVS X-Google-Smtp-Source: APXvYqw+lIWkxCOYZfgUieLhn03j3Firptukiq0WcBWbrHmeAQRBK9que/SoMHJEv+L5UyY/O19Z1Q== X-Received: by 2002:a17:90a:a616:: with SMTP id c22mr1907346pjq.61.1572299972866; Mon, 28 Oct 2019 14:59:32 -0700 (PDT) Return-Path: Received: from localhost.localdomain (c-67-170-172-113.hsd1.or.comcast.net. [67.170.172.113]) by smtp.gmail.com with ESMTPSA id f12sm10880612pfn.152.2019.10.28.14.59.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 28 Oct 2019 14:59:32 -0700 (PDT) From: John Stultz To: lkml Cc: John Stultz , Greg Kroah-Hartman , Rob Herring , Mark Rutland , ShuFan Lee , Heikki Krogerus , Suzuki K Poulose , Chunfeng Yun , Yu Chen , Felipe Balbi , Hans de Goede , Andy Shevchenko , Jun Li , Valentin Schneider , Jack Pham , linux-usb@vger.kernel.org, devicetree@vger.kernel.org Subject: [PATCH v4 8/9] dt-bindings: usb: generic: Add role-switch-default-host binding Date: Mon, 28 Oct 2019 21:59:18 +0000 Message-Id: <20191028215919.83697-9-john.stultz@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20191028215919.83697-1-john.stultz@linaro.org> References: <20191028215919.83697-1-john.stultz@linaro.org> Add binding to configure the default role the controller assumes is host mode when the usb role is USB_ROLE_NONE. Cc: Greg Kroah-Hartman Cc: Rob Herring Cc: Mark Rutland CC: ShuFan Lee Cc: Heikki Krogerus Cc: Suzuki K Poulose Cc: Chunfeng Yun Cc: Yu Chen Cc: Felipe Balbi Cc: Hans de Goede Cc: Andy Shevchenko Cc: Jun Li Cc: Valentin Schneider Cc: Jack Pham Cc: linux-usb@vger.kernel.org Cc: devicetree@vger.kernel.org Reviewed-by: Rob Herring Signed-off-by: John Stultz --- Documentation/devicetree/bindings/usb/generic.txt | 5 +++++ 1 file changed, 5 insertions(+) -- 2.17.1 diff --git a/Documentation/devicetree/bindings/usb/generic.txt b/Documentation/devicetree/bindings/usb/generic.txt index cf5a1ad456e6..013782fde293 100644 --- a/Documentation/devicetree/bindings/usb/generic.txt +++ b/Documentation/devicetree/bindings/usb/generic.txt @@ -34,6 +34,11 @@ Optional properties: the USB data role (USB host or USB device) for a given USB connector, such as Type-C, Type-B(micro). see connector/usb-connector.txt. + - role-switch-default-host: boolean, indicating if usb-role-switch is enabled + the device default operation mode of controller while + usb role is USB_ROLE_NONE is host mode. If this is not + set or false, it will be assumed the default is device + mode. This is an attribute to a USB controller such as: From patchwork Mon Oct 28 21:59:19 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Stultz X-Patchwork-Id: 177976 Delivered-To: patches@linaro.org Received: by 2002:a92:409a:0:0:0:0:0 with SMTP id d26csp3978445ill; Mon, 28 Oct 2019 14:59:34 -0700 (PDT) X-Received: by 2002:a63:5b56:: with SMTP id l22mr24044498pgm.52.1572299974713; Mon, 28 Oct 2019 14:59:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1572299974; cv=none; d=google.com; s=arc-20160816; b=vfT5y83ZXFTVclj1a3OF7L8G17qC0tgP2YZhx0rheJZ+cpy5Um7yFQZzMx+DeIPPPv jYtv2G1+pK/khdNv1qcLiEqzTFjHyhhxFK2c9gj4t0t89WBHcXJ3+YVbfYSP8ebrRBLD OVupKRgG/UbwtC30CUW70RvqXKA8w55bvpyCefwSshybHMSbyzKvgkfJXacZDWorvsp5 Y6yyrvdsZMaTVehCfmYFB2JH4QdluBrc5JCagfh4xgYNr1YTXg1vJSd5UMTcb5NGAi/+ NhVHS41P6tPevhEu5NNVHRCMyVnkHVnKLCI8L+jH+JyfE7ra4Hh9HEzC63zpJCzrWmnd J2fw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=9P5p/4dcNs8ql4OyOSsDmP/Eo0cfZOKgwuYqI45wfJg=; b=YXDNAA9tGbRKZ6bzA7qP0Qrze5PJNXG0ywbYXSwM5B2e42PBAGhyjAYhgn7EUUW7V9 i6oxAYtll7h5vELPJYFsB+9qP7OXlx4dNVXtSF/CGY8uL9eB0YgeXjGTgzRku4SoyDn3 cIx9+5K1OJ/5xNykCXd4h+etEJ8kBLFjVRRPKa5/8rhXTb7v8N/i/vkDXG0qxqO5Ubkg 0W17uBUuFjdUWKLG1724aZrQDaDz0EuKj0dXemmJLiYTN0zS/qy0XWQMooF70dpsdpAQ uXjfzfw1HxfaelXLQmpsWrzK7EebW38gefcMt/PTODS8koetbGWmwdXezFJyv5nx3rtf c5Jg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=ks8Q41j1; 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 c17sor1179670pjo.0.2019.10.28.14.59.34 for (Google Transport Security); Mon, 28 Oct 2019 14:59:34 -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=ks8Q41j1; 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:in-reply-to:references; bh=9P5p/4dcNs8ql4OyOSsDmP/Eo0cfZOKgwuYqI45wfJg=; b=ks8Q41j1ZqA/QKFHT472CH12EK/nGPhBNjUH0WKFQdpFsYiFWCGlWyyocdHfUnLMFa ilBT83QeApQCioM8MCcBVzcBTr7L16ZzSYSrlsZ3svQz3Qbmu5mSay4FCb/9m1XsUVU2 c1YR0FZ10+gBGjO9pUj9XMLVRV8DYgv7q+bju8Xop7n6vZQ9f1jfJDxhERBpjloaB6fy zHrBQ6YHV8IMq095CL+xzpfQDJxCaC6+b2Lj4lm6/v2LPLFB/3kHTtdPCO9b075ZTy59 KdY31qCinVxER1+Qe5BFmn6E1SYTIZ5dzMigy+dADU7kWpKK4lDLBXZWyamHz7NfObM5 BpUA== 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:in-reply-to :references; bh=9P5p/4dcNs8ql4OyOSsDmP/Eo0cfZOKgwuYqI45wfJg=; b=aX4lHGO3p5UXFrn6a4sg5wOJ20dLcHRDGTMz7i6QaK/mT7XiEVjEjdJ+YsSXHn2BHI 2k+Sh27633q0RcZSBDgFTqae/BGLp5RVf0H42C6J5xTWRuDICKQuR5svTvkCBT7phNkE URoM+EQETGNPN9CvjJSxeLFsyE5LDLdOC0vw2tvy73p4XsCyNnUsStWUwr1EkOpBYYsh St7Lk61+qI+bbDVeqYExr1yYlLSNvK1ZP89fPWNmN/iF28JUdzovzt9IitYIhmDk/KhH 1D0tp74w7FmJYfIniJxp9q0n9+ys6UfRrx4uax6EOcDDxQ6tgBevE7L+X3aQ1zmIXvvg q1rw== X-Gm-Message-State: APjAAAU4le6MuAXqHem94VWuUahtyLC96ITu3qIpKLkST0qHkmz8+xWh /IInS4n5+DHVdbR4VzJIY5Bw+adz X-Google-Smtp-Source: APXvYqyzWZOig+RfCXgpnHo7l5IBFBeACyeBjNjdSXrji1GSa9dz+HugwTGG5QUBsQUIQSVHRSs/1A== X-Received: by 2002:a17:90a:1050:: with SMTP id y16mr1902116pjd.59.1572299974196; Mon, 28 Oct 2019 14:59:34 -0700 (PDT) Return-Path: Received: from localhost.localdomain (c-67-170-172-113.hsd1.or.comcast.net. [67.170.172.113]) by smtp.gmail.com with ESMTPSA id f12sm10880612pfn.152.2019.10.28.14.59.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 28 Oct 2019 14:59:33 -0700 (PDT) From: John Stultz To: lkml Cc: John Stultz , Greg Kroah-Hartman , Rob Herring , Mark Rutland , ShuFan Lee , Heikki Krogerus , Suzuki K Poulose , Chunfeng Yun , Yu Chen , Felipe Balbi , Hans de Goede , Andy Shevchenko , Jun Li , Valentin Schneider , Jack Pham , linux-usb@vger.kernel.org, devicetree@vger.kernel.org Subject: [PATCH v4 9/9] usb: dwc3: Add host-mode as default support Date: Mon, 28 Oct 2019 21:59:19 +0000 Message-Id: <20191028215919.83697-10-john.stultz@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20191028215919.83697-1-john.stultz@linaro.org> References: <20191028215919.83697-1-john.stultz@linaro.org> Support configuring the default role the controller assumes as host mode when the usb role is USB_ROLE_NONE This patch was split out from a larger patch originally by Yu Chen Cc: Greg Kroah-Hartman Cc: Rob Herring Cc: Mark Rutland CC: ShuFan Lee Cc: Heikki Krogerus Cc: Suzuki K Poulose Cc: Chunfeng Yun Cc: Yu Chen Cc: Felipe Balbi Cc: Hans de Goede Cc: Andy Shevchenko Cc: Jun Li Cc: Valentin Schneider Cc: Jack Pham Cc: linux-usb@vger.kernel.org Cc: devicetree@vger.kernel.org Signed-off-by: John Stultz --- v3: Split this patch out from addition of usb-role-switch handling --- drivers/usb/dwc3/core.h | 3 +++ drivers/usb/dwc3/drd.c | 20 ++++++++++++++++---- 2 files changed, 19 insertions(+), 4 deletions(-) -- 2.17.1 diff --git a/drivers/usb/dwc3/core.h b/drivers/usb/dwc3/core.h index 6f19e9891767..3c879c9ab1aa 100644 --- a/drivers/usb/dwc3/core.h +++ b/drivers/usb/dwc3/core.h @@ -953,6 +953,8 @@ struct dwc3_scratchpad_array { * - USBPHY_INTERFACE_MODE_UTMI * - USBPHY_INTERFACE_MODE_UTMIW * @role_sw: usb_role_switch handle + * @role_switch_default_mode: default operation mode of controller while + * usb role is USB_ROLE_NONE. * @usb2_phy: pointer to USB2 PHY * @usb3_phy: pointer to USB3 PHY * @usb2_generic_phy: pointer to USB2 PHY @@ -1087,6 +1089,7 @@ struct dwc3 { struct notifier_block edev_nb; enum usb_phy_interface hsphy_mode; struct usb_role_switch *role_sw; + enum usb_dr_mode role_switch_default_mode; u32 fladj; u32 irq_gadget; diff --git a/drivers/usb/dwc3/drd.c b/drivers/usb/dwc3/drd.c index 61d4fd8aead4..0e3466fe5ac4 100644 --- a/drivers/usb/dwc3/drd.c +++ b/drivers/usb/dwc3/drd.c @@ -489,7 +489,10 @@ static int dwc3_usb_role_switch_set(struct device *dev, enum usb_role role) mode = DWC3_GCTL_PRTCAP_DEVICE; break; default: - mode = DWC3_GCTL_PRTCAP_DEVICE; + if (dwc->role_switch_default_mode == USB_DR_MODE_HOST) + mode = DWC3_GCTL_PRTCAP_HOST; + else + mode = DWC3_GCTL_PRTCAP_DEVICE; break; } @@ -515,7 +518,10 @@ static enum usb_role dwc3_usb_role_switch_get(struct device *dev) role = dwc->current_otg_role; break; default: - role = USB_ROLE_DEVICE; + if (dwc->role_switch_default_mode == USB_DR_MODE_HOST) + role = USB_ROLE_HOST; + else + role = USB_ROLE_DEVICE; break; } spin_unlock_irqrestore(&dwc->lock, flags); @@ -534,8 +540,14 @@ int dwc3_drd_init(struct dwc3 *dwc) struct usb_role_switch_desc dwc3_role_switch = {NULL}; u32 mode; - mode = DWC3_GCTL_PRTCAP_DEVICE; - + if (device_property_read_bool(dwc->dev, + "role-switch-default-host")) { + dwc->role_switch_default_mode = USB_DR_MODE_HOST; + mode = DWC3_GCTL_PRTCAP_HOST; + } else { + dwc->role_switch_default_mode = USB_DR_MODE_PERIPHERAL; + mode = DWC3_GCTL_PRTCAP_DEVICE; + } dwc3_role_switch.fwnode = dev_fwnode(dwc->dev); dwc3_role_switch.set = dwc3_usb_role_switch_set; dwc3_role_switch.get = dwc3_usb_role_switch_get;