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: Takahiro Akashi X-Patchwork-Id: 14798 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:2a8e:b0:403:3b70:6f57 with SMTP id in14csp1420577vqb; Mon, 2 Oct 2023 06:18:15 -0700 (PDT) X-Google-Smtp-Source: AGHT+IF3Nh6hP2PTyE3Lr1nXclhtOsx2GPuVmh1K1Rt7VmMBrMc5cRtCEexczbCvDtmnqLZ00Whx X-Received: by 2002:a05:6a20:8e16:b0:15a:58c8:b10f with SMTP id y22-20020a056a208e1600b0015a58c8b10fmr10992351pzj.43.1696252695556; Mon, 02 Oct 2023 06:18:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1696252695; cv=none; d=google.com; s=arc-20160816; b=VRkWwRBIvk2ptZUHb/MfhOZwbd1mOFGA1Qmm+GAc1dYS78MmxPwJqB01WQtk6NZ6mx QhX4UIMBlI62w9w2C2jsJUFIYI09Z+henc2Fww863pfD17Iv0nrXGxqmDlXv3JC1JD4w /SmR7XpzZJI7Wc2FNWPACFbBWstOuRQNRSjfvL20gFDepKbAJ2p2wPqmeGgC09nl5VpU WEGShF4A49qe5iSAndA8RF4RMO5u5KP8A4o3/XrT8popEdr5BL55lXsYevcaHcP35c2b XvGbFcb0MWYsjIDlzL4uT221QfnJcCxmC4OCMyYOsxyvRYoo3+o41rkeJmLM53lBIG8l p3og== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=6b76Ych1HnNWX1i2+SMCurFq8JmPkRVbgEKvHul6Y6M=; fh=5LIWo2D/PeZk6SC/rjjkha3vijtdzmZAJYKHEnFRQDY=; b=xXSciYAvofzUH9L1WAjdnmQpsBPCqJTq6+TlcxyPWWuhNvPMn9LmootHHTtL2RTG3N 9iXW7kYleUmDWwUOpZjEpj6Og0U1ixuwMZMHTBRF2VOQVP/3VueGPhFHbF9urAvx5Pvh MOnPzp0EQ6I9nPe8z3eMG/jUzQCkzWjpWI+PKXn+JLk8ZjFkHO6OgJiDOxCSkX/+VSoB HTEr7y/xuqw2m5g1hX+EhDGoBlblypl2XcBECztAFgodjR0U+RRvWwdssOKFF+dPrqRO x7fgokmKoBlMI9U/YXfa/uykqamdHio3+NLYvf1/2XKjQePSSFoL62LWWqLWrhgniBHb G5ow== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=HOzAakug; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from groat.vger.email (groat.vger.email. [2620:137:e000::3:5]) by mx.google.com with ESMTPS id t13-20020a1709027fcd00b001c60f6cf46bsi18704317plb.12.2023.10.02.06.18.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 02 Oct 2023 06:18:15 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) client-ip=2620:137:e000::3:5; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=HOzAakug; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by groat.vger.email (Postfix) with ESMTP id E7E1280A90DE; Sun, 1 Oct 2023 19:17:30 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at groat.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235145AbjJBCRO (ORCPT + 17 others); Sun, 1 Oct 2023 22:17:14 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55078 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235058AbjJBCRM (ORCPT ); Sun, 1 Oct 2023 22:17:12 -0400 Received: from mail-pj1-x102e.google.com (mail-pj1-x102e.google.com [IPv6:2607:f8b0:4864:20::102e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E9824D3 for ; Sun, 1 Oct 2023 19:17:08 -0700 (PDT) Received: by mail-pj1-x102e.google.com with SMTP id 98e67ed59e1d1-27909dabf1cso1269507a91.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=vger.kernel.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=HOzAakugpT5jH49+zsnPAoGSrzC4RQyW/9VDM64hsVYCKqErk5vj91prWqv4SNRaKJ 5+FTn+BahMoYmBzhLezqiIKWLSb7H/caYdDYpoOv1CMyO5OXnc9iVuKmoQA0IGjtm2GT iXvc6meL4x0AxeRFVNWsmyfEvp99k/T8QCA9wilnwLQ6LgoI7RWSQ1/Q6/l1orzeZVV9 SeQxYOnwFlOF37n3nG65k8ZZY6pnCVFWfpBfGjpeI/nPkILxYQDHjuhW8WmAvX/65mAu 5JuSP3JWhWahRncrRMmbxi2100BIvGWYRep7oGmMrPSKJhPPjWiAl6sYi3RiaEv73ajE h9QA== 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=AGckwHtAnXc6s0ra47UwyyQgbtFenNCVDicoMixwKa1woQNz2MMdVGyZ7P2LDWQqCC gRYfFEj5DjhzCN6YKg7eY2DKtQToAZi8uKfOJ04r+GdX0gB7rxn13JhL3ZvBniQFXjpA jHGP8wF00BCf74Mr03ciqlSJRh2EVYGZgcGM4B5Tbic+B7wl2x7XM+g8WxxwEaImtW7r S1CMrw2cv4vnlMHMlQLirlxVDqfaltmQmMC1yydD1I3ahgLyKC2RQk69zfYRxcyNZrLc VNzKlRU4YveuPOcIUYaVS+hQ8+t73zYb9xNnqSJaxqlo9imRrwfNEf/43OtFsHQ98csD 1Hqg== X-Gm-Message-State: AOJu0YwX7uDSchXk8vRsFrhjSyqx58zih0x8e+fc9EGCcm10JMxEX5at BbmYb1IfCIXl0PY7VUDfiijUiA== 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-Spam-Status: No, score=-0.8 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on groat.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (groat.vger.email [0.0.0.0]); Sun, 01 Oct 2023 19:17:31 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1778649866299692743 X-GMAIL-MSGID: 1778649866299692743 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