From mboxrd@z Thu Jan 1 00:00:00 1970 From: Anton Vorontsov Subject: Re: [PATCH V5 2/3] Documentation: gpio: Add APM X-Gene SoC GPIO controller DTS binding Date: Mon, 7 Jul 2014 14:54:47 -0700 Message-ID: <20140707215446.GA28692@teo> References: <1403823587-23404-1-git-send-email-fkan@apm.com> <1403823587-23404-3-git-send-email-fkan@apm.com> <20140630125339.GA21390@leverpostej> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Return-path: Received: from mail-pd0-f181.google.com ([209.85.192.181]:39679 "EHLO mail-pd0-f181.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750868AbaGGVyv (ORCPT ); Mon, 7 Jul 2014 17:54:51 -0400 Received: by mail-pd0-f181.google.com with SMTP id v10so6007608pde.40 for ; Mon, 07 Jul 2014 14:54:51 -0700 (PDT) Content-Disposition: inline In-Reply-To: Sender: linux-gpio-owner@vger.kernel.org List-Id: linux-gpio@vger.kernel.org To: Linus Walleij Cc: Feng Kan , Mark Rutland , "patches@apm.com" , "gnurou@gmail.com" , "linux-gpio@vger.kernel.org" , "devicetree@vger.kernel.org" , "linux-arm-kernel@lists.infradead.org" On Mon, Jul 07, 2014 at 11:26:18PM +0200, Linus Walleij wrote: ... > > There was another reason for this as well, part of the gpio code I read > > was confusing me. So I look through the other gpio documentations and > > found an example that did this as well. > > > > int of_gpio_simple_xlate(struct gpio_chip *gc, > > const struct of_phandle_args *gpiospec, u32 *flags) > > { > > /* > > * We're discouraging gpio_cells < 2, since that way you'll have to > > * write your own xlate function (that will have to retrive the GPIO > > * number and the flags from a single gpio cell -- this is possible, > > * but not recommended). > > */ > > Hm yeah that's right. > > This check was added by Anton in 2008. Anton why did we discourage > onecell GPIOs? Yup, the check was there from the very beginning. Think of OF_GPIO_ACTIVE_LOW flag (it is widely used in drivers.) The documentation in Feng's driver says "second cell is used to specify optional parameters (unused)," which is not entirely correct. With the standard xlate call it is used for active-low flag. You can implement active-low flag w/o using the second cell, but it will be ugly. Thanks, Anton From mboxrd@z Thu Jan 1 00:00:00 1970 From: anton.vorontsov@linaro.org (Anton Vorontsov) Date: Mon, 7 Jul 2014 14:54:47 -0700 Subject: [PATCH V5 2/3] Documentation: gpio: Add APM X-Gene SoC GPIO controller DTS binding In-Reply-To: References: <1403823587-23404-1-git-send-email-fkan@apm.com> <1403823587-23404-3-git-send-email-fkan@apm.com> <20140630125339.GA21390@leverpostej> Message-ID: <20140707215446.GA28692@teo> To: linux-arm-kernel@lists.infradead.org List-Id: linux-arm-kernel.lists.infradead.org On Mon, Jul 07, 2014 at 11:26:18PM +0200, Linus Walleij wrote: ... > > There was another reason for this as well, part of the gpio code I read > > was confusing me. So I look through the other gpio documentations and > > found an example that did this as well. > > > > int of_gpio_simple_xlate(struct gpio_chip *gc, > > const struct of_phandle_args *gpiospec, u32 *flags) > > { > > /* > > * We're discouraging gpio_cells < 2, since that way you'll have to > > * write your own xlate function (that will have to retrive the GPIO > > * number and the flags from a single gpio cell -- this is possible, > > * but not recommended). > > */ > > Hm yeah that's right. > > This check was added by Anton in 2008. Anton why did we discourage > onecell GPIOs? Yup, the check was there from the very beginning. Think of OF_GPIO_ACTIVE_LOW flag (it is widely used in drivers.) The documentation in Feng's driver says "second cell is used to specify optional parameters (unused)," which is not entirely correct. With the standard xlate call it is used for active-low flag. You can implement active-low flag w/o using the second cell, but it will be ugly. Thanks, Anton