linux-spi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Anton Vorontsov <avorontsov-hkdhdckH98+B+jHODAdFcQ@public.gmane.org>
To: spi-devel-general-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org
Cc: linuxppc-dev-mnsaURCQ41sdnm+yROfE0A@public.gmane.org
Subject: [PATCH 1/4] [POWERPC][SPI] spi_mpc83xx.c: should turn off SPI unit	while switching any mode.
Date: Thu, 26 Jul 2007 17:13:46 +0400	[thread overview]
Message-ID: <20070726131346.GA3417@localhost.localdomain> (raw)
In-Reply-To: <20070726131134.GA3309-bi+AKbBUZKY6gyzm1THtWbp2dZbC/Bob@public.gmane.org>

Documentation clearly states, that mode should not be changed
till SPMODE_ENABLE bit set. I've seen hangs w/o this patch.

Signed-off-by: Anton Vorontsov <avorontsov-hkdhdckH98+B+jHODAdFcQ@public.gmane.org>
---
 drivers/spi/spi_mpc83xx.c |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/drivers/spi/spi_mpc83xx.c b/drivers/spi/spi_mpc83xx.c
index 3295cfc..0b99fd9 100644
--- a/drivers/spi/spi_mpc83xx.c
+++ b/drivers/spi/spi_mpc83xx.c
@@ -176,6 +176,8 @@ static void mpc83xx_spi_chipselect(struct spi_device *spi, int value)
 			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);
 		if (mpc83xx_spi->activate_cs)
 			mpc83xx_spi->activate_cs(spi->chip_select, pol);
@@ -249,6 +251,8 @@ int mpc83xx_spi_setup_transfer(struct spi_device *spi, struct spi_transfer *t)
 	regval &= 0xff0fffff;
 	regval |= SPMODE_LEN(bits_per_word);
 
+	/* 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);
 
 	return 0;
-- 
1.5.0.6


-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >>  http://get.splunk.com/

  parent reply	other threads:[~2007-07-26 13:13 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-07-26 13:11 [PATCH 0/4] Few spi_mpc83xx.c fixes and improvements Anton Vorontsov
     [not found] ` <20070726131134.GA3309-bi+AKbBUZKY6gyzm1THtWbp2dZbC/Bob@public.gmane.org>
2007-07-26 13:13   ` Anton Vorontsov [this message]
     [not found]     ` <20070726131346.GA3417-bi+AKbBUZKY6gyzm1THtWbp2dZbC/Bob@public.gmane.org>
2007-07-27  6:32       ` [PATCH 1/4] [POWERPC][SPI] spi_mpc83xx.c: should turn off SPI unit while switching any mode Kumar Gala
     [not found]         ` <250FD11F-9ADC-46CC-B652-1148FC549316-XVmvHMARGAS8U2dJNN8I7kB+6BGkLq7r@public.gmane.org>
2007-07-27 13:36           ` Anton Vorontsov
2007-07-26 13:14   ` [PATCH 2/4] [POWERPC][SPI] spi_mpc83xx: get rid of magic numbers Anton Vorontsov
2007-07-26 13:14   ` [PATCH 3/4] [POWERPC][SPI] spi_mpc83xx: support for lsb mode switching Anton Vorontsov
2007-07-26 13:14   ` [PATCH 4/4] [POWERPC][SPI] spi_mpc83xx: fix LSB mode shifts Anton Vorontsov
2007-07-27  2:58   ` [PATCH 0/4] Few spi_mpc83xx.c fixes and improvements David Brownell
     [not found]     ` <200707261958.09127.david-b-yBeKhBN/0LDR7s880joybQ@public.gmane.org>
2007-07-27  6:32       ` Kumar Gala

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=20070726131346.GA3417@localhost.localdomain \
    --to=avorontsov-hkdhdckh98+b+jhodadfcq@public.gmane.org \
    --cc=linuxppc-dev-mnsaURCQ41sdnm+yROfE0A@public.gmane.org \
    --cc=spi-devel-general-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).