From: Kumar Gala <galak@kernel.crashing.org>
To: Kumar Gala <galak@kernel.crashing.org>
Cc: David Brownell <david-b@pacbell.net>,
spi-devel-general@lists.sourceforge.net,
linux kernel mailing list <linux-kernel@vger.kernel.org>
Subject: Re: question on spi_bitbang
Date: Fri, 31 Mar 2006 13:17:07 -0600 [thread overview]
Message-ID: <F1378860-AAEB-4587-B357-A9B78AD49073@kernel.crashing.org> (raw)
In-Reply-To: <29F33C89-519A-412B-9615-1944ED29FD9C@kernel.crashing.org>
On Mar 31, 2006, at 1:07 PM, Kumar Gala wrote:
>
> On Mar 31, 2006, at 12:11 PM, David Brownell wrote:
>
>> On Friday 31 March 2006 9:31 am, Kumar Gala wrote:
>>> I'm looking at using spi_bitbang for a SPI driver and was trying to
>>> understand were the right point is to handle MODE switches.
>>>
>>> There are 4 function pointers provided for each mode.
>>
>> That's if you are indeed "bit banging", or your controller is the
>> type that's basically a wrapper around a shift register: each
>> txrx_word() function transfers (or bitbangs) a 1-32 bit word in
>> the relevant SPI mode (0-3).
>>
>> There's also a higher level txrx_bufs() routine for buffer-at-a-time
>> access, better suited to DMA, FIFOs, and half-duplex hardware.
>
> My controller is just a shift register that I can set the
> characteristics of (bit length for example, reverse data).
>
>>> My controller
>>> HW has a mode register which allows setting clock polarity and clock
>>> phase. I assume what I want is in my chipselect() function is to
>>> set
>>> my mode register and have the four function pointers set to the same
>>> function.
>>
>> I don't know how your particular hardware works, but if you have a
>> real SPI controller it would probably be more natural to have your
>> setup() function handle that mode register earlier, out of the main
>> transfer loop ... unless that mode register is shared among all
>> chipselects, in which case you'd use the setup_transfer() call for
>> that, inside the transfer loop. (That call hasn't yet been merged
>> into the mainline kernel yet; it's in the MM tree.)
>
> The mode register is shared between chipselects so I'll go pull the
> patches from -mm for setup_transfer(). That sounds like the right
> place for setting my mode register.
Now that I look at setup_transfer() more I dont think its what I
want. It's only going to get called if the transfer is different
from the spi_device() settings. I would seem I would want to
configure all of my settings in chipselect().
>> The chipselect() call should only affect the chipselect signal and,
>> when you're activating a chip, its initial clock polarity. Though
>> if you're not using the latest from the MM tree, that's also your
>> hook for ensuring that the SPI mode is set up right.
>
> Why deal with just clock polarity and not clock phase as well in
> chipselect()?
>
> It sounds like with the new patch, I'll end up setting txrx_word[]
> to the same function for all modes.
>
> - kumar
> -
> To unsubscribe from this list: send the line "unsubscribe linux-
> kernel" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at http://www.tux.org/lkml/
next prev parent reply other threads:[~2006-03-31 19:16 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-03-31 17:31 question on spi_bitbang Kumar Gala
2006-03-31 18:11 ` David Brownell
2006-03-31 18:19 ` [spi-devel-general] " Stephen Street
2006-03-31 19:16 ` David Brownell
2006-03-31 19:07 ` Kumar Gala
2006-03-31 19:17 ` Kumar Gala [this message]
2006-03-31 19:32 ` [spi-devel-general] " David Brownell
2006-03-31 20:00 ` Kumar Gala
2006-03-31 20:36 ` David Brownell
2006-03-31 20:52 ` Kumar Gala
2006-03-31 21:15 ` David Brownell
2006-03-31 22:11 ` Kumar Gala
2006-03-31 22:20 ` David Brownell
2006-03-31 23:58 ` 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=F1378860-AAEB-4587-B357-A9B78AD49073@kernel.crashing.org \
--to=galak@kernel.crashing.org \
--cc=david-b@pacbell.net \
--cc=linux-kernel@vger.kernel.org \
--cc=spi-devel-general@lists.sourceforge.net \
/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