From patchwork Mon Nov 21 12:38:01 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yinbo Zhu X-Patchwork-Id: 23722 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:f944:0:0:0:0:0 with SMTP id q4csp1559648wrr; Mon, 21 Nov 2022 04:39:15 -0800 (PST) X-Google-Smtp-Source: AA0mqf5rq7FvbDtJ7hzwNHWxCCwQAQ4H80I7UZBV4iVrWBuKIZrcUWMVN9wPG2CHetygCBit6LIF X-Received: by 2002:a62:17c5:0:b0:56b:6936:ddfb with SMTP id 188-20020a6217c5000000b0056b6936ddfbmr356121pfx.15.1669034355291; Mon, 21 Nov 2022 04:39:15 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1669034355; cv=none; d=google.com; s=arc-20160816; b=P6an0p9LoM1tklwYIiKqGImGIzP/QUy+1QJikaDKWA8x+qZB8DBu7C+SYbhumEgbU2 U7Fw12Ap5HtV6UuR+7KszLPUXCnw2w9G3igcS4IN7meGfj39FwSh79ywEEzUY5Kj99r/ 8/JR1FCS/jrhygA6N5J1vyBp4p3K58twlMUgnWSz6HlWROne6F3rMlwL4iDCPI1AJ/vx jK6e092ewk+OXTsWJWXNi8Vsi/ejIUMWSqLfcSqSaEeMldCG3RfmAC3wHFxHypgBDgwn Vb6nSW1o+0CGkmA+wDe8e6oyDkm3uvuguyDsklOU0rBCT4Tz5wnTMfaCgjRFn0Ya16BV latA== 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:to:from; bh=OqEv+G9BHqlXPYrMCL87igDvC2jYKaw+Qn3xdnd7iVk=; b=a2hgqtJ1MHGXJUXOrG701lgETp7V/yOzwboTmMsVyr0CzMGX85SUpTfjKjttCjOICA 4zF4Hf/AT4QF3gUEqcVET0vYcwEsSu/7kU645yGuGy8VHvY4TvnGJjlHBaD+ho13EPGi Qd918XPBm7gbd8nXJKyaP62gMRtD7OwTaDaCKQiYZe8ql0gFzD0e93VeNhANHChDFhvm ZtCjS7HOmZPNNnrOocjiNwypdxYnaF3EdlluRJSpUAfvge7AvGgZ1vVTRL5DDxnUOwgN wDSR2gyFMdHqb0FLzujO8gwwJQ7X+vhXoFHySRhKLmzKK+dlEVgQMUdex7NTrK2ZkY4W YwCw== ARC-Authentication-Results: i=1; mx.google.com; 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 Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id m32-20020a634c60000000b0046f3dfb97a5si2509781pgl.660.2022.11.21.04.38.57; Mon, 21 Nov 2022 04:39:15 -0800 (PST) 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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229966AbiKUMia (ORCPT + 99 others); Mon, 21 Nov 2022 07:38:30 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58546 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231426AbiKUMiU (ORCPT ); Mon, 21 Nov 2022 07:38:20 -0500 Received: from loongson.cn (mail.loongson.cn [114.242.206.163]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id C700C11C28; Mon, 21 Nov 2022 04:38:15 -0800 (PST) Received: from loongson.cn (unknown [10.180.13.64]) by gateway (Coremail) with SMTP id _____8Cx7Ng1cXtjWxoJAA--.25294S3; Mon, 21 Nov 2022 20:38:13 +0800 (CST) Received: from localhost.localdomain (unknown [10.180.13.64]) by localhost.localdomain (Coremail) with SMTP id AQAAf8CxXuAwcXtjXpkXAA--.61043S2; Mon, 21 Nov 2022 20:38:12 +0800 (CST) From: Yinbo Zhu To: Linus Walleij , Bartosz Golaszewski , Rob Herring , Krzysztof Kozlowski , WANG Xuerui , Jiaxun Yang , Thomas Bogendoerfer , Juxin Gao , Bibo Mao , Yanteng Si , linux-gpio@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, loongarch@lists.linux.dev, linux-mips@vger.kernel.org, Arnaud Patard , Huacai Chen , Yinbo Zhu Subject: [PATCH v5 1/3] gpio: loongson2ef: move driver to original location Date: Mon, 21 Nov 2022 20:38:01 +0800 Message-Id: <20221121123803.3786-1-zhuyinbo@loongson.cn> X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 X-CM-TRANSID: AQAAf8CxXuAwcXtjXpkXAA--.61043S2 X-CM-SenderInfo: 52kx5xhqerqz5rrqw2lrqou0/ X-Coremail-Antispam: 1Uk129KBjvJXoW3Gw4DAry5Zw13Jry8WFyxuFg_yoWxKFyfpF 1fAw4kGrW8WF4fCrZ5CFykurZ8JanxGr9F9F47ur1UuF9rZa4UZr1ktF95Jr4DXrZ8JayI 9F9a9r12ka1jkwUanT9S1TB71UUUUjJqnTZGkaVYY2UrUUUUj1kv1TuYvTs0mT0YCTnIWj qI5I8CrVACY4xI64kE6c02F40Ex7xfYxn0WfASr-VFAUDa7-sFnT9fnUUIcSsGvfJTRUUU bfxFc2x0x2IEx4CE42xK8VAvwI8IcIk0rVWrJVCq3wAFIxvE14AKwVWUAVWUZwA2ocxC64 kIII0Yj41l84x0c7CEw4AK67xGY2AK021l84ACjcxK6xIIjxv20xvE14v26ryj6F1UM28E F7xvwVC0I7IYx2IY6xkF7I0E14v26r4j6F4UM28EF7xvwVC2z280aVAFwI0_Gr1j6F4UJw A2z4x0Y4vEx4A2jsIEc7CjxVAFwI0_Cr1j6rxdM2kKe7AKxVWUAVWUtwAS0I0E0xvYzxvE 52x082IY62kv0487Mc804VCY07AIYIkI8VC2zVCFFI0UMc02F40EFcxC0VAKzVAqx4xG6I 80ewAv7VC0I7IYx2IY67AKxVWUtVWrXwAv7VC2z280aVAFwI0_Gr0_Cr1lOx8S6xCaFVCj c4AY6r1j6r4UM4x0Y48IcxkI7VAKI48JMxkF7I0En4kS14v26r1q6r43MxAIw28IcxkI7V AKI48JMxAIw28IcVCjz48v1sIEY20_WwCFx2IqxVCFs4IE7xkEbVWUJVW8JwCFI7km07C2 67AKxVWUAVWUtwC20s026c02F40E14v26r1j6r18MI8I3I0E7480Y4vE14v26r106r1rMI 8E67AF67kF1VAFwI0_GFv_WrylIxkGc2Ij64vIr41lIxAIcVC0I7IYx2IY67AKxVW8JVW5 JwCI42IY6xIIjxv20xvEc7CjxVAFwI0_Gr0_Cr1lIxAIcVCF04k26cxKx2IYs7xG6r1j6r 1xMIIF0xvEx4A2jsIE14v26r4j6F4UMIIF0xvEx4A2jsIEc7CjxVAFwI0_Gr0_Gr1UYxBI daVFxhVjvjDU0xZFpf9x07j0zuAUUUUU= X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,SPF_HELO_PASS, SPF_PASS 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1750109368038537541?= X-GMAIL-MSGID: =?utf-8?q?1750109368038537541?= This gpio driver doesn't cover CPU_LOONGSON64 platforms, because of gpio address was wrong and I don't plan to support it thus move this driver to arch/mips/loongson2ef/ so that I can drop the shackles of the legacy driver and add a new driver that supports dts/acpi to support LoongArch platforms. Signed-off-by: Yinbo Zhu --- MAINTAINERS | 2 +- arch/loongarch/configs/loongson3_defconfig | 1 - arch/loongarch/include/asm/loongson.h | 6 ------ arch/mips/configs/lemote2f_defconfig | 1 - arch/mips/configs/loongson2k_defconfig | 1 - arch/mips/configs/loongson3_defconfig | 1 - arch/mips/include/asm/mach-loongson64/loongson.h | 5 ----- arch/mips/loongson2ef/common/Makefile | 1 + .../gpio-loongson.c => arch/mips/loongson2ef/common/gpio.c | 2 +- drivers/gpio/Kconfig | 6 ------ drivers/gpio/Makefile | 1 - 11 files changed, 3 insertions(+), 24 deletions(-) rename drivers/gpio/gpio-loongson.c => arch/mips/loongson2ef/common/gpio.c (98%) diff --git a/MAINTAINERS b/MAINTAINERS index 916b2d9cffc0..7b80a64b70b9 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -13881,7 +13881,7 @@ M: Jiaxun Yang L: linux-mips@vger.kernel.org S: Maintained F: arch/mips/include/asm/mach-loongson2ef/ -F: arch/mips/loongson2ef/ +F: arch/mips/loongson2ef/* F: drivers/cpufreq/loongson2_cpufreq.c MIPS/LOONGSON64 ARCHITECTURE diff --git a/arch/loongarch/configs/loongson3_defconfig b/arch/loongarch/configs/loongson3_defconfig index 3540e9c0a631..d576d802ffd0 100644 --- a/arch/loongarch/configs/loongson3_defconfig +++ b/arch/loongarch/configs/loongson3_defconfig @@ -601,7 +601,6 @@ CONFIG_I2C_PIIX4=y CONFIG_I2C_GPIO=y CONFIG_SPI=y CONFIG_GPIO_SYSFS=y -CONFIG_GPIO_LOONGSON=y CONFIG_SENSORS_LM75=m CONFIG_SENSORS_LM93=m CONFIG_SENSORS_W83795=m diff --git a/arch/loongarch/include/asm/loongson.h b/arch/loongarch/include/asm/loongson.h index 00db93edae1b..87587688fab8 100644 --- a/arch/loongarch/include/asm/loongson.h +++ b/arch/loongarch/include/asm/loongson.h @@ -29,12 +29,6 @@ #define LOONGSON_REG_SIZE 0x00100000 /* 1M */ #define LOONGSON_REG_TOP (LOONGSON_REG_BASE+LOONGSON_REG_SIZE-1) -/* GPIO Regs - r/w */ - -#define LOONGSON_GPIODATA LOONGSON_REG(0x11c) -#define LOONGSON_GPIOIE LOONGSON_REG(0x120) -#define LOONGSON_REG_GPIO_BASE (LOONGSON_REG_BASE + 0x11c) - #define MAX_PACKAGES 16 #define xconf_readl(addr) readl(addr) diff --git a/arch/mips/configs/lemote2f_defconfig b/arch/mips/configs/lemote2f_defconfig index 7e598d338979..81264ccaacfc 100644 --- a/arch/mips/configs/lemote2f_defconfig +++ b/arch/mips/configs/lemote2f_defconfig @@ -127,7 +127,6 @@ CONFIG_SERIAL_8250_EXTENDED=y CONFIG_SERIAL_8250_MANY_PORTS=y CONFIG_SERIAL_8250_FOURPORT=y CONFIG_HW_RANDOM=y -CONFIG_GPIO_LOONGSON=y CONFIG_THERMAL=y CONFIG_MEDIA_SUPPORT=m CONFIG_FB=y diff --git a/arch/mips/configs/loongson2k_defconfig b/arch/mips/configs/loongson2k_defconfig index 728bef666f7a..f11be40ccb4e 100644 --- a/arch/mips/configs/loongson2k_defconfig +++ b/arch/mips/configs/loongson2k_defconfig @@ -230,7 +230,6 @@ CONFIG_SERIAL_NONSTANDARD=y CONFIG_HW_RANDOM=y CONFIG_I2C_CHARDEV=y CONFIG_I2C_PIIX4=y -CONFIG_GPIO_LOONGSON=y CONFIG_SENSORS_LM75=m CONFIG_SENSORS_LM93=m CONFIG_SENSORS_W83627HF=m diff --git a/arch/mips/configs/loongson3_defconfig b/arch/mips/configs/loongson3_defconfig index aca66a5f330d..82de65130722 100644 --- a/arch/mips/configs/loongson3_defconfig +++ b/arch/mips/configs/loongson3_defconfig @@ -269,7 +269,6 @@ CONFIG_VIRTIO_CONSOLE=y CONFIG_HW_RANDOM=y CONFIG_I2C_CHARDEV=y CONFIG_I2C_PIIX4=y -CONFIG_GPIO_LOONGSON=y CONFIG_SENSORS_LM75=m CONFIG_SENSORS_LM93=m CONFIG_SENSORS_W83627HF=m diff --git a/arch/mips/include/asm/mach-loongson64/loongson.h b/arch/mips/include/asm/mach-loongson64/loongson.h index f7c3ab6d724e..51ee80d98742 100644 --- a/arch/mips/include/asm/mach-loongson64/loongson.h +++ b/arch/mips/include/asm/mach-loongson64/loongson.h @@ -177,11 +177,6 @@ extern int mach_i8259_irq(void); #define LOONGSON_PCIMEMBASECFG LOONGSON_REG(LOONGSON_REGBASE + 0x14) #define LOONGSON_PCIMAP_CFG LOONGSON_REG(LOONGSON_REGBASE + 0x18) -/* GPIO Regs - r/w */ - -#define LOONGSON_GPIODATA LOONGSON_REG(LOONGSON_REGBASE + 0x1c) -#define LOONGSON_GPIOIE LOONGSON_REG(LOONGSON_REGBASE + 0x20) - /* ICU Configuration Regs - r/w */ #define LOONGSON_INTEDGE LOONGSON_REG(LOONGSON_REGBASE + 0x24) diff --git a/arch/mips/loongson2ef/common/Makefile b/arch/mips/loongson2ef/common/Makefile index 30ea8b5ca685..4d4063f90cc5 100644 --- a/arch/mips/loongson2ef/common/Makefile +++ b/arch/mips/loongson2ef/common/Makefile @@ -14,6 +14,7 @@ obj-$(CONFIG_LOONGSON_UART_BASE) += serial.o obj-$(CONFIG_EARLY_PRINTK) += serial.o obj-$(CONFIG_LOONGSON_UART_BASE) += uart_base.o obj-$(CONFIG_LOONGSON_MC146818) += rtc.o +obj-$(CONFIG_GPIOLIB) += gpio.o # # Enable CS5536 Virtual Support Module(VSM) to virtulize the PCI configure diff --git a/drivers/gpio/gpio-loongson.c b/arch/mips/loongson2ef/common/gpio.c similarity index 98% rename from drivers/gpio/gpio-loongson.c rename to arch/mips/loongson2ef/common/gpio.c index a42145873cc9..0d3e7aef46d3 100644 --- a/drivers/gpio/gpio-loongson.c +++ b/arch/mips/loongson2ef/common/gpio.c @@ -1,6 +1,6 @@ // SPDX-License-Identifier: GPL-2.0-or-later /* - * Loongson-2F/3A/3B GPIO Support + * Loongson-2F GPIO Support * * Copyright (c) 2008 Richard Liu, STMicroelectronics * Copyright (c) 2008-2010 Arnaud Patard diff --git a/drivers/gpio/Kconfig b/drivers/gpio/Kconfig index a01af1180616..bc55b80f212a 100644 --- a/drivers/gpio/Kconfig +++ b/drivers/gpio/Kconfig @@ -375,12 +375,6 @@ config GPIO_LOGICVC Say yes here to support GPIO functionality of the Xylon LogiCVC programmable logic block. -config GPIO_LOONGSON - bool "Loongson-2/3 GPIO support" - depends on CPU_LOONGSON2EF || CPU_LOONGSON64 - help - Driver for GPIO functionality on Loongson-2F/3A/3B processors. - config GPIO_LPC18XX tristate "NXP LPC18XX/43XX GPIO support" default y if ARCH_LPC18XX diff --git a/drivers/gpio/Makefile b/drivers/gpio/Makefile index 29e3beb6548c..cfd298e00737 100644 --- a/drivers/gpio/Makefile +++ b/drivers/gpio/Makefile @@ -77,7 +77,6 @@ obj-$(CONFIG_GPIO_JANZ_TTL) += gpio-janz-ttl.o obj-$(CONFIG_GPIO_KEMPLD) += gpio-kempld.o obj-$(CONFIG_GPIO_LOGICVC) += gpio-logicvc.o obj-$(CONFIG_GPIO_LOONGSON1) += gpio-loongson1.o -obj-$(CONFIG_GPIO_LOONGSON) += gpio-loongson.o obj-$(CONFIG_GPIO_LP3943) += gpio-lp3943.o obj-$(CONFIG_GPIO_LP873X) += gpio-lp873x.o obj-$(CONFIG_GPIO_LP87565) += gpio-lp87565.o From patchwork Mon Nov 21 12:38:02 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yinbo Zhu X-Patchwork-Id: 23721 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:f944:0:0:0:0:0 with SMTP id q4csp1559426wrr; Mon, 21 Nov 2022 04:38:53 -0800 (PST) X-Google-Smtp-Source: AA0mqf6GoC1FLo8WoXyGwmnxfmp6RTA2M06dSjWWxIFjEvxbviQ9COh2wYwqye+dWY7TQSbL6h7V X-Received: by 2002:a17:90a:8d13:b0:213:c15:6f08 with SMTP id c19-20020a17090a8d1300b002130c156f08mr19887061pjo.134.1669034333236; Mon, 21 Nov 2022 04:38:53 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1669034333; cv=none; d=google.com; s=arc-20160816; b=0IwvCVvxh8IvBgXl3X4X23+FSU4UevfqX6jEUgZ+qNH80mAToPMG4iXEA0QoD3ImXl sYJyqKZ6/CQD1dkoHC3BHE89hDJdJA7IxZXqhSaBL5UjWMmZ/K7kRmbJ4hYFmogrX33e V8t2dFeMWCMtbUiVgGDcY0054tteBRylXRJ1pBhsJjqtGB+ZLW9DvlHqIn45/lmlanqt APQsgKUTPWVgbW71G2KlqAcFeBICZccFGJlVvPUbjh8JJf0TQ14m1xonkhID/EedJPlP bP/HBAkNOqFQub8vjlWtt7dVj9aftgI0jvrEyfdtmFNwAj6fIc4ImWtmbjqkWuXk/Klp AzOw== 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 :references:in-reply-to:message-id:date:subject:cc:to:from; bh=n8h8Yj4FlSX2u0KGVOd5rCXuQfL4zHaZQ7+cCYm0JAA=; b=xzTsm8SPqUUCKRd+8In0AhzTh3MOH114j76ts/Am3nqo1tZzMZzrbD5ncot7nths+g 0berEJ0OCYzbANMcErmUUF6n6oFoUpTuLZeba7E2A0W16LihSIIuIh4wnio/C1JsBg5o Q/4NCk4a+Xf6xsmUp07WuLIsHZTY64YwevGgvrIYt5/DLq6gGLrZwozOPgEXzz5mZeYS GiIB+aJaA657rp2bZphRPfgFAt7gSA2WEVCE6+ROmrb9q8pq3wf7liSAx2TLlWaTFatg VAapDjzc1P9PVr8OiYYb4Kt0aPMLaC0RCLwVIceIxK87OSuNXFvve7e/058L7pfYdYIC sCtg== ARC-Authentication-Results: i=1; mx.google.com; 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 Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id v135-20020a63618d000000b0047764bac806si3820251pgb.749.2022.11.21.04.38.37; Mon, 21 Nov 2022 04:38:53 -0800 (PST) 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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231528AbiKUMi0 (ORCPT + 99 others); Mon, 21 Nov 2022 07:38:26 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58456 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231530AbiKUMiU (ORCPT ); Mon, 21 Nov 2022 07:38:20 -0500 Received: from loongson.cn (mail.loongson.cn [114.242.206.163]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 9FAA7AD471; Mon, 21 Nov 2022 04:38:15 -0800 (PST) Received: from loongson.cn (unknown [10.180.13.64]) by gateway (Coremail) with SMTP id _____8Axjrc2cXtjYRoJAA--.20443S3; Mon, 21 Nov 2022 20:38:14 +0800 (CST) Received: from localhost.localdomain (unknown [10.180.13.64]) by localhost.localdomain (Coremail) with SMTP id AQAAf8CxXuAwcXtjXpkXAA--.61043S3; Mon, 21 Nov 2022 20:38:13 +0800 (CST) From: Yinbo Zhu To: Linus Walleij , Bartosz Golaszewski , Rob Herring , Krzysztof Kozlowski , WANG Xuerui , Jiaxun Yang , Thomas Bogendoerfer , Juxin Gao , Bibo Mao , Yanteng Si , linux-gpio@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, loongarch@lists.linux.dev, linux-mips@vger.kernel.org, Arnaud Patard , Huacai Chen , Yinbo Zhu Cc: Jianmin Lv , Hongchen Zhang , Liu Peibao Subject: [PATCH v5 2/3] gpio: loongson: add gpio driver support Date: Mon, 21 Nov 2022 20:38:02 +0800 Message-Id: <20221121123803.3786-2-zhuyinbo@loongson.cn> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20221121123803.3786-1-zhuyinbo@loongson.cn> References: <20221121123803.3786-1-zhuyinbo@loongson.cn> MIME-Version: 1.0 X-CM-TRANSID: AQAAf8CxXuAwcXtjXpkXAA--.61043S3 X-CM-SenderInfo: 52kx5xhqerqz5rrqw2lrqou0/ X-Coremail-Antispam: 1Uk129KBjvAXoWfGw1kWF1rCr1UCr13Ww1rWFg_yoW8JF1rCo W7WFZ8W3y8Xr17X3WFqFyFqFW7ZFn0qF40ywn2yFs8Gan8t3s8try3G3y3XFyFvFyFqFyx ZFyfur4fGFZ7tFs8n29KB7ZKAUJUUUUf529EdanIXcx71UUUUU7KY7ZEXasCq-sGcSsGvf J3Ic02F40EFcxC0VAKzVAqx4xG6I80ebIjqfuFe4nvWSU5nxnvy29KBjDU0xBIdaVrnRJU UUB01xkIjI8I6I8E6xAIw20EY4v20xvaj40_Wr0E3s1l1IIY67AEw4v_Jrv_JF1l8cAvFV AK0II2c7xJM28CjxkF64kEwVA0rcxSw2x7M28EF7xvwVC0I7IYx2IY67AKxVW5JVW7JwA2 z4x0Y4vE2Ix0cI8IcVCY1x0267AKxVW8JVWxJwA2z4x0Y4vEx4A2jsIE14v26r4UJVWxJr 1l84ACjcxK6I8E87Iv6xkF7I0E14v26F4UJVW0owAaw2AFwI0_JF0_Jw1le2I262IYc4CY 6c8Ij28IcVAaY2xG8wAqjxCEc2xF0cIa020Ex4CE44I27wAqx4xG64xvF2IEw4CE5I8CrV C2j2WlYx0E2Ix0cI8IcVAFwI0_Jw0_WrylYx0Ex4A2jsIE14v26r4j6F4UMcvjeVCFs4IE 7xkEbVWUJVW8JwACjcxG0xvY0x0EwIxGrwCY1x0262kKe7AKxVWUtVW8ZwCF04k20xvY0x 0EwIxGrwCF04k20xvE74AGY7Cv6cx26rWl4I8I3I0E4IkC6x0Yz7v_Jr0_Gr1l4IxYO2xF xVAFwI0_JF0_Jw1lx2IqxVAqx4xG67AKxVWUJVWUGwC20s026x8GjcxK67AKxVWUGVWUWw C2zVAF1VAY17CE14v26r4a6rW5MIIYrxkI7VAKI48JMIIF0xvE2Ix0cI8IcVAFwI0_Xr0_ Ar1lIxAIcVC0I7IYx2IY6xkF7I0E14v26r4j6F4UMIIF0xvE42xK8VAvwI8IcIk0rVWUJV WUCwCI42IY6I8E87Iv67AKxVW8JVWxJwCI42IY6I8E87Iv6xkF7I0E14v26r4j6r4UJbIY CTnIWIevJa73UjIFyTuYvjxU2iFxUUUUU X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,SPF_HELO_PASS, SPF_PASS 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1750109345260780695?= X-GMAIL-MSGID: =?utf-8?q?1750109345260780695?= The Loongson platforms GPIO controller contains 60 GPIO pins in total, 4 of which are dedicated GPIO pins, and the remaining 56 are reused with other functions. Each GPIO can set input/output and has the interrupt capability. This driver added support for Loongson GPIO controller and support to use DTS or ACPI to descibe GPIO device resources. Signed-off-by: Jianmin Lv Signed-off-by: Hongchen Zhang Signed-off-by: Liu Peibao Signed-off-by: Juxin Gao Signed-off-by: Yinbo Zhu --- Change in v5: 1. Move legacy gpio driver to proper location. 2. Remove the "gpio_base". 3. Add of_device_id and acpi_device_id data field for platform data. 4. Remove the ACPI_PTR(). 5. Remove the gpio label judgement logic and use mode instead. 6. Drop platform_loongson_gpio_get_props. 7. Using devres for all resource. 8. Remove the loongson_gpio_remove. 9. Remove the unmatched print information. 10. Remove the loongson_gpio_exit. Change in v4: 1. Fixup name spelling about Signed-off-by. 2. Drop "series" here and everywhere else. 3. Fixup the copyright in driver. 4. Drop the "else" in loongson_gpio_request. 5. Use trinocular operation replace the related logic. 6. Remove lable judgement in context about "lgpio->chip.to_irq = loongson_gpio_to_irq" 7. Use dev_err replace pr_err in probe. 8. Make legacy platform_data should be left out of this patch. 9. Remove the mips config in gpio Kconfig. Change in v3: 1. Move the gpio platform data struct from arch/ into include/linux/ platform_data/. 2. Replace platform_gpio_data with loongson_gpio_platform_data in .c. 3. Add maintainer in MAINTAINERS file for include/linux/platform_data/ gpio-loongson.h and gpio-loongson.c Change in v2: 1. Fixup of_loongson_gpio_get_props and remove the parse logic about "loongson,conf_offset", "loongson,out_offset", "loongson,in_offset", "loongson,gpio_base", "loongson,support_irq" then kernel driver will initial them that depend compatible except "loongson,gpio_base". MAINTAINERS | 7 + drivers/gpio/Kconfig | 10 ++ drivers/gpio/Makefile | 1 + drivers/gpio/gpio-loongson.c | 306 +++++++++++++++++++++++++++++++++++ 4 files changed, 324 insertions(+) create mode 100644 drivers/gpio/gpio-loongson.c diff --git a/MAINTAINERS b/MAINTAINERS index 7b80a64b70b9..47721a25249f 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -12048,6 +12048,13 @@ S: Maintained F: Documentation/devicetree/bindings/hwinfo/loongson,ls2k-chipid.yaml F: drivers/soc/loongson/loongson2_guts.c +LOONGSON GPIO DRIVER +M: Yinbo Zhu +L: linux-gpio@vger.kernel.org +S: Maintained +F: drivers/gpio/gpio-loongson.c +F: include/linux/platform_data/gpio-loongson.h + LSILOGIC MPT FUSION DRIVERS (FC/SAS/SPI) M: Sathya Prakash M: Sreekanth Reddy diff --git a/drivers/gpio/Kconfig b/drivers/gpio/Kconfig index bc55b80f212a..3986b471647d 100644 --- a/drivers/gpio/Kconfig +++ b/drivers/gpio/Kconfig @@ -375,6 +375,16 @@ config GPIO_LOGICVC Say yes here to support GPIO functionality of the Xylon LogiCVC programmable logic block. +config GPIO_LOONGSON + tristate "Loongson GPIO support" + depends on LOONGARCH || COMPILE_TEST + help + Say yes here to support the GPIO functionality of a number of + Loongson series of chips. The Loongson GPIO controller supports + up to 60 GPIOS in total, 4 of which are dedicated GPIO pins, and + the remaining 56 are reused with other functions, with edge or + level triggered interrupts. + config GPIO_LPC18XX tristate "NXP LPC18XX/43XX GPIO support" default y if ARCH_LPC18XX diff --git a/drivers/gpio/Makefile b/drivers/gpio/Makefile index cfd298e00737..29e3beb6548c 100644 --- a/drivers/gpio/Makefile +++ b/drivers/gpio/Makefile @@ -77,6 +77,7 @@ obj-$(CONFIG_GPIO_JANZ_TTL) += gpio-janz-ttl.o obj-$(CONFIG_GPIO_KEMPLD) += gpio-kempld.o obj-$(CONFIG_GPIO_LOGICVC) += gpio-logicvc.o obj-$(CONFIG_GPIO_LOONGSON1) += gpio-loongson1.o +obj-$(CONFIG_GPIO_LOONGSON) += gpio-loongson.o obj-$(CONFIG_GPIO_LP3943) += gpio-lp3943.o obj-$(CONFIG_GPIO_LP873X) += gpio-lp873x.o obj-$(CONFIG_GPIO_LP87565) += gpio-lp87565.o diff --git a/drivers/gpio/gpio-loongson.c b/drivers/gpio/gpio-loongson.c new file mode 100644 index 000000000000..9fb65ba2c4bd --- /dev/null +++ b/drivers/gpio/gpio-loongson.c @@ -0,0 +1,306 @@ +// SPDX-License-Identifier: GPL-2.0+ +/* + * Loongson GPIO Support + * + * Copyright (C) 2022 Loongson Technology Corporation Limited + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#define LOONGSON_GPIO_IN(x) (x->base + x->p_data->in_offset) +#define LOONGSON_GPIO_OUT(x) (x->base + x->p_data->out_offset) +#define LOONGSON_GPIO_OEN(x) (x->base + x->p_data->conf_offset) + +#define LOONGSON_GPIO_IN_BYTE(x, gpio) (x->base +\ + x->p_data->in_offset + gpio) +#define LOONGSON_GPIO_OUT_BYTE(x, gpio) (x->base +\ + x->p_data->out_offset + gpio) +#define LOONGSON_GPIO_OEN_BYTE(x, gpio) (x->base +\ + x->p_data->conf_offset + gpio) + +enum loongson_gpio_mode { + BIT_CTRL_MODE, + BYTE_CTRL_MODE, +}; + +struct loongson_gpio_platform_data { + const char *label; + enum loongson_gpio_mode mode; + int conf_offset; + int out_offset; + int in_offset; +}; + +struct loongson_gpio_chip { + struct gpio_chip chip; + spinlock_t lock; + void __iomem *base; + u16 *gsi_idx_map; + u16 mapsize; + const struct loongson_gpio_platform_data *p_data; +}; + +static int loongson_gpio_request( + struct gpio_chip *chip, unsigned int pin) +{ + if (pin >= chip->ngpio) + return -EINVAL; + + return 0; +} + +static inline void __set_direction(struct loongson_gpio_chip *lgpio, + unsigned int pin, int input) +{ + u64 qval; + u8 bval; + + if (lgpio->p_data->mode == BIT_CTRL_MODE) { + qval = readq(LOONGSON_GPIO_OEN(lgpio)); + if (input) + qval |= 1ULL << pin; + else + qval &= ~(1ULL << pin); + writeq(qval, LOONGSON_GPIO_OEN(lgpio)); + } else { + bval = input ? 1 : 0; + writeb(bval, LOONGSON_GPIO_OEN_BYTE(lgpio, pin)); + } +} + +static void __set_level(struct loongson_gpio_chip *lgpio, unsigned int pin, + int high) +{ + u64 qval; + u8 bval; + + if (lgpio->p_data->mode == BIT_CTRL_MODE) { + qval = readq(LOONGSON_GPIO_OUT(lgpio)); + if (high) + qval |= 1ULL << pin; + else + qval &= ~(1ULL << pin); + writeq(qval, LOONGSON_GPIO_OUT(lgpio)); + } else { + bval = high ? 1 : 0; + writeb(bval, LOONGSON_GPIO_OUT_BYTE(lgpio, pin)); + } +} + +static int loongson_gpio_direction_input( + struct gpio_chip *chip, unsigned int pin) +{ + unsigned long flags; + struct loongson_gpio_chip *lgpio = + container_of(chip, struct loongson_gpio_chip, chip); + + spin_lock_irqsave(&lgpio->lock, flags); + __set_direction(lgpio, pin, 1); + spin_unlock_irqrestore(&lgpio->lock, flags); + + return 0; +} + +static int loongson_gpio_direction_output( + struct gpio_chip *chip, unsigned int pin, + int value) +{ + struct loongson_gpio_chip *lgpio = + container_of(chip, struct loongson_gpio_chip, chip); + unsigned long flags; + + spin_lock_irqsave(&lgpio->lock, flags); + __set_level(lgpio, pin, value); + __set_direction(lgpio, pin, 0); + spin_unlock_irqrestore(&lgpio->lock, flags); + + return 0; +} + +static int loongson_gpio_get(struct gpio_chip *chip, unsigned int pin) +{ + u64 qval; + u8 bval; + int val; + + struct loongson_gpio_chip *lgpio = + container_of(chip, struct loongson_gpio_chip, chip); + + if (lgpio->p_data->mode == BIT_CTRL_MODE) { + qval = readq(LOONGSON_GPIO_IN(lgpio)); + val = (qval & (1ULL << pin)) != 0; + } else { + bval = readb(LOONGSON_GPIO_IN_BYTE(lgpio, pin)); + val = bval & 1; + } + + return val; +} + +static void loongson_gpio_set(struct gpio_chip *chip, unsigned int pin, + int value) +{ + unsigned long flags; + struct loongson_gpio_chip *lgpio = + container_of(chip, struct loongson_gpio_chip, chip); + + spin_lock_irqsave(&lgpio->lock, flags); + __set_level(lgpio, pin, value); + spin_unlock_irqrestore(&lgpio->lock, flags); +} + +static int loongson_gpio_to_irq( + struct gpio_chip *chip, unsigned int offset) +{ + struct platform_device *pdev = + container_of(chip->parent, struct platform_device, dev); + struct loongson_gpio_chip *lgpio = + container_of(chip, struct loongson_gpio_chip, chip); + + if (offset >= chip->ngpio) + return -EINVAL; + + if ((lgpio->gsi_idx_map != NULL) && (offset < lgpio->mapsize)) + offset = lgpio->gsi_idx_map[offset]; + else + return -EINVAL; + + return platform_get_irq(pdev, offset); +} + +static int loongson_gpio_init( + struct device *dev, struct loongson_gpio_chip *lgpio, + struct device_node *np, void __iomem *base) +{ + lgpio->chip.request = loongson_gpio_request; + lgpio->chip.direction_input = loongson_gpio_direction_input; + lgpio->chip.get = loongson_gpio_get; + lgpio->chip.direction_output = loongson_gpio_direction_output; + lgpio->chip.set = loongson_gpio_set; + lgpio->chip.can_sleep = 0; + lgpio->chip.of_node = np; + lgpio->chip.parent = dev; + lgpio->chip.label = lgpio->p_data->label; + spin_lock_init(&lgpio->lock); + lgpio->base = (void __iomem *)base; + lgpio->chip.to_irq = loongson_gpio_to_irq; + + devm_gpiochip_add_data(dev, &lgpio->chip, lgpio); + + return 0; +} + +static void loongson_gpio_get_props(struct platform_device *pdev, + struct loongson_gpio_chip *lgpio) +{ + int rval; + u32 ngpios; + struct device *dev = &pdev->dev; + + device_property_read_u32(dev, "ngpios", &ngpios); + lgpio->chip.ngpio = ngpios; + + rval = device_property_read_u16_array(dev, "gsi_idx_map", NULL, 0); + if (rval > 0) { + lgpio->gsi_idx_map = + devm_kmalloc_array(dev, rval, sizeof(*lgpio->gsi_idx_map), + GFP_KERNEL); + if (lgpio->gsi_idx_map) { + lgpio->mapsize = rval; + device_property_read_u16_array(dev, "gsi_idx_map", + lgpio->gsi_idx_map, lgpio->mapsize); + } + } +} + +static int loongson_gpio_probe(struct platform_device *pdev) +{ + void __iomem *base; + struct loongson_gpio_chip *lgpio; + struct device_node *np = pdev->dev.of_node; + struct device *dev = &pdev->dev; + + lgpio = devm_kzalloc(dev, sizeof(*lgpio), GFP_KERNEL); + if (!lgpio) + return -ENOMEM; + + loongson_gpio_get_props(pdev, lgpio); + + lgpio->p_data = device_get_match_data(&pdev->dev); + + base = devm_platform_ioremap_resource(pdev, 0); + if (IS_ERR(base)) + return PTR_ERR(base); + + platform_set_drvdata(pdev, lgpio); + + loongson_gpio_init(dev, lgpio, np, base); + + return 0; +} + +static const struct loongson_gpio_platform_data loongson_gpio_pdata0 = { + .label = "ls2k_gpio", + .mode = BIT_CTRL_MODE, + .conf_offset = 0x0, + .in_offset = 0x10, + .out_offset = 0x20, +}; + +static const struct loongson_gpio_platform_data loongson_gpio_pdata1 = { + .label = "ls7a_gpio", + .mode = BYTE_CTRL_MODE, + .conf_offset = 0x800, + .in_offset = 0x900, + .out_offset = 0xa00, +}; + +static const struct of_device_id loongson_gpio_of_match[] = { + { + .compatible = "loongson,ls2k-gpio", + .data = &loongson_gpio_pdata0, + }, + { + .compatible = "loongson,ls7a-gpio", + .data = &loongson_gpio_pdata1, + }, + {} +}; +MODULE_DEVICE_TABLE(of, loongson_gpio_of_match); + +static const struct acpi_device_id loongson_gpio_acpi_match[] = { + { + .id = "LOON0002", + .driver_data = (kernel_ulong_t)&loongson_gpio_pdata1, + }, + {} +}; +MODULE_DEVICE_TABLE(acpi, loongson_gpio_acpi_match); + +static struct platform_driver loongson_gpio_driver = { + .driver = { + .name = "loongson-gpio", + .owner = THIS_MODULE, + .of_match_table = loongson_gpio_of_match, + .acpi_match_table = loongson_gpio_acpi_match, + }, + .probe = loongson_gpio_probe, +}; + +static int __init loongson_gpio_setup(void) +{ + return platform_driver_register(&loongson_gpio_driver); +} +postcore_initcall(loongson_gpio_setup); + +MODULE_DESCRIPTION("Loongson gpio driver"); +MODULE_LICENSE("GPL"); From patchwork Mon Nov 21 12:38:03 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yinbo Zhu X-Patchwork-Id: 23723 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:f944:0:0:0:0:0 with SMTP id q4csp1559764wrr; Mon, 21 Nov 2022 04:39:30 -0800 (PST) X-Google-Smtp-Source: AA0mqf5A7huhxAvflE/O0f0z7jFxVDTVzESjJ/mf2z2PYcdgE5bshWtipCHYdooy4O1gXzsy/BfP X-Received: by 2002:a65:694e:0:b0:474:6749:407d with SMTP id w14-20020a65694e000000b004746749407dmr2265pgq.425.1669034370517; Mon, 21 Nov 2022 04:39:30 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1669034370; cv=none; d=google.com; s=arc-20160816; b=nXA9RPO/kKKWmFvdNloNrShLgubim7+ORJXrP++JYQzzeFQv7u7HVhlo3XcoryYxKk 263PWJeWpYo6+sBXN20roc9nr/z81+gpE0X4shF1OuQHaz0DD0RDhGg683Kiig+6x8fD /Z3cu+pRBQoUy8Z0hohCpIqoKeW4z7ohwiLbLejKwl4T4aWe9GJH3nuOhyuZWxba/Taq 96e70Wvtw2BxI5H1BnX+2CUneSHZGFMUNVE1qeK7vWT2kFUT3VPXGwj/Ns0tP7HIFsmq NFVJ1bB2jABzmoj8laCO2Dd7nhbZOnVyHqYC11rz/DbrVxsuhQVdadUfBVPqvCAZTxCG hZRg== 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 :references:in-reply-to:message-id:date:subject:cc:to:from; bh=F5XFeSNRVtGsSPviwddG2uUTHe8qdDOZlVxaaLmQJIs=; b=Px7hmn9l4BYFAxJgSsgE5fFtv7BIWcqvvWxZGXmgCdZbdNsNLDFOqxWht7QdgGwIEx 1MgkADsiOZa1Yit6kIkDDsv4EyC/tnz6V/XayAMDqx9QgLtiOhp6wUEiiyBjFYyG9uMa d3WzZzB78Ik6mJrk6dNmFvnv1TGi5wWXYxJ5NigPWTjOuEq7BEbUqGnKWsBWUc/VmfPm 5MqjXzvlXJjvKYx1lw9tk4ja+HsP+SQ42qtOBllVhQgSnmaDZUJEIZjUvtlqn8BLLmRI DJA1X1U2FopI1hdLbveG7sTAzHj5iS2SmdaeFDQE6g9fwkQ3seow/xtO7thdsZCr48Ef kVcw== ARC-Authentication-Results: i=1; mx.google.com; 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 Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id jx15-20020a17090b46cf00b0020a74d5486esi13302633pjb.21.2022.11.21.04.39.14; Mon, 21 Nov 2022 04:39:30 -0800 (PST) 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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230221AbiKUMim (ORCPT + 99 others); Mon, 21 Nov 2022 07:38:42 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58564 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231532AbiKUMiV (ORCPT ); Mon, 21 Nov 2022 07:38:21 -0500 Received: from loongson.cn (mail.loongson.cn [114.242.206.163]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id B2A05B6B35; Mon, 21 Nov 2022 04:38:16 -0800 (PST) Received: from loongson.cn (unknown [10.180.13.64]) by gateway (Coremail) with SMTP id _____8DxTts3cXtjaxoJAA--.25367S3; Mon, 21 Nov 2022 20:38:15 +0800 (CST) Received: from localhost.localdomain (unknown [10.180.13.64]) by localhost.localdomain (Coremail) with SMTP id AQAAf8CxXuAwcXtjXpkXAA--.61043S4; Mon, 21 Nov 2022 20:38:13 +0800 (CST) From: Yinbo Zhu To: Linus Walleij , Bartosz Golaszewski , Rob Herring , Krzysztof Kozlowski , WANG Xuerui , Jiaxun Yang , Thomas Bogendoerfer , Juxin Gao , Bibo Mao , Yanteng Si , linux-gpio@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, loongarch@lists.linux.dev, linux-mips@vger.kernel.org, Arnaud Patard , Huacai Chen , Yinbo Zhu Cc: Krzysztof Kozlowski Subject: [PATCH v5 3/3] dt-bindings: gpio: add loongson gpio Date: Mon, 21 Nov 2022 20:38:03 +0800 Message-Id: <20221121123803.3786-3-zhuyinbo@loongson.cn> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20221121123803.3786-1-zhuyinbo@loongson.cn> References: <20221121123803.3786-1-zhuyinbo@loongson.cn> MIME-Version: 1.0 X-CM-TRANSID: AQAAf8CxXuAwcXtjXpkXAA--.61043S4 X-CM-SenderInfo: 52kx5xhqerqz5rrqw2lrqou0/ X-Coremail-Antispam: 1Uk129KBjvJXoWxXF47tF45Wry5Zw45GFWxWFg_yoWrtr1fp3 WDZFZxX3y2grnxtFs8Ka17Zr4fAr1kC3WrurnxC3yxtrWUKwn8XFWfWFykG3Z3WrWUXF17 JwsrurWrta43Aw7anT9S1TB71UUUUjJqnTZGkaVYY2UrUUUUj1kv1TuYvTs0mT0YCTnIWj qI5I8CrVACY4xI64kE6c02F40Ex7xfYxn0WfASr-VFAUDa7-sFnT9fnUUIcSsGvfJTRUUU bfAFc2x0x2IEx4CE42xK8VAvwI8IcIk0rVWrJVCq3wAFIxvE14AKwVWUXVWUAwA2ocxC64 kIII0Yj41l84x0c7CEw4AK67xGY2AK021l84ACjcxK6xIIjxv20xvE14v26ryj6F1UM28E F7xvwVC0I7IYx2IY6xkF7I0E14v26F4j6r4UJwA2z4x0Y4vEx4A2jsIE14v26r4UJVWxJr 1l84ACjcxK6I8E87Iv6xkF7I0E14v26F4UJVW0owAaw2AFwI0_JF0_Jw1le2I262IYc4CY 6c8Ij28IcVAaY2xG8wAqjxCEc2xF0cIa020Ex4CE44I27wAqx4xG64xvF2IEw4CE5I8CrV C2j2WlYx0E2Ix0cI8IcVAFwI0_Wrv_ZF1lYx0Ex4A2jsIE14v26r4j6F4UMcvjeVCFs4IE 7xkEbVWUJVW8JwACjcxG0xvY0x0EwIxGrwCY1x0262kKe7AKxVWUtVW8ZwCF04k20xvY0x 0EwIxGrwCF04k20xvE74AGY7Cv6cx26rWl4I8I3I0E4IkC6x0Yz7v_Jr0_Gr1l4IxYO2xF xVAFwI0_JF0_Jw1lx2IqxVAqx4xG67AKxVWUJVWUGwC20s026x8GjcxK67AKxVWUGVWUWw C2zVAF1VAY17CE14v26r4a6rW5MIIYrxkI7VAKI48JMIIF0xvE2Ix0cI8IcVAFwI0_Xr0_ Ar1lIxAIcVC0I7IYx2IY6xkF7I0E14v26F4j6r4UJwCI42IY6xAIw20EY4v20xvaj40_Jr 0_JF4lIxAIcVC2z280aVAFwI0_Gr0_Cr1lIxAIcVC2z280aVCY1x0267AKxVW8JVW8JrUv cSsGvfC2KfnxnUUI43ZEXa7IU06WlPUUUUU== X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,SPF_HELO_PASS, SPF_PASS 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1750109383885882974?= X-GMAIL-MSGID: =?utf-8?q?1750109383885882974?= Add the Loongson platform gpio binding with DT schema format using json-schema. Signed-off-by: Yinbo Zhu Reviewed-by: Krzysztof Kozlowski --- Change in v5: 1. NO change, but other patch in this series of patches set has change. Change in v4: 1. Remove the string "series". 2. Add the reviewed-by information. Change in v3: 1. Separate some changes of MAINTAINERS file and enter the first patch. Change in v2: 1. Drop "loongson,gpio_base" and "gpio-ranges" will cover it. 1. Drop "loongson,conf_offset", "loongson,out_offset", "loongson,in_offset", "loongson,support_irq" and kernel driver will initial them that depend compatible in kernel. 3. Fixup maintainer for this driver. .../bindings/gpio/loongson,ls-gpio.yaml | 126 ++++++++++++++++++ MAINTAINERS | 1 + 2 files changed, 127 insertions(+) create mode 100644 Documentation/devicetree/bindings/gpio/loongson,ls-gpio.yaml diff --git a/Documentation/devicetree/bindings/gpio/loongson,ls-gpio.yaml b/Documentation/devicetree/bindings/gpio/loongson,ls-gpio.yaml new file mode 100644 index 000000000000..fb86e8ce6349 --- /dev/null +++ b/Documentation/devicetree/bindings/gpio/loongson,ls-gpio.yaml @@ -0,0 +1,126 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/gpio/loongson,ls-gpio.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Loongson GPIO controller. + +maintainers: + - Yinbo Zhu + +properties: + compatible: + enum: + - loongson,ls2k-gpio + - loongson,ls7a-gpio + + reg: + maxItems: 1 + + ngpios: + minimum: 1 + maximum: 64 + + "#gpio-cells": + const: 2 + + gpio-controller: true + + gpio-ranges: true + + interrupts: + minItems: 1 + maxItems: 64 + +required: + - compatible + - reg + - ngpios + - "#gpio-cells" + - gpio-controller + - gpio-ranges + - interrupts + +additionalProperties: false + +examples: + - | + #include + + gpio0: gpio@1fe00500 { + compatible = "loongson,ls2k-gpio"; + reg = <0x1fe00500 0x38>; + ngpios = <64>; + #gpio-cells = <2>; + gpio-controller; + gpio-ranges = <&pctrl 0 0 15>, + <&pctrl 16 16 15>, + <&pctrl 32 32 10>, + <&pctrl 44 44 20>; + interrupt-parent = <&liointc1>; + interrupts = <28 IRQ_TYPE_LEVEL_LOW>, + <29 IRQ_TYPE_LEVEL_LOW>, + <30 IRQ_TYPE_LEVEL_LOW>, + <30 IRQ_TYPE_LEVEL_LOW>, + <26 IRQ_TYPE_LEVEL_LOW>, + <26 IRQ_TYPE_LEVEL_LOW>, + <26 IRQ_TYPE_LEVEL_LOW>, + <26 IRQ_TYPE_LEVEL_LOW>, + <26 IRQ_TYPE_LEVEL_LOW>, + <26 IRQ_TYPE_LEVEL_LOW>, + <26 IRQ_TYPE_LEVEL_LOW>, + <26 IRQ_TYPE_LEVEL_LOW>, + <26 IRQ_TYPE_LEVEL_LOW>, + <26 IRQ_TYPE_LEVEL_LOW>, + <26 IRQ_TYPE_LEVEL_LOW>, + <>, + <26 IRQ_TYPE_LEVEL_LOW>, + <26 IRQ_TYPE_LEVEL_LOW>, + <26 IRQ_TYPE_LEVEL_LOW>, + <26 IRQ_TYPE_LEVEL_LOW>, + <26 IRQ_TYPE_LEVEL_LOW>, + <26 IRQ_TYPE_LEVEL_LOW>, + <26 IRQ_TYPE_LEVEL_LOW>, + <26 IRQ_TYPE_LEVEL_LOW>, + <26 IRQ_TYPE_LEVEL_LOW>, + <26 IRQ_TYPE_LEVEL_LOW>, + <26 IRQ_TYPE_LEVEL_LOW>, + <26 IRQ_TYPE_LEVEL_LOW>, + <26 IRQ_TYPE_LEVEL_LOW>, + <26 IRQ_TYPE_LEVEL_LOW>, + <26 IRQ_TYPE_LEVEL_LOW>, + <26 IRQ_TYPE_LEVEL_LOW>, + <27 IRQ_TYPE_LEVEL_LOW>, + <27 IRQ_TYPE_LEVEL_LOW>, + <27 IRQ_TYPE_LEVEL_LOW>, + <27 IRQ_TYPE_LEVEL_LOW>, + <27 IRQ_TYPE_LEVEL_LOW>, + <>, + <27 IRQ_TYPE_LEVEL_LOW>, + <27 IRQ_TYPE_LEVEL_LOW>, + <27 IRQ_TYPE_LEVEL_LOW>, + <27 IRQ_TYPE_LEVEL_LOW>, + <>, + <>, + <27 IRQ_TYPE_LEVEL_LOW>, + <27 IRQ_TYPE_LEVEL_LOW>, + <27 IRQ_TYPE_LEVEL_LOW>, + <27 IRQ_TYPE_LEVEL_LOW>, + <27 IRQ_TYPE_LEVEL_LOW>, + <27 IRQ_TYPE_LEVEL_LOW>, + <27 IRQ_TYPE_LEVEL_LOW>, + <27 IRQ_TYPE_LEVEL_LOW>, + <27 IRQ_TYPE_LEVEL_LOW>, + <27 IRQ_TYPE_LEVEL_LOW>, + <27 IRQ_TYPE_LEVEL_LOW>, + <27 IRQ_TYPE_LEVEL_LOW>, + <27 IRQ_TYPE_LEVEL_LOW>, + <27 IRQ_TYPE_LEVEL_LOW>, + <27 IRQ_TYPE_LEVEL_LOW>, + <27 IRQ_TYPE_LEVEL_LOW>, + <27 IRQ_TYPE_LEVEL_LOW>, + <27 IRQ_TYPE_LEVEL_LOW>, + <27 IRQ_TYPE_LEVEL_LOW>, + <27 IRQ_TYPE_LEVEL_LOW>; + }; diff --git a/MAINTAINERS b/MAINTAINERS index 47721a25249f..6381c0bebb34 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -12052,6 +12052,7 @@ LOONGSON GPIO DRIVER M: Yinbo Zhu L: linux-gpio@vger.kernel.org S: Maintained +F: Documentation/devicetree/bindings/gpio/loongson,ls-gpio.yaml F: drivers/gpio/gpio-loongson.c F: include/linux/platform_data/gpio-loongson.h