From patchwork Tue Mar 26 15:57:26 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bartosz Golaszewski X-Patchwork-Id: 10871473 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 953C413B5 for ; Tue, 26 Mar 2019 15:57:51 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 80748285CD for ; Tue, 26 Mar 2019 15:57:51 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 741CF28AE1; Tue, 26 Mar 2019 15:57: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 0E036285CD for ; Tue, 26 Mar 2019 15:57:51 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731613AbfCZP5j (ORCPT ); Tue, 26 Mar 2019 11:57:39 -0400 Received: from mail-wr1-f68.google.com ([209.85.221.68]:46773 "EHLO mail-wr1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726177AbfCZP5i (ORCPT ); Tue, 26 Mar 2019 11:57:38 -0400 Received: by mail-wr1-f68.google.com with SMTP id o1so14958438wrs.13 for ; Tue, 26 Mar 2019 08:57:37 -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=6RoQu7lKq5HUjsOpqb5VBB45JH3hBOA4zTqWoTxIGD0=; b=2AHMFk/nV5es0CsmlQNEAIl+UXjXuD9BY51qYWm4ehk9X8dG1QUsoNCAXpMvlhH7Yf IN5YEtJVEBJfAUOj69n6pKbfvWQKkf+zgH78/S+OXP7aL5vS+rVnXVaEAlpe22TZMwjh oIA+xxnD09PC1d7gp7X/fJzWrb1AMAtBHgtzTtdYOO0gXAX8FQv/kXiXxgHh/1LqRKSa pKd+xwZqf6SVmOt/B42PXgO/2/fVML/+pCAdpTdozi90nJxPzhlXTXaTDpI0Gauj0AEd HX6AvkpZFtqrfhzFw0K3UJPbZcZjitIKe2xPxJ6ItfyseU7XMHkqe6jjG4q/b8lBn81K KUbA== 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=6RoQu7lKq5HUjsOpqb5VBB45JH3hBOA4zTqWoTxIGD0=; b=t36/iXG9ou2/powcDkXBpC/XH5wJMc4/R3rKp4FmxibMgsER0J36GkHlPJVyB1lJ5z /ZxJsvmmLZqhjX8jzR5ZurikjSMC4av/wIXdAeM5KfrCfV+rHBaDOGoZ9OKtPSh+3lyE /0NZJOH2h8wh+rQaKwoV4w8x2njHZpTK6oNj0CPx18W/gSMq7ra9IeLaVQSWbMyzpCel 1u2wrdgdRIibQTjK6g6Zk0tKXva6E5LQOij7llJGzmQVCxBfDNh324nmxNax2/06phoB htSsutafhWakZV945TnDqhR5Rc4rTcVSGNdFGFqoC/jzhxeO8fUpJgmrQBt9qJrK5sDY dZoQ== X-Gm-Message-State: APjAAAW0RQhPby0Ha/mmVV/s5P5qQ6NBh5Quv3IqrrWE7FVrzH0RfCYj 1Gbhy9FJWW4TzwA/FwWxwxlM1A== X-Google-Smtp-Source: APXvYqxMZQ2CgaEn9VNAFmSYHng/qFDULpwN5xe6U1SLeQ53mxYaRXuNmHztd/kqbirFZBDJVE2lzg== X-Received: by 2002:a5d:5190:: with SMTP id k16mr2329572wrv.10.1553615856848; Tue, 26 Mar 2019 08:57:36 -0700 (PDT) Received: from debian-brgl.home ([2a01:cb1d:af:5b00:6d6c:8493:1ab5:dad7]) by smtp.gmail.com with ESMTPSA id 204sm28522999wmc.1.2019.03.26.08.57.35 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 26 Mar 2019 08:57:36 -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 1/3] ARM: davinci: omapl138-hawk: add a fixed regulator for ohci-da8xx Date: Tue, 26 Mar 2019 16:57:26 +0100 Message-Id: <20190326155728.5432-2-brgl@bgdev.pl> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190326155728.5432-1-brgl@bgdev.pl> References: <20190326155728.5432-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 | 48 +++++++++++++++++++-- 1 file changed, 45 insertions(+), 3 deletions(-) diff --git a/arch/arm/mach-davinci/board-omapl138-hawk.c b/arch/arm/mach-davinci/board-omapl138-hawk.c index 0896af2bed24..ea7110e47e8a 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,14 +299,48 @@ 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 */ @@ -326,12 +361,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 Mar 26 15:57:27 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bartosz Golaszewski X-Patchwork-Id: 10871469 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 9BCD01575 for ; Tue, 26 Mar 2019 15:57:43 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 84E0128435 for ; Tue, 26 Mar 2019 15:57:43 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 7934B2858F; Tue, 26 Mar 2019 15:57:43 +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 C777528435 for ; Tue, 26 Mar 2019 15:57:42 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731782AbfCZP5l (ORCPT ); Tue, 26 Mar 2019 11:57:41 -0400 Received: from mail-wr1-f67.google.com ([209.85.221.67]:43476 "EHLO mail-wr1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726277AbfCZP5k (ORCPT ); Tue, 26 Mar 2019 11:57:40 -0400 Received: by mail-wr1-f67.google.com with SMTP id k17so7045153wrx.10 for ; Tue, 26 Mar 2019 08:57:38 -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=Fi53ij1K/FV0HXXK08Smgt19lpbi7fcy/SCdbK/jhdY=; b=OrEKiMg+9Ou8/jDznyyH/U1jZPDJT7dDsPHu5jqDLpg25175m5U4qLuDHHjGIwv6Gu tfbKNt2UuI55ydlK47FM2dKOovk1vgzZoth2pEaGyL6ewUTUPMVI6aYQt+sASC5iXSbE aE0Qt1UbdH9WVtBtURoecs9HJBrmdBy5aIc/xnYlDxwxnsIr1CUvJ91IZXuY5rlyC3zK CCCEmiG31EHlcT+qkjuesday19DM6nb1vxMhbnlnRZegKgRohm9EOWQ4z/NPtWt5+i6x 83tX7Fz1jaWIuzDiCNzEtclKqX6s04O4ZCUwHz9PTeihgISS5AQMcvE7wsd/d2zlLQg9 2Hfw== 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=Fi53ij1K/FV0HXXK08Smgt19lpbi7fcy/SCdbK/jhdY=; b=Jh4UffwTRVJCTBf7mvut7giABkS53VD8OSrH4yRhSWrycOwYZ0w8l1k1wlHNPk2SDH f9neoLiWjicSo2GClSgbc/AldnFqU4xbJqpxfysy8jPDQRENtxiwqw1Lg5PaFZXX9qis Av6GKK58rZeWoj7xTZ5zBw6T0J6syk4AeBFbvslidpoAWLw4/okVz+e/4ZghXabfzUBb 7CDTfowHV0NF0JPxlWRfH+yybUPRxpk1yzlG2LBhq3VAdqIXA5TM96xvHmA53VrckerM ZVJuCh8WASkbAi/4sVi8/WswgeeAsVT20cTxaD1cGfNc2TCVI1+zyY4NrrSJThPNdBoF M2ug== X-Gm-Message-State: APjAAAVnaX1ub8u7O5qvXCzJL/t1kvPuY8NjeecTeY/qaGfwE1DZEeHB WF7qOjYMAS2Br3fS+FdTxxaWJQ== X-Google-Smtp-Source: APXvYqzhrAPxJruRDv7MCyTAjE/yvjaZbO0Ofuanv/eh0AwxC1c/i4MCwEQM7vjvH08MsIdaVWFLgw== X-Received: by 2002:adf:eb84:: with SMTP id t4mr21459803wrn.100.1553615858033; Tue, 26 Mar 2019 08:57:38 -0700 (PDT) Received: from debian-brgl.home ([2a01:cb1d:af:5b00:6d6c:8493:1ab5:dad7]) by smtp.gmail.com with ESMTPSA id 204sm28522999wmc.1.2019.03.26.08.57.36 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 26 Mar 2019 08:57:37 -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 2/3] ARM: davinci: da830-evm: add a fixed regulator for ohci-da8xx Date: Tue, 26 Mar 2019 16:57:27 +0100 Message-Id: <20190326155728.5432-3-brgl@bgdev.pl> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190326155728.5432-1-brgl@bgdev.pl> References: <20190326155728.5432-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 | 48 +++++++++++++++++++++++-- 1 file changed, 45 insertions(+), 3 deletions(-) diff --git a/arch/arm/mach-davinci/board-da830-evm.c b/arch/arm/mach-davinci/board-da830-evm.c index ff097ecfa451..2ae1eff54345 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,14 +54,48 @@ 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 */ @@ -75,6 +110,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", @@ -100,7 +138,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 Mar 26 15:57:28 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bartosz Golaszewski X-Patchwork-Id: 10871475 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 C8D8F1575 for ; Tue, 26 Mar 2019 15:57:52 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B25092858F for ; Tue, 26 Mar 2019 15:57:52 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A42BD285DA; Tue, 26 Mar 2019 15:57:52 +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 0F38A2858F for ; Tue, 26 Mar 2019 15:57:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731599AbfCZP5s (ORCPT ); Tue, 26 Mar 2019 11:57:48 -0400 Received: from mail-wr1-f67.google.com ([209.85.221.67]:41087 "EHLO mail-wr1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731570AbfCZP5k (ORCPT ); Tue, 26 Mar 2019 11:57:40 -0400 Received: by mail-wr1-f67.google.com with SMTP id r4so7304757wrq.8 for ; Tue, 26 Mar 2019 08:57:39 -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=oFSbPR6gZ80NJT0kvphV1uF3Ic6xnPJohJygHS7zRgQ=; b=aOyyfHUdTD+0/C9sDYB9DC3OSZ8vRYaurmgBJITGhusdwLsJ+dzzvg8NJz9IDzsEKa DPDRv1KfS3coVpzetOLZg95go1aCY7GmwKWqc31K3ocNQGJepodvoncJjGWy06H4kcYp 9Gb71Rqh5Jzcn6fNi7A9BMsmFFNtDoUO2m6b2YMHBLlGa66B3BQCm5EtYI7BtytV5tD/ 3SyhpzCfA0ggyUSgzWpQO6TxliKpXsB0t+jOoFREzmuzEpLMHsWAp5i4fDxYVyutvgCB xpWXqq/4SvYmGf02ysXCWU12RYuHrRr+qaZiSDwOXAWrdm/3XrIn00HOcdMfIjXCk34q IoOw== 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=oFSbPR6gZ80NJT0kvphV1uF3Ic6xnPJohJygHS7zRgQ=; b=KqMFUIkY8hc9iMqEDrIWWZO5PbMSDm8gqpDKPovuvUXqtg5J6Vklew9ukuQ7gYx5px /8wODxFB9wzO+/86mnerBPI/ZL8RIjn2DMNCPPI0YR7T0hOjsVL/UfoEaXm3eURbXRag MBrqIr6njVh7BdWdAGKa6TbwIeQAUqlZYY9cGLfQyPlHMXcJpGy3mvI2Ubb6zzuFTKnd q1pp3rBJycD8JT9UtJMcAR4w9wZOrc9e7Z9qJC8kYa0CWH0ddbR5bX63k++OdadA+b+J U17Ddv46tdYUKbm5wn9t/QBYMKcDk+c1VBZt86X1Ka9orQrMGrYGyl3wNez28rUrSouy n1AA== X-Gm-Message-State: APjAAAW3SzFJRjBIHL5shivlajpB3wPDfB8r97hvkoPkgL3hok4EQVd0 rSjpUub1174loLaUp6eh15jmzQ== X-Google-Smtp-Source: APXvYqyOFnJbEHiLStnWxm6A9moQpJBYz65AYo7mBV9PirflEkXMHvaAZxVw5xKdY8jUrFUkgHxdVA== X-Received: by 2002:adf:f8c1:: with SMTP id f1mr21129403wrq.151.1553615859235; Tue, 26 Mar 2019 08:57:39 -0700 (PDT) Received: from debian-brgl.home ([2a01:cb1d:af:5b00:6d6c:8493:1ab5:dad7]) by smtp.gmail.com with ESMTPSA id 204sm28522999wmc.1.2019.03.26.08.57.38 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 26 Mar 2019 08:57:38 -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 3/3] usb: ohci-da8xx: drop the vbus GPIO Date: Tue, 26 Mar 2019 16:57:28 +0100 Message-Id: <20190326155728.5432-4-brgl@bgdev.pl> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190326155728.5432-1-brgl@bgdev.pl> References: <20190326155728.5432-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. We need to modify the over-current interrupt handler to use a threaded irq as we cannot disable a regulator from interrupt context. Signed-off-by: Bartosz Golaszewski --- drivers/usb/host/ohci-da8xx.c | 39 ++++++++++++++++------------------- 1 file changed, 18 insertions(+), 21 deletions(-) diff --git a/drivers/usb/host/ohci-da8xx.c b/drivers/usb/host/ohci-da8xx.c index ca8a94f15ac0..f3892034de58 100644 --- a/drivers/usb/host/ohci-da8xx.c +++ b/drivers/usb/host/ohci-da8xx.c @@ -41,7 +41,6 @@ struct da8xx_ohci_hcd { struct regulator *vbus_reg; struct notifier_block nb; unsigned int reg_enabled; - struct gpio_desc *vbus_gpio; struct gpio_desc *oc_gpio; }; @@ -92,11 +91,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; @@ -124,9 +118,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); @@ -159,9 +150,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; @@ -211,7 +199,16 @@ 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); + 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; + + regulator_disable(da8xx_ohci->vbus_reg); return IRQ_HANDLED; } @@ -424,11 +421,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; @@ -438,9 +430,14 @@ 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; }