From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1759139AbcIWNI7 (ORCPT ); Fri, 23 Sep 2016 09:08:59 -0400 Received: from anholt.net ([50.246.234.109]:44952 "EHLO anholt.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1757328AbcIWNI5 (ORCPT ); Fri, 23 Sep 2016 09:08:57 -0400 From: Eric Anholt To: Linus Walleij Cc: linux-rpi-kernel , "linux-arm-kernel\@lists.infradead.org" , "linux-kernel\@vger.kernel.org" , Stephen Warren , Lee Jones , bcm-kernel-feedback-list , Alexandre Courbot , Rob Herring , Mark Rutland , Gerd Hoffmann Subject: Re: [PATCH 1/3] dt-bindings: Add a binding for the RPi firmware GPIO driver. In-Reply-To: References: <20160919161314.25858-1-eric@anholt.net> User-Agent: Notmuch/0.22.2 (http://notmuchmail.org) Emacs/24.5.1 (x86_64-pc-linux-gnu) Date: Fri, 23 Sep 2016 16:08:45 +0300 Message-ID: <87ponu931e.fsf@eliezer.anholt.net> MIME-Version: 1.0 Content-Type: multipart/signed; boundary="=-=-="; micalg=pgp-sha512; protocol="application/pgp-signature" Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org --=-=-= Content-Type: text/plain Linus Walleij writes: > On Mon, Sep 19, 2016 at 6:13 PM, Eric Anholt wrote: > >> The RPi firmware exposes all of the board's GPIO lines through >> property calls. Linux chooses to control most lines directly through >> the pinctrl driver, but for the FXL6408 GPIO expander on the Pi3, we >> need to access them through the firmware. >> >> Signed-off-by: Eric Anholt > > Aha > >> +++ b/Documentation/devicetree/bindings/gpio/gpio-raspberrypi-firmware.txt >> @@ -0,0 +1,22 @@ >> +Raspberry Pi power domain driver > > Really? :) Thanks. >> +Required properties: >> + >> +- compatible: Should be "raspberrypi,firmware-gpio" > > Usually this is vendor,compat, is the vendors name "raspberrypi"? Yes, this driver is for part of the Raspberry Pi Foundation's firmware code (you can find the same pattern in the firmware and firmware power domain drivers). >> +- gpio-controller: Marks the device node as a gpio controller >> +- #gpio-cells: Should be <2> for GPIO number and flags >> +- ngpios: Number of GPIO lines to control. See gpio.txt > > Is this ever anything else than 8? Else omit it and hardcode > 8 in the driver instead. (see below) >> +- firmware: Reference to the RPi firmware device node > > Reference the DT binding for this. > >> +- raspberrypi,firmware-gpio-offset: >> + Number the firmware uses for the first GPIO line >> + controlled by this driver > > Does this differ between different instances of this hardware or > can it just be open coded in the driver instead? This is which range (128-135) of the firmware's GPIOs we're controlling. If another GPIO expander appears later (quite believable, I think they're down to 1 spare line on this expander), then we would just make another node with a new offset and ngpios for that expander. Sort of related: I also worry that we have races with the firmware for the platform GPIO bits, since both ARM and firmware are doing RMWs (or, even worse, maybe just Ws?) of the registers controlled by the pinctrl driver. Hopefully I can get the firmware to pass control of devices like this over to Linux, with firmware making requests to us, but I don't know if that will happen and we may need to access other GPIOs using this interface :( --=-=-= Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIcBAEBCgAGBQJX5SldAAoJELXWKTbR/J7oaQUP/2E9H7kn/wjqyVG0hZJxXyKs KQzfl5Eay8ACORsAggNmmfg3G0Mf1qYoPcpD6GVoCbjay3PWd7nGBBj1VC2dCdT6 K68nmTEeZ9Umf4B0zdKuVnWGe6rfYPgqzv21EZ25DZ1PM2kEprMDXGv36/oNuRLh AQdCMY1L4a2A1GctNOJmmp3NtS2BfG+wT4G0fsx2Q1kRzS34NWKo3fLSu1JA4cr5 aCHpwpK4PaH9vxIvXqvYmuInW5NIpFXjSItaz7TmWNNqoE5nkOlr5F0u6OVN9vVd LELC0+TFFLwYwbn4htT/au60VQk8nkTvbehM/VIDxjANq+6PW8x+QZN6IHN86R3S lUovQRoCJbevkd+7FSJRnLrbP4FGz4oLTzOq8oWhzeYbTRNJEIXhMXdI1furBElO sd5AC2LMLYMNQg87RHrDv89JTLtjk0ZRSI5u1s0I4TTH0FkwzYETvrdEZmtdd+wW w4NZVjX91lxtn8r0jpZvxgIjk6r4e3yPsYi7NCAIjJvGK90P+eoE71O9kkrl5kK0 9qpdXsdkKeDOULS/csGoJaMXe0GYJ3wIgq5bbAqpD95bXMxhjA08SB/uH9zk9rur WLOb6VjnUAgfbI/l7hDgjgbUw4/aZRF/dLkY8efRNgrdE8WktDjSpg5i729LD/Zx ZoqrIUE90QHVhtpP4ftY =DgCj -----END PGP SIGNATURE----- --=-=-=--