linux-spi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Geert Uytterhoeven <geert+renesas@glider.be>
To: linux-renesas-soc@vger.kernel.org
Cc: linux-spi@vger.kernel.org, linux-clk@vger.kernel.org,
	Geert Uytterhoeven <geert+renesas@glider.be>
Subject: [PATCH/PROTO 2/9 common] spi: sh-msiof: Print max and transfer frequency
Date: Fri, 12 Aug 2016 18:38:38 +0200	[thread overview]
Message-ID: <1471019925-29083-3-git-send-email-geert+renesas@glider.be> (raw)
In-Reply-To: <1471019925-29083-1-git-send-email-geert+renesas@glider.be>

Not-Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
---
Not intended for upstream merge.
---
 drivers/spi/spi-sh-msiof.c | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)

diff --git a/drivers/spi/spi-sh-msiof.c b/drivers/spi/spi-sh-msiof.c
index ffa5efdf266a8276..72f80a088cddd395 100644
--- a/drivers/spi/spi-sh-msiof.c
+++ b/drivers/spi/spi-sh-msiof.c
@@ -272,6 +272,13 @@ static void sh_msiof_spi_set_clk_regs(struct sh_msiof_spi_priv *p,
 	k = min_t(int, k, ARRAY_SIZE(sh_msiof_spi_div_table) - 1);
 
 	scr = sh_msiof_spi_div_table[k].brdv | SCR_BRPS(brps);
+	dev_info(&p->pdev->dev, "clk at %lu Hz, brps = %u, brdv = %u%s\n",
+		 parent_rate, brps, sh_msiof_spi_div_table[k].div,
+		 ((sh_msiof_spi_div_table[k].div == 1 && brps > 2) ||
+		  (brps > 32)) ? " INVALID!" : "");
+	dev_info(&p->pdev->dev, "wanted: %u Hz, actual: %lu Hz\n", spi_hz,
+		 parent_rate / sh_msiof_spi_div_table[k].div / brps);
+
 	sh_msiof_write(p, TSCR, scr);
 	if (!(p->master->flags & SPI_MASTER_MUST_TX))
 		sh_msiof_write(p, RSCR, scr);
@@ -523,6 +530,16 @@ static int sh_msiof_spi_setup(struct spi_device *spi)
 {
 	struct device_node	*np = spi->master->dev.of_node;
 	struct sh_msiof_spi_priv *p = spi_master_get_devdata(spi->master);
+	u32 max_speed_hz, min_speed_hz;
+	unsigned long rate;
+
+	rate = clk_get_rate(p->clk);
+	max_speed_hz = rate;
+	min_speed_hz = rate / 1024;
+
+	dev_info(&p->pdev->dev,
+		 "%s: master speed min %u max %u, device speed max = %u\n",
+		 __func__, min_speed_hz, max_speed_hz, spi->max_speed_hz);
 
 	pm_runtime_get_sync(&p->pdev->dev);
 
-- 
1.9.1

  parent reply	other threads:[~2016-08-12 16:38 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-08-12 16:38 [PATCH/PROTO 0/9] R-Car H3 MSIOF Parent Clock Control Prototype Geert Uytterhoeven
2016-08-12 16:38 ` [PATCH/PROTO 1/9 common] spi: sh-msiof: Add support for R-Car H3 Geert Uytterhoeven
2016-08-12 16:38 ` Geert Uytterhoeven [this message]
2016-08-12 16:38 ` [PATCH/PROTO 3/9 common] arm64: dts: r8a7795: Add all MSIOF nodes Geert Uytterhoeven
2016-08-12 16:38 ` [PATCH/PROTO 5/9 option 1] arm64: dts: salvator-x: Configure MSIOF parent clock Geert Uytterhoeven
2016-08-12 16:38 ` [PATCH/PROTO 6/9 option 2/3] spi: sh-msiof: Add clock notifier to enforce valid " Geert Uytterhoeven
     [not found] ` <1471019925-29083-1-git-send-email-geert+renesas-gXvu3+zWzMSzQB+pC5nmwQ@public.gmane.org>
2016-08-12 16:38   ` [PATCH/PROTO 4/9 common] arm64: dts: salvator-x: Add dummy MSIOF SPI slave devices Geert Uytterhoeven
2016-08-12 16:38   ` [PATCH/PROTO 7/9 option 2] spi: sh-msiof: Configure MSIOF parent clock Geert Uytterhoeven
2016-08-12 16:38   ` [PATCH/PROTO 9/9 option 3] " Geert Uytterhoeven
2016-08-12 16:38 ` [PATCH/PROTO 8/9 option 3] clk: divider: Add hack to support dummy clocks Geert Uytterhoeven
2016-08-25  5:34 ` [PATCH/PROTO 0/9] R-Car H3 MSIOF Parent Clock Control Prototype Magnus Damm
2016-08-29 12:38   ` Geert Uytterhoeven

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=1471019925-29083-3-git-send-email-geert+renesas@glider.be \
    --to=geert+renesas@glider.be \
    --cc=linux-clk@vger.kernel.org \
    --cc=linux-renesas-soc@vger.kernel.org \
    --cc=linux-spi@vger.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;
as well as URLs for NNTP newsgroup(s).