Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp607577imu; Thu, 3 Jan 2019 04:01:49 -0800 (PST) X-Google-Smtp-Source: AFSGD/UFHLwQbD7qvbc17CwczmQ1KxCFks2e1+AxTElFSu83mi72oQz1H84Z5g19RUM/uZ5S7cnx X-Received: by 2002:a62:5182:: with SMTP id f124mr48255806pfb.238.1546516909745; Thu, 03 Jan 2019 04:01:49 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1546516909; cv=none; d=google.com; s=arc-20160816; b=WtioBWG+HKKzV/qZh1/sAuwNYUmFdZzXOMm+RYpv7Odqv3yzPADC/T1t3sdueZFBmS 38HGMrSYiowjfcpceaUxQWZg898VXDMuFefQkCX3uwYKSnVcVKy2YDLf6/lQyOyHP+r+ FN9WahCR3EgTYvcSqUpLj2kRWmE3E8mBb7Zv5P6fccfzMkTKj09lgkRPznSB8LxHoZQe /U18HkofYPNZsn9QkRhTL9DZxNoiT/6bdaKRJmRbSmJkpMjQQVL7+vcZFK5/MORpCG7+ qw0SZjHuQ32NFMt6UVsbbu/8IM5nWL7/BJuHb5OoWRX3ciHFCxlDtW5lAT8tguHdBGYQ 4+kg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:in-reply-to :mime-version:user-agent:date:message-id:from:cc:references:to :subject; bh=4FsHWCBJ1OtDjh5CxitSDN87kxEveVnuK7BHhAlWDXY=; b=rh4XEhCU7cvzn5lEgpnpi4xeUrXsAn/6g0eMd3ZZqhfTXb01lUfm3pf6MMxVAsQBO+ CjhdTjYOkQDp3MK9TrADXSCZ4Fzoz87C3pnz8vJEzsB/Q2ulqrJ17JH/hkvFIdLozjI8 3lV7+zyzOBFCt/fpVeJ4hC6xGHIqeq+ZdzNxK6ftrzU1sOzucNzpD4g7VnsRz8YRlHq+ XPtnV8ym9vqxEAjSsYOT1WOc5F7Jnrpqp0SrP/1N3NDeVb7R5JqAst3S9ci+Bu4XtkyG BCNmEd8xIoOMjBJk8HMR8gxvTSmzxmZDaJDKnc1d8bU7yhoNdHf3CA2moyOdJxsC5jUp /O0g== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id s27si2601847pgm.501.2019.01.03.04.01.30; Thu, 03 Jan 2019 04:01:49 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727338AbfACI7R (ORCPT + 99 others); Thu, 3 Jan 2019 03:59:17 -0500 Received: from relay1.mentorg.com ([192.94.38.131]:34642 "EHLO relay1.mentorg.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726214AbfACI7Q (ORCPT ); Thu, 3 Jan 2019 03:59:16 -0500 Received: from nat-ies.mentorg.com ([192.94.31.2] helo=SVR-IES-MBX-04.mgc.mentorg.com) by relay1.mentorg.com with esmtps (TLSv1.2:ECDHE-RSA-AES256-SHA384:256) id 1geyqQ-0005j1-BD from Vladimir_Zapolskiy@mentor.com ; Thu, 03 Jan 2019 00:59:14 -0800 Received: from [137.202.108.130] (137.202.0.90) by SVR-IES-MBX-04.mgc.mentorg.com (139.181.222.4) with Microsoft SMTP Server (TLS) id 15.0.1320.4; Thu, 3 Jan 2019 08:59:10 +0000 Subject: Re: RFC: gpio: mmio: add support for 3 direction regs To: "Fried, Ramon" , , , References: <32edfd70-95dc-26a1-2ea6-143344cb2384@linux.intel.com> <28205214-d395-1c17-51ee-970300b6a14e@linux.intel.com> CC: , From: Vladimir Zapolskiy Message-ID: <6f609cb3-b294-0e66-a68f-73ad7ee4ac9a@mentor.com> Date: Thu, 3 Jan 2019 10:59:09 +0200 User-Agent: Mozilla/5.0 (X11; Linux i686; rv:45.0) Gecko/20100101 Icedove/45.2.0 MIME-Version: 1.0 In-Reply-To: <28205214-d395-1c17-51ee-970300b6a14e@linux.intel.com> Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit X-Originating-IP: [137.202.0.90] X-ClientProxiedBy: svr-ies-mbx-02.mgc.mentorg.com (139.181.222.2) To SVR-IES-MBX-04.mgc.mentorg.com (139.181.222.4) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 01/03/2019 10:51 AM, Fried, Ramon wrote: > > On 1/3/2019 10:07, Vladimir Zapolskiy wrote: >> Hi Ramon, >> >> On 01/03/2019 09:36 AM, Fried, Ramon wrote: >>> Hi. >>> >>> I'm working on a driver for STA2X11 GPIO controller who seems to fit >>> best to the generic mmio driver, >> I hope you have seen the existing driver drivers/gpio/gpio-sta2x11.c > I surely did. we have the same IP in our soc but it was changed a lot > internally, don't want to litter the original. >> >>> the only problem I have is with the dir register case. The STA2X11 >>> has 3 registers for dir, one for data, one for set and one for >>> clear. The generic-mmio driver has support for this fashion for the >>> dat & set & clear registers but not for dirout/dirin registers. >>> >>> I wonder if support for this is generic enough to deserve a patch, if >>> so I'm willing to quickly add this support, if not, adding a flag >>> such as below, will allow partly using the generic mmio driver only >>> for set/get and the direction can be handled outside the driver. >>> >> If gpio-mmio fits well, then it might be simpler to set a flag >> BGPIOF_UNREADABLE_REG_DIR, then call bgpio_init() and then overwrite >> .direction_input, .direction_output and .get_direction callbacks, >> as a reference you can take a look at gpio-74xx-mmio.c > > Nice. > That's an option I didn't think of, better than setting the flag. > what about adding the generic support ? Setting a GPIO direction over three different registers doesn't sound as a suitable candidate for generalization, also your particular implementation is partial, relies on external platform/driver code to preset the directions and it does not allow to change direction in runtime, so just renounce the idea. -- Best wishes, Vladimir