From patchwork Fri Mar 29 09:33: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: 10876695 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 9DFDD922 for ; Fri, 29 Mar 2019 09:33:45 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 88924290C6 for ; Fri, 29 Mar 2019 09:33:45 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 7C9D4290CF; Fri, 29 Mar 2019 09:33:45 +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 BC1F4290C6 for ; Fri, 29 Mar 2019 09:33:44 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728589AbfC2Jdn (ORCPT ); Fri, 29 Mar 2019 05:33:43 -0400 Received: from mail-wr1-f68.google.com ([209.85.221.68]:40725 "EHLO mail-wr1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727387AbfC2Jdn (ORCPT ); Fri, 29 Mar 2019 05:33:43 -0400 Received: by mail-wr1-f68.google.com with SMTP id h4so1698849wre.7 for ; Fri, 29 Mar 2019 02:33:42 -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:mime-version :content-transfer-encoding; bh=GpELJtW4fCVe+Ycfj/JyzEGzxyVdJh7lCZRF0JRDAmo=; b=StbL9jxfAYy2Dxev994vRr2jrp0QWEaYx4Q38Af7iiA6tnp8/u4/eJIcMCja5VxTcw M25dq5tUiv0KyBxRY2noBeBD6ua5st5yuLJAzGFnfF6gP8mOrkkDD5k6qXd6T5ORXyiF W6k3eAWsrrvg9mtq1tmmyd5J6MgKfH6R/CdDbSnoQNW/t6Awo/lMcuZOOOcyvpFq9E3O 9NnDacgcmIyBjlEH3tMIswPNtalwAgpv3QAMC92sH+1/eOsYxdRmkxw6vy18/gndwfXr LcYs5/Hl+4OotlZmudghUor9a++XZetTH8HTbDAdt9Tk7dMQ5z58Gn+lu1KuEfUqiPJW C/6Q== 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:mime-version :content-transfer-encoding; bh=GpELJtW4fCVe+Ycfj/JyzEGzxyVdJh7lCZRF0JRDAmo=; b=BqdhXB5VLwaUU19gdvCQn1alnnHf7mQFAO37hcrS2Y17zDk0GUxmjSvB2VMWU/9E+P YEglSW7Rf7gchz+CnN4YQn6FLpTDnkv8lCB13PyJrapp4fIeTLGCsm3+DxbzF5pCxGRb f9XnIKhjQUILo2e8+gIsdNE7Q3XZnL4xn1zE4viRfoU+xThvL0ZKBQ9k7U28cm52S2S4 bzpVPJeNiAuFvn8J/Gkja41Q9dTt1Io6DRtLcFCPqDhOYBnA/ou5NhuYzMTbc6+LQH4Q 9GWg1d+HzxbYmbMlr1lh5uise1FMbgX3K2plZU77Ym+wnKUK5L9VV3/UHQeEFrlAY6Sa 33Cw== X-Gm-Message-State: APjAAAUlh5LdByelrzNdwy3/rDmTJp7iOlVn2tMwvQwYm8myXDqFOBnR 8kF8wwh52eUemFJhGvuw5h2NfXYxYyA= X-Google-Smtp-Source: APXvYqwGe72+R/HJYLG4Bw9as9N3h4jGK5k9CIf2Cpdx+/xB0L0e7eEQ5bI83VsTjllybDqiHtY4/g== X-Received: by 2002:adf:ec11:: with SMTP id x17mr29266263wrn.120.1553852021903; Fri, 29 Mar 2019 02:33:41 -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.40 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 29 Mar 2019 02:33:40 -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 0/6] ARM: davinci: ohci-da8xx: model the vbus GPIO as a fixed regulator Date: Fri, 29 Mar 2019 10:33:28 +0100 Message-Id: <20190329093334.3885-1-brgl@bgdev.pl> X-Mailer: git-send-email 2.21.0 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 as it duplicates code. Instead we should model the GPIO as a fixed regulator that can be controlled with a GPIO. This series adds fixed regulators for all users of vbus GPIO, adds overcurrent protection using the existing vbus regulator in the USB driver and removes the vbus GPIO calls once they're no longer used. v1 -> v2: - add patch 1/6 that fixes an existing problem with missing array sentinels in GPIO lookups - add patch 2/6 that removes an unnecessary use count variable from the driver - reorder the changes: add support for overcurrent protection using the existing vbus regulator first, then setup fixed regulators in board files and finally remove the vbus GPIO from the ohci driver Bartosz Golaszewski (6): ARM: davinci: add missing sentinels to GPIO lookup tables usb: ohci-da8xx: let the regulator framework keep track of use count usb: ohci-da8xx: disable the regulator if the overcurrent irq fired ARM: davinci: omapl138-hawk: add a fixed regulator for ohci-da8xx ARM: davinci: da830-evm: add a fixed regulator for ohci-da8xx usb: ohci-da8xx: drop the vbus GPIO arch/arm/mach-davinci/board-da830-evm.c | 51 ++++++++++++++++++-- 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 | 50 ++++++++++++++++++-- drivers/usb/host/ohci-da8xx.c | 52 ++++++++++----------- 6 files changed, 122 insertions(+), 34 deletions(-) Acked-by: Alan Stern