From patchwork Mon Oct 2 02:15:58 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: AKASHI Takahiro X-Patchwork-Id: 13405500 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org 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 smtp.lore.kernel.org (Postfix) with ESMTPS id 32E4FE784A6 for ; Mon, 2 Oct 2023 02:17:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Message-Id:Date:Subject:Cc :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=J7PtHWGBqT66SC6P4+jMS4OtrPNVDcH88Y8vc/Yy4m8=; b=Inb2u+1Fg+7/nn tUtZkE+tTF1bv8U6YQwTT7CqChC21lgwK39ta4kIkHTCMhXI6rYIbAQ+ZtdgKb0KQ7iSRz++3tAIu U06dvqkXLAdxBHqJSrJhAwfOxJNFPyZjthH/mBsnDfwZoms23Aiz2pyT7gMlOKSg/q9bsMr5nJZ7m /o01CWeC3U0wvontA6pMb+/I5RtECBep2Odu+WspyG8ZQITAa8pu1GuHbcnCd1lgi3udx4HN3ipod bdxowWLgtSVca21ZQ2UPCkrNtZmwdDs0wTqWW9tMGUCZ2HU1t62xHEyuz3EM9qYDjUK+V7vwZ3ob8 bqiScq7pDKVK/1t0L2qQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qn8Up-00BqJp-0D; Mon, 02 Oct 2023 02:17:19 +0000 Received: from mail-pj1-x102e.google.com ([2607:f8b0:4864:20::102e]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qn8Ul-00BqJ9-2y for linux-arm-kernel@lists.infradead.org; Mon, 02 Oct 2023 02:17:17 +0000 Received: by mail-pj1-x102e.google.com with SMTP id 98e67ed59e1d1-27909dabf1cso1269505a91.1 for ; Sun, 01 Oct 2023 19:17:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1696213028; x=1696817828; darn=lists.infradead.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=6b76Ych1HnNWX1i2+SMCurFq8JmPkRVbgEKvHul6Y6M=; b=HyiAogEK+QreWD4lkZvZ4sLdcHGjhy11y/Jz5Wjj9QTN6tHAM8YRYFnAS4nhNWh5GG PK7bezVEJU+9Flk95+9EFtuI4hJbpjLITwxJn7DQe9izf/1BI6jDz9aqEgtnjdkCTouV E3t7b25bHF8rzWZZDKPCb7KwpKh1T0pcoOD9Tr6QyqLgjp5VYZPu1ANpgbhqEbV8ezfS rgLMOEUYg3r/S3pHoBvYsxuxcJFOtkKb9nKk9MVz+K+Sdm/6f97c5vHHAGEc+V+oQ9/V CMMKhaUxgPlwJyWNOwFwWcTY/O+sXl3elePZELmnPdLj5wQpxMpCPHUQ+lRqQ6cnHIVQ 007w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1696213028; x=1696817828; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=6b76Ych1HnNWX1i2+SMCurFq8JmPkRVbgEKvHul6Y6M=; b=arRojZQvc1ccecxJRISROkWVr+uHEqeQXZda1XL6jmBugZdqOtzXKZKJ6Z30HkVAG6 kqAQCmo84EluBVgMCVAbLVrHGhx7XzWj1FZP8RZTVt4necVdlf4cXgGWfsgHRSoifvCY HSCAlv5vczFHqeXV32ar4isUxUkXMaCzMfCIT/HJGDxXngLvFINeca+4ZUNZg6ioTnGH 8O6ZmqY8gKIvCF284bsC5ahutx5fAcCnaxWwVmVKcr2fk6kkFP2uPJiMa/Rro2Ds+atA 8TYUWFg/l60IFhH2hdZNFcpfjl2Pn9Ozv47s3jrsD4EcZhulT7LyMconR6tXsNIAoZ1d Sjmg== X-Gm-Message-State: AOJu0Yxw3SIYZRfORg5l3iGP5M4tO1brePCTlGCSUi0UeUegtdk6OuOD pE+e8p4CchG8TclAdpNzkvR9ZQ== X-Google-Smtp-Source: AGHT+IG7F7GjhJnFomtH628B6eLxLuj4n7S9f0mGkASawyhxSQzyDo06i0YtDgv7Hzddo0DyTk9qvw== X-Received: by 2002:a17:90a:242:b0:263:730b:f568 with SMTP id t2-20020a17090a024200b00263730bf568mr9141074pje.3.1696213028338; Sun, 01 Oct 2023 19:17:08 -0700 (PDT) Received: from octopus.. ([2400:4050:c3e1:100:7ab1:199:d138:f054]) by smtp.gmail.com with ESMTPSA id mg11-20020a17090b370b00b002609cadc56esm5278319pjb.11.2023.10.01.19.17.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 01 Oct 2023 19:17:08 -0700 (PDT) From: AKASHI Takahiro To: sudeep.holla@arm.com, cristian.marussi@arm.com, robh+dt@kernel.org, krzysztof.kozlowski+dt@linaro.org, conor+dt@kernel.org, linus.walleij@linaro.org Cc: Oleksii_Moisieiev@epam.com, linux-arm-kernel@lists.infradead.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-gpio@vger.kernel.org, AKASHI Takahiro Subject: [RFC 0/4] gpio: add SCMI pinctrl based driver Date: Mon, 2 Oct 2023 11:15:58 +0900 Message-Id: <20231002021602.260100-1-takahiro.akashi@linaro.org> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20231001_191715_999157_2E2BCD4A X-CRM114-Status: GOOD ( 20.95 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org I'm currently working on implementing SCMI pinctrl/gpio drivers on U-Boot[1]. Although the pinctrl driver for the kernel[2] was submitted by EPAM, it doesn't contain the gpio driver and I believe that we should discuss a couple of points on the kernel side to finalize my design for U-Boot. So this RFC is intended for reviews, especially to raise some issues. (Please note that I have *never* tested the code because I don't have any real hardware to test SCMI on it.) 1) how to obtain a value on an input pin All the existing gpio drivers are set to obtain a value on an input pin by accessing the hardware directly. In SCMI case, however, this is just impossible in its nature and must be supported via a protocol using "Input-value" configuration type. (See the spec[3], table-23.) The current pinconf framework is missing the feature (the pinconf parameter and a helper function). See patch#1 and #2. Please note that there is an issue around the pin configuration in EPAM's current pinctrl driver as I commented[4]. 2) DT bindings I would like to propose a generic binding for SCMI pinctrl based gpio driver. This allows a "consumer" driver to handle gpio input pins like as other normal gpio controllers provide. (patch#4) 3) generic GPIO driver Based on (2), I tried to prototype a generic driver in patch#3. As you can see, there is no SCMI-specific line of code as a set of existing helper functions, except (1), seem to be enough to implement required interfaces. So I'm not sure whether the driver should has a "compatibles" property of "arm,scmi-gpio-generic". I will appreciate any comments. -Takahiro Akashi [1] https://lists.denx.de/pipermail/u-boot/2023-September/529765.html [2] https://lkml.iu.edu/hypermail/linux/kernel/2308.1/01082.html [3] https://developer.arm.com/documentation/den0056/ [4] https://lkml.iu.edu/hypermail/linux/kernel/2308.2/07483.html AKASHI Takahiro (4): pinctrl: define PIN_CONFIG_INPUT pinctrl: add pinctrl_gpio_get_config() gpio: scmi: add SCMI pinctrl based gpio driver dt-bindings: gpio: Add bindings for SCMI pinctrl based gpio .../bindings/gpio/arm,scmi-gpio.yaml | 71 ++++++++ drivers/gpio/Kconfig | 8 + drivers/gpio/Makefile | 1 + drivers/gpio/gpio-scmi.c | 154 ++++++++++++++++++ drivers/pinctrl/core.c | 19 +++ include/linux/pinctrl/consumer.h | 8 + include/linux/pinctrl/pinconf-generic.h | 3 + 7 files changed, 264 insertions(+) create mode 100644 Documentation/devicetree/bindings/gpio/arm,scmi-gpio.yaml create mode 100644 drivers/gpio/gpio-scmi.c