All of lore.kernel.org
 help / color / mirror / Atom feed
From: Nicolas Schichan <nschichan@freebox.fr>
To: Alexandre Courbot <acourbot@nvidia.com>, linux-mips@linux-mips.org
Cc: Maxime Bizon <mbizon@freebox.fr>,
	"linux-gpio@vger.kernel.org" <linux-gpio@vger.kernel.org>,
	Linus Walleij <linus.walleij@linaro.org>
Subject: Re: bcm63xx gpio issue on 3.19
Date: Wed, 11 Mar 2015 18:49:46 +0100	[thread overview]
Message-ID: <5500803A.7080409@freebox.fr> (raw)
In-Reply-To: <54FFD15E.3040202@nvidia.com>

On 03/11/2015 06:23 AM, Alexandre Courbot wrote:
>> Could you please advise on how to fix/workaround that ? (ideally while keeping
>> the possibility to invoke the gpiolib code from the setup/prom code).
> 
> The only allocation performed by gpiochip_add() is the array of gpio_descs.
> Having this array pre-allocated in your early code (maybe by using a static
> array variable) and passing it to a gpiochip_add_early() function would do the
> trick.
> 
> However, it is not that simple since gpio_desc is a private structure which
> details (including its size) are not visible outside of drivers/gpio.
> 
> Another solution I could see would be to have a kernel config option that
> would make gpiolib "pre-allocate" a number of gpio descriptors as a static
> array for such cases - similar to the global GPIO array, but not as big.
> 
> Finally, we can also restore the global GPIO array as a config option for the
> few architectures that need it.
> 
> Of course, I would prefer a solution based on dynamic allocation - is there a
> kind a primitive memory allocator that we can use at this early stage of boot?
> I.e. would alloc_pages() maybe work?
> 
> How do other subsystems that rely on dynamic allocation for registering their
> resources handle this? I guess regulator must fall in the same use-case,
> doesn't it?

Hi Alexandre,

Moving the bcm63xx_gpio_init() call from board_prom_init() to
bcm63xx_register_devices() (an arch_initcall) is enough to get called when
kmalloc is working. If code poking GPIOs is invoked earlier by a board code,
it will have to move in the board_register_devices() function though there
doesn't seem to any problems with the mainline bcm63xx board code in that regard.

I can produce a patch for that if it is an accepted solution. It has the
advantage of not requiring changes to the gpiolib code.

Regards,

-- 
Nicolas Schichan
Freebox SAS

  reply	other threads:[~2015-03-11 17:49 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-03-09 17:53 bcm63xx gpio issue on 3.19 Nicolas Schichan
2015-03-11  5:23 ` Alexandre Courbot
2015-03-11  5:23   ` Alexandre Courbot
2015-03-11 17:49   ` Nicolas Schichan [this message]
2015-03-12  4:03     ` Alexandre Courbot
2015-03-12  4:03       ` Alexandre Courbot
2015-03-18 10:02     ` Linus Walleij

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=5500803A.7080409@freebox.fr \
    --to=nschichan@freebox.fr \
    --cc=acourbot@nvidia.com \
    --cc=linus.walleij@linaro.org \
    --cc=linux-gpio@vger.kernel.org \
    --cc=linux-mips@linux-mips.org \
    --cc=mbizon@freebox.fr \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.