From patchwork Wed Nov 11 12:24:51 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lars Povlsen X-Patchwork-Id: 11897491 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=-6.8 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=no 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 1C4FEC56201 for ; Wed, 11 Nov 2020 12:25:41 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (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 9AF87206FB for ; Wed, 11 Nov 2020 12:25:40 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="arI2yogC"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=microchip.com header.i=@microchip.com header.b="2L2zLY4w" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 9AF87206FB Authentication-Results: mail.kernel.org; dmarc=fail (p=quarantine dis=none) header.from=microchip.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+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=merlin.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=jROAU+5332M5WJ9mrbVRMk6QLKon4OVqio/z3TtQ7uE=; b=arI2yogClnRygDxqLYyi5tOJAl PKtVAlz9OgFZAn8+Q4DaoBoaocg4wwk674EUAFmWF1NkEx47F44+hgWnz21o46fmTV9SDAD9fvICe U7zGryh65TCVr+TshVkVXptBfTLSHZgRd818U0gbmX6jFxP/M7sj/UHmdMX0v6Zajva0zCOay50uI tvnuLkTQ8YdZuRX1VrIUyy4BSjrO2cFvv+DqowBu5yoWlFDmLhYGrIDEZeWHJouWhIHyqg4fp+qOu TtSg4TtzFp5jBrfGTS5ik2hON2Ag6rQw4A5OPoyLrvVZ2898aESYHadT3ii3xBSRmyjrr5cJIec/e Bj7jjagQ==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kcpBT-0006N3-Ni; Wed, 11 Nov 2020 12:25:07 +0000 Received: from esa3.microchip.iphmx.com ([68.232.153.233]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kcpBQ-0006Mf-VE for linux-arm-kernel@lists.infradead.org; Wed, 11 Nov 2020 12:25:05 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=microchip.com; i=@microchip.com; q=dns/txt; s=mchp; t=1605097504; x=1636633504; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=IUX2xf6Hbx0dVgf+4RdvLcb80tKLCFc4rdnd1Xiw3z4=; b=2L2zLY4wsMMVYLakT1JVI6LQlV2hAg+9EEullhHdWeevizJQGVR/ge1j D9Dg1RI7VGxvoF3Y/uHwLaK6CXJQfzEA1hYFdQgoyngAbL5PxXcWOvnSw Yv0WZY5AnmSPvi8wtf9vQL7CoN4oi56PqlidalBHftZtxVxvyIGfNywxg hspOBIMN0VTsrOAaDS5vB6p+69IHVOuuCeJtw20NL6eBAbt8p7lnoE3Ts ldnQsfGR/T+mszxdjhnKBPi0kE2F4EyWJK5DybD/fYWoTUduhPdd/k2LR hyIwOmC226VNa5q+iDCu8lIXSnX6RgX6VirogVZ60tmNNfelEM2R19NNj g==; IronPort-SDR: M4NB8Uz6dCol8UC94vx0BYgFMXImxqujFIdcz5oAX3TKTDLAswTJ01/uI0v7eRBZTZHmGE4DU5 SknGXAtH3J2vLX+BfJVOzLCNAzWOPktM1dsxZy9WXafjkN65annMflWvW2s5D9fPhQ9yyt2Ph0 V79yyYujuAb4s2Xjjsop+cwjR10hwexzbuzH4o5HcNkQRUNPPhQ7nU3G00CX54Fzsbjp8bQUDL CfBtmDoTy7MxbnMIHKECpDlaNkQ1QZ2EFN+zFUXTS57SOT1wbXLLPYGmWtZXcElwypnKa2OPJZ 5Ew= X-IronPort-AV: E=Sophos;i="5.77,469,1596524400"; d="scan'208";a="98605526" Received: from smtpout.microchip.com (HELO email.microchip.com) ([198.175.253.82]) by esa3.microchip.iphmx.com with ESMTP/TLS/AES256-SHA256; 11 Nov 2020 05:25:02 -0700 Received: from chn-vm-ex04.mchp-main.com (10.10.85.152) by chn-vm-ex02.mchp-main.com (10.10.85.144) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1979.3; Wed, 11 Nov 2020 05:25:02 -0700 Received: from soft-dev10.microsemi.net (10.10.115.15) by chn-vm-ex04.mchp-main.com (10.10.85.152) with Microsoft SMTP Server id 15.1.1979.3 via Frontend Transport; Wed, 11 Nov 2020 05:25:00 -0700 From: Lars Povlsen To: Linus Walleij Subject: [PATCH v9 0/3] Adding support for Microchip/Microsemi serial GPIO controller Date: Wed, 11 Nov 2020 13:24:51 +0100 Message-ID: <20201111122454.6240-1-lars.povlsen@microchip.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20201111_072505_233501_E4A957D0 X-CRM114-Status: GOOD ( 13.34 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: devicetree@vger.kernel.org, Alexandre Belloni , linux-kernel@vger.kernel.org, Microchip Linux Driver Support , linux-gpio@vger.kernel.org, Andy Shevchenko , Lars Povlsen , linux-arm-kernel@lists.infradead.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org The series add support for the serial GPIO controller used by Microchip Sparx5, as well as (MSCC) ocelot/jaguar2 SoCs. v9 changes (from Andy): - Avoid bitfield duplication (use FIELD_PREP/FIELD_GET) - Introduce SGPIO_SRC_BITS define constant - Use ENOTSUPP instead of EOPNOTSUPP (checkpatch will complain) - Drop dev_err() when using pin for wrong direction - Replaced left-over OF code with device_property_* flavors - Use devm_kasprintf() instead of strnprintf()+devm_strdup() - Minor formatting changes, deleted comments v8 changes (from Andy): - Removed OF dependency/usage entirely. - Trimmed+sorted include files. - Made local variables reverse xmas sorted. - Removed __func__ usage. - Changed some occurences of "if (x) { ..." to early return. - Use dev_err_probe() where possible. - Replace of_device_get_match_data() with device_get_match_data() - Some minor formatting corrections - Do per-pin string allocation as opposed to bulk allocation+chop. v7 changes: - Fixed wrong sizeof in pin string name template. (Andy) - Collapsed sgpio_input_get() to one liner. (Andy) - Eliminated unneeded variable in microchip_sgpio_get_value() - Removed noisy dev_info(). (Andy) - Replaced platform_get_resource()+devm_ioremap_resource() with devm_platform_ioremap_resource(). (Andy) - Replaced device_property_read_u32() with of_property_read_u32(). (Andy) - Replaced __builtin_ffsll() with __builtin_ffs() for MIPS32 targets. v6 changes: - Use "bus-frequency" instead of "microchip,sgpio-frequency". Drop '$ref'. (Robh) - Added "ngpios" description, bumped minimum to 32. (Linus) - Added "#size-cells" description. (Linus) - Changed "bus-frequency" validation in driver to reflect the YAML description. v5 changes (driver comments from Linus): - Collect bank data in sgpio_bank struct - Add is_input boolean to sgpio_bank struct - Use single-bit bitmasks in sgpio_output_set() and sgpio_output_get() - Eliminate superfluous struct pinctrl_dev *pctl_dev in bank data - Fix wrong ngpio consistency check v4 changes (binding comments from Rob): - microchip,sgpio-port-ranges changed to uint32-matrix so tuples can be represented properly. - gpio controller node name changed to "gpio@[0-1]" - whitespace fixes - DT files updated as per schema changes v3 changes: - Renamed all usage of "mchp" abbrevation with "microchip". - Split the in/output directions into (two) separate banks. - Eliminated the bindings include file (from above) - Changed SPDX license to "GPL-2.0-or-later" - Change -ENOTSUPP to -EOPNOTSUPP - Minor type/symbol naming changes v2 changes: - Adds both in and output modes. - Use direct adressing of the individual banks (#gpio-cells = <4>), also osoleting need for addressing macros in bindings include file. - Property 'microchip,sgpio-ports' (uint32, bitmask) replaced by proper range set (array of [start,end]) 'microchip,sgpio-port-ranges'. - Fixes whitespace issues in Kconfig file Lars Povlsen (3): dt-bindings: pinctrl: Add bindings for pinctrl-microchip-sgpio driver pinctrl: pinctrl-microchip-sgpio: Add pinctrl driver for Microsemi Serial GPIO arm64: dts: sparx5: Add SGPIO devices .../pinctrl/microchip,sparx5-sgpio.yaml | 145 ++++ MAINTAINERS | 1 + arch/arm64/boot/dts/microchip/sparx5.dtsi | 91 +++ .../boot/dts/microchip/sparx5_pcb125.dts | 5 + .../dts/microchip/sparx5_pcb134_board.dtsi | 258 +++++++ .../dts/microchip/sparx5_pcb135_board.dtsi | 55 ++ drivers/pinctrl/Kconfig | 16 + drivers/pinctrl/Makefile | 1 + drivers/pinctrl/pinctrl-microchip-sgpio.c | 707 ++++++++++++++++++ 9 files changed, 1279 insertions(+) create mode 100644 Documentation/devicetree/bindings/pinctrl/microchip,sparx5-sgpio.yaml create mode 100644 drivers/pinctrl/pinctrl-microchip-sgpio.c --- 2.25.1