Commit graph

11 commits

Author SHA1 Message Date
Rafał Miłecki
3a41092709
spi: bcm53xx: simplify reading SPI data
This commit makes transfer function use spi_transfer_is_last to
determine if currently processed transfer is the last one. Thanks to
that we finally set hardware registers properly and it makes controller
behave the way it's expected to.

This allows simplifying read function which can now simply start reading
from the slot 0 instead of the last saved offset. It has been
successfully tested using spi_write_then_read.

Moreover this change fixes handling messages with two writing transfers.
It's important for SPI flash devices as their drivers commonly use one
transfer for a command and another one for data.

Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
Signed-off-by: Mark Brown <broonie@kernel.org>
2018-01-03 11:39:16 +00:00
Rafał Miłecki
e360e72e71 spi: bcm53xx: (re)license code to the GPL v2
My intention was to release this code under GPL v2 license. For some
reason my initial commit 0fc6a323e1 ("spi: bcm53xx: driver for SPI
controller on Broadcom bcma SoC") totally missed licensing info.
MODULE_LICENSE was later added by Axel specifying "GNU Public License
v2 or later".

This patch clarifies situation by adding a proper header (with Copyright
line) and adjusting MODULE_LICENSE. It should be acked by every driver
contributor.

Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
Acked-by: Nicholas Mc Guire <hofrat@osadl.org>
Reviewed-by: Jingoo Han <jingoohan1@gmail.com>
Acked-by: Jingoo Han <jingoohan1@gmail.com>
Acked-by: Joe Perches <joe@perches.com>
Acked-by: Axel Lin <axel.lin@ingics.com>
Acked-by: Vaishali Thakkar <vaishali.thakkar@oracle.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2017-01-06 18:21:50 +00:00
Rafał Miłecki
78d759dace spi: bcm53xx: set of_node to let DT specify device(s)
Setting of_node of master's dev seems to be a common way of letting it
work nicely with DT. This allows specifying device there instead of
hardcoding one in the driver code.

This was successfully tested with commit 1b47b98acc ("ARM: BCM5301X:
Add DT entry for SPI controller and NOR flash")

Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
Signed-off-by: Mark Brown <broonie@kernel.org>
2016-12-31 18:36:53 +00:00
Rafał Miłecki
a7b221d8f0 spi: bcm53xx: add spi_flash_read callback for MMIO-based reads
This implements more efficient reads of SPI-attached flash content.

Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2016-04-18 13:53:46 +01:00
Vaishali Thakkar
6774eea6d7 spi: bcm53xx: Adjust devm usage
Remove use of spi_unregister_master in remove function as
devm_spi_register_master in probe function automatically
handles it. To be compatible with the change, use direct
return instead of goto and remove unnedded label out.

Also, remove bcm53xxspi_bcma_remove as it is now redundant.

Signed-off-by: Vaishali Thakkar <vthakkar1994@gmail.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2015-09-16 17:42:28 +01:00
Mark Brown
f9de73426c Merge remote-tracking branches 'spi/topic/atmel', 'spi/topic/bcm2385', 'spi/topic/bcm2835', 'spi/topic/bcm53xx' and 'spi/topic/bitbang' into spi-next 2015-04-11 23:09:03 +01:00
Joe Perches
f7219b527b treewide: Remove unnecessary BCMA_CORETABLE_END macro
Use the normal {} instead of a macro to terminate an array.

Remove the macro too.

Signed-off-by: Joe Perches <joe@perches.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2015-02-11 14:38:28 -08:00
Nicholas Mc Guire
b3e7766bc4 spi: bcm53xx: use msecs_to_jiffies for conversion
Converting milliseconds to jiffies by "val * HZ / 1000" is technically
ok but msecs_to_jiffies(val) is the cleaner solution and handles all
corner cases correctly.

This is only an API consolidation and should make things more readable

Signed-off-by: Nicholas Mc Guire <hofrat@osadl.org>
Signed-off-by: Mark Brown <broonie@kernel.org>
2015-02-11 10:14:25 +08:00
Axel Lin
61d38b9a82 spi: bcm53xx: Add missing module information
Mainly to fix missing MODULE_LICENSE.
Also add MODULE_DESCRIPTION and MODULE_AUTHOR.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2014-09-26 09:08:10 +01:00
Jingoo Han
050429a78b spi: bcm53xx: make local symbol static
Make local symbol static, because this is used only in this file.

Signed-off-by: Jingoo Han <jg1.han@samsung.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2014-08-29 12:48:41 +01:00
Rafał Miłecki
0fc6a323e1 spi: bcm53xx: driver for SPI controller on Broadcom bcma SoC
Broadcom 53xx ARM SoCs use bcma bus that contains various cores (AKA
devices). If board has a serial flash, it's connected over SPI and the
bcma bus includes a SPI controller. Example log from such a board:
bus0: Found chip with id 53010, rev 0x00 and package 0x02
(...)
bus0: Core 18 found: SPI flash controller (manuf 0x4BF, id 0x50A, rev 0x01, class 0x0)

This patch adds a bcma driver for SPI core, it registers SPI master
controller and "bcm53xxspiflash" SPI device.

Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
2014-08-19 11:30:55 -05:00