From: Richard Fitzgerald <rf@opensource.cirrus.com>
To: <broonie@kernel.org>, <nsaenzjulienne@suse.de>,
<f.fainelli@gmail.com>, <rjui@broadcom.com>,
<sbranden@broadcom.com>
Cc: <bcm-kernel-feedback-list@broadcom.com>,
<linux-spi@vger.kernel.org>,
<linux-rpi-kernel@lists.infradead.org>,
<linux-arm-kernel@lists.infradead.org>,
<linux-kernel@vger.kernel.org>, <patches@opensource.cirrus.com>,
Richard Fitzgerald <rf@opensource.cirrus.com>
Subject: [PATCH] spi: bcm2835: Set controller max_speed_hz
Date: Thu, 7 Jan 2021 16:48:25 +0000 [thread overview]
Message-ID: <20210107164825.21919-1-rf@opensource.cirrus.com> (raw)
Set the struct spi_controller max_speed_hz. This is based on the
reported source clock frequency during probe. The maximum bus clock
is half the source clock (as per the code in bcm2835_spi_transfer_one).
If the controller max_speed_hz is not set, the spi core will limit all
transfers to 0 Hz so only the minimum possible bus frequency would be used.
Signed-off-by: Richard Fitzgerald <rf@opensource.cirrus.com>
---
drivers/spi/spi-bcm2835.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/drivers/spi/spi-bcm2835.c b/drivers/spi/spi-bcm2835.c
index 197485f2c2b2..8e161f4f7766 100644
--- a/drivers/spi/spi-bcm2835.c
+++ b/drivers/spi/spi-bcm2835.c
@@ -1307,6 +1307,8 @@ static int bcm2835_spi_probe(struct platform_device *pdev)
return dev_err_probe(&pdev->dev, PTR_ERR(bs->clk),
"could not get clk\n");
+ ctlr->max_speed_hz = clk_get_rate(bs->clk) / 2;
+
bs->irq = platform_get_irq(pdev, 0);
if (bs->irq <= 0)
return bs->irq ? bs->irq : -ENODEV;
--
2.20.1
next reply other threads:[~2021-01-07 16:49 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-01-07 16:48 Richard Fitzgerald [this message]
2021-01-07 16:58 ` Mark Brown
2021-01-13 17:54 ` Mark Brown
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=20210107164825.21919-1-rf@opensource.cirrus.com \
--to=rf@opensource.cirrus.com \
--cc=bcm-kernel-feedback-list@broadcom.com \
--cc=broonie@kernel.org \
--cc=f.fainelli@gmail.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-rpi-kernel@lists.infradead.org \
--cc=linux-spi@vger.kernel.org \
--cc=nsaenzjulienne@suse.de \
--cc=patches@opensource.cirrus.com \
--cc=rjui@broadcom.com \
--cc=sbranden@broadcom.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®