From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-3.0 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_PASS, USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 53E8BC10F14 for ; Fri, 12 Apr 2019 12:36:52 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 23E90218AF for ; Fri, 12 Apr 2019 12:36:52 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="I0xwwrVs"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=bgdev-pl.20150623.gappssmtp.com header.i=@bgdev-pl.20150623.gappssmtp.com header.b="YBkpX/P5" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 23E90218AF Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=bgdev.pl Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+infradead-linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Message-Id:Date:Subject:To :From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=U1b8zOyI7bDSDv3wUSP86pG1h7k7/7h3U9RB3wRs490=; b=I0xwwrVszFUPLX U+qB6iGpflUJaWf8j4OYisC3p1qfGt3hSuKp8xNqruYNlQnXU5Vt0ztfp2fjY5ujGWBM1VCRPaHxf lLbROAJ4cZQ/70SXjed/chQcRCARJ2U01MH07T4iWbVYgT68hM3GTVljhVds5BHgNi2MJ/5RPAYHm I3mDwnxNuhqPSDlu9uEV1kyNb/OJHSzzVsRbcjH4LWt7OhitqL9//Cu8d2KaaLxEuMTcSxeLNiCoy pIDTHugv4Pr0HF2wr2pTGtNo83KcIHjR9tDYFNP3ANRM1YplZrIOB3wSUz7L3cDKbZKNW6+5ls5t0 OkxdnWXgNTQ/nls9zzRw==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1hEvQG-0004OX-8h; Fri, 12 Apr 2019 12:36:48 +0000 Received: from mail-wm1-x344.google.com ([2a00:1450:4864:20::344]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1hEvQD-0004NR-7s for linux-arm-kernel@lists.infradead.org; Fri, 12 Apr 2019 12:36:46 +0000 Received: by mail-wm1-x344.google.com with SMTP id r186so373836wmf.1 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=ZuipLxtkNTf1Il9FrEnIeNflA8cZfEYe8FFPrEEzIao69U4p6HWate777ed47S/kUF yUbmuc+2tLzuWK79MUVTC9UprhU3noGLqwyCzxX5uhxFrUWIjnMRYY2jxw1Egeh8xj5S gpV9UH3R9y2pDdWdCkZpv1lWYi2cWl+/5m1wVOuLG4tw/V2Buiz396ETGpXnfzRLT0Uf i6/qS/9P7ysl64jicTq/q+34P2SjK4UHKweFdQ/VEPI3glX3ZvPvBgGkt+hqIqRdE2SR JjHhl9uZg74q9Vr1G5enDGpxtHnWgNeCbNAI0sIjcUREburXM+17sb5DcvrYWvBPfUcy MY4w== X-Gm-Message-State: APjAAAVMil/Bqydn+7A69r1fAUkml+ykK2uCDOCaUNUwxlmslXmvixso eEeCCjPsQQ5fcVLTLCGnA1TVTw== X-Google-Smtp-Source: APXvYqzkBfvOn88/4jK4XYC/MeVSWGcf943H4zya74H2OGLPnuZBtxEhVx+HjAzB/PeeIw8lrhCuAw== 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 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 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190412_053645_276755_8395A0B0 X-CRM114-Status: GOOD ( 13.85 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Bartosz Golaszewski , linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+infradead-linux-arm-kernel=archiver.kernel.org@lists.infradead.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 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel