From: Conor Dooley <conor@kernel.org>
To: Joshua Yeong <joshua.yeong@starfivetech.com>
Cc: robh@kernel.org, krzk+dt@kernel.org, conor+dt@kernel.org,
paul.walmsley@sifive.com, palmer@dabbelt.com,
aou@eecs.berkeley.edu, leyfoon.tan@starfivetech.com,
jeeheng.sia@starfivetech.com, devicetree@vger.kernel.org,
linux-kernel@vger.kernel.org, linux-riscv@lists.infradead.org
Subject: Re: [PATCH v2 1/2] cache: Add StarFive StarLink cache management for StarFive JH8100
Date: Tue, 23 Apr 2024 16:54:24 +0100 [thread overview]
Message-ID: <20240423-clique-despair-ead97b78b186@spud> (raw)
In-Reply-To: <20240423072639.143450-2-joshua.yeong@starfivetech.com>
[-- Attachment #1: Type: text/plain, Size: 1813 bytes --]
On Tue, Apr 23, 2024 at 03:26:38PM +0800, Joshua Yeong wrote:
> +
> +#include <asm/dma-noncoherent.h>
> +
> +#define STARLINK_CACHE_FLUSH_START_ADDR 0x0
> +#define STARLINK_CACHE_FLUSH_END_ADDR 0x8
> +#define STARLINK_CACHE_FLUSH_CTL 0x10
> +#define STARLINK_CACHE_CACHE_ALIGN 0x40
> +
> +#define STARLINK_CACHE_ADDRESS_RANGE_MASK GENMASK(39, 0)
> +#define STARLINK_CACHE_FLUSH_CTL_MODE_MASK GENMASK(2, 1)
> +#define STARLINK_CACHE_FLUSH_CTL_ENABLE_MASK BIT(0)
> +
> +#define STARLINK_CACHE_FLUSH_CTL_CLEAN_INVALIDATE 0
> +#define STARLINK_CACHE_FLUSH_CTL_MAKE_INVALIDATE 1
> +#define STARLINK_CACHE_FLUSH_CTL_CLEAN_SHARED 2
> +#define STARLINK_CACHE_FLUSH_TIMEOUT_US 5000000
> +
> +struct starlink_cache_priv {
> + void __iomem *base_addr;
> +};
> +
> +static struct starlink_cache_priv starlink_cache_priv;
> +
> +static void starlink_cache_flush_complete(void)
> +{
> + volatile void __iomem *_ctl = starlink_cache_priv.base_addr +
Why does this variable have an _ prefix?
> + STARLINK_CACHE_FLUSH_CTL;
This link only has spaces, it should be tabs + < 8 spaces.
> + u64 v;
> +
> + if (readq_poll_timeout_atomic((_ctl), v,
> + !(v & STARLINK_CACHE_FLUSH_CTL_ENABLE_MASK), 1,
> + STARLINK_CACHE_FLUSH_TIMEOUT_US))
> + WARN(1, "StarFive Starlink cache flush operation timeout\n");
> +}
I'd fine this easier to read as:
static void starlink_cache_flush_complete(void)
{
volatile void __iomem *_ctl = starlink_cache_priv.base_addr +
STARLINK_CACHE_FLUSH_CTL;
u64 v;
int ret;
ret = readq_poll_timeout_atomic(_ctl, v, !(v & STARLINK_CACHE_FLUSH_CTL_ENABLE_MASK),
STARLINK_CACHE_FLUSH_POLL_DELAY_US,
STARLINK_CACHE_FLUSH_TIMEOUT_US);
if (ret)
WARN(1, "StarFive Starlink cache flush operation timeout\n");
}
Cheers,
Conor.
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]
next prev parent reply other threads:[~2024-04-23 15:54 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-04-23 7:26 [PATCH v2 0/2] Add StarFive's JH8100 StarLink Cache Controller Joshua Yeong
2024-04-23 7:26 ` [PATCH v2 1/2] cache: Add StarFive StarLink cache management for StarFive JH8100 Joshua Yeong
2024-04-23 15:54 ` Conor Dooley [this message]
2024-04-23 7:26 ` [PATCH v2 2/2] dt-bindings: cache: Add docs for StarFive Starlink cache controller Joshua Yeong
2024-04-23 10:30 ` Rob Herring
2024-04-23 15:41 ` Conor Dooley
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=20240423-clique-despair-ead97b78b186@spud \
--to=conor@kernel.org \
--cc=aou@eecs.berkeley.edu \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=jeeheng.sia@starfivetech.com \
--cc=joshua.yeong@starfivetech.com \
--cc=krzk+dt@kernel.org \
--cc=leyfoon.tan@starfivetech.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-riscv@lists.infradead.org \
--cc=palmer@dabbelt.com \
--cc=paul.walmsley@sifive.com \
--cc=robh@kernel.org \
/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