Re: [PATCH 1/2] spi/rockchip: fix bug that case spi can't go as fast as slave request

2014-10-16 Thread Mark Brown
On Thu, Oct 16, 2014 at 05:58:51PM +0800, addy ke wrote: Please fix your mailer to word wrap within paragraphs. > On 2014/10/16 17:34, Mark Brown wrote: > >> If we set the rate unconditionally here, clk_set_rate() will be executed > >> in each spi transfer. > > Is that really such a high cost?

Re: [PATCH 1/2] spi/rockchip: fix bug that case spi can't go as fast as slave request

2014-10-16 Thread Mark Brown
On Thu, Oct 16, 2014 at 05:16:02PM +0800, addy ke wrote: > On 2014/10/15 21:04, Mark Brown wrote: > > On Wed, Oct 15, 2014 at 07:25:49PM +0800, Addy Ke wrote: > >> + if (WARN_ON(rs->speed > MAX_SCLK_OUT)) > >> + rs->speed = MAX_SCLK_OUT; > >> + /* the minimum divsor is 2 */ > >> + if

Re: [PATCH 1/2] spi/rockchip: fix bug that case spi can't go as fast as slave request

2014-10-16 Thread addy ke
On 2014/10/16 17:34, Mark Brown wrote: > On Thu, Oct 16, 2014 at 05:16:02PM +0800, addy ke wrote: >> On 2014/10/15 21:04, Mark Brown wrote: >>> On Wed, Oct 15, 2014 at 07:25:49PM +0800, Addy Ke wrote: > + if (WARN_ON(rs->speed > MAX_SCLK_OUT)) + rs->speed = MAX_SCLK_OUT; > >

Re: [PATCH 1/2] spi/rockchip: fix bug that case spi can't go as fast as slave request

2014-10-16 Thread addy ke
hi, Mark On 2014/10/15 21:04, Mark Brown wrote: > On Wed, Oct 15, 2014 at 07:25:49PM +0800, Addy Ke wrote: > >> +if (WARN_ON(rs->speed > MAX_SCLK_OUT)) >> +rs->speed = MAX_SCLK_OUT; >> + >> +/* the minimum divsor is 2 */ >> +if (rs->max_freq < 2 * rs->speed) { >> +

Re: [PATCH 1/2] spi/rockchip: fix bug that case spi can't go as fast as slave request

2014-10-15 Thread Mark Brown
On Wed, Oct 15, 2014 at 07:25:49PM +0800, Addy Ke wrote: > + if (WARN_ON(rs->speed > MAX_SCLK_OUT)) > + rs->speed = MAX_SCLK_OUT; > + > + /* the minimum divsor is 2 */ > + if (rs->max_freq < 2 * rs->speed) { > + clk_set_rate(rs->spiclk, 2 * rs->speed); > +

[PATCH 1/2] spi/rockchip: fix bug that case spi can't go as fast as slave request

2014-10-15 Thread Addy Ke
Because the minimum divisor in rk3x's spi controller is 2, if spi_clk is less than 2 * sclk_out, we can't get the right divisor. So we must set spi_clk again to match slave request. Signed-off-by: Addy Ke --- drivers/spi/spi-rockchip.c | 12 1 file changed, 12 insertions(+) diff --