<feed xmlns='http://www.w3.org/2005/Atom'>
<title>user/sven/linux.git/drivers/platform/chrome/cros_ec_uart.c, branch next/master</title>
<subtitle>Linux Kernel
</subtitle>
<id>https://git.stealer.net/cgit.cgi/user/sven/linux.git/atom?h=next%2Fmaster</id>
<link rel='self' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/atom?h=next%2Fmaster'/>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/'/>
<updated>2025-09-14T03:34:41Z</updated>
<entry>
<title>platform/chrome: Centralize common cros_ec_device initialization</title>
<updated>2025-09-14T03:34:41Z</updated>
<author>
<name>Tzung-Bi Shih</name>
<email>tzungbi@kernel.org</email>
</author>
<published>2025-08-28T08:35:58Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=e19ceeb1c0f63e3e15b197c5f34797134b51ba0e'/>
<id>urn:sha1:e19ceeb1c0f63e3e15b197c5f34797134b51ba0e</id>
<content type='text'>
Move the common initialization from protocol device drivers into central
cros_ec_device_alloc().

This removes duplicated code from each driver's probe function.
The buffer sizes are now calculated once, using the maximum possible
overhead required by any of the transport protocols, ensuring the
allocated buffers are sufficient for all cases.

Link: https://lore.kernel.org/r/20250828083601.856083-3-tzungbi@kernel.org
Signed-off-by: Tzung-Bi Shih &lt;tzungbi@kernel.org&gt;
</content>
</entry>
<entry>
<title>platform/chrome: Centralize cros_ec_device allocation</title>
<updated>2025-09-14T03:34:41Z</updated>
<author>
<name>Tzung-Bi Shih</name>
<email>tzungbi@kernel.org</email>
</author>
<published>2025-08-28T08:35:57Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=918856986014142271a70a334d300994b9c41720'/>
<id>urn:sha1:918856986014142271a70a334d300994b9c41720</id>
<content type='text'>
Introduce a helper function, cros_ec_device_alloc(), to centralize the
allocation of the struct cros_ec_device.  Convert all protocol device
drivers to use this new function.

This is a preparatory step for separating common initialization logic
out of device drivers' probe() and cros_ec_register().

Link: https://lore.kernel.org/r/20250828083601.856083-2-tzungbi@kernel.org
Signed-off-by: Tzung-Bi Shih &lt;tzungbi@kernel.org&gt;
</content>
</entry>
<entry>
<title>platform/chrome: cros_ec: jump to RW before probing</title>
<updated>2024-12-30T01:31:05Z</updated>
<author>
<name>Dawid Niedzwiecki</name>
<email>dawidn@google.com</email>
</author>
<published>2024-12-06T09:15:13Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=5ffa0dbfdc9fc05acae02d5b0dc766ec778569ac'/>
<id>urn:sha1:5ffa0dbfdc9fc05acae02d5b0dc766ec778569ac</id>
<content type='text'>
There are EC devices, like FPMCU, that use RWSIG as a method of
authenticating RW section. After the authentication succeeds, EC device
waits some time before jumping to RW. EC can be probed before the jump,
which means there is a time window after jump to RW in which EC won't
respond, because it is not initialized. It can cause a communication
errors after probing.

To avoid such problems, send the RWSIG continue command first, which
skips waiting for the jump to RW. Send the command more times, to make
sure EC is ready in RW before the start of the actual probing process. If
a EC device doesn't support the RWSIG, it will respond with invalid
command error code and probing will continue as usual.

Signed-off-by: Dawid Niedzwiecki &lt;dawidn@google.com&gt;
Link: https://lore.kernel.org/r/20241206091514.2538350-2-dawidn@google.com
Signed-off-by: Tzung-Bi Shih &lt;tzungbi@kernel.org&gt;
</content>
</entry>
<entry>
<title>Merge tag 'tag-chrome-platform-fixes-for-v6.9-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/chrome-platform/linux</title>
<updated>2024-04-11T18:15:09Z</updated>
<author>
<name>Linus Torvalds</name>
<email>torvalds@linux-foundation.org</email>
</author>
<published>2024-04-11T18:15:09Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=346668f02a770f84bfcbac0c07e70569349eba08'/>
<id>urn:sha1:346668f02a770f84bfcbac0c07e70569349eba08</id>
<content type='text'>
Pull chrome platform fix from Tzung-Bi Shih:
 "Fix a NULL pointer dereference"

* tag 'tag-chrome-platform-fixes-for-v6.9-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/chrome-platform/linux:
  platform/chrome: cros_ec_uart: properly fix race condition
</content>
</entry>
<entry>
<title>platform/chrome: cros_ec_uart: properly fix race condition</title>
<updated>2024-04-11T01:53:04Z</updated>
<author>
<name>Noah Loomans</name>
<email>noah@noahloomans.com</email>
</author>
<published>2024-04-10T18:26:19Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=5e700b384ec13f5bcac9855cb28fcc674f1d3593'/>
<id>urn:sha1:5e700b384ec13f5bcac9855cb28fcc674f1d3593</id>
<content type='text'>
The cros_ec_uart_probe() function calls devm_serdev_device_open() before
it calls serdev_device_set_client_ops(). This can trigger a NULL pointer
dereference:

    BUG: kernel NULL pointer dereference, address: 0000000000000000
    ...
    Call Trace:
     &lt;TASK&gt;
     ...
     ? ttyport_receive_buf

A simplified version of crashing code is as follows:

    static inline size_t serdev_controller_receive_buf(struct serdev_controller *ctrl,
                                                      const u8 *data,
                                                      size_t count)
    {
            struct serdev_device *serdev = ctrl-&gt;serdev;

            if (!serdev || !serdev-&gt;ops-&gt;receive_buf) // CRASH!
                return 0;

            return serdev-&gt;ops-&gt;receive_buf(serdev, data, count);
    }

It assumes that if SERPORT_ACTIVE is set and serdev exists, serdev-&gt;ops
will also exist. This conflicts with the existing cros_ec_uart_probe()
logic, as it first calls devm_serdev_device_open() (which sets
SERPORT_ACTIVE), and only later sets serdev-&gt;ops via
serdev_device_set_client_ops().

Commit 01f95d42b8f4 ("platform/chrome: cros_ec_uart: fix race
condition") attempted to fix a similar race condition, but while doing
so, made the window of error for this race condition to happen much
wider.

Attempt to fix the race condition again, making sure we fully setup
before calling devm_serdev_device_open().

Fixes: 01f95d42b8f4 ("platform/chrome: cros_ec_uart: fix race condition")
Cc: stable@vger.kernel.org
Signed-off-by: Noah Loomans &lt;noah@noahloomans.com&gt;
Reviewed-by: Guenter Roeck &lt;groeck@chromium.org&gt;
Link: https://lore.kernel.org/r/20240410182618.169042-2-noah@noahloomans.com
Signed-off-by: Tzung-Bi Shih &lt;tzungbi@kernel.org&gt;
</content>
</entry>
<entry>
<title>treewide, serdev: change receive_buf() return type to size_t</title>
<updated>2024-01-28T02:13:53Z</updated>
<author>
<name>Francesco Dolcini</name>
<email>francesco.dolcini@toradex.com</email>
</author>
<published>2024-01-22T18:05:51Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=fed99212acae832607817b24fa589f8aaf03103f'/>
<id>urn:sha1:fed99212acae832607817b24fa589f8aaf03103f</id>
<content type='text'>
receive_buf() is called from ttyport_receive_buf() that expects values
"&gt;= 0" from serdev_controller_receive_buf(), change its return type from
ssize_t to size_t.

The need for this clean-up was noticed while fixing a warning, see
commit 94d053942544 ("Bluetooth: btnxpuart: fix recv_buf() return value").
Changing the callback prototype to return an unsigned seems the best way
to document the API and ensure that is properly used.

GNSS drivers implementation of serdev receive_buf() callback return
directly the return value of gnss_insert_raw(). gnss_insert_raw()
returns a signed int, however this is not an issue since the value
returned is always positive, because of the kfifo_in() implementation.
gnss_insert_raw() could be changed to return also an unsigned, however
this is not implemented here as request by the GNSS maintainer Johan
Hovold.

Suggested-by: Jiri Slaby &lt;jirislaby@kernel.org&gt;
Link: https://lore.kernel.org/all/087be419-ec6b-47ad-851a-5e1e3ea5cfcc@kernel.org/
Signed-off-by: Francesco Dolcini &lt;francesco.dolcini@toradex.com&gt;
Acked-by: Jonathan Cameron &lt;Jonathan.Cameron@huawei.com&gt; #for-iio
Reviewed-by: Johan Hovold &lt;johan@kernel.org&gt;
Reviewed-by: Rob Herring &lt;robh@kernel.org&gt;
Reviewed-by: Alex Elder &lt;elder@linaro.org&gt;
Acked-by: Maximilian Luz &lt;luzmaximilian@gmail.com&gt;  # for platform/surface
Acked-by: Lee Jones &lt;lee@kernel.org&gt;
Acked-by: Ilpo Järvinen &lt;ilpo.jarvinen@linux.intel.com&gt;
Link: https://lore.kernel.org/r/20240122180551.34429-1-francesco@dolcini.it
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>tty: serdev: convert to u8 and size_t</title>
<updated>2023-12-08T11:02:38Z</updated>
<author>
<name>Jiri Slaby (SUSE)</name>
<email>jirislaby@kernel.org</email>
</author>
<published>2023-12-06T07:37:08Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=475fc6e2de6fec0ff3c9a74ddcfd2b52c90adc0d'/>
<id>urn:sha1:475fc6e2de6fec0ff3c9a74ddcfd2b52c90adc0d</id>
<content type='text'>
Switch character types to u8 and sizes to size_t. To conform to
characters/sizes in the rest of the tty layer.

This patch converts struct serdev_device_ops hooks and its
instantiations.

Signed-off-by: "Jiri Slaby (SUSE)" &lt;jirislaby@kernel.org&gt;
Cc: Rob Herring &lt;robh@kernel.org&gt;
Acked-by: Johan Hovold &lt;johan@kernel.org&gt;
Link: https://lore.kernel.org/r/20231206073712.17776-24-jirislaby@kernel.org
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>platform/chrome: cros_ec_uart: fix negative type promoted to high</title>
<updated>2023-01-18T02:57:51Z</updated>
<author>
<name>Tzung-Bi Shih</name>
<email>tzungbi@kernel.org</email>
</author>
<published>2023-01-09T08:15:54Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=8bb233b27fb7c11deefbe2318e75490b22cf3d1a'/>
<id>urn:sha1:8bb233b27fb7c11deefbe2318e75490b22cf3d1a</id>
<content type='text'>
serdev_device_write_buf() returns negative numbers on errors.  When
the return value compares to unsigned integer `len`, it promotes to
quite large positive number.

Fix it.

Fixes: 04a8bdd135cc ("platform/chrome: cros_ec_uart: Add transport layer")
Reported-by: Dan Carpenter &lt;error27@gmail.com&gt;
Signed-off-by: Tzung-Bi Shih &lt;tzungbi@kernel.org&gt;
Reviewed-by: Dan Carpenter &lt;dan.carpenter@oracle.com&gt;
Reviewed-by: Benson Leung &lt;bleung@chromium.org&gt;
Link: https://lore.kernel.org/r/20230109081554.3792547-1-tzungbi@kernel.org
</content>
</entry>
<entry>
<title>platform/chrome: cros_ec_uart: fix race condition</title>
<updated>2023-01-05T15:27:14Z</updated>
<author>
<name>Robert Zieba</name>
<email>robertzieba@google.com</email>
</author>
<published>2022-12-29T09:47:38Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=01f95d42b8f4e88f20d68791b0a85dbb9e3d1ac9'/>
<id>urn:sha1:01f95d42b8f4e88f20d68791b0a85dbb9e3d1ac9</id>
<content type='text'>
serdev_device_set_client_ops() is called before `ec_dev` is fully
initialized.  This can result in cros_ec_uart_rx_bytes() being called
while `ec_dev` is still not initialized, resulting in a kernel panic.

Call serdev_device_set_client_ops() after `ec_dev` is initialized.

Fixes: 04a8bdd135cc ("platform/chrome: cros_ec_uart: Add transport layer")
Signed-off-by: Robert Zieba &lt;robertzieba@google.com&gt;
[tzungbi: modified commit message and fixed context conflict.]
Signed-off-by: Tzung-Bi Shih &lt;tzungbi@kernel.org&gt;
Reviewed-by: Guenter Roeck &lt;groeck@chromium.org&gt;
Link: https://lore.kernel.org/r/20221229094738.2304044-1-tzungbi@kernel.org
</content>
</entry>
<entry>
<title>platform/chrome: cros_ec_uart: Add DT enumeration support</title>
<updated>2023-01-05T15:27:14Z</updated>
<author>
<name>Bhanu Prakash Maiya</name>
<email>bhanumaiya@chromium.org</email>
</author>
<published>2022-12-27T19:32:24Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=f9bce00f78ed9ff9c38130388c13a2b2b72b857e'/>
<id>urn:sha1:f9bce00f78ed9ff9c38130388c13a2b2b72b857e</id>
<content type='text'>
Existing firmware uses the "PRP0001" _HID and an associated compatible
string to enumerate the cros_ec_uart.

Add DT enumeration support for already shipped firmware.

Signed-off-by: Bhanu Prakash Maiya &lt;bhanumaiya@chromium.org&gt;
Co-developed-by: Mark Hasemeyer &lt;markhas@chromium.org&gt;
Signed-off-by: Mark Hasemeyer &lt;markhas@chromium.org&gt;
Reviewed-by: Prashant Malani &lt;pmalani@chromium.org&gt;
Signed-off-by: Tzung-Bi Shih &lt;tzungbi@kernel.org&gt;
Link: https://lore.kernel.org/r/20221227123212.v13.3.Ie23c217d69ff25d7354db942613f143bbc8ef891@changeid
</content>
</entry>
</feed>
