Re: spi_mpc8xxx.c: chip select polarity problem

2009-12-14 Thread Torsten Fleischer
On Wed, Dec 9, 2009 at 18:46:51 Grant Likely wrote: > wrote: > [...] > > The following patch adds a function to get the active state of the chip > > select of a SPI device by looking for the 'spi-cs-high' property in the > > associated device tree node. > > This function is used by the spi_mpc8xxx

Re: spi_mpc8xxx.c: chip select polarity problem

2009-12-09 Thread Grant Likely
On Wed, Dec 9, 2009 at 8:49 AM, Torsten Fleischer wrote: > On Thu, Nov 26, 2009 at 20:17:35,  Grant Likely wrote: > [...] >> spi-cs-high is definitely not a complete solution, but it isn't >> actively evil either.  Plus it is documented and (presumably) in >> active use. so support for it should n

Re: spi_mpc8xxx.c: chip select polarity problem

2009-12-09 Thread Torsten Fleischer
On Wed, Dec 9, 2009 at 18:46:51 Grant Likely wrote: [...] > > + ret = of_get_spi_cs_active_state(np, i, &astate); > > + if (ret) { > > + dev_err(dev, "can't get cs active state of device > > " + "#%d: %d\n", i, ret); >

Re: spi_mpc8xxx.c: chip select polarity problem

2009-12-09 Thread Torsten Fleischer
On Thu, Nov 26, 2009 at 20:17:35, Grant Likely wrote: [...] > spi-cs-high is definitely not a complete solution, but it isn't > actively evil either. Plus it is documented and (presumably) in > active use. so support for it should not be dropped. > > Regardless, there needs to be a library funct

Re: spi_mpc8xxx.c: chip select polarity problem

2009-11-26 Thread Grant Likely
On Thu, Nov 26, 2009 at 12:01 PM, Anton Vorontsov wrote: > On Thu, Nov 26, 2009 at 11:50:05AM -0700, Grant Likely wrote: >> On Thu, Nov 26, 2009 at 11:41 AM, Anton Vorontsov >> wrote: >> > On Thu, Nov 26, 2009 at 11:16:34AM -0700, Grant Likely wrote: >> > [...] >> >> The spi-cs-high property is d

Re: spi_mpc8xxx.c: chip select polarity problem

2009-11-26 Thread Anton Vorontsov
On Thu, Nov 26, 2009 at 11:50:05AM -0700, Grant Likely wrote: > On Thu, Nov 26, 2009 at 11:41 AM, Anton Vorontsov > wrote: > > On Thu, Nov 26, 2009 at 11:16:34AM -0700, Grant Likely wrote: > > [...] > >> The spi-cs-high property is defined in > >> Documentation/powerpc/dts-bindings/spi-bus.txt, bu

Re: spi_mpc8xxx.c: chip select polarity problem

2009-11-26 Thread Grant Likely
On Thu, Nov 26, 2009 at 11:41 AM, Anton Vorontsov wrote: > On Thu, Nov 26, 2009 at 11:16:34AM -0700, Grant Likely wrote: > [...] >> The spi-cs-high property is defined in >> Documentation/powerpc/dts-bindings/spi-bus.txt, but it definitely was >> a mistake > > Yup. > >> Currently the spi-cs-high p

Re: spi_mpc8xxx.c: chip select polarity problem

2009-11-26 Thread Anton Vorontsov
On Thu, Nov 26, 2009 at 11:16:34AM -0700, Grant Likely wrote: [...] > The spi-cs-high property is defined in > Documentation/powerpc/dts-bindings/spi-bus.txt, but it definitely was > a mistake Yup. > Currently the spi-cs-high property is parsed in the > of_register_spi_devices() function, but the

Re: spi_mpc8xxx.c: chip select polarity problem

2009-11-26 Thread Grant Likely
On Thu, Nov 26, 2009 at 10:27 AM, Torsten Fleischer wrote: > On Thu, Nov 26, 2009 at 13:12:04 Anton Vorontsov wrote: > [...] >> > Ah.  I understand what you're doing now.   Hmmm.  This approach >> > concerns me because it relies on firmware or platform code to get CS >> > gpios set up properly bef

Re: spi_mpc8xxx.c: chip select polarity problem

2009-11-26 Thread Grant Likely
On Thu, Nov 26, 2009 at 5:12 AM, Anton Vorontsov wrote: > On Wed, Nov 25, 2009 at 03:11:57PM -0700, Grant Likely wrote: >> On Wed, Nov 25, 2009 at 1:41 PM, Torsten Fleischer >> wrote: >> > On Wen, Nov 25, 2009 at 01:33:57 Grant Likely wrote: >> >> Thanks.  However, there needs to be a proper desc

Re: spi_mpc8xxx.c: chip select polarity problem

2009-11-26 Thread Torsten Fleischer
On Thu, Nov 26, 2009 at 13:12:04 Anton Vorontsov wrote: [...] > > Ah. I understand what you're doing now. Hmmm. This approach > > concerns me because it relies on firmware or platform code to get CS > > gpios set up properly before the driver is probed. > > Yes, that was said at the very begin

Re: spi_mpc8xxx.c: chip select polarity problem

2009-11-26 Thread Anton Vorontsov
On Wed, Nov 25, 2009 at 03:11:57PM -0700, Grant Likely wrote: > On Wed, Nov 25, 2009 at 1:41 PM, Torsten Fleischer > wrote: > > On Wen, Nov 25, 2009 at 01:33:57 Grant Likely wrote: > >> Thanks.  However, there needs to be a proper description of what this > >> patch does to go in the commit header

Re: spi_mpc8xxx.c: chip select polarity problem

2009-11-25 Thread Grant Likely
On Wed, Nov 25, 2009 at 1:41 PM, Torsten Fleischer wrote: > On Wen, Nov 25, 2009 at 01:33:57 Grant Likely wrote: >> Thanks.  However, there needs to be a proper description of what this >> patch does to go in the commit header.  Can you please write one? >> >> Thanks, >> g. >> > [...] > > The init

Re: spi_mpc8xxx.c: chip select polarity problem

2009-11-25 Thread Torsten Fleischer
On Wen, Nov 25, 2009 at 01:33:57 Grant Likely wrote: > Thanks. However, there needs to be a proper description of what this > patch does to go in the commit header. Can you please write one? > > Thanks, > g. > [...] The initialization of the chip selects is removed from the probe() function of

Re: spi_mpc8xxx.c: chip select polarity problem

2009-11-24 Thread Grant Likely
Thanks. However, there needs to be a proper description of what this patch does to go in the commit header. Can you please write one? Thanks, g. On Sat, Nov 21, 2009 at 9:08 AM, Torsten Fleischer wrote: > On Sat, Nov 21, 2009 at 09:45:50 Grant Likely wrote: > [...] >> Hey Torsten,  do you have

Re: spi_mpc8xxx.c: chip select polarity problem

2009-11-21 Thread Torsten Fleischer
On Sat, Nov 21, 2009 at 09:45:50 Grant Likely wrote: [...] > Hey Torsten, do you have an updated version of this change to address > the comments? I'm collecting the last few things for some linux-next > exposure now. Hey Grant, here is the updated version of the patch containing the recommende

Re: spi_mpc8xxx.c: chip select polarity problem

2009-11-21 Thread Grant Likely
On Wed, Nov 18, 2009 at 4:29 PM, Anton Vorontsov wrote: > On Wed, Nov 18, 2009 at 05:20:06PM +0100, Torsten Fleischer wrote: > [...] >> > Oh. On the other hand, we can postpone the gpio_direction_output() >> > call, and still require that the platform code (or firmware) >> > should be responsible

Re: spi_mpc8xxx.c: chip select polarity problem

2009-11-18 Thread Anton Vorontsov
On Wed, Nov 18, 2009 at 05:20:06PM +0100, Torsten Fleischer wrote: [...] > > Oh. On the other hand, we can postpone the gpio_direction_output() > > call, and still require that the platform code (or firmware) > > should be responsible for setting a sane default values on the > > chip selects. > >

Re: spi_mpc8xxx.c: chip select polarity problem

2009-11-18 Thread Torsten Fleischer
On Wen, Nov 18, 2009 00:28:23 Anton Vorontsov wrote: [...] > > > > > So it might be better to fix up initial value in the platform code? > > > > > > > > Oh, we actually cannot, because the driver calls > > > > gpio_direction_output(). > > > > > > > > And since we don't know the mode prior to SPI de

Re: spi_mpc8xxx.c: chip select polarity problem

2009-11-17 Thread Anton Vorontsov
On Tue, Nov 17, 2009 at 11:22:11PM +0300, Anton Vorontsov wrote: > On Tue, Nov 17, 2009 at 09:09:28PM +0100, Torsten Fleischer wrote: > > On Mon, Nov 16, 2009 at 19:00PM, Anton Vorontsov wrote: > > [...] > > > > So it might be better to fix up initial value in the platform code? > > > > > > Oh, we

Re: spi_mpc8xxx.c: chip select polarity problem

2009-11-17 Thread Torsten Fleischer
On Mon, Nov 16, 2009 at 19:00PM, Anton Vorontsov wrote: [...] > > So it might be better to fix up initial value in the platform code? > > Oh, we actually cannot, because the driver calls > gpio_direction_output(). > > And since we don't know the mode prior to SPI device's driver > probe() finishe

Re: spi_mpc8xxx.c: chip select polarity problem

2009-11-17 Thread Anton Vorontsov
On Tue, Nov 17, 2009 at 09:09:28PM +0100, Torsten Fleischer wrote: > On Mon, Nov 16, 2009 at 19:00PM, Anton Vorontsov wrote: > [...] > > > So it might be better to fix up initial value in the platform code? > > > > Oh, we actually cannot, because the driver calls > > gpio_direction_output(). > >

Re: spi_mpc8xxx.c: chip select polarity problem

2009-11-16 Thread Anton Vorontsov
On Mon, Nov 16, 2009 at 08:10:37PM +0300, Anton Vorontsov wrote: [...] > > I also tried to set alow_flags[x] = 0 for active low. In this case the > > transfer works, but the initial value for the CS is wrong (Low instead of > > High). > > So it might be better to fix up initial value in the plat

Re: spi_mpc8xxx.c: chip select polarity problem

2009-11-16 Thread Anton Vorontsov
On Mon, Nov 16, 2009 at 05:42:46PM +0100, Torsten Fleischer wrote: > Hi all, > > I have 3 devices connected to the SPI bus of the MPC8313. For the Chip Select > (CS) signals 3 GPIOs of the controller are used. But the driver uses the > inverse polarity of the CS either during the initialization

spi_mpc8xxx.c: chip select polarity problem

2009-11-16 Thread Torsten Fleischer
Hi all, I have 3 devices connected to the SPI bus of the MPC8313. For the Chip Select (CS) signals 3 GPIOs of the controller are used. But the driver uses the inverse polarity of the CS either during the initialization or at the transfer - depending on the setup of the flattened device tree. H