linux-spi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] spi: bcm2835: Set controller max_speed_hz
@ 2021-01-07 16:48 Richard Fitzgerald
  2021-01-07 16:58 ` Mark Brown
  2021-01-13 17:54 ` Mark Brown
  0 siblings, 2 replies; 3+ messages in thread
From: Richard Fitzgerald @ 2021-01-07 16:48 UTC (permalink / raw)
  To: broonie, nsaenzjulienne, f.fainelli, rjui, sbranden
  Cc: bcm-kernel-feedback-list, linux-spi, linux-rpi-kernel,
	linux-arm-kernel, linux-kernel, patches, Richard Fitzgerald

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


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] spi: bcm2835: Set controller max_speed_hz
  2021-01-07 16:48 [PATCH] spi: bcm2835: Set controller max_speed_hz Richard Fitzgerald
@ 2021-01-07 16:58 ` Mark Brown
  2021-01-13 17:54 ` Mark Brown
  1 sibling, 0 replies; 3+ messages in thread
From: Mark Brown @ 2021-01-07 16:58 UTC (permalink / raw)
  To: Richard Fitzgerald
  Cc: nsaenzjulienne, f.fainelli, rjui, sbranden,
	bcm-kernel-feedback-list, linux-spi, linux-rpi-kernel,
	linux-arm-kernel, linux-kernel, patches

[-- Attachment #1: Type: text/plain, Size: 254 bytes --]

On Thu, Jan 07, 2021 at 04:48:25PM +0000, Richard Fitzgerald wrote:

> 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.

That was a bug and is now fixed.

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] spi: bcm2835: Set controller max_speed_hz
  2021-01-07 16:48 [PATCH] spi: bcm2835: Set controller max_speed_hz Richard Fitzgerald
  2021-01-07 16:58 ` Mark Brown
@ 2021-01-13 17:54 ` Mark Brown
  1 sibling, 0 replies; 3+ messages in thread
From: Mark Brown @ 2021-01-13 17:54 UTC (permalink / raw)
  To: sbranden, rjui, f.fainelli, nsaenzjulienne, Richard Fitzgerald
  Cc: linux-rpi-kernel, linux-spi, linux-kernel,
	bcm-kernel-feedback-list, linux-arm-kernel, patches

On Thu, 7 Jan 2021 16:48:25 +0000, Richard Fitzgerald wrote:
> 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.

Applied to

   https://git.kernel.org/pub/scm/linux/kernel/git/broonie/spi.git for-next

Thanks!

[1/1] spi: bcm2835: Set controller max_speed_hz
      commit: c6892892a95debac8050579b0709214b7b28b514

All being well this means that it will be integrated into the linux-next
tree (usually sometime in the next 24 hours) and sent to Linus during
the next merge window (or sooner if it is a bug fix), however if
problems are discovered then the patch may be dropped or reverted.

You may get further e-mails resulting from automated or manual testing
and review of the tree, please engage with people reporting problems and
send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they
should be sent as incremental updates against current git, existing
patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying
to this mail.

Thanks,
Mark

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2021-01-13 17:55 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-01-07 16:48 [PATCH] spi: bcm2835: Set controller max_speed_hz Richard Fitzgerald
2021-01-07 16:58 ` Mark Brown
2021-01-13 17:54 ` Mark Brown

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).