<feed xmlns='http://www.w3.org/2005/Atom'>
<title>linux-toradex.git/drivers/spi, branch v3.10.78</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>spi: spidev: fix possible arithmetic overflow for multi-transfer message</title>
<updated>2015-05-06T19:56:21+00:00</updated>
<author>
<name>Ian Abbott</name>
<email>abbotti@mev.co.uk</email>
</author>
<published>2015-03-23T17:50:27+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=14a1fe5de9d7c391301b517e8effb5f098ada9c4'/>
<id>14a1fe5de9d7c391301b517e8effb5f098ada9c4</id>
<content type='text'>
commit f20fbaad7620af2df36a1f9d1c9ecf48ead5b747 upstream.

`spidev_message()` sums the lengths of the individual SPI transfers to
determine the overall SPI message length.  It restricts the total
length, returning an error if too long, but it does not check for
arithmetic overflow.  For example, if the SPI message consisted of two
transfers and the first has a length of 10 and the second has a length
of (__u32)(-1), the total length would be seen as 9, even though the
second transfer is actually very long.  If the second transfer specifies
a null `rx_buf` and a non-null `tx_buf`, the `copy_from_user()` could
overrun the spidev's pre-allocated tx buffer before it reaches an
invalid user memory address.  Fix it by checking that neither the total
nor the individual transfer lengths exceed the maximum allowed value.

Thanks to Dan Carpenter for reporting the potential integer overflow.

Signed-off-by: Ian Abbott &lt;abbotti@mev.co.uk&gt;
Signed-off-by: Mark Brown &lt;broonie@kernel.org&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;

</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
commit f20fbaad7620af2df36a1f9d1c9ecf48ead5b747 upstream.

`spidev_message()` sums the lengths of the individual SPI transfers to
determine the overall SPI message length.  It restricts the total
length, returning an error if too long, but it does not check for
arithmetic overflow.  For example, if the SPI message consisted of two
transfers and the first has a length of 10 and the second has a length
of (__u32)(-1), the total length would be seen as 9, even though the
second transfer is actually very long.  If the second transfer specifies
a null `rx_buf` and a non-null `tx_buf`, the `copy_from_user()` could
overrun the spidev's pre-allocated tx buffer before it reaches an
invalid user memory address.  Fix it by checking that neither the total
nor the individual transfer lengths exceed the maximum allowed value.

Thanks to Dan Carpenter for reporting the potential integer overflow.

Signed-off-by: Ian Abbott &lt;abbotti@mev.co.uk&gt;
Signed-off-by: Mark Brown &lt;broonie@kernel.org&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;

</pre>
</div>
</content>
</entry>
<entry>
<title>spi: pl022: Fix race in giveback() leading to driver lock-up</title>
<updated>2015-03-26T14:00:58+00:00</updated>
<author>
<name>Alexander Sverdlin</name>
<email>alexander.sverdlin@nokia.com</email>
</author>
<published>2015-02-27T15:30:21+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=b81da6c4557194be7e9f7118c08fae0ab607c58a'/>
<id>b81da6c4557194be7e9f7118c08fae0ab607c58a</id>
<content type='text'>
commit cd6fa8d2ca53cac3226fdcffcf763be390abae32 upstream.

Commit fd316941c ("spi/pl022: disable port when unused") introduced a race,
which leads to possible driver lock up (easily reproducible on SMP).

The problem happens in giveback() function where the completion of the transfer
is signalled to SPI subsystem and then the HW SPI controller is disabled. Another
transfer might be setup in between, which brings driver in locked-up state.

Exact event sequence on SMP:

core0                                   core1

                                        =&gt; pump_transfers()
                                        /* message-&gt;state == STATE_DONE */
                                          =&gt; giveback()
                                            =&gt; spi_finalize_current_message()

=&gt; pl022_unprepare_transfer_hardware()
=&gt; pl022_transfer_one_message
  =&gt; flush()
  =&gt; do_interrupt_dma_transfer()
    =&gt; set_up_next_transfer()
    /* Enable SSP, turn on interrupts */
    writew((readw(SSP_CR1(pl022-&gt;virtbase)) |
           SSP_CR1_MASK_SSE), SSP_CR1(pl022-&gt;virtbase));

...

=&gt; pl022_interrupt_handler()
  =&gt; readwriter()

                                        /* disable the SPI/SSP operation */
                                        =&gt; writew((readw(SSP_CR1(pl022-&gt;virtbase)) &amp;
                                                  (~SSP_CR1_MASK_SSE)), SSP_CR1(pl022-&gt;virtbase));

Lockup! SPI controller is disabled and the data will never be received. Whole
SPI subsystem is waiting for transfer ACK and blocked.

So, only signal transfer completion after disabling the controller.

Fixes: fd316941c (spi/pl022: disable port when unused)
Signed-off-by: Alexander Sverdlin &lt;alexander.sverdlin@nokia.com&gt;
Signed-off-by: Mark Brown &lt;broonie@kernel.org&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;

</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
commit cd6fa8d2ca53cac3226fdcffcf763be390abae32 upstream.

Commit fd316941c ("spi/pl022: disable port when unused") introduced a race,
which leads to possible driver lock up (easily reproducible on SMP).

The problem happens in giveback() function where the completion of the transfer
is signalled to SPI subsystem and then the HW SPI controller is disabled. Another
transfer might be setup in between, which brings driver in locked-up state.

Exact event sequence on SMP:

core0                                   core1

                                        =&gt; pump_transfers()
                                        /* message-&gt;state == STATE_DONE */
                                          =&gt; giveback()
                                            =&gt; spi_finalize_current_message()

=&gt; pl022_unprepare_transfer_hardware()
=&gt; pl022_transfer_one_message
  =&gt; flush()
  =&gt; do_interrupt_dma_transfer()
    =&gt; set_up_next_transfer()
    /* Enable SSP, turn on interrupts */
    writew((readw(SSP_CR1(pl022-&gt;virtbase)) |
           SSP_CR1_MASK_SSE), SSP_CR1(pl022-&gt;virtbase));

...

=&gt; pl022_interrupt_handler()
  =&gt; readwriter()

                                        /* disable the SPI/SSP operation */
                                        =&gt; writew((readw(SSP_CR1(pl022-&gt;virtbase)) &amp;
                                                  (~SSP_CR1_MASK_SSE)), SSP_CR1(pl022-&gt;virtbase));

Lockup! SPI controller is disabled and the data will never be received. Whole
SPI subsystem is waiting for transfer ACK and blocked.

So, only signal transfer completion after disabling the controller.

Fixes: fd316941c (spi/pl022: disable port when unused)
Signed-off-by: Alexander Sverdlin &lt;alexander.sverdlin@nokia.com&gt;
Signed-off-by: Mark Brown &lt;broonie@kernel.org&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;

</pre>
</div>
</content>
</entry>
<entry>
<title>spi/pxa2xx: Clear cur_chip pointer before starting next message</title>
<updated>2015-02-06T06:35:37+00:00</updated>
<author>
<name>Mika Westerberg</name>
<email>mika.westerberg@linux.intel.com</email>
</author>
<published>2014-12-29T08:33:36+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=ba455124c34d113bf781bfb2c1416d33cb1f26ce'/>
<id>ba455124c34d113bf781bfb2c1416d33cb1f26ce</id>
<content type='text'>
commit c957e8f084e0d21febcd6b8a0ea9631eccc92f36 upstream.

Once the current message is finished, the driver notifies SPI core about
this by calling spi_finalize_current_message(). This function queues next
message to be transferred. If there are more messages in the queue, it is
possible that the driver is asked to transfer the next message at this
point.

When spi_finalize_current_message() returns the driver clears the
drv_data-&gt;cur_chip pointer to NULL. The problem is that if the driver
already started the next message clearing drv_data-&gt;cur_chip will cause
NULL pointer dereference which crashes the kernel like:

 BUG: unable to handle kernel NULL pointer dereference at 0000000000000048
 IP: [&lt;ffffffffa0022bc8&gt;] cs_deassert+0x18/0x70 [spi_pxa2xx_platform]
 PGD 78bb8067 PUD 37712067 PMD 0
 Oops: 0000 [#1] SMP
 Modules linked in:
 CPU: 1 PID: 11 Comm: ksoftirqd/1 Tainted: G           O   3.18.0-rc4-mjo #5
 Hardware name: Intel Corp. VALLEYVIEW B3 PLATFORM/NOTEBOOK, BIOS MNW2CRB1.X64.0071.R30.1408131301 08/13/2014
 task: ffff880077f9f290 ti: ffff88007a820000 task.ti: ffff88007a820000
 RIP: 0010:[&lt;ffffffffa0022bc8&gt;]  [&lt;ffffffffa0022bc8&gt;] cs_deassert+0x18/0x70 [spi_pxa2xx_platform]
 RSP: 0018:ffff88007a823d08  EFLAGS: 00010202
 RAX: 0000000000000008 RBX: ffff8800379a4430 RCX: 0000000000000026
 RDX: 0000000000000000 RSI: 0000000000000246 RDI: ffff8800379a4430
 RBP: ffff88007a823d18 R08: 00000000ffffffff R09: 000000007a9bc65a
 R10: 000000000000028f R11: 0000000000000005 R12: ffff880070123e98
 R13: ffff880070123de8 R14: 0000000000000100 R15: ffffc90004888000
 FS:  0000000000000000(0000) GS:ffff880079a80000(0000) knlGS:0000000000000000
 CS:  0010 DS: 0000 ES: 0000 CR0: 000000008005003b
 CR2: 0000000000000048 CR3: 000000007029b000 CR4: 00000000001007e0
 Stack:
  ffff88007a823d58 ffff8800379a4430 ffff88007a823d48 ffffffffa0022c89
  0000000000000000 ffff8800379a4430 0000000000000000 0000000000000006
  ffff88007a823da8 ffffffffa0023be0 ffff88007a823dd8 ffffffff81076204
 Call Trace:
  [&lt;ffffffffa0022c89&gt;] giveback+0x69/0xa0 [spi_pxa2xx_platform]
  [&lt;ffffffffa0023be0&gt;] pump_transfers+0x710/0x740 [spi_pxa2xx_platform]
  [&lt;ffffffff81076204&gt;] ? pick_next_task_fair+0x744/0x830
  [&lt;ffffffff81049679&gt;] tasklet_action+0xa9/0xe0
  [&lt;ffffffff81049a0e&gt;] __do_softirq+0xee/0x280
  [&lt;ffffffff81049bc0&gt;] run_ksoftirqd+0x20/0x40
  [&lt;ffffffff810646df&gt;] smpboot_thread_fn+0xff/0x1b0
  [&lt;ffffffff810645e0&gt;] ? SyS_setgroups+0x150/0x150
  [&lt;ffffffff81060f9d&gt;] kthread+0xcd/0xf0
  [&lt;ffffffff81060ed0&gt;] ? kthread_create_on_node+0x180/0x180
  [&lt;ffffffff8187a82c&gt;] ret_from_fork+0x7c/0xb0

Fix this by clearing drv_data-&gt;cur_chip before we call spi_finalize_current_message().

Reported-by: Martin Oldfield &lt;m@mjoldfield.com&gt;
Signed-off-by: Mika Westerberg &lt;mika.westerberg@linux.intel.com&gt;
Acked-by: Robert Jarzmik &lt;robert.jarzmik@free.fr&gt;
Signed-off-by: Mark Brown &lt;broonie@kernel.org&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;

</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
commit c957e8f084e0d21febcd6b8a0ea9631eccc92f36 upstream.

Once the current message is finished, the driver notifies SPI core about
this by calling spi_finalize_current_message(). This function queues next
message to be transferred. If there are more messages in the queue, it is
possible that the driver is asked to transfer the next message at this
point.

When spi_finalize_current_message() returns the driver clears the
drv_data-&gt;cur_chip pointer to NULL. The problem is that if the driver
already started the next message clearing drv_data-&gt;cur_chip will cause
NULL pointer dereference which crashes the kernel like:

 BUG: unable to handle kernel NULL pointer dereference at 0000000000000048
 IP: [&lt;ffffffffa0022bc8&gt;] cs_deassert+0x18/0x70 [spi_pxa2xx_platform]
 PGD 78bb8067 PUD 37712067 PMD 0
 Oops: 0000 [#1] SMP
 Modules linked in:
 CPU: 1 PID: 11 Comm: ksoftirqd/1 Tainted: G           O   3.18.0-rc4-mjo #5
 Hardware name: Intel Corp. VALLEYVIEW B3 PLATFORM/NOTEBOOK, BIOS MNW2CRB1.X64.0071.R30.1408131301 08/13/2014
 task: ffff880077f9f290 ti: ffff88007a820000 task.ti: ffff88007a820000
 RIP: 0010:[&lt;ffffffffa0022bc8&gt;]  [&lt;ffffffffa0022bc8&gt;] cs_deassert+0x18/0x70 [spi_pxa2xx_platform]
 RSP: 0018:ffff88007a823d08  EFLAGS: 00010202
 RAX: 0000000000000008 RBX: ffff8800379a4430 RCX: 0000000000000026
 RDX: 0000000000000000 RSI: 0000000000000246 RDI: ffff8800379a4430
 RBP: ffff88007a823d18 R08: 00000000ffffffff R09: 000000007a9bc65a
 R10: 000000000000028f R11: 0000000000000005 R12: ffff880070123e98
 R13: ffff880070123de8 R14: 0000000000000100 R15: ffffc90004888000
 FS:  0000000000000000(0000) GS:ffff880079a80000(0000) knlGS:0000000000000000
 CS:  0010 DS: 0000 ES: 0000 CR0: 000000008005003b
 CR2: 0000000000000048 CR3: 000000007029b000 CR4: 00000000001007e0
 Stack:
  ffff88007a823d58 ffff8800379a4430 ffff88007a823d48 ffffffffa0022c89
  0000000000000000 ffff8800379a4430 0000000000000000 0000000000000006
  ffff88007a823da8 ffffffffa0023be0 ffff88007a823dd8 ffffffff81076204
 Call Trace:
  [&lt;ffffffffa0022c89&gt;] giveback+0x69/0xa0 [spi_pxa2xx_platform]
  [&lt;ffffffffa0023be0&gt;] pump_transfers+0x710/0x740 [spi_pxa2xx_platform]
  [&lt;ffffffff81076204&gt;] ? pick_next_task_fair+0x744/0x830
  [&lt;ffffffff81049679&gt;] tasklet_action+0xa9/0xe0
  [&lt;ffffffff81049a0e&gt;] __do_softirq+0xee/0x280
  [&lt;ffffffff81049bc0&gt;] run_ksoftirqd+0x20/0x40
  [&lt;ffffffff810646df&gt;] smpboot_thread_fn+0xff/0x1b0
  [&lt;ffffffff810645e0&gt;] ? SyS_setgroups+0x150/0x150
  [&lt;ffffffff81060f9d&gt;] kthread+0xcd/0xf0
  [&lt;ffffffff81060ed0&gt;] ? kthread_create_on_node+0x180/0x180
  [&lt;ffffffff8187a82c&gt;] ret_from_fork+0x7c/0xb0

Fix this by clearing drv_data-&gt;cur_chip before we call spi_finalize_current_message().

Reported-by: Martin Oldfield &lt;m@mjoldfield.com&gt;
Signed-off-by: Mika Westerberg &lt;mika.westerberg@linux.intel.com&gt;
Acked-by: Robert Jarzmik &lt;robert.jarzmik@free.fr&gt;
Signed-off-by: Mark Brown &lt;broonie@kernel.org&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;

</pre>
</div>
</content>
</entry>
<entry>
<title>spi: dw-mid: fix FIFO size</title>
<updated>2015-02-06T06:35:36+00:00</updated>
<author>
<name>Andy Shevchenko</name>
<email>andriy.shevchenko@linux.intel.com</email>
</author>
<published>2015-01-02T15:48:51+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=09572e4fa883185794e81b3b36438af5c9ff2132'/>
<id>09572e4fa883185794e81b3b36438af5c9ff2132</id>
<content type='text'>
commit 67bf9cda4b498b8cea4a40be67a470afe57d2e88 upstream.

The FIFO size is 40 accordingly to the specifications, but this means 0x40,
i.e. 64 bytes. This patch fixes the typo and enables FIFO size autodetection
for Intel MID devices.

Fixes: 7063c0d942a1 (spi/dw_spi: add DMA support)
Signed-off-by: Andy Shevchenko &lt;andriy.shevchenko@linux.intel.com&gt;
Signed-off-by: Mark Brown &lt;broonie@kernel.org&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;

</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
commit 67bf9cda4b498b8cea4a40be67a470afe57d2e88 upstream.

The FIFO size is 40 accordingly to the specifications, but this means 0x40,
i.e. 64 bytes. This patch fixes the typo and enables FIFO size autodetection
for Intel MID devices.

Fixes: 7063c0d942a1 (spi/dw_spi: add DMA support)
Signed-off-by: Andy Shevchenko &lt;andriy.shevchenko@linux.intel.com&gt;
Signed-off-by: Mark Brown &lt;broonie@kernel.org&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;

</pre>
</div>
</content>
</entry>
<entry>
<title>spi: dw: Fix dynamic speed change.</title>
<updated>2014-12-06T23:05:49+00:00</updated>
<author>
<name>Thor Thayer</name>
<email>tthayer@opensource.altera.com</email>
</author>
<published>2014-11-06T19:54:27+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=9c661315b77e219bc44b67c77567bf7833ff900c'/>
<id>9c661315b77e219bc44b67c77567bf7833ff900c</id>
<content type='text'>
commit 0a8727e69778683495058852f783eeda141a754e upstream.

An IOCTL call that calls spi_setup() and then dw_spi_setup() will
overwrite the persisted last transfer speed. On each transfer, the
SPI speed is compared to the last transfer speed to determine if the
clock divider registers need to be updated (did the speed change?).
This bug was observed with the spidev driver using spi-config to
update the max transfer speed.

This fix: Don't overwrite the persisted last transaction clock speed
when updating the SPI parameters in dw_spi_setup(). On the next
transaction, the new speed won't match the persisted last speed
and the hardware registers will be updated.
On initialization, the persisted last transaction clock
speed will be 0 but will be updated after the first SPI
transaction.

Move zeroed clock divider check into clock change test because
chip-&gt;clk_div is zero on startup and would cause a divide-by-zero
error. The calculation was wrong as well (can't support odd #).

Reported-by: Vlastimil Setka &lt;setka@vsis.cz&gt;
Signed-off-by: Vlastimil Setka &lt;setka@vsis.cz&gt;
Signed-off-by: Thor Thayer &lt;tthayer@opensource.altera.com&gt;
Signed-off-by: Mark Brown &lt;broonie@kernel.org&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;

</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
commit 0a8727e69778683495058852f783eeda141a754e upstream.

An IOCTL call that calls spi_setup() and then dw_spi_setup() will
overwrite the persisted last transfer speed. On each transfer, the
SPI speed is compared to the last transfer speed to determine if the
clock divider registers need to be updated (did the speed change?).
This bug was observed with the spidev driver using spi-config to
update the max transfer speed.

This fix: Don't overwrite the persisted last transaction clock speed
when updating the SPI parameters in dw_spi_setup(). On the next
transaction, the new speed won't match the persisted last speed
and the hardware registers will be updated.
On initialization, the persisted last transaction clock
speed will be 0 but will be updated after the first SPI
transaction.

Move zeroed clock divider check into clock change test because
chip-&gt;clk_div is zero on startup and would cause a divide-by-zero
error. The calculation was wrong as well (can't support odd #).

Reported-by: Vlastimil Setka &lt;setka@vsis.cz&gt;
Signed-off-by: Vlastimil Setka &lt;setka@vsis.cz&gt;
Signed-off-by: Thor Thayer &lt;tthayer@opensource.altera.com&gt;
Signed-off-by: Mark Brown &lt;broonie@kernel.org&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;

</pre>
</div>
</content>
</entry>
<entry>
<title>spi: pxa2xx: toggle clocks on suspend if not disabled by runtime PM</title>
<updated>2014-11-14T16:47:59+00:00</updated>
<author>
<name>Dmitry Eremin-Solenikov</name>
<email>dbaryshkov@gmail.com</email>
</author>
<published>2014-11-06T11:08:29+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=c822fb57ba12fbf0b989c201e400a5f71c9fade5'/>
<id>c822fb57ba12fbf0b989c201e400a5f71c9fade5</id>
<content type='text'>
commit 2b9375b91bef65b837bed61a05fb387159b38ddf upstream.

If PM_RUNTIME is enabled, it is easy to trigger the following backtrace
on pxa2xx hosts:

------------[ cut here ]------------
WARNING: CPU: 0 PID: 1 at /home/lumag/linux/arch/arm/mach-pxa/clock.c:35 clk_disable+0xa0/0xa8()
Modules linked in:
CPU: 0 PID: 1 Comm: swapper Not tainted 3.17.0-00007-g1b3d2ee-dirty #104
[&lt;c000de68&gt;] (unwind_backtrace) from [&lt;c000c078&gt;] (show_stack+0x10/0x14)
[&lt;c000c078&gt;] (show_stack) from [&lt;c001d75c&gt;] (warn_slowpath_common+0x6c/0x8c)
[&lt;c001d75c&gt;] (warn_slowpath_common) from [&lt;c001d818&gt;] (warn_slowpath_null+0x1c/0x24)
[&lt;c001d818&gt;] (warn_slowpath_null) from [&lt;c0015e80&gt;] (clk_disable+0xa0/0xa8)
[&lt;c0015e80&gt;] (clk_disable) from [&lt;c02507f8&gt;] (pxa2xx_spi_suspend+0x2c/0x34)
[&lt;c02507f8&gt;] (pxa2xx_spi_suspend) from [&lt;c0200360&gt;] (platform_pm_suspend+0x2c/0x54)
[&lt;c0200360&gt;] (platform_pm_suspend) from [&lt;c0207fec&gt;] (dpm_run_callback.isra.14+0x2c/0x74)
[&lt;c0207fec&gt;] (dpm_run_callback.isra.14) from [&lt;c0209254&gt;] (__device_suspend+0x120/0x2f8)
[&lt;c0209254&gt;] (__device_suspend) from [&lt;c0209a94&gt;] (dpm_suspend+0x50/0x208)
[&lt;c0209a94&gt;] (dpm_suspend) from [&lt;c00455ac&gt;] (suspend_devices_and_enter+0x8c/0x3a0)
[&lt;c00455ac&gt;] (suspend_devices_and_enter) from [&lt;c0045ad4&gt;] (pm_suspend+0x214/0x2a8)
[&lt;c0045ad4&gt;] (pm_suspend) from [&lt;c04b5c34&gt;] (test_suspend+0x14c/0x1dc)
[&lt;c04b5c34&gt;] (test_suspend) from [&lt;c000880c&gt;] (do_one_initcall+0x8c/0x1fc)
[&lt;c000880c&gt;] (do_one_initcall) from [&lt;c04aecfc&gt;] (kernel_init_freeable+0xf4/0x1b4)
[&lt;c04aecfc&gt;] (kernel_init_freeable) from [&lt;c0378078&gt;] (kernel_init+0x8/0xec)
[&lt;c0378078&gt;] (kernel_init) from [&lt;c0009590&gt;] (ret_from_fork+0x14/0x24)
---[ end trace 46524156d8faa4f6 ]---

This happens because suspend function tries to disable a clock that is
already disabled by runtime_suspend callback. Add if
(!pm_runtime_suspended()) checks to suspend/resume path.

Fixes: 7d94a505858 (spi/pxa2xx: add support for runtime PM)
Signed-off-by: Dmitry Eremin-Solenikov &lt;dbaryshkov@gmail.com&gt;
Reported-by: Andrea Adami &lt;andrea.adami@gmail.com&gt;
Signed-off-by: Mark Brown &lt;broonie@kernel.org&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;

</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
commit 2b9375b91bef65b837bed61a05fb387159b38ddf upstream.

If PM_RUNTIME is enabled, it is easy to trigger the following backtrace
on pxa2xx hosts:

------------[ cut here ]------------
WARNING: CPU: 0 PID: 1 at /home/lumag/linux/arch/arm/mach-pxa/clock.c:35 clk_disable+0xa0/0xa8()
Modules linked in:
CPU: 0 PID: 1 Comm: swapper Not tainted 3.17.0-00007-g1b3d2ee-dirty #104
[&lt;c000de68&gt;] (unwind_backtrace) from [&lt;c000c078&gt;] (show_stack+0x10/0x14)
[&lt;c000c078&gt;] (show_stack) from [&lt;c001d75c&gt;] (warn_slowpath_common+0x6c/0x8c)
[&lt;c001d75c&gt;] (warn_slowpath_common) from [&lt;c001d818&gt;] (warn_slowpath_null+0x1c/0x24)
[&lt;c001d818&gt;] (warn_slowpath_null) from [&lt;c0015e80&gt;] (clk_disable+0xa0/0xa8)
[&lt;c0015e80&gt;] (clk_disable) from [&lt;c02507f8&gt;] (pxa2xx_spi_suspend+0x2c/0x34)
[&lt;c02507f8&gt;] (pxa2xx_spi_suspend) from [&lt;c0200360&gt;] (platform_pm_suspend+0x2c/0x54)
[&lt;c0200360&gt;] (platform_pm_suspend) from [&lt;c0207fec&gt;] (dpm_run_callback.isra.14+0x2c/0x74)
[&lt;c0207fec&gt;] (dpm_run_callback.isra.14) from [&lt;c0209254&gt;] (__device_suspend+0x120/0x2f8)
[&lt;c0209254&gt;] (__device_suspend) from [&lt;c0209a94&gt;] (dpm_suspend+0x50/0x208)
[&lt;c0209a94&gt;] (dpm_suspend) from [&lt;c00455ac&gt;] (suspend_devices_and_enter+0x8c/0x3a0)
[&lt;c00455ac&gt;] (suspend_devices_and_enter) from [&lt;c0045ad4&gt;] (pm_suspend+0x214/0x2a8)
[&lt;c0045ad4&gt;] (pm_suspend) from [&lt;c04b5c34&gt;] (test_suspend+0x14c/0x1dc)
[&lt;c04b5c34&gt;] (test_suspend) from [&lt;c000880c&gt;] (do_one_initcall+0x8c/0x1fc)
[&lt;c000880c&gt;] (do_one_initcall) from [&lt;c04aecfc&gt;] (kernel_init_freeable+0xf4/0x1b4)
[&lt;c04aecfc&gt;] (kernel_init_freeable) from [&lt;c0378078&gt;] (kernel_init+0x8/0xec)
[&lt;c0378078&gt;] (kernel_init) from [&lt;c0009590&gt;] (ret_from_fork+0x14/0x24)
---[ end trace 46524156d8faa4f6 ]---

This happens because suspend function tries to disable a clock that is
already disabled by runtime_suspend callback. Add if
(!pm_runtime_suspended()) checks to suspend/resume path.

Fixes: 7d94a505858 (spi/pxa2xx: add support for runtime PM)
Signed-off-by: Dmitry Eremin-Solenikov &lt;dbaryshkov@gmail.com&gt;
Reported-by: Andrea Adami &lt;andrea.adami@gmail.com&gt;
Signed-off-by: Mark Brown &lt;broonie@kernel.org&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;

</pre>
</div>
</content>
</entry>
<entry>
<title>spi: pl022: Fix incorrect dma_unmap_sg</title>
<updated>2014-11-14T16:47:59+00:00</updated>
<author>
<name>Ray Jui</name>
<email>rjui@broadcom.com</email>
</author>
<published>2014-10-09T18:44:54+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=a8be23c660a778cdab39bcde9cd3696ebc097f6f'/>
<id>a8be23c660a778cdab39bcde9cd3696ebc097f6f</id>
<content type='text'>
commit 3ffa6158f002e096d28ede71be4e0ee8ab20baa2 upstream.

When mapped RX DMA entries are unmapped in an error condition when DMA
is firstly configured in the driver, the number of TX DMA entries was
passed in, which is incorrect

Signed-off-by: Ray Jui &lt;rjui@broadcom.com&gt;
Signed-off-by: Mark Brown &lt;broonie@kernel.org&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;

</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
commit 3ffa6158f002e096d28ede71be4e0ee8ab20baa2 upstream.

When mapped RX DMA entries are unmapped in an error condition when DMA
is firstly configured in the driver, the number of TX DMA entries was
passed in, which is incorrect

Signed-off-by: Ray Jui &lt;rjui@broadcom.com&gt;
Signed-off-by: Mark Brown &lt;broonie@kernel.org&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;

</pre>
</div>
</content>
</entry>
<entry>
<title>spi: dw-mid: terminate ongoing transfers at exit</title>
<updated>2014-10-30T16:35:12+00:00</updated>
<author>
<name>Andy Shevchenko</name>
<email>andriy.shevchenko@linux.intel.com</email>
</author>
<published>2014-09-18T17:08:53+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=9fa1d75bead1cfe2718d4e81fd039ea4006da745'/>
<id>9fa1d75bead1cfe2718d4e81fd039ea4006da745</id>
<content type='text'>
commit 8e45ef682cb31fda62ed4eeede5d9745a0a1b1e2 upstream.

Do full clean up at exit, means terminate all ongoing DMA transfers.

Signed-off-by: Andy Shevchenko &lt;andriy.shevchenko@linux.intel.com&gt;
Signed-off-by: Mark Brown &lt;broonie@kernel.org&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;

</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
commit 8e45ef682cb31fda62ed4eeede5d9745a0a1b1e2 upstream.

Do full clean up at exit, means terminate all ongoing DMA transfers.

Signed-off-by: Andy Shevchenko &lt;andriy.shevchenko@linux.intel.com&gt;
Signed-off-by: Mark Brown &lt;broonie@kernel.org&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;

</pre>
</div>
</content>
</entry>
<entry>
<title>spi: dw-mid: check that DMA was inited before exit</title>
<updated>2014-10-30T16:35:10+00:00</updated>
<author>
<name>Andy Shevchenko</name>
<email>andriy.shevchenko@linux.intel.com</email>
</author>
<published>2014-09-12T12:11:58+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=0ee097ac8eebdef530c6757d09bd82e08b455a08'/>
<id>0ee097ac8eebdef530c6757d09bd82e08b455a08</id>
<content type='text'>
commit fb57862ead652454ceeb659617404c5f13bc34b5 upstream.

If the driver was compiled with DMA support, but DMA channels weren't acquired
by some reason, mid_spi_dma_exit() will crash the kernel.

Fixes: 7063c0d942a1 (spi/dw_spi: add DMA support)
Signed-off-by: Andy Shevchenko &lt;andriy.shevchenko@linux.intel.com&gt;
Signed-off-by: Mark Brown &lt;broonie@kernel.org&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;

</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
commit fb57862ead652454ceeb659617404c5f13bc34b5 upstream.

If the driver was compiled with DMA support, but DMA channels weren't acquired
by some reason, mid_spi_dma_exit() will crash the kernel.

Fixes: 7063c0d942a1 (spi/dw_spi: add DMA support)
Signed-off-by: Andy Shevchenko &lt;andriy.shevchenko@linux.intel.com&gt;
Signed-off-by: Mark Brown &lt;broonie@kernel.org&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;

</pre>
</div>
</content>
</entry>
<entry>
<title>spi: dw-mid: respect 8 bit mode</title>
<updated>2014-10-30T16:35:10+00:00</updated>
<author>
<name>Andy Shevchenko</name>
<email>andriy.shevchenko@linux.intel.com</email>
</author>
<published>2014-09-18T17:08:51+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=3f8ae85b8ab60e025c806305f95e262d451831ac'/>
<id>3f8ae85b8ab60e025c806305f95e262d451831ac</id>
<content type='text'>
commit b41583e7299046abdc578c33f25ed83ee95b9b31 upstream.

In case of 8 bit mode and DMA usage we end up with every second byte written as
0. We have to respect bits_per_word settings what this patch actually does.

Signed-off-by: Andy Shevchenko &lt;andriy.shevchenko@linux.intel.com&gt;
Signed-off-by: Mark Brown &lt;broonie@kernel.org&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;

</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
commit b41583e7299046abdc578c33f25ed83ee95b9b31 upstream.

In case of 8 bit mode and DMA usage we end up with every second byte written as
0. We have to respect bits_per_word settings what this patch actually does.

Signed-off-by: Andy Shevchenko &lt;andriy.shevchenko@linux.intel.com&gt;
Signed-off-by: Mark Brown &lt;broonie@kernel.org&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;

</pre>
</div>
</content>
</entry>
</feed>
