From: Valentin Longchamp <valentin.longchamp@keymile.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH v2] spi/kirkwood: add weak functions board_spi_bus_claim/release
Date: Mon, 02 Apr 2012 15:37:05 +0200 [thread overview]
Message-ID: <4F79AB81.3020104@keymile.com> (raw)
In-Reply-To: <F766E4F80769BD478052FB6533FA745D1A2F771247@SC-VEXCH4.marvell.com>
Dear Prafulla,
On 03/30/2012 02:58 PM, Prafulla Wadaskar wrote:
>> -----Original Message-----
>> From: Valentin Longchamp [mailto:valentin.longchamp at keymile.com]
>> Sent: 30 March 2012 17:45
>> 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,
>>
>> For the simplicity of the discussion, I have removed everything in the
>> discussion that is not relevant for the current open point.
>>
>> On 03/30/2012 01:34 PM, Prafulla Wadaskar wrote:
>>> 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).
>>
>> But which MPP are these particular pins ?
>>
>> Let's have a look at a single signal, SPI_SCK for instance. From the
>> 88F6281
>> Hardware Spec [1], page 53, SPI_SCK can be MPP[2], MPP[10]. How can
>> the generic
>> driver know which one actually is wired to the SPI device SCK pin on
>> the
>> currently running hardware (when none is configured as then, since by
>> default
>> for us MPP[2] is NF_IO[4] and MPP[10] is UA0_TXD ) ? This is a board
>> specific !
>>
>> If you tell me how I easily can find this out in the kirkwood driver,
>
> Dear Valentin
>
> Please make a use of CONFIG_SF_DEFAULT_CS for this.
Is this really the correct #define to use ? From the documentation, this is
supposed to set the Serial Flash CS. OK our SPI controller is used for serial
flash access, but this may be used for something else.
So I would not use this #define, nor any that is related to Serial Flash support.
> By default this is defined to 0, lets map it to our default use case i.e. using MPP0-3 for default SPI signals
>
> One may pre-define this in his board config as per specific need, and we can use this effectively in Kirkwood_spi driver.
> i.e.
> bit0 to be used to configure SPI_CSn
> bit1 to be used to configure SPI_MOSI... and so on
>
> so if my needs are to use
> 1. MPP7 as SPI_CSn I will define CONFIG_SF_DEFAULT_CS to 0x01
> 2. MPP6 as SPI_MOSI I will define CONFIG_SF_DEFAULT_CS to 0x02
> 2. MPP6 as SPI_MOSI and MPP7 as SPI_CSn, I will define CONFIG_SF_DEFAULT_CS to 0x03
> .. and so on.
>
Yeah I see what you mean and that's what I had figured out. But I don't think
this is a simple solution:
1) We would have to add another CONFIG_SYS_XY for this purpose (as explained above)
2) The two spi_claim_bus and spi_release_bus functions should implement some bit
masking on the new CONFIG_SYS_XY to determine 4 pins that have to be configured.
The number of code lines would not be huge, but that would still be a lot more
than the 10 lines that my board specific functions would require. 10 sequencial
c line codes/board are from my point of view acceptable (and it would be only
for our board, since I see no other board using this).
OK genericity is nice, but I guess we would be the only ones using this code,
and it would not be worth it in this case. Additionnaly, I like the fact that
anything that has to do with the mpp configurations stays in one single board
specific .c file.
Regards
--
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
next prev parent reply other threads:[~2012-04-02 13:37 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-03-26 9:58 [U-Boot] [PATCH v2] spi/kirkwood: add weak functions board_spi_bus_claim/release Valentin Longchamp
2012-03-27 13:27 ` Valentin Longchamp
2012-03-28 7:48 ` Prafulla Wadaskar
2012-03-29 12:49 ` Valentin Longchamp
2012-03-29 14:21 ` Prafulla Wadaskar
2012-03-29 14:49 ` Valentin Longchamp
2012-03-29 15:44 ` Valentin Longchamp
2012-03-30 11:34 ` Prafulla Wadaskar
2012-03-30 12:14 ` Valentin Longchamp
2012-03-30 12:58 ` Prafulla Wadaskar
2012-04-02 13:37 ` Valentin Longchamp [this message]
2012-04-03 6:35 ` Prafulla Wadaskar
2012-04-04 7:01 ` Valentin Longchamp
2012-04-04 7:12 ` Prafulla Wadaskar
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=4F79AB81.3020104@keymile.com \
--to=valentin.longchamp@keymile.com \
--cc=u-boot@lists.denx.de \
/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