- 02 Aug, 2019 1 commit
-
-
The SPI thingies request FIFO-99 by default, reduce this to FIFO-50. FIFO-99 is the very highest priority available to SCHED_FIFO and it not a suitable default; it would indicate the SPI work is the most important work on the machine. Cc: Benson Leung <bleung@chromium.org> Cc: Enric Balletbo i Serra <enric.balletbo@collabora.com> Cc: Guenter Roeck <groeck@chromium.org> Cc: Mark Brown <broonie@kernel.org> Cc: linux-spi@vger.kernel.org Cc: linux-kernel@vger.kernel.org Signed-off-by:
Peter Zijlstra (Intel) <peterz@infradead.org> Reviewed-by:
Douglas Anderson <dianders@chromium.org> Link: https://lore.kernel.org/r/20190801111541.917256884@infradead.org Signed-off-by:
Mark Brown <broonie@kernel.org>
-
- 24 May, 2019 1 commit
-
-
Douglas Anderson authored
All currently known ECs in the wild are very sensitive to timing. Specifically the ECs are known to drop a transfer if more than 8 ms passes from the assertion of the chip select until the transfer finishes. Let's use the new feature introduced in the patch (spi: Allow SPI devices to request the pumping thread be realtime") to request the SPI pumping thread be realtime. This means that if we get shunted off to the SPI thread for whatever reason we won't get downgraded to low priority. NOTES: - We still need to keep ourselves as high priority since the SPI core doesn't guarantee that all transfers end up on the pumping thread (in fact, it tries pretty hard to do them in the calling context). - If future Chrome OS ECs ever fix themselves to be less sensitive then we could consider adding a property (or compatible string) to not set this property. For now we need it across the board. Signed-off-by:
Douglas Anderson <dianders@chromium.org> Reviewed-by:
Guenter Roeck <groeck@chromium.org> Signed-off-by:
Enric Balletbo i Serra <enric.balletbo@collabora.com>
-
- 20 May, 2019 2 commits
-
-
Douglas Anderson authored
In commit 37a18622 ("platform/chrome: cros_ec_spi: Transfer messages at high priority") we moved transfers to a high priority workqueue. This helped make them much more reliable. ...but, we still saw failures. We were actually finding ourselves competing for time with dm-crypt which also scheduled work on HIGHPRI workqueues. While we can consider reverting the change that made dm-crypt run its work at HIGHPRI, the argument in commit a1b89132 ("dm crypt: use WQ_HIGHPRI for the IO and crypt workqueues") is somewhat compelling. It does make sense for IO to be scheduled at a priority that's higher than the default user priority. It also turns out that dm-crypt isn't alone in using high priority like this. loop_prepare_queue() does something similar for loopback devices. Looking in more detail, it can be seen that the high priority workqueue isn't actually that high of a priority. It runs at MIN_NICE which is _fairly_ high priority but still below all real time priority. Should we move cros_ec_spi to real time priority to fix our problems, or is this just escalating a priority war? I'll argue here that cros_ec_spi _does_ belong at real time priority. Specifically cros_ec_spi actually needs to run quickly for correctness. As I understand this is exactly what real time priority is for. There currently doesn't appear to be any way to use the standard workqueue APIs with a real time priority, so we'll switch over to using using a kthread worker. We'll match the priority that the SPI core uses when it wants to do things on a realtime thread and just use "MAX_RT_PRIO - 1". This commit plus the patch ("platform/chrome: cros_ec_spi: Request the SPI thread be realtime") are enough to get communications very close to 100% reliable (the only known problem left is when serial console is turned on, which isn't something that happens in shipping devices). Specifically this test case now passes (tested on rk3288-veyron-jerry): dd if=/dev/zero of=/var/log/foo.txt bs=4M count=512& while true; do ectool version > /dev/null; done It should be noted that "/var/log" is encrypted (and goes through dm-crypt) and also passes through a loopback device. Signed-off-by:
Douglas Anderson <dianders@chromium.org> Reviewed-by:
Guenter Roeck <groeck@chromium.org> Signed-off-by:
Enric Balletbo i Serra <enric.balletbo@collabora.com>
-
Evan Green authored
The Chrome OS EC driver attaches to devices using the of_match_table even when ACPI is the underlying firmware. It does this using the magic PRP0001 ACPI HID, which tells ACPI to go find an OF compatible string under the hood and match on that. The cros_ec_spi driver needs to provide the of_match_table regardless of whether CONFIG_OF is enabled or not, since the table is used by ACPI for PRP0001 devices. Signed-off-by:
Evan Green <evgreen@chromium.org> Reviewed-by:
Benson Leung <bleung@chromium.org> Signed-off-by:
Enric Balletbo i Serra <enric.balletbo@collabora.com>
-
- 15 Apr, 2019 1 commit
-
-
Douglas Anderson authored
The software running on the Chrome OS Embedded Controller (cros_ec) handles SPI transfers in a bit of a wonky way. Specifically if the EC sees too long of a delay in a SPI transfer it will give up and the transfer will be counted as failed. Unfortunately the timeout is fairly short, though the actual number may be different for different EC codebases. We can end up tripping the timeout pretty easily if we happen to preempt the task running the SPI transfer and don't get back to it for a little while. Historically this hasn't been a _huge_ deal because: 1. On old devices Chrome OS used to run PREEMPT_VOLUNTARY. That meant we were pretty unlikely to take a big break from the transfer. 2. On recent devices we had faster / more processors. 3. Recent devices didn't use "cros-ec-spi-pre-delay". Using that delay makes us more likely to trip this use case. 4. For whatever reasons (I didn't dig) old kernels seem to be less likely to trip this. 5. For the most part it's kinda OK if a few transfers to the EC fail. Mostly we're just polling the battery or doing some other task where we'll try again. Even with the above things, this issue has reared its ugly head periodically. We could solve this in a nice way by adding reliable retries to the EC protocol [1] or by re-designing the code in the EC codebase to allow it to wait longer, but that code doesn't ever seem to get changed. ...and even if it did, it wouldn't help old devices. It's now time to finally take a crack at making this a little better. This patch isn't guaranteed to make every cros_ec SPI transfer perfect, but it should improve things by a few orders of magnitude. Specifically you can try this on a rk3288-veyron Chromebook (which is slower and also _does_ need "cros-ec-spi-pre-delay"): md5sum /dev/zero & md5sum /dev/zero & md5sum /dev/zero & md5sum /dev/zero & while true; do cat /sys/class/power_supply/sbs-20-000b/charge_now > /dev/null; done ...before this patch you'll see boatloads of errors. After this patch I don't see any in the testing I did. The way this patch works is by effectively boosting the priority of the cros_ec transfers. As far as I know there is no simple way to just boost the priority of the current process temporarily so the way we accomplish this is by queuing the work on the system_highpri_wq. NOTE: this patch relies on the fact that the SPI framework attempts to push the messages out on the calling context (which is the one that is boosted to high priority). As I understand from earlier (long ago) discussions with Mark Brown this should be a fine assumption. Even if it isn't true sometimes this patch will still not make things worse. [1] https://crbug.com/678675 Signed-off-by:
Douglas Anderson <dianders@chromium.org> Reviewed-by:
Matthias Kaehlcke <mka@chromium.org> Reviewed-by:
Brian Norris <briannorris@chromium.org> Signed-off-by:
Enric Balletbo i Serra <enric.balletbo@collabora.com>
-
- 01 Feb, 2019 2 commits
-
-
Enric Balletbo i Serra authored
Adopt the SPDX license identifier headers to ease license compliance management. Also change the description for one more appropriate. Signed-off-by:
Enric Balletbo i Serra <enric.balletbo@collabora.com> Reviewed-by:
Guenter Roeck <groeck@chromium.org>
-
Enric Balletbo i Serra authored
Use devm_mfd_add_devices() for adding cros-ec core MFD child devices. This reduces the need of remove callback from platform/chrome for removing the MFD child devices. Signed-off-by:
Enric Balletbo i Serra <enric.balletbo@collabora.com> Reviewed-by:
Guenter Roeck <groeck@chromium.org> Signed-off-by:
Lee Jones <lee.jones@linaro.org>
-
- 03 Jul, 2018 1 commit
-
-
Enric Balletbo i Serra authored
There are some cros-ec transport drivers (I2C, SPI) living in MFD, while others (LPC) living in drivers/platform. The transport drivers are more platform specific. So, move the I2C and SPI transport drivers to the platform/chrome directory. The patch also removes the MFD_ prefix of their Kconfig symbols. Signed-off-by:
Enric Balletbo i Serra <enric.balletbo@collabora.com> Reviewed-by:
Guenter Roeck <groeck@chromium.org> Acked-by:
Lee Jones <lee.jones@linaro.org> Signed-off-by:
Benson Leung <bleung@chromium.org>
-
- 23 May, 2018 1 commit
-
-
Brian Norris authored
Commit 001dde94 ("mfd: cros ec: spi: Fix "in progress" error signaling") pointed out some bad code, but its analysis and conclusion was not 100% correct. It *is* correct that we should not propagate result==EC_RES_IN_PROGRESS for transport errors, because this has a special meaning -- that we should follow up with EC_CMD_GET_COMMS_STATUS until the EC is no longer busy. This is definitely the wrong thing for many commands, because among other problems, EC_CMD_GET_COMMS_STATUS doesn't actually retrieve any RX data from the EC, so commands that expected some data back will instead start processing junk. For such commands, the right answer is to either propagate the error (and return that error to the caller) or resend the original command (*not* EC_CMD_GET_COMMS_STATUS). Unfortunately, commit 001dde94 forgets a crucial point: that for some long-running operations, the EC physically cannot respond to commands any more. For example, with EC_CMD_FLASH_ERASE, the EC may be re-flashing its own code regions, so it can't respond to SPI interrupts. Instead, the EC prepares us ahead of time for being busy for a "long" time, and fills its hardware buffer with EC_SPI_PAST_END. Thus, we expect to see several "transport" errors (or, messages filled with EC_SPI_PAST_END). So we should really translate that to a retryable error (-EAGAIN) and continue sending EC_CMD_GET_COMMS_STATUS until we get a ready status. IOW, it is actually important to treat some of these "junk" values as retryable errors. Together with commit 001dde94, this resolves bugs like the following: 1. EC_CMD_FLASH_ERASE now works again (with commit 001dde94, we would abort the first time we saw EC_SPI_PAST_END) 2. Before commit 001dde94, transport errors (e.g., EC_SPI_RX_BAD_DATA) seen in other commands (e.g., EC_CMD_RTC_GET_VALUE) used to yield junk data in the RX buffer; they will now yield -EAGAIN return values, and tools like 'hwclock' will simply fail instead of retrieving and re-programming undefined time values Fixes: 001dde94 ("mfd: cros ec: spi: Fix "in progress" error signaling") Signed-off-by:
Brian Norris <briannorris@chromium.org> Signed-off-by:
Lee Jones <lee.jones@linaro.org>
-
- 08 Jan, 2018 1 commit
-
-
Jon Hunter authored
The EC SPI driver prevents SPI transfers being to rapidly by keeping track of the time the last transfer was issued via the 'last_transfer_ns' variable. Previously, if the 'last_transfer_ns' variable was zero, this indicated that no previous transfer had been sent and that no delay was needed. However, the EC SPI driver has been updated to always initialise the 'last_transfer_ns' variable during probe and therefore, it is no longer necessary to test if it is zero. Remove the code that checks if this variable is zero. Signed-off-by:
Jon Hunter <jonathanh@nvidia.com> Reviewed-by:
Brian Norris <briannorris@chromium.org> Reviewed-by:
Douglas Anderson <dianders@chromium.org> Acked-by:
Benson Leung <bleung@chromium.org> Signed-off-by:
Lee Jones <lee.jones@linaro.org>
-
- 29 Nov, 2017 2 commits
-
-
Shawn Nematbakhsh authored
For host commands that take a long time to process, cros ec can return early by signaling a EC_RES_IN_PROGRESS result. The host must then poll status with EC_CMD_GET_COMMS_STATUS until completion of the command. None of the above applies when data link errors are encountered. When errors such as EC_SPI_PAST_END are encountered during command transmission, it usually means the command was not received by the EC. Treating such errors as if they were 'EC_RES_IN_PROGRESS' results is almost always the wrong decision, and can result in host commands silently being lost. Reported-by:
Jon Hunter <jonathanh@nvidia.com> Signed-off-by:
Shawn Nematbakhsh <shawnn@chromium.org> Reviewed-by:
Brian Norris <briannorris@chromium.org> Tested-by:
Jon Hunter <jonathanh@nvidia.com> Signed-off-by:
Lee Jones <lee.jones@linaro.org>
-
Jon Hunter authored
On the Tegra124 Nyan-Big chromebook the very first SPI message sent to the EC is failing. The Tegra SPI driver configures the SPI chip-selects to be active-high by default (and always has for many years). The EC SPI requires an active-low chip-select and so the Tegra chip-select is reconfigured to be active-low when the EC SPI driver calls spi_setup(). The problem is that if the first SPI message to the EC is sent too soon after reconfiguring the SPI chip-select, it fails. The EC SPI driver prevents back-to-back SPI messages being sent too soon by keeping track of the time the last transfer was sent via the variable 'last_transfer_ns'. To prevent the very first transfer being sent too soon, initialise the 'last_transfer_ns' variable after calling spi_setup() and before sending the first SPI message. Cc: <stable@vger.kernel.org> Signed-off-by:
Jon Hunter <jonathanh@nvidia.com> Reviewed-by:
Brian Norris <briannorris@chromium.org> Reviewed-by:
Douglas Anderson <dianders@chromium.org> Acked-by:
Benson Leung <bleung@chromium.org> Signed-off-by:
Lee Jones <lee.jones@linaro.org>
-
- 27 Apr, 2017 1 commit
-
-
Doug Anderson authored
This is a sucky change to bump up the time we'll wait for the EC. Why is it sucky? If 200ms for a transfer is a common thing it will have a massively bad impact on keyboard responsiveness. It still seems like a good idea to do this, though, because we have a gas gauge that claims that in an extreme case it could stretch the i2c clock for 144ms. It's not a common case so it shouldn't affect responsiveness, but it can happen. It's much better to have a single slow keyboard response than to start returning errors when we don't have to. In newer EC designs we should probably implement a virtual battery to respond to the kernel to insulate the kernel from these types of issues. Signed-off-by:
Doug Anderson <dianders@chromium.org> Signed-off-by:
Enric Balletbo i Serra <enric.balletbo@collabora.com> Signed-off-by:
Lee Jones <lee.jones@linaro.org>
-
- 04 Oct, 2016 1 commit
-
-
Lee Jones authored
Signed-off-by:
Lee Jones <lee.jones@linaro.org>
-
- 14 Jan, 2016 1 commit
-
-
Lee Jones authored
WARNING: Comparisons should place the constant on the right side of the test + BUG_ON(EC_MSG_PREAMBLE_COUNT > ec_dev->din_size); WARNING: Comparisons should place the constant on the right side of the test + BUG_ON(EC_MSG_PREAMBLE_COUNT > ec_dev->din_size); total: 0 errors, 2 warnings, 731 lines checked Signed-off-by:
Lee Jones <lee.jones@linaro.org>
-
- 11 Jan, 2016 1 commit
-
-
Nicolas Boichat authored
cros_ec_cmd_xfer_spi and cros_ec_pkt_xfer_spi generally work like this: - Pull CS down (active), wait a bit, then send a command - Wait for response (multiple requests) - Wait a while, pull CS up (inactive) These operations, individually, lock the SPI bus, but there is nothing preventing the SPI framework from interleaving messages intended for other devices as the bus is unlocked in between. This is a problem as the EC expects CS to be held low for the whole duration. Solution: Lock the SPI bus during the whole transaction, to make sure that no other messages can be interleaved. Signed-off-by:
Nicolas Boichat <drinkcat@chromium.org> Reviewed-by:
Gwendal Grignou <gwendal@chromium.org> Signed-off-by:
Lee Jones <lee.jones@linaro.org>
-
- 28 Oct, 2015 1 commit
-
-
An spi_driver does not need to set an owner, it will be populated by the driver core. Signed-off-by:
Andrew F. Davis <afd@ti.com> Acked-by:
Jonathan Cameron <jic23@kernel.org> Signed-off-by:
Mark Brown <broonie@kernel.org>
-
- 24 Aug, 2015 1 commit
-
-
Javier Martinez Canillas authored
The Documentation/devicetree/bindings/mfd/cros-ec.txt DT binding doc lists "google,cros-ec-spi" as a compatible string but the corresponding driver does not have an OF match table. Add the table to the driver so the SPI core can do an OF style match. Signed-off-by:
Javier Martinez Canillas <javier@osg.samsung.com> Signed-off-by:
Lee Jones <lee.jones@linaro.org>
-
- 15 Jun, 2015 6 commits
-
-
Alexandru M Stan authored
Some ECs need a little time for waking up before they can accept SPI data at a high speed. This is configurable via a DT property "google,cros-ec-spi-pre-delay". This patch makes the cros_ec_spi driver to cause a delay before the beginning of a SPI transaction, to make sure that the EC has already woken up, if the property has been defined in the DTS. Signed-off-by:
Alexandru M Stan <amstan@chromium.org> Reviewed-by:
Doug Anderson <dianders@chromium.org> Signed-off-by:
Chris Zhong <zyw@rock-chips.com> Signed-off-by:
Javier Martinez Canillas <javier.martinez@collabora.co.uk> Tested-by:
Heiko Stuebner <heiko@sntech.de> Acked-by:
Lee Jones <lee.jones@linaro.org> Acked-by:
Olof Johansson <olof@lixom.net> Signed-off-by:
Lee Jones <lee.jones@linaro.org>
-
Gwendal Grignou authored
Chromebooks can have more than one Embedded Controller so the cros_ec device id has to be incremented for each EC registered. Add a new structure to represent multiple EC as different char devices (e.g: /dev/cros_ec, /dev/cros_pd). It connects to cros_ec_device and allows sysfs inferface for cros_pd. Also reduce number of allocated objects, make chromeos sysfs class object a static and add refcounting to prevent object deletion while command is in progress. Signed-off-by:
Gwendal Grignou <gwendal@chromium.org> Reviewed-by:
Dmitry Torokhov <dtor@chromium.org> Signed-off-by:
Javier Martinez Canillas <javier.martinez@collabora.co.uk> Tested-by:
Heiko Stuebner <heiko@sntech.de> Acked-by:
Lee Jones <lee.jones@linaro.org> Acked-by:
Olof Johansson <olof@lixom.net> Signed-off-by:
Lee Jones <lee.jones@linaro.org>
-
Stephen Barber authored
Add proto v3 support to the SPI, I2C, and LPC. Signed-off-by:
Stephen Barber <smbarber@chromium.org> Signed-off-by:
Javier Martinez Canillas <javier.martinez@collabora.co.uk> Tested-by:
Heiko Stuebner <heiko@sntech.de> Reviewed-by:
Gwendal Grignou <gwendal@chromium.org> Tested-by:
Gwendal Grignou <gwendal@chromium.org> Acked-by:
Lee Jones <lee.jones@linaro.org> Acked-by:
Olof Johansson <olof@lixom.net> Signed-off-by:
Lee Jones <lee.jones@linaro.org>
-
Stephen Barber authored
Add support in cros_ec.c to handle EC host command protocol v3. For v3+, probe for maximum shared protocol version and max request, response, and passthrough sizes. For now, this will always fall back to v2, since there is no bus-specific code for handling proto v3 packets. Signed-off-by:
Stephen Barber <smbarber@chromium.org> Signed-off-by:
Javier Martinez Canillas <javier.martinez@collabora.co.uk> Reviewed-by:
Gwendal Grignou <gwendal@chromium.org> Tested-by:
Gwendal Grignou <gwendal@chromium.org> Tested-by:
Heiko Stuebner <heiko@sntech.de> Acked-by:
Lee Jones <lee.jones@linaro.org> Acked-by:
Olof Johansson <olof@lixom.net> Signed-off-by:
Lee Jones <lee.jones@linaro.org>
-
Javier Martinez Canillas authored
Commit 1b84f2a4 ("mfd: cros_ec: Use fixed size arrays to transfer data with the EC") modified the struct cros_ec_command fields to not use pointers for the input and output buffers and use fixed length arrays instead. This change was made because the cros_ec ioctl API uses that struct cros_ec_command to allow user-space to send commands to the EC and to get data from the EC. So using pointers made the API not 64-bit safe. Unfortunately this approach was not flexible enough for all the use-cases since there may be a need to send larger commands on newer versions of the EC command protocol. So to avoid to choose a constant length that it may be too big for most commands and thus wasting memory and CPU cycles on copy from and to user-space or having a size that is too small for some big commands, use a zero-length array that is both 64-bit safe and flexible. The same buffer is used for both output and input data so the maximum of these values should be used to allocate it. Suggested-by:
Gwendal Grignou <gwendal@chromium.org> Signed-off-by:
Javier Martinez Canillas <javier.martinez@collabora.co.uk> Tested-by:
Heiko Stuebner <heiko@sntech.de> Acked-by:
Lee Jones <lee.jones@linaro.org> Acked-by:
Olof Johansson <olof@lixom.net> Signed-off-by:
Lee Jones <lee.jones@linaro.org>
-
Gwendal Grignou authored
Parent and device were pointing to the same device structure. Parent is unused, removed. Signed-off-by:
Gwendal Grignou <gwendal@chromium.org> Tested-by:
Stephen Barber <smbarber@chromium.org> Tested-by:
Heiko Stuebner <heiko@sntech.de> Tested-by:
Gwendal Grignou <gwendal@chromium.org> Reviewed-by:
Puthikorn Voravootivat <puthik@chromium.org> Signed-off-by:
Javier Martinez Canillas <javier.martinez@collabora.co.uk> Signed-off-by:
Lee Jones <lee.jones@linaro.org>
-
- 06 Oct, 2014 2 commits
-
-
Andrew Bresticker authored
Now that there's a central cros_ec_cmd_xfer(), move the locking out of the SPI driver. Signed-off-by:
Andrew Bresticker <abrestic@chromium.org> Reviewed-by:
Simon Glass <sjg@chromium.org> Signed-off-by:
Javier Martinez Canillas <javier.martinez@collabora.co.uk> Reviewed-by:
Doug Anderson <dianders@chromium.org> Signed-off-by:
Lee Jones <lee.jones@linaro.org>
-
Doug Anderson authored
If someone sends a EC_CMD_REBOOT_EC to the EC, the EC will likely be unresponsive for quite a while. Add a delay to the end of the command to prevent random failures of future commands. NOTES: * This could be optimized a bit by simply delaying the next command sent, but EC_CMD_REBOOT_EC is such a rare command that the extra complexity doesn't seem worth it. * This is a bit of an "ugly hack" since the SPI driver is effectively snooping on the communication and making a lot of assumptions. It would be nice to architect in some better solution long term. * This same logic probably needs to be applied to the i2c driver. Signed-off-by:
Doug Anderson <dianders@chromium.org> Reviewed-by:
Randall Spangler <rspangler@chromium.org> Reviewed-by:
Vadim Bendebury <vbendeb@chromium.org> Signed-off-by:
Javier Martinez Canillas <javier.martinez@collabora.co.uk> Signed-off-by:
Lee Jones <lee.jones@linaro.org>
-
- 23 Jul, 2014 1 commit
-
-
Thomas Gleixner authored
Replace the ever recurring: ts = ktime_get_ts(); ns = timespec_to_ns(&ts); with ns = ktime_get_ns(); Signed-off-by:
Thomas Gleixner <tglx@linutronix.de> Acked-by:
Lee Jones <lee.jones@linaro.org> Signed-off-by:
John Stultz <john.stultz@linaro.org>
-
- 09 Jul, 2014 8 commits
-
-
Bill Richardson authored
When communicating with the EC, the cmd_xfer() function should return the number of bytes it received from the EC, or negative on error. Signed-off-by:
Bill Richardson <wfrichar@chromium.org> Signed-off-by:
Doug Anderson <dianders@chromium.org> Reviewed-by:
Simon Glass <sjg@chromium.org> Acked-by:
Wolfram Sang <wsa@the-dreams.de> Signed-off-by:
Lee Jones <lee.jones@linaro.org>
-
Bill Richardson authored
Just because the host was able to talk to the EC doesn't mean that the EC was happy with what it was told. Errors in communincation are not the same as error messages from the EC itself. This change lets the EC report its errors separately. [dianders: Added common function to cros_ec.c] Signed-off-by:
Bill Richardson <wfrichar@chromium.org> Signed-off-by:
Doug Anderson <dianders@chromium.org> Signed-off-by:
Lee Jones <lee.jones@linaro.org>
-
Bill Richardson authored
struct cros_ec_device has a superfluous "name" field. We can get all the debugging info we need from the existing ec_name and phys_name fields, so let's take out the extra field. The printout also has sufficient info in it without explicitly adding the transport. Before this change: cros-ec-spi spi2.0: Chrome EC (SPI) After this change: cros-ec-spi spi2.0: Chrome EC device registered Signed-off-by:
Bill Richardson <wfrichar@chromium.org> Signed-off-by:
Doug Anderson <dianders@chromium.org> Reviewed-by:
Simon Glass <sjg@chromium.org> Signed-off-by:
Lee Jones <lee.jones@linaro.org>
-
Bill Richardson authored
This is some internal structure reorganization / renaming to prepare for future patches that will add a userspace API to cros_ec. There should be no visible changes. Signed-off-by:
Bill Richardson <wfrichar@chromium.org> Signed-off-by:
Doug Anderson <dianders@chromium.org> Signed-off-by:
Lee Jones <lee.jones@linaro.org>
-
Simon Glass authored
Some commands take a while to execute. Use -EAGAIN to signal this to the caller. Signed-off-by:
Simon Glass <sjg@chromium.org> Signed-off-by:
Doug Anderson <dianders@chromium.org> Signed-off-by:
Lee Jones <lee.jones@linaro.org>
-
Bill Richardson authored
The members of struct cros_ec_device were improperly commented, and intermixed the private and public sections. This is just cleanup to make it more obvious what goes with what. [dianders: left lock in the structure but gave it the name that will eventually be used.] Signed-off-by:
Bill Richardson <wfrichar@chromium.org> Signed-off-by:
Doug Anderson <dianders@chromium.org> Signed-off-by:
Lee Jones <lee.jones@linaro.org>
-
Prathyush K authored
Set the device as wakeup capable and register the wakeup source. Note: Though it makes more sense to have the SPI framework do this, (either via device tree or by board_info) this change is as per an existing mail chain: https://lkml.org/lkml/2009/8/27/291 Signed-off-by:
Prathyush K <prathyush.k@samsung.com> Signed-off-by:
Doug Anderson <dianders@chromium.org> Signed-off-by:
Lee Jones <lee.jones@linaro.org>
-
Doug Anderson authored
cros_ec_spi makes the assumption that a 0-length message will put the spi chip select back to normal (non cs_toggle mode). This used to be the case back on kernel-3.8 on the spi-s3c64xx driver but doesn't appear to be true anymore. It seems like it was a pretty questionable assumption to begin with, so let's fix the code to be more robust. We know that a message with a single 0-length segment _will_ put things back in order. Change cros_ec_spi to handle this. This wasn't a problem on the main user of cros_ec_spi upstream (tegra) because it specified 'google,cros-ec-spi-msg-delay'. Signed-off-by:
Doug Anderson <dianders@chromium.org> Signed-off-by:
Lee Jones <lee.jones@linaro.org>
-
- 03 Jun, 2014 4 commits
-
-
Doug Anderson authored
We're adding i2c tunneling to the list of things that goes over cros_ec. i2c tunneling can be slooooooow, so increase our deadline to 100ms to account for that. Signed-off-by:
Doug Anderson <dianders@chromium.org> Reviewed-by:
Simon Glass <sjg@chromium.org> Tested-by:
Andrew Bresticker <abrestic@chromium.org> Tested-by:
Stephen Warren <swarren@nvidia.com> Signed-off-by:
Lee Jones <lee.jones@linaro.org>
-
Doug Anderson authored
The cros_ec_spi transfer had two problems with its timeout code: 1. It looked at the timeout even in the case that it found valid data. 2. If the cros_ec_spi code got switched out for a while, it's possible it could get a timeout after a single loop. Let's be paranoid and make sure we do one last transfer after the timeout expires. Signed-off-by:
Doug Anderson <dianders@chromium.org> Reviewed-by:
Simon Glass <sjg@chromium.org> Tested-by:
Andrew Bresticker <abrestic@chromium.org> Tested-by:
Stephen Warren <swarren@nvidia.com> Signed-off-by:
Lee Jones <lee.jones@linaro.org>
-
Doug Anderson authored
The main transfer function for cros_ec_spi can be called by more than one client at a time. Make sure that those clients don't stomp on each other by locking the bus for the duration of the transfer function. Signed-off-by:
Doug Anderson <dianders@chromium.org> Reviewed-by:
Simon Glass <sjg@chromium.org> Tested-by:
Andrew Bresticker <abrestic@chromium.org> Tested-by:
Stephen Warren <swarren@nvidia.com> Signed-off-by:
Lee Jones <lee.jones@linaro.org>
-
David Hendricks authored
To avoid spamming the EC we calculate the time between the previous transfer and the current transfer and force a delay if the time delta is too small. However, a small miscalculation causes the delay period to be far too short. Most noticably this impacts commands with a long turnaround time such as EC firmware reads and writes. Signed-off-by:
David Hendricks <dhendrix@chromium.org> Signed-off-by:
Doug Anderson <dianders@chromium.org> Reviewed-by:
Simon Glass <sjg@chromium.org> Tested-by:
Andrew Bresticker <abrestic@chromium.org> Tested-by:
Stephen Warren <swarren@nvidia.com> Signed-off-by:
Lee Jones <lee.jones@linaro.org>
-
- 21 Jan, 2014 1 commit
-
-
Rhyland Klein authored
The EC has specific timing it requires. Add support for an optional delay after raising CS to fix timing issues. This is configurable based on a DT property "google,cros-ec-spi-msg-delay". If this property isn't set, then no delay will be added. However, if set it will cause a delay equal to the value passed to it to be inserted at the end of a transaction. Signed-off-by:
Rhyland Klein <rklein@nvidia.com> Reviewed-by:
Bernie Thompson <bhthompson@chromium.org> Reviewed-by:
Andrew Bresticker <abrestic@chromium.org> Acked-by:
Mark Rutland <mark.rutland@arm.com> Signed-off-by:
Thierry Reding <treding@nvidia.com> Signed-off-by:
Lee Jones <lee.jones@linaro.org>
-