Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp407137imm; Thu, 30 Aug 2018 01:45:24 -0700 (PDT) X-Google-Smtp-Source: ANB0Vdbc5sy07ZQhnf/Gc5TKdP9BeuWCeQBTsJzjThXVQ88LxhyRMRyxqnQXk8iA/VB1siQa0/BU X-Received: by 2002:a62:6283:: with SMTP id w125-v6mr9521112pfb.108.1535618724899; Thu, 30 Aug 2018 01:45:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1535618724; cv=none; d=google.com; s=arc-20160816; b=DStTNGVECoM7VVmMAWfY+e4s1J0kJaLwZ+LVb/7MjndJHXEuUHcVGC2omN544QvssN NO16Bz+Enpxw9O1TA0CQ54YfF2gKXdbra1sXksNI4vUsnAyn7TyYQYEzCSTxJSU2XY24 eJeQiJJyj49ODpmXXys8kVBLQqYjRyCTW5KqsiYORcjqjMstzXQA1F/omVfIhuKIzpQf tsSBa9fCMpERP0kZXj/PD4pXODX8gt8g9+N8P0qVeMPVaBMLI8qK7IbTj6Ep69EZewjN B6CCZG3p/U2mwuKj3gZVYzhMVSOMhvGnIicZcak589CXVyrtdNk9Kor/JBBKp8UmpXZ/ f1gA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature :arc-authentication-results; bh=5J1BTzAeVNKsETRKMBuA+D+cqeEwKWTxg5mDg5iOGZ8=; b=QC1Z5CuOXpnyPrCdjAKcFeQL3b1SgcaWVHx0z/WxiV5T6RIHFoItz3+HGJEuKMrQQ/ CCqraMShuts4QU97zzFm2Rkq3catkwIPRb3KVoGKVW3zx8eLN1vhZDL9V1KmzJ7Hypsk ccETPQECrLVK8c+HeJHhfCCj1z0ia61n9GKyoEP6bKKLWNSsfuLyNmjam2KOX336TJrC bDWKh6Qnk/czGPxSs8UhsuRJIJ8VRTvOS5BdKjgcZJdIcah+Eo9YU9LxwwPajRpuFopd Bz8sjpPz5odHEoZxzgQ7QIIZjrdpv0Gn2iqCo4aeDBHfZkhYbmswKQMadL6fBYDugxdd JKGA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=PWblsL0S; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id n19-v6si4938443pgb.3.2018.08.30.01.45.10; Thu, 30 Aug 2018 01:45:24 -0700 (PDT) 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; dkim=pass header.i=@linaro.org header.s=google header.b=PWblsL0S; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728075AbeH3Mo5 (ORCPT + 99 others); Thu, 30 Aug 2018 08:44:57 -0400 Received: from mail-io0-f194.google.com ([209.85.223.194]:42661 "EHLO mail-io0-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728030AbeH3Mo5 (ORCPT ); Thu, 30 Aug 2018 08:44:57 -0400 Received: by mail-io0-f194.google.com with SMTP id n18-v6so6858838ioa.9 for ; Thu, 30 Aug 2018 01:43:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=5J1BTzAeVNKsETRKMBuA+D+cqeEwKWTxg5mDg5iOGZ8=; b=PWblsL0SwO6scsD2Zx5st1Wl/R2doSLtXBawxASSinWcUNbboyZV3OrgOiJO5l/ga4 IelWcjneyh2WKdBXKI9exUcRRvhh1MVwRHzHMBOv6MACPnjVcHvKiG4Qx7zjxtyp23oL s88uEQogifL0fpXi5aNUt6s04WEmDrz59ybeA= 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; bh=5J1BTzAeVNKsETRKMBuA+D+cqeEwKWTxg5mDg5iOGZ8=; b=Bh3yb5yUdX37vca0fA2u63fbmbki+zs8t60c1ol1ZKvnwtQupyf/u0jf4p3hRMChzf /YezWXF9YZanUrwgRpg9uXmVHyOXy+BQabLTtTjJsoJFkhDs5UbGmSmCvE68xOAQjpyh x/ntYvX7b89IFYCyJi2rq7rycs5ARLhZ+nXtDUuRvQO9StUZlbV6XCmEMSWi9ClG14to ctC0y9Ok+c/3VUStbm4JQtZuOA7dbuDD7Ord/6F7axMCG/c1MVt0wcjyE7mL9cC6CDhs gYNBw3Oyzly2xhPVjTZtIk098a6ci04Ov4SpX6t8dpoFH7KkV+HzycGK2S+D7pswI0ml jxTg== X-Gm-Message-State: APzg51DzGjIPqYI3RQd4grBGIAKL+gjyn9YHgPlkWrm3FkIYRE7eLw4Z rn8QW1uHlbQ8Feby79lxXegqXBVSfe+4B4h48vNuWw== X-Received: by 2002:a6b:4006:: with SMTP id k6-v6mr7694752ioa.277.1535618634004; Thu, 30 Aug 2018 01:43:54 -0700 (PDT) MIME-Version: 1.0 References: <20180828112721.28178-1-Eugeniy.Paltsev@synopsys.com> <20180828112721.28178-3-Eugeniy.Paltsev@synopsys.com> In-Reply-To: <20180828112721.28178-3-Eugeniy.Paltsev@synopsys.com> From: Linus Walleij Date: Thu, 30 Aug 2018 10:43:42 +0200 Message-ID: Subject: Re: [PATCH v2 2/2] dt-bindings: Document the Synopsys GPIO via CREG bindings To: Eugeniy.Paltsev@synopsys.com Cc: "open list:SYNOPSYS ARC ARCHITECTURE" , "open list:GPIO SUBSYSTEM" , "linux-kernel@vger.kernel.org" , Vineet Gupta , Alexey Brodkin , Rob Herring , "open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS" , Mark Rutland Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Aug 28, 2018 at 1:27 PM Eugeniy Paltsev wrote: > +++ b/Documentation/devicetree/bindings/gpio/snps,creg-gpio.txt > @@ -0,0 +1,49 @@ > +GPIO via CREG (Control REGisers) driver Speling Also should be "Synopsys GPIO via CREG" as this is likely just for Synopsys and not general purpose. > +This is is single-register MMIO GPIO driver to control such strangely mapped > +outputs: > + > +31 11 8 7 5 0 < bit number > +| | | | | | > +[ not used | gpio-1 | shift-1 | gpio-0 | shift-0 ] < 32 bit MMIO register > + ^ ^ > + | | > + | write 0x2 == set output to "1" (on) > + | write 0x3 == set output to "0" (off) > + | > + write 0x1 == set output to "1" (on) > + write 0x4 == set output to "0" (off) Move this documentation into the driver instead. > +Required properties: > +- compatible : "snps,creg-gpio" > +- reg : Exactly one register range with length 0x4. > +- #gpio-cells : Should be one - the pin number. > +- gpio-controller : Marks the device node as a GPIO controller. OK > +- snps,ngpios: Number of GPIO pins. Use the existing ngpios attribute for this, see gpio.txt > +- snps,bit-per-line: Number of bits per each gpio line (see picture). > + Array the size of "snps,ngpios" > +- snps,shift: Shift (in bits) of the each GPIO field from the previous one in > + register (see picture). Array the size of "snps,ngpios" > +- snps,on-val: Value should be set in corresponding field to set > + output to "1" (see picture). Array the size of "snps,ngpios" > +- snps,off-val: Value should be set in corresponding field to set > + output to "0" (see picture). Array the size of "snps,ngpios" Move this into a lookup table in the driver instead, and match the lookup table to the compatible string. The format of the register is known for a certain compatible, right? > +Optional properties: > +- snps,default-val: default output field values. Array the size of "snps,ngpios" Default values for different lines can be achieved by hogs if it's OK to tie them up perpetually, else work on creating generic inialization values in gpio.txt and implement that in gpiolib-of.c for everyone. This discussion comes up from time to time. Yours, Linus Walleij