[U-Boot] [PATCH v2] spi/kirkwood: add weak functions board_spi_bus_claim/release

Valentin Longchamp
2012-03-29T14:49:58Z

On 03/29/2012 04:21 PM, Prafulla Wadaskar wrote:
>> On 03/28/2012 09:48 AM, Prafulla Wadaskar wrote:
>>>> On 03/26/2012 11:58 AM, Valentin Longchamp wrote:
>>>>> Some kirkwood based boards may need to implement such function due
>>
>> Correct, this is exactly our use case: we have the NAND Flash
>> Controller and the
>> SPI controller that share the same pins.
>>
>>>
>>> But this is not board specific whereas, it should be feature
>> enhancement for Kirkwood spi driver.
>>
>> This is correct for the mpp part of spi_claim_bus. If you look at the
>> actual
>> implementation that we do in our board specific function, there is an
>> additional
>> step that is needed by our board design.
>>
>>>
>>> You should add this support very similar to multiple CS pin
>> selection support added to the Kirkwood driver, no external (board
>> specific triggers needed)
>>>
>>> Here are my suggestions:
>>> 1. Configure these mpps in your board specific files as NF pins.
>>> 2. Populate below logic for claim/release bus feature in Kirkwood
>> spi driver.
>>> 2.a. When spi_claim_bus will be called, backup current mpps status
>> and reconfigure these mpps for SPI in Kirkwood_spi driver.
>>> 2.b. When spi_release_bus will be called, reconfigure with backed up
>> mfg as SPI pins
>>> 2.c. Add check for to avoid multiple claim for same bus
>>>
>>
>> OK, I agree with this, but I would add:
>> 2.d. call weak attribute functions boad_spi_claim/release_bus at the
>> end of
>> spi_claim/release_bus functions
>
> With above logic, SPI driver will manage the show cleanly.
> Then, why do you need these weak attribute functions?
>

Because this is in our case not sufficient: we have an external device that
takes care of "disabling" the the SPI bus from the "bus" when we do some NF
accesses (and vice-versa), so that the SPI devices do not try interpret the NF
signal toggling as SPI accesses. This external "mux" is driver by a GPIO and
that's what I want to put in these board weak attribute functions.

They belong to spi_claim/release_bus but really are specific to our
device/boards and that's why I would need such functions.

--
Valentin Longchamp
Embedded Software Engineer
Hardware and Chip Integration
______________________________________
KEYMILE AG
Schwarzenburgstr. 73
CH-3097 Liebefeld
Phone +41 31 377 1318
Fax +41 31 377 1212
valentin.longchamp at keymile.com
www.keymile.com
______________________________________
KEYMILE: A Specialist as a Partner