From patchwork Fri Apr 12 12:36:35 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bartosz Golaszewski X-Patchwork-Id: 10898151 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 C7FF9922 for ; Fri, 12 Apr 2019 12:37:10 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id AA9D728D12 for ; Fri, 12 Apr 2019 12:37:10 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 9C52028D1B; Fri, 12 Apr 2019 12:37:10 +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 3739B28D12 for ; Fri, 12 Apr 2019 12:37:10 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728428AbfDLMgs (ORCPT ); Fri, 12 Apr 2019 08:36:48 -0400 Received: from mail-wm1-f67.google.com ([209.85.128.67]:33581 "EHLO mail-wm1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727529AbfDLMgq (ORCPT ); Fri, 12 Apr 2019 08:36:46 -0400 Received: by mail-wm1-f67.google.com with SMTP id z6so378200wmi.0 for ; Fri, 12 Apr 2019 05:36: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=45dzSBv6+V3bbvrapzfFB+qo0X2yeBTBy+CINkubKnc=; b=w4GD472KWldp0hHPg/Ps3G2W0jAvjWrj8BsmHNXWZg1xxBXbkfvw6xjfIUurXJ0nEj Q5PYxpgBwOPARJ2B/iOqLjbIfL6CvLFovFvge6SqXCeOISseeXxoejNluTO4E90ViDPF psx1VNo+s7x6nt+rXC7R/GbKIlQ09CCr6nTyY5CIGRbCO6w4Dqu6e3BvPUHuJXKhOuiu cBAEBtjO9NQEUqnDdSmEGXdBnsd+b2oyrdqojVGjZD4XALlwgOS2rGak2AFRyDrYui8x +Tz3h9dDL8LLc4ZCL+JnTx2d3k7R+f/ePhzGN4buShs4pF7091uMECgGujONpSsh0iRT fxlw== 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=V6g2Q6VPMq0iWHFYX3DM5Sn2tuvBMwwWOPaqpJ/uYvtIe9WrgT51eOXkciRO+CbVO5 LCFhTRQ8YyRy9ly6DgVF1YR1TBDbYK8/490PuPX/nTkHzlihJsJ8anN6s1LFarAaS14l xOdMAOxsG2bfe4jVXC8679QdQXeNsjvMGs0yFEqvEfjCybXO2Q/zhgtqrDJxclxekPUa VMXwCZwedb9/QM/KPa/Ds6wA9fg8Zo7RYH3shm8wCnEd3LeMU79n72/VJ9OBY+ag7jKV sq905WqxhcccGR6d5RXg5YTLM9yEGT/DHMPUUPodTKG9tKjwn5wKOpOxER8CCVw4tgIw Hdnw== X-Gm-Message-State: APjAAAUImv7m+7KnkvlftW7jOSqPsWrUXzUCmbZVxfMzZNrO5tGLYZWm M52gRy8dicRUXHvXWN1s0oU95Q== X-Google-Smtp-Source: APXvYqxX06KYCK4XB+Q+dqBWHaGwF6Mn33wY15Ntow3Vhc7yA950/dHiUaR1ywcqfgBGH5OLJHhEWw== X-Received: by 2002:a1c:e904:: with SMTP id q4mr10822003wmc.43.1555072604648; Fri, 12 Apr 2019 05:36:44 -0700 (PDT) Received: from localhost.localdomain (aputeaux-684-1-35-248.w90-86.abo.wanadoo.fr. [90.86.90.248]) by smtp.gmail.com with ESMTPSA id v190sm12384030wme.18.2019.04.12.05.36.43 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 12 Apr 2019 05:36: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 v5 1/6] ARM: davinci: add missing sentinels to GPIO lookup tables Date: Fri, 12 Apr 2019 14:36:35 +0200 Message-Id: <20190412123640.11437-2-brgl@bgdev.pl> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190412123640.11437-1-brgl@bgdev.pl> References: <20190412123640.11437-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 Fri Apr 12 12:36:36 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bartosz Golaszewski X-Patchwork-Id: 10898159 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 4676B1515 for ; Fri, 12 Apr 2019 12:37:17 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 23E8128D12 for ; Fri, 12 Apr 2019 12:37:17 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 18B2D28D1B; Fri, 12 Apr 2019 12:37:17 +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 9B63B28D12 for ; Fri, 12 Apr 2019 12:37:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728355AbfDLMgs (ORCPT ); Fri, 12 Apr 2019 08:36:48 -0400 Received: from mail-wm1-f66.google.com ([209.85.128.66]:39405 "EHLO mail-wm1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727958AbfDLMgr (ORCPT ); Fri, 12 Apr 2019 08:36:47 -0400 Received: by mail-wm1-f66.google.com with SMTP id n25so10821924wmk.4 for ; Fri, 12 Apr 2019 05:36: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=joOQiQILwSUQpc0pTrHcK/ya5VvWQmcmFsscTsVp5Yw=; b=ZzNHNCwB2MHMWsVsm62DVxQ40e64KQJi/5XS/zJI3Rjuz6UiIQiQMIUYlicxAUcMyR wRQ2JIBoVs7/ncCvHJ8+S+E26InWJTkutfL6OgVcBXzDapJNRwkL6ud3lxmQO4+sVf4U yrD+9EoL68IteFtZqS3XoRyLkBvfZRS5hkK3azO7M0CKgRK+VNnHorMzdE0bDI76P7kf SZkyMPqvWdXwelb9aV+hp3POKqHftBQGR1+CLlP3EWsRrn86DrGUe2IkOYctdhH88lEH Sg149a9nAHReBS9/uCKfoRyPgwqhxf4H+pCB/ty922D4QH/Nt4/GLMfK1INdKe7RXtD5 xnPg== 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=joOQiQILwSUQpc0pTrHcK/ya5VvWQmcmFsscTsVp5Yw=; b=cpkU3I0vA8+9aF6WG2eLJXmWTBbErh0n0Gx6PWilHVuw1Rmjja/yjI5eRlUC0vBylz Qg82RPsNElhuxWR5PdOju5CYVEYzIMt+PRcGqWnOycBb2pAEkxVX5ISlAhFzakGME2WZ 6uM4QJCuCHwtwue8z8cJpr2rJdVVQ+BhZaLNV1C6xKc2LTTXTde0KvPpLsSr8WUZ289s 9FuTJSiUlT7iFwBugj+WOQqDmAKeBO5D7BzhrDZvmveHlUlIb5k9ME8zldc4fahh+O1b jelkMTfv66p8BL1cAzR5ZJmTWRJLs4cVmrZ1+8aabUJb+jG3G626LENesNupqNjTiz1+ /zJQ== X-Gm-Message-State: APjAAAXVxDgRHsOS91R4Hy2QBKPnTR2KIGlh/cucB+AMMidHMq86YnFh +Lk5YOgy62+iuC4wMkmQH0yZ0Q== X-Google-Smtp-Source: APXvYqyElSWkpRR37KwhB8kBDZhyovKNUnSkJGF/0UvOx0kMpkjnAmtwpkNmPmgtdNBA9lHMZWqVSg== X-Received: by 2002:a1c:1a4d:: with SMTP id a74mr11089006wma.50.1555072605753; Fri, 12 Apr 2019 05:36:45 -0700 (PDT) Received: from localhost.localdomain (aputeaux-684-1-35-248.w90-86.abo.wanadoo.fr. [90.86.90.248]) by smtp.gmail.com with ESMTPSA id v190sm12384030wme.18.2019.04.12.05.36.44 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 12 Apr 2019 05:36:45 -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 v5 2/6] usb: ohci-da8xx: let the regulator framework keep track of use count Date: Fri, 12 Apr 2019 14:36:36 +0200 Message-Id: <20190412123640.11437-3-brgl@bgdev.pl> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190412123640.11437-1-brgl@bgdev.pl> References: <20190412123640.11437-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..209a262b5565 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 { 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 Apr 12 12:36:37 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bartosz Golaszewski X-Patchwork-Id: 10898155 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 5C4AA922 for ; Fri, 12 Apr 2019 12:37:15 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3AE0D28D12 for ; Fri, 12 Apr 2019 12:37:15 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 2F6B928D1B; Fri, 12 Apr 2019 12:37:15 +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 C050B28D12 for ; Fri, 12 Apr 2019 12:37:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728665AbfDLMhJ (ORCPT ); Fri, 12 Apr 2019 08:37:09 -0400 Received: from mail-wm1-f66.google.com ([209.85.128.66]:36653 "EHLO mail-wm1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727497AbfDLMgs (ORCPT ); Fri, 12 Apr 2019 08:36:48 -0400 Received: by mail-wm1-f66.google.com with SMTP id h18so10835232wml.1 for ; Fri, 12 Apr 2019 05:36: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=OmZNDj/ROqmmydwLVfrSm5YpHHAqTHz5p0ofV4c+h88=; b=hgQLpCvyQWkGA2+C2SVC+yttOyqCs79IPSMazHMDa5D/84A9fokZ/J6nVKCozEc+d/ 1wn1YKFAmx3OMtjLtetWgWH3h9ZRDkowGbxcMxoWdgx9zZlyfS7PvfBY3KKXcM5yHmEU 7Nn65q9oRScO4qvbKi+HN2z5+PmH5mIzDZXfjcIqlul6bL9tdn+zrpu1lTVSgyaebUsI eJV2MjdxrBWTyLiMkQEJEj6FZV2t2One7G5SE/y0sjcstKtjupUgdhryil3RSNKAfRAG xIKrlA0oe450dJNe1BD79oWMG7wzq8gs0XrB130U127+8Gej98UNSFNEeEsGwBjsf652 J6CA== 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=OmZNDj/ROqmmydwLVfrSm5YpHHAqTHz5p0ofV4c+h88=; b=XiXnCs5cPmMHR06P0Al1y8yhOA/nOz8JGjOxgeJMGu6uNxSMhMWr/JMC+NF8KoVxVg PrWBg+D+r6I1vuiL7xgvnX/2WmpDhRbKHQ3emgSWZsHHsae1RXAMXgcKgQ3uQES4vilo hderWlj1xBgNIkm2kMKFQnDVRD4YCGCQwczCAlBpxObtsLF20/fEqVZmVymE8GIo7emP eVD1Upqlv/Gzg1C1we81esPgo4P8LDLqjMVc6ISvRlMnv1CXBbPJimzDwRFbOF+mavf5 rHvLoxtP9bYQFOqypdNgDQXwAt6eaMvZglPIpuYpJHbHeYSl3EmgZZFmgHXQwos31n2p POYQ== X-Gm-Message-State: APjAAAWW1+i2cJBkf3u5z6I+ZoaSMgZj5RMebsC9Dg6XkAh9jB+THNC3 FNV5dNozeCaiY8yo33YbKK+7kw== X-Google-Smtp-Source: APXvYqwolTlOkBeqh0vywQsBopUex17ovDjGm26J7GwepQL2sUOHtRZs/QRwZB/kPFkyAVSqQrrnCw== X-Received: by 2002:a1c:7e8a:: with SMTP id z132mr11430786wmc.92.1555072606977; Fri, 12 Apr 2019 05:36:46 -0700 (PDT) Received: from localhost.localdomain (aputeaux-684-1-35-248.w90-86.abo.wanadoo.fr. [90.86.90.248]) by smtp.gmail.com with ESMTPSA id v190sm12384030wme.18.2019.04.12.05.36.45 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 12 Apr 2019 05:36: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 v5 3/6] usb: ohci-da8xx: disable the regulator if the overcurrent irq fired Date: Fri, 12 Apr 2019 14:36:37 +0200 Message-Id: <20190412123640.11437-4-brgl@bgdev.pl> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190412123640.11437-1-brgl@bgdev.pl> References: <20190412123640.11437-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 | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) diff --git a/drivers/usb/host/ohci-da8xx.c b/drivers/usb/host/ohci-da8xx.c index 209a262b5565..f69b339d45e5 100644 --- a/drivers/usb/host/ohci-da8xx.c +++ b/drivers/usb/host/ohci-da8xx.c @@ -202,12 +202,23 @@ 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 +445,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 Fri Apr 12 12:36:38 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bartosz Golaszewski X-Patchwork-Id: 10898141 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 D39EF922 for ; Fri, 12 Apr 2019 12:36:53 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B6E1A28D12 for ; Fri, 12 Apr 2019 12:36:53 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A855C28D1B; Fri, 12 Apr 2019 12:36:53 +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 42F6C28D12 for ; Fri, 12 Apr 2019 12:36:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728589AbfDLMgv (ORCPT ); Fri, 12 Apr 2019 08:36:51 -0400 Received: from mail-wm1-f66.google.com ([209.85.128.66]:39411 "EHLO mail-wm1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728479AbfDLMgu (ORCPT ); Fri, 12 Apr 2019 08:36:50 -0400 Received: by mail-wm1-f66.google.com with SMTP id n25so10822044wmk.4 for ; Fri, 12 Apr 2019 05:36: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=WkiOzqo+5E8+PTnExhJYSKG8TC17kxUDe5ZrFElD/ZE=; b=o8ep84Q2/ISktCjQUU+vyYVsFjv1uyAK6SwCYaD4jFPEo1k0bqeNPAX2jydpt0quHY bdNKR/nqe+T1MnRzAEgttYd8HKmhNU6RmqlSVrBFkF3Tuw0l03zBIUjHbg43TaV5Bclb LSZgulopBXIDgJMrb5b5UIBko9QP9OAbuYNHmFH8NO3bBAbI/mTQAO6m5neAmfWsoa4Q fMBh0U+4dVQn9lxZ5mzervhRl1oNb0j+HvJWs60pSM11dqXvjmxNPElY5dcp0ZlWTiRd sYmPyrrlZu/xWk2pKs7wnczZPF6P5kLTlH4bDO9xGuiZaEhXj733gUATOFKZD2W3qU+A /rtQ== 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=XuC0Phpxd8o/CU3AwfQ2pL3wbXztTc2R0zkmLL0hHFIBYhaeH5EXXNXD9wvTPfTRwU mHVaCKZvLxIItXv+Rq09z+rbm2Dftm469u9xkD4VAtkSbwmBb1HPWpvIfaIchM7Eq6ta PxeNzgVPIX/7VYyJj8fD+KIh/MW7Few7Q231opN4wO/oPBtAFEx1dFXiApcppRqtIcwZ lsabLOTC761v+AhBzB/TJyWQ4nOQKTQ5MIdiJUhXfAe2ZM1c/hfGdl1VE3BqwSICrlQo zI+QsAvi1UYv/A8Ujgy4fnsyW1kc9lm9aUpbmL/N6fiw2+B+1AvL2t5Pi5wIXkv9dIfl i1RA== X-Gm-Message-State: APjAAAU3PqPp/tGzyXprmdEzI/hLs27yj4bPMv3WisZTY9c4yYve0hiL eJ5rbgO+33Eeuuzie8re1RXeWw== X-Google-Smtp-Source: APXvYqzzQFHewKkSvNQ7QQk9hjqwJsoMiX45q4ONdF3ZP0biYEW/amEcQzL4GiM88Y5pcvpDlAVuKQ== X-Received: by 2002:a1c:730c:: with SMTP id d12mr11021693wmb.47.1555072608151; Fri, 12 Apr 2019 05:36:48 -0700 (PDT) Received: from localhost.localdomain (aputeaux-684-1-35-248.w90-86.abo.wanadoo.fr. [90.86.90.248]) by smtp.gmail.com with ESMTPSA id v190sm12384030wme.18.2019.04.12.05.36.47 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 12 Apr 2019 05:36: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 v5 4/6] ARM: davinci: omapl138-hawk: add a fixed regulator for ohci-da8xx Date: Fri, 12 Apr 2019 14:36:38 +0200 Message-Id: <20190412123640.11437-5-brgl@bgdev.pl> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190412123640.11437-1-brgl@bgdev.pl> References: <20190412123640.11437-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 Fri Apr 12 12:36:39 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bartosz Golaszewski X-Patchwork-Id: 10898143 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 819A11515 for ; Fri, 12 Apr 2019 12:36:57 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 62A2D28D12 for ; Fri, 12 Apr 2019 12:36:57 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 56B1928D1B; Fri, 12 Apr 2019 12:36:57 +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 DB82028D12 for ; Fri, 12 Apr 2019 12:36:56 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728624AbfDLMgw (ORCPT ); Fri, 12 Apr 2019 08:36:52 -0400 Received: from mail-wm1-f65.google.com ([209.85.128.65]:36656 "EHLO mail-wm1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728546AbfDLMgv (ORCPT ); Fri, 12 Apr 2019 08:36:51 -0400 Received: by mail-wm1-f65.google.com with SMTP id h18so10835373wml.1 for ; Fri, 12 Apr 2019 05:36: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=gyAH0wiE/i5zzvDeE8RjO1VQwB5hV38XLhGYRf7RuPY=; b=vfxJcimzZAf4jUdtnGeJKKAJI3aDV6ULLr6n9UB4lk1AaK7TdW+/i8ucVjrl3BGCe2 HVuXwQn1MV5+ML90el9EIJGSeOGyhhnk7M+Yr8i0ixB/bvCDyk3+DDBiXvhMiEKpBtbK R5jZx9NZmMHQUTkkW2/bOs5EYd6F5a4ujSI7v0krSAhiR2qnRGTHvJJCBpo7rLmeHJdu XqBKqraXUpgZ4yzoQofnb3gdhdwx9V3wN+mDrjXeny/zge5QuxvU1gT6nBFRhRNwMej7 YcmySxQzGKudb/QVF5DNY4YTL0OfxVhgMsJLM/my9wz+pJ6PvVUyPmxi9/bMAsdl20/3 /NUQ== 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=tIQ3BfVyi27XqVi00k38JY2VaHiSu8q7k4dTsXG3sz/f6rWE1GzqasbRhJpqz73XKW Ww0+S7kJI8ndnku4ekqFgQOHJe0oR/nh65Z2rtMqIsUYcL+1iBFNHG5IMJiW5PlPquQZ GlPe1WXoUH6alA2NZPQFTrL78v276qS24nMeX5l58dQc9ovKG52oDZ5crZp+NJJ7b+Xo T9BO0hA5nx0akFpgxbzJbkbTfV3hOnsumyGgvn9Ebm5wDb6w4QWCpaXzAZFfzwmfckAO NGpKP/boU9NUmFab8m9wP+BSB5TJsAHtckorpHURQw7/hLQKnGV03NAyUO/PZ3LPB+Ss I/LA== X-Gm-Message-State: APjAAAWF4YHDqaD0/QNF5n3NTcawVAuUs24Y5uXxSbgNghkF80n74GyJ ckWqn1xwfJBfjsWsWGz5/nMxkQ== X-Google-Smtp-Source: APXvYqzmKKSpUEDN0I3pJfNrQFrzgLeSvGY457OoNa770MDWpdG6X1KjuLcbp0dAm+2r9kmredz9eg== X-Received: by 2002:a1c:a9cb:: with SMTP id s194mr11337862wme.62.1555072609308; Fri, 12 Apr 2019 05:36:49 -0700 (PDT) Received: from localhost.localdomain (aputeaux-684-1-35-248.w90-86.abo.wanadoo.fr. [90.86.90.248]) by smtp.gmail.com with ESMTPSA id v190sm12384030wme.18.2019.04.12.05.36.48 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 12 Apr 2019 05:36: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 v5 5/6] ARM: davinci: da830-evm: add a fixed regulator for ohci-da8xx Date: Fri, 12 Apr 2019 14:36:39 +0200 Message-Id: <20190412123640.11437-6-brgl@bgdev.pl> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190412123640.11437-1-brgl@bgdev.pl> References: <20190412123640.11437-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 Fri Apr 12 12:36:40 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bartosz Golaszewski X-Patchwork-Id: 10898149 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 10967922 for ; Fri, 12 Apr 2019 12:37:04 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E308D28D12 for ; Fri, 12 Apr 2019 12:37:03 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D753D28D1B; Fri, 12 Apr 2019 12:37:03 +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 66CB528D12 for ; Fri, 12 Apr 2019 12:37:03 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728638AbfDLMg6 (ORCPT ); Fri, 12 Apr 2019 08:36:58 -0400 Received: from mail-wr1-f65.google.com ([209.85.221.65]:46934 "EHLO mail-wr1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728565AbfDLMgw (ORCPT ); Fri, 12 Apr 2019 08:36:52 -0400 Received: by mail-wr1-f65.google.com with SMTP id t17so11691351wrw.13 for ; Fri, 12 Apr 2019 05:36:51 -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=h/Q4Spim9Fjjy6MSB+oYYlQqYCUhED1m+pmPurYYc2Y=; b=YG7aeotx3icHw05FTScZXtz6eI0WzRmPR9r6FmonoBSpKAOTJdRkCgx5hYrJ4ueMTy 5jFE2sXMf9uyzDRvuLEzYgDWkJ4kXk6M3eIPBacFPpfE3nrH+0PjH6fRHsxA6p8iUpq2 NsEBllK/RvsUb0h2tR79J0X3h5918f7qm3OUWmjN1jfK7aWhJD3CX9+u4OJogs44XfU9 gLQ5pXtlIVpuVend1DdiQ9as/umwvNamToRP/2cAPtLCpat2QWYQqAwSw4ZzvjazMVo9 XHELA+ILZQuO3XfWbLq1KSP/ag+jz9r+AXXwUKElxgOCphUpxpA3hs4B+GyVwUcAE8z4 76cg== 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=h/Q4Spim9Fjjy6MSB+oYYlQqYCUhED1m+pmPurYYc2Y=; b=FdNetkJ0equYcBrpofaTvYwj7f41sb9C755CYZxmIugbhWtuPxUXUXio+QO30JpION k/lxKgxPpRU78jNKYLsIw7I87ZxOynVrzfX9/KKn5sdwfXqZYMv1R+SK9wMD8KCehKAa ttuBG/tVqTkwJDLj5VtH6Rd9YojdOiJ6VaxhLwiFcVQPxxBkLqEKT+ieqvkyUijVPo+X UpWK1hXyBfdyIx76mBPvtt/D0pjlBY52C4Y8Pyx4DrOW1hIRKgYjDRtQdHLgMfQGuIlz 2xzjdpGjHq/AeAF5KLbTa1+p4IuseysgjVwtvsH/SV7ftLHq2cepZ9RrSb889i2JnPBb IvYA== X-Gm-Message-State: APjAAAVzjOYNf2/wOdrzV0bDB2D3+HOhgNgqEAXrA7vZgwUKuK4qTikP IhI12sPrcigcRepaqfvjXdbGwg== X-Google-Smtp-Source: APXvYqxUp4JTFAHxNl36SNcbXMkjwbVgonN366UairP79cquPxow05ayhQbaEoIG/Mmfw/Uo1FkIAA== X-Received: by 2002:adf:f1ce:: with SMTP id z14mr35525249wro.152.1555072610418; Fri, 12 Apr 2019 05:36:50 -0700 (PDT) Received: from localhost.localdomain (aputeaux-684-1-35-248.w90-86.abo.wanadoo.fr. [90.86.90.248]) by smtp.gmail.com with ESMTPSA id v190sm12384030wme.18.2019.04.12.05.36.49 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 12 Apr 2019 05:36:49 -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 v5 6/6] usb: ohci-da8xx: drop the vbus GPIO Date: Fri, 12 Apr 2019 14:36:40 +0200 Message-Id: <20190412123640.11437-7-brgl@bgdev.pl> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190412123640.11437-1-brgl@bgdev.pl> References: <20190412123640.11437-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 | 32 +++++--------------------------- 1 file changed, 5 insertions(+), 27 deletions(-) diff --git a/drivers/usb/host/ohci-da8xx.c b/drivers/usb/host/ohci-da8xx.c index f69b339d45e5..38183ac438c6 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; @@ -208,16 +196,11 @@ static irqreturn_t ohci_da8xx_oc_thread(int irq, void *data) struct device *dev = da8xx_ohci->hcd->self.controller; 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) { - ret = regulator_disable(da8xx_ohci->vbus_reg); - if (ret) - dev_err(dev, - "Failed to disable regulator: %d\n", - ret); - } + if (gpiod_get_value_cansleep(da8xx_ohci->oc_gpio) && + 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; @@ -431,11 +414,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;