[U-Boot] [PATCH] Use common function to set GPIOs for MX3 and MX5

2010-08-20 Thread Stefano Babic
The patch adds support for setting gpios to the MX51 processor and change name to the corresponding functions for MX31. In this way, it is possible to get rid of nasty #ifdef switches related to the processor type. Signed-off-by: Stefano Babic --- arch/arm/include/asm/arch-mx31/mx31-regs.h | 1

Re: [U-Boot] [PATCH] Use common function to set GPIOs for MX3 and MX5

2010-08-20 Thread David Jander
On Friday 20 August 2010 10:20:11 am Stefano Babic wrote: > The patch adds support for setting gpios to the > MX51 processor and change name to the corresponding > functions for MX31. In this way, it is possible to get rid > of nasty #ifdef switches related to the processor type. Argh! I was just

Re: [U-Boot] [PATCH] Use common function to set GPIOs for MX3 and MX5

2010-08-20 Thread David Jander
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 > #include > #include > +#include >

Re: [U-Boot] [PATCH] Use common function to set GPIOs for MX3 and MX5

2010-08-20 Thread Stefano Babic
David Jander wrote: > Hi Stefano, > Hi David, > 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: Understood,

Re: [U-Boot] [PATCH] Use common function to set GPIOs for MX3 and MX5

2010-08-20 Thread David Jander
Stefano, On Friday 20 August 2010 12:01:00 pm Stefano Babic wrote: > > 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 compile

Re: [U-Boot] [PATCH] Use common function to set GPIOs for MX3 and MX5

2010-08-20 Thread Stefano Babic
David Jander wrote: > Great. I'll wait. > In the meantime I have just done this to get it working: > > #ifdef CONFIG_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

Re: [U-Boot] [PATCH] Use common function to set GPIOs for MX3 and MX5

2010-08-20 Thread David Jander
On Friday 20 August 2010 12:20:25 pm Stefano Babic wrote: > David Jander wrote: > > Great. I'll wait. > > In the meantime I have just done this to get it working: > > > > #ifdef CONFIG_MX31 > > void spi_cs_activate(struct spi_slave *slave) > > { > > struct mxc_spi_slave *mxcs = to_mxc_spi_slave

Re: [U-Boot] [PATCH] Use common function to set GPIOs for MX3 and MX5

2010-08-20 Thread Stefano Babic
David Jander wrote: > Absolutely right. I just posted it as reference for your patch eventually, > not > because I thought it was good that way. Yes, I know. I want only to point out what we have to reach ;-) >>> Seems to work, but never mind... >> Ok, I will resend my patch, I hope you can giv

Re: [U-Boot] [PATCH] Use common function to set GPIOs for MX3 and MX5

2010-08-20 Thread David Jander
Hi Stefano, On Friday 20 August 2010 01:19:28 pm Stefano Babic wrote: > > Will do. > > Btw, do you have any idea why spi_xchg_single() hangs while transmitting > > the second word without claiming the bus again? > > Can you see where does it hang ? Which device is connected to your SPI > bus ? D

Re: [U-Boot] [PATCH] Use common function to set GPIOs for MX3 and MX5

2010-08-20 Thread Stefano Babic
David Jander wrote: > Hi Stefano, > Hi David, > On Friday 20 August 2010 01:19:28 pm Stefano Babic wrote: >>> Will do. >>> Btw, do you have any idea why spi_xchg_single() hangs while transmitting >>> the second word without claiming the bus again? >> Can you see where does it hang ? Which device

Re: [U-Boot] [PATCH] Use common function to set GPIOs for MX3 and MX5

2010-08-23 Thread David Jander
Hi again, On Friday 20 August 2010 03:35:57 pm Stefano Babic wrote: > > Just figured out one big mistake. I was debugging spi_flash.c, and had > > CONFIG_ENV_IS_IN_SPI_FLASH set. That means, first SPI access is done > > before malloc is available, and guess what? spi_setup_slave() uses malloc > >

Re: [U-Boot] [PATCH] Use common function to set GPIOs for MX3 and MX5

2010-08-23 Thread David Jander
On Monday 23 August 2010 10:50:53 am David Jander wrote: > I am just now picking up where I left last week, so give me a few hours and > I should have something working, I guess. Ok, I guess I was pessimistic. There is a weird bug in mxc_spi.c: CPOL is negated! I just saw that in the mx51evk.h h

Re: [U-Boot] [PATCH] Use common function to set GPIOs for MX3 and MX5

2010-08-23 Thread Stefano Babic
David Jander wrote: > Hi again, > Hi David, > Are you sure? In arch/arm/lib/board.c function start_armboot(), init_sequence > is processed first, which contains env_init() before dram_init() and just > after completing init_sequence, mem_malloc_init() is called. How can you have > working mall

Re: [U-Boot] [PATCH] Use common function to set GPIOs for MX3 and MX5

2010-08-23 Thread Stefano Babic
David Jander wrote: > Ok, I guess I was pessimistic. There is a weird bug in mxc_spi.c: CPOL is > negated! > I just saw that in the mx51evk.h header file CONFIG_FSL_PMIC_MODE was set to > low-active clock (CPOL=1), which is not supposed to work. But it did work, > and > on the scope clock-polar

Re: [U-Boot] [PATCH] Use common function to set GPIOs for MX3 and MX5

2010-08-23 Thread David Jander
Hi Stefano, On Monday 23 August 2010 12:37:16 pm Stefano Babic wrote: >[...] > > In spi_cfg(), I saw this line: > > > > if (!(mode & SPI_CPOL)) > > sclkpol = 1; > > > > AFAIK, this should be: > > > > if (mode & SPI_CPOL) > > sclkpol = 1; > > > > At least for the MX51. Can you confirm that

Re: [U-Boot] [PATCH] Use common function to set GPIOs for MX3 and MX5

2010-08-23 Thread Stefano Babic
David Jander wrote: > Hi Stefano, > Hi David, > I just checked in the reference manual of the i.MX31, and there the meaning > of > this bit has the same polarity as on the i.MX51, so you'll need to fix this > also at the end of the spi_setup_slave() function, in the #else path of the > #ifde

Re: [U-Boot] [PATCH] Use common function to set GPIOs for MX3 and MX5

2010-08-23 Thread Stefan Roese
On Monday 23 August 2010 17:55:44 Stefano Babic wrote: > > I am also adding support for S25FL032P chips to the spansion driver. Will > > post a patch later. > > I have seen. However, it should be better if you send the patch also to > the maintainer for the MTD subsystem (Stefan Roese, I set his a

Re: [U-Boot] [PATCH] Use common function to set GPIOs for MX3 and MX5

2010-08-23 Thread Detlev Zundel
Hi Stefan, > On Monday 23 August 2010 17:55:44 Stefano Babic wrote: >> > I am also adding support for S25FL032P chips to the spansion driver. Will >> > post a patch later. >> >> I have seen. However, it should be better if you send the patch also to >> the maintainer for the MTD subsystem (Stefan

Re: [U-Boot] [PATCH] Use common function to set GPIOs for MX3 and MX5

2010-08-23 Thread Mike Frysinger
On Monday, August 23, 2010 17:03:24 Detlev Zundel wrote: > Hi Stefan, > > On Monday 23 August 2010 17:55:44 Stefano Babic wrote: > >> > I am also adding support for S25FL032P chips to the spansion driver. > >> > Will post a patch later. > >> > >> I have seen. However, it should be better if you se

Re: [U-Boot] [PATCH] Use common function to set GPIOs for MX3 and MX5

2010-08-26 Thread Detlev Zundel
Hi Mike, > On Monday, August 23, 2010 17:03:24 Detlev Zundel wrote: >> Hi Stefan, >> > On Monday 23 August 2010 17:55:44 Stefano Babic wrote: >> >> > I am also adding support for S25FL032P chips to the spansion driver. >> >> > Will post a patch later. >> >> >> >> I have seen. However, it should b