summaryrefslogtreecommitdiff
path: root/drivers/spi/spi-img-spfi.c
Commit message (Collapse)AuthorAgeFilesLines
* spi: img-spfi: Set device select bits for SPFI port stateIonela Voinescu2018-07-301-0/+3
| | | | | | | | | | | Even if the chip select line is not controlled by the SPFI hardware, the device select bits need to be set to specify the chip select line in use for the hardware to know what parameters to use for the current transfer. Signed-off-by: Ionela Voinescu <ionela.voinescu@imgtec.com> Signed-off-by: Andreas Färber <afaerber@suse.de> Signed-off-by: Mark Brown <broonie@kernel.org>
* spi: img-spfi: Remove spi_master_put in img_spfi_remove()Wei Yongjun2016-07-271-2/+0
| | | | | | | | | | | The call to spi_master_put() in img_spfi_remove() is redundant since the master is registered using devm_spi_register_master() and no reference hold by using spi_master_get() in img_spfi_remove(). This is detected by Coccinelle semantic patch. Signed-off-by: Wei Yongjun <weiyj.lk@gmail.com> Signed-off-by: Mark Brown <broonie@kernel.org>
*-. Merge remote-tracking branches 'spi/topic/dw', 'spi/topic/fsl-espi', ↵Mark Brown2015-08-311-0/+14
|\ \ | | | | | | | | | 'spi/topic/img-spfi' and 'spi/topic/mpc512x-psc' into spi-next
| | * spi: img-spfi: check for max speed supported by the spfi blockSifan Naeem2015-07-071-0/+14
| |/ | | | | | | | | | | | | | | | | | | | | | | Maximum speed supported by spfi is limited to 1/4 of the spfi clock. But in some SoCs the maximum speed supported by the spfi block can be limited to less than 1/4 of the spfi clock. In such cases we have to define the limit in the device tree so that the driver can pick it up. Signed-off-by: Sifan Naeem <sifan.naeem@imgtec.com> Signed-off-by: Mark Brown <broonie@kernel.org>
| |
| \
*-. \ Merge remote-tracking branches 'spi/fix/bcm2835', 'spi/fix/bitbang', ↵Mark Brown2015-08-311-13/+46
|\ \ \ | | |/ | |/| | | | 'spi/fix/img-spfi', 'spi/fix/omap2-mcspi', 'spi/fix/orion' and 'spi/fix/xilinx' into spi-linus
| | * spi: img-spfi: fix kbuild test robot warningSifan Naeem2015-08-061-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | drivers/spi/spi-img-spfi.c: In function 'img_spfi_setup': drivers/spi/spi-img-spfi.c:446: warning: 'ret' may be used uninitialized in this function. Fixes: commit b03ba9e314c1 ("spi: img-spfi: fix multiple calls to request gpio") Signed-off-by: Sifan Naeem <sifan.naeem@imgtec.com> Signed-off-by: Mark Brown <broonie@kernel.org> Cc: stable@vger.kernel.org
| | * spi: img-spfi: fix multiple calls to request gpioSifan Naeem2015-08-041-8/+41
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | spfi_setup may be called many times by the spi framework, but gpio_request_one can only be called once without freeing, repeatedly calling gpio_request_one will cause an error to be thrown, which causes the request to spi_setup to be marked as failed. We can have a per-spi_device flag that indicates whether or not the gpio has been requested. If the gpio has already been requested use gpio_direction_output to set the direction of the gpio. Fixes: 8c2c8c03cdcb ("spi: img-spfi: Control CS lines with GPIO") Signed-off-by: Sifan Naeem <sifan.naeem@imgtec.com> Signed-off-by: Mark Brown <broonie@kernel.org> Cc: stable@vger.kernel.org
| | * spi: img-spfi: check for timeout error before proceedingSifan Naeem2015-07-291-4/+4
| |/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | Calling spfi_wait_all_done is not required if the transfer has timed out before all data is transferred. spfi_wait_all_done polls for Alldone interrupt which is triggered to mark the transfer as complete and to indicate it is now safe to issue a new transfer. Fixes: 8c2c8c0 ("spi: img-spfi: Control CS lines with GPIO") Signed-off-by: Sifan Naeem <sifan.naeem@imgtec.com> Reviewed-by: Andrew Bresticker <abrestic@chromium.org> Signed-off-by: Mark Brown <broonie@kernel.org> Cc: stable@vger.kernel.org
* | spi: img-spfi: fix support for speeds up to 1/4th input clockSifan Naeem2015-06-221-0/+2
|/ | | | | | | | | | | | | | | | | | | | Setting the Same Edge bit indicates to the spfi block to receive and transmit data on the same edge of the spfi clock, which in turn doubles the operating frequency of spfi. The maximum supported frequency is limited to 1/4th of the spfi input clock, but without this bit set the maximum would be 1/8th of the input clock. The current driver calculates the divisor with maximum speed at 1/4th of the input clock, this would fail if the requested frequency is higher than 1/8 of the input clock. Any requests for 1/8th of the input clock would still pass. Fixes: 8543d0e72d43 ("spi: img-spfi: Limit bit clock to 1/4th of input clock") Signed-off-by: Sifan Naeem <sifan.naeem@imgtec.com> Signed-off-by: Mark Brown <broonie@kernel.org> Cc: <stable@vger.kernel.org>
* spi: img-spfi: Control CS lines with GPIOEzequiel Garcia2015-04-081-48/+44
| | | | | | | | | | | | | | | | | | When the CONTINUE bit is set, the interrupt status we are polling to identify if a transaction has finished can be sporadic. Even though the transfer has finished, the interrupt status may erroneously indicate that there is still data in the FIFO. This behaviour causes random timeouts in large PIO transfers. Instead of using the CONTINUE bit to control the CS lines, use the SPI core's CS GPIO handling. Also, now that the CONTINUE bit is not being used, we can poll for the ALLDONE interrupt to indicate transfer completion. Signed-off-by: Sifan Naeem <sifan.naeem@imgtec.com> Signed-off-by: Ezequiel Garcia <ezequiel.garcia@imgtec.com> Signed-off-by: Andrew Bresticker <abrestic@chromium.org> Signed-off-by: Mark Brown <broonie@kernel.org>
* Merge branch 'fix/img-spfi' of ↵Mark Brown2015-04-081-5/+5
|\ | | | | | | git://git.kernel.org/pub/scm/linux/kernel/git/broonie/spi into spi-img-spfi
| * spi: img-spfi: Limit bit clock to 1/4th of input clockAndrew Bresticker2015-04-071-5/+5
| | | | | | | | | | | | | | | | | | Although the SPFI BITCLK divider supports a value of up to 255, only values up to 128 are usable. This results in a maximum possible bit clock rate of 1/4th the input clock rate. Signed-off-by: Andrew Bresticker <abrestic@chromium.org> Signed-off-by: Mark Brown <broonie@kernel.org>
* | spi: img-spfi: Reset controller after each messageAndrew Bresticker2015-04-081-2/+11
| | | | | | | | | | | | | | | | | | Imagination has recommended that the SPFI controller be reset after each message, regardless of success or failure. Do this in an unprepare_message() callback. Signed-off-by: Andrew Bresticker <abrestic@chromium.org> Signed-off-by: Mark Brown <broonie@kernel.org>
* | spi: img-spfi: Implement a handle_err() callbackEzequiel Garcia2015-04-081-20/+24
| | | | | | | | | | | | | | | | | | The driver can be greatly simplified by moving the transfer timeout handling to a handle_err() callback. Signed-off-by: Ezequiel Garcia <ezequiel.garcia@imgtec.com> Signed-off-by: Andrew Bresticker <abrestic@chromium.org> Signed-off-by: Mark Brown <broonie@kernel.org>
* | Merge tag 'v4.0-rc7' into spi-img-spfiMark Brown2015-04-081-0/+7
|\ \ | | | | | | | | | Linux 4.0-rc7
| * | spi: img-spfi: Verify max spfi transfer lengthSifan Naeem2015-03-031-0/+7
| |/ | | | | | | | | | | | | | | | | | | | | | | Maximum transfer length supported by SPFI is 65535, this is limited by the number of bits available in SPFI TSize register to represent the transfer size. For transfer requests larger than the maximum supported the driver will return an invalid argument error. Signed-off-by: Sifan Naeem <sifan.naeem@imgtec.com> Reviewed-by: Andrew Bresticker <abrestic@chromium.org> Signed-off-by: Mark Brown <broonie@kernel.org>
* | spi: img-spfi: Setup TRANSACTION register before CONTROL registerSifan Naeem2015-04-081-2/+3
| | | | | | | | | | | | | | | | | | | | | | | | Setting the transfer length in the TRANSACTION register after the CONTROL register is programmed causes intermittent timeout issues in SPFI transfers when using the SPI framework to control the CS GPIO lines. To avoid this issue, set transfer length before programming the CONTROL register. Signed-off-by: Sifan Naeem <sifan.naeem@imgtec.com> Signed-off-by: Andrew Bresticker <abrestic@chromium.org> Signed-off-by: Mark Brown <broonie@kernel.org>
* | spi: img-spfi: Implement a prepare_message() callbackEzequiel Garcia2015-04-071-12/+20
| | | | | | | | | | | | | | | | | | | | In preparation for switching to using the SPI core's CS GPIO handling, move setup of the PORT_STATE register, which must be configured before CS is asserted, to a prepare_message() callback. Signed-off-by: Ezequiel Garcia <ezequiel.garcia@imgtec.com> Signed-off-by: Andrew Bresticker <abrestic@chromium.org> Signed-off-by: Mark Brown <broonie@kernel.org>
* | spi: img-spfi: Remove udelay in soft resetSifan Naeem2015-03-031-1/+0
|/ | | | | | | | | Removing the udelay between setting and clearing the soft reset bit in the spfi control register as it is not required. Signed-off-by: Sifan Naeem <sifan.naeem@imgtec.com> Reviewed-by: Andrew Bresticker <abrestic@chromium.org> Signed-off-by: Mark Brown <broonie@kernel.org>
* spi: img-spfi: Select FIFO based on transfer lengthAndrew Bresticker2014-12-241-30/+19
| | | | | | | | | | Since the 32-bit FIFO is deeper (64 bytes) than the 8-bit FIFO (16 bytes), use the 32-bit FIFO when there are at least 32 bits remaining to be transferred in PIO mode or when the transfer length is 32-bit aligned in DMA mode. Signed-off-by: Andrew Bresticker <abrestic@chromium.org> Signed-off-by: Mark Brown <broonie@kernel.org>
* spi: img-spfi: Increase DMA burst sizeAndrew Bresticker2014-12-241-2/+2
| | | | | | | | | A 1-byte burst size is rather inefficient and has been shown to cause TX issues during testing. Increase the DMA burst size to 4-bytes for both RX and TX DMA when using the 8-bit FIFO. Signed-off-by: Andrew Bresticker <abrestic@chromium.org> Signed-off-by: Mark Brown <broonie@kernel.org>
* spi: img-spfi: Enable controller before starting TX DMAAndrew Bresticker2014-12-221-2/+2
| | | | | | | | It is recommended that the SPFI controller be enabled (i.e. setting SPFI_EN in SPFI_CONTROL) before TX DMA begins. Signed-off-by: Andrew Bresticker <abrestic@chromium.org> Signed-off-by: Mark Brown <broonie@kernel.org>
* spi: Replace CONFIG_PM_RUNTIME with CONFIG_PMRafael J. Wysocki2014-12-191-2/+2
| | | | | | | | | | | | | | | | A couple of new CONFIG_PM_RUNTIME users have been added recently in the SPI subsystem. However, 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/ (again). Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com> Acked-by: Mark Brown <broonie@kernel.org>
* spi: Add driver for IMG SPFI controllerAndrew Bresticker2014-11-171-0/+746
Add support for the Synchronous Peripheral Flash Interface (SPFI) master controller found on IMG SoCs. The SPFI controller supports 5 chip-select lines and single/dual/quad mode SPI transfers. Signed-off-by: Andrew Bresticker <abrestic@chromium.org> Signed-off-by: Mark Brown <broonie@kernel.org>