2c2bc7489ef330c920fbcee99468aa36a909998a |
|
17-Oct-2014 |
Addy Ke <addy.ke@rock-chips.com> |
spi/rockchip: spi controller must be disabled in tx callback too Signed-off-by: Addy Ke <addy.ke@rock-chips.com> Signed-off-by: Mark Brown <broonie@kernel.org>
|
c28be31b11f56b3bb62490dfe5304eaa2724afc2 |
|
15-Oct-2014 |
Addy Ke <addy.ke@rock-chips.com> |
spi/rockchip: fix bug that cause spi transfer timed out in DMA duplex mode 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> Signed-off-by: Mark Brown <broonie@kernel.org>
|
f9cfd52262d36a55b39d41e2b0faae632ad57e4c |
|
15-Oct-2014 |
Addy Ke <addy.ke@rock-chips.com> |
spi/rockchip: fix bug that case spi can't go as fast as slave request 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> Signed-off-by: Mark Brown <broonie@kernel.org>
|
a24e70c0ac146f8bcae3cdb7f514950d5b32219e |
|
25-Sep-2014 |
Addy Ke <addy.ke@rock-chips.com> |
spi/rockchip: fix bug that cause the failure to read data in DMA mode In my test on RK3288-pinky board, if spi is enabled, it will begin to read data from slave regardless of whether the DMA is ready. So we need prepare DMA before spi is enable. Signed-off-by: Addy Ke <addy.ke@rock-chips.com> Signed-off-by: Mark Brown <broonie@kernel.org> Cc: stable@vger.kernel.org
|
62946172c81578477fcbb26478aebaa31353488d |
|
03-Sep-2014 |
Doug Anderson <dianders@chromium.org> |
spi/rockchip: Don't warn if SPI is busy but disabled The reference manual from Rockchip claims this about the BSF (SPI Busy Flag): * 0 - SPI is idle or disabled * 1 - SPI is actively transferring data The above doesn't quite appear to be true. Specifically I found the busy bit set when SPI was disabled. Let's change the WARN_ON() so we only check the busy bit if the controller was enabled. Signed-off-by: Doug Anderson <dianders@chromium.org> Signed-off-by: Mark Brown <broonie@kernel.org>
|
64bc0110f1ec905b1676b5ef60c1cc5b1799e1b6 |
|
03-Sep-2014 |
Doug Anderson <dianders@chromium.org> |
spi/rockchip: Fix the wait_for_idle() timeout The wait_for_idle() could get unlucky and timeout too quickly. Specifically, the old calculation was effectively: timeout = jiffies + 1; if (jiffies >= timeout) print warning; From the above it should be obvious that if jiffies ticks in just the wrong place then we'll have an effective timeout of 0. Fix this by effectively changing the above ">=" to a ">". That gives us an extra jiffy to finish. Signed-off-by: Doug Anderson <dianders@chromium.org> Signed-off-by: Mark Brown <broonie@kernel.org>
|
5d1d150d7d775db1dccb4dc4676075d456dea392 |
|
29-Aug-2014 |
Doug Anderson <dianders@chromium.org> |
spi/rockchip: Avoid accidentally turning off the clock If our client is requesting a clock that is above the maximum clock then the following division will result in 0: rs->max_freq / rs->speed We'll then program 0 into the SPI_BAUDR register. The Rockchip TRM says: "If the value is 0, the serial output clock (sclk_out) is disabled." It's much better to end up with the fastest possible clock rather than a clock that is off, so enforce a minimum value. Signed-off-by: Doug Anderson <dianders@chromium.org> Signed-off-by: Mark Brown <broonie@kernel.org>
|
0ac7a4904ae1a73ae4c2c18ff6a5dd2b7e03254c |
|
20-Aug-2014 |
Addy Ke <addy.ke@rock-chips.com> |
spi/rockchip: fixup incorrect dma direction setting Signed-off-by: Addy Ke <addy.ke@rock-chips.com> Signed-off-by: Mark Brown <broonie@linaro.org>
|
db7e8d90cae5d0840ad1444b693ec43dbfab339f |
|
20-Jul-2014 |
Wei Yongjun <yongjun_wei@trendmicro.com.cn> |
spi/rockchip: fix error return code in rockchip_spi_probe() Fix to return -EINVAL from the error handling case instead of 0 when failed to get fifo length. Signed-off-by: Wei Yongjun <yongjun_wei@trendmicro.com.cn> Signed-off-by: Mark Brown <broonie@linaro.org>
|
4e6fafee0289222105c40ddd7293da19b043122c |
|
20-Jul-2014 |
Wei Yongjun <yongjun_wei@trendmicro.com.cn> |
spi/rockchip: remove redundant dev_err call in rockchip_spi_probe() There is a error message within devm_ioremap_resource already, so remove the dev_err call to avoid redundant error message. Signed-off-by: Wei Yongjun <yongjun_wei@trendmicro.com.cn> Signed-off-by: Mark Brown <broonie@linaro.org>
|
c4950143fcc0da75b89c11365a500c0879431d81 |
|
20-Jul-2014 |
Wei Yongjun <yongjun_wei@trendmicro.com.cn> |
spi/rockchip: remove duplicated include from spi-rockchip.c Remove duplicated include. Signed-off-by: Wei Yongjun <yongjun_wei@trendmicro.com.cn> Signed-off-by: Mark Brown <broonie@linaro.org>
|
b839b785182497da67374db216b28213ee7bf1b4 |
|
11-Jul-2014 |
Addy Ke <addy.ke@rockchip.com> |
spi/rockchip: add compatible strings for RK3188 and RK3288 Suggested-by: Mark Brown <broonie@kernel.org> Signed-off-by: Addy Ke <addy.ke@rockchip.com> Signed-off-by: Mark Brown <broonie@linaro.org>
|
ee780997648814d6f1e18b05234867bbd0b43ca9 |
|
11-Jul-2014 |
Addy Ke <addy.ke@rockchip.com> |
spi/rockchip: master->mode_bits: remove SPI_CS_HIGH bit Suggested-by: Jonas Gorski <jogo@openwrt.org> Signed-off-by: Addy Ke <addy.ke@rockchip.com> Signed-off-by: Mark Brown <broonie@linaro.org>
|
2df08e7890231c44c3b57ece8b95a5797cd82388 |
|
11-Jul-2014 |
Addy Ke <addy.ke@rockchip.com> |
spi/rockchip: call wait_for_idle() for the transfer to complete Suggested-by: Mark Brown <broonie@kernel.org> Signed-off-by: Addy Ke <addy.ke@rockchip.com> Signed-off-by: Mark Brown <broonie@linaro.org>
|
5dcc44ed911cadc7eb3db46e874a447848f3b340 |
|
11-Jul-2014 |
Addy Ke <addy.ke@rockchip.com> |
spi/rockchip: cleanup some coding issues and uncessary output Suggested-by: Mark Brown <broonie@kernel.org> Signed-off-by: Addy Ke <addy.ke@rockchip.com> Signed-off-by: Mark Brown <broonie@linaro.org>
|
64e36824b32b061a9537dc2e026977806f75846f |
|
01-Jul-2014 |
addy ke <addy.ke@rock-chips.com> |
spi/rockchip: add driver for Rockchip RK3xxx SoCs integrated SPI In order to facilitate understanding, rockchip SPI controller IP design looks similar in its registers to designware. But IC implementation is different from designware, So we need a dedicated driver for Rockchip RK3XXX SoCs integrated SPI. The main differences: - dma request line: rockchip SPI controller have two DMA request line for tx and rx. - Register offset: RK3288 dw SPI_CTRLR0 0x0000 0x0000 SPI_CTRLR1 0x0004 0x0004 SPI_SSIENR 0x0008 0x0008 SPI_MWCR NONE 0x000c SPI_SER 0x000c 0x0010 SPI_BAUDR 0x0010 0x0014 SPI_TXFTLR 0x0014 0x0018 SPI_RXFTLR 0x0018 0x001c SPI_TXFLR 0x001c 0x0020 SPI_RXFLR 0x0020 0x0024 SPI_SR 0x0024 0x0028 SPI_IPR 0x0028 NONE SPI_IMR 0x002c 0x002c SPI_ISR 0x0030 0x0030 SPI_RISR 0x0034 0x0034 SPI_TXOICR NONE 0x0038 SPI_RXOICR NONE 0x003c SPI_RXUICR NONE 0x0040 SPI_MSTICR NONE 0x0044 SPI_ICR 0x0038 0x0048 SPI_DMACR 0x003c 0x004c SPI_DMATDLR 0x0040 0x0050 SPI_DMARDLR 0x0044 0x0054 SPI_TXDR 0x0400 NONE SPI_RXDR 0x0800 NONE SPI_IDR NONE 0x0058 SPI_VERSION NONE 0x005c SPI_DR NONE 0x0060 - register configuration: such as SPI_CTRLRO in rockchip SPI controller: cr0 = (CR0_BHT_8BIT << CR0_BHT_OFFSET) | (CR0_SSD_ONE << CR0_SSD_OFFSET); cr0 |= (rs->n_bytes << CR0_DFS_OFFSET); cr0 |= ((rs->mode & 0x3) << CR0_SCPH_OFFSET); cr0 |= (rs->tmode << CR0_XFM_OFFSET); cr0 |= (rs->type << CR0_FRF_OFFSET); For more information, see RK3288 chip manual. - Wait for idle: Must ensure that the FIFO data has been sent out before the next transfer. Signed-off-by: addy ke <addy.ke@rock-chips.com> Signed-off-by: Mark Brown <broonie@linaro.org>
|