All of lore.kernel.org
 help / color / mirror / Atom feed
From: Valentin Longchamp <valentin.longchamp@keymile.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH v3 1/3] cmd_sf: add 'release' command
Date: Wed, 25 Nov 2015 08:10:53 +0100	[thread overview]
Message-ID: <56555EFD.1020202@keymile.com> (raw)
In-Reply-To: <5655307B.9040702@denx.de>

On 25/11/2015 04:52, Stefan Roese wrote:
> Hi Valentine,
> 
> On 24.11.2015 17:02, Valentin Longchamp wrote:
> 
> <snip>
> 
>>>>> Does your board use driver model from SPI and SPI flash? If not I
>>>>> think that should be the first step.
>>>>>
>>>>
>>>> No we don't. Could you please elaborate on how this would cover this use case
>>>> and should be the first step ?
>>>>
>>>> I am open to other ways to cover this use case of ours, especially since this
>>>> was done more than 2 years ago and u-boot has changed since then. However I
>>>> don't see the direct link between the driver model and how it would allow to
>>>> make sure spi_flash_free() is called in our u-boot env scripts.
>>>
>>> In driver model you would have a remove() method for your SPI driver
>>> which does the required pinmux changing.
>>
>> OK, when looking at SPI flash, SPI controller driver and the driver model, I
>> have found out why we require this "release" command.
>>
>> So the SPI subsystem and its drivers (with or without DM support) make sure that
>> spi_claim_bus/release_bus are called before/after the accesses. This should
>> cover the pinmux configuration stuff.
>>
>> In our case, it was not sufficient since drivers/spi/kirkwood_spi.c does the
>> pinmux configuration at 2 places: spi_claim_bus/release_bus for the IO
>> (MOSI/MISO/CLK) AND spi_setup_slave/free_slave for the chip select.
>>
>> Since spi_free_slave is not always called after spi_setup_slave (for instance
>> after a sf probe command on the u-boot prompt), the CS pin was not always given
>> back to the NAND flash controller that's why there was a need for a sf release
>> command in our case.
>>
>> I have now moved all the pinmux configuration for kirkwood_spi into
>> spi_claim_bus/release_bus and the need for this sf release command is not
>> necessary anymore.
>>
>> I am going to test this a bit more and send a new patch series which will not
>> require this release command.
>>
>>>
>>> There is a detailed howto in doc/driver-model showing how to port your
>>> driver over. Please let me know if you need any help/ideas.
>>
>> I have had a look at it and it is a great help on porting a driver to this
>> model. That's something we plan to do for our boards eventually.
> 
> So did you already port the kirkwood SPI driver to DM? I'm asking, since
> I also do have a patch for this in the queue. I'll hopefully be able
> to post it by end of this week.

No I didn't. I was just looking at what should be done for that. For my above
problem I want to send a patch to the current driver without porting it at all.

> 
> BTW: I would love to see the Kirkwood platform to be moved over to
> arch-mvebu at some time, which already supports DM.
> 

Tell me if you're doing something in this area, I may give some help or test a
few things, according to the remaining time besides my current projects. The
Kirkwood platform would definitely be better if this was done.

Valentin

  reply	other threads:[~2015-11-25  7:10 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-11-13 13:25 [U-Boot] [PATCH v3 0/3] Serial Flash: call spi_flash_free more coherently Valentin Longchamp
2015-11-13 13:25 ` [U-Boot] [PATCH v3 1/3] cmd_sf: add 'release' command Valentin Longchamp
2015-11-19 16:57   ` Jagan Teki
2015-11-20 10:13     ` Valentin Longchamp
2015-11-20 17:19       ` Simon Glass
2015-11-23  9:19         ` Valentin Longchamp
2015-11-24  1:49           ` Simon Glass
2015-11-24 16:02             ` Valentin Longchamp
2015-11-25  3:52               ` Stefan Roese
2015-11-25  7:10                 ` Valentin Longchamp [this message]
2015-11-13 13:25 ` [U-Boot] [PATCH v3 2/3] env_sf: generalize call to spi_flash_free after accesses Valentin Longchamp
2015-11-13 13:25 ` [U-Boot] [PATCH v3 3/3] km_arm: call 'sf release' in the newenv and update scripts Valentin Longchamp

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=56555EFD.1020202@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.