History log of /drivers/spi/spi-xilinx.c
Revision Date Author Comments
9c0b8fd1a5493d0c5ab2fb147e758ca556e80863 13-Aug-2014 Michal Simek <michal.simek@xilinx.com> spi: xilinx: Remove .owner field for driver

There is no need to init .owner field.

Based on the patch from Peter Griffin <peter.griffin@linaro.org>
"mmc: remove .owner field for drivers using module_platform_driver"

This patch removes the superflous .owner field for drivers which
use the module_platform_driver API, as this is overriden in
platform_driver_register anyway."

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
4b153a2137c5d2914794c8944d78c731c1b0ae9d 10-Jul-2014 Lars-Peter Clausen <lars@metafoo.de> spi: xilinx: Use pdev->id instead of pdev->dev.id for the SPI bus number

The Xilinx SPI driver initializes the bus_num field of the SPI master to
pdev->dev.id. pdev->dev.id is always 0 for platform devices which causes bus
number conflicts for the SPI controller when creating multiple device instances
of the driver. Instead use pdev->id which will have the assignt platform device
id. If the device is instantiated via devicetree pdev->id is -1 which will cause
the SPI core to dynamically assign a id (or use the id defined via a alias in
the devicetree).

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Mark Brown <broonie@linaro.org>
6ff8672a96a01ec0861784b23be48a32443269f7 26-Feb-2014 Jingoo Han <jg1.han@samsung.com> spi: xilinx: remove unnecessary spaces

Remove unnecessary space in order to fix the following
checkpatch issues.

WARNING: Unnecessary space after function pointer name

Signed-off-by: Jingoo Han <jg1.han@samsung.com>
Reviewed-by: Michal Simek <monstr@monstr.eu>
Signed-off-by: Mark Brown <broonie@linaro.org>
9bf46f6df5d1e9db8b4b786d22e88d8b6edd949e 14-Feb-2014 Axel Lin <axel.lin@ingics.com> spi: xilinx: Convert to let spi core validate bits_per_word

Set bits_per_word_mask so spi core will reject transfers that attempt to use
an unsupported bits_per_word value.

spi_bitbang requires custom setup_transfer() to be defined if there is a
custom txrx_bufs(). Thus keep the empty xilinx_spi_setup_transfer() function
in the code.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Acked-by: Michal Simek <michal.simek@xilinx.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
3a44623d5e1404b29786f1afd225d1aa04a4ae90 21-Jan-2014 Paul Gortmaker <paul.gortmaker@windriver.com> spi: delete non-required instances of include <linux/init.h>

None of these files are actually using any __init type directives
and hence don't need to include <linux/init.h>. Most are just a
left over from __devinit and __cpuinit removal, or simply due to
code getting copied from one driver to the next.

Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
16735d022f72b20ddbb2274b8e109f69575e9b2b 14-Nov-2013 Wolfram Sang <wsa@the-dreams.de> tree-wide: use reinit_completion instead of INIT_COMPLETION

Use this new function to make code more comprehensible, since we are
reinitialzing the completion, not initializing.

[akpm@linux-foundation.org: linux-next resyncs]
Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
Acked-by: Linus Walleij <linus.walleij@linaro.org> (personally at LCE13)
Cc: Ingo Molnar <mingo@kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
702a4879ec337463f858c8ab467482cce260bf18 10-Sep-2013 Axel Lin <axel.lin@ingics.com> spi: bitbang: Let spi_bitbang_start() take a reference to master

Many drivers that use bitbang library have a leak on probe error paths.
This is because once a spi_master_get() call succeeds, we need an additional
spi_master_put() call to free the memory.

Fix this issue by moving the code taking a reference to master to
spi_bitbang_start(), so spi_bitbang_start() will take a reference to master on
success. With this change, the caller is responsible for calling
spi_bitbang_stop() to decrement the reference and spi_master_put() as
counterpart of spi_alloc_master() to prevent a memory leak.

So now we have below patten for drivers using bitbang library:

probe:
spi_alloc_master -> Init reference count to 1
spi_bitbang_start -> Increment reference count
remove:
spi_bitbang_stop -> Decrement reference count
spi_master_put -> Decrement reference count (reference count reaches 0)

Fixup all users accordingly.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Suggested-by: Uwe Kleine-Koenig <u.kleine-koenig@pengutronix.de>
Acked-by: Uwe Kleine-Koenig <u.kleine-koenig@pengutronix.de>
Signed-off-by: Mark Brown <broonie@linaro.org>
94c69f765f1b4a658d96905ec59928e3e3e07e6a 10-Sep-2013 Axel Lin <axel.lin@ingics.com> spi: bitbang: Let spi_bitbang_start() take a reference to master

Many drivers that use bitbang library have a leak on probe error paths.
This is because once a spi_master_get() call succeeds, we need an additional
spi_master_put() call to free the memory.

Fix this issue by moving the code taking a reference to master to
spi_bitbang_start(), so spi_bitbang_start() will take a reference to master on
success. With this change, the caller is responsible for calling
spi_bitbang_stop() to decrement the reference and spi_master_put() as
counterpart of spi_alloc_master() to prevent a memory leak.

So now we have below patten for drivers using bitbang library:

probe:
spi_alloc_master -> Init reference count to 1
spi_bitbang_start -> Increment reference count
remove:
spi_bitbang_stop -> Decrement reference count
spi_master_put -> Decrement reference count (reference count reaches 0)

Fixup all users accordingly.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Suggested-by: Uwe Kleine-Koenig <u.kleine-koenig@pengutronix.de>
Acked-by: Uwe Kleine-Koenig <u.kleine-koenig@pengutronix.de>
Signed-off-by: Mark Brown <broonie@linaro.org>
8074cf063e410a2c0cf1704c3b31002e21f5df7c 30-Jul-2013 Jingoo Han <jg1.han@samsung.com> spi: use dev_get_platdata()

Use the wrapper function for retrieving the platform data instead of
accessing dev->platform_data directly.

Signed-off-by: Jingoo Han <jg1.han@samsung.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
30af9b558a56200bda5febd140d5b826581d1f15 09-Aug-2013 Mark Brown <broonie@linaro.org> spi/bitbang: Drop empty setup() functions

Now that the bitbang core does not require a setup() function we can
drop the check in the altera, nuc900 and xilinx drivers.

Signed-off-by: Mark Brown <broonie@linaro.org>
9ca1273bb9d35c81bfb73215556bf794a73a2d83 17-Jul-2013 Dan Carpenter <dan.carpenter@oracle.com> spi/xilinx: signedness issue checking platform_get_irq()

In xilinx_spi_probe() we use xspi->irq to store negative error codes so
it has to be signed. We weren't going to use the upper bit any way so
this is fine.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
7b3b7432ae7848a269671921393148ff1aae3881 09-Jul-2013 Michal Simek <michal.simek@xilinx.com> spi/xilinx: Simplify irq allocation

Use devm_request_irq() for irq allocation which
simplify driver code.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
be3acdff943f46c32e9b2f453f0033bbae01a804 08-Jul-2013 Michal Simek <michal.simek@xilinx.com> spi/xilinx: Use of_property_read_u32 for reading value from node

It simplifies driver probing.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
ad3fdbcaf98dc1258f7ee1503703e7fcbc0d8d8e 08-Jul-2013 Michal Simek <michal.simek@xilinx.com> spi/xilinx: Clean ioremap calling

devm_ioremap_resource() automatically checks that
struct resource is initialized.
Also group platform_get_resource() and devm_ioremap_resource()
together.
And remove mem resource from struct xilinx_spi.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
5586c09e19b0dea5c1b4fd9838ca73575def223f 08-Jul-2013 Michal Simek <michal.simek@xilinx.com> spi/xilinx: Remove CONFIG_OF from the driver

dev.of_node is in struct device all the time.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
7cb2abd05fe1f9aea70b8ee38004b60bc882ffb5 05-Jul-2013 Mark Brown <broonie@linaro.org> spi/xilinx: Refer to platform device as pdev in probe() and remove()

This is a more traditional name and makes things a bit clearer when
referring to actual struct devices as we do frequently during probe().

Signed-off-by: Mark Brown <broonie@linaro.org>
Acked-by: Michal Simek <michal.simek@xilinx.com>
d81c0bbbf84086568b559bee59e4a93aba4a6e0f 03-Jul-2013 Mark Brown <broonie@linaro.org> spi/xilinx: Remove remains of of_platform device registration

In the past there used to be a separate platform device type for device
tree systems so the probe and removal functions were split into generic
and bus sections. Since this is no longer the case simplify the code (and
remove some unprototyped exports) by factoring everything into the bus
probe() and remove().

Signed-off-by: Mark Brown <broonie@linaro.org>
c40537d008ab1b4fe2f12641cca1462de10a95f7 01-Jul-2013 Mark Brown <broonie@linaro.org> spi/xilinx: Convert to devm_ioremap_resource()

Saves code and reduces the possibility of error.

Signed-off-by: Mark Brown <broonie@linaro.org>
e07619539017ac31004a038d1d886e2ed4d0e61a 10-Jul-2013 Michal Simek <michal.simek@xilinx.com> spi/xilinx: Revert master->setup function removal

master->setup() must be initialized to be able
to successfully run spi_bitbang_start()
and satisfy if/else logic there.

"spi: convert drivers to use bits_per_word_mask"
(sha1: 24778be20f87d5aadb19624fc768b3159fa43efc)

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
e33d085d11e54bc9fb07b2555cd104d8e7b3089b 09-Jun-2013 dan.carpenter@oracle.com <dan.carpenter@oracle.com> spi: spi-xilinx: cleanup a check in xilinx_spi_txrx_bufs()

'!' has higher precedence than comparisons so the original condition
is equivalent to "if (xspi->remaining_bytes == 0)". This makes the
static checkers complain.

xspi->remaining_bytes is signed and from looking at the code
briefly, I think it might be able to go negative. I suspect that
going negative may cause a bug, but I don't have the hardware and
can't test.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
913b19660e166e718d419cccd753c3990881f17c 31-May-2013 Sachin Kamat <sachin.kamat@linaro.org> spi: spi-xilinx: Remove redundant platform_set_drvdata()

Setting platform data to NULL is not necessary.
Also fixes the following sparse warning:
drivers/spi/spi-xilinx.c:508:35: warning: Using plain integer as NULL pointer

Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
Signed-off-by: Mark Brown <broonie@linaro.org>
082339bc63cccf8ea49b1f3cf4ee39ce00742849 04-Jun-2013 Michal Simek <michal.simek@xilinx.com> spi: spi-xilinx: Add run run-time endian detection

Do not load endian value from platform data
and rather autodetect it.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
68c315bb951d94210c43c52166d326f9c26f7ce8 04-Jun-2013 Peter Crosthwaite <peter.crosthwaite@petalogix.com> spi: spi-xilinx: Remove ISR race condition

The ISR currently consumes the rx buffer data and re-enables transmission
from within interrupt context. This is bad because if the interrupt
occurs again before the ISR exits, the new interrupt will be erroneously
cleared by the still completing ISR.

Simplified the ISR by just setting the completion variable and exiting with
no action. Then just looped the transmit functionality in
xilinx_spi_txrx_bufs().

Signed-off-by: Peter Crosthwaite <peter.crosthwaite@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
24778be20f87d5aadb19624fc768b3159fa43efc 22-May-2013 Stephen Warren <swarren@wwwdotorg.org> spi: convert drivers to use bits_per_word_mask

Fill in the recently added spi_master.bits_per_word_mask field in as
many drivers as possible. Make related cleanups, such as removing any
redundant error-checking, or empty setup callbacks.

Signed-off-by: Stephen Warren <swarren@wwwdotorg.org>
Acked-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
fd4a319bc933ae93e68935b21924a9ca4ba2d060 07-Dec-2012 Grant Likely <grant.likely@secretlab.ca> spi: Remove HOTPLUG section attributes

CONFIG_HOTPLUG is going away as an option. As result the __dev*
markings will be going away.

Remove use of __devinit, __devexit_p, __devinitdata, __devinitconst,
and __devexit.

Bill Pemberton has done most of the legwork on this series. I've used
his script to purge the attributes from the drivers/gpio tree.

Reported-by: Bill Pemberton <wfp5p@virginia.edu>
Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
940ab88962bc1aff3273a8356d64577a6e386736 05-Oct-2011 Grant Likely <grant.likely@secretlab.ca> drivercore: Add helper macro for platform_driver boilerplate

For simple modules that contain a single platform_driver without any
additional setup code then ends up being a block of duplicated
boilerplate. This patch adds a new macro, module_platform_driver(),
which replaces the module_init()/module_exit() registrations with
template functions.

Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
Acked-by: Greg Kroah-Hartman <gregkh@suse.de>
Reviewed-by: Magnus Damm <magnus.damm@gmail.com>
Reviewed-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Reviewed-by: Stephen Boyd <sboyd@codeaurora.org>
ca632f556697d45d67ed5cada7cedf3ddfe0db4b 06-Jun-2011 Grant Likely <grant.likely@secretlab.ca> spi: reorganize drivers

Sort the SPI makefile and enforce the naming convention spi_*.c for
spi drivers.

This change also rolls the contents of atmel_spi.h into the .c file
since there is only one user of that particular include file.

v2: - Use 'spi-' prefix instead of 'spi_' to match what seems to be
be the predominant pattern for subsystem prefixes.
- Clean up filenames in Kconfig and header comment blocks

Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
Acked-by: Wolfram Sang <w.sang@pengutronix.de>
Acked-by: Linus Walleij <linus.walleij@linaro.org>