Received: by 2002:a05:6a10:f3d0:0:0:0:0 with SMTP id a16csp1626247pxv; Fri, 2 Jul 2021 08:17:58 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzpTbkdJbbYMjdj5u41LWPovIWK9VZfPVMnjroMhraUwE0njAtx59pMwgWAVPNWvh4LJh/N X-Received: by 2002:a92:b00d:: with SMTP id x13mr355578ilh.181.1625239078808; Fri, 02 Jul 2021 08:17:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1625239078; cv=none; d=google.com; s=arc-20160816; b=Q/BzKfUfwoWxkSkh+TtJAUNLGhHEF4o+Cd58F5fADcWz83DKawgFqa+M/AzsMZMlUg 30sKY17KLzTyqWtyLGUutB8eBXHRsTjCzP6hkSTBnWd2u6rOYi9DKeiRFdnWrkLFWNwb /0yflwnj71zpejsWeWaZiuaKrbrtg0GegcHMFQ50udSIFD1Gjf3erlur8fo/3uhT7K4P AGZM4LnH2BVfwkzdYbGS385zxUZq9NMIVoU0pHr8+fehXfSd/VfojeutH5OaQX2UYZPx LH6nId8Dn971oZJCnJD15ynQBowogMbuCcaGETNOVI/PBICGqZ8vZoXNuOJQ7Ns2Ci6Y igPg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:message-id:user-agent:references:in-reply-to :subject:cc:to:from:date:content-transfer-encoding:mime-version :dkim-signature; bh=OWy2yrkTk66WQxbgnmVpmHdWaJn/RapTlXrAofVrtKA=; b=lvspjIfqvoW7+k8JfpdfTnxypqKNzCpEiLlneCjdkEW2/dVb613pERkjAHTbGw0slx 1CVUeoNFRn5zMAfhXrUGoiNHNIjJIdnIclHXqYs0/bo7gYuwgQAGEgzPuKrsr22AWAIv VucWlSWw7sENQ4/OyCeBHewuiBYO/w2Km3JN/kMhT1zM4UlTiDXAd8JOnKUWvjL7QcEC xAMRC2V6aPfJ3DxDoax6dgLr3Q+YJRrPS/JlT4ZOQVMOAoiPIGXcnx0bFMm7+vVujcyh 6g9hO3S4+BFrp7EpYgSbWVn+zeyc0ktir0ejBwbCipToYaxTSt1PvF4b6A9H8FVva+2E ktvQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@walle.cc header.s=mail2016061301 header.b=fM22Ossi; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id f12si3883328ila.37.2021.07.02.08.17.46; Fri, 02 Jul 2021 08:17:58 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@walle.cc header.s=mail2016061301 header.b=fM22Ossi; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232441AbhGBPC2 (ORCPT + 99 others); Fri, 2 Jul 2021 11:02:28 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48618 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230271AbhGBPC2 (ORCPT ); Fri, 2 Jul 2021 11:02:28 -0400 Received: from ssl.serverraum.org (ssl.serverraum.org [IPv6:2a01:4f8:151:8464::1:2]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 19283C061762; Fri, 2 Jul 2021 07:59:56 -0700 (PDT) Received: from ssl.serverraum.org (web.serverraum.org [172.16.0.2]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ssl.serverraum.org (Postfix) with ESMTPSA id 9A2A02224D; Fri, 2 Jul 2021 16:59:51 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=walle.cc; s=mail2016061301; t=1625237992; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=OWy2yrkTk66WQxbgnmVpmHdWaJn/RapTlXrAofVrtKA=; b=fM22OssiTe4GCgmGyUJ7YDdMyNsIY/kmsOERyeYP4g4ELQkYfNOfWr0JFoVJ9aR293lgJT rfb47ACOX/2AevGjX5afzHIFaImldCqYHhEBny5bI8WtWGxmj45uLrrmmnZ6XV7FJPRlNm NdrL/SOe9I912AbrKuCnqNgw4a3Ea/g= MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII; format=flowed Content-Transfer-Encoding: 7bit Date: Fri, 02 Jul 2021 16:59:51 +0200 From: Michael Walle To: Drew Fustini Cc: Rob Herring , Linus Walleij , Bartosz Golaszewski , Paul Walmsley , Palmer Dabbelt , Michael Zhu , Geert Uytterhoeven , Fu Wei , linux-kernel@vger.kernel.org, linux-gpio@vger.kernel.org, linux-riscv@lists.infradead.org, devicetree@vger.kernel.org, Emil Renner Berthing , Huan Feng Subject: Re: [RFC PATH 2/2] gpio: starfive-jh7100: Add StarFive JH7100 GPIO driver In-Reply-To: <20210701203333.GA963857@x1> References: <20210701002037.912625-1-drew@beagleboard.org> <20210701002037.912625-3-drew@beagleboard.org> <8c59105d32a9936f8806501ecd20e044@walle.cc> <20210701203333.GA963857@x1> User-Agent: Roundcube Webmail/1.4.11 Message-ID: X-Sender: michael@walle.cc Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Drew, Am 2021-07-01 22:33, schrieb Drew Fustini: > On Thu, Jul 01, 2021 at 08:39:40AM +0200, Michael Walle wrote: >> Hi Drew, >> >> Am 2021-07-01 02:20, schrieb Drew Fustini: >> > Add GPIO driver for the StarFive JH7100 SoC [1] used on the >> > BeagleV Starlight JH7100 board [2]. >> > >> > [1] https://github.com/starfive-tech/beaglev_doc/ >> > [2] https://github.com/beagleboard/beaglev-starlight >> > >> > Signed-off-by: Emil Renner Berthing >> > Signed-off-by: Huan Feng >> > Signed-off-by: Drew Fustini >> >> Could this driver use GPIO_REGMAP and REGMAP_IRQ? See >> drivers/gpio/gpio-sl28cpld.c for an example. >> >> -michael > > Thank you for the suggestion. I am not familiar with GPIO_REGMAP and > REGMAP_IRQ so I will read about it. Is the advantage is that is helps > to reduce code duplication by using an abstraction? Yes, I've looked briefly at your patch and it seemed that GPIO_REGMAP might fit here which will reduce code. > I did notice that the gpio-sifive.c driver used regmap_update_bits() > and > regmap_write(). > > I suppose that is better than writel_relaxed() and iowrite32() which > this RFC driver does? Its just another abstraction layer in between. For MMIO it will also end up using some variant of the above (see regmap-mmio.c). But if you use regmap, you can also use REGMAP_IRQ which might also be a fit for your GPIO controller and thus don't have to implement your own versions for the irq_chip ops. -michael