#
07d67493 |
|
26-Jan-2024 |
Luis de Arquer <luis.dearquer@inertim.com> |
spi: spi-rockchip: Fix max_native_cs Signed-off-by: Luis de Arquer <luis.dearquer@inertim.com> Link: https://lore.kernel.org/r/4d18808e85b85077761c5655083f20ebfd7d3770.camel@gmail.com Signed-off-by: Mark Brown <broonie@kernel.org>
|
#
5c018e37 |
|
26-Jan-2024 |
Luis de Arquer <luis.dearquer@inertim.com> |
spi: spi-rockchip: Fix out of bounds array access Since spi-rockchip enables use_gpio_descriptors and the SPI_CONTROLLER_GPIO_SS flag, the spi subsytem may call set_cs() for spi devices with indexes above ROCKCHIP_SPI_MAX_CS_NUM Remove array cs_asserted[] which held a shadow copy of the state of the chip select lines with the only purpose of optimizing out rewriting a chip select line to the current state (no-op) This case is already handled by spi.c Signed-off-by: Luis de Arquer <luis.dearquer@inertim.com> Link: https://lore.kernel.org/r/d0a0c4b94f933f7f43973c34765214303ee82b77.camel@gmail.com Signed-off-by: Mark Brown <broonie@kernel.org>
|
#
d6c612a3 |
|
23-Aug-2023 |
Li Zetao <lizetao1@huawei.com> |
spi: rockchip: Use helper function devm_clk_get_enabled() Since commit 7ef9651e9792 ("clk: Provide new devm_clk helpers for prepared and enabled clocks"), devm_clk_get() and clk_prepare_enable() can now be replaced by devm_clk_get_enabled() when driver enables (and possibly prepares) the clocks for the whole lifetime of the device. Moreover, it is no longer necessary to unprepare and disable the clocks explicitly. Reviewed-by: Jonathan Cameron <Jonathan.Cameron@huawei.com> Signed-off-by: Li Zetao <lizetao1@huawei.com> Link: https://lore.kernel.org/r/20230823133938.1359106-26-lizetao1@huawei.com Signed-off-by: Mark Brown <broonie@kernel.org>
|
#
1a3ccff3 |
|
18-Aug-2023 |
Yang Yingliang <yangyingliang@huawei.com> |
spi: rockchip: switch to use modern name Change legacy name master/slave to modern name host/target or controller. No functional changed. Signed-off-by: Yang Yingliang <yangyingliang@huawei.com> Acked-by: Heiko Stuebner <heiko@sntech.e> Link: https://lore.kernel.org/r/20230818093154.1183529-14-yangyingliang@huawei.com Signed-off-by: Mark Brown <broonie@kernel.org>
|
#
82238d2c |
|
10-Jul-2023 |
Andy Shevchenko <andriy.shevchenko@linux.intel.com> |
spi: Rename SPI_MASTER_GPIO_SS to SPI_CONTROLLER_GPIO_SS Rename SPI_MASTER_GPIO_SS to SPI_CONTROLLER_GPIO_SS and convert the users to SPI_CONTROLLER_GPIO_SS to follow the new naming shema. Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Link: https://lore.kernel.org/r/20230710154932.68377-14-andriy.shevchenko@linux.intel.com Reviewed-by: Serge Semin <fancer.lancer@gmail.com> Signed-off-by: Mark Brown <broonie@kernel.org>
|
#
9e264f3f |
|
10-Mar-2023 |
Amit Kumar Mahapatra via Alsa-devel <alsa-devel@alsa-project.org> |
spi: Replace all spi->chip_select and spi->cs_gpiod references with function call Supporting multi-cs in spi drivers would require the chip_select & cs_gpiod members of struct spi_device to be an array. But changing the type of these members to array would break the spi driver functionality. To make the transition smoother introduced four new APIs to get/set the spi->chip_select & spi->cs_gpiod and replaced all spi->chip_select and spi->cs_gpiod references with get or set API calls. While adding multi-cs support in further patches the chip_select & cs_gpiod members of the spi_device structure would be converted to arrays & the "idx" parameter of the APIs would be used as array index i.e., spi->chip_select[idx] & spi->cs_gpiod[idx] respectively. Signed-off-by: Amit Kumar Mahapatra <amit.kumar-mahapatra@amd.com> Acked-by: Heiko Stuebner <heiko@sntech.de> # Rockchip drivers Reviewed-by: Michal Simek <michal.simek@amd.com> Reviewed-by: Cédric Le Goater <clg@kaod.org> # Aspeed driver Reviewed-by: Dhruva Gole <d-gole@ti.com> # SPI Cadence QSPI Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com> # spi-stm32-qspi Acked-by: William Zhang <william.zhang@broadcom.com> # bcm63xx-hsspi driver Reviewed-by: Serge Semin <fancer.lancer@gmail.com> # DW SSI part Link: https://lore.kernel.org/r/167847070432.26.15076794204368669839@mailman-core.alsa-project.org Signed-off-by: Mark Brown <broonie@kernel.org>
|
#
5ff5e676 |
|
03-Mar-2023 |
Uwe Kleine-König <u.kleine-koenig@pengutronix.de> |
spi: rockchip: Convert to platform remove callback returning void The .remove() callback for a platform driver returns an int which makes many driver authors wrongly assume it's possible to do error handling by returning an error code. However the value returned is (mostly) ignored and this typically results in resource leaks. To improve here there is a quest to make the remove callback return void. In the first step of this quest all drivers are converted to .remove_new() which already returns void. Trivially convert this driver from always returning zero in the remove callback to the void returning variant. Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Link: https://lore.kernel.org/r/20230303172041.2103336-60-u.kleine-koenig@pengutronix.de Signed-off-by: Mark Brown <broonie@kernel.org>
|
#
8c220e6c |
|
25-Feb-2023 |
Lizhe <sensor1010@163.com> |
drivers/spi-rockchip.c : Remove redundant variable slave variable slave in spi_alloc_master() or spi_alloc_slave() has been assigned. it is not necessary to be assigned again Signed-off-by: Lizhe <sensor1010@163.com> Link: https://lore.kernel.org/r/20230226063334.7489-1-sensor1010@163.com Signed-off-by: Mark Brown <broonie@kernel.org>
|
#
d447fa65 |
|
25-Feb-2023 |
Lizhe <sensor1010@163.com> |
drivers/spi-rockchip.c : Use devm_platform_get_and_ioremap_resource makes code better use devm_platform_get_and_ioremap replace platform_get_resource() and devm_ioremap_resource() Signed-off-by: Lizhe <sensor1010@163.com> Link: https://lore.kernel.org/r/20230226065125.14086-1-sensor1010@163.com Signed-off-by: Mark Brown <broonie@kernel.org>
|
#
419bc8f6 |
|
17-Jun-2022 |
Jon Lin <jon.lin@rock-chips.com> |
spi: rockchip: Unmask IRQ at the final to avoid preemption Avoid pio_write process is preempted, resulting in abnormal state. Signed-off-by: Jon Lin <jon.lin@rock-chips.com> Signed-off-by: Jon <jon.lin@rock-chips.com> Link: https://lore.kernel.org/r/20220617124251.5051-1-jon.lin@rock-chips.com Signed-off-by: Mark Brown <broonie@kernel.org>
|
#
d5d933f0 |
|
21-Apr-2022 |
Luca Ceresoli <luca.ceresoli@bootlin.com> |
spi: rockchip: fix missing error on unsupported SPI_CS_HIGH The hardware (except for the ROCKCHIP_SPI_VER2_TYPE2 version) does not support active-high native chip selects. However if such a CS is configured the core does not error as it normally should, because the 'ctlr->use_gpio_descriptors = true' line in rockchip_spi_probe() makes the core set SPI_CS_HIGH in ctlr->mode_bits. In such a case the spi-rockchip driver operates normally but produces an active-low chip select signal without notice. There is no provision in the current core code to handle this situation. Fix by adding a check in the ctlr->setup function (similarly to what spi-atmel.c does). This cannot be done reading the SPI_CS_HIGH but in ctlr->mode_bits because that bit gets always set by the core for master mode (see above). Fixes: eb1262e3cc8b ("spi: spi-rockchip: use num-cs property and ctlr->enable_gpiods") Signed-off-by: Luca Ceresoli <luca.ceresoli@bootlin.com> Link: https://lore.kernel.org/r/20220421213251.1077899-1-luca.ceresoli@bootlin.com Signed-off-by: Mark Brown <broonie@kernel.org>
|
#
2fcdde56 |
|
15-Feb-2022 |
Jon Lin <jon.lin@rock-chips.com> |
spi: rockchip: clear interrupt status in error handler The interrupt status bit of the previous error data transmition will affect the next operation and cause continuous SPI transmission failure. Signed-off-by: Jon Lin <jon.lin@rock-chips.com> Link: https://lore.kernel.org/r/20220216014028.8123-7-jon.lin@rock-chips.com Signed-off-by: Mark Brown <broonie@kernel.org>
|
#
e882575e |
|
15-Feb-2022 |
shengfei Xu <xsf@rock-chips.com> |
spi: rockchip: Suspend and resume the bus during NOIRQ_SYSTEM_SLEEP_PM ops the wakeup interrupt handler which is guaranteed not to run while @resume noirq() is being executed. the patch can help to avoid the wakeup source try to access spi when the spi is in suspend mode. Signed-off-by: shengfei Xu <xsf@rock-chips.com> Signed-off-by: Jon Lin <jon.lin@rock-chips.com> Link: https://lore.kernel.org/r/20220216014028.8123-6-jon.lin@rock-chips.com Signed-off-by: Mark Brown <broonie@kernel.org>
|
#
3a4bf922 |
|
15-Feb-2022 |
Jon Lin <jon.lin@rock-chips.com> |
spi: rockchip: Preset cs-high and clk polarity in setup progress After power up, the cs and clock is in default status, and the cs-high and clock polarity dts property configuration will take no effect until the calling of rockchip_spi_config in the first transmission. So preset them to make sure a correct voltage before the first transmission coming. Signed-off-by: Jon Lin <jon.lin@rock-chips.com> Link: https://lore.kernel.org/r/20220216014028.8123-5-jon.lin@rock-chips.com Signed-off-by: Mark Brown <broonie@kernel.org>
|
#
869f2c94 |
|
15-Feb-2022 |
Jon Lin <jon.lin@rock-chips.com> |
spi: rockchip: Stop spi slave dma receiver when cs inactive The spi which's version is higher than ver 2 will automatically enable this feature. If the length of master transmission is uncertain, the RK spi slave is better to automatically stop after cs inactive instead of waiting for xfer_completion forever. Signed-off-by: Jon Lin <jon.lin@rock-chips.com> Link: https://lore.kernel.org/r/20220216014028.8123-4-jon.lin@rock-chips.com Signed-off-by: Mark Brown <broonie@kernel.org>
|
#
80808768 |
|
15-Feb-2022 |
Jon Lin <jon.lin@rock-chips.com> |
spi: rockchip: terminate dma transmission when slave abort After slave abort, all DMA should be stopped, or it will affect the next transmission and maybe abort again. Signed-off-by: Jon Lin <jon.lin@rock-chips.com> Link: https://lore.kernel.org/r/20220216014028.8123-3-jon.lin@rock-chips.com Signed-off-by: Mark Brown <broonie@kernel.org>
|
#
9382df0a |
|
15-Feb-2022 |
Jon Lin <jon.lin@rock-chips.com> |
spi: rockchip: Fix error in getting num-cs property Get num-cs u32 from dts of_node property rather than u16. Signed-off-by: Jon Lin <jon.lin@rock-chips.com> Link: https://lore.kernel.org/r/20220216014028.8123-2-jon.lin@rock-chips.com Signed-off-by: Mark Brown <broonie@kernel.org>
|
#
5457773e |
|
26-Aug-2021 |
Tobias Schramm <t.schramm@manjaro.org> |
spi: rockchip: handle zero length transfers without timing out Previously zero length transfers submitted to the Rokchip SPI driver would time out in the SPI layer. This happens because the SPI peripheral does not trigger a transfer completion interrupt for zero length transfers. Fix that by completing zero length transfers immediately at start of transfer. Signed-off-by: Tobias Schramm <t.schramm@manjaro.org> Link: https://lore.kernel.org/r/20210827050357.165409-1-t.schramm@manjaro.org Signed-off-by: Mark Brown <broonie@kernel.org>
|
#
736b81e0 |
|
21-Jun-2021 |
Jon Lin <jon.lin@rock-chips.com> |
spi: rockchip: Support SPI_CS_HIGH 1.Add standard spi-cs-high support 2.Refer to spi-controller.yaml for details Signed-off-by: Jon Lin <jon.lin@rock-chips.com> Link: https://lore.kernel.org/r/20210621104848.19539-2-jon.lin@rock-chips.com Signed-off-by: Mark Brown <broonie@kernel.org>
|
#
b8d42371 |
|
21-Jun-2021 |
Jon Lin <jon.lin@rock-chips.com> |
spi: rockchip: Support cs-gpio 1.Add standard cs-gpio support 2.Refer to spi-controller.yaml for details Signed-off-by: Jon Lin <jon.lin@rock-chips.com> Link: https://lore.kernel.org/r/20210621104848.19539-1-jon.lin@rock-chips.com Signed-off-by: Mark Brown <broonie@kernel.org>
|
#
2758bd09 |
|
21-Jun-2021 |
Jon Lin <jon.lin@rock-chips.com> |
spi: rockchip: Wait for STB status in slave mode tx_xfer After ROCKCHIP_SPI_VER2_TYPE2, SR->STB is a more accurate judgment bit for spi slave transmition. Signed-off-by: Jon Lin <jon.lin@rock-chips.com> Link: https://lore.kernel.org/r/20210621104800.19088-5-jon.lin@rock-chips.com Signed-off-by: Mark Brown <broonie@kernel.org>
|
#
4a47fcdb |
|
21-Jun-2021 |
Jon Lin <jon.lin@rock-chips.com> |
spi: rockchip: Set rx_fifo interrupt waterline base on transfer item The error here is to calculate the width as 8 bits. In fact, 16 bits should be considered. Signed-off-by: Jon Lin <jon.lin@rock-chips.com> Link: https://lore.kernel.org/r/20210621104800.19088-4-jon.lin@rock-chips.com Signed-off-by: Mark Brown <broonie@kernel.org>
|
#
0f4f58b8 |
|
21-Jun-2021 |
Jon Lin <jon.lin@rock-chips.com> |
spi: rockchip: add compatible string for rv1126 Add compatible string for rv1126 for potential applications. Signed-off-by: Jon Lin <jon.lin@rock-chips.com> Link: https://lore.kernel.org/r/20210621104800.19088-3-jon.lin@rock-chips.com Signed-off-by: Mark Brown <broonie@kernel.org>
|
#
02621799 |
|
24-Mar-2021 |
Jay Fang <f.fangjian@huawei.com> |
spi: rockchip: Fix code indent should use tabs where possible Fix checkpatch errors: ERROR: code indent should use tabs where possible #484: FILE: spi-rockchip.c:484: +^I | CR0_BHT_8BIT << CR0_BHT_OFFSET$ ERROR: code indent should use tabs where possible #485: FILE: spi-rockchip.c:485: +^I | CR0_SSD_ONE << CR0_SSD_OFFSET$ ERROR: code indent should use tabs where possible #486: FILE: spi-rockchip.c:486: +^I | CR0_EM_BIG << CR0_EM_OFFSET;$ Signed-off-by: Jay Fang <f.fangjian@huawei.com> Link: https://lore.kernel.org/r/1616566602-13894-11-git-send-email-f.fangjian@huawei.com Signed-off-by: Mark Brown <broonie@kernel.org>
|
#
e5098952 |
|
26-Feb-2021 |
Arnd Bergmann <arnd@arndb.de> |
spi: rockchip: avoid objtool warning Building this file with clang leads to a an unreachable code path causing a warning from objtool: drivers/spi/spi-rockchip.o: warning: objtool: rockchip_spi_transfer_one()+0x2e0: sibling call from callable instruction with modified stack frame Change the unreachable() into an error return that can be handled if it ever happens, rather than silently crashing the kernel. Fixes: 65498c6ae241 ("spi: rockchip: support 4bit words") Signed-off-by: Arnd Bergmann <arnd@arndb.de> Acked-by: Pratyush Yadav <p.yadav@ti.com> Link: https://lore.kernel.org/r/20210226140109.3477093-1-arnd@kernel.org Signed-off-by: Mark Brown <broonie@kernel.org>
|
#
6bd2c867 |
|
07-Jan-2021 |
Vincent Pelletier <plr.vincent@gmail.com> |
spi: rockchip: Call the dedicated transfer completion function. spi_finalize_current_transfer currently only calls "complete", so no functional change is expected. Signed-off-by: Vincent Pelletier <plr.vincent@gmail.com> Link: https://lore.kernel.org/r/f3e1cf19a7dcdd77adc0a719adf46449b84ccadd.1610062884.git.plr.vincent@gmail.com Signed-off-by: Mark Brown <broonie@kernel.org>
|
#
940f3bbf |
|
16-Oct-2020 |
Alexander Kochetkov <al.kochet@gmail.com> |
spi: rockchip: enable autosuspend feature If SPI is used for periodic polling any sensor, significant delays sometimes appear. Switching on module clocks during resume lead to delays. Enabling autosuspend mode causes the controller to not suspend between SPI transfers and the delays disappear. Signed-off-by: Alexander Kochetkov <al.kochet@gmail.com> Link: https://lore.kernel.org/r/20201016085014.31667-1-al.kochet@gmail.com Signed-off-by: Mark Brown <broonie@kernel.org>
|
#
4294e4ac |
|
22-Jul-2020 |
Jon Lin <jon.lin@rock-chips.com> |
spi: rockchip: Fix error in SPI slave pio read The RXFLR is possible larger than rx_left in Rockchip SPI, fix it. Fixes: 01b59ce5dac8 ("spi: rockchip: use irq rather than polling") Signed-off-by: Jon Lin <jon.lin@rock-chips.com> Tested-by: Emil Renner Berthing <kernel@esmil.dk> Reviewed-by: Heiko Stuebner <heiko@sntech.de> Reviewed-by: Emil Renner Berthing <kernel@esmil.dk> Link: https://lore.kernel.org/r/20200723004356.6390-3-jon.lin@rock-chips.com Signed-off-by: Mark Brown <broonie@kernel.org>
|
#
13a96935 |
|
22-Jul-2020 |
Jon Lin <jon.lin@rock-chips.com> |
spi: rockchip: Support 64-location deep FIFOs The FIFO depth of SPI V2 is 64 instead of 32, add support for it. Signed-off-by: Jon Lin <jon.lin@rock-chips.com> Tested-by: Emil Renner Berthing <kernel@esmil.dk> Reviewed-by: Emil Renner Berthing <kernel@esmil.dk> Link: https://lore.kernel.org/r/20200723004356.6390-2-jon.lin@rock-chips.com Signed-off-by: Mark Brown <broonie@kernel.org>
|
#
4d9ca632 |
|
22-Jul-2020 |
Jon Lin <jon.lin@rock-chips.com> |
spi: rockchip: Config spi rx dma burst size depend on xfer length The burst length can be adjusted according to the transmission length to improve the transmission rate Signed-off-by: Jon Lin <jon.lin@rock-chips.com> Tested-by: Emil Renner Berthing <kernel@esmil.dk> Reviewed-by: Emil Renner Berthing <kernel@esmil.dk> Link: https://lore.kernel.org/r/20200723004356.6390-1-jon.lin@rock-chips.com Signed-off-by: Mark Brown <broonie@kernel.org>
|
#
eb1262e3 |
|
11-May-2020 |
Chris Ruehl <chris.ruehl@gtsys.com.hk> |
spi: spi-rockchip: use num-cs property and ctlr->enable_gpiods The original implementation set num_chipselect to ROCKCHIP_SPI_MAX_CS_NUM (2) which seems wrong here. spi0 has 2 native cs, all others just one. With enable and use of cs_gpiods / GPIO CS, its correct to set the num_chipselect from the num-cs property and set max_native_cs with the define. If num-cs is missing the default set to num_chipselect = 1. Signed-off-by: Chris Ruehl <chris.ruehl@gtsys.com.hk> Link: https://lore.kernel.org/r/20200511083022.23678-4-chris.ruehl@gtsys.com.hk Signed-off-by: Mark Brown <broonie@kernel.org>
|
#
d065f41a |
|
11-May-2020 |
Chris Ruehl <chris.ruehl@gtsys.com.hk> |
spi: spi-rockchip: add support for spi slave mode Add support for spi slave mode in spi-rockchip. The register map has an entry for it. If spi-slave is set in dts, set this corresponding bit and add to mode_bits the SPI_NO_CS, allow slave mode without explicit CS use. Slave abort function had been added. Signed-off-by: Chris Ruehl <chris.ruehl@gtsys.com.hk> Link: https://lore.kernel.org/r/20200511083022.23678-3-chris.ruehl@gtsys.com.hk Signed-off-by: Mark Brown <broonie@kernel.org>
|
#
d66571a2 |
|
11-May-2020 |
Chris Ruehl <chris.ruehl@gtsys.com.hk> |
spi: spi-rockchip: cleanup use struct spi_controller Cleanup, move from the compatibily layer struct spi_master over to struct spi_controller, and rename the related function calls. Signed-off-by: Chris Ruehl <chris.ruehl@gtsys.com.hk> Link: https://lore.kernel.org/r/20200511083022.23678-2-chris.ruehl@gtsys.com.hk Signed-off-by: Mark Brown <broonie@kernel.org>
|
#
c6486ead |
|
09-Mar-2020 |
Johan Jonker <jbx6244@gmail.com> |
spi: rockchip: add compatible string for px30 rk3308 rk3328 The Rockchip spi binding is updated to yaml and new models were added. The spi on px30,rk3308 and rk3328 are the same as other Rockchip based SoCs, so add compatible string for it. Signed-off-by: Johan Jonker <jbx6244@gmail.com> Link: https://lore.kernel.org/r/20200309151004.7780-1-jbx6244@gmail.com Signed-off-by: Mark Brown <broonie@kernel.org>
|
#
2025cf9e |
|
29-May-2019 |
Thomas Gleixner <tglx@linutronix.de> |
treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 288 Based on 1 normalized pattern(s): this program is free software you can redistribute it and or modify it under the terms and conditions of the gnu general public license version 2 as published by the free software foundation this program is distributed in the hope it will be useful but without any warranty without even the implied warranty of merchantability or fitness for a particular purpose see the gnu general public license for more details extracted by the scancode license scanner the SPDX license identifier GPL-2.0-only has been chosen to replace the boilerplate/reference in 263 file(s). Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Reviewed-by: Allison Randal <allison@lohutok.net> Reviewed-by: Alexios Zavras <alexios.zavras@intel.com> Cc: linux-spdx@vger.kernel.org Link: https://lkml.kernel.org/r/20190529141901.208660670@linutronix.de Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
|
#
8af0c18a |
|
14-May-2019 |
Suren Baghdasaryan <surenb@google.com> |
include/: refactor headers to allow kthread.h inclusion in psi_types.h kthread.h can't be included in psi_types.h because it creates a circular inclusion with kthread.h eventually including psi_types.h and complaining on kthread structures not being defined because they are defined further in the kthread.h. Resolve this by removing psi_types.h inclusion from the headers included from kthread.h. Link: http://lkml.kernel.org/r/20190319235619.260832-7-surenb@google.com Signed-off-by: Suren Baghdasaryan <surenb@google.com> Acked-by: Johannes Weiner <hannes@cmpxchg.org> Cc: Dennis Zhou <dennis@kernel.org> Cc: Ingo Molnar <mingo@redhat.com> Cc: Jens Axboe <axboe@kernel.dk> Cc: Li Zefan <lizefan@huawei.com> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Tejun Heo <tj@kernel.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
|
#
47300728 |
|
11-Apr-2019 |
Emil Renner Berthing <kernel@esmil.dk> |
spi: rockchip: turn down tx dma bursts This fixes tx and bi-directional dma transfers on rk3399-gru-kevin. It seems the SPI fifo must have room for 2 bursts when the dma_tx_req signal is generated or it might skip some words. This in turn makes the rx dma channel never complete for bi-directional transfers. Fix it by setting tx burst length to fifo_len / 4 and the dma watermark to fifo_len / 2. However the rk3399 TRM says (sic): "DMAC support incrementing-address burst and fixed-address burst. But in the case of access SPI and UART at byte or halfword size, DMAC only support fixed-address burst and the address must be aligned to word." So this relies on fifo_len being a multiple of 16 such that the burst length (= fifo_len / 4) is a multiple of 4 and the addresses will be word-aligned. Fixes: dcfc861d24ec ("spi: rockchip: adjust dma watermark and burstlen") Signed-off-by: Emil Renner Berthing <kernel@esmil.dk> Signed-off-by: Mark Brown <broonie@kernel.org>
|
#
04290192 |
|
31-Oct-2018 |
Emil Renner Berthing <kernel@esmil.dk> |
spi: rockchip: support lsb-first mode Add missing support for lsb-first mode. Signed-off-by: Emil Renner Berthing <kernel@esmil.dk> Tested-by: Heiko Stuebner <heiko@sntech.de> Signed-off-by: Mark Brown <broonie@kernel.org>
|
#
65498c6a |
|
31-Oct-2018 |
Emil Renner Berthing <kernel@esmil.dk> |
spi: rockchip: support 4bit words The hardware supports 4, 8 and 16bit spi words, so add the missing support for 4bit words. Signed-off-by: Emil Renner Berthing <kernel@esmil.dk> Tested-by: Heiko Stuebner <heiko@sntech.de> Signed-off-by: Mark Brown <broonie@kernel.org>
|
#
01b59ce5 |
|
31-Oct-2018 |
Emil Renner Berthing <kernel@esmil.dk> |
spi: rockchip: use irq rather than polling Register an interrupt handler to fill/empty the tx and rx fifos rather than busy-looping. Signed-off-by: Emil Renner Berthing <kernel@esmil.dk> Tested-by: Heiko Stuebner <heiko@sntech.de> Signed-off-by: Mark Brown <broonie@kernel.org>
|
#
74b7efa8 |
|
31-Oct-2018 |
Emil Renner Berthing <kernel@esmil.dk> |
spi: rockchip: precompute rx sample delay Now that we no longer potentially change spi clock at runtime we can precompute the rx sample delay at probe time rather than for each transfer. Signed-off-by: Emil Renner Berthing <kernel@esmil.dk> Tested-by: Heiko Stuebner <heiko@sntech.de> Signed-off-by: Mark Brown <broonie@kernel.org>
|
#
420b82f8 |
|
31-Oct-2018 |
Emil Renner Berthing <kernel@esmil.dk> |
spi: rockchip: set min/max speed The driver previously checked each transfer if the requested speed was higher than possible with the current spi clock rate and raised the clock rate accordingly. However, there is no check to see if the spi clock was actually set that high and no way to dynamically lower the spi clock rate again. So it seems any potiential users of this functionality are better off just setting the spi clock rate at init using the assigned-clock-rates devicetree property. Removing this dynamic spi clock rate raising allows us let the spi framework handle min/max speeds for us. Signed-off-by: Emil Renner Berthing <kernel@esmil.dk> Tested-by: Heiko Stuebner <heiko@sntech.de> Signed-off-by: Mark Brown <broonie@kernel.org>
|
#
eff0275e |
|
31-Oct-2018 |
Emil Renner Berthing <kernel@esmil.dk> |
spi: rockchip: simplify use_dma logic We only need to know if we're using dma when setting up the transfer, so just use a local variable for that. Signed-off-by: Emil Renner Berthing <kernel@esmil.dk> Tested-by: Heiko Stuebner <heiko@sntech.de> Signed-off-by: Mark Brown <broonie@kernel.org>
|
#
d790c342 |
|
31-Oct-2018 |
Emil Renner Berthing <kernel@esmil.dk> |
spi: rockchip: remove master pointer from dev data In almost all cases we already have a pointer to the spi master structure where we have the driver data. The only exceptions are the dma callbacks which are easily fixed by passing them the master and using spi_master_get_devdata to retrieve the driver data. Signed-off-by: Emil Renner Berthing <kernel@esmil.dk> Tested-by: Heiko Stuebner <heiko@sntech.de> Signed-off-by: Mark Brown <broonie@kernel.org>
|
#
eee06a9e |
|
31-Oct-2018 |
Emil Renner Berthing <kernel@esmil.dk> |
spi: rockchip: don't store dma channels twice The spi master (aka spi controller) structure already has two fields for storing the rx and tx dma channels. Just use them rather than duplicating them in driver data. Signed-off-by: Emil Renner Berthing <kernel@esmil.dk> Tested-by: Heiko Stuebner <heiko@sntech.de> Signed-off-by: Mark Brown <broonie@kernel.org>
|
#
fc1ad8ee |
|
31-Oct-2018 |
Emil Renner Berthing <kernel@esmil.dk> |
spi: rockchip: read transfer info directly Just read transfer info directly from the spi device and transfer structures rather than storing it in driver data first. Signed-off-by: Emil Renner Berthing <kernel@esmil.dk> Tested-by: Heiko Stuebner <heiko@sntech.de> Signed-off-by: Mark Brown <broonie@kernel.org>
|
#
ce386100 |
|
31-Oct-2018 |
Emil Renner Berthing <kernel@esmil.dk> |
spi: rockchip: disable spi on error Successful transfers leave the spi disabled, so if we just make sure to disable the spi on error there should be no need to disable the spi from master->unprepare_message. This also flushes the tx and rx fifos, so no need to do that manually. Signed-off-by: Emil Renner Berthing <kernel@esmil.dk> Tested-by: Heiko Stuebner <heiko@sntech.de> Signed-off-by: Mark Brown <broonie@kernel.org>
|
#
fab3e487 |
|
31-Oct-2018 |
Emil Renner Berthing <kernel@esmil.dk> |
spi: rockchip: use atomic_t state The state field is currently only used to make sure only the last of the tx and rx dma callbacks issue an spi_finalize_current_transfer. Rather than using a spinlock we can get away with just turning the state field into an atomic_t. Signed-off-by: Emil Renner Berthing <kernel@esmil.dk> Tested-by: Heiko Stuebner <heiko@sntech.de> Signed-off-by: Mark Brown <broonie@kernel.org>
|
#
2410d6a3 |
|
31-Oct-2018 |
Emil Renner Berthing <kernel@esmil.dk> |
spi: rockchip: always use SPI mode The hardware supports 3 different variants of SPI and there were some code around it, but nothing to actually set it to anything but "Motorola SPI". Just drop that code and always use that mode. Signed-off-by: Emil Renner Berthing <kernel@esmil.dk> Tested-by: Heiko Stuebner <heiko@sntech.de> Signed-off-by: Mark Brown <broonie@kernel.org>
|
#
31bcb57b |
|
31-Oct-2018 |
Emil Renner Berthing <kernel@esmil.dk> |
spi: rockchip: use designated init for dma config Use C99 designated initializers for dma slave config structures. This also makes sure uninitialized fields are zeroed so we don't need an explicit memset. Signed-off-by: Emil Renner Berthing <kernel@esmil.dk> Tested-by: Heiko Stuebner <heiko@sntech.de> Signed-off-by: Mark Brown <broonie@kernel.org>
|
#
30688e4e |
|
31-Oct-2018 |
Emil Renner Berthing <kernel@esmil.dk> |
spi: rockchip: make spi_enable_chip take bool The spi_enable_chip function takes a boolean argument. Change the type to reflect that. Signed-off-by: Emil Renner Berthing <kernel@esmil.dk> Tested-by: Heiko Stuebner <heiko@sntech.de> Signed-off-by: Mark Brown <broonie@kernel.org>
|
#
a3c17402 |
|
10-Oct-2018 |
Emil Renner Berthing <kernel@esmil.dk> |
spi: rockchip: simplify spi enable logic Let the dma/non-dma code paths handle the spi enable flag themselves. This removes some logic to determine if the flag should be turned on before or after dma and also don't leave the spi enabled if the dma path fails. Signed-off-by: Emil Renner Berthing <kernel@esmil.dk> Signed-off-by: Mark Brown <broonie@kernel.org>
|
#
d9071b7e |
|
10-Oct-2018 |
Emil Renner Berthing <kernel@esmil.dk> |
spi: rockchip: directly use direction constants The dma direction for the tx and rx dma channels never change, so just use the constants directly rather than storing them in device data. Signed-off-by: Emil Renner Berthing <kernel@esmil.dk> Signed-off-by: Mark Brown <broonie@kernel.org>
|
#
f340b920 |
|
10-Oct-2018 |
Emil Renner Berthing <kernel@esmil.dk> |
spi: rockchip: mark use_dma as bool The driver data has a u32 field use_dma which is only ever used as a boolean, so change its type to reflect that. Signed-off-by: Emil Renner Berthing <kernel@esmil.dk> Signed-off-by: Mark Brown <broonie@kernel.org>
|
#
058f7c50 |
|
10-Oct-2018 |
Emil Renner Berthing <kernel@esmil.dk> |
spi: rockchip: remove unneeded dma_caps We no longer need the dma_caps since the dma driver already clamps the burst length to the hardware limit, so don't request and store dma_caps in device data. Signed-off-by: Emil Renner Berthing <kernel@esmil.dk> Signed-off-by: Mark Brown <broonie@kernel.org>
|
#
dcfc861d |
|
10-Oct-2018 |
Huibin Hong <huibin.hong@rock-chips.com> |
spi: rockchip: adjust dma watermark and burstlen Signal tx dma when spi fifo is less than half full, and limit tx bursts to half the fifo length. Clamp rx burst length to 1 to avoid alignment issues. Signed-off-by: Huibin Hong <huibin.hong@rock-chips.com> Signed-off-by: Emil Renner Berthing <kernel@esmil.dk> Signed-off-by: Mark Brown <broonie@kernel.org>
|
#
dd8fd2cb |
|
10-Oct-2018 |
Huibin Hong <huibin.hong@rock-chips.com> |
spi: rockchip: initialize dma_slave_config properly The rxconf and txconf structs are allocated on the stack, so make sure we zero them before filling out the relevant fields. Signed-off-by: Huibin Hong <huibin.hong@rock-chips.com> Signed-off-by: Emil Renner Berthing <kernel@esmil.dk> Signed-off-by: Mark Brown <broonie@kernel.org>
|
#
04b37d2d |
|
15-Aug-2017 |
Huibin Hong <huibin.hong@rock-chips.com> |
spi: rockchip: configure CTRLR1 according to size and data frame CTRLR1 is number of data frames, when rx only. When data frame is 8 bit, CTRLR1 is len-1. When data frame is 16 bit, CTRLR1 is (len/2)-1. Signed-off-by: Huibin Hong <huibin.hong@rock-chips.com> Signed-off-by: Mark Brown <broonie@kernel.org>
|
#
6b860e69 |
|
14-Aug-2017 |
Andy Yan <andy.yan@rock-chips.com> |
spi: rockchip: add compatible string for rv1108 spi The spi on rv1108 is the same as other rockchip based socs, add compatible string for it. Signed-off-by: Andy Yan <andy.yan@rock-chips.com> Acked-by: Rob Herring <robh@kernel.org> Signed-off-by: Mark Brown <broonie@kernel.org>
|
#
d38c4ae1 |
|
07-Aug-2017 |
Jeffy Chen <jeffy.chen@rock-chips.com> |
spi: rockchip: Fix clock handling in suspend/resume The runtime suspend callback might be called by pm domain framework at suspend_noirq stage. It would try to disable the clocks which already been disabled by rockchip_spi_suspend. Call pm_runtime_force_suspend/pm_runtime_force_resume when suspend/resume to avoid that. Signed-off-by: Jeffy Chen <jeffy.chen@rock-chips.com> Signed-off-by: Mark Brown <broonie@kernel.org>
|
#
6a06e895 |
|
07-Aug-2017 |
Jeffy Chen <jeffy.chen@rock-chips.com> |
spi: rockchip: Fix clock handling in remove We are assuming clocks enabled when calling rockchip_spi_remove, which is not always true. Those clocks might already been disabled by the runtime PM at that time. Call pm_runtime_get_sync before trying to disable clocks to avoid that. Signed-off-by: Jeffy Chen <jeffy.chen@rock-chips.com> Signed-off-by: Mark Brown <broonie@kernel.org>
|
#
43de979d |
|
07-Aug-2017 |
Jeffy Chen <jeffy.chen@rock-chips.com> |
spi: rockchip: Slightly rework return value handling Slightly rework return value handling, no functional changes. Signed-off-by: Jeffy Chen <jeffy.chen@rock-chips.com> Signed-off-by: Mark Brown <broonie@kernel.org>
|
#
aa099382 |
|
27-Jun-2017 |
Jeffy Chen <jeffy.chen@rock-chips.com> |
spi: rockchip: Disable Runtime PM when chip select is asserted The rockchip spi would stop driving pins when runtime suspended, which might break slave's xfer(for example cros_ec). Since we have pullups on those pins, we only need to care about this when the CS asserted. So let's keep the spi alive when chip select is asserted. Also use pm_runtime_put instead of pm_runtime_put_sync. Suggested-by: Doug Anderson <dianders@chromium.org> Signed-off-by: Jeffy Chen <jeffy.chen@rock-chips.com> Reviewed-by: Douglas Anderson <dianders@chromium.org> Signed-off-by: Mark Brown <broonie@kernel.org>
|
#
c863795c |
|
27-Jun-2017 |
Jeffy Chen <jeffy.chen@rock-chips.com> |
spi: rockchip: Set GPIO_SS flag to enable Slave Select with GPIO CS The rockchip spi still requires slave selection when using GPIO CS. Signed-off-by: Jeffy Chen <jeffy.chen@rock-chips.com> Reviewed-by: Douglas Anderson <dianders@chromium.org> Signed-off-by: Mark Brown <broonie@kernel.org>
|
#
c351587e |
|
12-Jun-2017 |
Jeffy Chen <jeffy.chen@rock-chips.com> |
spi: rockchip: fix error handling when probe After failed to request dma tx chain, we need to disable pm_runtime. Also cleanup error labels for better readability. Signed-off-by: Jeffy Chen <jeffy.chen@rock-chips.com> Reviewed-by: Brian Norris <briannorris@chromium.org> Signed-off-by: Mark Brown <broonie@kernel.org>
|
#
23e291c2 |
|
16-Dec-2016 |
Brian Norris <briannorris@chromium.org> |
spi: rockchip: support "sleep" pin configuration In the pattern of many other devices, support a system-sleep pin configuration. Signed-off-by: Brian Norris <briannorris@chromium.org> Reviewed-by: Douglas Anderson <dianders@chromium.org> Tested-by: Caesar Wang <wxt@rock-chips.com> Signed-off-by: Mark Brown <broonie@kernel.org>
|
#
5185a81c |
|
14-Jul-2016 |
Brian Norris <briannorris@chromium.org> |
spi: rockchip: limit transfers to (64K - 1) bytes The Rockchip SPI controller's length register only supports 16-bits, yielding a maximum length of 64KiB (the CTRLR1 register holds "length - 1"). Trying to transfer more than that (e.g., with a large SPI flash read) will cause the driver to hang. Now, it seems that while theoretically we should be able to program CTRLR1 with 0xffff, and get a 64KiB transfer, but that also seems to cause the core to choke, so stick with a maximum of 64K - 1 bytes -- i.e., 0xffff. Signed-off-by: Brian Norris <briannorris@chromium.org> Signed-off-by: Mark Brown <broonie@kernel.org>
|
#
4dc0dd83 |
|
08-Jun-2016 |
Tomeu Vizoso <tomeu.vizoso@collabora.com> |
spi: rockchip: Signal unfinished DMA transfers When using DMA, the transfer_one callback should return 1 because the transfer hasn't finished yet. A previous commit changed the function to return 0 when the DMA channels were correctly prepared. This manifested in Veyron boards with this message: [ 1.983605] cros-ec-spi spi0.0: EC failed to respond in time Fixes: ea9849113343 ("spi: rockchip: check return value of dmaengine_prep_slave_sg") Signed-off-by: Tomeu Vizoso <tomeu.vizoso@collabora.com> Signed-off-by: Mark Brown <broonie@kernel.org> Cc: stable@vger.kernel.org
|
#
aa29ea3d |
|
19-May-2016 |
Caesar Wang <wxt@rock-chips.com> |
spi/rockchip: add the rk3036/rk3228/rk3368 to match for driver In gerenal, the "rockchip,rockchip-spi" string will match the dts that's great in spi driver. After all the most of rockchip SoCs ar same spi controller. Then, we should keep the old style to match the dts various. Signed-off-by: Caesar Wang <wxt@rock-chips.com> Signed-off-by: Mark Brown <broonie@kernel.org>
|
#
5de7ed0c |
|
04-May-2016 |
Dan Carpenter <dan.carpenter@oracle.com> |
spi: rockchip: potential NULL dereference on error We were calling dma_release_channel(rs->dma_tx.ch) when "rs->dma_tx.ch" is potentially NULL. There is actually a call to that in the unwind code at the bottom of the function so we can just re-arrange this a bit and remove the call. Also there is no need to set rs->dma_tx.ch to NULL on this error path. Fixes: e4c0e06f949b ('spi: rockchip: fix probe deferral handling') Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com> Signed-off-by: Mark Brown <broonie@kernel.org>
|
#
e4c0e06f |
|
30-Mar-2016 |
Shawn Lin <shawn.lin@rock-chips.com> |
spi: rockchip: fix probe deferral handling Use dma_request_chan instead of dma_request_slave_channel, in this case we can check EPROBE_DEFER without static warning. Reported-by: Dan Carpenter <dan.carpenter@oracle.com> Signed-off-by: Shawn Lin <shawn.lin@rock-chips.com> Reviewed-by: Douglas Anderson <dianders@chromium.org> Signed-off-by: Mark Brown <broonie@kernel.org>
|
#
bb51537a |
|
14-Mar-2016 |
Geert Uytterhoeven <geert+renesas@glider.be> |
spi: rockchip: Spelling s/divsor/divisor/ Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be> Signed-off-by: Mark Brown <broonie@kernel.org>
|
#
108b5c8b |
|
09-Mar-2016 |
Shawn Lin <shawn.lin@rock-chips.com> |
spi: rockchip: covert rsd_nsecs to u32 type rsd_nsecs is defined as u8 memeber of struct rockchip_spi, but using of_property_read_u32. That means we take risk of truncation by type conversion if we pass on big value from dt. Signed-off-by: Shawn Lin <shawn.lin@rock-chips.com> Signed-off-by: Mark Brown <broonie@kernel.org>
|
#
ec5c5d8a |
|
09-Mar-2016 |
Shawn Lin <shawn.lin@rock-chips.com> |
spi: rockchip: header file cleanup Remove some of unused header files and reoder it into alphabetical order. Signed-off-by: Shawn Lin <shawn.lin@rock-chips.com> Signed-off-by: Mark Brown <broonie@kernel.org>
|
#
61cadcf4 |
|
09-Mar-2016 |
Shawn Lin <shawn.lin@rock-chips.com> |
spi: rockchip: check requesting dma channel with EPROBE_DEFER Let's defer probing the driver if the return value of dma_request_slave_channel is ERR_PTR(-EPROBE_DEFER) instead of disabling dma capability directly. Signed-off-by: Shawn Lin <shawn.lin@rock-chips.com> Signed-off-by: Mark Brown <broonie@kernel.org>
|
#
557b7ea3 |
|
09-Mar-2016 |
Shawn Lin <shawn.lin@rock-chips.com> |
spi: rockchip: migrate to dmaengine_terminate_async dmaengine_terminate_all is deprecated, let's use dmaengine_terminate_async for interrupt handling. Signed-off-by: Shawn Lin <shawn.lin@rock-chips.com> Signed-off-by: Mark Brown <broonie@kernel.org>
|
#
ea984911 |
|
09-Mar-2016 |
Shawn Lin <shawn.lin@rock-chips.com> |
spi: rockchip: check return value of dmaengine_prep_slave_sg We should check return value of dmaengine_prep_slave_sg, otherwise we take risk of null pointer. Signed-off-by: Shawn Lin <shawn.lin@rock-chips.com> Signed-off-by: Mark Brown <broonie@kernel.org>
|
#
0277e01a |
|
06-Mar-2016 |
Alexander Kochetkov <al.kochet@gmail.com> |
spi/rockchip: fix endian mode for 16-bit transfers 16-bit transfers must be in big endian mode on wire. Signed-off-by: Alexander Kochetkov <al.kochet@gmail.com> Signed-off-by: Mark Brown <broonie@kernel.org>
|
#
b920cc31 |
|
24-Feb-2016 |
Huibin Hong <huibin.hong@rock-chips.com> |
spi/rockchip: Make sure spi clk is on in rockchip_spi_set_cs Rockchip_spi_set_cs could be called by spi_setup, but spi_setup may be called by device driver after runtime suspend. Then the spi clock is closed, rockchip_spi_set_cs may access the spi registers, which causes cpu block in some socs. Fixes: 64e36824b32 ("spi/rockchip: add driver for Rockchip RK3xxx") Signed-off-by: Huibin Hong <huibin.hong@rock-chips.com> Signed-off-by: Mark Brown <broonie@kernel.org>
|
#
9b7a5622 |
|
18-Feb-2016 |
Xu Jianqun <jay.xu@rock-chips.com> |
spi: rockchip: add bindings for rk3399 spi Add devicetree bindings for Rockchip rk3399 spi which found on Rockchip rk3399 SoCs. Signed-off-by: Jianqun Xu <jay.xu@rock-chips.com> Signed-off-by: Heiko Stuebner <heiko@sntech.de> Signed-off-by: Mark Brown <broonie@kernel.org>
|
#
23366a02 |
|
15-Feb-2016 |
Shawn Lin <shawn.lin@rock-chips.com> |
spi: rockchip: remove xfer_completion from rockchip_spi xfer_completion isn't been used anywhere, so it can be removed. Signed-off-by: Shawn Lin <shawn.lin@rock-chips.com> Signed-off-by: Mark Brown <broonie@kernel.org>
|
#
844c9f47 |
|
15-Feb-2016 |
Shawn Lin <shawn.lin@rock-chips.com> |
spi: rockchip: add missing spi_master_put Add missing spi_master_put for rockchip_spi_remove since it calls spi_master_get already. Signed-off-by: Shawn Lin <shawn.lin@rock-chips.com> Signed-off-by: Mark Brown <broonie@kernel.org>
|
#
b8659add |
|
15-Feb-2016 |
Shawn Lin <shawn.lin@rock-chips.com> |
spi: rockchip: disable runtime pm when in err case Before registering master, driver enables runtime pm. This patch pm_runtime_disable in err case while probing driver to balance pm reference count. Signed-off-by: Shawn Lin <shawn.lin@rock-chips.com> Signed-off-by: Mark Brown <broonie@kernel.org>
|
#
80abf888 |
|
22-Jan-2016 |
Addy Ke <addy.ke@rock-chips.com> |
spi: rockchip: modify DMA max burst to 1 Generic dma controller on Rockchips' platform cannot support DMAFLUSHP instruction which make dma to flush the req of non-aligned or non-multiple of what we need. That will cause an unrecoverable dma bus error. The saftest way is to set dma max burst to 1. Signed-off-by: Addy ke <addy.ke@rock-chips.com> Fixes: 64e36824b32b06 ("spi/rockchip: add driver for Rockchip...") Signed-off-by: Shawn Lin <shawn.lin@rock-chips.com> cc: Heiko Stuebner <heiko@sntech.de> cc: Olof Johansson <olof@lixom.net> cc: Doug Anderson <dianders@chromium.org> cc: Sonny Rao <sonnyrao@chromium.org> Acked-by: Mark Brown <broonie@kernel.org> Signed-off-by: Caesar Wang <wxt@rock-chips.com> Signed-off-by: Vinod Koul <vinod.koul@intel.com>
|
#
99622f56 |
|
30-Jun-2015 |
Alexey Klimov <klimov.linux@gmail.com> |
spi/rockchip: remove unnecessary memset of rockchip_spi Memory for struct rockchip_spi is allocated by spi_alloc_master() using kzalloc() so it doesn't need to be set to 0 one more time. Signed-off-by: Alexey Klimov <klimov.linux@gmail.com> Signed-off-by: Mark Brown <broonie@kernel.org>
|
#
76b17e6e |
|
26-Mar-2015 |
Julius Werner <jwerner@chromium.org> |
spi/rockchip: Add device tree property to configure Rx Sample Delay We have found that we can sometimes see read failures on boards with high-capacitance SPI lines. It seems that the controller samples the Rx data line too early, and its register interface has an "Rx Sample Delay" setting to fine-tune against this issue. This patch adds a new optional device tree entry that can configure this delay in terms of nanoseconds. The kernel will calculate the best-fitting amount of parent clock ticks to program the controller with based on that. Signed-off-by: Julius Werner <jwerner@chromium.org> Signed-off-by: Mark Brown <broonie@kernel.org>
|
#
754ec43c |
|
26-Mar-2015 |
Julius Werner <jwerner@chromium.org> |
spi/rockchip: Round up clock rate divisor to err on the safe side The Rockchip SPI driver currently calculates its clock rate divisor by integer dividing the parent rate by the target rate, and then rounding the result up to the next even number (since the divisor must be even). Clock rate divisors should always be rounded up, so that the resulting frequency is lower or equal to the target. This is correctly done in the second step here but not in the first, so we still have a risk of exceeding the desired target frequency (e.g. setting spi-max-frequency to 40000000 with a parent clock of 99000000 could lead to a divisor of 99000000 / 40000000 == 2 (which is even) that then results in an effective frequency of 99000000 / 2 == 49500000 (potentially exceeding the flash chip's specifications). This patch changes the division to round up to fix this problem. Signed-off-by: Julius Werner <jwerner@chromium.org> Signed-off-by: Mark Brown <broonie@kernel.org>
|
#
2291793c |
|
27-Feb-2015 |
Andy Shevchenko <andriy.shevchenko@linux.intel.com> |
spi/rockchip: do an error handling in proper time There was handle_err() callback introduced that is dedicated for error handling. The patch moves error handling to this callback. Cc: Heiko Stuebner <heiko@sntech.de> Cc: linux-rockchip@lists.infradead.org Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Signed-off-by: Mark Brown <broonie@kernel.org>
|
#
97cf5669 |
|
28-Jan-2015 |
Arnd Bergmann <arnd@arndb.de> |
spi/rockchip: avoid uninitialized-use warning We currently get a warning about potentially uninitialized variables in the rockchip spi driver, at least in certain toolchain versions: spi/spi-rockchip.c: In function 'rockchip_spi_prepare_dma': include/linux/dmaengine.h:796:2: warning: 'txdesc' may be used uninitialized in this function include/linux/dmaengine.h:796:2: warning: 'rxdesc' may be used uninitialized in this function The reason seems to be that gcc cannot know whether the value of the rs->rx and rs->tx variables change between the two points these are accessed. The code is actually correct, but to make this clearer to the compiler, this changes the conditionals to test for the local rxdesc/txdesc variables instead, which it knows won't change. Signed-off-by: Arnd Bergmann <arnd@arndb.de> Signed-off-by: Mark Brown <broonie@kernel.org>
|
#
ec833050 |
|
12-Dec-2014 |
Rafael J. Wysocki <rafael.j.wysocki@intel.com> |
spi: Replace CONFIG_PM_RUNTIME with CONFIG_PM After commit b2b49ccbdd54 (PM: Kconfig: Set PM_RUNTIME if PM_SLEEP is selected) PM_RUNTIME is always set if PM is set, so #ifdef blocks depending on CONFIG_PM_RUNTIME may now be changed to depend on CONFIG_PM. Replace CONFIG_PM_RUNTIME with CONFIG_PM everywhere under drivers/spi/. Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com> Acked-by: Mark Brown <broonie@kernel.org>
|
#
dfcc2e35 |
|
11-Nov-2014 |
Laurentiu Palcu <laurentiu.palcu@intel.com> |
spi/rockchip: remove redundant call to spi_master_put() The call to spi_master_put() in rockchip_spi_remove() is redundant since the master is registered using devm_. This patch removes it. Signed-off-by: Laurentiu Palcu <laurentiu.palcu@intel.com> Signed-off-by: Mark Brown <broonie@kernel.org>
|
#
14ac00e0 |
|
20-Oct-2014 |
Wolfram Sang <wsa@kernel.org> |
spi: drop owner assignment from platform_drivers A platform_driver does not need to set an owner, it will be populated by the driver core. Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
|
#
2c2bc748 |
|
16-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>
|
#
c28be31b |
|
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>
|
#
f9cfd522 |
|
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>
|
#
a24e70c0 |
|
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
|
#
62946172 |
|
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>
|
#
64bc0110 |
|
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>
|
#
5d1d150d |
|
28-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>
|
#
0ac7a490 |
|
19-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>
|
#
db7e8d90 |
|
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>
|
#
4e6fafee |
|
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>
|
#
c4950143 |
|
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>
|
#
b839b785 |
|
10-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>
|
#
ee780997 |
|
10-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>
|
#
2df08e78 |
|
10-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>
|
#
5dcc44ed |
|
10-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>
|
#
64e36824 |
|
30-Jun-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>
|