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

Prafulla Wadaskar prafulla at marvell.com
Fri Mar 30 13:34:45 CEST 2012



> -----Original Message-----
> From: Valentin Longchamp [mailto:valentin.longchamp at keymile.com]
> Sent: 29 March 2012 21:15
> 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/29/2012 02:49 PM, Valentin Longchamp wrote:
> > On 03/28/2012 09:48 AM, Prafulla Wadaskar wrote:
> >> 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.
> >
> 
> I have started to implement this, and now I see that with your
> approach of doing
> the mpp part in the driver does not work and my proposed solution of
> doing this
> with board specific functions is the correct one:
> 
> The SPI_SI, SPI_SCK, SPI_CSn all can be used with different mpp
> configuration.
> This is a board design parameter. How can the driver know which one is
> used on
> the board ?

Dear Valentin
You should keep by default NF configuration in your board configuration (kwmpp_config), so this becomes your default mpp configuration.

If SPI flash is being accessed, all spi_flash calls are guarded with claim_bus and release_bus APIs.

In Kirkwood specific claim_bus API, you will backup default configuration (which is NF in your case) for these particular pins (SPI_SI, SPI_SCK, SPI_CSn, MOSI, MISO).

and in release_bus API, you will reconfigure backed-up mpp configuration (which will be NF in your case).

With this you don't need km_hw_spi_bus_claim() or do_spi_toggle() in your board specific code any more.

How come this doesn't work? It should work, if not let's debug the problem.

Regards..
Prafulla . . .


More information about the U-Boot mailing list