From patchwork Fri Mar 29 09:33:29 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bartosz Golaszewski X-Patchwork-Id: 10876713 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 1FD22139A for ; Fri, 29 Mar 2019 09:34:24 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0C012287E7 for ; Fri, 29 Mar 2019 09:34:24 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 00338289A9; Fri, 29 Mar 2019 09:34: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=unavailable 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 704F5287E7 for ; Fri, 29 Mar 2019 09:34:23 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728660AbfC2JeW (ORCPT ); Fri, 29 Mar 2019 05:34:22 -0400 Received: from mail-wm1-f68.google.com ([209.85.128.68]:53592 "EHLO mail-wm1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727387AbfC2Jdo (ORCPT ); Fri, 29 Mar 2019 05:33:44 -0400 Received: by mail-wm1-f68.google.com with SMTP id q16so1764603wmj.3 for ; Fri, 29 Mar 2019 02:33:43 -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=ip0Af/xqdfmo1gYikSlIwnA/2wrU/gZ0/N3BF/YGvKw=; b=BINz0rkoUktsO2eGgf60kWm2zKPOVlmpSajI41Qsn7Ax1jtXIGm14hbwpmhxH5DjpI MmqhjiHdor8Zbe0X/kT1yC2WEDw6Na2gsQrEhBPSRMCK6PSB1EJvO55IRtFDF+woKJcd xF71cubZAKvk9fMip/Z9xkk0FuppwXX1TZh+uwgspbOM2VNIEG4spt0WlncVbGeZe65U Zqt92edCMA5b5WC8croafLnY04QfNRkOkhzdGn3IN0Mmp0nMH1Rw0/O0fmY+k+bQurJn x/mhkcQco4sqUsYVD0g7BI4O2RirQOMQK7YnBxg7DXwIOjETltdv+WSpsoajLG2tuJBA 792w== 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=ip0Af/xqdfmo1gYikSlIwnA/2wrU/gZ0/N3BF/YGvKw=; b=SgRdfw3JTCdoFrsWaEaIpja7gvGgqlHnWijte9dLACy0S4LR0Q2f/uZpMhI05IyXPI NCYR4Jzd73QdEovqS7gC2sNivKeV35x0EN8o4S1LgQwuEJUqUfBpU/VakRZa3dOpFjeI dF2kZCwhllIuGKObhxDEn4bk9Sz+ekaRcCLxDNGKqWLQW5Io46lldt6thCF+N6pEQT5v 9p3NcFcVpSDewWvlWKBdO2iFnbxo/+DhZQGUSC0kgRRme2F5cFEKQW4DyDt6dtyv3pWQ DJcmHevN+nP4vJMe2U1Y0pAZ83AE06kzC7ROF0EBqt+sVnlHjvV2gwXPlAO2rcUwHmld qzSQ== X-Gm-Message-State: APjAAAUELEfgJCGS1S1BrfNFfc31kJEq4lhvWoRaX9j6UfPWvW3uva3z e9NSFkodLd/T93dEacEBxmqP0w== X-Google-Smtp-Source: APXvYqzsuCQYuRsG3pxCvRkRN5K6Z3g0w6EFDcvxMtAitbe8e7zPQ/Vy4B9TDNOG9b0vnPRju5ZKtA== X-Received: by 2002:a1c:e188:: with SMTP id y130mr2760438wmg.83.1553852023122; Fri, 29 Mar 2019 02:33:43 -0700 (PDT) Received: from localhost.localdomain (aputeaux-684-1-29-77.w90-86.abo.wanadoo.fr. [90.86.254.77]) by smtp.gmail.com with ESMTPSA id s12sm1957125wmj.42.2019.03.29.02.33.41 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 29 Mar 2019 02:33:42 -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 , stable@vger.kernel.org Subject: [PATCH v2 1/6] ARM: davinci: add missing sentinels to GPIO lookup tables Date: Fri, 29 Mar 2019 10:33:29 +0100 Message-Id: <20190329093334.3885-2-brgl@bgdev.pl> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190329093334.3885-1-brgl@bgdev.pl> References: <20190329093334.3885-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. Cc: stable@vger.kernel.org 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 Fri Mar 29 09:33:30 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bartosz Golaszewski X-Patchwork-Id: 10876711 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 82625139A for ; Fri, 29 Mar 2019 09:34:19 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6DE02287E0 for ; Fri, 29 Mar 2019 09:34:19 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 6237128856; Fri, 29 Mar 2019 09:34:19 +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 0F403287E0 for ; Fri, 29 Mar 2019 09:34:19 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728917AbfC2JeR (ORCPT ); Fri, 29 Mar 2019 05:34:17 -0400 Received: from mail-wm1-f68.google.com ([209.85.128.68]:40347 "EHLO mail-wm1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728737AbfC2Jdq (ORCPT ); Fri, 29 Mar 2019 05:33:46 -0400 Received: by mail-wm1-f68.google.com with SMTP id z24so1960196wmi.5 for ; Fri, 29 Mar 2019 02:33:45 -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=ze5SSoMthSUJEWILh/6R6Dx6kiGpd0KVEMFuw2rprTY=; b=0BSzGfvncOp+if/tJIHLno6MGS9J176p5OuCiUpvRIpwJtY2UTdoe7/x8bZzvQbwUy 6uov2hdT4bF9A/9E6HpwTs9bu4JOG2GXE8UHxOIHMOwRbapJqNKYArovWz/LB09vYkx7 Z7YS4oK6a7aOgz4LmJExBeZroq1pWS1YSdDLekZmHY2uPDsG27TckGUfOhQbylpj4Mg0 8TCWDMTM73KtTcIyofhdWeOx1qqeYqqeRaNzKA7EMrLIZFK9PTTJ4WKbzGfy+R2SVxqk Y4ucaijH8aGjkigRxgt7WV8oW7fLIZigBVqP1FcksX4+3DCDLFya+XZlU+QBCy4lNHZ3 5r6w== 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=ze5SSoMthSUJEWILh/6R6Dx6kiGpd0KVEMFuw2rprTY=; b=bgensz2iSZ5PYj561dDy3BT7Tuy39wHIK0L8iceBpbTJjXaOP8Sv+s4IMjSGRYLHeZ 8dltTVwlypSU0MAFK1XOnt0e7tV6Ah+tvcFPStz6tpym3nxFrnVM7bNdljDQytJwe4SK 17mJ1uPjVH/EHPq8C66K0r0YkXcsW7d038+nfwcO0Rep4CjAFmm64ut4tZsSOMeZvRcw OXSVFo6wv4SmuBvoSZEHwJKtd6KUZxgpe92mUddkzWL+nDL+lD5p3bm1XrSUzIxj4htN ryl/tSYQ9NNvWOUnyLWLk09DCk3auo2e8s2+CwVT7lXMCf4nztsNtZ/fupCpCqg1VN4j +hqw== X-Gm-Message-State: APjAAAXv4PhgWXo4vp8eT6oirFNQz5J9MbzZHBfR8JNIO92TLAcveeQV WfkaCknYBsVaVLsNNVVii5drYg== X-Google-Smtp-Source: APXvYqywqsBJ6vOuQI0SVUJ9GDFgyd4nYvY/ygpOvIhNOZKecn56UXso299U5l5WwsmJ3cF2p4HNGg== X-Received: by 2002:a1c:e085:: with SMTP id x127mr2814871wmg.87.1553852024425; Fri, 29 Mar 2019 02:33:44 -0700 (PDT) Received: from localhost.localdomain (aputeaux-684-1-29-77.w90-86.abo.wanadoo.fr. [90.86.254.77]) by smtp.gmail.com with ESMTPSA id s12sm1957125wmj.42.2019.03.29.02.33.43 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 29 Mar 2019 02:33:43 -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 v2 2/6] usb: ohci-da8xx: let the regulator framework keep track of use count Date: Fri, 29 Mar 2019 10:33:30 +0100 Message-Id: <20190329093334.3885-3-brgl@bgdev.pl> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190329093334.3885-1-brgl@bgdev.pl> References: <20190329093334.3885-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 --- 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 Fri Mar 29 09:33:31 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bartosz Golaszewski X-Patchwork-Id: 10876707 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 147761805 for ; Fri, 29 Mar 2019 09:34:07 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id F3AF3290C6 for ; Fri, 29 Mar 2019 09:34:06 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E8139290CF; Fri, 29 Mar 2019 09:34:06 +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 86C7429102 for ; Fri, 29 Mar 2019 09:34:06 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728814AbfC2Jds (ORCPT ); Fri, 29 Mar 2019 05:33:48 -0400 Received: from mail-wm1-f65.google.com ([209.85.128.65]:40348 "EHLO mail-wm1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728776AbfC2Jdr (ORCPT ); Fri, 29 Mar 2019 05:33:47 -0400 Received: by mail-wm1-f65.google.com with SMTP id z24so1960280wmi.5 for ; Fri, 29 Mar 2019 02:33:46 -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=qxVFTCKVfhfrjJriQ7IFcj6eKhxdNdDEXDDI5+KStxc=; b=CUQ7KKfdW8+ryhjSUNXaiFX89azn2tYpx2isT2sVjj6MMYlDDZb59OKxxSo4i5+is9 jcPishfNrPUJLOkdwWo2BPE2E4sr7Cdu+VK+J4/kdk3jUigrmH77ObhZrQVGNpg2ebbG 7sa6hG2AgJmcIxOE0cST8nIBPDVRCpGo4O/sjbvzF+IUiTzbw7Rlac7HUq5LvkRRzmno idvbBMW2bAe3nTKKP27RmtWsivWJdLV68yw8/xHWELdO/BHC1GFd7f2NwYbTcowSkXTg VHQ/xjeGtJ6VzOPNkqQtxFDLscOLzh7ewjH2aCcx/sAyRh6ePgeHgsVcFK+Zo8VeoqXa kD4g== 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=qxVFTCKVfhfrjJriQ7IFcj6eKhxdNdDEXDDI5+KStxc=; b=Jcno0PAghfsTgfYuu/tJZ6egk7TY1+oWluMKtynmd8ZoZtPtKPP6zJei5hqj26zRZf 8NzuOSYodDeN8SXVbh+Dz4LT7kiR9WKbdWwrV+PNGDEway8FjhWby54y5XPeM+FyH8Hj hPlm61+HWieQArmrktZPZNZDcsNAvuyKZYxeCDDGX/PIZV9FTULFk7FT0Uv/85wpm7pq KO9MCy3toRbiSpV2/ysVw0sx69Dow8jGS5xoKE1Hi2oCskukf9QMJdab/L92m10McHhL DO5u8NUPvieV627wSmxFhde/aA60JAtefnwM65tjVtziPnbqcwNqrm1gIGjcMlQ5vq5s WmvQ== X-Gm-Message-State: APjAAAXlkKbiNqoO4vDDTR/VBVMn3EeLENhuLglB+UUrIvRbc7lhaoxn 7VKKGy5PhiWaZ25dFvJhy9OGig== X-Google-Smtp-Source: APXvYqy+zZg4B2VxgIKMbzMvBv4CBQGWIh4gIel8gfANT8NUSAkwF5Q59QfXQdw6RoUD5ZGBE3xtyQ== X-Received: by 2002:a1c:96d5:: with SMTP id y204mr1145423wmd.22.1553852025666; Fri, 29 Mar 2019 02:33:45 -0700 (PDT) Received: from localhost.localdomain (aputeaux-684-1-29-77.w90-86.abo.wanadoo.fr. [90.86.254.77]) by smtp.gmail.com with ESMTPSA id s12sm1957125wmj.42.2019.03.29.02.33.44 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 29 Mar 2019 02:33:44 -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 v2 3/6] usb: ohci-da8xx: disable the regulator if the overcurrent irq fired Date: Fri, 29 Mar 2019 10:33:31 +0100 Message-Id: <20190329093334.3885-4-brgl@bgdev.pl> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190329093334.3885-1-brgl@bgdev.pl> References: <20190329093334.3885-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 --- drivers/usb/host/ohci-da8xx.c | 29 ++++++++++++++++++++++++----- 1 file changed, 24 insertions(+), 5 deletions(-) diff --git a/drivers/usb/host/ohci-da8xx.c b/drivers/usb/host/ohci-da8xx.c index 9c6d1f03b871..35eb2cb96a8f 100644 --- a/drivers/usb/host/ohci-da8xx.c +++ b/drivers/usb/host/ohci-da8xx.c @@ -206,8 +206,25 @@ static irqreturn_t ohci_da8xx_oc_handler(int irq, void *data) { struct da8xx_ohci_hcd *da8xx_ohci = data; - if (gpiod_get_value(da8xx_ohci->oc_gpio)) - gpiod_set_value(da8xx_ohci->vbus_gpio, 0); + if (gpiod_get_value(da8xx_ohci->oc_gpio)) { + if (da8xx_ohci->vbus_gpio) + gpiod_set_value(da8xx_ohci->vbus_gpio, 0); + else if (da8xx_ohci->vbus_reg) + return IRQ_WAKE_THREAD; + } + + return IRQ_HANDLED; +} + +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; + + ret = regulator_disable(da8xx_ohci->vbus_reg); + if (ret) + dev_err(dev, "Failed to disable regulator: %d\n", ret); return IRQ_HANDLED; } @@ -434,9 +451,11 @@ 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, - "OHCI over-current indicator", da8xx_ohci); + error = devm_request_threaded_irq(dev, oc_irq, + ohci_da8xx_oc_handler, ohci_da8xx_oc_thread, + IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING | + IRQF_ONESHOT, "OHCI over-current indicator", + da8xx_ohci); if (error) goto err; } From patchwork Fri Mar 29 09:33:32 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bartosz Golaszewski X-Patchwork-Id: 10876697 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 05208922 for ; Fri, 29 Mar 2019 09:33:52 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E4D0E290C6 for ; Fri, 29 Mar 2019 09:33:51 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D91D8290CF; Fri, 29 Mar 2019 09:33:51 +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 77D4A290C6 for ; Fri, 29 Mar 2019 09:33:51 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728831AbfC2Jdt (ORCPT ); Fri, 29 Mar 2019 05:33:49 -0400 Received: from mail-wm1-f67.google.com ([209.85.128.67]:38900 "EHLO mail-wm1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728804AbfC2Jds (ORCPT ); Fri, 29 Mar 2019 05:33:48 -0400 Received: by mail-wm1-f67.google.com with SMTP id w15so1957031wmc.3 for ; Fri, 29 Mar 2019 02:33:47 -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=JM1IFJaq9Fzy9jb7gkxjcG7uHNdo0C9cZXORwZYID2s=; b=D0JHjConPyyO0cRxQv1PUTZqVI3WTeq57J3FAP2XyHi2rJUUNI5ZC5L7oc/E6tlcJN pKNHgYGDM1aPFyKvAHOx5g33iVr1PTs45fCR7PCDPkoMwaK3YfH7RUk2J3PBNkEA4rBx sYENWcWooDcJodHMYVS5WMlwCz84djynJF+xtLKkE856uw5WapRrfx8t5I/axUlT05el Z28geVAWnsVKjM6IiysviN72ZTQI5oAQAAgMrm8iM9YB/HhM7CiR+4s/ZaZHhKAFbuf/ Gajlg7u54ny33L+HlpaZvMnZhVpGiBVJahmZS8Qsum5UFEK40GnEuuS3GpBfj74Ty3x+ hdng== 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=JM1IFJaq9Fzy9jb7gkxjcG7uHNdo0C9cZXORwZYID2s=; b=hMPMXgWYtE3q79HbROLuYrklmsHECoHkYkqHrrMVBfIFuMhVaWx3JNC8YgiHHYJUZ9 pMViVFoLn9+W82hn7naw+GDrry/VmFnosHoGnNl5IOORE3JoWL69s25UWtsBKlT4tZJ2 Jjno9ZkYfqs/c+gJNUWKYpdCd7+wLA0O8XeHrdNWHjJExmICxHs3N9vTLlTwPHxGapmd TKqPG1gqOwBRQ9E/NeQdzF70qyhH9SvUbUoCLPvJstqB7mJWSCplQDIf1hNJEPvrjLsN ligA2T+KRee9nb6sm2May45PbKZN+t1AEtusxN+SdtzZv+OJtmpipJ4fevOsfO0zJX5K cTvw== X-Gm-Message-State: APjAAAV7HtAIzELr7gGQRa9eTPsQUMouODHZi+Du/ESzBfOI8xN0QImu DxZRxLCv8S2t14zGzqJ79fEY1g== X-Google-Smtp-Source: APXvYqxBhAX2VClwpi4aYDKKs3DFdRs9olKE3HhUScClXiKL60lGO7CW7XC2L6AlxrsLRV/60+rvBw== X-Received: by 2002:a1c:f115:: with SMTP id p21mr3028614wmh.93.1553852026829; Fri, 29 Mar 2019 02:33:46 -0700 (PDT) Received: from localhost.localdomain (aputeaux-684-1-29-77.w90-86.abo.wanadoo.fr. [90.86.254.77]) by smtp.gmail.com with ESMTPSA id s12sm1957125wmj.42.2019.03.29.02.33.45 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 29 Mar 2019 02:33:46 -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 v2 4/6] ARM: davinci: omapl138-hawk: add a fixed regulator for ohci-da8xx Date: Fri, 29 Mar 2019 10:33:32 +0100 Message-Id: <20190329093334.3885-5-brgl@bgdev.pl> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190329093334.3885-1-brgl@bgdev.pl> References: <20190329093334.3885-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..0039b4d4c935 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 = 1, + .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.1", + .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 Fri Mar 29 09:33:33 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bartosz Golaszewski X-Patchwork-Id: 10876703 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 D29E61575 for ; Fri, 29 Mar 2019 09:34:05 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id BD403290C6 for ; Fri, 29 Mar 2019 09:34:05 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B05B629100; Fri, 29 Mar 2019 09:34:05 +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 42459290C6 for ; Fri, 29 Mar 2019 09:34:05 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728818AbfC2JeE (ORCPT ); Fri, 29 Mar 2019 05:34:04 -0400 Received: from mail-wr1-f66.google.com ([209.85.221.66]:33270 "EHLO mail-wr1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728824AbfC2Jdt (ORCPT ); Fri, 29 Mar 2019 05:33:49 -0400 Received: by mail-wr1-f66.google.com with SMTP id q1so1745846wrp.0 for ; Fri, 29 Mar 2019 02:33:48 -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=LbCGKRK2X1xPLdacL1xB8HrW5AVjZ0KwD0ifnHHdo+g=; b=iXnzMUAbcdao3LV0SCIWLlFt13jR8QGk+hMydpXfSkXJxiCsmrH8Mwys7RmZd8DPPg U8UdLbiJbouQI+10MCIO0al7cvmezfM+euBlKqPg5Iz+EemT8qvo0OuXJPsa6LyEUHrY JEN0GyEVwstJJxTWyuwys8W9ZCY6ai8JgeyJOWYlfgAV0HJFXpNMG8hHe4VOTMnqg+Oc Pa3dpsYguhAPCzmQaURjD/JrCZRxwrpf6BeyLpI7NVyP+c6xj5j9AMZm0hf32eI73w/d dqZxKPeFbYA6Bg9OxrLuyHmj9bfGFUbfjSF8OCc3zmX0YRWcKS3eZNm/yH/ae6g3Df+y oLYQ== 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=LbCGKRK2X1xPLdacL1xB8HrW5AVjZ0KwD0ifnHHdo+g=; b=at1uIrTSYepTWad8ntAyzQ2EG+NIQWIthJUUbdD01Vlhyx7oiwUL3755tocESx7CWp /Cs+KsXbOFDfkH2RT5Q3BSlMC2sc0+94OB1MGDFf6xCFe2ZoU0eYsk6A5UuTI0gYbPI9 +AOr50pajoruq4gpCem4w6hx2l5YogHhCwVfHIcL9yWHYLS+3kqJ0khCBL8AARssPa+i LxjMQq79DVXmjsu6mSDOpRbXdbp/Gy41U/BnS4lzZIMfncy+rKguLrGFljXVjt3ed1Y+ ambqmxbOIbSAUoVc3wAwy1na9sZ2izVmrTIkK0xB6MmQ3kGy4oGF+sSu0n01C6wmIu1w 95og== X-Gm-Message-State: APjAAAVkQsdcdoRxEX/2MBS51PuBiBNKWLD6Qnpv9BXuQ/TShuvugrVT ouWIWBNcE5fe6JRG4VHgclHecA== X-Google-Smtp-Source: APXvYqyQR9UvO6TWHtcUrh4IiHTJ7pi8WetsR42Ox4VYCAjcb/5UecHqkFGawyhYmd0frxyujftF8A== X-Received: by 2002:adf:cc85:: with SMTP id p5mr9510456wrj.101.1553852028108; Fri, 29 Mar 2019 02:33:48 -0700 (PDT) Received: from localhost.localdomain (aputeaux-684-1-29-77.w90-86.abo.wanadoo.fr. [90.86.254.77]) by smtp.gmail.com with ESMTPSA id s12sm1957125wmj.42.2019.03.29.02.33.46 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 29 Mar 2019 02:33:47 -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 v2 5/6] ARM: davinci: da830-evm: add a fixed regulator for ohci-da8xx Date: Fri, 29 Mar 2019 10:33:33 +0100 Message-Id: <20190329093334.3885-6-brgl@bgdev.pl> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190329093334.3885-1-brgl@bgdev.pl> References: <20190329093334.3885-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..6caf50bb92c9 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 = 1, + .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.1", + .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 Fri Mar 29 09:33:34 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bartosz Golaszewski X-Patchwork-Id: 10876701 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 344A81575 for ; Fri, 29 Mar 2019 09:33:59 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1F865290C6 for ; Fri, 29 Mar 2019 09:33:59 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 1416C290CF; Fri, 29 Mar 2019 09:33:59 +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 AF55F290C6 for ; Fri, 29 Mar 2019 09:33:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728782AbfC2Jdv (ORCPT ); Fri, 29 Mar 2019 05:33:51 -0400 Received: from mail-wr1-f65.google.com ([209.85.221.65]:36408 "EHLO mail-wr1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728804AbfC2Jdu (ORCPT ); Fri, 29 Mar 2019 05:33:50 -0400 Received: by mail-wr1-f65.google.com with SMTP id y13so1727050wrd.3 for ; Fri, 29 Mar 2019 02:33:49 -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=GP71nrEz2X3rw8lQrVpt+CoiTCN65NyK/tNcu9jk+HM=; b=dPoePFfuN4kBvyabdGTpC3H2E0TFZ2RIh1sUkDEajwe6gyeyIDKQCtj6SBh8WBjg6q 9g8yAQ7YtC5Zphy68e/UDohmEh50c8yrmgICTE+52kGMLdSKtvCvDqO3Yv5tK/vpMNK8 XNDR9sXOVasozdiRyAiu6+lo++5VdekKialK3tsX17V1Bi/PruMptVBl3UkO9KZbAdGW o3Rm3HEJP43/vPD9T1ODdryZduS7xTX7lZ2V3+LBExU6/Ny6JUE6hbju0+UFq4rVsoEb NS6qHudSnnvDnZjsJBSrZksEUhbmH/X6JVDfb8gafgMAVKxiRTdpvt1z0JsyGiZ9dmq0 a3qg== 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=GP71nrEz2X3rw8lQrVpt+CoiTCN65NyK/tNcu9jk+HM=; b=UhmQ1YbU55DuTcDzpXo6Gxj4Yp4U5WbfhXgYpAkKJTy49U0slmv/MpnS9LK8IXfPrd sgRvjHf2CZorb/qp0iLSCzKRaVSq0Rk6/MoldoX6T+ptdvwSX2zihLFmMdn0NpyjDuw8 0xZROAWQ4ZnTOyUviPrqrmF+bFzUd55m6uCr4l5/itSsK9pNN8NeWImKmnjwKussr8sY 3//XmtHa/GsiCXwKd3PxVAwDmM+2GU6hb/kotBmlFqxnhZGxBxngQQ+U7cW8yxspDv3c uJUlGvOW0WbkRvXy5Mse//UQ2kRx7wXWXhdeozDoCpkcD+AK/cHWmIbCf4CzsB5QLFEq Crdg== X-Gm-Message-State: APjAAAVJvUbet+tPlaAXcGCjRNAqJS09HlS6GrfXQJKWnLjYWK2nFnUH Jue86QdA/oYDTWDOVFcqjrJ1Kg== X-Google-Smtp-Source: APXvYqx2tOQhgDugwDc3oTfArC3GBendxfodPg6UHJto8zVnrsKrIOmsARKO7o8B0TARyoTapdtG5A== X-Received: by 2002:adf:fc0b:: with SMTP id i11mr31002027wrr.145.1553852029302; Fri, 29 Mar 2019 02:33:49 -0700 (PDT) Received: from localhost.localdomain (aputeaux-684-1-29-77.w90-86.abo.wanadoo.fr. [90.86.254.77]) by smtp.gmail.com with ESMTPSA id s12sm1957125wmj.42.2019.03.29.02.33.48 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 29 Mar 2019 02:33:48 -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 v2 6/6] usb: ohci-da8xx: drop the vbus GPIO Date: Fri, 29 Mar 2019 10:33:34 +0100 Message-Id: <20190329093334.3885-7-brgl@bgdev.pl> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190329093334.3885-1-brgl@bgdev.pl> References: <20190329093334.3885-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 --- 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 35eb2cb96a8f..ef27f9126cca 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; @@ -207,9 +195,7 @@ static irqreturn_t ohci_da8xx_oc_handler(int irq, void *data) struct da8xx_ohci_hcd *da8xx_ohci = data; if (gpiod_get_value(da8xx_ohci->oc_gpio)) { - if (da8xx_ohci->vbus_gpio) - gpiod_set_value(da8xx_ohci->vbus_gpio, 0); - else if (da8xx_ohci->vbus_reg) + if (da8xx_ohci->vbus_reg) return IRQ_WAKE_THREAD; } @@ -437,11 +423,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;