linux-sh.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
To: linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH 3/7] sh: pfc: Allow device tree registration
Date: Mon, 26 Nov 2012 12:54:47 +0000	[thread overview]
Message-ID: <3335047.C4mAxUcIyV@avalon> (raw)
In-Reply-To: <1353889014-17142-4-git-send-email-horms@verge.net.au>

Hi Simon,

On Monday 26 November 2012 09:16:50 Simon Horman wrote:
> This is a crude mechanism to allow the pfc driver to be registered through
> device tree. The mofication of this is to provide a way for pfc gpios to be
> looked up by device tree for devices which use pfc gpios.

Indeed it's a bit of a hack :-) I'll see how I can rebase that on top of my 
PFC patch series. I'd rather avoid this intermediate step as it would make PFC 
rework more complex.

> More specifically, the motivation is to allow the registration
> of the card-detect gpio for the Micro-SD SDHI slot of the KZM9G board.
>
> Cc: Paul Mundt <lethal@linux-sh.org>
> Cc: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
> Signed-off-by: Simon Horman <horms@verge.net.au>
> ---
>  drivers/sh/pfc/gpio.c  |   15 +++++++++++++++
>  include/linux/sh_pfc.h |    7 +++++++
>  2 files changed, 22 insertions(+)
> 
> diff --git a/drivers/sh/pfc/gpio.c b/drivers/sh/pfc/gpio.c
> index 038fa07..322b927 100644
> --- a/drivers/sh/pfc/gpio.c
> +++ b/drivers/sh/pfc/gpio.c
> @@ -136,6 +136,19 @@ static void sh_pfc_gpio_setup(struct sh_pfc_chip *chip)
> gc->ngpio = (pfc->last_gpio - pfc->first_gpio) + 1;
>  }
> 
> +#ifdef CONFIG_OF_GPIO
> +static void
> +sh_pfc_register_gpiochip_dt(struct sh_pfc *pfc, struct gpio_chip *chip)
> +{
> +	chip->of_node = pfc->of_node;
> +	chip->of_gpio_n_cells = pfc->of_gpio_n_cells;
> +	chip->of_xlate = pfc->of_xlate;
> +}
> +#else
> +static void sh_pfc_register_gpiochip_dt(struct sh_pfc *pfc,
> +					struct gpio_chip *chip) {}
> +#endif
> +
>  int sh_pfc_register_gpiochip(struct sh_pfc *pfc)
>  {
>  	struct sh_pfc_chip *chip;
> @@ -153,6 +166,8 @@ int sh_pfc_register_gpiochip(struct sh_pfc *pfc)
>  	if (unlikely(ret < 0))
>  		kfree(chip);
> 
> +	sh_pfc_register_gpiochip_dt(pfc, &chip->gpio_chip);
> +
>  	pr_info("%s handling gpio %d -> %d\n",
>  		pfc->name, pfc->first_gpio, pfc->last_gpio);
> 
> diff --git a/include/linux/sh_pfc.h b/include/linux/sh_pfc.h
> index c19a092..9963370 100644
> --- a/include/linux/sh_pfc.h
> +++ b/include/linux/sh_pfc.h
> @@ -124,6 +124,13 @@ struct sh_pfc {
>  	struct pfc_window *window;
> 
>  	unsigned long unlock_reg;
> +
> +#ifdef CONFIG_OF_GPIO
> +	struct device_node *of_node;
> +	int of_gpio_n_cells;
> +	int (*of_xlate)(struct gpio_chip *gc,
> +		        const struct of_phandle_args *gpiospec, u32 *flags);
> +#endif
>  };
> 
>  /* XXX compat for now */
-- 
Regards,

Laurent Pinchart


  reply	other threads:[~2012-11-26 12:54 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-11-26  0:16 [PATCH 0/7] ARM: mach-shmobile: kzm9g: Reference DT implementation Simon Horman
2012-11-26  0:16 ` [PATCH 1/7] mmc: sh-mmcif: provide default allowed voltage Simon Horman
2012-11-26  4:06   ` Magnus Damm
2012-11-26  4:39     ` Simon Horman
2012-11-26  0:16 ` [PATCH 2/7] mmc: sdhi: enchance OF support for flags and cd-gpios Simon Horman
2012-11-26 10:16   ` Guennadi Liakhovetski
2012-11-26 10:18   ` Guennadi Liakhovetski
2012-11-26  0:16 ` [PATCH 3/7] sh: pfc: Allow device tree registration Simon Horman
2012-11-26 12:54   ` Laurent Pinchart [this message]
2012-11-27  0:07   ` Laurent Pinchart
2012-11-27  0:42     ` Simon Horman
2012-11-26  0:16 ` [PATCH 4/7] ARM: shmobile: pfc-sh73a0: Register device tree Simon Horman
2012-11-26 14:06   ` Laurent Pinchart
2012-11-27  3:36     ` Simon Horman
2012-11-26  0:16 ` [PATCH 5/7] ARM: mach-shmobile: sh73a0: Allow initialisation of GIC by DT Simon Horman
2012-11-26  0:16 ` [PATCH 6/7] ARM: mach-shmobile: sh73a0: Minimal setup using DT Simon Horman
2012-11-26  4:23   ` Magnus Damm
2012-11-26  4:58     ` Simon Horman
2012-11-26 12:53       ` Laurent Pinchart
2012-11-27  0:32         ` Simon Horman
2012-11-26  0:16 ` [PATCH 7/7] ARM: mach-shmobile: kzm9g: Reference DT implementation Simon Horman
2012-11-26  8:34   ` Tetsuyuki Kobayashi
2012-11-27  0:33     ` Simon Horman
2012-11-26  6:10 ` [PATCH 0/7] " Tetsuyuki Kobayashi
2012-11-27  0:32   ` Simon Horman

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=3335047.C4mAxUcIyV@avalon \
    --to=laurent.pinchart@ideasonboard.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).