#
4a94d7e3 |
|
13-Nov-2023 |
Martin Hundebøll <martin@geanix.com> |
can: m_can: allow keeping the transceiver running in suspend Add a flag to the device class structure that leaves the chip in a running state with rx interrupt enabled, so that an m_can device driver can configure and use the interrupt as a wakeup source. Signed-off-by: Martin Hundebøll <martin@geanix.com> Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
|
#
c306c387 |
|
07-Feb-2024 |
Markus Schneider-Pargmann <msp@baylibre.com> |
can: m_can: Implement transmit submission coalescing m_can supports submitting multiple transmits with one register write. This is an interesting option to reduce the number of SPI transfers for peripheral chips. The m_can_tx_op is extended with a bool that signals if it is the last transmission and the submit should be executed immediately. The worker then writes the skb to the FIFO and submits it only if the submit bool is set. If it isn't set, the worker will write the next skb which is waiting in the workqueue to the FIFO, etc. Signed-off-by: Markus Schneider-Pargmann <msp@baylibre.com> Link: https://lore.kernel.org/all/20240207093220.2681425-15-msp@baylibre.com Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
|
#
1fa80e23 |
|
07-Feb-2024 |
Markus Schneider-Pargmann <msp@baylibre.com> |
can: m_can: Introduce a tx_fifo_in_flight counter Keep track of the number of transmits in flight. This patch prepares the driver to control the network interface queue based on this counter. By itself this counter be implemented with an atomic, but as we need to do other things in the critical sections later I am using a spinlock instead. Signed-off-by: Markus Schneider-Pargmann <msp@baylibre.com> Link: https://lore.kernel.org/all/20240207093220.2681425-12-msp@baylibre.com Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
|
#
e668673e |
|
07-Feb-2024 |
Markus Schneider-Pargmann <msp@baylibre.com> |
can: m_can: Use the workqueue as queue The current implementation uses the workqueue for peripheral chips to submit work. Only a single work item is queued and used at any time. To be able to keep more than one transmit in flight at a time, prepare the workqueue to support multiple transmits at the same time. Each work item now has a separate storage for a skb and a pointer to cdev. This assures that each workitem can be processed individually. The workqueue is replaced by an ordered workqueue which makes sure that only a single worker processes the items queued on the workqueue. Also items are ordered by the order they were enqueued. This removes most of the concurrency the workqueue normally offers. It is not necessary for this driver. The cleanup functions have to be adopted a bit to handle this new mechanism. Signed-off-by: Markus Schneider-Pargmann <msp@baylibre.com> Link: https://lore.kernel.org/all/20240207093220.2681425-11-msp@baylibre.com Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
|
#
80c5bac0 |
|
07-Feb-2024 |
Markus Schneider-Pargmann <msp@baylibre.com> |
can: m_can: Cache tx putidx m_can_tx_handler is the only place where data is written to the tx fifo. We can calculate the putidx in the driver code here to avoid the dependency on the txfqs register. Signed-off-by: Markus Schneider-Pargmann <msp@baylibre.com> Reviewed-by: Simon Horman <simon.horman@corigine.com> Link: https://lore.kernel.org/all/20240207093220.2681425-10-msp@baylibre.com Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
|
#
ec390d08 |
|
07-Feb-2024 |
Markus Schneider-Pargmann <msp@baylibre.com> |
can: m_can: Implement transmit coalescing Extend the coalescing implementation for transmits. In normal mode the chip raises an interrupt for every finished transmit. This implementation switches to coalescing mode as soon as an interrupt handled a transmit. For coalescing the watermark level interrupt is used to interrupt exactly after x frames were sent. It switches back into normal mode once there was an interrupt with no finished transmit and the timer being inactive. The timer is shared with receive coalescing. The time for receive and transmit coalescing timers have to be the same for that to work. The benefit is to have only a single running timer. Signed-off-by: Markus Schneider-Pargmann <msp@baylibre.com> Reviewed-by: Simon Horman <horms@kernel.org> Link: https://lore.kernel.org/all/20240207093220.2681425-6-msp@baylibre.com Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
|
#
07f25091 |
|
07-Feb-2024 |
Markus Schneider-Pargmann <msp@baylibre.com> |
can: m_can: Implement receive coalescing m_can offers the possibility to set an interrupt on reaching a watermark level in the receive FIFO. This can be used to implement coalescing. Unfortunately there is no hardware timeout available to trigger an interrupt if only a few messages were received within a given time. To solve this I am using a hrtimer to wake up the irq thread after x microseconds. The timer is always started if receive coalescing is enabled and new received frames were available during an interrupt. The timer is stopped if during a interrupt handling no new data was available. If the timer is started the new item interrupt is disabled and the watermark interrupt takes over. If the timer is not started again, the new item interrupt is enabled again, notifying the handler about every new item received. Signed-off-by: Markus Schneider-Pargmann <msp@baylibre.com> Link: https://lore.kernel.org/all/20240207093220.2681425-5-msp@baylibre.com Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
|
#
c1b17ea7 |
|
28-Jul-2023 |
Markus Schneider-Pargmann <msp@baylibre.com> |
can: tcan4x5x: Check size of mram configuration To reduce debugging effort in case the mram is misconfigured, add this size check of the DT configuration. Currently if the mram configuration doesn't fit into the available MRAM it just overwrites other areas of the MRAM. Signed-off-by: Markus Schneider-Pargmann <msp@baylibre.com> Reviewed-by: Michal Kubiak <michal.kubiak@intel.com> Link: https://lore.kernel.org/all/20230728141923.162477-4-msp@baylibre.com Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
|
#
07382e6b |
|
24-Jul-2023 |
Rob Herring <robh@kernel.org> |
can: Explicitly include correct DT includes, part 2 The DT of_device.h and of_platform.h date back to the separate of_platform_bus_type before it as merged into the regular platform bus. As part of that merge prepping Arm DT support 13 years ago, they "temporarily" include each other. They also include platform_device.h and of.h. As a result, there's a pretty much random mix of those include files used throughout the tree. In order to detangle these headers and replace the implicit includes with struct declarations, users need to explicitly include the correct includes. Signed-off-by: Rob Herring <robh@kernel.org> Link: https://lore.kernel.org/all/20230724211841.805053-1-robh@kernel.org Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
|
#
b382380c |
|
07-Jul-2023 |
Judith Mendez <jm@ti.com> |
can: m_can: Add hrtimer to generate software interrupt Introduce timer polling method to MCAN since some SoCs may not have M_CAN interrupt routed to A53 Linux and do not have interrupt property in device tree M_CAN node. On AM62x SoC, MCANs on MCU domain do not have hardware interrupt routed to A53 Linux, instead they will use timer polling method. Add an hrtimer to MCAN class device. Each MCAN will have its own hrtimer instantiated if there is no hardware interrupt found in device tree M_CAN node. The timer will generate a software interrupt every 1 ms. In hrtimer callback, we check if there is a transaction pending by reading a register, then process by calling the isr if there is. Tested-by: Hiago De Franco <hiago.franco@toradex.com> # Toradex Verdin AM62 Reviewed-by: Tony Lindgren <tony@atomide.com> Signed-off-by: Judith Mendez <jm@ti.com> Link: https://lore.kernel.org/all/20230707204714.62964-3-jm@ti.com Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
|
#
09451f24 |
|
03-Nov-2022 |
Vivek Yadav <vivek.2311@samsung.com> |
can: m_can: sort header inclusion alphabetically Sort header inclusion alphabetically. Suggested-by: Marc Kleine-Budde <mkl@pengutronix.de> Signed-off-by: Vivek Yadav <vivek.2311@samsung.com> Link: https://lore.kernel.org/all/20221104051617.21173-1-vivek.2311@samsung.com Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
|
#
6a8836e3 |
|
12-Oct-2022 |
Marc Kleine-Budde <mkl@pengutronix.de> |
can: m_can: is_lec_err(): clean up LEC error handling The PSR register contains among other the error for the CAN arbitration phase (LEC bits) and CAN data phase (DLEC bits). Prepare is_lec_err() to be called with the (D)LEC value only instead of the whole PSR register. While there rename LEC_UNUSED to LEC_NO_CHANGE to match the latest M_CAN reference manual. Link: https://lore.kernel.org/all/20221019211611.1605764-1-mkl@pengutronix.de Reviewed-by: Chandrasekar Ramakrishnan <rcsekar@samsung.com> Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
|
#
6c1e423a |
|
18-May-2022 |
Oliver Hartkopp <socketcan@hartkopp.net> |
can: can-dev: remove obsolete CAN LED support Since commit 30f3b42147ba6f ("can: mark led trigger as broken") the CAN specific LED support was disabled and marked as BROKEN. As the common LED support with CONFIG_LEDS_TRIGGER_NETDEV should do this work now the code can be removed as preparation for a CAN netdevice Kconfig rework. Link: https://lore.kernel.org/all/20220518154527.29046-1-socketcan@hartkopp.net Suggested-by: Vincent Mailhol <mailhol.vincent@wanadoo.fr> Signed-off-by: Oliver Hartkopp <socketcan@hartkopp.net> [mkl: remove led.h from MAINTAINERS] Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
|
#
d6da7881 |
|
12-May-2022 |
Jarkko Nikula <jarkko.nikula@linux.intel.com> |
can: m_can: remove support for custom bit timing, take #2 Now when Intel Elkhart Lake uses again common bit timing and there are no other users for custom bit timing, we can bring back the changes done by the commit 0ddd83fbebbc ("can: m_can: remove support for custom bit timing"). This effectively reverts commit ea768b2ffec6 ("Revert "can: m_can: remove support for custom bit timing"") while taking into account commit ea22ba40debe ("can: m_can: make custom bittiming fields const") and commit 7d4a101c0bd3 ("can: dev: add sanity check in can_set_static_ctrlmode()"). Link: https://lore.kernel.org/all/20220512124144.536850-2-jarkko.nikula@linux.intel.com Signed-off-by: Jarkko Nikula <jarkko.nikula@linux.intel.com> Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
|
#
ea22ba40 |
|
15-Nov-2021 |
Matthias Schiffer <matthias.schiffer@ew.tq-group.com> |
can: m_can: make custom bittiming fields const The assigned timing structs will be defined a const anyway, so we can avoid a few casts by declaring the struct fields as const as well. Link: https://lore.kernel.org/all/4508fa4e639164b2584c49a065d90c78a91fa568.1636967198.git.matthias.schiffer@ew.tq-group.com Signed-off-by: Matthias Schiffer <matthias.schiffer@ew.tq-group.com> Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
|
#
ea768b2f |
|
15-Nov-2021 |
Matthias Schiffer <matthias.schiffer@ew.tq-group.com> |
Revert "can: m_can: remove support for custom bit timing" The timing limits specified by the Elkhart Lake CPU datasheets do not match the defaults. Let's reintroduce the support for custom bit timings. This reverts commit 0ddd83fbebbc5537f9d180d31f659db3564be708. Link: https://lore.kernel.org/all/00c9e2596b1a548906921a574d4ef7a03c0dace0.1636967198.git.matthias.schiffer@ew.tq-group.com Signed-off-by: Matthias Schiffer <matthias.schiffer@ew.tq-group.com> Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
|
#
e3938177 |
|
16-Aug-2021 |
Matt Kline <matt@bitbashing.io> |
can: m_can: Disable IRQs on FIFO bus errors If FIFO reads or writes fail due to the underlying regmap (e.g., SPI) I/O, propagate that up to the m_can driver, log an error, and disable interrupts, similar to the mcp251xfd driver. While reworking the FIFO functions to add this error handling, add support for bulk reads and writes of multiple registers. Link: https://lore.kernel.org/r/20210817050853.14875-2-matt@bitbashing.io Signed-off-by: Matt Kline <matt@bitbashing.io> [mkl: re-wrap long lines, remove WARN_ON, convert to netdev block comments] Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
|
#
0ddd83fb |
|
15-Dec-2020 |
Marc Kleine-Budde <mkl@pengutronix.de> |
can: m_can: remove support for custom bit timing Since commit aee2b3ccc8a6 ("can: tcan4x5x: fix bittiming const, use common bittiming from m_can driver") there is no use of the device specific bit timing parameters (m_can_classdev::bit_timing and struct m_can_classdev::data_timing). This patch removes the support for custom bit timing from the driver, as the common bit timing works for all known IP core implementations. Cc: Chandrasekar Ramakrishnan <rcsekar@samsung.com> Link: https://lore.kernel.org/r/20210616102811.2449426-7-mkl@pengutronix.de Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
|
#
d836cb5f |
|
09-May-2021 |
Faiz Abbas <faiz_abbas@ti.com> |
can: m_can: Add support for transceiver as phy Add support for implementing transceiver node as phy. The max_bitrate is obtained by getting a phy attribute. Link: https://lore.kernel.org/r/20210724174001.553047-1-mkl@pengutronix.de Signed-off-by: Faiz Abbas <faiz_abbas@ti.com> Signed-off-by: Aswath Govindraju <a-govindraju@ti.com> Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
|
#
1be37d3b |
|
08-Mar-2021 |
Torin Cooper-Bennun <torin@maxiluxsystems.com> |
can: m_can: fix periph RX path: use rx-offload to ensure skbs are sent from softirq context For peripheral devices, m_can sent skbs directly from a threaded irq instead of from a softirq context, breaking the tcan4x5x peripheral driver completely. This patch transitions the driver to use the rx-offload helper for peripherals, ensuring the skbs are sent from the correct context, with h/w timestamping to ensure correct ordering. Link: https://lore.kernel.org/r/20210308102427.63916-4-torin@maxiluxsystems.com Signed-off-by: Torin Cooper-Bennun <torin@maxiluxsystems.com> [mkl: m_can_class_register(): update error handling] Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
|
#
ac33ffd3 |
|
12-Dec-2020 |
Marc Kleine-Budde <mkl@pengutronix.de> |
can: m_can: let m_can_class_allocate_dev() allocate driver specific private data This patch enhances m_can_class_allocate_dev() to allocate driver specific private data. The driver's private data struct must contain struct m_can_classdev as its first member followed by the remaining private data. Link: https://lore.kernel.org/r/20201212175518.139651-7-mkl@pengutronix.de Reviewed-by: Sean Nyekjaer <sean@geanix.com> Reviewed-by: Dan Murphy <dmurphy@ti.com> Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
|
#
78e19a29 |
|
12-Dec-2020 |
Marc Kleine-Budde <mkl@pengutronix.de> |
can: m_can: m_can_config_endisable(): mark as static The function m_can_config_endisable() is not used outside of the m_can driver, so mark it as static. Link: https://lore.kernel.org/r/20201212175518.139651-5-mkl@pengutronix.de Reviewed-by: Sean Nyekjaer <sean@geanix.com> Reviewed-by: Dan Murphy <dmurphy@ti.com> Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
|
#
3fb5a7ce |
|
30-Nov-2020 |
Marc Kleine-Budde <mkl@pengutronix.de> |
can: m_can: remove not used variable struct m_can_classdev::freq This patch removes the unused variable freq from the struct m_can_classdev. Link: https://lore.kernel.org/r/20201130133713.269256-5-mkl@pengutronix.de Reviewed-by: Dan Murphy <dmurphy@ti.com> Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
|
#
a8c22f5b |
|
26-Feb-2020 |
Dan Murphy <dmurphy@ti.com> |
can: m_can: m_can_class_free_dev(): introduce new function This patch creates a common function that peripherials can call to free the netdev device when failures occur. Fixes: f524f829b75a ("can: m_can: Create a m_can platform framework") Reported-by: Marc Kleine-Budde <mkl@pengutronix.de> Signed-off-by: Dan Murphy <dmurphy@ti.com> Link: http://lore.kernel.org/r/20200227183829.21854-2-dmurphy@ti.com Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
|
#
441ac340 |
|
09-May-2019 |
Dan Murphy <dmurphy@ti.com> |
can: m_can: Rename m_can_priv to m_can_classdev Rename the common m_can_priv class structure to m_can_classdev as this is more descriptive. Acked-by: Wolfgang Grandegger <wg@grandegger.com> Signed-off-by: Dan Murphy <dmurphy@ti.com> Acked-by: Faiz Abbas <faiz_abbas@ti.com> Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
|
#
f524f829 |
|
09-May-2019 |
Dan Murphy <dmurphy@ti.com> |
can: m_can: Create a m_can platform framework Create a m_can platform framework that peripheral devices can register to and use common code and register sets. The peripheral devices may provide read/write and configuration support of the IP. Acked-by: Wolfgang Grandegger <wg@grandegger.com> Signed-off-by: Dan Murphy <dmurphy@ti.com> Acked-by: Faiz Abbas <faiz_abbas@ti.com> Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
|