001-4.12-04-spi-bcm63xx-hsspi-allow-providing-clock-rate-through.patch 1015 B

1234567891011121314151617181920212223242526272829303132333435
  1. From d03f23df6ff47898d76f06b3aa5dadcfa1ec8f4f Mon Sep 17 00:00:00 2001
  2. From: Jonas Gorski <[email protected]>
  3. Date: Sun, 19 Feb 2017 23:40:22 +0100
  4. Subject: [PATCH 1/3] spi/bcm63xx-hsspi: allow providing clock rate through a
  5. second clock
  6. Instead of requiring the hsspi clock to have a rate, allow using a second
  7. clock for providing the Hz rate, which is probably more correct anyway.
  8. Signed-off-by: Jonas Gorski <[email protected]>
  9. ---
  10. drivers/spi/spi-bcm63xx-hsspi.c | 12 ++++++++++--
  11. 1 file changed, 10 insertions(+), 2 deletions(-)
  12. --- a/drivers/spi/spi-bcm63xx-hsspi.c
  13. +++ b/drivers/spi/spi-bcm63xx-hsspi.c
  14. @@ -351,8 +351,16 @@ static int bcm63xx_hsspi_probe(struct pl
  15. return PTR_ERR(clk);
  16. rate = clk_get_rate(clk);
  17. - if (!rate)
  18. - return -EINVAL;
  19. + if (!rate) {
  20. + struct clk *pll_clk = devm_clk_get(dev, "pll");
  21. +
  22. + if (IS_ERR(pll_clk))
  23. + return PTR_ERR(pll_clk);
  24. +
  25. + rate = clk_get_rate(pll_clk);
  26. + if (!rate)
  27. + return -EINVAL;
  28. + }
  29. ret = clk_prepare_enable(clk);
  30. if (ret)