All of lore.kernel.org
 help / color / mirror / Atom feed
From: David Jander <david.jander@protonic.nl>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH] Use common function to set GPIOs for MX3 and MX5
Date: Fri, 20 Aug 2010 11:29:25 +0200	[thread overview]
Message-ID: <201008201129.25980.david.jander@protonic.nl> (raw)
In-Reply-To: <1282292411-6087-1-git-send-email-sbabic@denx.de>


Hi Stefano,

On Friday 20 August 2010 10:20:11 am Stefano Babic wrote:
> diff --git a/drivers/spi/mxc_spi.c b/drivers/spi/mxc_spi.c
> index e15a63c..54af2e3 100644
> --- a/drivers/spi/mxc_spi.c
> +++ b/drivers/spi/mxc_spi.c
> @@ -23,6 +23,7 @@
>  #include <spi.h>
>  #include <asm/errno.h>
>  #include <asm/io.h>
> +#include <mxc_gpio.h>
> 
>  #ifdef CONFIG_MX27
>  /* i.MX27 has a completely wrong register layout and register definitions
>  in the @@ -68,9 +69,6 @@ static unsigned long spi_bases[] = {
>  	0x53f84000,
>  };
> 
> -#define OUT	MX31_GPIO_DIRECTION_OUT
> -#define mxc_gpio_direction	mx31_gpio_direction
> -#define mxc_gpio_set		mx31_gpio_set
>  #elif defined(CONFIG_MX51)
>  #include <asm/arch/imx-regs.h>
>  #include <asm/arch/clock.h>
> @@ -111,13 +109,12 @@ static unsigned long spi_bases[] = {
>  	CSPI2_BASE_ADDR,
>  	CSPI3_BASE_ADDR,
>  };
> -#define mxc_gpio_direction(gpio, dir)	(0)
> -#define mxc_gpio_set(gpio, value)	{}
> -#define OUT	1

After this change, it seems something else is missing:
GCC somehow removed the following code for i.MX51 without actually compiling 
the arguments to the functions (???), but now it becomes evident this only 
compiles for i.MX31:

void spi_cs_activate(struct spi_slave *slave)
{
	struct mxc_spi_slave *mxcs = to_mxc_spi_slave(slave);
	if (mxcs->gpio > 0)
		mxc_gpio_set(mxcs->gpio, mxcs->ctrl_reg & MXC_CSPICTRL_SSPOL);
}

void spi_cs_deactivate(struct spi_slave *slave)
{
	struct mxc_spi_slave *mxcs = to_mxc_spi_slave(slave);
	if (mxcs->gpio > 0)
		mxc_gpio_set(mxcs->gpio,
			      !(mxcs->ctrl_reg & MXC_CSPICTRL_SSPOL));
}

On i.MX51 SSPOL is set in the config register, and per SS individually. 
Therefore, MXC_CSPICTRL_SSPOL isn't defined for i.MX51.

Best regards,

-- 
David Jander
Protonic Holland.

  parent reply	other threads:[~2010-08-20  9:29 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-08-20  8:20 [U-Boot] [PATCH] Use common function to set GPIOs for MX3 and MX5 Stefano Babic
2010-08-20  8:46 ` David Jander
2010-08-20  9:29 ` David Jander [this message]
2010-08-20 10:01   ` Stefano Babic
2010-08-20 10:07     ` David Jander
2010-08-20 10:20       ` Stefano Babic
2010-08-20 10:30         ` David Jander
2010-08-20 11:19           ` Stefano Babic
2010-08-20 12:15             ` David Jander
2010-08-20 13:35               ` Stefano Babic
2010-08-23  8:50                 ` David Jander
2010-08-23  9:14                   ` David Jander
2010-08-23 10:37                     ` Stefano Babic
2010-08-23 11:30                       ` David Jander
2010-08-23 15:55                         ` Stefano Babic
2010-08-23 17:18                           ` Stefan Roese
2010-08-23 21:03                             ` Detlev Zundel
2010-08-23 21:53                               ` Mike Frysinger
2010-08-26  9:09                                 ` Detlev Zundel
2010-08-23 10:28                   ` Stefano Babic
2010-08-20 10:55 ` [U-Boot] [PATCH V2] " Stefano Babic

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=201008201129.25980.david.jander@protonic.nl \
    --to=david.jander@protonic.nl \
    --cc=u-boot@lists.denx.de \
    /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.