[PATCH/RFC 6/6] spi: bcm2835: set gpio-cs to high state prior to any

Stephen Warren swarren at wwwdotorg.org
Mon Mar 30 20:35:45 PDT 2015

On 03/30/2015 01:25 PM, Martin Sperl wrote:
>> On 30.03.2015, at 06:28, Mark Brown <broonie at kernel.org> wrote:
>> On Sun, Mar 29, 2015 at 04:03:28PM +0200, Martin Sperl wrote:
>>> A variation of this probably should get moved into spi_register_master
>>> to fix this for other spi-controller as well.
>> Yes, this is the wrong place to solve this.
> So should we move that into spi_register_master?
> My question for completeness remains: how do we get the devices
> from dt or whatever while we are still registering the master?
> Also I am still missing a bit of the big picture and vision how
> to implement it taking all different HW/setup cases into account.
> That is why I have put it as an RFC - mostly to get the issue some
> exposure and some ideas.

I suspect the solution is simply not to have the pinctrl node set the CS
pins to GPIO_OUT, but rather rely on gpio_request() ->
bcm2835_gpio_request() -> bcm2835_pmx_gpio_set_direction() setting up
the pinmux function for any GPIOs that are requested. Presumably, the CS
GPIO for each chip is only requested when the DT node for the SPI device
(not SPI controller device) has been parsed, so the correct GPIO CS
value can be passed to gpio_request()/gpio_direction_output()?

More information about the linux-rpi-kernel mailing list