[U-Boot] SPI - cs validity

Hebbar, Gururaja gururaja.hebbar at ti.com
Wed Apr 6 11:47:59 CEST 2011


Hi,

On Wed, Apr 06, 2011 at 15:02:22, Ran Shalit wrote:
>  
> 
> 	It seems that currently both atmel & davinci boards supports only 1 spi instance at a time.
> 	
> 	In order to support different spi instances,
> 	In case of atmel declare SPIx_BASE as required & set CONFIG_DEFAULT_SPI_BUS to required bus
> 	In case of davinci set CONFIG_SYS_SPI_BASE to base address of required spi instance
> 	
> 	Also, spi_cs_is_valid() function needs to be updated to support different spi instances. spi_cs_is_valid() function is board dependednt.
> 	
> 	Hope this helps.
> 	
> 	Regards,
> 	Gururaja
> 	
> 
> 
>  
> Hi Gururaja,
>  
> It seems that the implementation limit the validity only for bus==0.
> This means that trying other bus(=spi port ?)  will fail even if its not at the same time. In addition to that the CPU's data sheet make no limit.
>  
> Best Regards,
> Ran
> 

Don't top post.


Currenly davinci spi driver only allows (bus == 0) to pass which means spi0. So if you want to support other or many spi port at once, then

1. you need to change spi_cs_is_valid() to check for various bus values &
2. validate the bus argument to spi_setup_slave(). may be using a switch as in case of atmel. 
 
from 

ds->regs = (struct davinci_spi_regs *)CONFIG_SYS_SPI_BASE;

to 

struct davinci_spi_regs *regs;

switch (bus) {
	case 0:
		regs = (struct davinci_spi_regs *)CONFIG_SYS_SPI0_BASE;
		break;
	case 1:
		regs = (struct davinci_spi_regs *)CONFIG_SYS_SPI1_BASE;
		break;
                 ...
                 ...
	default:
		return NULL;
	}

ds->regs = regs;

Regards
Gururaja


More information about the U-Boot mailing list