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 X-Spam-Level: X-Spam-Status: No, score=-0.7 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 29D4EC432C0 for ; Fri, 22 Nov 2019 12:39:33 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id ED3742072D for ; Fri, 22 Nov 2019 12:39:32 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=baylibre-com.20150623.gappssmtp.com header.i=@baylibre-com.20150623.gappssmtp.com header.b="wPFNW57z" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727269AbfKVMjc (ORCPT ); Fri, 22 Nov 2019 07:39:32 -0500 Received: from mail-ot1-f68.google.com ([209.85.210.68]:32874 "EHLO mail-ot1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726750AbfKVMjc (ORCPT ); Fri, 22 Nov 2019 07:39:32 -0500 Received: by mail-ot1-f68.google.com with SMTP id q23so186663otn.0 for ; Fri, 22 Nov 2019 04:39:31 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20150623.gappssmtp.com; s=20150623; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc:content-transfer-encoding; bh=pIaE2t8kEhzDVYCOk21I3VO5ugELTHI5U7MvhDfP+Bw=; b=wPFNW57zKwWO86/8XbUcXJJRoWhRtgaz8SFbCVb3kzCZs5NoKJ5NAi5XITr/5axrWF 7t/bmKwgoI/qdkwMUMKfuO+JQl+KF3HA6koatw564ZgsHkf3LTN617naBAfhOMLIk1jZ UHtrysleLqU2AQjrR/Qy+bepkiaXKqSBtTLbQlDmapNYB9kdfzlMSB4DFre/jEwUF15D P4ChWAELcH4Fly7afKA1+MiGJLmLKPBjBPpU+ZSFXBtlLmgYQEerSeMbL04k3cDXdeYH u658C2PbUnrGIPJl+JsiWXXiN0wUe5kS+NfcvxGIKAHHshIVt2KylgTsXH3ib1SkOmx6 Rosg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc:content-transfer-encoding; bh=pIaE2t8kEhzDVYCOk21I3VO5ugELTHI5U7MvhDfP+Bw=; b=HHzKZJETEp5mGm7/wDBu+XbArs5KdldtcraZ2UDnBkcC28xM8pvDojpN7q92BhY/gq Pj0sc2cNVBbc2i1uF3LcPyW1OjlB/+pN5k7C0zBzhd5M8SDJe2SrWPiNrUiqfmsjrDUu O1qL7+blqeWvYbw9YPXHJRxw5qrNlOCLeLQYyDJkrsE6pMzgnxEDBxOdaItSCPzlsiK1 SA9CdJvGQwmU4C9+uSdyHH0ed34rbO6ZTXL6yzprfNj3qJ9ej+WKFOW0fNyjlhPykfrF 1+Bgg3rTKrM+Wk7yQMc5ArokkbkpItBF6SvTuBJfOainhiPwRC1d7HUhCDdRWZ2cQEj+ 5sTw== X-Gm-Message-State: APjAAAXfsQtRKnLABFVzMfmeKgphXzgO9jkD1abYqv+0Pw0D1M26GYWM u7oU7ZJ5vBsIs+UvHwu8CRrjDhbEyjKs5J5ZeM6OOg== X-Google-Smtp-Source: APXvYqxKHhBekxA9nnYnqjLUFq+26q+Pt7iPthEshyRausyypcoh9ry3D5ayg7l4W/Vg0xxTE7p87Rqo7hkmAImYaDM= X-Received: by 2002:a9d:17ca:: with SMTP id j68mr10551757otj.250.1574426371219; Fri, 22 Nov 2019 04:39:31 -0800 (PST) MIME-Version: 1.0 References: <1573560684-48104-1-git-send-email-yash.shah@sifive.com> <1573560684-48104-4-git-send-email-yash.shah@sifive.com> In-Reply-To: From: Bartosz Golaszewski Date: Fri, 22 Nov 2019 13:39:20 +0100 Message-ID: Subject: Re: [PATCH 3/4] gpio: sifive: Add GPIO driver for SiFive SoCs To: Linus Walleij Cc: Yash Shah , "robh+dt@kernel.org" , "mark.rutland@arm.com" , "palmer@dabbelt.com" , "Paul Walmsley ( Sifive)" , "aou@eecs.berkeley.edu" , "tglx@linutronix.de" , "jason@lakedaemon.net" , "maz@kernel.org" , "bmeng.cn@gmail.com" , "atish.patra@wdc.com" , Sagar Kadam , "linux-gpio@vger.kernel.org" , "devicetree@vger.kernel.org" , "linux-riscv@lists.infradead.org" , "linux-kernel@vger.kernel.org" , Sachin Ghadi Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Sender: devicetree-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: devicetree@vger.kernel.org pt., 22 lis 2019 o 13:28 Linus Walleij napisa=C5= =82(a): > > On Tue, Nov 19, 2019 at 5:42 PM Bartosz Golaszewski > wrote: > > wt., 19 lis 2019 o 16:03 Linus Walleij napis= a=C5=82(a): > > > On Mon, Nov 18, 2019 at 11:15 AM Bartosz Golaszewski > > > wrote: > > > > > pon., 18 lis 2019 o 11:03 Yash Shah napisa= =C5=82(a): > > > Is it really so? The bgpio_lock does protect the registers used > > > by regmap-mmio but unless the interrupt code is also using the > > > same registers it is fine to have a different lock for those. > > > > > > Is the interrupt code really poking into the very same registers > > > as passed to bgpio_init()? > > > > > > Of course it could be seen as a bit dirty to poke around in the > > > same memory space with regmap and the bgpio_* accessors > > > but in practice it's no problem if they never touch the same > > > things. > > > > > > Yours, > > > Linus Walleij > > > > I'm wondering if it won't cause any inconsistencies when for example > > interrupts are being triggered on input lines while we're also reading > > their values? Seems to me it's just more clear to use a single lock > > for a register range. Most drivers using gpio-mmio do just that in > > their irq-related routines. > > OK good point. Just one lock for the whole thing is likely > more maintainable even if it works with two different locks. > > > Anyway: even without using bgpio_lock this code is inconsistent: if > > we're using regmap for interrupt registers, we should either decide to > > rely on locking provided by regmap or disable it and use a locally > > defined lock. > > OK makes sense, let's say we use the bgpio_lock everywhere > for this. > > Yash: are you OK with this? (Haven't read the new patch set > yet, maybe it is already fixed...) > > > Also: if we're using regmap, then let's use it > > everywhere, not only when it's convenient for updating registers. > > I think what you are saying is that we should extend gpio-mmio.c > with some optional regmap API (or create a separate MMIO library > for regmap consumers) which makes sense, but it feels a bit > heavy task to toss at contributors. > > We could add it to the TODO file, where I already have some > item like this for port-mapped I/O. > It's been on my personal TODO list too for some time as it seems it could benefit some i2c drivers too. Also: I think such a helper could eventually completely replace the generic drivers such as gpio-mmio and gpio-reg. In other words: good idea to put it into the TODO. If there are no objections I was thinking about starting the work soon aiming at v5.6, as soon as we get the recent changes in uAPI out of the way. Bart > Yours, > Linus Walleij