From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 47EA5C43217 for ; Thu, 2 Dec 2021 18:00:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:Content-Type: Content-Transfer-Encoding:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:In-Reply-To:Subject:From:References:Cc:To: MIME-Version:Date:Message-ID:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=uHP2/ja232808YQ18AQV/54hbDUsUHm9Gz95bMNbc5I=; b=wyxysx7qn6rsZz EwhtfMYhUGf4BOxtEYbCS+yvsMkJfmp/6bP33kvM1nG2JXGJSa7qMLBoOS+OfW92x4qP0SUcN4wdX f2pKmWg25mLpIzMh0xYcCBFlepXiUwRUnfo7ae1/SgHW3Em4+9+R1a2Trt8Fy0mwk4GINKQJaNvXf 3aLxVhU5zXZBw4mePSckP52sAX1/Wb/4byBL7ErE49xd4W+CVw/1zsFjA+gCJbjjnuKbfx4h0FmE0 X662+LuTigv8RdtovvretNIWRq97RaCpY/EQNIBG36uUVNV6fx3jNb7/WdYtnbt47ONpuIRdZy1ed /V0nsuGLhLaEeVBaQxqg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1msqMR-00DDpl-1n; Thu, 02 Dec 2021 17:59:11 +0000 Received: from nbd.name ([2a01:4f8:221:3d45::2]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1msqMN-00DDp3-WA for linux-arm-kernel@lists.infradead.org; Thu, 02 Dec 2021 17:59:09 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=nbd.name; s=20160729; h=Content-Transfer-Encoding:Content-Type:In-Reply-To:Subject: From:References:Cc:To:MIME-Version:Date:Message-ID:Sender:Reply-To:Content-ID :Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To: Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe :List-Post:List-Owner:List-Archive; bh=PbNRTWvVFrQhSfiFmSEKFvbhIel4YjxA0wnIzvHb8r0=; b=E/oitWV4Vohr250EjbMQbna/JR chMwbzdnr9hplbVWpNh6OpTMETeCCIS8oFoItBPiwA74gexrdYw/muEeMadTPKkaElBa3TcEe9HAE SRCUs9PTaR4oeCGIDAf2BKfvaV0K1kELPcyuSNzFmZZ/dVhNJw9uicqnfBzxm+13IGv4=; Received: from p54ae943f.dip0.t-ipconnect.de ([84.174.148.63] helo=nf.local) by ds12 with esmtpsa (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.89) (envelope-from ) id 1msqMK-0001s4-RS; Thu, 02 Dec 2021 18:59:04 +0100 Message-ID: Date: Thu, 2 Dec 2021 18:59:03 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:91.0) Gecko/20100101 Thunderbird/91.3.2 Content-Language: en-US To: Linus Walleij Cc: linux-arm-kernel@lists.infradead.org, Bartosz Golaszewski , john@phrozen.org, linux-kernel@vger.kernel.org, linux-gpio@vger.kernel.org References: <20211129153330.37719-1-nbd@nbd.name> <20211129153330.37719-13-nbd@nbd.name> From: Felix Fietkau Subject: Re: [PATCH v5 12/13] gpio: Add support for Airoha EN7523 GPIO controller In-Reply-To: X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20211202_095908_240139_F804C32D X-CRM114-Status: GOOD ( 18.98 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="us-ascii"; Format="flowed" Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On 2021-12-02 02:47, Linus Walleij wrote: > Hi Felix! > > Thanks for your patch! > > On Mon, Nov 29, 2021 at 4:54 PM Felix Fietkau wrote: > >> From: John Crispin >> >> Airoha's GPIO controller on their ARM EN7523 SoCs consists of two banks of 32 >> GPIOs. Each instance in DT is for an single bank. >> >> Signed-off-by: John Crispin >> Signed-off-by: Felix Fietkau > > (...) >> +config GPIO_EN7523 >> + tristate "Airoha GPIO support" >> + depends on ARCH_AIROHA >> + default ARCH_AIROHA >> + select GPIO_GENERIC > > Yes that looks applicable, but why isn't it used? > > The few 32-bit registers look like an ideal candidate for > using the generic GPIO. Check similar drivers such as > drivers/gpio/gpio-ftgpio010.c and how it uses > bgpio_init() and the nice doc for bgpio_init() in > drivers/gpio/gpio-mmio.c. I just looked at the datasheet and the driver code again, and I think EN7523 is too strange for proper generic GPIO support. For each bank there are two control registers (not consecutive), which have 2-bit fields for every GPIO line to control direction. No idea why 2 bits per line, because only values 0 and 1 are valid, the rest are reserved. For lines configured as output, an extra output-enable bit also needs to be set in a separate register before output values can be written. The code does use bgpio to read/write values, but that's about it. I don't think it would do the generic GPIO code any good to support this weirdness. - Felix _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel