[U-Boot] [PATCH 3/9 v2] i.MX31: support GPIO as a chip-select in the mxc_spi driver

Anatolij Gustschin agust at denx.de
Thu Feb 5 17:32:27 CET 2009


Guennadi Liakhovetski wrote:

> diff --git a/drivers/spi/mxc_spi.c b/drivers/spi/mxc_spi.c
> index b7bd84b..1341543 100644
> --- a/drivers/spi/mxc_spi.c
> +++ b/drivers/spi/mxc_spi.c
<snip>
> @@ -105,6 +112,10 @@ static u32 spi_xchg_single(struct spi_slave *slave, u32 data, int bitlen)
>  	while (reg_read(mxcs->base + MXC_CSPICTRL) & MXC_CSPICTRL_XCH)
>  		;
>  
> +	if (mxcs->gpio > 0 && (flags & SPI_XFER_END))
> +		mx31_gpio_set(mxcs->gpio,
> +			      !(mxcs->ctrl_reg & MXC_CSPICTRL_SSPOL));

this is a multi-line if statement, I think the preferred coding style
is as follows:
	if (...) {
		/*
		 * multi-line if statement
		 */
		...
	}
please fix, Thanks!

> @@ -146,11 +157,35 @@ struct spi_slave *spi_setup_slave(unsigned int bus, unsigned int cs,
>  {
>  	unsigned int ctrl_reg;
>  	struct mxc_spi_slave *mxcs;
> +	int ret;
>  
> -	if (bus >= sizeof(spi_bases) / sizeof(spi_bases[0]) ||
> -	    cs > 3)
> +	if (bus >= sizeof(spi_bases) / sizeof(spi_bases[0]))

please use ARRAY_SIZE() here, too. Thanks!

Best regards,
Anatolij



More information about the U-Boot mailing list