linux-spi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Re: [PATCH] at25: call spi_setup before read/write access
       [not found] ` <BD79186B4FD85F4B8E60E381CAEE190948112F-KURmP/Qoe8Pmp66j18f85VaTQe2KTcn/@public.gmane.org>
@ 2008-07-23 18:37   ` David Brownell
       [not found]     ` <BD79186B4FD85F4B8E60E381CAEE1909481160@mi8nycmail19.Mi8.com>
  0 siblings, 1 reply; 2+ messages in thread
From: David Brownell @ 2008-07-23 18:37 UTC (permalink / raw)
  To: hartleys; +Cc: spi-devel-general-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f

On Wednesday 23 July 2008, hartleys wrote:
> This patch makes the at25 driver call spi_setup before any read/write
> access to the eeprom to insure that the device mode and clock is set
> correctly.

Why would this be needed though?  It was called before probe(), and
nothing changed the setup ... so it should still be valid.


> Signed-off-by: H Hartley Sweeten <hsweeten-3FF4nKcrg1dE2c76skzGb0EOCMrvLtNR@public.gmane.org>
> 
> 
> --- orig/linux-2.6.25.10/drivers/spi/at25.c	2008-07-02
> 20:46:47.000000000 -0700
> +++
> /home/bigguiness/buildroot/project_build_arm/ep9307/linux-2.6.25.10/driv
> ers/spi/at25.c	2008-07-23 10:45:51.000000000 -0700
> @@ -134,6 +134,8 @@ at25_bin_read(struct kobject *kobj, stru
>  	if (unlikely(!count))
>  		return count;
>  
> +	spi_setup(at25->spi);
> +
>  	return at25_ee_read(at25, buf, off, count);
>  }
>  
> @@ -260,6 +262,8 @@ at25_bin_write(struct kobject *kobj, str
>  	if (unlikely(!count))
>  		return count;
>  
> +	spi_setup(at25->spi);
> +
>  	return at25_ee_write(at25, buf, off, count);
>  }
>   
> 



-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] at25: call spi_setup before read/write access
       [not found]       ` <BD79186B4FD85F4B8E60E381CAEE1909481160-KURmP/Qoe8Pmp66j18f85VaTQe2KTcn/@public.gmane.org>
@ 2008-07-23 19:11         ` David Brownell
  0 siblings, 0 replies; 2+ messages in thread
From: David Brownell @ 2008-07-23 19:11 UTC (permalink / raw)
  To: hartleys; +Cc: spi-devel-general-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f

On Wednesday 23 July 2008, hartleys wrote:
> On Wednesday, July 23, 2008 David Brownell wrote:
> >> This patch makes the at25 driver call spi_setup before any read/write
> 
> >> access to the eeprom to insure that the device mode and clock is set 
> >> correctly.
> >
> > Why would this be needed though?  It was called before probe(), and
> > nothing changed the setup ... so it should still be valid.
> 
> With multiple slaves another driver could change the clock.

No it can't.  If you're seeing that behavior, it's a bug in your
SPI controller driver ... it's not properly keeping track of
the device settings.  The spi_setup() call only changes records
of settings for that device; those settings become active the
next time I/O is performed to that device.  The controllers often
have per-chipselect registers with settings for speed, mode, word
size, and so forth.  If they don't have such registers, they need
to emulate having them.

Also, note that your patch wouldn't actually work around that
controller driver bug.  A driver for a different SPI device
could issue requests between the spi_setup() you added and
the I/O calls ...

- Dave


-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2008-07-23 19:11 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <BD79186B4FD85F4B8E60E381CAEE190948112F@mi8nycmail19.Mi8.com>
     [not found] ` <BD79186B4FD85F4B8E60E381CAEE190948112F-KURmP/Qoe8Pmp66j18f85VaTQe2KTcn/@public.gmane.org>
2008-07-23 18:37   ` [PATCH] at25: call spi_setup before read/write access David Brownell
     [not found]     ` <BD79186B4FD85F4B8E60E381CAEE1909481160@mi8nycmail19.Mi8.com>
     [not found]       ` <BD79186B4FD85F4B8E60E381CAEE1909481160-KURmP/Qoe8Pmp66j18f85VaTQe2KTcn/@public.gmane.org>
2008-07-23 19:11         ` David Brownell

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).