From mboxrd@z Thu Jan 1 00:00:00 1970 From: Eugeniy Paltsev Subject: Re: [PATCH v2 2/2] dt-bindings: Document the Synopsys GPIO via CREG bindings Date: Thu, 30 Aug 2018 18:16:06 +0000 Message-ID: <1535652965.4465.84.camel@synopsys.com> References: <20180828112721.28178-1-Eugeniy.Paltsev@synopsys.com> <20180828112721.28178-3-Eugeniy.Paltsev@synopsys.com> Mime-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: base64 Return-path: In-Reply-To: Content-Language: en-US Content-ID: <9B9760F1D93627448C72AA0FD8165E0F@internal.synopsys.com> Sender: linux-kernel-owner@vger.kernel.org To: "Eugeniy.Paltsev@synopsys.com" , "linus.walleij@linaro.org" Cc: "linux-kernel@vger.kernel.org" , "robh+dt@kernel.org" , "Alexey.Brodkin@synopsys.com" , "Vineet.Gupta1@synopsys.com" , "devicetree@vger.kernel.org" , "linux-snps-arc@lists.infradead.org" , "linux-gpio@vger.kernel.org" , "mark.rutland@arm.com" List-Id: linux-gpio@vger.kernel.org T24gVGh1LCAyMDE4LTA4LTMwIGF0IDEwOjQzICswMjAwLCBMaW51cyBXYWxsZWlqIHdyb3RlOg0K PiBPbiBUdWUsIEF1ZyAyOCwgMjAxOCBhdCAxOjI3IFBNIEV1Z2VuaXkgUGFsdHNldg0KPiA8RXVn ZW5peS5QYWx0c2V2QHN5bm9wc3lzLmNvbT4gd3JvdGU6DQo+IA0KPiA+ICsrKyBiL0RvY3VtZW50 YXRpb24vZGV2aWNldHJlZS9iaW5kaW5ncy9ncGlvL3NucHMsY3JlZy1ncGlvLnR4dA0KPiA+IEBA IC0wLDAgKzEsNDkgQEANCj4gPiArR1BJTyB2aWEgQ1JFRyAoQ29udHJvbCBSRUdpc2VycykgZHJp dmVyDQpbc25pcF0NCg0KPiA+ICstIHNucHMsbmdwaW9zOiBOdW1iZXIgb2YgR1BJTyBwaW5zLg0K PiANCj4gVXNlIHRoZSBleGlzdGluZyBuZ3Bpb3MgYXR0cm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3Qgd2FudCB0byBoYXJkY29kZSB0aGlzIHZh bHVlcyBpbnRvIGxvb2t1cCB0YWJsZSBhcyBJIGdvaW5nIHRvIHVzZQ0KdGhpcyBkcml2ZXIgb24g MyBhbHJlYWR5IHVwc3RyZWFtZWQgcGxhdGZvcm1zIGFuZCBhdCBsZWFzdCBvbmUgdXBjb21pbmcu DQoNClRoZXkgYWxsIGhhdmUgc3VjaCBDUkVHIHBzZXVkby0nR1BJT3MnIGRpZmZlcmVudGx5IG1h cHBlZCB3aXRoIGRpZmZlcmVudCBJTyBsaW5lcyBudW1iZXIsDQpkaWZmZXJlbnQgZW5hYmxlL2Rp c2FibGUgdmFsdWUsIGV0Yy4uLg0KDQpJcyBpdCByZWFsbHkgYSBwcm9ibGVtIHRvIGhhdmUgdGhp cyB2YWx1ZXMgY29uZmlndXJlZCB2aWEgZGV2aWNlIHRyZWU/DQpJZiB3ZSByZWFkIHRoZW0gZnJv bSBEVCB3ZSBhcmUgYWJsZSB0byB1c2UgdGhpcyBnZW5lcmljIGFuZCBjb25maWd1cmFibGUgZHJp dmVyIHRvIGhhbmRsZQ0KYm90aCBleGlzdGluZyBhbmQgdXBjb21pbmcgcGxhdGZvcm1zIHdpdGhv dXQgdGhlIG5lZWQgb2YgcGF0Y2hpbmcgdGhlIGRyaXZlciBvbiBldmVyeSBuZXcNCnBsYXRmb3Jt IHVwc3RyZWFtaW5nLg0KDQo+IA0KPiBZb3VycywNCj4gTGludXMgV2FsbGVpag0KLS0gDQogRXVn ZW5peSBQYWx0c2V2 From mboxrd@z Thu Jan 1 00:00:00 1970 From: Eugeniy.Paltsev@synopsys.com (Eugeniy Paltsev) Date: Thu, 30 Aug 2018 18:16:06 +0000 Subject: [PATCH v2 2/2] dt-bindings: Document the Synopsys GPIO via CREG bindings In-Reply-To: References: <20180828112721.28178-1-Eugeniy.Paltsev@synopsys.com> <20180828112721.28178-3-Eugeniy.Paltsev@synopsys.com> List-ID: Message-ID: <1535652965.4465.84.camel@synopsys.com> To: linux-snps-arc@lists.infradead.org On Thu, 2018-08-30@10:43 +0200, Linus Walleij wrote: > 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 [snip] > > +- snps,ngpios: Number of GPIO pins. > > Use the existing ngpios attribute for this, see gpio.txt Ok > > +- 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? Actually I really don't want to hardcode this values into lookup table as I going to use this driver on 3 already upstreamed platforms and at least one upcoming. They all have such CREG pseudo-'GPIOs' differently mapped with different IO lines number, different enable/disable value, etc... Is it really a problem to have this values configured via device tree? If we read them from DT we are able to use this generic and configurable driver to handle both existing and upcoming platforms without the need of patching the driver on every new platform upstreaming. > > Yours, > Linus Walleij -- Eugeniy Paltsev