<feed xmlns='http://www.w3.org/2005/Atom'>
<title>linux-toradex.git/drivers/spi, branch v2.6.20.2</title>
<subtitle>Linux kernel for Apalis and Colibri modules</subtitle>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/'/>
<entry>
<title>[PATCH] SPI: alternative fix for spi_busnum_to_master</title>
<updated>2007-01-26T21:50:58+00:00</updated>
<author>
<name>Atsushi Nemoto</name>
<email>anemo@mba.ocn.ne.jp</email>
</author>
<published>2007-01-26T08:56:54+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=1e9a51dca19dc1d8807c63cb3bd4413d3f95aaf5'/>
<id>1e9a51dca19dc1d8807c63cb3bd4413d3f95aaf5</id>
<content type='text'>
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:
[&lt;8024db6c&gt;] kobject_uevent_env+0x54c/0x5e8
[&lt;802a8264&gt;] store_uevent+0x1c/0x3c  (in drivers/class.c)
[&lt;801cb14c&gt;] subsys_attr_store+0x2c/0x50
[&lt;801cb80c&gt;] flush_write_buffer+0x38/0x5c
[&lt;801cb900&gt;] sysfs_write_file+0xd0/0x190
[&lt;80181444&gt;] vfs_write+0xc4/0x1a0
[&lt;80181cdc&gt;] sys_write+0x54/0xa0
[&lt;8010dae4&gt;] stack_done+0x20/0x3c

flush_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 &lt;anemo@mba.ocn.ne.jp&gt;
Signed-off-by: David Brownell &lt;dbrownell@users.sourceforge.net&gt;
Signed-off-by: Andrew Morton &lt;akpm@osdl.org&gt;
Signed-off-by: Linus Torvalds &lt;torvalds@linux-foundation.org&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
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:
[&lt;8024db6c&gt;] kobject_uevent_env+0x54c/0x5e8
[&lt;802a8264&gt;] store_uevent+0x1c/0x3c  (in drivers/class.c)
[&lt;801cb14c&gt;] subsys_attr_store+0x2c/0x50
[&lt;801cb80c&gt;] flush_write_buffer+0x38/0x5c
[&lt;801cb900&gt;] sysfs_write_file+0xd0/0x190
[&lt;80181444&gt;] vfs_write+0xc4/0x1a0
[&lt;80181cdc&gt;] sys_write+0x54/0xa0
[&lt;8010dae4&gt;] stack_done+0x20/0x3c

flush_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 &lt;anemo@mba.ocn.ne.jp&gt;
Signed-off-by: David Brownell &lt;dbrownell@users.sourceforge.net&gt;
Signed-off-by: Andrew Morton &lt;akpm@osdl.org&gt;
Signed-off-by: Linus Torvalds &lt;torvalds@linux-foundation.org&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>[PATCH] spi: fix error setting the spi mode in pxa2xx_spi.c</title>
<updated>2007-01-26T21:50:57+00:00</updated>
<author>
<name>Justin Clacherty</name>
<email>justin@redfish-group.com</email>
</author>
<published>2007-01-26T08:56:44+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=7f6ee1adc75bf31d1b76814338f76a88e653cb60'/>
<id>7f6ee1adc75bf31d1b76814338f76a88e653cb60</id>
<content type='text'>
Currently the spi mode can be set to the wrong mode if you are switching
from any mode other than mode 0.  This is because the mode is set using a
bitwise or on uncleared bits.  The following patch clears the mode bits
before setting the new mode.  I've also modified it to use the appropriate
defines from pxa-regs.h for readability.

Signed-off-by: Justin Clacherty &lt;justin@redfish-group.com&gt;
Signed-off-by: David Brownell &lt;dbrownell@users.sourceforge.net&gt;
Signed-off-by: Andrew Morton &lt;akpm@osdl.org&gt;
Signed-off-by: Linus Torvalds &lt;torvalds@linux-foundation.org&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Currently the spi mode can be set to the wrong mode if you are switching
from any mode other than mode 0.  This is because the mode is set using a
bitwise or on uncleared bits.  The following patch clears the mode bits
before setting the new mode.  I've also modified it to use the appropriate
defines from pxa-regs.h for readability.

Signed-off-by: Justin Clacherty &lt;justin@redfish-group.com&gt;
Signed-off-by: David Brownell &lt;dbrownell@users.sourceforge.net&gt;
Signed-off-by: Andrew Morton &lt;akpm@osdl.org&gt;
Signed-off-by: Linus Torvalds &lt;torvalds@linux-foundation.org&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>[PATCH] S3C24XX: fix passing spi chipselect to select routine</title>
<updated>2007-01-26T21:50:57+00:00</updated>
<author>
<name>Ben Dooks</name>
<email>ben-linux@fluff.org</email>
</author>
<published>2007-01-26T08:56:43+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=8736b9270c2f8993ca44c30f64d4c6d25e379687'/>
<id>8736b9270c2f8993ca44c30f64d4c6d25e379687</id>
<content type='text'>
It turns out that the spi chipselect was not being passed to the set_cs
routine if one was specified in the platform data.

As part of the fix, change to using a set_cs field in the controller state,
and put a default gpio routine in if the data passed does not specify it.

Also remove the //#define DEBUG

Signed-off-by: Ben Dooks &lt;ben-linux@fluff.org&gt;
Signed-off-by: David Brownell &lt;dbrownell@users.sourceforge.net&gt;
Signed-off-by: Andrew Morton &lt;akpm@osdl.org&gt;
Signed-off-by: Linus Torvalds &lt;torvalds@linux-foundation.org&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
It turns out that the spi chipselect was not being passed to the set_cs
routine if one was specified in the platform data.

As part of the fix, change to using a set_cs field in the controller state,
and put a default gpio routine in if the data passed does not specify it.

Also remove the //#define DEBUG

Signed-off-by: Ben Dooks &lt;ben-linux@fluff.org&gt;
Signed-off-by: David Brownell &lt;dbrownell@users.sourceforge.net&gt;
Signed-off-by: Andrew Morton &lt;akpm@osdl.org&gt;
Signed-off-by: Linus Torvalds &lt;torvalds@linux-foundation.org&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>[PATCH] spi_s3c24xx_gpio: use right header</title>
<updated>2006-12-30T18:56:43+00:00</updated>
<author>
<name>Arnaud Patard (Rtp</name>
<email>arnaud.patard@rtp-net.org</email>
</author>
<published>2006-12-30T00:49:10+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=e2a5d2f9b3e6011093a7587e0e18d653fb050a36'/>
<id>e2a5d2f9b3e6011093a7587e0e18d653fb050a36</id>
<content type='text'>
Russel King recently reminded us that one shouldn't use asm/arch/hardware.h
but one should use asm/hardware.h.  Unfortunately, the spi_s3c24xx_gpio
driver is using the wrong header.  This patch is fixing that.

Signed-off-by: Arnaud Patard &lt;arnaud.patard@rtp-net.org&gt;
Signed-off-by: David Brownell &lt;dbrownell@users.sourceforge.net&gt;
Signed-off-by: Andrew Morton &lt;akpm@osdl.org&gt;
Signed-off-by: Linus Torvalds &lt;torvalds@osdl.org&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Russel King recently reminded us that one shouldn't use asm/arch/hardware.h
but one should use asm/hardware.h.  Unfortunately, the spi_s3c24xx_gpio
driver is using the wrong header.  This patch is fixing that.

Signed-off-by: Arnaud Patard &lt;arnaud.patard@rtp-net.org&gt;
Signed-off-by: David Brownell &lt;dbrownell@users.sourceforge.net&gt;
Signed-off-by: Andrew Morton &lt;akpm@osdl.org&gt;
Signed-off-by: Linus Torvalds &lt;torvalds@osdl.org&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>[PATCH] SPI: define null tx_buf to mean "shift out zeroes"</title>
<updated>2006-12-30T18:56:42+00:00</updated>
<author>
<name>David Brownell</name>
<email>david-b@pacbell.net</email>
</author>
<published>2006-12-30T00:48:39+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=4b1badf5d9ddfc46ad075ca5bfc465972c85cc7c'/>
<id>4b1badf5d9ddfc46ad075ca5bfc465972c85cc7c</id>
<content type='text'>
Some issues were recently turned up with the current specification of what
it means for spi_transfer.tx_buf to be null, as part of transfers which are
(from the SPI protocol driver perspective) pure reads.

Specifically, that it seems better to change the TX behaviour there from
"undefined" to "will shift zeroes".  This lets protocol drivers (like the
ads7846 driver) depend on that behavior.  It's what most controller drivers
in the tree are already doing (with one exception and one case of driver
wanting-to-oops), it's what Microwire hardware will necessarily be doing,
and it removes an issue whereby certain security audits would need to
define such a value anyway as part of removing covert channels.

This patch changes the specification to require shifting zeroes, and
updates all currently merged SPI controller drivers to do so.

Signed-off-by: David Brownell &lt;dbrownell@users.sourceforge.net&gt;
Signed-off-by: Kumar Gala &lt;galak@kernel.crashing.org&gt;
Signed-off-by: Andrew Morton &lt;akpm@osdl.org&gt;
Signed-off-by: Linus Torvalds &lt;torvalds@osdl.org&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Some issues were recently turned up with the current specification of what
it means for spi_transfer.tx_buf to be null, as part of transfers which are
(from the SPI protocol driver perspective) pure reads.

Specifically, that it seems better to change the TX behaviour there from
"undefined" to "will shift zeroes".  This lets protocol drivers (like the
ads7846 driver) depend on that behavior.  It's what most controller drivers
in the tree are already doing (with one exception and one case of driver
wanting-to-oops), it's what Microwire hardware will necessarily be doing,
and it removes an issue whereby certain security audits would need to
define such a value anyway as part of removing covert channels.

This patch changes the specification to require shifting zeroes, and
updates all currently merged SPI controller drivers to do so.

Signed-off-by: David Brownell &lt;dbrownell@users.sourceforge.net&gt;
Signed-off-by: Kumar Gala &lt;galak@kernel.crashing.org&gt;
Signed-off-by: Andrew Morton &lt;akpm@osdl.org&gt;
Signed-off-by: Linus Torvalds &lt;torvalds@osdl.org&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>[PATCH] fix s3c24xx gpio driver (include linux/workqueue.h)</title>
<updated>2006-12-22T16:55:51+00:00</updated>
<author>
<name>Ben Dooks</name>
<email>ben-linux@fluff.org</email>
</author>
<published>2006-12-22T09:11:45+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=6d3a25f1fb75206ae8b2b1cdd1431b3852e1a45a'/>
<id>6d3a25f1fb75206ae8b2b1cdd1431b3852e1a45a</id>
<content type='text'>
The general gpio driver includes seem to now depend on having
&lt;linux/workqueue.h&gt; included before they are.

Signed-off-by: Ben Dooks &lt;ben-linux@fluff.org&gt;
Signed-off-by: David Brownell &lt;dbrownell@users.sourceforge.net&gt;
Signed-off-by: Andrew Morton &lt;akpm@osdl.org&gt;
Signed-off-by: Linus Torvalds &lt;torvalds@osdl.org&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
The general gpio driver includes seem to now depend on having
&lt;linux/workqueue.h&gt; included before they are.

Signed-off-by: Ben Dooks &lt;ben-linux@fluff.org&gt;
Signed-off-by: David Brownell &lt;dbrownell@users.sourceforge.net&gt;
Signed-off-by: Andrew Morton &lt;akpm@osdl.org&gt;
Signed-off-by: Linus Torvalds &lt;torvalds@osdl.org&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>[PATCH] spi: stabilize PIO mode transfers on PXA2xx systems</title>
<updated>2006-12-10T17:55:40+00:00</updated>
<author>
<name>Stephen Street</name>
<email>stephen@streetfiresound.com</email>
</author>
<published>2006-12-10T10:18:54+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=8d94cc50aa4f1448a6483975097805eb8d6be0e0'/>
<id>8d94cc50aa4f1448a6483975097805eb8d6be0e0</id>
<content type='text'>
Stabilize PIO mode transfers against a range of word sizes and FIFO
thresholds and fixes word size setup/override issues.

1) 16 and 32 bit DMA/PIO transfers broken due to timing differences.
2) Potential for bad transfer counts due to transfer size assumptions.
3) Setup function broken is multiple ways.
4) Per transfer bit_per_word changes break DMA setup in pump_tranfers.
5) False positive timeout are not errors.
6) Changes in pxa2xx_spi_chip not effective in calls to setup.
7) Timeout scaling wrong for PXA255 NSSP.
8) Driver leaks memory while busy during unloading.

Known issues:

SPI_CS_HIGH and SPI_LSB_FIRST settings in struct spi_device are not handled.

Testing:

This patch has been test against the "random length, random bits/word,
random data (verified on loopback) and stepped baud rate by octaves
(3.6MHz to 115kHz)" test.  It is robust in PIO mode, using any
combination of tx and rx thresholds, and also in DMA mode (which
internally computes the thresholds).

Much thanks to Ned Forrester for exhaustive reviews, fixes and testing.
The driver is substantially better for his efforts.

Signed-off-by: Stephen Street &lt;stephen@streetfiresound.com&gt;
Signed-off-by: David Brownell &lt;dbrownell@users.sourceforge.net&gt;
Signed-off-by: Andrew Morton &lt;akpm@osdl.org&gt;
Signed-off-by: Linus Torvalds &lt;torvalds@osdl.org&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Stabilize PIO mode transfers against a range of word sizes and FIFO
thresholds and fixes word size setup/override issues.

1) 16 and 32 bit DMA/PIO transfers broken due to timing differences.
2) Potential for bad transfer counts due to transfer size assumptions.
3) Setup function broken is multiple ways.
4) Per transfer bit_per_word changes break DMA setup in pump_tranfers.
5) False positive timeout are not errors.
6) Changes in pxa2xx_spi_chip not effective in calls to setup.
7) Timeout scaling wrong for PXA255 NSSP.
8) Driver leaks memory while busy during unloading.

Known issues:

SPI_CS_HIGH and SPI_LSB_FIRST settings in struct spi_device are not handled.

Testing:

This patch has been test against the "random length, random bits/word,
random data (verified on loopback) and stepped baud rate by octaves
(3.6MHz to 115kHz)" test.  It is robust in PIO mode, using any
combination of tx and rx thresholds, and also in DMA mode (which
internally computes the thresholds).

Much thanks to Ned Forrester for exhaustive reviews, fixes and testing.
The driver is substantially better for his efforts.

Signed-off-by: Stephen Street &lt;stephen@streetfiresound.com&gt;
Signed-off-by: David Brownell &lt;dbrownell@users.sourceforge.net&gt;
Signed-off-by: Andrew Morton &lt;akpm@osdl.org&gt;
Signed-off-by: Linus Torvalds &lt;torvalds@osdl.org&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>[PATCH] spi: check platform_device_register_simple() error</title>
<updated>2006-12-07T16:39:42+00:00</updated>
<author>
<name>Akinobu Mita</name>
<email>akinobu.mita@gmail.com</email>
</author>
<published>2006-12-07T04:39:05+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=7b92ff01c2cd21567c3342c1c77d5e4f1a2bd699'/>
<id>7b92ff01c2cd21567c3342c1c77d5e4f1a2bd699</id>
<content type='text'>
Check the return value of platform_device_register_simple().

Cc: David Brownell &lt;dbrownell@users.sourceforge.net&gt;
Signed-off-by: Akinobu Mita &lt;akinobu.mita@gmail.com&gt;
Signed-off-by: Andrew Morton &lt;akpm@osdl.org&gt;
Signed-off-by: Linus Torvalds &lt;torvalds@osdl.org&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Check the return value of platform_device_register_simple().

Cc: David Brownell &lt;dbrownell@users.sourceforge.net&gt;
Signed-off-by: Akinobu Mita &lt;akinobu.mita@gmail.com&gt;
Signed-off-by: Andrew Morton &lt;akpm@osdl.org&gt;
Signed-off-by: Linus Torvalds &lt;torvalds@osdl.org&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>[PATCH] spi: set kset of master class dev explicitly</title>
<updated>2006-12-07T16:39:33+00:00</updated>
<author>
<name>Hans-Christian Egtvedt</name>
<email>hcegtvedt@atmel.com</email>
</author>
<published>2006-12-07T04:36:19+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=3bd0f6943520e459659d10f3282285e43d3990f1'/>
<id>3bd0f6943520e459659d10f3282285e43d3990f1</id>
<content type='text'>
&lt;quote Imre Deak from Thu, 12 Jan 2006 21:18:54 +0200&gt;
  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.
&lt;/quote&gt;

Signed-off-by: Hans-Christian Egtvedt &lt;hcegtvedt@atmel.com&gt;
Cc: David Brownell &lt;david-b@pacbell.net&gt;
Signed-off-by: Andrew Morton &lt;akpm@osdl.org&gt;
Signed-off-by: Linus Torvalds &lt;torvalds@osdl.org&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
&lt;quote Imre Deak from Thu, 12 Jan 2006 21:18:54 +0200&gt;
  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.
&lt;/quote&gt;

Signed-off-by: Hans-Christian Egtvedt &lt;hcegtvedt@atmel.com&gt;
Cc: David Brownell &lt;david-b@pacbell.net&gt;
Signed-off-by: Andrew Morton &lt;akpm@osdl.org&gt;
Signed-off-by: Linus Torvalds &lt;torvalds@osdl.org&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>[PATCH] spi: correct bus_num and buffer bug in spi core</title>
<updated>2006-12-07T16:39:32+00:00</updated>
<author>
<name>Hans-Christian Egtvedt</name>
<email>hcegtvedt@atmel.com</email>
</author>
<published>2006-12-07T04:36:17+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=4740d387f3cb9e63f48f2488815b38a2c92755c8'/>
<id>4740d387f3cb9e63f48f2488815b38a2c92755c8</id>
<content type='text'>
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 &gt;= 10000. It

should be 9 bytes big, not 8.

Signed-off-by: Hans-Christian Egtvedt &lt;hcegtvedt@atmel.com&gt;
Cc: David Brownell &lt;david-b@pacbell.net&gt;
Signed-off-by: Andrew Morton &lt;akpm@osdl.org&gt;
Signed-off-by: Linus Torvalds &lt;torvalds@osdl.org&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
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 &gt;= 10000. It

should be 9 bytes big, not 8.

Signed-off-by: Hans-Christian Egtvedt &lt;hcegtvedt@atmel.com&gt;
Cc: David Brownell &lt;david-b@pacbell.net&gt;
Signed-off-by: Andrew Morton &lt;akpm@osdl.org&gt;
Signed-off-by: Linus Torvalds &lt;torvalds@osdl.org&gt;
</pre>
</div>
</content>
</entry>
</feed>
