Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp6632742rwb; Tue, 15 Nov 2022 01:10:08 -0800 (PST) X-Google-Smtp-Source: AA0mqf6Ek9rj4/WMvW2S9BlS1TcqIStTRAF6FO2pmbgLX2x1N5n+pfk34rfDBx9ctJLSRSEU0bDT X-Received: by 2002:a17:902:edc7:b0:186:9c25:7ef0 with SMTP id q7-20020a170902edc700b001869c257ef0mr2974531plk.164.1668503408104; Tue, 15 Nov 2022 01:10:08 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668503408; cv=none; d=google.com; s=arc-20160816; b=y8Bd6RRGwTitWfbvD8ASSz8qzru3qMou3gswxXaZbTMR7guAJ6Igt6yvU6iscWcH5r bN1HI3HrCav7gr3DiX169cr/JHKgFxyf4HuVyLlniiOCeRsICFjK+G22FhunKF0t/4Sm 3rlMKdmK5qRpswLfexAseH+RgzNkBa6aImtrHlWs604sn0fJz6BjGvX8SqjWLoEI6arB LrxDDK+zVlvvUWcGJkQUDLo5mFqOJArztqKOSC1FRmrFAoaXy0BwwHuQMjnfApnqIpGi vaEeLyVskYAob++qBAZkGkUBE+172I6dyxtGBTMp/NjWRmIFJPQ9+2hxqCnUSln4FyDr RNeA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=DPUEJYNpBZuDWaWvpWz9lTBlWL+Xs7ztgn+pfOxI9Vw=; b=hmJ5odjTEQikCfLneP/3hgYIaydhv31o6JBCVwj9t3/+otKy1N+QyKkdpBnR655atX yFs6FZeH5U1AwRuf57sSUoDf85ql7hynG7v4VBOmn8UwGfcM/jTx+0IjFPVDUXQ9RciI dBZdVXpM66ymuDLlDyfvgn+bUSiuGP4dplqQNsMcxRBOYgfLxTdHnDUMRKg8kjV692H2 YvN+RXI8z3kewVP0DOF1kkrBUYCikc0ZCoGxpaPvnbN3n0nttqG9OXxGHBo7etXVk2kZ axn+s4bskH75P8b/dq7hcNM1b9nnrAP1DQY44s725lYqNPCDeMQxBBsk3h10/5VKktaW dnDA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@bgdev-pl.20210112.gappssmtp.com header.s=20210112 header.b=za5gKQHy; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id il7-20020a17090b164700b00213d512f07csi12942860pjb.182.2022.11.15.01.09.55; Tue, 15 Nov 2022 01:10:08 -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; dkim=pass header.i=@bgdev-pl.20210112.gappssmtp.com header.s=20210112 header.b=za5gKQHy; 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 S229806AbiKOJFz (ORCPT + 89 others); Tue, 15 Nov 2022 04:05:55 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36698 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232547AbiKOJFx (ORCPT ); Tue, 15 Nov 2022 04:05:53 -0500 Received: from mail-vs1-xe36.google.com (mail-vs1-xe36.google.com [IPv6:2607:f8b0:4864:20::e36]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 36B901EECA for ; Tue, 15 Nov 2022 01:05:51 -0800 (PST) Received: by mail-vs1-xe36.google.com with SMTP id l190so13996060vsc.10 for ; Tue, 15 Nov 2022 01:05:51 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bgdev-pl.20210112.gappssmtp.com; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=DPUEJYNpBZuDWaWvpWz9lTBlWL+Xs7ztgn+pfOxI9Vw=; b=za5gKQHyD5pfb+Psq9X451yj/JM/sWgade6c5blX+uuQ2wxffv7AkvmTo1P0h/EN09 Fy3sp3m+6emgJD4ycOw+g6J0KpPXl5XJ4OaQJnxsOLH2lEe6hoCyMXfT53vfQSTIyZWl qUe0miJhOkndQKc0+RwVEGXuasFvwQrgZI2RXrJH/AzgtJ4tQq8kyB41Fi2JV57QBx/U e9mBNZw42y15hjRkxNZTAJAWw93sqE2R7+AsU0he/J3QreUibqfXO+mATPYzyaxUgkhB 1bC/swUVlF2528bieS438IHPBlS1TDJHrlb3j/tkH3EUeo+EazNACSO3uUFi/bhFLYZJ 8Dyw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=DPUEJYNpBZuDWaWvpWz9lTBlWL+Xs7ztgn+pfOxI9Vw=; b=PJfxSgg9pX5r0AX25yzeTIVDFAHwfCm9SJDu0To0dYUWLwq1h8aSd6S6wRlsylCktZ TV4rqm5FRW6eHYTicTsIKOyeh+CH4SMAo430xiVzMZEFs7SWkZ8lTu4RU8kpuShTn+YQ L9zZpdBJPPFAZMQwynsgR8cNgkufZ3atr8x+uQjshlKHdIDuzLfpnLkqep3S1dbxwVLD v4H912ZuluTxXlA2CE7c/GjHocJZHHNvqyQD/vXCt+yCK18Tl4r3ButVphkFOzbjbeae qDJoPGcQaZvlH0DaG/lGTqrC8DLA/vV5e3l3Y7sMBecU/P1nqvwMhaEIi8mVO9Qsqqg2 9lOg== X-Gm-Message-State: ANoB5plCYl8srNli8rc4xoIa5ztFmQw4D7JIcrZraS2l3Dp5NZgKRKm8 DyKrh3r99i+C2pRGBe64im2WCoFIPSeTRTTXiXCJSw== X-Received: by 2002:a05:6102:488:b0:3ac:38c7:1bdd with SMTP id n8-20020a056102048800b003ac38c71bddmr8089142vsa.9.1668503150211; Tue, 15 Nov 2022 01:05:50 -0800 (PST) MIME-Version: 1.0 References: <20221114095332.21079-1-zhuyinbo@loongson.cn> In-Reply-To: <20221114095332.21079-1-zhuyinbo@loongson.cn> From: Bartosz Golaszewski Date: Tue, 15 Nov 2022 10:05:39 +0100 Message-ID: Subject: Re: [PATCH v2 1/2] gpio: loongson: add dts/acpi gpio support To: Yinbo Zhu Cc: Linus Walleij , 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 , lvjianmin , zhanghongchen , Liu Peibao Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_NONE autolearn=unavailable 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 On Mon, Nov 14, 2022 at 10:53 AM Yinbo Zhu wrote: > > The latest Loongson series platform use dts or acpi framework to > register gpio device resources, such as the Loongson-2 series > SoC of LOONGARCH architecture. In order to support dts, acpi and > compatibility with previous platform device resources in driver, > this patch was added. > > Signed-off-by: lvjianmin > Signed-off-by: zhanghongchen > Signed-off-by: Liu Peibao > Signed-off-by: Juxin Gao > Signed-off-by: Yinbo Zhu > --- > 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". > > arch/loongarch/include/asm/loongson.h | 13 + > .../include/asm/mach-loongson2ef/loongson.h | 12 + > .../include/asm/mach-loongson64/loongson.h | 13 + > drivers/gpio/Kconfig | 6 +- > drivers/gpio/gpio-loongson.c | 422 +++++++++++++++--- > 5 files changed, 391 insertions(+), 75 deletions(-) > > diff --git a/arch/loongarch/include/asm/loongson.h b/arch/loongarch/include/asm/loongson.h > index 00db93edae1b..383fdda155f0 100644 > --- a/arch/loongarch/include/asm/loongson.h > +++ b/arch/loongarch/include/asm/loongson.h > @@ -60,6 +60,19 @@ static inline void xconf_writeq(u64 val64, volatile void __iomem *addr) > ); > } > > +/* ============== Data structrues =============== */ > + > +/* gpio data */ > +struct platform_gpio_data { > + u32 gpio_conf; > + u32 gpio_out; > + u32 gpio_in; > + u32 support_irq; > + char *label; > + int gpio_base; > + int ngpio; > +}; This is a terrible name for an exported structure. You would at least need some kind of a namespace prefix. But even then the need to add a platform data structure is very questionable. We've moved past the need for platform data in the kernel. I don't see anyone setting it up in this series either. Could you provide more explanation on why you would need it and who would use it? > + > /* ============== LS7A registers =============== */ > #define LS7A_PCH_REG_BASE 0x10000000UL > /* LPC regs */ > diff --git a/arch/mips/include/asm/mach-loongson2ef/loongson.h b/arch/mips/include/asm/mach-loongson2ef/loongson.h > index ca039b8dcde3..b261cea4fee1 100644 > --- a/arch/mips/include/asm/mach-loongson2ef/loongson.h > +++ b/arch/mips/include/asm/mach-loongson2ef/loongson.h > @@ -315,4 +315,16 @@ extern unsigned long _loongson_addrwincfg_base; > > #endif /* ! CONFIG_CPU_SUPPORTS_ADDRWINCFG */ > > +/* ============== Data structrues =============== */ > + > +/* gpio data */ > +struct platform_gpio_data { > + u32 gpio_conf; > + u32 gpio_out; > + u32 gpio_in; > + u32 support_irq; > + char *label; > + int gpio_base; > + int ngpio; > +}; No idea why you would need to duplicate it like this either. And why put it in arch/. [snip] I will hold off reviewing the rest of the patch until we get that clarified. Bartosz