From: "tiejun.chen" <tiejun.chen@windriver.com>
To: WANG YiFei <yifei_wang@hotmail.com>
Cc: linuxppc-dev@ozlabs.org
Subject: Re: Help about chip select on SPI slave devices
Date: Mon, 18 Oct 2010 16:17:34 +0800 [thread overview]
Message-ID: <4CBC029E.4030508@windriver.com> (raw)
In-Reply-To: <BAY158-ds45852D1FE75BC452A052FF5580@phx.gbl>
WANG YiFei wrote:
> Hi,
>
> We have a board which has 1 SPI master controller and 4 SPI slave devices, and we'd like to use 2 GPIOs to demux to chip select these slave devices.
> Can anyone tell me if current powerpc dts support demuxer for chip select for spi slave devices? So far as I know, in dts, SPI master can only use 1 to 1 GPIO to CS(then needs 4 GPIOs).
It may be unnecessary to add other device property on the dts for your purpose.
You can still get those original 2 gpios defined on the dts by default, but pass
'4' to num_chipselect of your SPI master when probe SPI master. This will 'tell'
kernel there are 4 kind chipselect signals for SPI sub-system. When the new SPI
device is added, the kernel would acquire the number which chip should be
activated by parsing chip_select of that corresponding spi_device. Then the
kernel call your chipselect defined with struct spi_bitbang to set gpio. (Often
we use gpio API gpio_set_value). On there you can determine how gpio_set_value()
are called according to your SPI device chip_select.
For example,
------
NO.0 Chip ==> gpio_set_value(PIN0, 0); gpio_set_value(PIN1, 0)
NO.1 Chip ==> gpio_set_value(PIN0, 0); gpio_set_value(PIN1, 1)
NO.2 Chip ==> gpio_set_value(PIN0, 1); gpio_set_value(PIN1, 0)
NO.3 Chip ==> gpio_set_value(PIN0, 1); gpio_set_value(PIN1, 1)
Tiejun
>
>
> Thanks in advance,
> YiFei
>
> _______________________________________________
> Linuxppc-dev mailing list
> Linuxppc-dev@lists.ozlabs.org
> https://lists.ozlabs.org/listinfo/linuxppc-dev
>
prev parent reply other threads:[~2010-10-18 8:18 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-10-12 14:49 ppc405 + MCP23S17 WANG YiFei
2010-10-13 3:09 ` tiejun.chen
2010-10-13 6:23 ` WANG YiFei
2010-10-13 7:49 ` tiejun.chen
2010-10-13 15:03 ` WANG YiFei
2010-10-14 5:03 ` tiejun.chen
2010-10-16 10:35 ` Help about chip select on SPI slave devices WANG YiFei
2010-10-18 8:17 ` tiejun.chen [this message]
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=4CBC029E.4030508@windriver.com \
--to=tiejun.chen@windriver.com \
--cc=linuxppc-dev@ozlabs.org \
--cc=yifei_wang@hotmail.com \
/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).