Re: [RFC PATCH 08/12] gpio/tegra: Add device tree support

From: Belisko Marek
Date: Sat Aug 13 2011 - 05:49:30 EST


On Sat, Aug 13, 2011 at 12:54 AM, Stephen Warren <swarren@xxxxxxxxxx> wrote:
> Signed-off-by: Stephen Warren <swarren@xxxxxxxxxx>
> ---
> Âdrivers/gpio/gpio-tegra.c | Â 31 +++++++++++++++++++++++++++++++
> Â1 files changed, 31 insertions(+), 0 deletions(-)
>
> diff --git a/drivers/gpio/gpio-tegra.c b/drivers/gpio/gpio-tegra.c
> index 4da4839..923b413 100644
> --- a/drivers/gpio/gpio-tegra.c
> +++ b/drivers/gpio/gpio-tegra.c
> @@ -326,6 +326,29 @@ static struct irq_chip tegra_gpio_irq_chip = {
> Â#endif
> Â};
>
> +#ifdef CONFIG_OF
> +static void __init tegra_gpio_probe_dt(struct platform_device *pdev)
> +{
> + Â Â Â const __be32 *gpios;
> + Â Â Â u32 gpioslen;
> + Â Â Â int i;
> +
> + Â Â Â gpios = of_get_property(pdev->dev.of_node, "nvidia,gpios", &gpioslen);
> + Â Â Â if (gpios == NULL)
> + Â Â Â Â Â Â Â return;
> +
> + Â Â Â gpioslen /= sizeof(*gpios);
> + Â Â Â for (i = 0; i < gpioslen; i++, gpios++) {
> + Â Â Â Â Â Â Â u32 gpio = be32_to_cpup(gpios);
> + Â Â Â Â Â Â Â dev_err(&pdev->dev, "Enabling GPIO %d\n", gpio);
Is really necessary to print all enabled gpio's to console? Also seen
same in pinmux probe.
> + Â Â Â Â Â Â Â tegra_gpio_enable(gpio);
> + Â Â Â }
> +}
> +#else
> +static inline void __init tegra_gpio_probe_dt(struct platform_device *pdev)
> +{
> +}
> +#endif
>
> Â/* This lock class tells lockdep that GPIO irqs are in a different
> Â* category than their parents, so it won't report false recursion.
> @@ -371,13 +394,21 @@ static int __init tegra_gpio_probe(struct platform_device *pdev)
> Â Â Â Â Â Â Â Â Â Â Â Âspin_lock_init(&bank->lvl_lock[j]);
> Â Â Â Â}
>
> + Â Â Â tegra_gpio_probe_dt(pdev);
> +
> Â Â Â Âreturn 0;
> Â}
>
> +static struct of_device_id tegra_gpio_of_match[] __devinitdata = {
> + Â Â Â { .compatible = "nvidia,tegra20-gpio", },
> + Â Â Â { },
> +};
> +
> Âstatic struct platform_driver tegra_gpio_driver = {
>    Â.driver     = {
>        Â.name  = "tegra-gpio",
> Â Â Â Â Â Â Â Â.owner Â= THIS_MODULE,
> + Â Â Â Â Â Â Â .of_match_table = tegra_gpio_of_match,
> Â Â Â Â},
>    Â.probe     Â= tegra_gpio_probe,
> Â};
> --
> 1.7.0.4
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majordomo@xxxxxxxxxxxxxxx
> More majordomo info at Âhttp://vger.kernel.org/majordomo-info.html
> Please read the FAQ at Âhttp://www.tux.org/lkml/
>

regards,

marek

--
as simple and primitive as possible
-------------------------------------------------
Marek Belisko - OPEN-NANDRA
Freelance Developer

Ruska Nova Ves 219 | Presov, 08005 Slovak Republic
Tel: +421 915 052 184
skype: marekwhite
icq: 290551086
web: http://open-nandra.com
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/