Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp382854yba; Fri, 12 Apr 2019 05:39:07 -0700 (PDT) X-Google-Smtp-Source: APXvYqxBOjk3e5neVn+HXiG8bkb2NTG+dEeYyl6wvIgeIUfXVP9pa16+8s+cHj17M1dqg+BLtlOs X-Received: by 2002:a17:902:141:: with SMTP id 59mr20886764plb.132.1555072747495; Fri, 12 Apr 2019 05:39:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1555072747; cv=none; d=google.com; s=arc-20160816; b=xRb6q531fu448QPkjsfmFy2WlsF/xbJ9Blx8gR+qnV10FxgTYwr39Dk8lm67Q7gKAI 9YPxwULU5tmAfR+YCHlui1iveaedAPtm/AGtCgLI7rGhpDH7mKLQkrsArNeNifcuDI9z TUR6N2vdFnrm3zWFPOZ3tQNYTe1ET/D3mQD9VUNeUqupyjochUCevTjgSi5WU+55qVgs kvBBMOrkyi7Wm6YNgWW1wksUoV34+LuNQTFtRB9dU2I6ad01bbKKlGvOZec63uO16xHL MnZLRyST23Z0Q8vyPAlcL2AcaU5UZjjKhiRFAmF/q8TH0Pqs0eCOo8A3VeUkAMoCUrQz rpcA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=XjjkFruDsH5BYQSaWX+oEpOL4blf0Yltxz9NZtZphkA=; b=L7JZuGDhAi1fAy/66BHhgbzTy3IVpOAjcIBnXYrpCEeaTvFgU5UVJ32m6eItIeYlIj iXa+tstwsmQg9TeCdZt7nOm6bHg1VD2z4Hfvgm2E7XY2EQ7RjQJzuYoQ/uQJMGZWN03M bztdjNl1e+NysfN9zhintYHVfI4HXySrT/GsEM928WB8X/hVZ+fyHnpXDxQRwMkv7xbN gMcF0R4OnfYGInhpAxPU0p2Vq6jOJQ53EEsu9QaZASK0Zt1P0lmhrZlxRjP6xq5BOdja 3tvYGNlg6DhDeKsLHwzT+RxYx2JvUP8BtPrRUfggg0lTmkUa9n2n99/bv1mVeeW/XvN+ mQXA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@bgdev-pl.20150623.gappssmtp.com header.s=20150623 header.b="YBkpX/P5"; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 134si38153916pga.249.2019.04.12.05.38.51; Fri, 12 Apr 2019 05:39:07 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@bgdev-pl.20150623.gappssmtp.com header.s=20150623 header.b="YBkpX/P5"; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727976AbfDLMgq (ORCPT + 99 others); Fri, 12 Apr 2019 08:36:46 -0400 Received: from mail-wm1-f67.google.com ([209.85.128.67]:40269 "EHLO mail-wm1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727497AbfDLMgp (ORCPT ); Fri, 12 Apr 2019 08:36:45 -0400 Received: by mail-wm1-f67.google.com with SMTP id z24so10900907wmi.5 for ; Fri, 12 Apr 2019 05:36:44 -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=XjjkFruDsH5BYQSaWX+oEpOL4blf0Yltxz9NZtZphkA=; b=YBkpX/P5s7YFsOu4AR5CWQC3NIh6KtLHjWQsVXTICMxUkEoYanZ/7ut8fpogZJq+cV 8d3s/iF/3Ltbrxfyf1eGFKcCnX4BazlFOfk4qiraEj/M4rFknFS7iGq99nTzoOBW+ChD /K8AHsBslAzHrr4P0Jd8b5IsFl8FLC9LEshct/QRSnhEESRKcXHE/OGM/9eESuF13a43 ESPoKrcbzPEViKyxXzGC+ybQTnUANYd1iFlwTO+8Y2u2oyYPIFUL48Gluy4WYemLeoi0 oGC4OCuetyVOC2MqBB3A3qfVceoSeApsI9dAfvqFbs0+/XE3vQASuhEBrZZf8edLABkF aO3Q== 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=XjjkFruDsH5BYQSaWX+oEpOL4blf0Yltxz9NZtZphkA=; b=EkxM2Nez534OePCdIsPRZgDFEu5k9xvA1R6FqnB/gvz8X7BUsneXdo4tD1dRuGmIfp 72U+7ATARWxwZRa6zVNYaZrXrrGVaHAcNHB13JjajSkDyHj7VU2gf+1nirh0acx/zbKg R9+e3nX8WbK9Dh+yU4RWWT6cjZ4wMdaGqLUBAJJZ5WskhDfDATApYQ0cpD5bOTOvwWte 8hZ62QnamPYT78lSh7QknQvYYStbmQSPOC/DCg84W3x0pj81rfiLOHs1YJM1Ohwxcu71 zC/3swaGleOKKnUJ1bmdbEhXcweLkMY4/tT8kZ4axLLN3avOSbMzAaKUDkBvexZqL6ls uSRQ== X-Gm-Message-State: APjAAAXfi3KA9pKZ+k+43GIzHjKtAoXrq+vpgWItxfeS+PSG0MhW9DZG 72R3eEYaSEXh9pC/VD4cTOU/wA== X-Received: by 2002:a1c:99d5:: with SMTP id b204mr10621493wme.95.1555072603479; Fri, 12 Apr 2019 05:36:43 -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.42 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 12 Apr 2019 05:36: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 Subject: [PATCH v5 0/6] ARM: davinci: ohci-da8xx: model the vbus GPIO as a fixed regulator Date: Fri, 12 Apr 2019 14:36:34 +0200 Message-Id: <20190412123640.11437-1-brgl@bgdev.pl> X-Mailer: git-send-email 2.21.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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. Tested on da830-evm with the module both built-in and loadable. 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 v2 -> v3: - change the device id of the fixed regulator to 0 since it's the first one - drop the interrupt-context handler and only use the thread - drop Alan's Ack from patch 3/6 as it's changed significantly - rebase on top of v5.1-rc4 v3 -> v4: - in patch 2/6: switch to using a simple if/else v4 -> v5: - remove stray newline in patch 3/6 - remove one level of indentation in patch 6/6 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 | 42 ++++++----------- 6 files changed, 112 insertions(+), 34 deletions(-) -- 2.21.0