From patchwork Wed Oct 16 03:33:30 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Stultz X-Patchwork-Id: 176403 Delivered-To: patches@linaro.org Received: by 2002:a92:7e96:0:0:0:0:0 with SMTP id q22csp6783575ill; Tue, 15 Oct 2019 20:33:45 -0700 (PDT) X-Received: by 2002:a17:902:6b08:: with SMTP id o8mr39011742plk.152.1571196825168; Tue, 15 Oct 2019 20:33:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1571196825; cv=none; d=google.com; s=arc-20160816; b=cZ1jCDxzWlK9lNNSyzfr1LlCieCwdiRnVb/t7rzwhXmwDaJMczO8GSINhWKF/3Lb7l wWJkPJJlC0ExWDX7OPJGUMZib19V4Mdq9xYbNt3gi2Dl4UDyw8oG3vH2eoh9HcIfuDnf aeloif2aE6HSafqltq2QHuY3vikA3FNtrLpW4MHIOe4lTueWXSpWQf7Htom5MnnTLyj2 Q4FTYHJiFi1nLexn7w8BGxWjEOaekqiCyejmHw/959A+uAIPdp8/PybDEfc1DAKK6iX7 2HML/LjcXucP7QJ9+KRZNFZ6zZ0+0rDq6f2nMETIZvvmElGyOjuuJNFoWB+Je7Gfe+wg ZJTg== 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=fRDq+Govllq16c1rVtbPxh4EGeU09WPUKVrEsP0KpogU9K9CgTNpHjNEhczMWIQeq9 HplWAdW6LsKwDTY0Esq/z1KQLn9QZ4282uodzelEyZCmyVvOda7SmhdnT3JWlLB5HlzL KkX5rxMCbHkD2jFna13a7YKv4fHkuqKXwRRhcqHbUC3K9I5T3n2hEiQKFfmpX5LWmlki 8iwXaRN3TZI9xnhhIhW0nafTSuJOtITgnblpu3XxeCWZZc/lhoY+mjdqKFOq4DfbYK/g 5RcHTGMvliRKBa3XoJgOQaDhxR9GMMM2f+2TwoBM654LaojnB1lhL2FcJGS5bqe2apwz LEhw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=e6dZ4jnO; 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 q8sor29842463plr.67.2019.10.15.20.33.45 for (Google Transport Security); Tue, 15 Oct 2019 20:33:45 -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=e6dZ4jnO; 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=e6dZ4jnOdh701k6NIby9LePCeZk359ThphqZ/2dmJcm5ahDdEyvbcCb7e1qoumSLz0 8j+1PiF2T63bndbhCteIdZ/+q9rAHX7I70BI2N3BlLE9Mt562iWVzRA6MOYGzlpwWKcQ GxWtdyTnInOCSf5l461dxNA5c2yEklyi3Mzj6nxxJAWzf8tSW9nlA43PAX/DEFhL1x5K wmgkPA9ikT+8E1AQJ2eAIdMSaNcViHVg26qtyYT587vUUX/1mnFB4MICD79iJd31EkHg LFcGqZVjhYpd+WkBoT7+lhEmQevDkes86Ld4ASBmJgLVKKUK3mnqhH1jmHEmjuR00Kbw n2SQ== 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=HPSKiMbaniRjR/YaTZBPz5bbC9I28nVGYbxok4k2JcEt5jXCmYevXgmJS3ZWL1oiOS BmyJL3sh6eaXH2CQGu11lZ1HHa92ShVcgKALtCV1xmOxijRfIzE3oFfbMDSjhMmtUbnk Qkxs+GbwEXMXOmt4b1+7XaWC2GS6tXHPxpTK2htjYRZf1yVSt1JAMwt+Ts8B0rqSFCLc hMnimnWqtNAVSrZjHeVrC0OsGNFRsCIMuy3234gjZbuht4/nvEV6piq5lYtnuJe+oyrX 2zNnZhavynSFZfmJtXX0/9FeWSa6TaHca8q+nMvaOKOpCn4i4MqmhNSctYC4dDBY7qJE XUiw== X-Gm-Message-State: APjAAAVRPr8ZTMBUG4PT5/9OvLjenzOwYyevzl91LX+RMEmTrpPaKF4D 1Z454sQHldl/L8Wm//43trUu0Kkq X-Google-Smtp-Source: APXvYqzi4gPMxKJwhqOxXiD5FPvDSBSoufhfjLaVn4yXk8AEbK4UogbAw0pn+zPiG0oPOnXiM33JVw== X-Received: by 2002:a17:902:a988:: with SMTP id bh8mr39613879plb.303.1571196824723; Tue, 15 Oct 2019 20:33:44 -0700 (PDT) Return-Path: Received: from localhost.localdomain ([2601:1c2:680:1319:692:26ff:feda:3a81]) by smtp.gmail.com with ESMTPSA id l23sm748356pjy.12.2019.10.15.20.33.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 15 Oct 2019 20:33:44 -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: [RFC][PATCH v3 01/11] dt-bindings: usb: rt1711h: Add connector bindings Date: Wed, 16 Oct 2019 03:33:30 +0000 Message-Id: <20191016033340.1288-2-john.stultz@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20191016033340.1288-1-john.stultz@linaro.org> References: <20191016033340.1288-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 Wed Oct 16 03:33:31 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Stultz X-Patchwork-Id: 176404 Delivered-To: patches@linaro.org Received: by 2002:a92:7e96:0:0:0:0:0 with SMTP id q22csp6783598ill; Tue, 15 Oct 2019 20:33:46 -0700 (PDT) X-Received: by 2002:a62:5801:: with SMTP id m1mr43063368pfb.204.1571196826774; Tue, 15 Oct 2019 20:33:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1571196826; cv=none; d=google.com; s=arc-20160816; b=zb7NwqMerFNRgdia9uwKPPwrnwdHx/OH4sByJG1qmdo+5NuApfmH72Ufe14P9cu+zP NXXnyTsmDXeXDuhnHnVyrube5b0sF1+E6XUF2Rs9sqXd2KeBmEBvb1cWWSun2J7M7IEQ m8mfSlvhjcBk18djA0TlhqWjf7Qh/QCRwEyoy444utbS+Yrk7JyIL7OrC93GzHBS0lZ5 n4dmib8k+bnnz3O4HTBwu7xgHbKb0gWhuwf/wGGfQJynbRC7TBuM3qwgzE0U93kUvxCL p3p4Hr6IU6Y2nqqqj0DfAcupy3IBssDtguM6JYNGSbcM9Gclx4cBn+TPYeYwO7L+ut8i 6AWA== 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=OkBk5IEgIqUy9PUsnJfQBiIpMyF3gMIzPVha8ttS53a9Vfw3kZVGXI97ZVO7kEGjHw JodCxFI2ePR9Q8DX4s9bnk7DFv1kDihrkNbHQFQxqBsTap2kLlVaN+r4hU7C/gzQt189 PoeDaQ6q7jx4GGYxHZGkXRXUlYDXcVMfW86THdedyHu2CZFnKYv/epZH9PnTuY+aNbgy 0zL8pNTBD1/GfXZZjP9I80nvjdwT5N7U8M497jVEW1FmygtJviGzop08DnhIe59p8Ivo on/mSHi0vGXZYoRyi5Nk+eIPTBYCptd/sdd3Bg+Ehq3Bk4pqL1q0uaKYLJ2BGtKu60pf OwNA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=lGAST+mY; 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 q138sor26048165pfc.41.2019.10.15.20.33.46 for (Google Transport Security); Tue, 15 Oct 2019 20:33:46 -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=lGAST+mY; 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=lGAST+mYnUw2+fFUvOyyVN68vAR+ZDOyy8WoR3kjWo+W2+qfO342xlBSDzAujCE92W xE0pXYq5oYJMudqdUUTFcA4aWTLpzR+HCUmB2mLqubMM06EZSAOSYJjIUw4X7hTl3wuZ nuUIgEUQvBCjVCKdCz7w+QZpLjGw9uKQAXLeecMbO1I9Jv6BXS5VvWMhSILKzjD9zOKQ 13+n9QYnIPx0gCFbGdo1DDHBdarXxErH5EaN8Pyqbtxwar/4fbU5+fiWPJ2fPmqi1oJM +YU3v3GRs0ICUUyn1sNwz9LHFqOGijZHx5d3agCBmyOak2HuwQbcxym7UyWvVtNxdO5H 0a8Q== 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=rKDxWZ4NYlh8HHInpinIQ+hvh1p9bezhmiyKacyTrZGYRbivUq5wi5V/AhfQZ5r4Yk ergOTzKxGtRmMz1+MIn0aMjK2EmcGer6NehEjGg25WiOYdyitSeKEyLpeNeLkDcqytZv 70MeVLb5SJOjiZCKP+HEiUHbMh5QSvOG6ksjYD7R46BAaa5H0kdv47bza0Q5Vui2fraR MsMJLJLitdKOtYLYghDJNgK1BqPSiRBr7K/HsF5JUECruP+5cBW9D7yTdafT6NQPTACY TYQSJFodmanjiSrrOSReIr0NDYNWj4ChFNdyBXqOe2elHE/zI5qzCUwQoWV+qwnVmx7g XbeQ== X-Gm-Message-State: APjAAAXwtCzYng2MuWlmuN/xyxOIh856swibDikax9aOGOdDdqHTIMkJ iiOAdHpNO71vNXdt+A4LujhGxFvc X-Google-Smtp-Source: APXvYqx4mHE3Pk26QZ2wQVQI9bb5Z31XRA2QB6VDKjNpj4Ri/jYSuBD2qTj2kfwGMLGU4KLE6yoqJA== X-Received: by 2002:a63:d457:: with SMTP id i23mr42038764pgj.276.1571196826240; Tue, 15 Oct 2019 20:33:46 -0700 (PDT) Return-Path: Received: from localhost.localdomain ([2601:1c2:680:1319:692:26ff:feda:3a81]) by smtp.gmail.com with ESMTPSA id l23sm748356pjy.12.2019.10.15.20.33.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 15 Oct 2019 20:33:45 -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: [RFC][PATCH v3 02/11] usb: dwc3: Execute GCTL Core Soft Reset while switch modes Date: Wed, 16 Oct 2019 03:33:31 +0000 Message-Id: <20191016033340.1288-3-john.stultz@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20191016033340.1288-1-john.stultz@linaro.org> References: <20191016033340.1288-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 Wed Oct 16 03:33:32 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Stultz X-Patchwork-Id: 176405 Delivered-To: patches@linaro.org Received: by 2002:a92:7e96:0:0:0:0:0 with SMTP id q22csp6783625ill; Tue, 15 Oct 2019 20:33:48 -0700 (PDT) X-Received: by 2002:a17:90a:a891:: with SMTP id h17mr2299766pjq.32.1571196828397; Tue, 15 Oct 2019 20:33:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1571196828; cv=none; d=google.com; s=arc-20160816; b=rE/VODf8G7hh0vJPFCFfw/APwhlnNgmR8qPHIa3QFJYPD1hAfuo5hla89HPyjXDx7u oxJ1CpgwzGjQulsq/s89NDX9oObA5mxws7ZxlSKkWcOJJJoWHym/b9Pm+y8YnUrmbtIj nMuREOBogSWpu6sqGwc274HexFBjY71Cjqo6mBBkdqqHd2xXc5+J0zns44HQw93xF3ly va2VGc+dlKTYovS5JQbunbqnuHBb9BWV13jbsVRcJ/yIGmAwMi2r3C5NHRGPVz7Lp6Sg clH3d44p9LQcCaVvvPE+p38I8ktWhz+ndtzpGU8sHDp7q/9b3Z5RneL1eBKjrshRNMp2 9siA== 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=TxJhm/I+3V5vef5W/56TFusCvF++1045Ndq1HR3V9U00Zku7qqLExfwQJPnISvJDvQ uWDyhpKdLdmzHdeUCNArpHPdyWq1eALrx/c14NsjkgkwcnOTPPZrVhOKk9fyOV0GLx4n gpTwsZJ7ekEHM0WkqTd42AP60+8HKDKwqKCOxmHyXC3hGmwonHSs4yQj+D3tsXX/9/l3 o4TF/P4r/mimAXXXEJ7XTiteGg/rqEte2XIn6UUbajoYEx6j8mIC8XZuGDa/GxydIjuB WkSTuOdmJmCO6CuNWyUwgVPTN+1UVeqVXz80ggx2vKNYmIdF6pwpy3Q4uB4cE8Jbwut3 3k9w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=vPB51r4E; 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 p4sor30062143pli.32.2019.10.15.20.33.48 for (Google Transport Security); Tue, 15 Oct 2019 20:33:48 -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=vPB51r4E; 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=vPB51r4EZ8stXyXSv4G88Vclvyv30hhGw3Tpf379BTU6tuj4TcKIJfGOECfS9HgZxC sOrbB6xhou5OBa2HlB+vuU2WBsw4f/epqpY2AKZc4vX3zf/GGEi7NTWl3NRCe7TWT4xh gWLBrp4TL0Jjk5b9CCugv6PxSzCLRtTIAkR1zEpMsBJX8R06I74CldwORwLPGQGe6qTL HJEJ0mLdHAx4O2EJZm2EdpYqyXc00yPju4FmuoIeGvCO0cyES07xGg+PZECCBEsIKeIj drFgq8KvXV8U7VRXLDSQCSN3+2iDEOUJ+cCsx3GB7nVHoDqZcrH2wKcd/RNABDOj72qN WTCg== 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=mIsxn8fJHR/pwZ6Rj8WagdqPyR7oYAdbugpSp2ImS3yQJhOxAaPdusj+eMHe3/q6cm Wp6DnMUcIDIvMSDPriGMf/xlrYg1qBrJDJ/JwBN2V3t57rKnIjcmdMyQf0aJN7kwC86I evVemhLFyV5SOj9Dk8I2D1nK+6qMp+4u5AdHv456/IuM/m3aqXjPMPjErFV0nDvleHoy AFc7Y40PNjTLGakTQAaU2kCrEkFb1PiO1u3JOsyzx3KSh81TR6/RoSp809aZyXIIlTWT JBhoRAHBpruGbvr+miRxND+k8Ggi0L03XZeT5O6pw0kAPwT7iA/JXk03loHg/jvKALa4 OsSw== X-Gm-Message-State: APjAAAXJ8qmSeeXKhNRBTJ3TiQJTPDccCmGAN9ewyFbVhRzp50L6uc/V 8xs55J3j082Wa1wYtV2j10RsC01F X-Google-Smtp-Source: APXvYqzFCD/6MuKpzLdXxEtnegE2Po5uAh/iIxgZiDEZd0o2kcUaDRjQ4rIow2Sz5ik6Cxtqptfa3w== X-Received: by 2002:a17:902:d691:: with SMTP id v17mr37578925ply.340.1571196827898; Tue, 15 Oct 2019 20:33:47 -0700 (PDT) Return-Path: Received: from localhost.localdomain ([2601:1c2:680:1319:692:26ff:feda:3a81]) by smtp.gmail.com with ESMTPSA id l23sm748356pjy.12.2019.10.15.20.33.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 15 Oct 2019 20:33:47 -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: [RFC][PATCH v3 03/11] usb: dwc3: Increase timeout for CmdAct cleared by device controller Date: Wed, 16 Oct 2019 03:33:32 +0000 Message-Id: <20191016033340.1288-4-john.stultz@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20191016033340.1288-1-john.stultz@linaro.org> References: <20191016033340.1288-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 Wed Oct 16 03:33:33 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Stultz X-Patchwork-Id: 176406 Delivered-To: patches@linaro.org Received: by 2002:a92:7e96:0:0:0:0:0 with SMTP id q22csp6783655ill; Tue, 15 Oct 2019 20:33:50 -0700 (PDT) X-Received: by 2002:a17:902:47:: with SMTP id 65mr38489174pla.81.1571196830183; Tue, 15 Oct 2019 20:33:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1571196830; cv=none; d=google.com; s=arc-20160816; b=tOKvAbbWGvhhrgTjYKqPGJChhSUQ0eF2NJjVM7ZGzcwPbvAuQQkZ6V3oCS0wUila6E 4eFJ79tSL3T16qyuALRyqzzeT8djd/jVqftWyWaYaBh4sEhDlQQhaZeCoYj4wACMcRv5 TgsvFxfhFFbzdsYo19qG9NwjABRBAHyrURnwi4P0fHP87YNcUV4g0SboMqwAFDNUN2DH fpaQOGYf+5g0KRG3ZKSzzSxzUMqWmBfMRipPj2qigZEXFj5vHITQyq958Nb6mgh4G7lm XtOx3WUZOfsgqx/BrQenhUF/oJgf+Rr1Cy0EEVM+kMcDn6iIf/hCWQ26SUUeq2aILoxx 1R1g== 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=Fk56Pt1fGccXmKmQ/Jeo40yXUyiG0Au7sOVELWBpmSc=; b=mTBXxIGdwG7w/824en7V4fR1Y7J+79RIGDyCzRqHDk+858K+5O4gAgksPd1lTMS8Tr XSXHs3T/4r+Ta751udTl/QFJLaadrfWr2evqO42mxpJafrsfsd8i7QYac/smzVrmb6H2 gGMQ1JB9AI8qO2L0rByZw1bUfC3yFStQhf6GHWB8zPodCMO5h0VKCf90jpgmF2d9ZtK0 2tuNMpWQNFkiwf04QwvuwYTCOyTxpaD6m9yLTfamTqP0tMYRarpN0tSrjIPe6NrfYmoR Ydj2OQjmnr3rOehApAz8SFMTReP8LXZR0Eain/Rkonf1kYpOTMxBXUVkEuJYUJX8hF+Y e/dA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=i5842S39; 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 w8sor25585634pfi.51.2019.10.15.20.33.50 for (Google Transport Security); Tue, 15 Oct 2019 20:33:50 -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=i5842S39; 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=Fk56Pt1fGccXmKmQ/Jeo40yXUyiG0Au7sOVELWBpmSc=; b=i5842S39DyNZjUZRJPov05KdX7BzPpP2NUVj577HofBXaFkmDioGcqwLERfGPCtRSo HxrufDjWomrDtclywcgyQlD/y+bxJRLcjN9o9sAc0492h3Sqk9lgZvAl3G9PDq4gU/Hq T8lEnvqFyCrhZWZLbPGC3IBEqFDHD0vSeAJP6CJMI6TeFEXj9lHjQ1gMcXvUshJNlSbV hQlwzNfdpEc8o1zpF4j8MeUNFET0RjQc3rMX03QpqyJyDqQ3SaEPhKKI+dAYa8HCcRdh 3kR7U+p+H01mWN3lCCwYydpOV9lAS3XXzH9hxXY97aQyeg0idEeovmkH84X+Db9lycVc albw== 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=Fk56Pt1fGccXmKmQ/Jeo40yXUyiG0Au7sOVELWBpmSc=; b=iobixBsxImHKa4cwhTW9L9zAK0nGGAkKP9A8DCEdsF3TmO8KBRJvGjPd2ai67mIZEK mS3fHCH4w0DP6DdQQ32BlSEIthhB8FpJgprb9SSfjqUdbtGVhxHMtZ7xjbicPrDEABrQ zVHEkJ816qpg+88tppJbYXtCx+wFMqCrYA0iV3xVDcm/r80jwNa1Pqbg90RoM1WtAaI8 yJHFKGJHEM03OuRKU5FwSv3EIV1T8FYNkW4XrAlAPoQ00YXqB3HK7b36XkTx2ScOHMaw 1/Yx6krMpaVmJKnV9LxGkXvTA/3F8SHZO18fmVXr63hENRkj+sxwmxzMKz1+r1J+ELt9 OYAg== X-Gm-Message-State: APjAAAX6ZS/waP3bqzyfM+ITi/kkxhZq45MOmGK2QJ7ZriSeM49UuLfQ bhOhlX7q1+krbI8w8rwMmfsutKuwy9CDaw== X-Google-Smtp-Source: APXvYqyDkJPdQQMUkmfGn1srI4a3vVQ3+fGtZ+xRSHgsO+5CqQbLMJGruDMef6xeBYAvO7XFUOWfqg== X-Received: by 2002:aa7:8046:: with SMTP id y6mr42224599pfm.178.1571196829644; Tue, 15 Oct 2019 20:33:49 -0700 (PDT) Return-Path: Received: from localhost.localdomain ([2601:1c2:680:1319:692:26ff:feda:3a81]) by smtp.gmail.com with ESMTPSA id l23sm748356pjy.12.2019.10.15.20.33.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 15 Oct 2019 20:33:48 -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: [RFC][PATCH v3 04/11] dt-bindings: usb: dwc3: Allow clock list & resets to be more flexible Date: Wed, 16 Oct 2019 03:33:33 +0000 Message-Id: <20191016033340.1288-5-john.stultz@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20191016033340.1288-1-john.stultz@linaro.org> References: <20191016033340.1288-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 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 Wed Oct 16 03:33:34 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Stultz X-Patchwork-Id: 176413 Delivered-To: patches@linaro.org Received: by 2002:a92:7e96:0:0:0:0:0 with SMTP id q22csp6783684ill; Tue, 15 Oct 2019 20:33:51 -0700 (PDT) X-Received: by 2002:a65:67c8:: with SMTP id b8mr29676810pgs.121.1571196831508; Tue, 15 Oct 2019 20:33:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1571196831; cv=none; d=google.com; s=arc-20160816; b=U2LGcyzJdnFExAc+MMmkn5VgI94FLs/wOBnZuC6WYR7TqhdcZlDhhL6qEU5dEXNf6L /6Hl6vbn/JZpI8KrbUa0LLxHmuAsbbK8lhfUVXNRiYDV2jCo7pS1ibFHu2KlMLwYupRn xP8DPPaIWtTUq/f7aGGdSFvo6+sswPPSco8QAYQE+bfHsZNHmzqox0c34xGFk+EMuY2m h2WiCzHpgOLJRnjDuwOYjPiLXxiGofNxt/5NUeHAGt6uWDqJmo5bM47mGG8RGZtcdSLr qYvgDaDgb0HhqaSl31erCtTAjjME/gqz66onsNjlBZOtCD46ShqXxj9lmaUdJicu9Jh/ HC7w== 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=mmGMZQlCR6mgA59oWS1f2Nk927cLgLJYDtngM3i0DmQ=; b=gQDJ5PVPf2PAV78qtKMjvVJA8vzDJ2aiShgooct8uvFKkCp93+CJYwMFfRVqeGXStS Ys43wz5dKrjC9W8S3ag8Ai5sdKlq/8pw2eYnrAp7RpeUCGWnUykL7IbBhACBAuyTtfNq 3DAmDiskxfXbDtW+LKvFjgFyejLUy8G+fklr8UCc62kga1seAmjFKyLiFa9DoMwLvktO 3vDJORtvUO35DhduQSUPrHupnCNGsUnifhx7VLbraWSaZrUzz022QKoCrcGnH/xPcSrK aZuIlwenCCoUnDk7e1V2VDW5MsK7PSdrKLO7ApjHT3FAHEIFQKSTMB8p4y7zzr1EHika qsFQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="uLkbH/AL"; 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 i12sor25889978pfk.45.2019.10.15.20.33.51 for (Google Transport Security); Tue, 15 Oct 2019 20:33:51 -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="uLkbH/AL"; 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=mmGMZQlCR6mgA59oWS1f2Nk927cLgLJYDtngM3i0DmQ=; b=uLkbH/AL8pOg7wAkq783Kv7Wli+S4S1fkwXvQK1hsdZz8RMDlTmkhaDVpBDw/mkoO4 zBTWunDgn6kC1ewqFmgahk4sa4DL54pMRwCKWKiTye44tvTXsqTp6tTiQkBUQj9ZE7WX GFlecPGJ8qg9BS/QnlLtz2ltiSGv/DD9h60Nk3yaik8zidbbaF1cr9PvCiBb3MgexH43 QqgoYOBBbb1zOJvedENxG6asKQFB/TzSZAY/z04OpFQSmYX6mevmQD1DMHMmEQbMZkNW uW8J/Od3UKmRiRZSjx5lUM8HYObGLRFjd7aVMByq0wV3Rc+Qi/ZvxrF44OpKP2tjyR0R 0vhw== 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=mmGMZQlCR6mgA59oWS1f2Nk927cLgLJYDtngM3i0DmQ=; b=JsfE48STNSmq1TumDSnay0xgOo97mX2VkhPlF2zxRBwr+JPH8CVNaJ5vw1x3EbM17b E01tSAHZU4amQQncFdpg/t7X4VoO3A+fnbUh6c52fHdDaKxrN9MYOJH0O+4IX369ieWP okNGd5o5FRboKllwFEAH+kY3g7A3+44PvXP94wdITeQ3rlH2d9XuvD1MZhnE34g5Bf1o 1I3rk8917CXiWnC3UsxB6BW4z0d8ZzCtw/nPvb1oZ9dUEw8iJTagg6H14Kdi41B98hTN 3kGMPRQpMM9NnNcGr/zI4m2F79ZbDHX2V/Fi/C7lc0ox4Ht0u0BdxifEf0cw0d7PiUnB v7Gg== X-Gm-Message-State: APjAAAWIJoD+cEMCfGyYYKGM8D3Q8B9dXn1Tdp++ZgX4MAcTVFFZCsKi yAm5v3sPY1UdegFa9DZCcMD2eyRr X-Google-Smtp-Source: APXvYqws+YMGIIyJ9Z71j/JJfgVn5iU2tJXSMhO0gdaPFucclq53zCDhmjLlxCTNhG2oSTVllo97hA== X-Received: by 2002:a62:e206:: with SMTP id a6mr42231705pfi.64.1571196830986; Tue, 15 Oct 2019 20:33:50 -0700 (PDT) Return-Path: Received: from localhost.localdomain ([2601:1c2:680:1319:692:26ff:feda:3a81]) by smtp.gmail.com with ESMTPSA id l23sm748356pjy.12.2019.10.15.20.33.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 15 Oct 2019 20:33:50 -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: [RFC][PATCH v3 05/11] usb: dwc3: Rework clock initialization to be more flexible Date: Wed, 16 Oct 2019 03:33:34 +0000 Message-Id: <20191016033340.1288-6-john.stultz@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20191016033340.1288-1-john.stultz@linaro.org> References: <20191016033340.1288-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 Wed Oct 16 03:33:35 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Stultz X-Patchwork-Id: 176407 Delivered-To: patches@linaro.org Received: by 2002:a92:7e96:0:0:0:0:0 with SMTP id q22csp6783707ill; Tue, 15 Oct 2019 20:33:53 -0700 (PDT) X-Received: by 2002:a17:90a:9f81:: with SMTP id o1mr2264344pjp.60.1571196833059; Tue, 15 Oct 2019 20:33:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1571196833; cv=none; d=google.com; s=arc-20160816; b=fZS5jTNxxOOLVpdtD8Qqr3424c49458nZrRd/WchTW8QQY7+UoJ351GmR/WqpaEVDx rJ3P7aIvxMak7s0Pj46GP0VjEF8lAIrDKfcEW/uftz031ZTqlYl2cX3DXxjxbTtZB/Hw W9M/18XgAlbq3cYINdalpTBZ+0DySX9bISHBYJYc1bagykwcwbX3ZRAlimdHR/Pf1CoX PLGourmCGq1Bhblr6HmYDGX1oMMyCocjRMONdtWzZOp+TARFqYuhdB4qZcBXYbzvw7CI 6WWGPWJsT8nE6RmNyQbKSgX4wq+JQASHP86xnfKvrowmILuHxsjuNof66pIakIk0hmoj mMgA== 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=XYmCRZgf8b2IcaP7U8709/cAdbizYn9CNcdmOHw1lAQ=; b=EmaJgyudkzUdkgBrkqujiwP5kvn75BqtC+z0gcYzX1RIVqTlGbhDVM6qQuBqurL8U/ gBRzPOvNk38+AOCvx2yBUeQUlZXSR6AFCWotN+uIwTQ+6X/UhcZ5QEuAQiNsbuHa6SmW OGMmXXhg88SlFd0utzBqV39tm0B8ibrdYoss74qHX+LcUtKdFHmINDlWiEOhzmAIVbeU JtSHSSGKuV7B1rqrHjE/JXc0EwZYoqCc6fKvhqTDx150w9OLaLqQVp6bI3tw2zNMQI/B LzF0pS9RIS2TFKi+JHsQ3EpbOeetqmSUDpc2gAw2Cwcsm8D96ATsvMgpq1BQThGab4VK YJAQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=M+j3OSTd; 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 z9sor29984681pln.70.2019.10.15.20.33.52 for (Google Transport Security); Tue, 15 Oct 2019 20:33:53 -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=M+j3OSTd; 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=XYmCRZgf8b2IcaP7U8709/cAdbizYn9CNcdmOHw1lAQ=; b=M+j3OSTd6OWlEcLeVpxIyqrceKfn8UXv80YolW6qvBqb5QXn0w1KjA3liz7wZvvEPE 2jK1cjfZbCKO8KDuKnvDQSgiagX/xGJbc7M3TJeUvCEhRvnvCmaM3oJ+CzoqDax+5nDM QhYddsNAxjU+dLqhpM1jwvYZ8hXoy1hMpKir6wed8XX+ayBTHSnLwfyIamo33p9a1xp2 PAFkXAZ1JRCrng+9VkPVr1NmtmNHaKLd8mlCKTBqHOgBYVb6XVr8pEhba5xWk52mw9+8 cSsq/uXaMZ29Xuo+Uq8QcmxDRCg2hc4P7CPQKjNqb4foAoUmOCclW3wtYJbBM6L5tf0X OSTA== 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=XYmCRZgf8b2IcaP7U8709/cAdbizYn9CNcdmOHw1lAQ=; b=jqcV36lnWajBVdku7qkBn/2eBebLZ670UbibdHqcQ5wWoRvWKamhITxcFD9/SbK1aU Q/HcCjEEyMPhlC/tRhWpLuj9q0u0xY57YvRnqsF97q9GeTCKjCPRMul0iEBAPZ7RGRRC DnDBmLJ1qbAtt1LjN3jwAtKMEDRpXFjV3kXVTytkH/BhzUatIdmEgW5maQsqX4qB+TMU mqXdwBjKtfOq5rlIiQ1cnGZJ1tDzGWm4q1HoGCF1zTN6O8jDcShvxgFPHj4tr98MuZli YkTAzpf23dcv4eYxxm/X6JXCzbzKHVvy+nONjWxafg+n6awoH/6WkCHYLTo+qgM+dmla lumA== X-Gm-Message-State: APjAAAV097WwRK9DgiKVh2TOxQR/LYMV7iyJMbDxIASsO44uZ++2QKTS I6zt3aw46tte8KygiIDtNE5km6vA X-Google-Smtp-Source: APXvYqwtJMHOOIbFTp5wm3D/o0iQ0CChhCx+w+5i1GrQwEE/EFW7imOCSKYWaKsUoO/zz8QDQxMKfA== X-Received: by 2002:a17:902:a605:: with SMTP id u5mr37825346plq.140.1571196832574; Tue, 15 Oct 2019 20:33:52 -0700 (PDT) Return-Path: Received: from localhost.localdomain ([2601:1c2:680:1319:692:26ff:feda:3a81]) by smtp.gmail.com with ESMTPSA id l23sm748356pjy.12.2019.10.15.20.33.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 15 Oct 2019 20:33:51 -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: [RFC][PATCH v3 06/11] usb: dwc3: Rework resets initialization to be more flexible Date: Wed, 16 Oct 2019 03:33:35 +0000 Message-Id: <20191016033340.1288-7-john.stultz@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20191016033340.1288-1-john.stultz@linaro.org> References: <20191016033340.1288-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 Wed Oct 16 03:33:36 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Stultz X-Patchwork-Id: 176408 Delivered-To: patches@linaro.org Received: by 2002:a92:7e96:0:0:0:0:0 with SMTP id q22csp6783726ill; Tue, 15 Oct 2019 20:33:54 -0700 (PDT) X-Received: by 2002:a63:4e52:: with SMTP id o18mr27900705pgl.153.1571196834742; Tue, 15 Oct 2019 20:33:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1571196834; cv=none; d=google.com; s=arc-20160816; b=CrGs3O8O4ffKK5j+53+vjn1CTON7HmDgaC/ePHgrBcwpIrFGggtKFFtOWlKloFhy0R UTdtZhrdUYi7hvO1s6m1gmSV8qW3aU74LUihyYiUr5arGDspU27Ndu5UXkvP9Wya7fJ7 TpQmXawKUHAP52EbozB/FYrM4Ovl95fimo8qQbs7H7YmsGdC+22ywBiwSbxrREXByhPG r+50mhKHBoROzhe47zWL0PMTTxEvXsBMBRlCsiL1GQ4BWSJ8db+T4iMMjzWN/ONIDGzh kDeAWV9AoJIbWHLosERtwNhEdRr/t974uwUy1W0m4mIe2hkbPG5OnARWYDcvLZd73Dta iDhw== 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=rYj+MmiPRW5CycPqSf3m0f+fKCh/fR+CfA1sYfj6d8byn1/sNmHAt//Z0giDKFPRfC A7807AYEGYTO/ogrVgESnBBej7pIhbLpCAkMpi/nJgTzwkEEL6c6e940Ff3uIG91pQh/ MyY/w+MDjJT5IZCqrv0czmbmBNQay7W3QFqWmLlZbvmEPLMcXXnH7xGQiD/jofyp1vxt TKkOAJp3yAxO6NF27hMvkv11bMxQ6J0dRMrDky6Q/QFpTfaODggYEbDFpaLkH8EQssXK g4UhpU9GhtI7IqzaMTJLizZ00MtEkokhoMtrMhhrJtNrMp0cStSo9MOq4cf5Fs+Ssftv URRw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="u9L/pE1C"; 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 i1sor667006pfe.8.2019.10.15.20.33.54 for (Google Transport Security); Tue, 15 Oct 2019 20:33:54 -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="u9L/pE1C"; 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=u9L/pE1CJ4s0MCM+ENSOrn5WX8ACrKw+f7H+culvO6PxC99AEUEIDqUc/Od//7F4ux NGKoaw5O875g7vF+TdHz5jOtu/6ZqGT/u9eVpntdnCTT247RwTDWquw2hdvSCV+fBi1V m7ETBCC7pz06d+d+CYF7H/t97DpuXf3fs4XAntVl56c3A9yJOyJQ7AmCA1cdxAs/PqEq i9JwY1zgFvlchdZKDy82Wn/K4HljT0F70ysZwFzhzmhzYxoC2a7ppnxV/j3m3sWF+toz AaM2eMUwXZBux98pSL0V4XInnIoMgsw7qVjNKuwWmC2PUBfCABDddSm/pvOPJpHR+aZz VQEA== 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=miJ0RsHKPYyNG9ZEnk48YhJ6pOag3foNYDtoHwCQCaToD0ps9nza9RhOt9FI/iwDOP RFRQSC2xhLN4Cf7/Wtyny/wYTXUtbR4+FAPJjn+nUnBlRQ3SqG4pJ7Lj1/q/VS59RHEh 76hBxq8nbkKuGU50VGvscr9P3+L0t+CO9bLO/uFvT57SDYU4oAs3mIAf0MGCIm1+ByRv Tn71VSD1mRQQvNejNtZi2ELVcLHQk3lCaN8eaht5jZU1qKfzhX1551CPlJYdMvQv+6/i prdXqf4Hl4roceijNuRoOGKhV0B3Jp5aQ19zsebkuAoGy2x9Jwzho/ljehSP3nJUUEvC DSMw== X-Gm-Message-State: APjAAAW3qNXiargomAa0Y7sz+eckeYNRMZ2L27Mvc4ajF4VsA1PI+IoC bmIVDCGkFu6hoRVFLn+i/dFf65f5 X-Google-Smtp-Source: APXvYqwm2S497WA37OpvJu48WtPFC2QRdjOTLBX6kJACVlFLFjKUX/3rNVLnjoD4Lp5ERBCkjIvLaQ== X-Received: by 2002:aa7:8e47:: with SMTP id d7mr11104425pfr.125.1571196834268; Tue, 15 Oct 2019 20:33:54 -0700 (PDT) Return-Path: Received: from localhost.localdomain ([2601:1c2:680:1319:692:26ff:feda:3a81]) by smtp.gmail.com with ESMTPSA id l23sm748356pjy.12.2019.10.15.20.33.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 15 Oct 2019 20:33:53 -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: [RFC][PATCH v3 07/11] usb: dwc3: Registering a role switch in the DRD code. Date: Wed, 16 Oct 2019 03:33:36 +0000 Message-Id: <20191016033340.1288-8-john.stultz@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20191016033340.1288-1-john.stultz@linaro.org> References: <20191016033340.1288-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 Wed Oct 16 03:33:37 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Stultz X-Patchwork-Id: 176409 Delivered-To: patches@linaro.org Received: by 2002:a92:7e96:0:0:0:0:0 with SMTP id q22csp6783749ill; Tue, 15 Oct 2019 20:33:56 -0700 (PDT) X-Received: by 2002:a17:90a:a401:: with SMTP id y1mr2286646pjp.118.1571196836254; Tue, 15 Oct 2019 20:33:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1571196836; cv=none; d=google.com; s=arc-20160816; b=f+f2ZimhBoB7II0ijALvMWIkUuCAkrp5ly7BE4+92qZpDWn8o5T8Cz1fb+DfoN/f9r km7XAODCWDBgfzoRx/8OkPFASgdFc3wbQtSEGyM6WQQPdqtEDtDMgSXgmlU1GqyQCmij GEfHodD6/orBeBJzemCyoto3Ktt/vaSw8oS2RAxG2IOq+2QlPVS37U7qvcyZaodNZN7g T+bq68GlF1IPU4b13dO9n++IxIoRY75XscWP3ELjBXb7N4ze7xGpZXGlYcfmbMVlJeMc WPM1BwCk4kuiKkVBMDnCBS2HQad7xPxEn4gWEDHgqPYsFRJQepoWcu3hJhKYRAjGK1pA o3hA== 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=2keRpRTlNq//agdfEU+WzxjuweOfNeyW5raNbEYcYgw=; b=fYVVkFAIuLNm3Gb6qBcAqqmnXToLCM71gTpWRvsPWW4fbBn7rzivZ8L8blxzFX7ahn Iu2YBQBq42LCZMrrPoA1tZgzcs22YNU7/NDV5DGhEbgzlghCNIMyDzUtK0H6GcSWiAcj PFtTxxeU11E0UtXzNY8GQa62/KJLKjOHKj14VUT0EgYNIKSfHHgX24r1Lo3TJCsNYo8y BFgE8WpB3S+s57+I6oBbHRglzpoa9WqDx/7+OmmNqE58k1WscA881svvMAHBj7Z4Mut0 diOISLYvCR8t7L7lj+uEEuvvwW5zcPPKCA3BIHJuAyipC+h/bTvWUpdF0nF0LYbkdci/ mqYg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=v2mpFWC0; 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 41sor29737419plb.73.2019.10.15.20.33.56 for (Google Transport Security); Tue, 15 Oct 2019 20:33:56 -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=v2mpFWC0; 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=2keRpRTlNq//agdfEU+WzxjuweOfNeyW5raNbEYcYgw=; b=v2mpFWC0YeHuM2R8yAg/xDpZt4YlyYEVb2YKwXwoQsMjqhvV4fsR1Q+zHo3hChIz74 MW6PS7z0+vutQPyCMifBfWFJu7BomzYe3pJZZNJX9fBPaYzen1Y83jxgqRXYBaS7U9H5 scyF2ijATEZVAZbM+jVPL3xBacyxLHMqGCOE2s+vXhdWKMN15J0X1c+Sg2O7EyOWXzvH V52YtiHaU85DASd1pNaSNMJRInWisTGPtptGEwmH6o7Nnegid13neEpqqP3dKTUMjQnJ tvTz2rC2F9gEnOwqvQdfEPwBq0sMvAzaAjD+WU5GOr/0YMnusEvDyJFkLqPqltkOQGC4 Vz+w== 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=2keRpRTlNq//agdfEU+WzxjuweOfNeyW5raNbEYcYgw=; b=VgeshD5axnenXUdVncncHmnTPPGAQ30Dd/WUYzBZwiAn462ZjE4vDsOSf6TTMrzaB7 esfvlVQ2/JgXZJd7das5kXFAAc3yfoyHwoj9wJLn8xsX2o0NGVhBMpmt78zDacJ/D6Td X173DB5rr17uGtoqTm8Pjcnkjv8Ncwnfwa4iEM3E5UO9e5en7P5mLYnAWu+W2Lt8zzCv 8jdmB5EKY5lOoA1cJXA3SUGrT2gFAVXKYXdUMfI01b94nrGZkqYqLM/h1If0DToKQXb9 nSMksYAlyGNEjsDWDubEykjjL0smWN/j1E01NopkGaFmHHJlw1YLPostT59GckYEQizf x82Q== X-Gm-Message-State: APjAAAWGsmMe3H/sqLddQeB1bJ4kI7dWP6BY8x2kCLuMxS+1bwh/jqoq AJ8ZESXdtuCuRUx0CmK8hM++qmFX X-Google-Smtp-Source: APXvYqzHJcZTagsu+7PgWeGgCQGg5oFBlQy68utODPD6pCC+Bv83uRYHQVAk7xRaFQ4dZKLhn4gl5g== X-Received: by 2002:a17:902:7891:: with SMTP id q17mr15072798pll.241.1571196835824; Tue, 15 Oct 2019 20:33:55 -0700 (PDT) Return-Path: Received: from localhost.localdomain ([2601:1c2:680:1319:692:26ff:feda:3a81]) by smtp.gmail.com with ESMTPSA id l23sm748356pjy.12.2019.10.15.20.33.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 15 Oct 2019 20:33:55 -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: [RFC][PATCH v3 08/11] dt-bindings: usb: generic: Add role-switch-default-host binding Date: Wed, 16 Oct 2019 03:33:37 +0000 Message-Id: <20191016033340.1288-9-john.stultz@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20191016033340.1288-1-john.stultz@linaro.org> References: <20191016033340.1288-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 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 Wed Oct 16 03:33:38 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Stultz X-Patchwork-Id: 176410 Delivered-To: patches@linaro.org Received: by 2002:a92:7e96:0:0:0:0:0 with SMTP id q22csp6783778ill; Tue, 15 Oct 2019 20:33:57 -0700 (PDT) X-Received: by 2002:a62:1953:: with SMTP id 80mr42616898pfz.168.1571196837913; Tue, 15 Oct 2019 20:33:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1571196837; cv=none; d=google.com; s=arc-20160816; b=OVeQ4a9j1hcZwodw86ine7/BU0ZMNY0D7d6F0ZY3x91mxrB/rA4LBib7tGeMN8gzQM AFDTc3SELwtXzgrk9SBrk2XrvHU6VbvVFDkgATj0/7QnIw1AYnUcu/j9/WJK99wvmkIv Ki/cvX47uvE1M/4hGEsJq2+/atctqzqykHWqgnA22aTqT9e7vnhRVq8wy6z9wLJYIm+P eLbWGYJ+3y99vo/M+K4Mt0pjkFgpkQfMkbvAIy6NC0xOj+/vaXlfWHPhfpAqdQQyjzKm mt/STeJviZ9CyRi/PYfEOGA0SsSSfUJDUARhKrQ62VT7hhGmRimcs3xi5b+NkWAfzmg8 YI8g== 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=Rn8usM+XE5+lxoRld5YsiT5MurP3HVz0DdwAtA7K0jkUCJ1KXkdKnk9+VnImRm3CX9 zWl2H2EhovHqs/9GFRzOei38XbM/2rD5w3LCD45qefpLtzGt/SeYdTmUxf3swylC5kjC KTGtlzTu21qRXkjTO9x5AXp9/mLUNHQCEXxkiiZiTCSkQzX3SMeGzAPglk8MLsVrtW56 hEaDgmnf1W8SHsNiq3RwpE1c4ghdexZ63E22IVYfP2z/th4wwMZXWutXNzs5Cy4BUUCw hwGLYMUWWx2XQNS1pr9KunZx3cISjuMiQOmrou2lQKcu6OMNwdE84IXxTgUwF/z+Kq2b ljPg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=S8QPNSs9; 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 u5sor30068672plz.40.2019.10.15.20.33.57 for (Google Transport Security); Tue, 15 Oct 2019 20:33:57 -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=S8QPNSs9; 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=S8QPNSs9adnyu7KEv9w2knTdoCT6Ms5rsg3c0ffAASNps2kXgSHXVyQ2mcSTBv21pX HpiPueBop6ANtnLDdDM219VIxyxIDzV1XIyQLdIlsn6H7kpXN08T4H2t6Rv5Y8ZDk7Qk aWEu4HWD6MZj/ZsgBOepxlViw6srTSWs4q/Myt8R5fJJeqDVHBoUhKafpkTSWkUOAqkv VRvYg/3dGEpUstTHwXoxRrGl5n+Oy7pbRQfziY29IchEfUJjKeaQY8viJhlbdeIqprsl Kpr+296Mg3oNMAwBKtzRlp2kndkIL+mCifQBnCMWIPjvIFMe0I1ZgkomiHsoALoX5zfh Unuw== 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=cS6wbQPCBTgQoma6IUT89btQZvzukSgOvV6pqlffBhpSb0FBNZTaFPTjPs4MIqygUk QP19Egdd+Fw0VbroJ5wEhwv7jrroB0tHs1PsxZcGxEIfnndokZB+QOAav6bEWgRlbneZ stMipjmiICat77ob70nOG5LbuTXsUBa3nw8VTvUloLkqJgL9n9RCAyz8g//zETj4i/6O tiuAmJ4MVqaFs/U3wFvKDltuQ8gm5OHwJGtzOu58EqX7YBF4G/CGhj6o0TY8DH5vomCH 61i3oODCuVt9CuTPzuT4kHYqx0YvUJolzsZzZir5o9VDA0X2t9Au+BvUOP051U4lwuDS zgXA== X-Gm-Message-State: APjAAAUt/ijPBX/nQ/loqr8zXPWvue6LuNTSY/2i4yNYhN9sDZWImbci VCDXIZyWAUvwJ0hry4QuTrZuz/hU X-Google-Smtp-Source: APXvYqzppbYL+EYic/A6NgNFl9sC0kKMhtR0UaCTPvDBIK3mJX+2b+D+VGulj/UhBdNR+k2Qm9/DSA== X-Received: by 2002:a17:902:322:: with SMTP id 31mr36939961pld.162.1571196837356; Tue, 15 Oct 2019 20:33:57 -0700 (PDT) Return-Path: Received: from localhost.localdomain ([2601:1c2:680:1319:692:26ff:feda:3a81]) by smtp.gmail.com with ESMTPSA id l23sm748356pjy.12.2019.10.15.20.33.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 15 Oct 2019 20:33:56 -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: [RFC][PATCH v3 09/11] usb: dwc3: Add host-mode as default support Date: Wed, 16 Oct 2019 03:33:38 +0000 Message-Id: <20191016033340.1288-10-john.stultz@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20191016033340.1288-1-john.stultz@linaro.org> References: <20191016033340.1288-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; From patchwork Wed Oct 16 03:33:39 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Stultz X-Patchwork-Id: 176411 Delivered-To: patches@linaro.org Received: by 2002:a92:7e96:0:0:0:0:0 with SMTP id q22csp6783793ill; Tue, 15 Oct 2019 20:33:59 -0700 (PDT) X-Received: by 2002:a63:4654:: with SMTP id v20mr43002939pgk.11.1571196839649; Tue, 15 Oct 2019 20:33:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1571196839; cv=none; d=google.com; s=arc-20160816; b=IBN884X0Coe7uBi7h1j832ehl7opSiS5czEy7bAsrmOyjz8Iu55i9A94NJvMYa8Cr6 CGr/AvHK9sDvpTMBOQ/7eJi1yyyI7rbvEwyV2uFkmKKj76YxU4zGTAY/QqxyBgczIaQF 2fwuJ9LE3YPP5g48OvlM6LPxKG1ng9Wzoe3yC0Aem4rAyxSxT3IjB+vOECUU4tqwY47X CO5G0zjMu+p30+0EgtY7eqllxhH3C3ROsk6PaZkSy3LUXOe9QCYbi7fRNntdVkYYRVif NmoO8t3+jE8F3e0VxKmlPuITG0GPc2ZNThJHSgqVVE8G/o1QvIGJx2ag12F9PGHbCIoN OUqQ== 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=g5sQMXSMdWuSqvmdQD58X3h1zk5SjaH8Y+Tanu+qv7s=; b=Wke+NjEz8FoOTsPwoXt2AzFynu2b741mv0CZXfJmML91HGV3GRwlDRMXOUHiAHL861 hkfFvJHW6w3tAroLYtovmlB3L10jt92+zf8AiD7JxjkZufGxaETjLzE14iknEvE0Y8A9 AiWx/uwmiAUOf/V811pe/0Vlq8Zm611QyxG5tmk8uDYNxxH+r0rGY3qLPC0+hwR6Sugq OCwYTta7w0xgpEarTwNFIKZDBT06RVEv5nE9FK0571D3YeThKCtjnipabJyqyz2de3J0 g7gwZiXoebsx4z2FT/bkeCq+mmXuZ3jyooXpA3G/DM6LGwJpnuuTpKczqYF/b4WHYtTu IZfA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=xYd2AltO; 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 i2sor25974567pfd.16.2019.10.15.20.33.59 for (Google Transport Security); Tue, 15 Oct 2019 20:33:59 -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=xYd2AltO; 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=g5sQMXSMdWuSqvmdQD58X3h1zk5SjaH8Y+Tanu+qv7s=; b=xYd2AltOxj3y/Ve5vEQPkHNfpCqVzUI4h1Hkf4GwUtrRjBAR3I8+P5vvRXlAMF+VIj lOAoFNsMsXMtTUfsDZmToG3ETzPD4KKFUT+JgO5tIITA5efcDQc7e5ADqNqyf7OnBFo7 8Trebi8naNe9Hrv3Wf8lzKTYnqJv/rBY0PwLAhpC6iOmx5HUgiovPLa/tEUg7wBG1iiu Q4aJv6u02XbtnyN0bEGS6bXVcn/wWy9ewpbWtyWcud7BrGvhVM2CKEdrJqo9/fTpDlwd D7Bhmm6SQvPwc6Wi0UibcLOg/tqbRtIh9CqaWfWS63sbVEk2I4v0MryE86bkFYVz1Ud6 CcrA== 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=g5sQMXSMdWuSqvmdQD58X3h1zk5SjaH8Y+Tanu+qv7s=; b=VWpB8DnBl2msSZ7AwD1U93HxOboVRu+BhrwAscg6pPKfOxAGwDKI2/KKOWjVS29Gvd zUzo8NcJHF1Qt+MH4TtyQa3BxuYCm2Jex9LxL/ufJy8uxt/1kqOrCWKBju7zajVaAcGg 8BfSxdn0Crd46Udkh5Ormly8mhiKIVOaN4MZn7UspOrxWDMkZXyB82TfsLZELCOtQl/J bDpXhDwegTTSAxxosEC6ecTm/EFKfTGHd/kY0nsaY3QLJQLqseboLG+FwS49F9/5yAC/ zbOj9+ZwvWk17/ByJJmKgZBcRuCxBsB3UfYXxTR5MC46ki6RdoNKnU7PnlmVqYMBeLgw vbsQ== X-Gm-Message-State: APjAAAWPxf0PV1c3zKJ7GPTWfoj+2qaym8N88qJrMhb5qsgh8GO1Vu9D wZDFnWp5Io2kUcGZtmqYyohafBd/ X-Google-Smtp-Source: APXvYqxdFeMofjrhcmy13r5JUspDNYDwqOMXH2WgRGuNbN+bj9FrOOgg9uXV3EB0TMfrXMdil541Aw== X-Received: by 2002:aa7:908b:: with SMTP id i11mr42817988pfa.186.1571196839121; Tue, 15 Oct 2019 20:33:59 -0700 (PDT) Return-Path: Received: from localhost.localdomain ([2601:1c2:680:1319:692:26ff:feda:3a81]) by smtp.gmail.com with ESMTPSA id l23sm748356pjy.12.2019.10.15.20.33.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 15 Oct 2019 20:33:58 -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: [RFC][PATCH v3 10/11] dt-bindings: misc: Add bindings for HiSilicon usb hub and data role switch functionality on HiKey960 Date: Wed, 16 Oct 2019 03:33:39 +0000 Message-Id: <20191016033340.1288-11-john.stultz@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20191016033340.1288-1-john.stultz@linaro.org> References: <20191016033340.1288-1-john.stultz@linaro.org> From: Yu Chen This patch adds binding documentation to support usb hub and usb data role switch of Hisilicon HiKey960 Board. 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: Reworked as usb-role-switch intermediary --- .../bindings/misc/hisilicon-hikey-usb.txt | 40 +++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 Documentation/devicetree/bindings/misc/hisilicon-hikey-usb.txt -- 2.17.1 diff --git a/Documentation/devicetree/bindings/misc/hisilicon-hikey-usb.txt b/Documentation/devicetree/bindings/misc/hisilicon-hikey-usb.txt new file mode 100644 index 000000000000..1e131b38230d --- /dev/null +++ b/Documentation/devicetree/bindings/misc/hisilicon-hikey-usb.txt @@ -0,0 +1,40 @@ +Support usb hub and usb data role switch of Hisilicon HiKey960 Board. + +----------------------------- + +Required properties: +- compatible: "hisilicon,gpio_hubv1" +- typec-vbus-gpios: gpio to control the vbus of typeC port +- otg-switch-gpios: gpio to switch DP & DM between the hub and typeC port +- hub-vdd33-en-gpios: gpio to enable the power of hub +- pinctrl-names: pin configuration state name ("default") +- pinctrl-0: pinctrl config +- usb-role-switch: flags the driver as a role switch provider +- ports: two endpoints to connect the usb core role switch provider + to the usb-c tcpm driver. + +Example +----- + hisi_hikey_usb: hisi_hikey_usb { + compatible = "hisilicon,gpio_hubv1"; + typec-vbus-gpios = <&gpio25 2 GPIO_ACTIVE_HIGH>; + otg-switch-gpios = <&gpio25 6 GPIO_ACTIVE_HIGH>; + hub-vdd33-en-gpios = <&gpio5 6 GPIO_ACTIVE_HIGH>; + pinctrl-names = "default"; + pinctrl-0 = <&usbhub5734_pmx_func>; + usb-role-switch; + + port { + #address-cells = <1>; + #size-cells = <0>; + + hikey_usb_ep0: endpoint@0 { + reg = <0>; + remote-endpoint = <&dwc3_role_switch>; + }; + hikey_usb_ep1: endpoint@1 { + reg = <1>; + remote-endpoint = <&rt1711h_ep>; + }; + }; + }; From patchwork Wed Oct 16 03:33:40 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Stultz X-Patchwork-Id: 176412 Delivered-To: patches@linaro.org Received: by 2002:a92:7e96:0:0:0:0:0 with SMTP id q22csp6783811ill; Tue, 15 Oct 2019 20:34:01 -0700 (PDT) X-Received: by 2002:a62:e70d:: with SMTP id s13mr42512623pfh.224.1571196841226; Tue, 15 Oct 2019 20:34:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1571196841; cv=none; d=google.com; s=arc-20160816; b=niTZvcYz0VVl4NG0nrakab4MeoANk42DDVPbl/wUd0HM86VjySnlxbo+Vc+x8G3b83 d65pwMlHMw+K2fQVkc5p2fXXWPQOQUIOvJDrCrAqfJT4mIbeda54xhZza2d9oEIQl02G UXp8FpccypzXLHNent509hMrfWcD48EY7BTzRPx7F0Lwd9GzBjJE0mMmh3mM7rurF8qm HH4v8nuRb/RM8vaAwskaChhxQC15eYVIkdk6cB2FXyHzx10dxbA8bXhbFAUBdASZz0V9 UzfOOW5GOmRa+debb1t7323Lop6QMXMAfpafEveiMignsrwCoj9eRlvKIs3gXBlnHsfg NIOA== 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=xagVe9Yqjp30L3CH/AkBbW6XTA2w//rI82PLgD7cLOY=; b=g4pg4uNjbHNc49pfh+X4/SMkrRu7nlwrwuB+ZC3ULgWlRRjeqtR3gzhUkthJzp2BVR Lqs7qwbA4qXtoam3MSgNDrmXFAtu86lxTsLoQ1sLxzeBnu3t6ngbPLRKnswX3hzCL95t NwQB1PZkUxJ8ltuKPoS5vJ8R/yhBbOgWKHSkLiyM9vRlUoN6+WlT/D39fqRcjLjKzZLD UzdnBIgKkb528Deg6hpiuIUIhaRdQYmcx34FAnXS3LAE9nCy+fdJQhnEihP7i5bXpFu5 yDaTyehpN45DSizDKAUqRKcrNHWAqTDMsUmNuWlhyve0Z8IxN4MGizydwWbtULyPStWA lo9A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=FCG3oi+w; 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 i1sor667188pfe.8.2019.10.15.20.34.01 for (Google Transport Security); Tue, 15 Oct 2019 20:34:01 -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=FCG3oi+w; 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=xagVe9Yqjp30L3CH/AkBbW6XTA2w//rI82PLgD7cLOY=; b=FCG3oi+wtp8WuNIu+Mj5Xi6zpckok2804ZhLuVVAM/UPmgGPZgIRNcoZ+FLno8BalL 9xR660aCw9gHCn4sb+789tetZoeFdSJms1H/XxtkX5QccB0ZsTiyzIc5daYbhF6X8FjX h3XndUeWdDaDZCdbOkUyGiAwpjE+e26OxhohCVmIM52DCq6qgZuH89RiHbG16RPMIuoa WxmViHk759exoEZaSWw6hHZut2L7m9+Q5RGVV8sKUC+l+kjNojogq9ZerxqGEMWAfoVK i5DfeGg8sqY8Ayiudd5l2B5+1l2RU+FUpctMXiPgfZbsc3plPulJJyoT+biy3nkerECK 4brg== 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=xagVe9Yqjp30L3CH/AkBbW6XTA2w//rI82PLgD7cLOY=; b=b+BQNX0eH6apH5e3Vev3IziZ5ue2uSGI7X59Ic+SNNC+vUv3LKPaibnQpBiuHRaTsp Xs3qpmAOAkddnT4xuTwG4E4yiPvFghmbjseb7iqSygYwXacOc4BEocQADgRFzpjtgae0 RNDNi5PBsCdOKJIxvQnRLWrfor9eoJK71W4Esn5cDgwIkMvxVyi2y6cw4f+hf3SWTDUx X6NsJMCvoYZiYIHuDScmyqeyzeOFpcFjp8Pi//4AKcXe/M0KrTdMQzlxsAh78/kkPmS5 2ALm3oT2YfUsu4bywNnUpiU1SnqmoORmdMAzeNROBciSyxBSWc0ML7t0iy2G5UTsgc7W mKDA== X-Gm-Message-State: APjAAAXT8A4B3VGVf/rpgqEVBQi+fPMo33jgprYqRU8TVuRIDg5vWBin w35p+Lk7dH0PRT9sXQqmZNFDnW2+ X-Google-Smtp-Source: APXvYqyjznVOrrf/7tKLsDK6LxpZJ0h4ZdLLFiHJOkW6Rcda1DTtbAt+tRl/yGJyszQBRoTNvSQgXA== X-Received: by 2002:a62:ce01:: with SMTP id y1mr2104635pfg.176.1571196840691; Tue, 15 Oct 2019 20:34:00 -0700 (PDT) Return-Path: Received: from localhost.localdomain ([2601:1c2:680:1319:692:26ff:feda:3a81]) by smtp.gmail.com with ESMTPSA id l23sm748356pjy.12.2019.10.15.20.33.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 15 Oct 2019 20:34:00 -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: [RFC][PATCH v3 11/11] misc: hisi_hikey_usb: Driver to support usb functionality of Hikey960 Date: Wed, 16 Oct 2019 03:33:40 +0000 Message-Id: <20191016033340.1288-12-john.stultz@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20191016033340.1288-1-john.stultz@linaro.org> References: <20191016033340.1288-1-john.stultz@linaro.org> From: Yu Chen The HiKey960 has a fairly complex USB configuration due to it needing to support a USB-C port for host/device mode and multiple USB-A ports in host mode using a single USB controller. See schematics here: https://github.com/96boards/documentation/raw/master/consumer/hikey/hikey960/hardware-docs/HiKey960_Schematics.pdf This driver acts as a usb-role-switch intermediary, intercepting the role switch notifications from the tcpm code, and passing them on to the dwc3 core. In doing so, it also controls the onboard hub and power gpios in order to properly route the data lines between the USB-C port and the onboard hub to the USB-A ports. NOTE: It was noted that controlling the TYPEC_VBUS_POWER_OFF and TYPEC_VBUS_POWER_ON values here is not reccomended. I'm looking for a way to remove that bit from the logic here, but wanted to still get feedback on this approach. 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 [jstultz: Major rework to make the driver a usb-role-switch intermediary] Signed-off-by: John Stultz --- v3: * Major rework to make the driver a usb-role-switch intermediary rather then trying to do notifier callbacks from the role switch logic --- drivers/misc/Kconfig | 6 ++ drivers/misc/Makefile | 1 + drivers/misc/hisi_hikey_usb.c | 178 ++++++++++++++++++++++++++++++++++ 3 files changed, 185 insertions(+) create mode 100644 drivers/misc/hisi_hikey_usb.c -- 2.17.1 diff --git a/drivers/misc/Kconfig b/drivers/misc/Kconfig index c55b63750757..bf42d1e234ea 100644 --- a/drivers/misc/Kconfig +++ b/drivers/misc/Kconfig @@ -466,6 +466,12 @@ config PVPANIC a paravirtualized device provided by QEMU; it lets a virtual machine (guest) communicate panic events to the host. +config HISI_HIKEY_USB + tristate "USB functionality of HiSilicon Hikey Platform" + depends on OF && GPIOLIB + help + If you say yes here you get support for usb functionality of HiSilicon Hikey Platform. + source "drivers/misc/c2port/Kconfig" source "drivers/misc/eeprom/Kconfig" source "drivers/misc/cb710/Kconfig" diff --git a/drivers/misc/Makefile b/drivers/misc/Makefile index c1860d35dc7e..e5e85ad0dd57 100644 --- a/drivers/misc/Makefile +++ b/drivers/misc/Makefile @@ -57,3 +57,4 @@ obj-y += cardreader/ obj-$(CONFIG_PVPANIC) += pvpanic.o obj-$(CONFIG_HABANA_AI) += habanalabs/ obj-$(CONFIG_XILINX_SDFEC) += xilinx_sdfec.o +obj-$(CONFIG_HISI_HIKEY_USB) += hisi_hikey_usb.o diff --git a/drivers/misc/hisi_hikey_usb.c b/drivers/misc/hisi_hikey_usb.c new file mode 100644 index 000000000000..32015bc9ccf6 --- /dev/null +++ b/drivers/misc/hisi_hikey_usb.c @@ -0,0 +1,178 @@ +// SPDX-License-Identifier: GPL-2.0 +/* + * Support for usb functionality of Hikey series boards + * based on Hisilicon Kirin Soc. + * + * Copyright (C) 2017-2018 Hilisicon Electronics Co., Ltd. + * http://www.huawei.com + * + * Authors: Yu Chen + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#define DEVICE_DRIVER_NAME "hisi_hikey_usb" + +#define HUB_VBUS_POWER_ON 1 +#define HUB_VBUS_POWER_OFF 0 +#define USB_SWITCH_TO_HUB 1 +#define USB_SWITCH_TO_TYPEC 0 +#define TYPEC_VBUS_POWER_ON 1 +#define TYPEC_VBUS_POWER_OFF 0 + +struct hisi_hikey_usb { + struct gpio_desc *otg_switch; + struct gpio_desc *typec_vbus; + struct gpio_desc *hub_vbus; + + struct usb_role_switch *hub_role_sw; + struct usb_role_switch *dev_role_sw; + struct notifier_block nb; +}; + +static void hub_power_ctrl(struct hisi_hikey_usb *hisi_hikey_usb, int value) +{ + gpiod_set_value_cansleep(hisi_hikey_usb->hub_vbus, value); +} + +static void usb_switch_ctrl(struct hisi_hikey_usb *hisi_hikey_usb, + int switch_to) +{ + gpiod_set_value_cansleep(hisi_hikey_usb->otg_switch, switch_to); +} + +static void usb_typec_power_ctrl(struct hisi_hikey_usb *hisi_hikey_usb, + int value) +{ + gpiod_set_value_cansleep(hisi_hikey_usb->typec_vbus, value); +} + +static int hub_usb_role_switch_set(struct device *dev, enum usb_role role) +{ + struct hisi_hikey_usb *hisi_hikey_usb = dev_get_drvdata(dev); + + if (!hisi_hikey_usb || !hisi_hikey_usb->dev_role_sw) + return -EINVAL; + + switch (role) { + case USB_ROLE_NONE: + usb_typec_power_ctrl(hisi_hikey_usb, TYPEC_VBUS_POWER_OFF); + usb_switch_ctrl(hisi_hikey_usb, USB_SWITCH_TO_HUB); + hub_power_ctrl(hisi_hikey_usb, HUB_VBUS_POWER_ON); + break; + case USB_ROLE_HOST: + hub_power_ctrl(hisi_hikey_usb, HUB_VBUS_POWER_OFF); + usb_switch_ctrl(hisi_hikey_usb, USB_SWITCH_TO_TYPEC); + usb_typec_power_ctrl(hisi_hikey_usb, TYPEC_VBUS_POWER_ON); + break; + case USB_ROLE_DEVICE: + hub_power_ctrl(hisi_hikey_usb, HUB_VBUS_POWER_OFF); + usb_typec_power_ctrl(hisi_hikey_usb, TYPEC_VBUS_POWER_OFF); + usb_switch_ctrl(hisi_hikey_usb, USB_SWITCH_TO_TYPEC); + break; + default: + break; + } + + return usb_role_switch_set_role(hisi_hikey_usb->dev_role_sw, role); +} + +static enum usb_role hub_usb_role_switch_get(struct device *dev) +{ + struct hisi_hikey_usb *hisi_hikey_usb = dev_get_drvdata(dev); + + if (!hisi_hikey_usb || !hisi_hikey_usb->dev_role_sw) + return -EINVAL; + + return usb_role_switch_get_role(hisi_hikey_usb->dev_role_sw); +} + +static int hisi_hikey_usb_probe(struct platform_device *pdev) +{ + struct device *dev = &pdev->dev; + struct hisi_hikey_usb *hisi_hikey_usb; + struct usb_role_switch_desc hub_role_switch = {NULL}; + + hisi_hikey_usb = devm_kzalloc(dev, sizeof(*hisi_hikey_usb), GFP_KERNEL); + if (!hisi_hikey_usb) + return -ENOMEM; + + hisi_hikey_usb->typec_vbus = devm_gpiod_get(dev, "typec-vbus", + GPIOD_OUT_LOW); + if (IS_ERR(hisi_hikey_usb->typec_vbus)) + return PTR_ERR(hisi_hikey_usb->typec_vbus); + + hisi_hikey_usb->otg_switch = devm_gpiod_get(dev, "otg-switch", + GPIOD_OUT_HIGH); + if (IS_ERR(hisi_hikey_usb->otg_switch)) + return PTR_ERR(hisi_hikey_usb->otg_switch); + + /* hub-vdd33-en is optional */ + hisi_hikey_usb->hub_vbus = devm_gpiod_get_optional(dev, "hub-vdd33-en", + GPIOD_OUT_HIGH); + if (IS_ERR(hisi_hikey_usb->hub_vbus)) + return PTR_ERR(hisi_hikey_usb->hub_vbus); + + hisi_hikey_usb->dev_role_sw = usb_role_switch_get(dev); + if (!hisi_hikey_usb->dev_role_sw) + return -EPROBE_DEFER; + if (IS_ERR(hisi_hikey_usb->dev_role_sw)) + return PTR_ERR(hisi_hikey_usb->dev_role_sw); + + hub_role_switch.fwnode = dev_fwnode(dev); + hub_role_switch.set = hub_usb_role_switch_set; + hub_role_switch.get = hub_usb_role_switch_get; + hisi_hikey_usb->hub_role_sw = usb_role_switch_register(dev, + &hub_role_switch); + + if (IS_ERR(hisi_hikey_usb->hub_role_sw)) { + usb_role_switch_put(hisi_hikey_usb->dev_role_sw); + return PTR_ERR(hisi_hikey_usb->hub_role_sw); + } + + platform_set_drvdata(pdev, hisi_hikey_usb); + + return 0; +} + +static int hisi_hikey_usb_remove(struct platform_device *pdev) +{ + struct hisi_hikey_usb *hisi_hikey_usb = platform_get_drvdata(pdev); + + if (hisi_hikey_usb->hub_role_sw) + usb_role_switch_unregister(hisi_hikey_usb->hub_role_sw); + + if (hisi_hikey_usb->dev_role_sw) + usb_role_switch_put(hisi_hikey_usb->dev_role_sw); + + return 0; +} + +static const struct of_device_id id_table_hisi_hikey_usb[] = { + {.compatible = "hisilicon,gpio_hubv1"}, + {} +}; +MODULE_DEVICE_TABLE(of, id_table_hisi_hikey_usb); + +static struct platform_driver hisi_hikey_usb_driver = { + .probe = hisi_hikey_usb_probe, + .remove = hisi_hikey_usb_remove, + .driver = { + .name = DEVICE_DRIVER_NAME, + .of_match_table = id_table_hisi_hikey_usb, + }, +}; + +module_platform_driver(hisi_hikey_usb_driver); + +MODULE_AUTHOR("Yu Chen "); +MODULE_DESCRIPTION("Driver Support for USB functionality of Hikey"); +MODULE_LICENSE("GPL v2");