[PATCH] mpc83xx SPI glitch

Joakim Tjernlund joakim.tjernlund at transmode.se
Tue Apr 1 00:23:49 EST 2008


Mike

I already sent a patch some time ago, it addresses this bug and
alot more. See spi-devel-general
<spi-devel-general at lists.sourceforge.net>,

I am waiting for David B. to comment/apply it. If you want to see this
in 2.6.25 I suggest you remind 'David Brownell' <david-b at pacbell.net>

 Jocke
On Mon, 2008-03-31 at 08:04 -0500, Mike Hench wrote:
> dont write SPMODE reg unless mode changed.
> it causes SPI to go hi-z momentarily
> which can cause a spike on the CLK line
> this is a problem in MMC where /CS is held asserted
> across multiple transactions.
> 
> Signed-off-by: Mike Hench <mhench at elutions.com>
> 
> ---
> 
> --- linux-2.6.25-rc5.orig/drivers/spi/spi_mpc83xx.c	2008-03-10
> 00:22:27.000000000 -0500
> +++ linux-2.6.25-rc5/drivers/spi/spi_mpc83xx.c	2008-03-31
> 07:37:37.000000000 -0500
> @@ -147,6 +147,7 @@
>  
>  	if (value == BITBANG_CS_ACTIVE) {
>  		u32 regval =
> mpc83xx_spi_read_reg(&mpc83xx_spi->base->mode);
> +		u32 regval0 = regval;
>  		u32 len = spi->bits_per_word;
>  		u8 pm;
>  
> @@ -188,9 +189,16 @@
>  			regval |= SPMODE_PM(pm);
>  		}
>  
> -		/* Turn off SPI unit prior changing mode */
> -		mpc83xx_spi_write_reg(&mpc83xx_spi->base->mode, 0);
> -		mpc83xx_spi_write_reg(&mpc83xx_spi->base->mode, regval);
> +		// dont write reg unless mode changed.
> +		// it causes SPI to go hi-z momentarily
> +		// which can cause a spike on the CLK line
> +		// this is a problem in MMC where /CS is held asserted
> +		// across multiple transactions.
> +		if(regval != regval0) {
> +			/* Turn off SPI unit prior changing mode */
> +			mpc83xx_spi_write_reg(&mpc83xx_spi->base->mode,
> 0);
> +			mpc83xx_spi_write_reg(&mpc83xx_spi->base->mode,
> regval);
> +		}
>  		if (mpc83xx_spi->activate_cs)
>  			mpc83xx_spi->activate_cs(spi->chip_select, pol);
>  	}
> 
> _______________________________________________
> Linuxppc-dev mailing list
> Linuxppc-dev at ozlabs.org
> https://ozlabs.org/mailman/listinfo/linuxppc-dev
> 
> 





More information about the Linuxppc-dev mailing list