All of lore.kernel.org
 help / color / mirror / Atom feed
From: Bastien Curutchet <bastien.curutchet@bootlin.com>
To: Miquel Raynal <miquel.raynal@bootlin.com>
Cc: Santosh Shilimkar <ssantosh@kernel.org>,
	Krzysztof Kozlowski <krzk@kernel.org>,
	Richard Weinberger <richard@nod.at>,
	Vignesh Raghavendra <vigneshr@ti.com>,
	linux-kernel@vger.kernel.org, linux-mtd@lists.infradead.org,
	Thomas Petazzoni <thomas.petazzoni@bootlin.com>,
	Herve Codina <herve.codina@bootlin.com>,
	Christopher Cordahi <christophercordahi@nanometrics.ca>
Subject: Re: [PATCH v2 2/6] memory: ti-aemif: Export aemif_set_cs_timings()
Date: Tue, 12 Nov 2024 10:13:38 +0100	[thread overview]
Message-ID: <07cd5d53-ce99-4ada-a7f1-53795eff5c42@bootlin.com> (raw)
In-Reply-To: <87ttcdr2ym.fsf@bootlin.com>

Hi Miquèl,

On 11/11/24 8:21 PM, Miquel Raynal wrote:
> 
> Hello Bastien,
> 
> On 06/11/2024 at 09:55:03 +01, Bastien Curutchet <bastien.curutchet@bootlin.com> wrote:
> 
>> Export the aemif_set_cs_timing() symbol so it can be used by other
>> drivers
>>
>> Add a spinlock to protect the CS configuration register from concurrent
>> accesses.
> 
> What concurrent accesses are you trying to protect yourself against?
> I fail to see the use case, but TBH I haven't tried hard enough maybe.
> 

The register that handles the CS configuration belongs to the AEMIF 
component but it will also be accessed by the AEMIF 'children' with the 
aemif_set_cs_timing() function. So far, concurrent accesses shouldn't 
occur because the AEMIF configures the CS timings only once and does so 
before probing its 'children'; but I don't know how things can evolve in 
the future.

> Also, what justifies the use of a spin-lock in this case?
> 

TBH, I always struggle to choose between mutexes and spin-locks. I chose 
spin-lock because it only protects one memory-mapped register so I think 
it doesn't worth going to sleep when waiting for the lock.


Best regards,
Bastien

______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/

WARNING: multiple messages have this Message-ID (diff)
From: Bastien Curutchet <bastien.curutchet@bootlin.com>
To: Miquel Raynal <miquel.raynal@bootlin.com>
Cc: Santosh Shilimkar <ssantosh@kernel.org>,
	Krzysztof Kozlowski <krzk@kernel.org>,
	Richard Weinberger <richard@nod.at>,
	Vignesh Raghavendra <vigneshr@ti.com>,
	linux-kernel@vger.kernel.org, linux-mtd@lists.infradead.org,
	Thomas Petazzoni <thomas.petazzoni@bootlin.com>,
	Herve Codina <herve.codina@bootlin.com>,
	Christopher Cordahi <christophercordahi@nanometrics.ca>
Subject: Re: [PATCH v2 2/6] memory: ti-aemif: Export aemif_set_cs_timings()
Date: Tue, 12 Nov 2024 10:13:38 +0100	[thread overview]
Message-ID: <07cd5d53-ce99-4ada-a7f1-53795eff5c42@bootlin.com> (raw)
In-Reply-To: <87ttcdr2ym.fsf@bootlin.com>

Hi Miquèl,

On 11/11/24 8:21 PM, Miquel Raynal wrote:
> 
> Hello Bastien,
> 
> On 06/11/2024 at 09:55:03 +01, Bastien Curutchet <bastien.curutchet@bootlin.com> wrote:
> 
>> Export the aemif_set_cs_timing() symbol so it can be used by other
>> drivers
>>
>> Add a spinlock to protect the CS configuration register from concurrent
>> accesses.
> 
> What concurrent accesses are you trying to protect yourself against?
> I fail to see the use case, but TBH I haven't tried hard enough maybe.
> 

The register that handles the CS configuration belongs to the AEMIF 
component but it will also be accessed by the AEMIF 'children' with the 
aemif_set_cs_timing() function. So far, concurrent accesses shouldn't 
occur because the AEMIF configures the CS timings only once and does so 
before probing its 'children'; but I don't know how things can evolve in 
the future.

> Also, what justifies the use of a spin-lock in this case?
> 

TBH, I always struggle to choose between mutexes and spin-locks. I chose 
spin-lock because it only protects one memory-mapped register so I think 
it doesn't worth going to sleep when waiting for the lock.


Best regards,
Bastien

  reply	other threads:[~2024-11-12  9:13 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-11-06  8:55 [PATCH v2 0/6] Implement setup_interface() in the DaVinci NAND controller Bastien Curutchet
2024-11-06  8:55 ` Bastien Curutchet
2024-11-06  8:55 ` [PATCH v2 1/6] memory: ti-aemif: Create aemif_set_cs_timings() Bastien Curutchet
2024-11-06  8:55   ` Bastien Curutchet
2024-11-11 19:16   ` Miquel Raynal
2024-11-11 19:16     ` Miquel Raynal
2024-11-06  8:55 ` [PATCH v2 2/6] memory: ti-aemif: Export aemif_set_cs_timings() Bastien Curutchet
2024-11-06  8:55   ` Bastien Curutchet
2024-11-11 19:21   ` Miquel Raynal
2024-11-11 19:21     ` Miquel Raynal
2024-11-12  9:13     ` Bastien Curutchet [this message]
2024-11-12  9:13       ` Bastien Curutchet
2024-11-12 11:17       ` Miquel Raynal
2024-11-12 11:17         ` Miquel Raynal
2024-11-06  8:55 ` [PATCH v2 3/6] mtd: rawnand: davinci: Always depends on TI_AEMIF Bastien Curutchet
2024-11-06  8:55   ` Bastien Curutchet
2024-11-06  8:55 ` [PATCH v2 4/6] mtd: rawnand: davinci: Order headers alphabetically Bastien Curutchet
2024-11-06  8:55   ` Bastien Curutchet
2024-11-06  8:55 ` [PATCH v2 5/6] mtd: rawnand: davinci: Add clock resource Bastien Curutchet
2024-11-06  8:55   ` Bastien Curutchet
2024-11-06  8:55 ` [PATCH v2 6/6] mtd: rawnand: davinci: Implement setup_interface() operation Bastien Curutchet
2024-11-06  8:55   ` Bastien Curutchet
2024-11-11 19:32   ` Miquel Raynal
2024-11-11 19:32     ` Miquel Raynal
2024-11-12 12:53     ` Bastien Curutchet
2024-11-12 12:53       ` Bastien Curutchet

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=07cd5d53-ce99-4ada-a7f1-53795eff5c42@bootlin.com \
    --to=bastien.curutchet@bootlin.com \
    --cc=christophercordahi@nanometrics.ca \
    --cc=herve.codina@bootlin.com \
    --cc=krzk@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mtd@lists.infradead.org \
    --cc=miquel.raynal@bootlin.com \
    --cc=richard@nod.at \
    --cc=ssantosh@kernel.org \
    --cc=thomas.petazzoni@bootlin.com \
    --cc=vigneshr@ti.com \
    /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.