From: Eddie James <eajames@linux.ibm.com>
To: openbmc@lists.ozlabs.org
Cc: Eddie James <eajames@linux.ibm.com>
Subject: [PATCH linux dev-5.8] fsi: aspeed: Set poll timeout based on clock divider
Date: Wed, 10 Feb 2021 14:46:13 -0600 [thread overview]
Message-ID: <20210210204613.49560-1-eajames@linux.ibm.com> (raw)
The timeout for polling for transfer acknowledgment on the OPB
was very long, occasionally resulting in scheduling problems.
Instead, use a timeout based on the clock divider specified with
the module parameter. In benchmarking, the worst case poll times
didn't increase significantly with increased divider until it
reached 16 and higher. The average poll time increased linearly
with the divider.
div 1: max:150us avg: 2us
div 2: max:155us avg: 3us
div 4: max:149us avg: 7us
div 8: max:153us avg:13us
div 16: max:197us avg:21us
div 32: max:181us avg:50us
div 64: max:262us avg:100us
Signed-off-by: Eddie James <eajames@linux.ibm.com>
---
drivers/fsi/fsi-master-aspeed.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/drivers/fsi/fsi-master-aspeed.c b/drivers/fsi/fsi-master-aspeed.c
index c71d7e9a32b0..13f7e07beacc 100644
--- a/drivers/fsi/fsi-master-aspeed.c
+++ b/drivers/fsi/fsi-master-aspeed.c
@@ -25,6 +25,7 @@ struct fsi_master_aspeed {
void __iomem *base;
struct clk *clk;
struct gpio_desc *cfam_reset_gpio;
+ int timeout_us;
};
#define to_fsi_master_aspeed(m) \
@@ -92,8 +93,6 @@ static const u32 fsi_base = 0xa0000000;
static u16 aspeed_fsi_divisor = FSI_DIVISOR_DEFAULT;
module_param_named(bus_div,aspeed_fsi_divisor, ushort, 0);
-#define OPB_POLL_TIMEOUT 10000
-
static int __opb_write(struct fsi_master_aspeed *aspeed, u32 addr,
u32 val, u32 transfer_size)
{
@@ -110,7 +109,7 @@ static int __opb_write(struct fsi_master_aspeed *aspeed, u32 addr,
ret = readl_poll_timeout(base + OPB_IRQ_STATUS, reg,
(reg & OPB0_XFER_ACK_EN) != 0,
- 0, OPB_POLL_TIMEOUT);
+ 0, aspeed->timeout_us);
status = readl(base + OPB0_STATUS);
@@ -157,7 +156,7 @@ static int __opb_read(struct fsi_master_aspeed *aspeed, uint32_t addr,
ret = readl_poll_timeout(base + OPB_IRQ_STATUS, reg,
(reg & OPB0_XFER_ACK_EN) != 0,
- 0, OPB_POLL_TIMEOUT);
+ 0, aspeed->timeout_us);
status = readl(base + OPB0_STATUS);
@@ -609,6 +608,7 @@ static int fsi_master_aspeed_probe(struct platform_device *pdev)
dev_set_drvdata(&pdev->dev, aspeed);
mutex_init(&aspeed->lock);
+ aspeed->timeout_us = min(10000, max(1, aspeed_fsi_divisor / 8) * 300);
aspeed_master_init(aspeed);
rc = fsi_master_register(&aspeed->master);
--
2.27.0
next reply other threads:[~2021-02-10 20:47 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-02-10 20:46 Eddie James [this message]
2021-02-11 2:44 ` [PATCH linux dev-5.8] fsi: aspeed: Set poll timeout based on clock divider Joel Stanley
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=20210210204613.49560-1-eajames@linux.ibm.com \
--to=eajames@linux.ibm.com \
--cc=openbmc@lists.ozlabs.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 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.