From patchwork Tue Apr 9 08:28:50 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bartosz Golaszewski X-Patchwork-Id: 10890689 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 38F6F17E6 for ; Tue, 9 Apr 2019 08:29:07 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 26D8628818 for ; Tue, 9 Apr 2019 08:29:07 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 180382881A; Tue, 9 Apr 2019 08:29:07 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 63F5C28814 for ; Tue, 9 Apr 2019 08:29:06 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726741AbfDII3E (ORCPT ); Tue, 9 Apr 2019 04:29:04 -0400 Received: from mail-wr1-f68.google.com ([209.85.221.68]:38390 "EHLO mail-wr1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726633AbfDII3D (ORCPT ); Tue, 9 Apr 2019 04:29:03 -0400 Received: by mail-wr1-f68.google.com with SMTP id k11so19691401wro.5 for ; Tue, 09 Apr 2019 01:29:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bgdev-pl.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=45dzSBv6+V3bbvrapzfFB+qo0X2yeBTBy+CINkubKnc=; b=G873zF5dffzKx8qrkIZHrHo6kXTyU1Bv+mgvyIhr3uibQy4aoo1WvphGf2GLK097eX 31iBzbqiOjvdXYajQXQwz/lVmafuheAQJYVdYEg0zswvPytELmltlloLQmEYIkrmXtK+ tFfOvXQqXytmOJTR6htl7sdPzYcwqVieM4UZFuACViR5xEy9swNubOoKVJTvGEndTmBn tlLxXHR63oUVW+LXmGIpS8wEqXYMKqZCVsJ26mfXvurS7mLPVu6DMbu1O01u1uToAy2K evHL9ayeMiZK33tu9pM2aihLvoIqddjHD+IrLg5qKi3eH7ieFJAfMBJvucvRg+DIm3lC E0OA== 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:mime-version:content-transfer-encoding; bh=45dzSBv6+V3bbvrapzfFB+qo0X2yeBTBy+CINkubKnc=; b=DGXGaMKpDP3P/Cio/YfYvat+leIV8iuZw+/LvfhLI7PVqxR3WPio1nAW4CPGczz9sJ Y8OgRq3luJnrvz9XqAvkkM5GGXy/2Vbd16L73DaJzwmaurX5aW5xUT1Ly8aKvCDlcU2C SgWIHb1N6PPNbU3JgBlHtFEvQ8EfAuBegQKw7u+iECLaDGrcR6mlv8j/qEx5wfuiRBYK rMtcsTDapoMQvjhp5NniNuY1D9Pk5tD6XukTt8//lYdRZfG2XgsBaG8khFy2Qfol0kH/ 60iBDJwGLRG7OjOjzeBpWBoiU53PXibzmrkb40gwH79QMKZZSJdboMzSg7vF6VnLFVkR 59JQ== X-Gm-Message-State: APjAAAVfvLQnICYr9ISDnpfk0dlYfELE5ac004o6JF71nkk301rOpEP8 +dyXVGgJ23eOXp8swElmyJnqOA== X-Google-Smtp-Source: APXvYqxFy33HpHS7vPDiHpRUKe9PCK4WXUvc5uild4OPX5P/ir+fPCj2jafSHIrmlezXe2kg9W1LPA== X-Received: by 2002:a5d:530f:: with SMTP id e15mr23401704wrv.19.1554798541528; Tue, 09 Apr 2019 01:29:01 -0700 (PDT) Received: from debian-brgl.home ([2a01:cb1d:af:5b00:6d6c:8493:1ab5:dad7]) by smtp.gmail.com with ESMTPSA id c20sm59968651wre.28.2019.04.09.01.29.00 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 09 Apr 2019 01:29:00 -0700 (PDT) From: Bartosz Golaszewski To: Sekhar Nori , Kevin Hilman , Alan Stern , Greg Kroah-Hartman Cc: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-usb@vger.kernel.org, Bartosz Golaszewski Subject: [PATCH v3 1/6] ARM: davinci: add missing sentinels to GPIO lookup tables Date: Tue, 9 Apr 2019 10:28:50 +0200 Message-Id: <20190409082855.15373-2-brgl@bgdev.pl> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190409082855.15373-1-brgl@bgdev.pl> References: <20190409082855.15373-1-brgl@bgdev.pl> MIME-Version: 1.0 Sender: linux-usb-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Bartosz Golaszewski Some GPIO lookup tables defined in davinci board files are missing array sentinels. If an entry for given device cannot be found, this will cause a kernel panic. Signed-off-by: Bartosz Golaszewski --- arch/arm/mach-davinci/board-da830-evm.c | 2 ++ arch/arm/mach-davinci/board-da850-evm.c | 1 + arch/arm/mach-davinci/board-dm355-evm.c | 1 + arch/arm/mach-davinci/board-dm644x-evm.c | 1 + arch/arm/mach-davinci/board-omapl138-hawk.c | 1 + 5 files changed, 6 insertions(+) diff --git a/arch/arm/mach-davinci/board-da830-evm.c b/arch/arm/mach-davinci/board-da830-evm.c index ff097ecfa451..e3d74e43c47d 100644 --- a/arch/arm/mach-davinci/board-da830-evm.c +++ b/arch/arm/mach-davinci/board-da830-evm.c @@ -58,6 +58,7 @@ static struct gpiod_lookup_table da830_evm_usb_gpio_lookup = { .table = { GPIO_LOOKUP("davinci_gpio", ON_BD_USB_DRV, "vbus", 0), GPIO_LOOKUP("davinci_gpio", ON_BD_USB_OVC, "oc", 0), + { } }, }; @@ -156,6 +157,7 @@ static struct gpiod_lookup_table mmc_gpios_table = { GPIO_ACTIVE_LOW), GPIO_LOOKUP("davinci_gpio", DA830_MMCSD_WP_PIN, "wp", GPIO_ACTIVE_LOW), + { } }, }; diff --git a/arch/arm/mach-davinci/board-da850-evm.c b/arch/arm/mach-davinci/board-da850-evm.c index 1fdc9283a8c5..4ee65a8a3b80 100644 --- a/arch/arm/mach-davinci/board-da850-evm.c +++ b/arch/arm/mach-davinci/board-da850-evm.c @@ -784,6 +784,7 @@ static struct gpiod_lookup_table mmc_gpios_table = { GPIO_ACTIVE_LOW), GPIO_LOOKUP("davinci_gpio", DA850_MMCSD_WP_PIN, "wp", GPIO_ACTIVE_HIGH), + { } }, }; diff --git a/arch/arm/mach-davinci/board-dm355-evm.c b/arch/arm/mach-davinci/board-dm355-evm.c index 64d81fc86f14..5113273fda69 100644 --- a/arch/arm/mach-davinci/board-dm355-evm.c +++ b/arch/arm/mach-davinci/board-dm355-evm.c @@ -121,6 +121,7 @@ static struct gpiod_lookup_table i2c_recovery_gpiod_table = { GPIO_ACTIVE_HIGH | GPIO_OPEN_DRAIN), GPIO_LOOKUP("davinci_gpio", DM355_I2C_SCL_PIN, "scl", GPIO_ACTIVE_HIGH | GPIO_OPEN_DRAIN), + { } }, }; diff --git a/arch/arm/mach-davinci/board-dm644x-evm.c b/arch/arm/mach-davinci/board-dm644x-evm.c index de15f782816e..9d87d4e440ea 100644 --- a/arch/arm/mach-davinci/board-dm644x-evm.c +++ b/arch/arm/mach-davinci/board-dm644x-evm.c @@ -663,6 +663,7 @@ static struct gpiod_lookup_table i2c_recovery_gpiod_table = { GPIO_ACTIVE_HIGH | GPIO_OPEN_DRAIN), GPIO_LOOKUP("davinci_gpio", DM644X_I2C_SCL_PIN, "scl", GPIO_ACTIVE_HIGH | GPIO_OPEN_DRAIN), + { } }, }; diff --git a/arch/arm/mach-davinci/board-omapl138-hawk.c b/arch/arm/mach-davinci/board-omapl138-hawk.c index 0896af2bed24..e244c8648594 100644 --- a/arch/arm/mach-davinci/board-omapl138-hawk.c +++ b/arch/arm/mach-davinci/board-omapl138-hawk.c @@ -303,6 +303,7 @@ static struct gpiod_lookup_table hawk_usb_gpio_lookup = { .table = { GPIO_LOOKUP("davinci_gpio", DA850_USB1_VBUS_PIN, "vbus", 0), GPIO_LOOKUP("davinci_gpio", DA850_USB1_OC_PIN, "oc", 0), + { } }, }; From patchwork Tue Apr 9 08:28:51 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bartosz Golaszewski X-Patchwork-Id: 10890703 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 0BE1317E1 for ; Tue, 9 Apr 2019 08:29:42 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id EC2D4274A3 for ; Tue, 9 Apr 2019 08:29:41 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E0062285BD; Tue, 9 Apr 2019 08:29:41 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6E0B4274A3 for ; Tue, 9 Apr 2019 08:29:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726735AbfDII3k (ORCPT ); Tue, 9 Apr 2019 04:29:40 -0400 Received: from mail-wr1-f66.google.com ([209.85.221.66]:36606 "EHLO mail-wr1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726001AbfDII3E (ORCPT ); Tue, 9 Apr 2019 04:29:04 -0400 Received: by mail-wr1-f66.google.com with SMTP id y13so19673550wrd.3 for ; Tue, 09 Apr 2019 01:29:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bgdev-pl.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=15DBa0EnjSNcBoiq7HFAstm0qdeH35lSsLh5PK7xiEg=; b=bXDBK1K3t0svttcv9jzP3GIIt6Gp35JiLi41MrbUFQno0+Nwszgq72uurXsqJCPFih 7NoFGvr5wge0VotCbiKB8m3QEx4gHpEbKZM2dHNoYU/Dr5IoPU6yi9LXmupyBgEVngXG gM4LxsrTetEPUwDc0RJeWTi+sHs5558quvMOyPfzZNDb8VuLqVYvrOwyQYiKyXbbcJRX +He54ul9Me+HdbYUxs3A+mxGc3OmFf26gMDggJ9fAFKtwaQOjCzLKloZtWaHByBF96An 6Pt+WyQpaVDzCn3t5vBcQVQDxjIZR+OTujyWQp5IFr9ZgfZ52c6DmoWQjF5L+Sa3fG/j 2OMg== 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:mime-version:content-transfer-encoding; bh=15DBa0EnjSNcBoiq7HFAstm0qdeH35lSsLh5PK7xiEg=; b=Byn3azoOis7L8z7E+Xv8S7GeS3VS2QjH0eC98rn9B+/Fr+rrPXgqnMtt/tWYkZ+11j b6W4nCDFrKxZpn2hgK4a46BuJYjfVLE5x/k4H0qkDJ5BmaKIoe6/F4v8yBZ9B3zUVnBO GFmTyYaMHHI0Ru1hpr1nwXuPhEkrt5yoTvpMJh6gMzLVOvN4DeKRwsyWW/kKFdiDQiBN Dtie2TvhgpMS06tYFKb8v8N4bA4ErYiaRMp1/xKPMmamFGbkSxHNv9e9vRHp+mL6Aa0R zFXwuGQ+cAuOO9BoqFRj0DDSRNKBm/nf5NC4+Akz2QL0Hb1TXESpe1jFTcQcA+fIJCTl ntVA== X-Gm-Message-State: APjAAAUbK5Nr/dRqGbN2f/EqyQucantPVZMad2BOjhfsIdZCrN81runN t0JFO0EdgNHXtOs0jVqEMlV9Gg== X-Google-Smtp-Source: APXvYqyEihnGv12APLf6JtqE+drrm3qzq2sqhdNZtGeoavhnovnlsL84rkYx2+L4c0gMbIkVC8NbvQ== X-Received: by 2002:adf:cf0e:: with SMTP id o14mr21087198wrj.182.1554798542702; Tue, 09 Apr 2019 01:29:02 -0700 (PDT) Received: from debian-brgl.home ([2a01:cb1d:af:5b00:6d6c:8493:1ab5:dad7]) by smtp.gmail.com with ESMTPSA id c20sm59968651wre.28.2019.04.09.01.29.01 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 09 Apr 2019 01:29:02 -0700 (PDT) From: Bartosz Golaszewski To: Sekhar Nori , Kevin Hilman , Alan Stern , Greg Kroah-Hartman Cc: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-usb@vger.kernel.org, Bartosz Golaszewski Subject: [PATCH v3 2/6] usb: ohci-da8xx: let the regulator framework keep track of use count Date: Tue, 9 Apr 2019 10:28:51 +0200 Message-Id: <20190409082855.15373-3-brgl@bgdev.pl> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190409082855.15373-1-brgl@bgdev.pl> References: <20190409082855.15373-1-brgl@bgdev.pl> MIME-Version: 1.0 Sender: linux-usb-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Bartosz Golaszewski There's no reason to have a separate variable to keep track of the regulator state. The regulator core already does that. Remove reg_enabled from struct da8xx_ohci_hcd. Signed-off-by: Bartosz Golaszewski Acked-by: Alan Stern --- drivers/usb/host/ohci-da8xx.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/drivers/usb/host/ohci-da8xx.c b/drivers/usb/host/ohci-da8xx.c index ca8a94f15ac0..9c6d1f03b871 100644 --- a/drivers/usb/host/ohci-da8xx.c +++ b/drivers/usb/host/ohci-da8xx.c @@ -40,7 +40,6 @@ struct da8xx_ohci_hcd { struct phy *usb11_phy; struct regulator *vbus_reg; struct notifier_block nb; - unsigned int reg_enabled; struct gpio_desc *vbus_gpio; struct gpio_desc *oc_gpio; }; @@ -100,21 +99,18 @@ static int ohci_da8xx_set_power(struct usb_hcd *hcd, int on) if (!da8xx_ohci->vbus_reg) return 0; - if (on && !da8xx_ohci->reg_enabled) { + if (on) { ret = regulator_enable(da8xx_ohci->vbus_reg); if (ret) { dev_err(dev, "Failed to enable regulator: %d\n", ret); return ret; } - da8xx_ohci->reg_enabled = 1; - - } else if (!on && da8xx_ohci->reg_enabled) { + } else if (!on) { ret = regulator_disable(da8xx_ohci->vbus_reg); if (ret) { dev_err(dev, "Failed to disable regulator: %d\n", ret); return ret; } - da8xx_ohci->reg_enabled = 0; } return 0; From patchwork Tue Apr 9 08:28:52 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bartosz Golaszewski X-Patchwork-Id: 10890701 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 2175F17E6 for ; Tue, 9 Apr 2019 08:29:40 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0DAF5274A3 for ; Tue, 9 Apr 2019 08:29:40 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 01C70285BD; Tue, 9 Apr 2019 08:29:39 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 92FE3274A3 for ; Tue, 9 Apr 2019 08:29:39 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726894AbfDII3e (ORCPT ); Tue, 9 Apr 2019 04:29:34 -0400 Received: from mail-wr1-f67.google.com ([209.85.221.67]:46588 "EHLO mail-wr1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726711AbfDII3F (ORCPT ); Tue, 9 Apr 2019 04:29:05 -0400 Received: by mail-wr1-f67.google.com with SMTP id t17so19626285wrw.13 for ; Tue, 09 Apr 2019 01:29:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bgdev-pl.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=a1ibeF6fSGxrtLocqohp3DOAYCn4qHHgfHueAd+c1xs=; b=rc+kTt8MY2foIoO6IjqRvTBpTQiETlG0C7fT9V7xOdJMWZEKp+lAiESGAKm99LXeXu T5xQLvJGPkdZatLGwgq7gk5rUuiTTglQKmV/sOshrcW29zByeTA5MPNfno0S8u/6eGuq 3Bk9cHaoT3DXyZq/jSWydel7+s2mOogSSjxHmB593utiDAnkgd4i+VsS3Ls853Pzg2nm rFNO4FFcGBle4U+0Evd1zYEwZK0c+eK+EGNrD21XZSKGYovcqKxt5rF5znqRF8ong5fp elykfxGj6rwLp+F4N8t03WwjQMJxuIFYDt+Xx59ZRvexjbyaPin4+fO0MrMGORdLG9mV T1JA== 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:mime-version:content-transfer-encoding; bh=a1ibeF6fSGxrtLocqohp3DOAYCn4qHHgfHueAd+c1xs=; b=um3OcOxIgHhjGWuq5/xB9BBgN9ZIFo2wksBlJOzJdgyhaaofWQYG+2ASeTE7ix39Fy ix2ZiTit444GK+JjUrRNIVkjbyjZQsQRu9Jh2/QjohxO+VYV9Bfdy/tpYlrqa+v5wh5I RdT6VHWtFxpBjuDXGwU5q53YdmmQAGyr9Dc2BV2rTozR1YVLo8dydHVVScv4R/KTnBTT Kekr9afZ04OkZA52FK2qY2ExfjTsi2/q/wFrPaCC4hqeldW/kE3D6YY7OtcMBZH7+vwu OdWYBtvzcP5XnuudaFqpZgNEl1dXgGTTayPE3XJnx9tWNnnQWrPtVV63Mcw8SUrDimIQ Q//A== X-Gm-Message-State: APjAAAUfUM66ko/qbWwmLmUPOA2qktrkI1SJKPM6GwYPxUDDIUxmctyz A2Lqgb9cNEDrKc5bEtZKjIz03A== X-Google-Smtp-Source: APXvYqysocVGytB4qAkrXJND7pGufXDa6d177/I7jwR3YsuT6GTfMd1DU/ZnHPgeW3VASAODo3gPGw== X-Received: by 2002:adf:ff88:: with SMTP id j8mr21891334wrr.1.1554798543888; Tue, 09 Apr 2019 01:29:03 -0700 (PDT) Received: from debian-brgl.home ([2a01:cb1d:af:5b00:6d6c:8493:1ab5:dad7]) by smtp.gmail.com with ESMTPSA id c20sm59968651wre.28.2019.04.09.01.29.02 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 09 Apr 2019 01:29:03 -0700 (PDT) From: Bartosz Golaszewski To: Sekhar Nori , Kevin Hilman , Alan Stern , Greg Kroah-Hartman Cc: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-usb@vger.kernel.org, Bartosz Golaszewski Subject: [PATCH v3 3/6] usb: ohci-da8xx: disable the regulator if the overcurrent irq fired Date: Tue, 9 Apr 2019 10:28:52 +0200 Message-Id: <20190409082855.15373-4-brgl@bgdev.pl> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190409082855.15373-1-brgl@bgdev.pl> References: <20190409082855.15373-1-brgl@bgdev.pl> MIME-Version: 1.0 Sender: linux-usb-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Bartosz Golaszewski Historically the power supply management in this driver has been handled in two separate places in parallel. Device-tree users simply defined an appropriate regulator, while two boards with no DT support (da830-evm and omapl138-hawk) passed functions defined in their respective board files over platform data. These functions simply used legacy GPIO calls to watch the oc GPIO for interrupts and disable the vbus GPIO when the irq fires. Commit d193abf1c913 ("usb: ohci-da8xx: add vbus and overcurrent gpios") updated these GPIO calls to the modern API and moved them inside the driver. This however is not the optimal solution for the vbus GPIO which should be modeled as a fixed regulator that can be controlled with a GPIO. In order to keep the overcurrent protection available once we move the board files to using fixed regulators we need to disable the enable_reg regulator when the overcurrent indicator interrupt fires. Since we cannot call regulator_disable() from interrupt context, we need to switch to using a oneshot threaded interrupt. Signed-off-by: Bartosz Golaszewski Acked-by: Alan Stern --- drivers/usb/host/ohci-da8xx.c | 23 ++++++++++++++++++----- 1 file changed, 18 insertions(+), 5 deletions(-) diff --git a/drivers/usb/host/ohci-da8xx.c b/drivers/usb/host/ohci-da8xx.c index 9c6d1f03b871..108fe0a1b962 100644 --- a/drivers/usb/host/ohci-da8xx.c +++ b/drivers/usb/host/ohci-da8xx.c @@ -202,12 +202,24 @@ static int ohci_da8xx_regulator_event(struct notifier_block *nb, return 0; } -static irqreturn_t ohci_da8xx_oc_handler(int irq, void *data) +static irqreturn_t ohci_da8xx_oc_thread(int irq, void *data) { struct da8xx_ohci_hcd *da8xx_ohci = data; + struct device *dev = da8xx_ohci->hcd->self.controller; + int ret; - if (gpiod_get_value(da8xx_ohci->oc_gpio)) - gpiod_set_value(da8xx_ohci->vbus_gpio, 0); + if (gpiod_get_value_cansleep(da8xx_ohci->oc_gpio)) { + if (da8xx_ohci->vbus_gpio) { + gpiod_set_value_cansleep(da8xx_ohci->vbus_gpio, 0); + } else if (da8xx_ohci->vbus_reg) { + ret = regulator_disable(da8xx_ohci->vbus_reg); + if (ret) + dev_err(dev, + "Failed to disable regulator: %d\n", + ret); + } + + } return IRQ_HANDLED; } @@ -434,8 +446,9 @@ static int ohci_da8xx_probe(struct platform_device *pdev) if (oc_irq < 0) goto err; - error = devm_request_irq(dev, oc_irq, ohci_da8xx_oc_handler, - IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING, + error = devm_request_threaded_irq(dev, oc_irq, NULL, + ohci_da8xx_oc_thread, IRQF_TRIGGER_RISING | + IRQF_TRIGGER_FALLING | IRQF_ONESHOT, "OHCI over-current indicator", da8xx_ohci); if (error) goto err; From patchwork Tue Apr 9 08:28:53 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bartosz Golaszewski X-Patchwork-Id: 10890695 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 020B417E1 for ; Tue, 9 Apr 2019 08:29:26 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E3D1F28814 for ; Tue, 9 Apr 2019 08:29:25 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D7EA42881A; Tue, 9 Apr 2019 08:29:25 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 70CF528814 for ; Tue, 9 Apr 2019 08:29:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726791AbfDII3H (ORCPT ); Tue, 9 Apr 2019 04:29:07 -0400 Received: from mail-wr1-f67.google.com ([209.85.221.67]:46590 "EHLO mail-wr1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726756AbfDII3H (ORCPT ); Tue, 9 Apr 2019 04:29:07 -0400 Received: by mail-wr1-f67.google.com with SMTP id t17so19626359wrw.13 for ; Tue, 09 Apr 2019 01:29:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bgdev-pl.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=WkiOzqo+5E8+PTnExhJYSKG8TC17kxUDe5ZrFElD/ZE=; b=s99I0hVkurOugcw1p2GVsy9/iolntxChb1wMHFhKwdWsGTYowrVBedaTcoohRv1I2I qqWs6ADvHGqaBJcOVWBmvS1Trdj1RdsLOmorucGdN5FbA2BV6+SZ4wEtQfuZ7mjqIq+k B31JBuG048iRnXknjb8+nMWglaY6g8O8UkPcniFG0pGt15WOJA5vJm8yZ1/8xhIzfF1k dUl/u15wFJnPd9u2vo35AOshy90KiK9wJZJDMdKJz+jWjEUG+rWrI3JWKYvjXTUv8nqx wmC7iY0IpWJLzeAuPFlKThI2lA6DdCWQ+P0ar6F18+uGJv3r931t8Y8K3OqeJFsuQYK+ 21+g== 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:mime-version:content-transfer-encoding; bh=WkiOzqo+5E8+PTnExhJYSKG8TC17kxUDe5ZrFElD/ZE=; b=ovU19fxwxUBIbNg7HPoFSGYFzySrE2VdJFCbwCvj4vc2qXj97wwbDvL2yWG7wOVXop Z/KnOh+9C5c+MIwwbJdxViy4oiCAsP+rxFKU8pLMBet+QWlEjYZmqL9MV2TQw1Zo6M20 SPiTy51clfI0rdRyEh1SU+vH3CfhSz+8EsbFj108RFzDrEd6Mitg+waFRresqztbj3QY 85xspWisZvla0DMzTq/43pno7GS+ZCEStz8xKSPG3/VWulpRNvnAoaIfR05Mw9sMZ44w C5dSPw/c25KET2PRb4FARtQYyBXlWN8S2U89mkMeDzU3vttGzgSyAQPgkAvdaLUOMsPo JfZg== X-Gm-Message-State: APjAAAXcYLvFecyoDMuO5R/KH8Nqz7nFDIw+/SaxZWTU//XRozx0ntAO QB7VXUs8zMw6jWhCq5RE5Dhcag== X-Google-Smtp-Source: APXvYqxhwWqWQ9oHtjDDiAcwLNtMiQK1Mu4cvY64Bg3l4X3qTuwytnbqiwjJUEoaVX6oKkBKyMC+tw== X-Received: by 2002:adf:f285:: with SMTP id k5mr6966620wro.110.1554798545229; Tue, 09 Apr 2019 01:29:05 -0700 (PDT) Received: from debian-brgl.home ([2a01:cb1d:af:5b00:6d6c:8493:1ab5:dad7]) by smtp.gmail.com with ESMTPSA id c20sm59968651wre.28.2019.04.09.01.29.03 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 09 Apr 2019 01:29:04 -0700 (PDT) From: Bartosz Golaszewski To: Sekhar Nori , Kevin Hilman , Alan Stern , Greg Kroah-Hartman Cc: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-usb@vger.kernel.org, Bartosz Golaszewski Subject: [PATCH v3 4/6] ARM: davinci: omapl138-hawk: add a fixed regulator for ohci-da8xx Date: Tue, 9 Apr 2019 10:28:53 +0200 Message-Id: <20190409082855.15373-5-brgl@bgdev.pl> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190409082855.15373-1-brgl@bgdev.pl> References: <20190409082855.15373-1-brgl@bgdev.pl> MIME-Version: 1.0 Sender: linux-usb-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Bartosz Golaszewski Instead of directly using the vbus GPIO we should model it as a fixed regulator. Add all necessary fix-ups for the regulator to be registered and configure the vbus GPIO as its enable pin. Signed-off-by: Bartosz Golaszewski --- arch/arm/mach-davinci/board-omapl138-hawk.c | 49 +++++++++++++++++++-- 1 file changed, 46 insertions(+), 3 deletions(-) diff --git a/arch/arm/mach-davinci/board-omapl138-hawk.c b/arch/arm/mach-davinci/board-omapl138-hawk.c index e244c8648594..db177a6a7e48 100644 --- a/arch/arm/mach-davinci/board-omapl138-hawk.c +++ b/arch/arm/mach-davinci/board-omapl138-hawk.c @@ -21,6 +21,7 @@ #include #include #include +#include #include #include @@ -298,15 +299,50 @@ static const short da850_hawk_usb11_pins[] = { -1 }; -static struct gpiod_lookup_table hawk_usb_gpio_lookup = { +static struct regulator_consumer_supply hawk_usb_supplies[] = { + REGULATOR_SUPPLY("vbus", NULL), +}; + +static struct regulator_init_data hawk_usb_vbus_data = { + .consumer_supplies = hawk_usb_supplies, + .num_consumer_supplies = ARRAY_SIZE(hawk_usb_supplies), +}; + +static struct fixed_voltage_config hawk_usb_vbus = { + .supply_name = "vbus", + .microvolts = 3300000, + .init_data = &hawk_usb_vbus_data, +}; + +static struct platform_device hawk_usb_vbus_device = { + .name = "reg-fixed-voltage", + .id = 0, + .dev = { + .platform_data = &hawk_usb_vbus, + }, +}; + +static struct gpiod_lookup_table hawk_usb_oc_gpio_lookup = { .dev_id = "ohci-da8xx", .table = { - GPIO_LOOKUP("davinci_gpio", DA850_USB1_VBUS_PIN, "vbus", 0), GPIO_LOOKUP("davinci_gpio", DA850_USB1_OC_PIN, "oc", 0), { } }, }; +static struct gpiod_lookup_table hawk_usb_vbus_gpio_lookup = { + .dev_id = "reg-fixed-voltage.0", + .table = { + GPIO_LOOKUP("davinci_gpio", DA850_USB1_VBUS_PIN, NULL, 0), + { } + }, +}; + +static struct gpiod_lookup_table *hawk_usb_gpio_lookups[] = { + &hawk_usb_oc_gpio_lookup, + &hawk_usb_vbus_gpio_lookup, +}; + static struct da8xx_ohci_root_hub omapl138_hawk_usb11_pdata = { /* TPS2087 switch @ 5V */ .potpgt = (3 + 1) / 2, /* 3 ms max */ @@ -327,12 +363,19 @@ static __init void omapl138_hawk_usb_init(void) pr_warn("%s: USB PHY CLK registration failed: %d\n", __func__, ret); + gpiod_add_lookup_tables(hawk_usb_gpio_lookups, + ARRAY_SIZE(hawk_usb_gpio_lookups)); + ret = da8xx_register_usb_phy(); if (ret) pr_warn("%s: USB PHY registration failed: %d\n", __func__, ret); - gpiod_add_lookup_table(&hawk_usb_gpio_lookup); + ret = platform_device_register(&hawk_usb_vbus_device); + if (ret) { + pr_warn("%s: Unable to register the vbus supply\n", __func__); + return; + } ret = da8xx_register_usb11(&omapl138_hawk_usb11_pdata); if (ret) From patchwork Tue Apr 9 08:28:54 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bartosz Golaszewski X-Patchwork-Id: 10890691 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 9585F17E1 for ; Tue, 9 Apr 2019 08:29:12 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 825D928814 for ; Tue, 9 Apr 2019 08:29:12 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 764E82888D; Tue, 9 Apr 2019 08:29:12 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 058BB28814 for ; Tue, 9 Apr 2019 08:29:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726827AbfDII3J (ORCPT ); Tue, 9 Apr 2019 04:29:09 -0400 Received: from mail-wr1-f67.google.com ([209.85.221.67]:44560 "EHLO mail-wr1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726786AbfDII3I (ORCPT ); Tue, 9 Apr 2019 04:29:08 -0400 Received: by mail-wr1-f67.google.com with SMTP id y7so4063398wrn.11 for ; Tue, 09 Apr 2019 01:29:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bgdev-pl.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=gyAH0wiE/i5zzvDeE8RjO1VQwB5hV38XLhGYRf7RuPY=; b=r/RkcHXMX6LLaUb5DyY0cJqlJ/XpJ28YIwZGo0EuPMwnE08n0FL171fRH5NEwYIqJW Yjx3VnSmo6eo1uNO6bIPngtk/WXNqokjQcOXMlj4lFyCGpP50TSmWpFwg+xld5c+4Zmj eBwsDS9OMg5pFaIj3FItxbxi4hF8lBrhn7vcWNBQ//A5GYGlcJ+GJv5E7vSRA71GE956 PA+n4ZpUrLUuffhpSPMBLHsgJRCKflQMpS+xbe7YstfPIJngcnR3TtWYz8gS+6Mlga0M HitjuC1eKUYVaE4DKNkV9ZhEgnWUb9krQhmyXmu0vgFC2WTTjJUsUDtTLqA41KooDtnJ mM7A== 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:mime-version:content-transfer-encoding; bh=gyAH0wiE/i5zzvDeE8RjO1VQwB5hV38XLhGYRf7RuPY=; b=iG+zEEb6Kcxz1+tdXOPdm167EUwWz/3sEs2k1Uc6Wop1kLt+Gch0IYiZ1dFV23H8M7 JNOLj+w6j5YEHDG2ZZHgL7o7DNsifVjjhueZN1i5xzVliXkPx+wJZPbVmhPeBFbABBkv cCR2/JW53ozGALg6dF2/ndZzRgXz2N6NFcZTqqoJgy+UO7ZyeDedKIJMesNx4dFfCZRo Fgru4qiOwvAkUKb/U2Txk5VgImV17iTFoRTflESY8isYpb1+5XQ9CJOpSs84g0fUvkKS uYACWE7XNbRH9rqda+ZQYEcFx9a2NjmVowfLDZ+Qvs9P9oXvLY9GzRd8KrQdHjlt0P6t rCPw== X-Gm-Message-State: APjAAAWC7F2QxmzxVu+kcYWruHU8GeHQaeZ4d5mwXuId6mCBGnv9OCHM KAaEi6Z509DXr8e3Cven9us1Jw== X-Google-Smtp-Source: APXvYqxb7X9Rk6XcFuSmdlNUmt9x59B/entM4fiTxnbGiWv+T3cpIjMl5X7CDH3WT/mB2aIL/pWkDA== X-Received: by 2002:adf:ea88:: with SMTP id s8mr23225448wrm.300.1554798546324; Tue, 09 Apr 2019 01:29:06 -0700 (PDT) Received: from debian-brgl.home ([2a01:cb1d:af:5b00:6d6c:8493:1ab5:dad7]) by smtp.gmail.com with ESMTPSA id c20sm59968651wre.28.2019.04.09.01.29.05 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 09 Apr 2019 01:29:05 -0700 (PDT) From: Bartosz Golaszewski To: Sekhar Nori , Kevin Hilman , Alan Stern , Greg Kroah-Hartman Cc: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-usb@vger.kernel.org, Bartosz Golaszewski Subject: [PATCH v3 5/6] ARM: davinci: da830-evm: add a fixed regulator for ohci-da8xx Date: Tue, 9 Apr 2019 10:28:54 +0200 Message-Id: <20190409082855.15373-6-brgl@bgdev.pl> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190409082855.15373-1-brgl@bgdev.pl> References: <20190409082855.15373-1-brgl@bgdev.pl> MIME-Version: 1.0 Sender: linux-usb-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Bartosz Golaszewski Instead of directly using the vbus GPIO we should model it as a fixed regulator. Add all necessary fix-ups for the regulator to be registered and configure the vbus GPIO as its enable pin. Signed-off-by: Bartosz Golaszewski --- arch/arm/mach-davinci/board-da830-evm.c | 49 +++++++++++++++++++++++-- 1 file changed, 46 insertions(+), 3 deletions(-) diff --git a/arch/arm/mach-davinci/board-da830-evm.c b/arch/arm/mach-davinci/board-da830-evm.c index e3d74e43c47d..51a892702e27 100644 --- a/arch/arm/mach-davinci/board-da830-evm.c +++ b/arch/arm/mach-davinci/board-da830-evm.c @@ -29,6 +29,7 @@ #include #include #include +#include #include #include @@ -53,15 +54,50 @@ static const short da830_evm_usb11_pins[] = { -1 }; -static struct gpiod_lookup_table da830_evm_usb_gpio_lookup = { +static struct regulator_consumer_supply da830_evm_usb_supplies[] = { + REGULATOR_SUPPLY("vbus", NULL), +}; + +static struct regulator_init_data da830_evm_usb_vbus_data = { + .consumer_supplies = da830_evm_usb_supplies, + .num_consumer_supplies = ARRAY_SIZE(da830_evm_usb_supplies), +}; + +static struct fixed_voltage_config da830_evm_usb_vbus = { + .supply_name = "vbus", + .microvolts = 33000000, + .init_data = &da830_evm_usb_vbus_data, +}; + +static struct platform_device da830_evm_usb_vbus_device = { + .name = "reg-fixed-voltage", + .id = 0, + .dev = { + .platform_data = &da830_evm_usb_vbus, + }, +}; + +static struct gpiod_lookup_table da830_evm_usb_oc_gpio_lookup = { .dev_id = "ohci-da8xx", .table = { - GPIO_LOOKUP("davinci_gpio", ON_BD_USB_DRV, "vbus", 0), GPIO_LOOKUP("davinci_gpio", ON_BD_USB_OVC, "oc", 0), { } }, }; +static struct gpiod_lookup_table da830_evm_usb_vbus_gpio_lookup = { + .dev_id = "reg-fixed-voltage.0", + .table = { + GPIO_LOOKUP("davinci_gpio", ON_BD_USB_DRV, "vbus", 0), + { } + }, +}; + +static struct gpiod_lookup_table *da830_evm_usb_gpio_lookups[] = { + &da830_evm_usb_oc_gpio_lookup, + &da830_evm_usb_vbus_gpio_lookup, +}; + static struct da8xx_ohci_root_hub da830_evm_usb11_pdata = { /* TPS2065 switch @ 5V */ .potpgt = (3 + 1) / 2, /* 3 ms max */ @@ -76,6 +112,9 @@ static __init void da830_evm_usb_init(void) pr_warn("%s: USB PHY CLK registration failed: %d\n", __func__, ret); + gpiod_add_lookup_tables(da830_evm_usb_gpio_lookups, + ARRAY_SIZE(da830_evm_usb_gpio_lookups)); + ret = da8xx_register_usb_phy(); if (ret) pr_warn("%s: USB PHY registration failed: %d\n", @@ -101,7 +140,11 @@ static __init void da830_evm_usb_init(void) return; } - gpiod_add_lookup_table(&da830_evm_usb_gpio_lookup); + ret = platform_device_register(&da830_evm_usb_vbus_device); + if (ret) { + pr_warn("%s: Unable to register the vbus supply\n", __func__); + return; + } ret = da8xx_register_usb11(&da830_evm_usb11_pdata); if (ret) From patchwork Tue Apr 9 08:28:55 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bartosz Golaszewski X-Patchwork-Id: 10890693 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id D13EE17E6 for ; Tue, 9 Apr 2019 08:29:23 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id BBCA028814 for ; Tue, 9 Apr 2019 08:29:23 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B020C2881A; Tue, 9 Apr 2019 08:29:23 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4439228814 for ; Tue, 9 Apr 2019 08:29:23 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726849AbfDII3R (ORCPT ); Tue, 9 Apr 2019 04:29:17 -0400 Received: from mail-wr1-f65.google.com ([209.85.221.65]:33268 "EHLO mail-wr1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726798AbfDII3I (ORCPT ); Tue, 9 Apr 2019 04:29:08 -0400 Received: by mail-wr1-f65.google.com with SMTP id q1so19704856wrp.0 for ; Tue, 09 Apr 2019 01:29:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bgdev-pl.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=p38pAuvIEjPOoMJmacPqD0dwSx+AzVUQhdkwsmJTYSE=; b=MBfSNNswpjRwqServDNjI2/BOiIcx9EC0oB1tqAD7fGW2Oowkm0RWHTlbKrCzhvsix 0qy6xl8hhcUflELsLM2TQ9euS4q4Vr74Z6VlpX7DMAsRWqpl57h3aQb8CODjQLwmIqt7 mwUIr3o4CyVQNSLQEG1To6NiOhVCR27Bz/jrjfAY7Psvg5ilDPHaXnKoUjaOt0zzT0RY 9btINSJ2H3Cf3/0FzIlZLr0yrYn3Lmj3TvvY5gCaExsktVo5MHRwlIzQPUAPq17lmzES lScDYTVOZ43XjZMugEZTS4swgXx/G2dqXLWTX2gHboK4RdWYYpxTA1u/oodqSkk2AKlx 3D3g== 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:mime-version:content-transfer-encoding; bh=p38pAuvIEjPOoMJmacPqD0dwSx+AzVUQhdkwsmJTYSE=; b=UurIh6bDtFBMGASrz3uFSfhiKqf/mfRNgGOkfBTcKC1SThfv09BTLdeGQ8pihVqqrN e31/yKJhNtk/6ovZa0AwAkEsdat4p1ZYjW7wgFzvmine8hin74S8dCSsettmlkXfD1ZU MCYavOdnKp+tGicsSftqwJ7L5IbQR9o7o2sosioUDlEKWvhE/0dBTFYisgoQuItanhpy k2Bm+HYjbhW9ozmVHwnujPtBlfpn+ZHibGHKhZZl/EwNTiHcBG0e3I+w4AuBhQogMQy/ uBUyYXJv7MO0IxbmpNF4hcTqpeV7UYhQwPOSYJMdcZT9Vc5gx2Fna/tTmWIr21AF4LP5 XvQA== X-Gm-Message-State: APjAAAXu/UgaUNky7cC8s7h5FBaY2l2nNGqW481Zp8VAbnfedq5Ni3ME 1AWTgjLMOvlx9fXYjSGodrDKoQ== X-Google-Smtp-Source: APXvYqwuqt0Q4a6XDmiEQ2O+wNjRnHQZTa83jRtPmEs026IXU9oxqaWK/TDBjMKzdwmzTeqqwOu5EQ== X-Received: by 2002:adf:fec3:: with SMTP id q3mr22158011wrs.173.1554798547426; Tue, 09 Apr 2019 01:29:07 -0700 (PDT) Received: from debian-brgl.home ([2a01:cb1d:af:5b00:6d6c:8493:1ab5:dad7]) by smtp.gmail.com with ESMTPSA id c20sm59968651wre.28.2019.04.09.01.29.06 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 09 Apr 2019 01:29:06 -0700 (PDT) From: Bartosz Golaszewski To: Sekhar Nori , Kevin Hilman , Alan Stern , Greg Kroah-Hartman Cc: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-usb@vger.kernel.org, Bartosz Golaszewski Subject: [PATCH v3 6/6] usb: ohci-da8xx: drop the vbus GPIO Date: Tue, 9 Apr 2019 10:28:55 +0200 Message-Id: <20190409082855.15373-7-brgl@bgdev.pl> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190409082855.15373-1-brgl@bgdev.pl> References: <20190409082855.15373-1-brgl@bgdev.pl> MIME-Version: 1.0 Sender: linux-usb-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Bartosz Golaszewski All users now setup a fixed regulator for the vbus supply. We can drop the vbus GPIO code. Signed-off-by: Bartosz Golaszewski Acked-by: Alan Stern --- drivers/usb/host/ohci-da8xx.c | 21 +-------------------- 1 file changed, 1 insertion(+), 20 deletions(-) diff --git a/drivers/usb/host/ohci-da8xx.c b/drivers/usb/host/ohci-da8xx.c index 108fe0a1b962..9d1157beb508 100644 --- a/drivers/usb/host/ohci-da8xx.c +++ b/drivers/usb/host/ohci-da8xx.c @@ -40,7 +40,6 @@ struct da8xx_ohci_hcd { struct phy *usb11_phy; struct regulator *vbus_reg; struct notifier_block nb; - struct gpio_desc *vbus_gpio; struct gpio_desc *oc_gpio; }; @@ -91,11 +90,6 @@ static int ohci_da8xx_set_power(struct usb_hcd *hcd, int on) struct device *dev = hcd->self.controller; int ret; - if (da8xx_ohci->vbus_gpio) { - gpiod_set_value_cansleep(da8xx_ohci->vbus_gpio, on); - return 0; - } - if (!da8xx_ohci->vbus_reg) return 0; @@ -120,9 +114,6 @@ static int ohci_da8xx_get_power(struct usb_hcd *hcd) { struct da8xx_ohci_hcd *da8xx_ohci = to_da8xx_ohci(hcd); - if (da8xx_ohci->vbus_gpio) - return gpiod_get_value_cansleep(da8xx_ohci->vbus_gpio); - if (da8xx_ohci->vbus_reg) return regulator_is_enabled(da8xx_ohci->vbus_reg); @@ -155,9 +146,6 @@ static int ohci_da8xx_has_set_power(struct usb_hcd *hcd) { struct da8xx_ohci_hcd *da8xx_ohci = to_da8xx_ohci(hcd); - if (da8xx_ohci->vbus_gpio) - return 1; - if (da8xx_ohci->vbus_reg) return 1; @@ -209,9 +197,7 @@ static irqreturn_t ohci_da8xx_oc_thread(int irq, void *data) int ret; if (gpiod_get_value_cansleep(da8xx_ohci->oc_gpio)) { - if (da8xx_ohci->vbus_gpio) { - gpiod_set_value_cansleep(da8xx_ohci->vbus_gpio, 0); - } else if (da8xx_ohci->vbus_reg) { + if (da8xx_ohci->vbus_reg) { ret = regulator_disable(da8xx_ohci->vbus_reg); if (ret) dev_err(dev, @@ -432,11 +418,6 @@ static int ohci_da8xx_probe(struct platform_device *pdev) } } - da8xx_ohci->vbus_gpio = devm_gpiod_get_optional(dev, "vbus", - GPIOD_OUT_HIGH); - if (IS_ERR(da8xx_ohci->vbus_gpio)) - goto err; - da8xx_ohci->oc_gpio = devm_gpiod_get_optional(dev, "oc", GPIOD_IN); if (IS_ERR(da8xx_ohci->oc_gpio)) goto err;