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

Prafulla Wadaskar
2012-03-29T14:21:32Z

> -----Original Message-----
> From: Valentin Longchamp [mailto:valentin.longchamp at keymile.com]
> Sent: 29 March 2012 18:20
> To: Prafulla Wadaskar
> Cc: u-boot at lists.denx.de; Gerlando Falauto; Holger Brunck
> Subject: Re: [PATCH v2] spi/kirkwood: add weak functions
> board_spi_bus_claim/release
>
> Hi Prafulla,
>
> 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
> >> to
> >>> some HW designs.
> >>
> >> I see no feedback from your side on this patch. I think you should
> go
> >> through
> >> the marvell tree:
> >>
> >> - the spi_claim/release_bus function are already implemented in the
> >> SPI subsystem
> >> - this patch touches only a kirkwood driver
> >> - there is no spi u-boot tree from what I see
> >>
> >> Please keep me up to date about the status of this patch
> >
> > Hi Valentin,
> > I have gone through this patch and related implementation in your
> other patch_series.
> > http://lists.denx.de/pipermail/u-boot/2012-March/120716.html
> >
> > Basically spi_claim_bus and spi_release_bus are not supported in
> current Kirkwood spi driver.
> > These are needed if someone wish to share the same interface pins
> with some other peripheral (that is your use case)
>
> 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?

Regards..
Prafulla . . .