linux-spi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* spi-bitbang inverted logic?
@ 2012-03-15 11:09 Guennadi Liakhovetski
       [not found] ` <Pine.LNX.4.64.1203151201040.2988-0199iw4Nj15frtckUFj5Ag@public.gmane.org>
  0 siblings, 1 reply; 5+ messages in thread
From: Guennadi Liakhovetski @ 2012-03-15 11:09 UTC (permalink / raw)
  To: Grant Likely; +Cc: spi-devel-general-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f

Hi all

I stumbled across this code in spi-bitbang.c:

		list_for_each_entry (t, &m->transfers, transfer_list) {
			...
			cs_change = t->cs_change;
			...
			if (!cs_change)
				continue;
			...
			/* sometimes a short mid-message deselect of the chip
			 * may be needed to terminate a mode or command
			 */
			ndelay(nsecs);
			bitbang->chipselect(spi, BITBANG_CS_INACTIVE);
			ndelay(nsecs);
		}
		...

		/* normally deactivate chipselect ... unless no error and
		 * cs_change has hinted that the next message will probably
		 * be for this chip too.
		 */
		if (!(status == 0 && cs_change)) {
			ndelay(nsecs);
			bitbang->chipselect(spi, BITBANG_CS_INACTIVE);
			ndelay(nsecs);
		}

So, IIUC, on the first occurrance cs_change is interpreted as "true == 
have to disable CD," whereas the second one does the opposite. Shouldn't 
the latter one be inverted?

Thanks
Guennadi
---
Guennadi Liakhovetski, Ph.D.
Freelance Open-Source Software Developer
http://www.open-technology.de/

------------------------------------------------------------------------------
This SF email is sponsosred by:
Try Windows Azure free for 90 days Click Here 
http://p.sf.net/sfu/sfd2d-msazure

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

end of thread, other threads:[~2012-03-16 10:00 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-03-15 11:09 spi-bitbang inverted logic? Guennadi Liakhovetski
     [not found] ` <Pine.LNX.4.64.1203151201040.2988-0199iw4Nj15frtckUFj5Ag@public.gmane.org>
2012-03-15 21:31   ` Grant Likely
2012-03-16  6:09   ` Jassi Brar
     [not found]     ` <CABb+yY0KqpSYnGqcf95JU0PkjMen_ECwPMmNTFdnMRwrguGPnA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2012-03-16  8:34       ` Guennadi Liakhovetski
     [not found]         ` <Pine.LNX.4.64.1203160915380.13465-0199iw4Nj15frtckUFj5Ag@public.gmane.org>
2012-03-16 10:00           ` Jassi Brar

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