- 31 Aug, 2013 1 commit
-
-
Axel Lin authored
In the case spi_master_initialize_queue() fails, current code calls device_unregister() before return error from spi_register_master(). However, all the drivers call spi_master_put() in the error path if spi_register_master() fails. Thus we should call device_del() rather than device_unregister() before return error from spi_register_master(). This also makes all the spi_register_master() error handling consistent, because all other error paths of spi_register_master() expect drivers to call spi_master_put() if spi_register_master() fails. Signed-off-by:
Axel Lin <axel.lin@ingics.com> Signed-off-by:
Mark Brown <broonie@linaro.org>
-
- 22 Aug, 2013 3 commits
-
-
Axel Lin authored
We have tested master->running immediately after grab the master->queue_lock. The status of master->running won't be changed until we release the lock. Thus remove a redundant test for master->running. Signed-off-by:
Axel Lin <axel.lin@ingics.com> Signed-off-by:
Mark Brown <broonie@linaro.org>
-
Sourav Poddar authored
There is a bug in the following patch: http://comments.gmane.org/gmane.linux.kernel.spi.devel/14420 spi: DUAL and QUAD support fix the previous patch some mistake below: 1. DT in slave node, use "spi-tx-nbits = <1/2/4>" in place of using "spi-tx-dual, spi-tx-quad" directly, same to rx. So correct the previous way to get the property in @of_register_spi_devices(). 2. Change the value of transfer bit macro(SPI_NBITS_SINGLE, SPI_NBITS_DUAL SPI_NBITS_QUAD) to 0x01, 0x02 and 0x04 to match the actual wires. 3. Add the following check (1)keep the tx_nbits and rx_nbits in spi_transfer is not beyond the single, dual and quad. (2)keep tx_nbits and rx_nbits are contained by @spi_device->mode example: if @spi_device->mode = DUAL, then tx/rx_nbits can not be set to QUAD(SPI_NBITS_QUAD) (3)if "@spi_device->mode & SPI_3WIRE", then tx/rx_nbits should be in single(SPI_NBITS_SINGLE) Checking of the tx/rx transfer bits and mode bits should be done conditionally based on type of buffer filled else EINVAL condition will always get hit either for rx or tx. Signed-off-by:
Sourav Poddar <sourav.poddar@ti.com> Signed-off-by:
Mark Brown <broonie@linaro.org>
-
wangyuhang authored
fix the previous patch some mistake below: 1. DT in slave node, use "spi-tx-nbits = <1/2/4>" in place of using "spi-tx-dual, spi-tx-quad" directly, same to rx. So correct the previous way to get the property in @of_register_spi_devices(). 2. Change the value of transfer bit macro(SPI_NBITS_SINGLE, SPI_NBITS_DUAL SPI_NBITS_QUAD) to 0x01, 0x02 and 0x04 to match the actual wires. 3. Add the following check (1)keep the tx_nbits and rx_nbits in spi_transfer is not beyond the single, dual and quad. (2)keep tx_nbits and rx_nbits are contained by @spi_device->mode example: if @spi_device->mode = DUAL, then tx/rx_nbits can not be set to QUAD(SPI_NBITS_QUAD) (3)if "@spi_device->mode & SPI_3WIRE", then tx/rx_nbits should be in single(SPI_NBITS_SINGLE) Signed-off-by:
wangyuhang <wangyuhang2014@gmail.com> Signed-off-by:
Mark Brown <broonie@linaro.org>
-
- 14 Aug, 2013 1 commit
-
-
Gabor Juhos authored
Since the 'spi: Support transfer speed checking in the core' change, the SPI core validates the desired speed of a given transfer against the minimum and maximum speeds supported by the controller. If the speed of a transfer is not specified, the core uses the maximum speed of the actual SPI device. However if the maximum speed of the actual device is greater than the maximum speed of the controller, the core will reject the transfer due to the aforementioned change. Change the code to use the maximum speed of the controller by default if that is below the device's maximum speed. Signed-off-by:
Gabor Juhos <juhosg@openwrt.org> Signed-off-by:
Mark Brown <broonie@linaro.org>
-
- 29 Jul, 2013 1 commit
-
-
Mark Brown authored
Most SPI drivers that implement runtime PM support use identical code to do so: they acquire a runtime PM lock in prepare_transfer_hardware() and then they release it in unprepare_transfer_hardware(). The variations in this are mostly missing error checking and the choice to use autosuspend. Since these runtime PM calls are normally the only thing in the prepare and unprepare callbacks and the autosuspend API transparently does the right thing on devices with autosuspend disabled factor all of this out into the core with a flag to enable the behaviour. Signed-off-by:
Mark Brown <broonie@linaro.org> Reviewed-by:
Stephen Warren <swarren@nvidia.com> Acked-by:
Linus Walleij <linus.walleij@linaro.org>
-
- 18 Jul, 2013 1 commit
-
-
Sourav Poddar authored
Make spi core calculate the message length while populating the other transfer parameters. Usecase, driver can use it to populate framelength filed in their controller. Signed-off-by:
Sourav Poddar <sourav.poddar@ti.com> Signed-off-by:
Mark Brown <broonie@linaro.org>
-
- 15 Jul, 2013 2 commits
-
-
Mark Brown authored
Check that transfers are non-empty and that there is a completion for them. Signed-off-by:
Mark Brown <broonie@linaro.org>
-
Mark Brown authored
Allow drivers to avoid implementing their own checks for simple rates by specifying the limits in the master structure. Signed-off-by:
Mark Brown <broonie@linaro.org>
-
- 03 Jul, 2013 1 commit
-
-
Kees Cook authored
Calling kthread_run with a single name parameter causes it to be handled as a format string. Many callers are passing potentially dynamic string content, so use "%s" in those cases to avoid any potential accidents. Signed-off-by:
Kees Cook <keescook@chromium.org> Signed-off-by:
Andrew Morton <akpm@linux-foundation.org> Signed-off-by:
Linus Torvalds <torvalds@linux-foundation.org>
-
- 03 Jun, 2013 1 commit
-
-
Rafael J. Wysocki authored
The "runtime idle" helper routine, rpm_idle(), currently ignores return values from .runtime_idle() callbacks executed by it. However, it turns out that many subsystems use pm_generic_runtime_idle() which checks the return value of the driver's callback and executes pm_runtime_suspend() for the device unless that value is not 0. If that logic is moved to rpm_idle() instead, pm_generic_runtime_idle() can be dropped and its users will not need any .runtime_idle() callbacks any more. Moreover, the PCI, SCSI, and SATA subsystems' .runtime_idle() routines, pci_pm_runtime_idle(), scsi_runtime_idle(), and ata_port_runtime_idle(), respectively, as well as a few drivers' ones may be simplified if rpm_idle() calls rpm_suspend() after 0 has been returned by the .runtime_idle() callback executed by it. To reduce overall code bloat, make the changes described above. Tested-by:
Mika Westerberg <mika.westerberg@linux.intel.com> Tested-by:
Kevin Hilman <khilman@linaro.org> Signed-off-by:
Rafael J. Wysocki <rafael.j.wysocki@intel.com> Acked-by:
Kevin Hilman <khilman@linaro.org> Reviewed-by:
Ulf Hansson <ulf.hansson@linaro.org> Acked-by:
Alan Stern <stern@rowland.harvard.edu>
-
- 07 Apr, 2013 2 commits
-
-
Andreas Larsson authored
This makes sure that an error is returned on an incorrectly formed "cs-gpios" property, but reports success when the "cs-gpios" property is well formed or missing. When holes in the cs-gpios property phandle list is used to indicate that some other form of chipselect is to be used it is important that failure to read a broken "cs-gpios" property does not silently fail leading to the spi controller to use an unintended chipselect. Signed-off-by:
Andreas Larsson <andreas@gaisler.com> Signed-off-by:
Grant Likely <grant.likely@secretlab.ca>
-
Andreas Larsson authored
The return value from of_get_named_gpio is -ENOENT when the given index matches a hole in the "cs-gpios" property phandle list. However, the default value of cs_gpio in struct spi_device and entries of cs_gpios in struct spi_master is -EINVAL, which is documented to indicate that a GPIO line should not be used for the given spi_device. This sets the default value of cs_gpio in struct spi_device and entries of cs_gpios in struct spi_master to -ENOENT. Thus, -ENOENT is the only value used to indicate that no GPIO line should be used. Signed-off-by:
Andreas Larsson <andreas@gaisler.com> Signed-off-by:
Grant Likely <grant.likely@secretlab.ca>
-
- 01 Apr, 2013 3 commits
-
-
Rafael J. Wysocki authored
The ACPI handle of struct spi_master's dev member should not be set, because this causes that struct spi_master to be associated with the ACPI device node corresponding to its parent as the second "physical_device", which is incorrect (this happens during the registration of struct spi_master). Consequently, acpi_register_spi_devices() should use the ACPI handle of the parent of the struct spi_master it is called for rather than that struct spi_master's ACPI handle (which should be NULL). Make that happen and modify the spi-pxa2xx driver, which currently is the only driver for ACPI-enumerated SPI controller chips, not to set the ACPI handle for the struct spi_master it creates. Signed-off-by:
Rafael J. Wysocki <rafael.j.wysocki@intel.com> Acked-by:
Mika Westerberg <mika.westerberg@linux.intel.com> Acked-by:
Mark Brown <broonie@opensource.wolfsonmicro.com>
-
Bryan Freed authored
spi_pump_messages() calls into a controller driver with unprepare_transfer_hardware() which is documented as "This may sleep". As in the prepare_transfer_hardware() call below, we should release the queue_lock spinlock before making the call. Rework the logic a bit to hold queue_lock to protect the 'busy' flag, then release it to call unprepare_transfer_hardware(). Signed-off-by:
Bryan Freed <bfreed@chromium.org> Reviewed-by:
Doug Anderson <dianders@chromium.org> Signed-off-by:
Doug Anderson <dianders@chromium.org> Acked-by:
Linus Walleij <linus.walleij@linaro.org> Signed-off-by:
Mark Brown <broonie@opensource.wolfsonmicro.com>
-
Stephen Warren authored
Allow SPI masters to define the set of bits_per_word values they support. If they do this, then the SPI core will reject transfers that attempt to use an unsupported bits_per_word value. This eliminates the need for each SPI driver to implement this checking in most cases. Signed-off-by:
Stephen Warren <swarren@wwwdotorg.org> Signed-off-by:
Mark Brown <broonie@opensource.wolfsonmicro.com>
-
- 13 Feb, 2013 1 commit
-
-
Grant Likely authored
This patch replaces the horribly coded of_count_named_gpios() with a call to of_count_phandle_with_args() which is far more efficient. This also changes the return value of of_gpio_count() & of_gpio_named_count() from 'unsigned int' to 'int' so that it can return an error code. All the users of that function are fixed up to correctly handle a negative return value. v2: Split GPIO portion into a separate patch Tested-by:
Andreas Larsson <andreas@gaisler.com> Signed-off-by:
Grant Likely <grant.likely@secretlab.ca> Cc: Linus Walleij <linus.walleij@linaro.org> Cc: Rob Herring <rob.herring@calxeda.com>
-
- 10 Feb, 2013 1 commit
-
-
Andreas Larsson authored
Using memset does not set an array of integers properly. Replace with a loop to set each element properly. Signed-off-by:
Andreas Larsson <andreas@gaisler.com> Signed-off-by:
Grant Likely <grant.likely@secretlab.ca>
-
- 07 Feb, 2013 1 commit
-
-
Clark Williams authored
Move rt scheduler definitions out of include/linux/sched.h into new file include/linux/sched/rt.h Signed-off-by:
Clark Williams <williams@redhat.com> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Steven Rostedt <rostedt@goodmis.org> Link: http://lkml.kernel.org/r/20130207094707.7b9f825f@riff.lan Signed-off-by:
Ingo Molnar <mingo@kernel.org>
-
- 06 Feb, 2013 1 commit
-
-
Michał Mirosław authored
All in-kernel users of class_find_device() don't really need mutable data for match callback. In two places (kernel/power/suspend_test.c, drivers/scsi/osd/osd_uld.c) this patch changes match callbacks to use const search data. The const is propagated to rtc_class_open() and power_supply_get_by_name() parameters. Note that there's a dev reference leak in suspend_test.c that's not touched in this patch. Signed-off-by:
Michał Mirosław <mirq-linux@rere.qmqm.pl> Acked-by:
Grant Likely <grant.likely@secretlab.ca> Signed-off-by:
Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-
- 05 Feb, 2013 3 commits
-
-
Mark Brown authored
Use GFP_DMA in order to ensure that the memory we allocate for transfers in spi_write_then_read() can be DMAed. On most platforms this will have no effect. Signed-off-by:
Mark Brown <broonie@opensource.wolfsonmicro.com> Signed-off-by:
Grant Likely <grant.likely@secretlab.ca>
-
Laxman Dewangan authored
When spi client does the spi transfer and if it does not set the speed for each transfer then set it as default of spi device in spi core before calling low level transfer. This will remove the extra check in low level driver for setting speed. Signed-off-by:
Laxman Dewangan <ldewangan@nvidia.com> Signed-off-by:
Grant Likely <grant.likely@secretlab.ca>
-
Grant Likely authored
Linux assigns a number to each spi_master in the system, but when the platform used the device tree, the numbers are dynamically assigned and are not predictable. In general this shouldn't matter since the kernel doesn't use the bus number for anything other than matching a bus to spi_boardinfo (not used for DT). However, sometimes userspace needs to figure out which bus is which, so it makes sense to use the global /aliases namespace to choose a specific bus number. It is safe to derive the bus number from an alias because aliases will never cause two buses to try and use the same bus number. (At one time the cell-index property was used for this purpose, but cell-index has the risk of an id collision). Signed-off-by:
Grant Likely <grant.likely@secretlab.ca> Cc: Anatolij Gustschin <agust@denx.de> Cc: Mark Brown <broonie@opensource.wolfsonmicro.com>
-
- 15 Dec, 2012 1 commit
-
-
David Daney authored
To get modprobe to automatically load the proper modules, we need to prefix things with "spi:". Partially based on Grant Likely's suggestions. Signed-off-by:
David Daney <david.daney@cavium.com> [grant.likely: reworked because drivers/of/of_spi.c has been removed] Signed-off-by:
Grant Likely <grant.likely@secretlab.ca>
-
- 10 Dec, 2012 1 commit
-
-
Andreas Larsson authored
The spi support code works on SPARC too. No reason to exclude it from the party. Signed-off-by:
Andreas Larsson <andreas@gaisler.com> Acked-by:
David S. Miller <davem@davemloft.net> Signed-off-by:
Grant Likely <grant.likely@secretlab.ca>
-
- 07 Dec, 2012 2 commits
-
-
Grant Likely authored
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>
-
Lars-Peter Clausen authored
This patch allows to specify that a SPI device is connected in 3-wire mode via device tree. Signed-off-by:
Lars-Peter Clausen <lars@metafoo.de> Acked-by:
Rob Herring <rob.herring@calxeda.com> Signed-off-by:
Grant Likely <grant.likely@secretlab.ca>
-
- 06 Dec, 2012 2 commits
-
-
Grant Likely authored
Fix problem discovered with sparse: + drivers/spi/spi.c:1554:37: sparse: incompatible types in comparison expression (different signedness) drivers/spi/spi.c: In function 'spi_write_then_read': drivers/spi/spi.c:1554:23: warning: comparison of distinct pointer types lacks a cast [enabled by default] The change to SPI_BUFSIZ was introduced in commit b3a223ee , "spi: Remove SPI_BUFSIZ restriction on spi_write_then_read()" Cc: Mark Brown <broonie@opensource.wolfsonmicro.com> Reported-by:
kbuild test robot <fengguang.wu@intel.com> Signed-off-by:
Grant Likely <grant.likely@secretlab.ca>
-
Mark Brown authored
In order to avoid constantly allocating and deallocating there is a fixed buffer which spi_write_then_read() uses for transfers, with an early error check to ensure that the transfer fits within the buffer. This limits the size of transfers to this size, currently max(32, SMP_CACHE_BYTES). Since we can dynamically allocate and in fact already have a fallback to do so when there is contention for the fixed buffer remove this restriction and instead dynamically allocate a suitably sized buffer if the transfer won't fit. Signed-off-by:
Mark Brown <broonie@opensource.wolfsonmicro.com> Signed-off-by:
Grant Likely <grant.likely@secretlab.ca>
-
- 30 Nov, 2012 1 commit
-
-
Mika Westerberg authored
ACPI 5 introduced SPISerialBus resource that allows us to enumerate and configure the SPI slave devices behind the SPI controller. This patch adds support for this to the SPI core. In addition we bind ACPI nodes to SPI devices. This makes it possible for the slave drivers to get the ACPI handle for further configuration. Signed-off-by:
Mika Westerberg <mika.westerberg@linux.intel.com> Acked-by:
Grant Likely <grant.likely@secretlab.ca> Signed-off-by:
Rafael J. Wysocki <rafael.j.wysocki@intel.com>
-
- 29 Nov, 2012 1 commit
-
-
Alexander Sverdlin authored
Currently of_register_spi_devices() function registers all SPI devices, independetly from their status property in device tree. According to "ePAPR 1.1" spec, device should only be registered if there is no "status" property, or it has "ok" (or "okay") value (see of_device_is_available()). In case of "platform devices", of_platform_device_create_pdata() checks for "status" and ensures that disabled devices are not pupulated. But such check for SPI buses was missing until now. Fix it. Signed-off-by:
Alexander Sverdlin <alexander.sverdlin@sysgo.com> Signed-off-by:
Grant Likely <grant.likely@secretlab.ca>
-
- 21 Nov, 2012 1 commit
-
-
Jean-Christophe PLAGNIOL-VILLARD authored
This will allow to use gpio for chip select with no modification in the driver binding When use the cs-gpios, the gpio number will be passed via the cs_gpio field and the number of chip select will automatically increased with max(hw cs, gpio cs). So if for example the controller has 2 CS lines, and the cs-gpios property looks like this: cs-gpios = <&gpio1 0 0> <0> <&gpio1 1 0> <&gpio1 2 0>; Then it should be configured so that num_chipselect = 4 with the following mapping: cs0 : &gpio1 0 0 cs1 : native cs2 : &gpio1 1 0 cs3 : &gpio1 2 0 Signed-off-by:
Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com> Cc: devicetree-discuss@lists.ozlabs.org Cc: spi-devel-general@lists.sourceforge.net Signed-off-by:
Richard Genoud <richard.genoud@gmail.com> [grant.likely: fixed up type of cs count so min() can do type checking] Signed-off-by:
Grant Likely <grant.likely@secretlab.ca>
-
- 09 Nov, 2012 2 commits
-
-
Laxman Dewangan authored
Currently the master->setup() is called unconditionally. The assumption is that every driver need to implement this callback. This encourages drivers to populate empty functions to prevent crashing. This patch prevents the call of master->setup() if it is not populated. Signed-off-by:
Laxman Dewangan <ldewangan@nvidia.com> Signed-off-by:
Mark Brown <broonie@opensource.wolfsonmicro.com>
-
Laxman Dewangan authored
When spi client does the spi transfer and does not sets the bits_per_word for each transfer then set it as default of spi device in spi core before calling low level transfer. Removing the similar code from spi-tegra20-slink driver as it is not required. Signed-off-by:
Laxman Dewangan <ldewangan@nvidia.com> Signed-off-by:
Mark Brown <broonie@opensource.wolfsonmicro.com>
-
- 21 May, 2012 1 commit
-
-
Grant Likely authored
The modalias attribute of spi devices doesn't have the "spi:" prefix that is used in the UEVENT and in spi device drivers. This patch adds the prefix so the modprobe can correctly match modules to devices. Reported-by:
David Daney <david.daney@cavium.com> Signed-off-by:
Grant Likely <grant.likely@secretlab.ca>
-
- 20 May, 2012 1 commit
-
-
Grant Likely authored
Trivial simplification. Instead of requiring spi master drivers to always set the bus number (even when a dynamic number is desired), this patch modifies spi_alloc_master() to initialize num_chipselect to 1 (because there will always be at least one CS) and bus_num to -1 for dynamic allocation. This simplifies the code needed to be written for drivers. Signed-off-by:
Grant Likely <grant.likely@secretlab.ca>
-
- 11 May, 2012 1 commit
-
-
Shubhrajyoti D authored
Currently the prepare/unprepare transfer are called unconditionally. The assumption is that every driver using the spi core queue infrastructure has to populate the prepare and unprepare functions. This encourages drivers to populate empty functions to prevent crashing. This patch prevents the call to prepare/unprepare if not populated. Signed-off-by:
Shubhrajyoti D <shubhrajyoti@ti.com> Acked-by:
Linus Walleij <linus.walleij@linaro.org> [grant.likely: fix whitespace defect] Signed-off-by:
Grant Likely <grant.likely@secretlab.ca>
-
- 13 Apr, 2012 1 commit
-
-
Grant Likely authored
The SPI device tree support code isn't shared by any other subsystem. It can be moved into the core drivers/spi directory and the exported symbol can be removed. Signed-off-by:
Grant Likely <grant.likely@secretlab.ca> Cc: Rob Herring <rob.herring@calxeda.com>
-
- 15 Mar, 2012 1 commit
-
-
Guennadi Liakhovetski authored
The status variable is guaranteed to be 0 at that location anyway. Signed-off-by:
Guennadi Liakhovetski <g.liakhovetski@gmx.de> Signed-off-by:
Grant Likely <grant.likely@secretlab.ca>
-
- 11 Mar, 2012 1 commit
-
-
Dan Carpenter authored
We should release the lock here and enable IRQs before returning. Signed-off-by:
Dan Carpenter <dan.carpenter@oracle.com> [grant.likely: move unlock above dev_err() call] Signed-off-by:
Grant Likely <grant.likely@secretlab.ca>
-