public inbox for linux-arm-kernel@lists.infradead.org
 help / color / mirror / Atom feed
From: u.kleine-koenig@pengutronix.de (Uwe Kleine-König)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 1/1] arm: imx: share imx5x_register_gpios for mach-mx5
Date: Thu, 25 Nov 2010 07:29:24 +0100	[thread overview]
Message-ID: <20101125062924.GD4693@pengutronix.de> (raw)
In-Reply-To: <1290695312-30031-1-git-send-email-linuxzsc@gmail.com>

Hello Richard,

On Thu, Nov 25, 2010 at 10:28:32PM +0800, Richard Zhao wrote:
> From: Richard Zhao <richard.zhao@freescale.com>
> 
> Add variable mx5x_gpio_port_cnt, and init in machine init function.
> It can be share by mx51, mx53 and coming mx50.
> 
> Signed-off-by: Richard Zhao <linuxzsc@gmail.com>
> 
> diff --git a/arch/arm/mach-mx5/board-cpuimx51.c b/arch/arm/mach-mx5/board-cpuimx51.c
> index 5ff5522..cd7bd4c 100644
> --- a/arch/arm/mach-mx5/board-cpuimx51.c
> +++ b/arch/arm/mach-mx5/board-cpuimx51.c
> @@ -242,6 +242,8 @@ __setup("otg_mode=", eukrea_cpuimx51_otg_mode);
>   */
>  static void __init eukrea_cpuimx51_init(void)
>  {
> +	mx5x_gpio_port_cnt = 4;
> +
IMO the machine files shouldn't need to know how many gpio banks are
available.  This is a per-SoC thing and so should be set in a SoC function.

How do you want to continue this change?  mx51 and mx53 have the same
number of ports?  Does mx50 have more or less?  The addresses are the
same?

Best regards
Uwe

>  	mxc_iomux_v3_setup_multiple_pads(eukrea_cpuimx51_pads,
>  					ARRAY_SIZE(eukrea_cpuimx51_pads));
>  
> diff --git a/arch/arm/mach-mx5/board-cpuimx51sd.c b/arch/arm/mach-mx5/board-cpuimx51sd.c
> index ff1f45e..e47345a 100644
> --- a/arch/arm/mach-mx5/board-cpuimx51sd.c
> +++ b/arch/arm/mach-mx5/board-cpuimx51sd.c
> @@ -262,6 +262,8 @@ static struct platform_device *platform_devices[] __initdata = {
>  
>  static void __init eukrea_cpuimx51sd_init(void)
>  {
> +	mx5x_gpio_port_cnt = 4;
> +
>  	mxc_iomux_v3_setup_multiple_pads(eukrea_cpuimx51sd_pads,
>  					ARRAY_SIZE(eukrea_cpuimx51sd_pads));
>  
> diff --git a/arch/arm/mach-mx5/board-mx51_3ds.c b/arch/arm/mach-mx5/board-mx51_3ds.c
> index 6cc2805..cb22fc3 100644
> --- a/arch/arm/mach-mx5/board-mx51_3ds.c
> +++ b/arch/arm/mach-mx5/board-mx51_3ds.c
> @@ -160,6 +160,8 @@ static struct spi_board_info mx51_3ds_spi_nor_device[] = {
>   */
>  static void __init mxc_board_init(void)
>  {
> +	mx5x_gpio_port_cnt = 4;
> +
>  	mxc_iomux_v3_setup_multiple_pads(mx51_3ds_pads,
>  					ARRAY_SIZE(mx51_3ds_pads));
>  	mxc_init_imx_uart();
> diff --git a/arch/arm/mach-mx5/board-mx51_babbage.c b/arch/arm/mach-mx5/board-mx51_babbage.c
> index ef32843..8054c09 100644
> --- a/arch/arm/mach-mx5/board-mx51_babbage.c
> +++ b/arch/arm/mach-mx5/board-mx51_babbage.c
> @@ -347,9 +347,12 @@ static const struct spi_imx_master mx51_babbage_spi_pdata __initconst = {
>   */
>  static void __init mxc_board_init(void)
>  {
> +	mx5x_gpio_port_cnt = 4;
> +
>  	iomux_v3_cfg_t usbh1stp = MX51_PAD_USBH1_STP__USBH1_STP;
>  	iomux_v3_cfg_t power_key = MX51_PAD_EIM_A27__GPIO_2_21;
>  
> +	mx5x_gpio_port_cnt = 4;
>  #if defined(CONFIG_CPU_FREQ_IMX)
>  	get_cpu_op = mx51_get_cpu_op;
>  #endif
> diff --git a/arch/arm/mach-mx5/board-mx51_efikamx.c b/arch/arm/mach-mx5/board-mx51_efikamx.c
> index 4b2718b..cf315cb 100644
> --- a/arch/arm/mach-mx5/board-mx51_efikamx.c
> +++ b/arch/arm/mach-mx5/board-mx51_efikamx.c
> @@ -314,6 +314,8 @@ void mx51_efikamx_reset(void)
>  
>  static void __init mxc_board_init(void)
>  {
> +	mx5x_gpio_port_cnt = 4;
> +
>  	mxc_iomux_v3_setup_multiple_pads(mx51efikamx_pads,
>  					ARRAY_SIZE(mx51efikamx_pads));
>  	mx51_efikamx_board_id();
> diff --git a/arch/arm/mach-mx5/devices.c b/arch/arm/mach-mx5/devices.c
> index d926203..b8371d2 100644
> --- a/arch/arm/mach-mx5/devices.c
> +++ b/arch/arm/mach-mx5/devices.c
> @@ -183,13 +183,11 @@ static struct mxc_gpio_port mxc_gpio_ports[] = {
>  	},
>  };
>  
> -int __init imx51_register_gpios(void)
> -{
> -	return mxc_gpio_init(mxc_gpio_ports, 4);
> -}
> +int mx5x_gpio_port_cnt;
>  
> -int __init imx53_register_gpios(void)
> +int __init imx5x_register_gpios(void)
>  {
> -	return mxc_gpio_init(mxc_gpio_ports, ARRAY_SIZE(mxc_gpio_ports));
> +	if (mx5x_gpio_port_cnt)
> +		return mxc_gpio_init(mxc_gpio_ports, mx5x_gpio_port_cnt);
> +	return -EINVAL;
>  }
> -
> diff --git a/arch/arm/mach-mx5/devices.h b/arch/arm/mach-mx5/devices.h
> index af1d07c..d3411dc 100644
> --- a/arch/arm/mach-mx5/devices.h
> +++ b/arch/arm/mach-mx5/devices.h
> @@ -4,3 +4,5 @@ extern struct platform_device mxc_usbdr_udc_device;
>  extern struct platform_device mxc_wdt;
>  extern struct platform_device mxc_hsi2c_device;
>  extern struct platform_device mxc_keypad_device;
> +
> +extern int mx5x_gpio_port_cnt;
> diff --git a/arch/arm/mach-mx5/mm.c b/arch/arm/mach-mx5/mm.c
> index e57f968..b0ea57b 100644
> --- a/arch/arm/mach-mx5/mm.c
> +++ b/arch/arm/mach-mx5/mm.c
> @@ -61,7 +61,7 @@ void __init mx53_map_io(void)
>  	iotable_init(mx53_io_desc, ARRAY_SIZE(mx53_io_desc));
>  }
>  
> -int imx51_register_gpios(void);
> +int imx5x_register_gpios(void);
>  
>  void __init mx51_init_irq(void)
>  {
> @@ -78,11 +78,9 @@ void __init mx51_init_irq(void)
>  		panic("unable to map TZIC interrupt controller\n");
>  
>  	tzic_init_irq(tzic_virt);
> -	imx51_register_gpios();
> +	imx5x_register_gpios();
>  }
>  
> -int imx53_register_gpios(void);
> -
>  void __init mx53_init_irq(void)
>  {
>  	unsigned long tzic_addr;
> @@ -95,5 +93,5 @@ void __init mx53_init_irq(void)
>  		panic("unable to map TZIC interrupt controller\n");
>  
>  	tzic_init_irq(tzic_virt);
> -	imx53_register_gpios();
> +	imx5x_register_gpios();
>  }
> -- 
> 1.7.1
> 
> 
> 

-- 
Pengutronix e.K.                           | Uwe Kleine-K?nig            |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |

  reply	other threads:[~2010-11-25  6:29 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-11-25 14:28 [PATCH 1/1] arm: imx: share imx5x_register_gpios for mach-mx5 Richard Zhao
2010-11-25  6:29 ` Uwe Kleine-König [this message]
2010-11-25  6:44   ` Richard Zhao
2010-11-25  7:42     ` Uwe Kleine-König
2010-11-25  8:01       ` Richard Zhao
2010-11-25  8:14         ` Uwe Kleine-König
2010-11-25  8:43           ` Sascha Hauer
2010-11-25 11:10             ` Richard Zhao
2010-11-25 12:17               ` Uwe Kleine-König
2010-11-25 14:40                 ` Richard Zhao

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=20101125062924.GD4693@pengutronix.de \
    --to=u.kleine-koenig@pengutronix.de \
    --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