<feed xmlns='http://www.w3.org/2005/Atom'>
<title>kernel/linux.git/drivers/net/can/spi, branch linux-4.16.y</title>
<subtitle>Linux kernel stable tree (mirror)</subtitle>
<id>https://git.radix-linux.su/kernel/linux.git/atom?h=linux-4.16.y</id>
<link rel='self' href='https://git.radix-linux.su/kernel/linux.git/atom?h=linux-4.16.y'/>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/'/>
<updated>2018-05-16T08:12:31+00:00</updated>
<entry>
<title>can: hi311x: Work around TX complete interrupt erratum</title>
<updated>2018-05-16T08:12:31+00:00</updated>
<author>
<name>Lukas Wunner</name>
<email>lukas@wunner.de</email>
</author>
<published>2018-05-09T12:43:43+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=37be6761ece7db918969b55a647d5265d0ae5cb0'/>
<id>urn:sha1:37be6761ece7db918969b55a647d5265d0ae5cb0</id>
<content type='text'>
commit 32bee8f48fa048a3198109de50e51c092507ff52 upstream.

When sending packets as fast as possible using "cangen -g 0 -i -x", the
HI-3110 occasionally latches the interrupt pin high on completion of a
packet, but doesn't set the TXCPLT bit in the INTF register.  The INTF
register contains 0x00 as if no interrupt has occurred.  Even waiting
for a few milliseconds after the interrupt doesn't help.

Work around this apparent erratum by instead checking the TXMTY bit in
the STATF register ("TX FIFO empty").  We know that we've queued up a
packet for transmission if priv-&gt;tx_len is nonzero.  If the TX FIFO is
empty, transmission of that packet must have completed.

Note that this is congruent with our handling of received packets, which
likewise gleans from the STATF register whether a packet is waiting in
the RX FIFO, instead of looking at the INTF register.

Cc: Mathias Duckeck &lt;m.duckeck@kunbus.de&gt;
Cc: Akshay Bhat &lt;akshay.bhat@timesys.com&gt;
Cc: Casey Fitzpatrick &lt;casey.fitzpatrick@timesys.com&gt;
Cc: stable@vger.kernel.org # v4.12+
Signed-off-by: Lukas Wunner &lt;lukas@wunner.de&gt;
Acked-by: Akshay Bhat &lt;akshay.bhat@timesys.com&gt;
Signed-off-by: Marc Kleine-Budde &lt;mkl@pengutronix.de&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;

</content>
</entry>
<entry>
<title>can: hi311x: Acquire SPI lock on -&gt;do_get_berr_counter</title>
<updated>2018-05-16T08:12:31+00:00</updated>
<author>
<name>Lukas Wunner</name>
<email>lukas@wunner.de</email>
</author>
<published>2018-05-09T12:38:43+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=3cda1f6aed6463af0bbb0a3eca9815bd9f834cef'/>
<id>urn:sha1:3cda1f6aed6463af0bbb0a3eca9815bd9f834cef</id>
<content type='text'>
commit 5cec9425b41dcf834c3d48776900d6acb7e96f38 upstream.

hi3110_get_berr_counter() may run concurrently to the rest of the driver
but neglects to acquire the lock protecting access to the SPI device.
As a result, it and the rest of the driver may clobber each other's tx
and rx buffers.

We became aware of this issue because transmission of packets with
"cangen -g 0 -i -x" frequently hung.  It turns out that agetty executes
-&gt;do_get_berr_counter every few seconds via the following call stack:

    CPU: 2 PID: 1605 Comm: agetty
    [&lt;7f3f7500&gt;] (hi3110_get_berr_counter [hi311x])
    [&lt;7f130204&gt;] (can_fill_info [can_dev])
    [&lt;80693bc0&gt;] (rtnl_fill_ifinfo)
    [&lt;806949ec&gt;] (rtnl_dump_ifinfo)
    [&lt;806b4834&gt;] (netlink_dump)
    [&lt;806b4bc8&gt;] (netlink_recvmsg)
    [&lt;8065f180&gt;] (sock_recvmsg)
    [&lt;80660f90&gt;] (___sys_recvmsg)
    [&lt;80661e7c&gt;] (__sys_recvmsg)
    [&lt;80661ec0&gt;] (SyS_recvmsg)
    [&lt;80108b20&gt;] (ret_fast_syscall+0x0/0x1c)

agetty listens to netlink messages in order to update the login prompt
when IP addresses change (if /etc/issue contains \4 or \6 escape codes):
https://git.kernel.org/pub/scm/utils/util-linux/util-linux.git/commit/?id=e36deb6424e8

It's a useful feature, though it seems questionable that it causes CAN
bit error statistics to be queried.

Be that as it may, if hi3110_get_berr_counter() is invoked while a frame
is sent by hi3110_hw_tx(), bogus SPI transfers like the following may
occur:

    =&gt; 12 00             (hi3110_get_berr_counter() wanted to transmit
                          EC 00 to query the transmit error counter,
                          but the first byte was overwritten by
                          hi3110_hw_tx_frame())

    =&gt; EA 00 3E 80 01 FB (hi3110_hw_tx_frame() wanted to transmit a
                          frame, but the first byte was overwritten by
                          hi3110_get_berr_counter() because it wanted
                          to query the receive error counter)

This sequence hangs the transmission because the driver believes it has
sent a frame and waits for the interrupt signaling completion, but in
reality the chip has never sent away the frame since the commands it
received were malformed.

Fix by acquiring the SPI lock in hi3110_get_berr_counter().

I've scrutinized the entire driver for further unlocked SPI accesses but
found no others.

Cc: Mathias Duckeck &lt;m.duckeck@kunbus.de&gt;
Cc: Akshay Bhat &lt;akshay.bhat@timesys.com&gt;
Cc: Casey Fitzpatrick &lt;casey.fitzpatrick@timesys.com&gt;
Cc: Stef Walter &lt;stefw@redhat.com&gt;
Cc: Karel Zak &lt;kzak@redhat.com&gt;
Cc: stable@vger.kernel.org # v4.12+
Signed-off-by: Lukas Wunner &lt;lukas@wunner.de&gt;
Reviewed-by: Akshay Bhat &lt;akshay.bhat@timesys.com&gt;
Signed-off-by: Marc Kleine-Budde &lt;mkl@pengutronix.de&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;

</content>
</entry>
<entry>
<title>can: mcp251x: mcp251x_setup(): remove unused parameter "struct mcp251x_priv *priv"</title>
<updated>2018-01-05T10:12:08+00:00</updated>
<author>
<name>Marc Kleine-Budde</name>
<email>mkl@pengutronix.de</email>
</author>
<published>2017-12-06T14:17:44+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=aa68172235ba7a8514a5c1b50360235f10058971'/>
<id>urn:sha1:aa68172235ba7a8514a5c1b50360235f10058971</id>
<content type='text'>
The 2nd parameter of mcp251x_setup() "struct mcp251x_priv *priv" is not
used, so remove it.

Suggested-by: Oleksij Rempel &lt;o.rempel@pengutronix.de&gt;
Signed-off-by: Marc Kleine-Budde &lt;mkl@pengutronix.de&gt;
</content>
</entry>
<entry>
<title>can: hi311x: Add Holt HI-311x CAN driver</title>
<updated>2017-04-04T15:35:59+00:00</updated>
<author>
<name>Akshay Bhat</name>
<email>akshay.bhat@timesys.com</email>
</author>
<published>2017-03-17T21:10:40+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=57e83fb9b7468c75cb65cde1d23043553c346c6d'/>
<id>urn:sha1:57e83fb9b7468c75cb65cde1d23043553c346c6d</id>
<content type='text'>
This patch adds support for the Holt HI-311x CAN controller. The HI311x
CAN controller is capable of transmitting and receiving standard data
frames, extended data frames and remote frames. The HI311x interfaces
with the host over SPI.

Datasheet: www.holtic.com/documents/371-hi-3110_v-rev-jpdf.do

Signed-off-by: Akshay Bhat &lt;nodeax@gmail.com&gt;
Acked-by: Wolfgang Grandegger &lt;wg@grandegger.com&gt;
Signed-off-by: Marc Kleine-Budde &lt;mkl@pengutronix.de&gt;
</content>
</entry>
<entry>
<title>can: mcp251x: add message about sucessful/unsuccessful probe</title>
<updated>2016-06-23T09:23:49+00:00</updated>
<author>
<name>Ed Spiridonov</name>
<email>edo.rus@gmail.com</email>
</author>
<published>2016-06-20T18:40:15+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=b63f69d0fc1fa1e25842a2266633862d523c380f'/>
<id>urn:sha1:b63f69d0fc1fa1e25842a2266633862d523c380f</id>
<content type='text'>
Silent ignorance of errors during probe procedure is a bad thing, this
patch fixes it. Extra message added for hardware initialization
failure. Such common issues are mostly caused by wrong wiring.  Message
about success added as well, it should be useful to debug new hardware
configuration, especially in case of several CAN buses.

Signed-off-by: Ed Spiridonov &lt;edo.rus@gmail.com&gt;
Signed-off-by: Marc Kleine-Budde &lt;mkl@pengutronix.de&gt;
</content>
</entry>
<entry>
<title>can: mcp251x: Replace create_freezable_workqueue with alloc_workqueue</title>
<updated>2016-05-09T09:07:28+00:00</updated>
<author>
<name>Amitoj Kaur Chawla</name>
<email>amitoj1606@gmail.com</email>
</author>
<published>2016-04-08T15:32:10+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=b6fd3aba6041922e115bd8e10539b8545f4120ac'/>
<id>urn:sha1:b6fd3aba6041922e115bd8e10539b8545f4120ac</id>
<content type='text'>
Replace scheduled to be removed create_freezable_workqueue with
alloc_workqueue.

priv-&gt;wq should be explicitly set as freezable to ensure it is frozen
in the suspend sequence and work items are drained so that no new work
item starts execution until thawed. Thus, use of WQ_FREEZABLE flag
here is required.

WQ_MEM_RECLAIM flag has been set here to ensure forward progress
regardless of memory pressure.

The order of execution is not important so set @max_active as 0.

Signed-off-by: Amitoj Kaur Chawla &lt;amitoj1606@gmail.com&gt;
Acked-by: Tejun Heo &lt;tj@kernel.org&gt;
Signed-off-by: Marc Kleine-Budde &lt;mkl@pengutronix.de&gt;
</content>
</entry>
<entry>
<title>can: mcp251x: avoid write to error flag register if it's unnecessary</title>
<updated>2016-03-04T07:45:17+00:00</updated>
<author>
<name>Ed Spiridonov</name>
<email>edo.rus@gmail.com</email>
</author>
<published>2016-03-04T06:07:27+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=d694b06c42a56c9610861ee0474b4d441af8ada6'/>
<id>urn:sha1:d694b06c42a56c9610861ee0474b4d441af8ada6</id>
<content type='text'>
Only two bits (RX0OVR and RX1OVR) are writable in EFLG, write is useless
if these bits aren't set.

Signed-off-by: Ed Spiridonov &lt;edo.rus@gmail.com&gt;
Signed-off-by: Marc Kleine-Budde &lt;mkl@pengutronix.de&gt;
</content>
</entry>
<entry>
<title>spi: Drop owner assignment from spi_drivers</title>
<updated>2015-10-28T01:30:17+00:00</updated>
<author>
<name>Andrew F. Davis</name>
<email>afd@ti.com</email>
</author>
<published>2015-10-23T13:59:11+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=3821a065f5672c430a088ae68b4da2a2d2b34106'/>
<id>urn:sha1:3821a065f5672c430a088ae68b4da2a2d2b34106</id>
<content type='text'>
An spi_driver does not need to set an owner, it will be populated by the
driver core.

Signed-off-by: Andrew F. Davis &lt;afd@ti.com&gt;
Acked-by: Jonathan Cameron &lt;jic23@kernel.org&gt;
Signed-off-by: Mark Brown &lt;broonie@kernel.org&gt;
</content>
</entry>
<entry>
<title>can: mcp251x: get regulators optionally</title>
<updated>2015-07-16T07:04:22+00:00</updated>
<author>
<name>Stefan Agner</name>
<email>stefan@agner.ch</email>
</author>
<published>2015-05-18T16:33:28+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=69da3f2ac528642acbd06ed14564ac1b9a918394'/>
<id>urn:sha1:69da3f2ac528642acbd06ed14564ac1b9a918394</id>
<content type='text'>
The regulators power and transceiver are optional. If those are not
present, the pointer (or error pointer) is correctly handled by the
driver, hence we can use devm_regulator_get_optional safely, which
avoids regulators getting created.

Signed-off-by: Stefan Agner &lt;stefan@agner.ch&gt;
Signed-off-by: Marc Kleine-Budde &lt;mkl@pengutronix.de&gt;
</content>
</entry>
<entry>
<title>can: mcp251x: fix resume when device is down</title>
<updated>2015-07-16T07:04:21+00:00</updated>
<author>
<name>Stefan Agner</name>
<email>stefan@agner.ch</email>
</author>
<published>2015-05-18T16:33:27+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=25b401c1816ae64bcc5dcb1d39ab41812522a0ce'/>
<id>urn:sha1:25b401c1816ae64bcc5dcb1d39ab41812522a0ce</id>
<content type='text'>
If a valid power regulator or a dummy regulator is used (which
happens to be the case when no regulator is specified), restart_work
is queued no matter whether the device was running or not at suspend
time. Since work queues get initialized in the ndo_open callback,
resuming leads to a NULL pointer exception.

Reverse exactly the steps executed at suspend time:
- Enable the power regulator in any case
- Enable the transceiver regulator if the device was running, even in
  case we have a power regulator
- Queue restart_work only in case the device was running

Fixes: bf66f3736a94 ("can: mcp251x: Move to threaded interrupts instead of workqueues.")
Signed-off-by: Stefan Agner &lt;stefan@agner.ch&gt;
Cc: linux-stable &lt;stable@vger.kernel.org&gt;
Signed-off-by: Marc Kleine-Budde &lt;mkl@pengutronix.de&gt;
</content>
</entry>
</feed>
