Received: by 2002:a05:6358:4e97:b0:b3:742d:4702 with SMTP id ce23csp2414256rwb; Mon, 15 Aug 2022 05:11:52 -0700 (PDT) X-Google-Smtp-Source: AA6agR49yUUoANjSESu0qUKTRbp8CSajgbVAhdfwQqq89IGvywV9Zmnaf0QUrKsoZJg8m2K8Q72/ X-Received: by 2002:a05:6402:f22:b0:43e:8623:d32c with SMTP id i34-20020a0564020f2200b0043e8623d32cmr14568955eda.265.1660565512511; Mon, 15 Aug 2022 05:11:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1660565512; cv=none; d=google.com; s=arc-20160816; b=t0EmYHVAKXRUI37C+7JKhFOAFUvA8qVhnJ7MZCB0uDt0AAIsjCNLvtx+Lrog6XZt2o kZcu+dQAVz4phNmdR83K/SDTxQkd2bAQ9K+RMrZdlIkHF7Ponj4MJjik4ARpQkGHKemY c0mt10ypOa/0Gy5sLoRnucaRQ1oqShhpXsktD0834R7/3nrT/s+365K+OXSNviN9z/hT IbyeqE11k+lCuxUZWY5ptnPbWa8xudrMGmeJE5ggM1E72kDMH/9T7wZeBA6ZXKxVfsNk 0N0kt5bCZi9F3PILn3hvGBrwtP5l9GNi9ZCusI32IZiHHUB9ND/1wHYVTOGDi4YnDoT+ OeVA== 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=7kUxAuqN1oxLH5nGGSmYJZ6ZVlmRsWXDNylt++LuX/4=; b=yDsDQv4+9AuNppfgeNFOEMNYavlBYTjS/SKXJbu+DGIyDFAegXuHu71OOpShlZl9WL ZKC6jueShPUOAhBpAIW3p6SVlZo2sGuPw5oLluSnnYuF+ePtIEHqD+5rpMGvGO1SSq1v +Kqp+EUux+QI1/2VXC2Tfo79jo/rfgpG/HZ84aOgyhfujLhqaRhV++ercoSqbopafTGa GDASUHgDyySGr3WqzJ63BBOvLIbYskON1sdAN8kidXoeJnyyatt2v675R9y9C4ETL5PQ V2ZIoDH+OmODlBZ2pQM552YZyYnBAlI7hBYWk9mkexc6qmLH/fCsmApekGSE6MVhxR/h 9AcQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@microchip.com header.s=mchp header.b=WEgvtiUQ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=microchip.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id g21-20020a056402425500b0043dfb97250esi8303436edb.456.2022.08.15.05.11.25; Mon, 15 Aug 2022 05:11:52 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@microchip.com header.s=mchp header.b=WEgvtiUQ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=microchip.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231851AbiHOMI6 (ORCPT + 99 others); Mon, 15 Aug 2022 08:08:58 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50868 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229605AbiHOMIx (ORCPT ); Mon, 15 Aug 2022 08:08:53 -0400 Received: from esa.microchip.iphmx.com (esa.microchip.iphmx.com [68.232.154.123]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9037726106; Mon, 15 Aug 2022 05:08:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=microchip.com; i=@microchip.com; q=dns/txt; s=mchp; t=1660565332; x=1692101332; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=LYdbdaSxPnkWKQtEEtEDtnmk+PnqxeXBOvUXZFgkiHU=; b=WEgvtiUQ4TpxzXR8kSkPQ01f3bhOGkE6szI8YKnL0pxzmaeyczODfjm5 GtTj09k1BeVIYPqQGLXTZkZRtJlN9YOVL+XSxGFMPNRCYhAyU4uHZSFMT 4MJP6KYy9M/erM2MFEl4ZGWXaJTndUKv+PFKDB6utvAGKaJGyIcqBCIaM VX2sdRr5xmmZKFo4y8Xe9F5F7QUSchBFgYtTo7n1yMmQoiZtOXeC8AK2O wZj/2u239FRyWJytfuQGapdDNOegdFjRzVdMmFheJd2QGbLDEpgqFyiDF IfxTihOKQhA0wdMfiiaBQs1IYGSkc9BljKFECyK01Pz7bWF0WeSkDBiN6 g==; X-IronPort-AV: E=Sophos;i="5.93,238,1654585200"; d="scan'208";a="172452934" Received: from unknown (HELO email.microchip.com) ([170.129.1.10]) by esa2.microchip.iphmx.com with ESMTP/TLS/AES256-SHA256; 15 Aug 2022 05:08:51 -0700 Received: from chn-vm-ex04.mchp-main.com (10.10.85.152) by chn-vm-ex01.mchp-main.com (10.10.85.143) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.12; Mon, 15 Aug 2022 05:08:39 -0700 Received: from dev-powerhorse.microchip.com (10.10.115.15) by chn-vm-ex04.mchp-main.com (10.10.85.152) with Microsoft SMTP Server id 15.1.2507.12 via Frontend Transport; Mon, 15 Aug 2022 05:08:37 -0700 From: To: , , , , , , CC: , , Subject: [PATCH v6 0/1] Add Polarfire SoC GPIO support Date: Mon, 15 Aug 2022 13:08:33 +0100 Message-ID: <20220815120834.1562544-1-lewis.hanly@microchip.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, SPF_HELO_PASS,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Lewis Hanly Add a driver to support the Polarfire SoC gpio controller. Tested with latest 5.19 kernel. MPFS gpio interrupts are connected to IOMUX configured by system register GPIO_INTERRUPT_FAB_CR(31:0). Interrupt connection for some GPIO's to the PLIC (Platform Level Interrupt Controller) can be shared (not directly connected) or direct if connection is available. previously upstreamed dt-bindings: gpio: microchip,mpfs-gpio.yaml Changes in v6 Fixed typo causing compile issue with kernel 6.0-rc1 Changes in v5 Added the const for the irqchip, removed in error from v2. Changes in v4 Changed the interrupt handling from Hierarchical flow to chained interrupt flow. The reason for the change was with hierarchical flow we requried a interrupt number mapping array to work with our HW and this was not acceptable. On reviewing the architecture the chained interrupt flow works better for our hardware and configurations which are not fixed in Silicon. Added support to read the optional DT property ngpios. Changes in v3: Changed order in kconfig. Removed blank lines in driver header/source file. Removed BYTE_BOUNDARY variable and use macro to do *4. mpfs_gpio_assign_bit parameter uses macro instead of (i * BYTE_BOUNDARY). Add correct definitions for direction. Change order of variables in mpfs_gpio_irq_set_type function. Return dev_err_probe instead of dev_err. Remove noise of dev_inf. Avoid using of_match_ptr. use devm_gpiochip_add_data(..) Update mpfs_gpio_remove. Changes in v2: Use raw_spinlock. Use __assign_bit() to assign bit, added a bool variable for value. Remove unnecessary checking gpio_index. Remove default from switch statement. Use const for irq_chip, name updated and use mask/unmask. Use latest kernel api irq set_chip. Implemented hierarchical interrupt chip support, although suggested to use chained interrupt flow I believe this fits better. Lewis Hanly (1): gpio: mpfs: add polarfire soc gpio support drivers/gpio/Kconfig | 7 + drivers/gpio/Makefile | 1 + drivers/gpio/gpio-mpfs.c | 317 +++++++++++++++++++++++++++++++++++++++ 3 files changed, 325 insertions(+) create mode 100644 drivers/gpio/gpio-mpfs.c -- 2.25.1