14 Apr, 2009
1 commit
-
The "simplify spi_write_then_read()" patch included two regressions from
the 2.6.27 behaviors:- The data it wrote out during the (full duplex) read side
of the transfer was not zeroed.- It fails completely on half duplex hardware, such as
Microwire and most "3-wire" SPI variants.So, revert that patch. A revised version should be submitted at some
point, which can get the speedup on standard hardware (full duplex)
without breaking on less-capable half-duplex stuff.Signed-off-by: David Brownell
Cc: [2.6.28.x, 2.6.29.x]
Signed-off-by: Andrew Morton
Signed-off-by: Linus Torvalds
07 Jan, 2009
1 commit
-
Acked-by: David Brownell
Signed-off-by: Kay Sievers
Signed-off-by: Greg Kroah-Hartman
17 Oct, 2008
2 commits
-
Make the SPI external GPIO expander drivers register themselves at
subsys_initcall() time when they're statically linked, and make the SPI
core do its driver model initialization earlier so that's safe.SOC-integrated GPIOs are available starting very early -- often before
initcalls start to run, or earily in arch_initcall() at latest -- so this
improves consistency, letting more subsystems rely on GPIOs being usable
by their own subsys_initcall() code.Signed-off-by: David Brownell
Signed-off-by: Andrew Morton
Signed-off-by: Linus Torvalds -
Modify spi_write_then_read() to use one transfer. This speeds up all
callers, and is a minor code shrink.Signed-off-by: Vernon Sauder
Signed-off-by: David Brownell
Signed-off-by: Andrew Morton
Signed-off-by: Linus Torvalds
15 Aug, 2008
1 commit
-
When reviewing a recent patch I noticed a potential trouble spot in the
registration of new SPI devices. The SPI master driver is told to set
the device up before adding it to the driver model, so that it's always
properly set up when probe() is called. (This is important, because in
the case of inverted chipselects, this device can make the bus misbehave
until it's properly deselected. It's got to be set up even if no driver
binds to the device.)The trouble spot is that it doesn't first verify that no other device
has been added using that chipselect. If such a device has been added,
its configuration gets trashed. (Fortunately this has not been a common
error!)The fix here adds an explicit check, and a mutex to protect the relevant
critical region.[akpm@linux-foundation.org: make the lock local to spi_add_device()]
Signed-off-by: David Brownell
Signed-off-by: Andrew Morton
Signed-off-by: Linus Torvalds
26 Jul, 2008
1 commit
-
spi_new_device() allocates and registers an spi device all in one swoop.
If the driver needs to add extra data to the spi_device before it is
registered, then this causes problems. This is needed for OF device
tree support so that the SPI device tree helper can add a pointer to
the device node after the device is allocated, but before the device
is registered. OF aware SPI devices can then retrieve data out of the
device node to populate a platform data structure.This patch splits the allocation and registration portions of code out
of spi_new_device() and creates two new functions; spi_alloc_device()
and spi_register_device(). spi_new_device() is modified to use the new
functions for allocation and registration. None of the existing users
of spi_new_device() should be affected by this change.Drivers using the new API can forego the use of spi_board_info
structure to describe the device layout and populate data into the
spi_device structure directly.This change is in preparation for adding an OF device tree parser to
generate spi_devices based on data in the device tree.Signed-off-by: Grant Likely
Acked-by: David Brownell
25 Jul, 2008
1 commit
-
Currently, 'modalias' in the spi_device structure is a 'const char *'.
The spi_new_device() function fills in the modalias value from a passed in
spi_board_info data block. Since it is a pointer copy, the new spi_device
remains dependent on the spi_board_info structure after the new spi_device
is registered (no other fields in spi_device directly depend on the
spi_board_info structure; all of the other data is copied).This causes a problem when dynamically propulating the list of attached
SPI devices. For example, in arch/powerpc, the list of SPI devices can be
populated from data in the device tree. With the current code, the device
tree adapter must kmalloc() a new spi_board_info structure for each new
SPI device it finds in the device tree, and there is no simple mechanism
in place for keeping track of these allocations.This patch changes modalias from a 'const char *' to a fixed char array.
By copying the modalias string instead of referencing it, the dependency
on the spi_board_info structure is eliminated and an outside caller does
not need to maintain a separate spi_board_info allocation for each device.If searched through the code to the best of my ability for any references
to modalias which may be affected by this change and haven't found
anything. It has been tested with the lite5200b platform in arch/powerpc.[dbrownell@users.sourceforge.net: cope with linux-next changes: KOBJ_NAME_LEN obliterated, etc]
Signed-off-by: Grant Likely
Signed-off-by: David Brownell
Signed-off-by: Andrew Morton
Signed-off-by: Linus Torvalds
22 Jul, 2008
1 commit
-
This mirrors the functionality that driver_find_device has as well.
We add a start variable, and all callers of the function are fixed up at
the same time.The block layer will be using this new functionality in a follow-on
patch.Cc: Kay Sievers
Signed-off-by: Greg Kroah-Hartman
07 Feb, 2008
2 commits
-
Don't update dev->power.power_state any more in the SPI core. The only
reason to update this scheduled-to-be-removed field was to make the
already-removed /sys/devices/.../power/state files work better.Signed-off-by: David Brownell
Signed-off-by: Andrew Morton
Signed-off-by: Linus Torvalds -
Nothing should ever include this file.
Signed-off-by: Ralf Baechle
Acked-by: "Mike Frysinger"
Acked-by: "Bryan Wu"
Signed-off-by: Andrew Morton
Signed-off-by: Linus Torvalds
25 Jan, 2008
1 commit
-
Convert to use the class iteration api.
Signed-off-by: Dave Young
Acked-by: David Brownell
Signed-off-by: Greg Kroah-Hartman
06 Dec, 2007
2 commits
-
Simplify spi_sync calling convention, eliminating the need to check both
the return value AND the message->status. In consequence, this corrects
misbehaviours of spi_read and spi_write (which only checked the former) and
their callers.Signed-off-by: Marc Pignat
Signed-off-by: David Brownell
Signed-off-by: Andrew Morton
Signed-off-by: Linus Torvalds -
Make spi_write_then_read() use a mutex not a binary semaphore.
Signed-off-by: David Brownell
Signed-off-by: Andrew Morton
Signed-off-by: Linus Torvalds
15 Nov, 2007
1 commit
-
After 49dce689ad4ef0fd1f970ef762168e4bd46f69a3, device_for_each_child
iteration hits the master device itself. Do not call spi_unregister_device()
for the master device.Signed-off-by: Atsushi Nemoto
Acked-by: David Brownell
Cc:
Signed-off-by: Andrew Morton
Signed-off-by: Linus Torvalds
17 Oct, 2007
1 commit
-
Make the SPI framework and drivers stop using class_device. Update docs
accordingly ... highlighting just which sysfs paths should be
"safe"/stable.Signed-off-by: Tony Jones
Signed-off-by: David Brownell
Cc: Greg KH
Signed-off-by: Andrew Morton
Signed-off-by: Linus Torvalds
13 Oct, 2007
1 commit
-
This changes the uevent buffer functions to use a struct instead of a
long list of parameters. It does no longer require the caller to do the
proper buffer termination and size accounting, which is currently wrong
in some places. It fixes a known bug where parts of the uevent
environment are overwritten because of wrong index calculations.Many thanks to Mathieu Desnoyers for finding bugs and improving the
error handling.Signed-off-by: Kay Sievers
Cc: Mathieu Desnoyers
Cc: Cornelia Huck
Signed-off-by: Greg Kroah-Hartman
01 Aug, 2007
1 commit
-
This updates some error reporting paths in SPI device setup:
- Move validation logic for SPI chipselects to spi_new_device(),
which is where it should always have been.- In spi_new_device(), emit error messages if the device can't
be created. This is LOTS better than a silent failure; though
eventually, the calling convention should probably change to
use the conventions.- Includes one previously-missing check: SPI masters must always
have at least one chipselect, even for dedicated busses which
always keep it selected!It also adds a FIXME (IDR for dynamic ID allocation) so the issue doesn't live
purely in my mailbox.Signed-off-by: David Brownell
Signed-off-by: Andrew Morton
Signed-off-by: Linus Torvalds
22 Jul, 2007
1 commit
-
WARNING: drivers/built-in.o(.text+0x889735): Section mismatch: reference to .init.text:scan_boardinfo (between 'spi_register_master' and '__unregister')
Signed-off-by: Adrian Bunk
Acked-by: David Brownell
Signed-off-by: Andrew Morton
Signed-off-by: Linus Torvalds
18 Jul, 2007
1 commit
-
The SPI core/init code uses a semaphore as mutex. Use the mutex API instead
of the (binary) semaphore.Signed-off-by: Matthias Kaehlcke
Acked-by: David Brownell
Signed-off-by: Andrew Morton
Signed-off-by: Linus Torvalds
05 Jun, 2007
1 commit
-
Fix SPI dynamic bus ID assignment to start at 2^15-1 rather than a negative
number. Valid bus ids are supposed to be positive, and are (now) stored in
an 's16' value.Signed-off-by: David Brownell
Signed-off-by: Andrew Morton
Signed-off-by: Linus Torvalds
09 May, 2007
1 commit
-
Various documentation updates for the SPI infrastructure, to clarify things
that may not have been clear, to cope with lack of editing, and fix
omissions.Also, plug SPI into the kernel-api DocBook template, and fix all the
resulting glitches in document generation.Signed-off-by: David Brownell
Cc: "Randy.Dunlap"
Signed-off-by: Andrew Morton
Signed-off-by: Linus Torvalds
28 Mar, 2007
1 commit
-
WARNING: drivers/built-in.o - Section mismatch: reference to .init.text:spi_register_master from .text between 'spi_bitbang_start' (at offset 0x84e11a) and 'bitbang_work'
WARNING: drivers/built-in.o - Section mismatch: reference to .init.text:spi_alloc_master from .text between 'butterfly_attach' (at offset 0x84e681) and 'at25_remove'
WARNING: drivers/built-in.o - Section mismatch: reference to .init.text:spi_new_device from .text between 'butterfly_attach' (at offset 0x84e7e4) and 'at25_remove'Signed-off-by: Adrian Bunk
Signed-off-by: David Brownell
Signed-off-by: Andrew Morton
Signed-off-by: Linus Torvalds
13 Feb, 2007
1 commit
-
I'd like to assign NULL to kfree()d members of a structure. I can't do
that without ugly casting (see the PXA patch) when the structure pointed to
is const-qualified. I don't really see a reason why the cleanup method
isn't allowed to alter the object it should clean up. :-)No, I didn't test the PXA patch, but I verified that the NULL-assignment
doesn't stop me from doing rmmod/insmodding my own spi_bitbang-based
driver.Signed-off-by: Hans-Peter Nilsson
Signed-off-by: David Brownell
Signed-off-by: Andrew Morton
Signed-off-by: Linus Torvalds
08 Feb, 2007
2 commits
-
This reverts commit 2943ecf2ed32632473c06f1975db47a7aa98c10f.
This should go through the SPI maintainer, it was my fault that it did
not. Especially as it conflicts with other patches he has pending.Signed-off-by: Greg Kroah-Hartman
-
Converts from using struct "class_device" to "struct device" making
everything show up properly in /sys/devices/ with symlinks from the
/sys/class directory.Cc:
Signed-off-by: Greg Kroah-Hartman
27 Jan, 2007
1 commit
-
If a SPI master device exists, udev (udevtrigger) causes kernel crash, due
to wrong kobj pointer in kobject_uevent_env(). This problem was not in
2.6.19.The backtrace (on MIPS) was:
[] kobject_uevent_env+0x54c/0x5e8
[] store_uevent+0x1c/0x3c (in drivers/class.c)
[] subsys_attr_store+0x2c/0x50
[] flush_write_buffer+0x38/0x5c
[] sysfs_write_file+0xd0/0x190
[] vfs_write+0xc4/0x1a0
[] sys_write+0x54/0xa0
[] stack_done+0x20/0x3cflush_write_buffer() passes kobject of spi_master_class.subsys to
subsys_addr_store(), then subsys_addr_store() passes a pointer to a struct
subsystem to store_uevent() which expects a pointer to a struct
class_device. The problem seems subsys_attr_store() called instead of
class_device_attr_store().This mismatch was caused by commit
3bd0f6943520e459659d10f3282285e43d3990f1, which overrides kset of master
class. This made spi_master_class.subsys.kset.ktype NULL so
subsys_sysfs_ops is used instead of class_dev_sysfs_ops.The commit was to fix spi_busnum_to_master(). Here is a patch fixes
this function in other way, just searching children list of
class_device.Signed-off-by: Atsushi Nemoto
Signed-off-by: David Brownell
Signed-off-by: Andrew Morton
Signed-off-by: Linus Torvalds
08 Dec, 2006
4 commits
-
In order for spi_busnum_to_master to work spi master devices must be linked
into the spi_master_class.subsys.kset list. At the moment the default
class_obj_subsys.kset is used and we can't enumerate the master devices.Signed-off-by: Hans-Christian Egtvedt
Cc: David Brownell
Signed-off-by: Andrew Morton
Signed-off-by: Linus Torvalds -
Correct the following in driver/spi/spi.c in function spi_busnum_to_master:
* must allow bus_num 0, the if is really not needed.
* correct the name buffer which is too small for bus_num >= 10000. Itshould be 9 bytes big, not 8.
Signed-off-by: Hans-Christian Egtvedt
Cc: David Brownell
Signed-off-by: Andrew Morton
Signed-off-by: Linus Torvalds -
Signed-off-by: Jeff Garzik
Cc: David Brownell
Signed-off-by: Andrew Morton
Signed-off-by: Linus Torvalds -
SLAB_KERNEL is an alias of GFP_KERNEL.
Signed-off-by: Christoph Lameter
Signed-off-by: Andrew Morton
Signed-off-by: Linus Torvalds
04 Nov, 2006
1 commit
-
WARNING: vmlinux - Section mismatch: reference to .init.text:spi_register_board_info from __ksymtab_gpl between '__ksymtab_spi_register_board_info' (at offset 0xc032f7d0) and '__ksymtab_spi_alloc_master'
Fix this by removing the export.
Acked-by: David Brownell
Signed-off-by: Andrew Morton
Signed-off-by: Linus Torvalds
04 Jul, 2006
1 commit
-
lockdep needs to have the waitqueue lock initialized for on-stack waitqueues
implicitly initialized by DECLARE_COMPLETION(). Annotate on-stack completions
accordingly.Has no effect on non-lockdep kernels.
Signed-off-by: Ingo Molnar
Signed-off-by: Andrew Morton
Signed-off-by: Linus Torvalds
29 Jun, 2006
1 commit
-
This patch adds earlier initialization of spi_device.mode, as needed
on boards using nondefault chipselect polarity. An example would be
ones using the RS5C348 RTC without an external signal inverter between
the RTC chipselect and the SPI controller.Without this mechanism, the first setup() call for that chip would
wrongly enable chips, corrupting transfers to/from other chips sharing
that SPI bus.Signed-off-by: David Brownell
Signed-off-by: Linus Torvalds
22 May, 2006
1 commit
-
Because several developers asked me about referenced but missing
spi_add_master(), I think that this patch should be applied ... it
corrects comments so they refer to spi_register_master() instead.Signed-off-by: dmitry pervushin
Signed-off-by: David Brownell
Signed-off-by: Andrew Morton
Signed-off-by: Linus Torvalds
17 May, 2006
2 commits
-
We need to be able to have a "SPI bus 0" matching chip numbering; but
that number was wrongly used to flag dynamic allocation of a bus number.This patch resolves that issue; now negative numbers trigger dynamic alloc.
It also updates the how-to-write-a-controller-driver overview to mention
this stuff.Signed-off-by: David Brownell
Signed-off-by: Greg Kroah-Hartman -
Make sure that spi_write_then_read() can always handle at least 32 bytes
of transfer (total, both directions), minimizing one portability issue.Signed-off-by: David Brownell
Signed-off-by: Greg Kroah-Hartman
21 Feb, 2006
1 commit
-
Fix two problems in the spi subsystem:
1) spi subsystem core dumps when modular spi master is unloaded.
2) spi subsystem core dumps when spi slave device is suspended/resumed and
module slave driver is not loaded.Signed-off-by: Stephen Street
Signed-off-by: David Brownell
Cc: Greg KH
Signed-off-by: Andrew Morton
Signed-off-by: Linus Torvalds
14 Jan, 2006
3 commits
-
gcc4 generates warnings when a non-FASTCALL function pointer is assigned to a
FASTCALL one. Perhaps it has taste.Cc: David Brownell
Signed-off-by: Andrew Morton
Signed-off-by: Greg Kroah-Hartman -
This makes the SPI core and its users access transfers in the SPI message
structure as linked list not as an array, as discussed on LKML.From: David Brownell
Updates including doc, bugfixes to the list code, add
spi_message_add_tail(). Plus, initialize things _before_ grabbing the
locks in some cases (in case it grows more expensive). This also merges
some bitbang updates of mine that didn't yet make it into the mm tree.Signed-off-by: Vitaly Wool
Signed-off-by: Dmitry Pervushin
Signed-off-by: David Brownell
Signed-off-by: Andrew Morton
Signed-off-by: Greg Kroah-Hartman -
This includes various updates to the SPI core:
- Fixes a driver model refcount bug in spi_unregister_master() paths.
- The spi_master structures now have wrappers which help keep drivers
from needing class-level get/put for device data or for refcounts.- Check for a few setup errors that would cause oopsing later.
- Docs say more about memory management. Highlights the use of DMA-safe
i/o buffers, and zero-initializing spi_message and such metadata.- Provide a simple alloc/free for spi_message and its spi_transfer;
this is only one of the possible memory management policies.Nothing to break code that already works.
Signed-off-by: David Brownell
Signed-off-by: Andrew Morton
Signed-off-by: Greg Kroah-Hartman