* [PATCH 0/2] spi: fix two bugs @ 2014-10-15 11:25 Addy Ke 2014-10-15 11:25 ` [PATCH 1/2] spi/rockchip: fix bug that case spi can't go as fast as slave request Addy Ke 2014-10-15 11:26 ` [PATCH 2/2] spi/rockchip: fix bug that cause spi transfer timed out in DMA duplex mode Addy Ke 0 siblings, 2 replies; 11+ messages in thread From: Addy Ke @ 2014-10-15 11:25 UTC (permalink / raw) To: broonie-DgEjT+Ai2ygdnm+yROfE0A, heiko-4mtYJXux2i+zQB+pC5nmwQ, dianders-F7+t8E8rja9g9hUCZPvPmw, grant.likely-QSEj5FYQhm4dnm+yROfE0A, robh+dt-DgEjT+Ai2ygdnm+yROfE0A, amstan-hpIqsD4AKlfQT0dZR+AlfA, sonnyrao-hpIqsD4AKlfQT0dZR+AlfA Cc: linux-kernel-u79uwXL29TY76Z2rM5mHXA, linux-spi-u79uwXL29TY76Z2rM5mHXA, linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r, linux-rockchip-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r, devicetree-u79uwXL29TY76Z2rM5mHXA, olof-nZhT3qVonbNeoWH0uzbU5w, hj-TNX95d0MmH7DzftRWevZcw, kever.yang-TNX95d0MmH7DzftRWevZcw, xjq-TNX95d0MmH7DzftRWevZcw, huangtao-TNX95d0MmH7DzftRWevZcw, zyw-TNX95d0MmH7DzftRWevZcw, yzq-TNX95d0MmH7DzftRWevZcw, zhenfu.fang-TNX95d0MmH7DzftRWevZcw, cf-TNX95d0MmH7DzftRWevZcw, zhangqing-TNX95d0MmH7DzftRWevZcw, hl-TNX95d0MmH7DzftRWevZcw, wei.luo-TNX95d0MmH7DzftRWevZcw, Addy Ke Patch 1: fix bug that case spi can't go as fast as slave request Patch 2: fix bug that cause spi transfer timed out in DMA duplex mode Tested on rk3288-pinky-version2 board. Addy Ke (2): spi/rockchip: fix bug that case spi can't go as fast as slave request spi/rockchip: fix bug that cause spi transfer timed out in DMA duplex mode drivers/spi/spi-rockchip.c | 46 +++++++++++++++++++++++++++++++++++----------- 1 file changed, 35 insertions(+), 11 deletions(-) -- 1.8.3.2 -- To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org More majordomo info at http://vger.kernel.org/majordomo-info.html ^ permalink raw reply [flat|nested] 11+ messages in thread
* [PATCH 1/2] spi/rockchip: fix bug that case spi can't go as fast as slave request 2014-10-15 11:25 [PATCH 0/2] spi: fix two bugs Addy Ke @ 2014-10-15 11:25 ` Addy Ke 2014-10-15 13:04 ` Mark Brown 2014-10-15 11:26 ` [PATCH 2/2] spi/rockchip: fix bug that cause spi transfer timed out in DMA duplex mode Addy Ke 1 sibling, 1 reply; 11+ messages in thread From: Addy Ke @ 2014-10-15 11:25 UTC (permalink / raw) To: broonie, heiko, dianders, grant.likely, robh+dt, amstan, sonnyrao Cc: linux-kernel, linux-spi, linux-arm-kernel, linux-rockchip, devicetree, olof, hj, kever.yang, xjq, huangtao, zyw, yzq, zhenfu.fang, cf, zhangqing, hl, wei.luo, 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 <addy.ke@rock-chips.com> --- drivers/spi/spi-rockchip.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/drivers/spi/spi-rockchip.c b/drivers/spi/spi-rockchip.c index f96ea8a..3044c6c 100644 --- a/drivers/spi/spi-rockchip.c +++ b/drivers/spi/spi-rockchip.c @@ -145,6 +145,9 @@ #define RXBUSY (1 << 0) #define TXBUSY (1 << 1) +/* sclk_out: spi master internal logic in rk3x can support 50Mhz */ +#define MAX_SCLK_OUT 50000000 + enum rockchip_ssi_type { SSI_MOTO_SPI = 0, SSI_TI_SSP, @@ -496,6 +499,15 @@ static void rockchip_spi_config(struct rockchip_spi *rs) dmacr |= RF_DMA_EN; } + 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); + rs->max_freq = clk_get_rate(rs->spiclk); + } + /* div doesn't support odd number */ div = max_t(u32, rs->max_freq / rs->speed, 1); div = (div + 1) & 0xfffe; -- 1.8.3.2 ^ permalink raw reply related [flat|nested] 11+ messages in thread
* Re: [PATCH 1/2] spi/rockchip: fix bug that case spi can't go as fast as slave request 2014-10-15 11:25 ` [PATCH 1/2] spi/rockchip: fix bug that case spi can't go as fast as slave request Addy Ke @ 2014-10-15 13:04 ` Mark Brown [not found] ` <20141015130452.GD27755-GFdadSzt00ze9xe1eoZjHA@public.gmane.org> 0 siblings, 1 reply; 11+ messages in thread From: Mark Brown @ 2014-10-15 13:04 UTC (permalink / raw) To: Addy Ke Cc: heiko, dianders, grant.likely, robh+dt, amstan, sonnyrao, linux-kernel, linux-spi, linux-arm-kernel, linux-rockchip, devicetree, olof, hj, kever.yang, xjq, huangtao, zyw, yzq, zhenfu.fang, cf, zhangqing, hl, wei.luo [-- Attachment #1: Type: text/plain, Size: 559 bytes --] 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); > + rs->max_freq = clk_get_rate(rs->spiclk); > + } I'll apply this but you should be checking the return code from clk_set_rate() here, please send a followup patch doing that. It might also be worth consdering just setting the rate unconditionally here, it seems like it should make things simpler. [-- Attachment #2: Digital signature --] [-- Type: application/pgp-signature, Size: 473 bytes --] ^ permalink raw reply [flat|nested] 11+ messages in thread
[parent not found: <20141015130452.GD27755-GFdadSzt00ze9xe1eoZjHA@public.gmane.org>]
* Re: [PATCH 1/2] spi/rockchip: fix bug that case spi can't go as fast as slave request [not found] ` <20141015130452.GD27755-GFdadSzt00ze9xe1eoZjHA@public.gmane.org> @ 2014-10-16 9:16 ` addy ke 2014-10-16 9:34 ` Mark Brown 0 siblings, 1 reply; 11+ messages in thread From: addy ke @ 2014-10-16 9:16 UTC (permalink / raw) To: broonie-DgEjT+Ai2ygdnm+yROfE0A Cc: heiko-4mtYJXux2i+zQB+pC5nmwQ, dianders-F7+t8E8rja9g9hUCZPvPmw, grant.likely-QSEj5FYQhm4dnm+yROfE0A, robh+dt-DgEjT+Ai2ygdnm+yROfE0A, amstan-hpIqsD4AKlfQT0dZR+AlfA, sonnyrao-hpIqsD4AKlfQT0dZR+AlfA, linux-kernel-u79uwXL29TY76Z2rM5mHXA, linux-spi-u79uwXL29TY76Z2rM5mHXA, linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r, linux-rockchip-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r, devicetree-u79uwXL29TY76Z2rM5mHXA, olof-nZhT3qVonbNeoWH0uzbU5w, hj-TNX95d0MmH7DzftRWevZcw, kever.yang-TNX95d0MmH7DzftRWevZcw, xjq-TNX95d0MmH7DzftRWevZcw, huangtao-TNX95d0MmH7DzftRWevZcw, zyw-TNX95d0MmH7DzftRWevZcw, yzq-TNX95d0MmH7DzftRWevZcw, zhenfu.fang-TNX95d0MmH7DzftRWevZcw, cf-TNX95d0MmH7DzftRWevZcw, zhangqing-TNX95d0MmH7DzftRWevZcw, hl-TNX95d0MmH7DzftRWevZcw, wei.luo-TNX95d0MmH7DzftRWevZcw 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) { >> + clk_set_rate(rs->spiclk, 2 * rs->speed); >> + rs->max_freq = clk_get_rate(rs->spiclk); >> + } > > I'll apply this but you should be checking the return code from > clk_set_rate() here, please send a followup patch doing that. It might If clk_set_rate return error, do I only put dev_warn here or return error value to spi core? > also be worth consdering just setting the rate unconditionally here, it > seems like it should make things simpler. > I think we need. If we set the rate unconditionally here, clk_set_rate() will be executed in each spi transfer. -- To unsubscribe from this list: send the line "unsubscribe linux-spi" in the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org More majordomo info at http://vger.kernel.org/majordomo-info.html ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH 1/2] spi/rockchip: fix bug that case spi can't go as fast as slave request 2014-10-16 9:16 ` addy ke @ 2014-10-16 9:34 ` Mark Brown 2014-10-16 9:58 ` addy ke 0 siblings, 1 reply; 11+ messages in thread From: Mark Brown @ 2014-10-16 9:34 UTC (permalink / raw) To: addy ke Cc: heiko, kever.yang, linux-kernel, xjq, zyw, linux-rockchip, grant.likely, hj, huangtao, devicetree, amstan, yzq, zhangqing, cf, robh+dt, linux-arm-kernel, hl, dianders, linux-spi, wei.luo, sonnyrao, olof, zhenfu.fang [-- Attachment #1.1: Type: text/plain, Size: 1022 bytes --] 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 (rs->max_freq < 2 * rs->speed) { > >> + clk_set_rate(rs->spiclk, 2 * rs->speed); > >> + rs->max_freq = clk_get_rate(rs->spiclk); > >> + } > > I'll apply this but you should be checking the return code from > > clk_set_rate() here, please send a followup patch doing that. It might > If clk_set_rate return error, do I only put dev_warn here or return error value to spi core? It'd be better to return an error if we need to set the rate and can't do it. > > also be worth consdering just setting the rate unconditionally here, it > > seems like it should make things simpler. > I think we need. > If we set the rate unconditionally here, clk_set_rate() will be executed in each spi transfer. Is that really such a high cost? [-- Attachment #1.2: Digital signature --] [-- Type: application/pgp-signature, Size: 473 bytes --] [-- Attachment #2: Type: text/plain, Size: 176 bytes --] _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH 1/2] spi/rockchip: fix bug that case spi can't go as fast as slave request 2014-10-16 9:34 ` Mark Brown @ 2014-10-16 9:58 ` addy ke 2014-10-16 10:26 ` Mark Brown 0 siblings, 1 reply; 11+ messages in thread From: addy ke @ 2014-10-16 9:58 UTC (permalink / raw) To: broonie Cc: heiko, dianders, grant.likely, robh+dt, amstan, sonnyrao, linux-kernel, linux-spi, linux-arm-kernel, linux-rockchip, devicetree, olof, hj, kever.yang, xjq, huangtao, zyw, yzq, zhenfu.fang, cf, zhangqing, hl, wei.luo 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; > >>>> + /* the minimum divsor is 2 */ >>>> + if (rs->max_freq < 2 * rs->speed) { >>>> + clk_set_rate(rs->spiclk, 2 * rs->speed); >>>> + rs->max_freq = clk_get_rate(rs->spiclk); >>>> + } > >>> I'll apply this but you should be checking the return code from >>> clk_set_rate() here, please send a followup patch doing that. It might > >> If clk_set_rate return error, do I only put dev_warn here or return error value to spi core? > > It'd be better to return an error if we need to set the rate and can't > do it. > >>> also be worth consdering just setting the rate unconditionally here, it >>> seems like it should make things simpler. > >> I think we need. >> If we set the rate unconditionally here, clk_set_rate() will be executed in each spi transfer. > > Is that really such a high cost? > Not high cost, but I think if the default spi_clk is enough, we do not need to set spi_clk again. Maybe we can only set spi_clk as (2 * MAX_SCLK_OUT) in probe(). ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH 1/2] spi/rockchip: fix bug that case spi can't go as fast as slave request 2014-10-16 9:58 ` addy ke @ 2014-10-16 10:26 ` Mark Brown 0 siblings, 0 replies; 11+ messages in thread From: Mark Brown @ 2014-10-16 10:26 UTC (permalink / raw) To: addy ke Cc: heiko, dianders, grant.likely, robh+dt, amstan, sonnyrao, linux-kernel, linux-spi, linux-arm-kernel, linux-rockchip, devicetree, olof, hj, kever.yang, xjq, huangtao, zyw, yzq, zhenfu.fang, cf, zhangqing, hl, wei.luo [-- Attachment #1: Type: text/plain, Size: 539 bytes --] 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? > Not high cost, but I think if the default spi_clk is enough, we do not need to set spi_clk again. > Maybe we can only set spi_clk as (2 * MAX_SCLK_OUT) in probe(). It's not too bad to do it where it is, it just seems better to be simpler. [-- Attachment #2: Digital signature --] [-- Type: application/pgp-signature, Size: 473 bytes --] ^ permalink raw reply [flat|nested] 11+ messages in thread
* [PATCH 2/2] spi/rockchip: fix bug that cause spi transfer timed out in DMA duplex mode 2014-10-15 11:25 [PATCH 0/2] spi: fix two bugs Addy Ke 2014-10-15 11:25 ` [PATCH 1/2] spi/rockchip: fix bug that case spi can't go as fast as slave request Addy Ke @ 2014-10-15 11:26 ` Addy Ke [not found] ` <1413372378-4309-1-git-send-email-addy.ke-TNX95d0MmH7DzftRWevZcw@public.gmane.org> 1 sibling, 1 reply; 11+ messages in thread From: Addy Ke @ 2014-10-15 11:26 UTC (permalink / raw) To: broonie, heiko, dianders, grant.likely, robh+dt, amstan, sonnyrao Cc: linux-kernel, linux-spi, linux-arm-kernel, linux-rockchip, devicetree, olof, hj, kever.yang, xjq, huangtao, zyw, yzq, zhenfu.fang, cf, zhangqing, hl, wei.luo, Addy Ke In rx mode, dma must be prepared before spi is enabled. But in tx and tr mode, spi must be enabled first. Signed-off-by: Addy Ke <addy.ke@rock-chips.com> --- drivers/spi/spi-rockchip.c | 34 +++++++++++++++++++++++----------- 1 file changed, 23 insertions(+), 11 deletions(-) diff --git a/drivers/spi/spi-rockchip.c b/drivers/spi/spi-rockchip.c index 3044c6c..153269b 100644 --- a/drivers/spi/spi-rockchip.c +++ b/drivers/spi/spi-rockchip.c @@ -328,6 +328,8 @@ static int rockchip_spi_unprepare_message(struct spi_master *master, spin_unlock_irqrestore(&rs->lock, flags); + spi_enable_chip(rs, 0); + return 0; } @@ -384,6 +386,8 @@ static int rockchip_spi_pio_transfer(struct rockchip_spi *rs) if (rs->tx) wait_for_idle(rs); + spi_enable_chip(rs, 0); + return 0; } @@ -395,8 +399,10 @@ static void rockchip_spi_dma_rxcb(void *data) spin_lock_irqsave(&rs->lock, flags); rs->state &= ~RXBUSY; - if (!(rs->state & TXBUSY)) + if (!(rs->state & TXBUSY)) { + spi_enable_chip(rs, 0); spi_finalize_current_transfer(rs->master); + } spin_unlock_irqrestore(&rs->lock, flags); } @@ -512,8 +518,6 @@ static void rockchip_spi_config(struct rockchip_spi *rs) div = max_t(u32, rs->max_freq / rs->speed, 1); div = (div + 1) & 0xfffe; - spi_enable_chip(rs, 0); - writel_relaxed(cr0, rs->regs + ROCKCHIP_SPI_CTRLR0); writel_relaxed(rs->len - 1, rs->regs + ROCKCHIP_SPI_CTRLR1); @@ -527,8 +531,6 @@ static void rockchip_spi_config(struct rockchip_spi *rs) spi_set_clk(rs, div); dev_dbg(rs->dev, "cr0 0x%x, div %d\n", cr0, div); - - spi_enable_chip(rs, 1); } static int rockchip_spi_transfer_one( @@ -536,7 +538,7 @@ static int rockchip_spi_transfer_one( struct spi_device *spi, struct spi_transfer *xfer) { - int ret = 0; + int ret = 1; struct rockchip_spi *rs = spi_master_get_devdata(master); WARN_ON(readl_relaxed(rs->regs + ROCKCHIP_SPI_SSIENR) && @@ -568,17 +570,27 @@ static int rockchip_spi_transfer_one( rs->tmode = CR0_XFM_RO; /* we need prepare dma before spi was enabled */ - if (master->can_dma && master->can_dma(master, spi, xfer)) { + if (master->can_dma && master->can_dma(master, spi, xfer)) rs->use_dma = 1; - rockchip_spi_prepare_dma(rs); - } else { + else rs->use_dma = 0; - } rockchip_spi_config(rs); - if (!rs->use_dma) + if (rs->use_dma) { + if (rs->tmode == CR0_XFM_RO) { + /* rx: dma must be prepared first */ + rockchip_spi_prepare_dma(rs); + spi_enable_chip(rs, 1); + } else { + /* tx or tr: spi must be enabled first */ + spi_enable_chip(rs, 1); + rockchip_spi_prepare_dma(rs); + } + } else { + spi_enable_chip(rs, 1); ret = rockchip_spi_pio_transfer(rs); + } return ret; } -- 1.8.3.2 ^ permalink raw reply related [flat|nested] 11+ messages in thread
[parent not found: <1413372378-4309-1-git-send-email-addy.ke-TNX95d0MmH7DzftRWevZcw@public.gmane.org>]
* Re: [PATCH 2/2] spi/rockchip: fix bug that cause spi transfer timed out in DMA duplex mode [not found] ` <1413372378-4309-1-git-send-email-addy.ke-TNX95d0MmH7DzftRWevZcw@public.gmane.org> @ 2014-10-15 13:05 ` Mark Brown [not found] ` <20141015130547.GE27755-GFdadSzt00ze9xe1eoZjHA@public.gmane.org> 0 siblings, 1 reply; 11+ messages in thread From: Mark Brown @ 2014-10-15 13:05 UTC (permalink / raw) To: Addy Ke Cc: heiko-4mtYJXux2i+zQB+pC5nmwQ, dianders-F7+t8E8rja9g9hUCZPvPmw, grant.likely-QSEj5FYQhm4dnm+yROfE0A, robh+dt-DgEjT+Ai2ygdnm+yROfE0A, amstan-hpIqsD4AKlfQT0dZR+AlfA, sonnyrao-hpIqsD4AKlfQT0dZR+AlfA, linux-kernel-u79uwXL29TY76Z2rM5mHXA, linux-spi-u79uwXL29TY76Z2rM5mHXA, linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r, linux-rockchip-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r, devicetree-u79uwXL29TY76Z2rM5mHXA, olof-nZhT3qVonbNeoWH0uzbU5w, hj-TNX95d0MmH7DzftRWevZcw, kever.yang-TNX95d0MmH7DzftRWevZcw, xjq-TNX95d0MmH7DzftRWevZcw, huangtao-TNX95d0MmH7DzftRWevZcw, zyw-TNX95d0MmH7DzftRWevZcw, yzq-TNX95d0MmH7DzftRWevZcw, zhenfu.fang-TNX95d0MmH7DzftRWevZcw, cf-TNX95d0MmH7DzftRWevZcw, zhangqing-TNX95d0MmH7DzftRWevZcw, hl-TNX95d0MmH7DzftRWevZcw, wei.luo-TNX95d0MmH7DzftRWevZcw [-- Attachment #1: Type: text/plain, Size: 185 bytes --] On Wed, Oct 15, 2014 at 07:26:18PM +0800, Addy Ke wrote: > In rx mode, dma must be prepared before spi is enabled. > But in tx and tr mode, spi must be enabled first. Applied, thanks. [-- Attachment #2: Digital signature --] [-- Type: application/pgp-signature, Size: 473 bytes --] ^ permalink raw reply [flat|nested] 11+ messages in thread
[parent not found: <20141015130547.GE27755-GFdadSzt00ze9xe1eoZjHA@public.gmane.org>]
* Re: [PATCH 2/2] spi/rockchip: fix bug that cause spi transfer timed out in DMA duplex mode [not found] ` <20141015130547.GE27755-GFdadSzt00ze9xe1eoZjHA@public.gmane.org> @ 2014-10-16 9:26 ` addy ke 2014-10-16 9:34 ` Mark Brown 0 siblings, 1 reply; 11+ messages in thread From: addy ke @ 2014-10-16 9:26 UTC (permalink / raw) To: broonie-DgEjT+Ai2ygdnm+yROfE0A Cc: heiko-4mtYJXux2i+zQB+pC5nmwQ, dianders-F7+t8E8rja9g9hUCZPvPmw, grant.likely-QSEj5FYQhm4dnm+yROfE0A, robh+dt-DgEjT+Ai2ygdnm+yROfE0A, amstan-hpIqsD4AKlfQT0dZR+AlfA, sonnyrao-hpIqsD4AKlfQT0dZR+AlfA, linux-kernel-u79uwXL29TY76Z2rM5mHXA, linux-spi-u79uwXL29TY76Z2rM5mHXA, linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r, linux-rockchip-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r, devicetree-u79uwXL29TY76Z2rM5mHXA, olof-nZhT3qVonbNeoWH0uzbU5w, hj-TNX95d0MmH7DzftRWevZcw, kever.yang-TNX95d0MmH7DzftRWevZcw, xjq-TNX95d0MmH7DzftRWevZcw, huangtao-TNX95d0MmH7DzftRWevZcw, zyw-TNX95d0MmH7DzftRWevZcw, yzq-TNX95d0MmH7DzftRWevZcw, zhenfu.fang-TNX95d0MmH7DzftRWevZcw, cf-TNX95d0MmH7DzftRWevZcw, zhangqing-TNX95d0MmH7DzftRWevZcw, hl-TNX95d0MmH7DzftRWevZcw, wei.luo-TNX95d0MmH7DzftRWevZcw Hi, Mark The following changes is nessarry:(if tx complete, spi must be disabled too) diff --git a/drivers/spi/spi-rockchip.c b/drivers/spi/spi-rockchip.c index 153269b..87bc16f 100644 --- a/drivers/spi/spi-rockchip.c +++ b/drivers/spi/spi-rockchip.c @@ -418,8 +418,10 @@ static void rockchip_spi_dma_txcb(void *data) spin_lock_irqsave(&rs->lock, flags); rs->state &= ~TXBUSY; - if (!(rs->state & RXBUSY)) + if (!(rs->state & RXBUSY)) { + spi_enable_chip(rs, 0); spi_finalize_current_transfer(rs->master); + } spin_unlock_irqrestore(&rs->lock, flags); } Sorry for my mistake, I have not put these changes to this patch. Do I need send patch v2 or a new patch to fix this issure? On 2014/10/15 21:05, Mark Brown wrote: > On Wed, Oct 15, 2014 at 07:26:18PM +0800, Addy Ke wrote: >> In rx mode, dma must be prepared before spi is enabled. >> But in tx and tr mode, spi must be enabled first. > > Applied, thanks. > -- To unsubscribe from this list: send the line "unsubscribe linux-spi" in the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org More majordomo info at http://vger.kernel.org/majordomo-info.html ^ permalink raw reply related [flat|nested] 11+ messages in thread
* Re: [PATCH 2/2] spi/rockchip: fix bug that cause spi transfer timed out in DMA duplex mode 2014-10-16 9:26 ` addy ke @ 2014-10-16 9:34 ` Mark Brown 0 siblings, 0 replies; 11+ messages in thread From: Mark Brown @ 2014-10-16 9:34 UTC (permalink / raw) To: addy ke Cc: heiko, kever.yang, linux-kernel, xjq, zyw, linux-rockchip, grant.likely, hj, huangtao, devicetree, amstan, yzq, zhangqing, cf, robh+dt, linux-arm-kernel, hl, dianders, linux-spi, wei.luo, sonnyrao, olof, zhenfu.fang [-- Attachment #1.1: Type: text/plain, Size: 295 bytes --] On Thu, Oct 16, 2014 at 05:26:02PM +0800, addy ke wrote: > The following changes is nessarry:(if tx complete, spi must be disabled too) > diff --git a/drivers/spi/spi-rockchip.c b/drivers/spi/spi-rockchip.c > index 153269b..87bc16f 100644 Please send this using the normal submission process. [-- Attachment #1.2: Digital signature --] [-- Type: application/pgp-signature, Size: 473 bytes --] [-- Attachment #2: Type: text/plain, Size: 176 bytes --] _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel ^ permalink raw reply [flat|nested] 11+ messages in thread
end of thread, other threads:[~2014-10-16 10:26 UTC | newest] Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2014-10-15 11:25 [PATCH 0/2] spi: fix two bugs Addy Ke 2014-10-15 11:25 ` [PATCH 1/2] spi/rockchip: fix bug that case spi can't go as fast as slave request Addy Ke 2014-10-15 13:04 ` Mark Brown [not found] ` <20141015130452.GD27755-GFdadSzt00ze9xe1eoZjHA@public.gmane.org> 2014-10-16 9:16 ` addy ke 2014-10-16 9:34 ` Mark Brown 2014-10-16 9:58 ` addy ke 2014-10-16 10:26 ` Mark Brown 2014-10-15 11:26 ` [PATCH 2/2] spi/rockchip: fix bug that cause spi transfer timed out in DMA duplex mode Addy Ke [not found] ` <1413372378-4309-1-git-send-email-addy.ke-TNX95d0MmH7DzftRWevZcw@public.gmane.org> 2014-10-15 13:05 ` Mark Brown [not found] ` <20141015130547.GE27755-GFdadSzt00ze9xe1eoZjHA@public.gmane.org> 2014-10-16 9:26 ` addy ke 2014-10-16 9:34 ` 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).