diff mbox

[07/11] spi: spi-sh-msiof: RSCR register may absent

Message ID 1385921962-19843-7-git-send-email-takasi-y@ops.dti.ne.jp (mailing list archive)
State Changes Requested
Headers show

Commit Message

takasi-y@ops.dti.ne.jp Dec. 1, 2013, 6:19 p.m. UTC
From: Takashi Yoshii <takasi-y@ops.dti.ne.jp>

On Ape6, Rcar-H2, and Rcar-M2,
MSIOF lacks RSCR(Receive Clock Select Register).
I guess this is a part of .rx_need_dummy_tx case, and use same flag.

Signed-off-by: Takashi Yoshii <takasi-y@ops.dti.ne.jp>
---
 drivers/spi/spi-sh-msiof.c |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

Comments

Geert Uytterhoeven Feb. 12, 2014, 4:06 p.m. UTC | #1
Hi Yoshii-san,

On Sun, Dec 1, 2013 at 7:19 PM,  <takasi-y@ops.dti.ne.jp> wrote:
> On Ape6, Rcar-H2, and Rcar-M2,
> MSIOF lacks RSCR(Receive Clock Select Register).
> I guess this is a part of .rx_need_dummy_tx case, and use same flag.

Are you sure? I'm under the impression MSIOF on APE6 does have RSCR,
just like on A1, and SH (e.g. 7724).

Given also that:
  - dummy TX is needed during reception for  APE6, R-Car H2/M2, and
     (perhaps --- this is not 100% clear to me) A1,
  - RMDR1[15:0] must be zero on APE6, and R-Car H2/M2.

there are (at least) 4 different variants of MSIOF:
  - SH
  - A1
  - APE6
  - R-Car H2 and M2

And I don't know about SH7372 and SH73A0...

But we indeed may not need to distinguish between all variants.
You just use the value of rx_need_dummy_tx as test condition.
If this works for APE6 and A1, we can add a new platform device name
"spi_sh_mobile_msiof" instead of adding the rx_need_dummy_tx flag
to platform data (struct sh_msiof_spi_info).
This would be in line with the currently defined (but so far unused) DT
compatible values "renesas,sh-msiof" and "renesas,sh-mobile-msiof".

What do you think?

Thanks!

Gr{oetje,eeting}s,

                        Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds
--
To unsubscribe from this list: send the line "unsubscribe linux-sh" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Simon Horman Feb. 12, 2014, 11:50 p.m. UTC | #2
On Wed, Feb 12, 2014 at 05:06:41PM +0100, Geert Uytterhoeven wrote:
> Hi Yoshii-san,
> 
> On Sun, Dec 1, 2013 at 7:19 PM,  <takasi-y@ops.dti.ne.jp> wrote:
> > On Ape6, Rcar-H2, and Rcar-M2,
> > MSIOF lacks RSCR(Receive Clock Select Register).
> > I guess this is a part of .rx_need_dummy_tx case, and use same flag.
> 
> Are you sure? I'm under the impression MSIOF on APE6 does have RSCR,
> just like on A1, and SH (e.g. 7724).

FWIW, the version of the APE6 documentation that I have access to
indicates that it does have RSCR.

> Given also that:
>   - dummy TX is needed during reception for  APE6, R-Car H2/M2, and
>      (perhaps --- this is not 100% clear to me) A1,
>   - RMDR1[15:0] must be zero on APE6, and R-Car H2/M2.
> 
> there are (at least) 4 different variants of MSIOF:
>   - SH
>   - A1
>   - APE6
>   - R-Car H2 and M2
> 
> And I don't know about SH7372 and SH73A0...
> 
> But we indeed may not need to distinguish between all variants.
> You just use the value of rx_need_dummy_tx as test condition.
> If this works for APE6 and A1, we can add a new platform device name
> "spi_sh_mobile_msiof" instead of adding the rx_need_dummy_tx flag
> to platform data (struct sh_msiof_spi_info).
> This would be in line with the currently defined (but so far unused) DT
> compatible values "renesas,sh-msiof" and "renesas,sh-mobile-msiof".
> 
> What do you think?
> 
> Thanks!
> 
> Gr{oetje,eeting}s,
> 
>                         Geert
> 
> --
> Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org
> 
> In personal conversations with technical people, I call myself a hacker. But
> when I'm talking to journalists I just say "programmer" or something like that.
>                                 -- Linus Torvalds
> 
--
To unsubscribe from this list: send the line "unsubscribe linux-sh" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/drivers/spi/spi-sh-msiof.c b/drivers/spi/spi-sh-msiof.c
index b0334b6..bbd989f 100644
--- a/drivers/spi/spi-sh-msiof.c
+++ b/drivers/spi/spi-sh-msiof.c
@@ -164,7 +164,8 @@  static void sh_msiof_spi_set_clk_regs(struct sh_msiof_spi_priv *p,
 	k = min_t(int, k, ARRAY_SIZE(sh_msiof_spi_clk_table) - 1);
 
 	sh_msiof_write(p, TSCR, sh_msiof_spi_clk_table[k].scr);
-	sh_msiof_write(p, RSCR, sh_msiof_spi_clk_table[k].scr);
+	if (!p->info->rx_need_dummy_tx)
+		sh_msiof_write(p, RSCR, sh_msiof_spi_clk_table[k].scr);
 }
 
 static void sh_msiof_spi_set_pin_regs(struct sh_msiof_spi_priv *p,