summaryrefslogtreecommitdiffstats
path: root/drivers/net/can
AgeCommit message (Collapse)Author
2020-12-14can: m_can: use struct m_can_classdev as drvdataMarc Kleine-Budde
The m_can driver's suspend and resume functions (m_can_class_suspend() and m_can_class_resume()) make use of dev_get_drvdata() and assume that the drvdata is a pointer to the struct net_device. With upcoming conversion of the tcan4x5x driver to pm_runtime this assumption is no longer valid. As the suspend and resume functions actually need a struct m_can_classdev pointer, change the m_can_platform and the m_can_pci driver to hold a pointer to struct m_can_classdev instead, as the tcan4x5x driver already does. Link: https://lore.kernel.org/r/20201212175518.139651-8-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>
2020-12-14can: m_can: let m_can_class_allocate_dev() allocate driver specific private dataMarc Kleine-Budde
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>
2020-12-14can: m_can: m_can_clk_start(): make use of pm_runtime_resume_and_get()Marc Kleine-Budde
With patch | dd8088d5a896 PM: runtime: Add pm_runtime_resume_and_get to deal with usage counter the usual pm_runtime_get_sync() and pm_runtime_put_noidle() in-case-of-error dance is no longer needed. Convert the m_can driver to use this function. Link: https://lore.kernel.org/r/20201212175518.139651-6-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>
2020-12-14can: m_can: m_can_config_endisable(): mark as staticMarc Kleine-Budde
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>
2020-12-14can: m_can: use cdev as name for struct m_can_classdev uniformlyMarc Kleine-Budde
This patch coverts the m_can driver to use cdev as name for struct m_can_classdev uniformly throughout the whole driver. Link: https://lore.kernel.org/r/20201212175518.139651-4-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>
2020-12-14can: m_can: convert indention to kernel coding styleMarc Kleine-Budde
This patch converts the indention in the m_can driver to kernel coding style. Link: https://lore.kernel.org/r/20201212175518.139651-3-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>
2020-12-14can: m_can: update link to M_CAN user manualMarc Kleine-Budde
Old versions of the user manual are regularly depublished, so change link to the linux-can github page, which has a mirror off all published datasheets. Link: https://lore.kernel.org/r/20201212175518.139651-2-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>
2020-12-11Merge git://git.kernel.org/pub/scm/linux/kernel/git/netdev/netJakub Kicinski
xdp_return_frame_bulk() needs to pass a xdp_buff to __xdp_return(). strlcpy got converted to strscpy but here it makes no functional difference, so just keep the right code. Conflicts: net/netfilter/nf_tables_api.c Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2020-12-10can: mcp251xfd: Add support for internal loopback modeManivannan Sadhasivam
MCP251xFD supports internal loopback mode which can be used to verify CAN functionality in the absence of a real CAN device. Link: https://lore.kernel.org/r/20201201054019.11012-1-manivannan.sadhasivam@linaro.org Signed-off-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org> [mkl: mcp251xfd_get_normal_mode(): move CAN_CTRLMODE_LOOPBACK check to front] Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
2020-12-10can: flexcan: convert the driver to DT-onlyFabio Estevam
The flexcan driver runs only on DT platforms, so simplify the code by using of_device_get_match_data() to retrieve the driver data and also by removing the unused id_table. Signed-off-by: Fabio Estevam <festevam@gmail.com> Link: https://lore.kernel.org/r/20201128132855.7724-1-festevam@gmail.com Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
2020-12-10can: m_can: add PCI glue driver for Intel Elkhart LakeJarkko Nikula
Add support for M_CAN controller on Intel Elkhart Lake attached to the PCI bus. It integrates the Bosch M_CAN controller with Message RAM and the wrapper IP block with additional registers which all of them are within the same MMIO range. Currently only interrupt control register from wrapper IP is used and the MRAM configuration is expected to come from the firmware via "bosch,mram-cfg" device property and parsed by m_can.c core. Initial implementation is done by Felipe Balbi while he was working at Intel with later changes from Raymond Tan and me. Co-developed-by: Felipe Balbi (Intel) <balbi@kernel.org> Co-developed-by: Raymond Tan <raymond.tan@intel.com> Signed-off-by: Felipe Balbi (Intel) <balbi@kernel.org> Signed-off-by: Raymond Tan <raymond.tan@intel.com> Signed-off-by: Jarkko Nikula <jarkko.nikula@linux.intel.com> Link: https://lore.kernel.org/r/20201117160827.3636264-1-jarkko.nikula@linux.intel.com Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
2020-12-10can: m_can: move runtime PM enable/disable to m_can_platformPatrik Flykt
This is a preparatory patch for upcoming PCI based M_CAN devices. The current PM implementation would cause PCI based drivers to enable PM twice, once when the PCI device is added and a second time in m_can_class_register(). This will cause 'Unbalanced pm_runtime_enable!' to be logged, and is a situation that should be avoided. Therefore, in anticipation of PCI devices, move PM enabling out from M_CAN class registration to its only user, the m_can_platform driver. Signed-off-by: Patrik Flykt <patrik.flykt@linux.intel.com> Link: https://lore.kernel.org/r/20201023115800.46538-2-patrik.flykt@linux.intel.com [mkl: m_can_plat_probe(): fix error handling m_can_class_register(): simplify error handling] Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
2020-12-10can: m_can: m_can_config_endisable(): remove double clearing of clock stop ↵Sean Nyekjaer
request bit The CSR bit is already cleared when arriving here so remove this section of duplicate code. The registers set in m_can_config_endisable() is set to same exact values as before this patch. Signed-off-by: Sean Nyekjaer <sean@geanix.com> Acked-by: Sriram Dash <sriram.dash@samsung.com> Acked-by: Dan Murphy <dmurphy@ti.com> Link: https://lore.kernel.org/r/20191211063227.84259-1-sean@geanix.com Fixes: f524f829b75a ("can: m_can: Create a m_can platform framework") Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
2020-12-10can: rx-offload: can_rx_offload_offload_one(): avoid double unlikely() ↵Antonio Quartulli
notation when using IS_ERR() The definition of IS_ERR() already applies the unlikely() notation when checking the error status of the passed pointer. For this reason there is no need to have the same notation outside of IS_ERR() itself. Clean up code by removing redundant notation. Signed-off-by: Antonio Quartulli <a@unstable.cc> Link: https://lore.kernel.org/r/20201210085321.18693-1-a@unstable.cc Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
2020-12-05can: softing: softing_netdev_open(): fix error handlingZhang Qilong
If softing_netdev_open() fails, we should call close_candev() to avoid reference leak. Fixes: 03fd3cf5a179d ("can: add driver for Softing card") Signed-off-by: Zhang Qilong <zhangqilong3@huawei.com> Acked-by: Kurt Van Dijck <dev.kurt@vandijck-laurijssen.be> Link: https://lore.kernel.org/r/20201202151632.1343786-1-zhangqilong3@huawei.com Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de> Link: https://lore.kernel.org/r/20201204133508.742120-2-mkl@pengutronix.de Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2020-12-03Merge git://git.kernel.org/pub/scm/linux/kernel/git/netdev/netJakub Kicinski
Conflicts: drivers/net/ethernet/ibm/ibmvnic.c Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2020-11-30can: m_can: m_can_class_unregister(): move right after m_can_class_register()Marc Kleine-Budde
This patch moves the function m_can_class_unregister() directly after the m_can_class_register() function. Link: https://lore.kernel.org/r/20201130133713.269256-7-mkl@pengutronix.de Reviewed-by: Dan Murphy <dmurphy@ti.com> Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
2020-11-30can: m_can: m_can_plat_remove(): remove unneeded platform_set_drvdata()Marc Kleine-Budde
There's no need to unset the drvdata on remove, so remove the unneeded call to platform_set_drvdata() in m_can_plat_remove(). Link: https://lore.kernel.org/r/20201130133713.269256-6-mkl@pengutronix.de Reviewed-by: Dan Murphy <dmurphy@ti.com> Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
2020-11-30can: m_can: remove not used variable struct m_can_classdev::freqMarc Kleine-Budde
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>
2020-11-30can: m_can: Kconfig: convert the into menuMarc Kleine-Budde
Since there is more than one base driver for the m_can core, let's convert this into a menu. Link: https://lore.kernel.org/r/20201130133713.269256-4-mkl@pengutronix.de Reviewed-by: Dan Murphy <dmurphy@ti.com> Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
2020-11-30can: tcan4x5x: tcan4x5x_can_probe(): remove probe failed error messageMarc Kleine-Budde
The driver core already emits a probe failed error message, so remove this one from the driver. Link: https://lore.kernel.org/r/20201130133713.269256-3-mkl@pengutronix.de Reviewed-by: Dan Murphy <dmurphy@ti.com> Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
2020-11-30can: tcan4x5x: remove mram_start and reg_offset from struct tcan4x5x_privMarc Kleine-Budde
Both struct tcan4x5x_priv::mram_start and struct tcan4x5x_priv::reg_offset are only assigned once with a constant and then always used read-only. This patch changes the driver to use the constant directly instead. Link: https://lore.kernel.org/r/20201130133713.269256-2-mkl@pengutronix.de Reviewed-by: Dan Murphy <dmurphy@ti.com> Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
2020-11-30can: tcan4x5x: rename parse_config() functionDan Murphy
Rename the tcan4x5x_parse_config() function to tcan4x5x_get_gpios() since the function retrieves the gpio configurations from the firmware. Signed-off-by: Dan Murphy <dmurphy@ti.com> Link: http://lore.kernel.org/r/20200226140358.30017-1-dmurphy@ti.com Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
2020-11-30can: kvaser_pciefd: kvaser_pciefd_open(): fix error handlingZhang Qilong
If kvaser_pciefd_bus_on() failed, we should call close_candev() to avoid reference leak. Fixes: 26ad340e582d3 ("can: kvaser_pciefd: Add driver for Kvaser PCIEcan devices") Signed-off-by: Zhang Qilong <zhangqilong3@huawei.com> Link: https://lore.kernel.org/r/20201128133922.3276973-3-zhangqilong3@huawei.com Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
2020-11-30can: c_can: c_can_power_up(): fix error handlingZhang Qilong
In the error handling in c_can_power_up(), there are two bugs: 1) c_can_pm_runtime_get_sync() will increase usage counter if device is not empty. Forgetting to call c_can_pm_runtime_put_sync() will result in a reference leak here. 2) c_can_reset_ram() operation will set start bit when enable is true. We should clear it in the error handling. We fix it by adding c_can_pm_runtime_put_sync() for 1), and c_can_reset_ram(enable is false) for 2) in the error handling. Fixes: 8212003260c60 ("can: c_can: Add d_can suspend resume support") Fixes: 52cde85acc23f ("can: c_can: Add d_can raminit support") Signed-off-by: Zhang Qilong <zhangqilong3@huawei.com> Link: https://lore.kernel.org/r/20201128133922.3276973-2-zhangqilong3@huawei.com [mkl: return "0" instead of "ret"] Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
2020-11-30can: sun4i_can: sun4i_can_err(): don't count arbitration lose as an errorJeroen Hofstee
Losing arbitration is normal in a CAN-bus network, it means that a higher priority frame is being send and the pending message will be retried later. Hence most driver only increment arbitration_lost, but the sun4i driver also incremeants tx_error, causing errors to be reported on a normal functioning CAN-bus. So stop counting them as errors. Fixes: 0738eff14d81 ("can: Allwinner A10/A20 CAN Controller support - Kernel module") Signed-off-by: Jeroen Hofstee <jhofstee@victronenergy.com> Link: https://lore.kernel.org/r/20201127095941.21609-1-jhofstee@victronenergy.com [mkl: split into two seperate patches] Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
2020-11-30can: sja1000: sja1000_err(): don't count arbitration lose as an errorJeroen Hofstee
Losing arbitration is normal in a CAN-bus network, it means that a higher priority frame is being send and the pending message will be retried later. Hence most driver only increment arbitration_lost, but the sja1000 driver also incremeants tx_error, causing errors to be reported on a normal functioning CAN-bus. So stop counting them as errors. Fixes: 8935f57e68c4 ("can: sja1000: fix network statistics update") Signed-off-by: Jeroen Hofstee <jhofstee@victronenergy.com> Link: https://lore.kernel.org/r/20201127095941.21609-1-jhofstee@victronenergy.com [mkl: split into two seperate patches] Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
2020-11-30can: m_can: tcan4x5x_can_probe(): fix error path: remove erroneous ↵Marc Kleine-Budde
clk_disable_unprepare() The clocks mcan_class->cclk and mcan_class->hclk are not prepared by any call during tcan4x5x_can_probe(), so remove erroneous clk_disable_unprepare() on them. Fixes: 5443c226ba91 ("can: tcan4x5x: Add tcan4x5x driver to the kernel") Link: http://lore.kernel.org/r/20201130114252.215334-1-mkl@pengutronix.de Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
2020-11-29can: tcan4x5x: tcan4x5x_clear_interrupts(): remove redundant return statementSean Nyekjaer
This patch removes a redundant return at the end of tcan4x5x_clear_interrupts(). Signed-off-by: Sean Nyekjaer <sean@geanix.com> Link: http://lore.kernel.org/r/20191211141635.322577-1-sean@geanix.com Reported-by: Daniels Umanovskis <daniels@umanovskis.se> Acked-by: Dan Murphy <dmurphy@ti.com> Fixes: 5443c226ba91 ("can: tcan4x5x: Add tcan4x5x driver to the kernel") Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
2020-11-29can: mcp251xfd: tef-path: reduce number of SPI core requests to set UINC bitMarc Kleine-Budde
Reduce the number of separate SPI core requests when setting the UINC bit in the TEF FIFO, and instead batch them up into a single SPI core request. Link: https://lore.kernel.org/r/20201126132144.351154-6-mkl@pengutronix.de Tested-by: Thomas Kopp <thomas.kopp@microchip.com> Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
2020-11-29can: mcp251xfd: move struct mcp251xfd_tef_ring definitionMarc Kleine-Budde
This patch moves the struct mcp251xfd_tef_ring upwards, so that the union mcp251xfd_write_reg_buf and struct spi_transfer can be made members of it. Link: https://lore.kernel.org/r/20201126132144.351154-5-mkl@pengutronix.de Tested-by: Thomas Kopp <thomas.kopp@microchip.com> Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
2020-11-29can: mcp251xfd: struct mcp251xfd_priv::tef to array of length 1Marc Kleine-Budde
This patch converts the struct mcp251xfd_tef_ring member within the struct mcp251xfd_priv into an array of length one. This way all rings (tef, tx and rx) can be accessed in the same way. Link: https://lore.kernel.org/r/20201126132144.351154-4-mkl@pengutronix.de Tested-by: Thomas Kopp <thomas.kopp@microchip.com> Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
2020-11-29can: mcp25xxfd: rx-path: reduce number of SPI core requests to set UINC bitUrsula Maplehurst
Reduce the number of separate SPI core requests when setting the UINC bit in the RX FIFO, and instead batch them up into a single SPI core request. Link: https://github.com/marckleinebudde/linux/issues/4 Link: https://lore.kernel.org/r/20201126132144.351154-3-mkl@pengutronix.de Tested-by: Thomas Kopp <thomas.kopp@microchip.com> Signed-off-by: Ursula Maplehurst <ursula@kangatronix.co.uk> Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
2020-11-29can: mcp251xfd: mcp25xxfd_ring_alloc(): add define instead open coding the ↵Marc Kleine-Budde
maximum number of RX objects This patch add a define for the maximum number of RX objects instead of open coding it. Link: https://lore.kernel.org/r/20201126132144.351154-2-mkl@pengutronix.de Tested-by: Thomas Kopp <thomas.kopp@microchip.com> Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
2020-11-29can: pcan_usb_core: fix fall-through warnings for ClangGustavo A. R. Silva
In preparation to enable -Wimplicit-fallthrough for Clang, fix a warning by moving the "default" to the end of the "switch" statement and explicitly adding a break statement instead of letting the code fall through to the next case. Link: https://github.com/KSPP/linux/issues/115 Reported-by: Gustavo A. R. Silva <gustavoars@kernel.org> Link: http://lore.kernel.org/r/aab7cf16bf43cc7c3e9c9930d2dae850c1d07a3c.1605896059.git.gustavoars@kernel.org Signed-off-by: Gustavo A. R. Silva <gustavoars@kernel.org> [mkl: move default to end] Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
2020-11-27Merge git://git.kernel.org/pub/scm/linux/kernel/git/netdev/netJakub Kicinski
Trivial conflict in CAN, keep the net-next + the byteswap wrapper. Conflicts: drivers/net/can/usb/gs_usb.c Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2020-11-27can: m_can: m_can_dev_setup(): add support for bosch mcan version 3.3.0Pankaj Sharma
Add support for mcan bit timing and control mode according to bosch mcan IP version 3.3.0. The mcan version read from the Core Release field of CREL register would be 33. Accordingly the properties are to be set for mcan v3.3.0 Signed-off-by: Pankaj Sharma <pankj.sharma@samsung.com> Link: https://lore.kernel.org/r/1606366302-5520-1-git-send-email-pankj.sharma@samsung.com Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
2020-11-27can: m_can: fix nominal bitiming tseg2 min for version >= 3.1Marc Kleine-Budde
At lest the revision 3.3.0 of the bosch m_can IP core specifies that valid register values for "Nominal Time segment after sample point (NTSEG2)" are from 1 to 127. As the hardware uses a value of one more than the programmed value, mean tseg2_min is 2. This patch fixes the tseg2_min value accordingly. Cc: Dan Murphy <dmurphy@ti.com> Cc: Mario Huettel <mario.huettel@gmx.net> Acked-by: Sriram Dash <sriram.dash@samsung.com> Link: https://lore.kernel.org/r/20201124190751.3972238-1-mkl@pengutronix.de Fixes: b03cfc5bb0e1 ("can: m_can: Enable M_CAN version dependent initialization") Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
2020-11-27can: m_can: m_can_open(): remove IRQF_TRIGGER_FALLING from ↵Marc Kleine-Budde
request_threaded_irq()'s flags The threaded IRQ handler is used for the tcan4x5x driver only. The IRQ pin of the tcan4x5x controller is active low, so better not use IRQF_TRIGGER_FALLING when requesting the IRQ. As this can result in missing interrupts. Further, if the device tree specified the interrupt as "IRQ_TYPE_LEVEL_LOW", unloading and reloading of the driver results in the following error during ifup: | irq: type mismatch, failed to map hwirq-31 for gpio@20a8000! | tcan4x5x spi1.1: m_can device registered (irq=0, version=32) | tcan4x5x spi1.1 can2: TCAN4X5X successfully initialized. | tcan4x5x spi1.1 can2: failed to request interrupt This patch fixes the problem by removing the IRQF_TRIGGER_FALLING from the request_threaded_irq(). Fixes: f524f829b75a ("can: m_can: Create a m_can platform framework") Cc: Dan Murphy <dmurphy@ti.com> Cc: Sriram Dash <sriram.dash@samsung.com> Cc: Pankaj Sharma <pankj.sharma@samsung.com> Link: https://lore.kernel.org/r/20201127093548.509253-1-mkl@pengutronix.de Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
2020-11-26can: mcp251xfd: mcp251xfd_probe(): bail out if no IRQ was givenMarc Kleine-Budde
This patch add a check to the mcp251xfd_probe() function to bail out and give the user a proper error message if no IRQ is specified. Otherwise the driver will probe just fine but ifup will fail with a meaningless "RTNETLINK answers: Invalid argument" error message. Link: https://lore.kernel.org/r/20201123113522.3820052-1-mkl@pengutronix.de Reported-by: Niels Petter <petter@ka-long.de> Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
2020-11-26can: gs_usb: fix endianess problem with candleLight firmwareMarc Kleine-Budde
The firmware on the original USB2CAN by Geschwister Schneider Technologie Entwicklungs- und Vertriebs UG exchanges all data between the host and the device in host byte order. This is done with the struct gs_host_config::byte_order member, which is sent first to indicate the desired byte order. The widely used open source firmware candleLight doesn't support this feature and exchanges the data in little endian byte order. This breaks if a device with candleLight firmware is used on big endianess systems. To fix this problem, all u32 (but not the struct gs_host_frame::echo_id, which is a transparent cookie) are converted to __le32. Cc: Maximilian Schneider <max@schneidersoft.net> Cc: Hubert Denkmair <hubert@denkmair.de> Reported-by: Michael Rausch <mr@netadair.de> Link: https://lore.kernel.org/r/b58aace7-61f3-6df7-c6df-69fee2c66906@netadair.de Tested-by: Oleksij Rempel <o.rempel@pengutronix.de> Fixes: d08e973a77d1 ("can: gs_usb: Added support for the GS_USB CAN devices") Link: https://lore.kernel.org/r/20201120103818.3386964-1-mkl@pengutronix.de Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
2020-11-23net: don't include ethtool.h from netdevice.hJakub Kicinski
linux/netdevice.h is included in very many places, touching any of its dependecies causes large incremental builds. Drop the linux/ethtool.h include, linux/netdevice.h just needs a forward declaration of struct ethtool_ops. Fix all the places which made use of this implicit include. Acked-by: Johannes Berg <johannes@sipsolutions.net> Acked-by: Shannon Nelson <snelson@pensando.io> Reviewed-by: Jesse Brandeburg <jesse.brandeburg@intel.com> Link: https://lore.kernel.org/r/20201120225052.1427503-1-kuba@kernel.org Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2020-11-20can: mcp251xfd: remove useless code in mcp251xfd_chip_softresetKaixu Xia
It would directly return if the variable err equals to 0 or other errors. Only when the err equals to -ETIMEDOUT it can reach the 'if (err)' statement, so the 'if (err)' and last 'return -ETIMEDOUT' statements are useless. Romove them. Reported-by: Tosk Robot <tencent_os_robot@tencent.com> Signed-off-by: Kaixu Xia <kaixuxia@tencent.com> Link: https://lore.kernel.org/r/1605605352-25298-1-git-send-email-kaixuxia@tencent.com Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
2020-11-20can: kvaser_usb: Add new Kvaser hydra devicesJimmy Assarsson
Add new Kvaser hydra devices. Signed-off-by: Jimmy Assarsson <extja@kvaser.com> Link: https://lore.kernel.org/r/20201115163027.16851-6-jimmyassarsson@gmail.com Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
2020-11-20can: kvaser_usb: kvaser_usb_hydra: Add support for new device variantChrister Beskow
Add support for a new variant of devices using the hydra platform, based on NXP i.MX RT (flexcan). Signed-off-by: Christer Beskow <chbe@kvaser.com> Signed-off-by: Jimmy Assarsson <extja@kvaser.com> Link: https://lore.kernel.org/r/20201115163027.16851-5-jimmyassarsson@gmail.com Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
2020-11-20can: kvaser_usb: Add new Kvaser Leaf v2 devicesJimmy Assarsson
Add new Kvaser Leaf v2 devices. Signed-off-by: Jimmy Assarsson <extja@kvaser.com> Link: https://lore.kernel.org/r/20201115163027.16851-4-jimmyassarsson@gmail.com Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
2020-11-20can: kvaser_usb: Add USB_{LEAF,HYDRA}_PRODUCT_ID_END definesJimmy Assarsson
Add USB_{LEAF,HYDRA}_PRODUCT_ID_END defines, representing the last USB PID entry in respectively family. This removes the need to update the kvaser_is_{leaf,hydra}() functions whenever new devices are added. Signed-off-by: Jimmy Assarsson <extja@kvaser.com> Link: https://lore.kernel.org/r/20201115163027.16851-3-jimmyassarsson@gmail.com Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
2020-11-20can: flexcan: flexcan_close(): change order if commands to properly shut ↵Marc Kleine-Budde
down the controller There haven been reports, that the flexcan_close() soradically hangs during simultanious ifdown, sending of CAN messages and probably open CAN bus: | (__schedule) from [<808bbd34>] (schedule+0x90/0xb8) | (schedule) from [<808bf274>] (schedule_timeout+0x1f8/0x24c) | (schedule_timeout) from [<8016be44>] (msleep+0x18/0x1c) | (msleep) from [<80746a64>] (napi_disable+0x60/0x70) | (napi_disable) from [<8052fdd0>] (flexcan_close+0x2c/0x140) | (flexcan_close) from [<80744930>] (__dev_close_many+0xb8/0xd8) | (__dev_close_many) from [<8074db9c>] (__dev_change_flags+0xd0/0x1a0) | (__dev_change_flags) from [<8074dc84>] (dev_change_flags+0x18/0x48) | (dev_change_flags) from [<80760c24>] (do_setlink+0x44c/0x7b4) | (do_setlink) from [<80761560>] (rtnl_newlink+0x374/0x68c) I was unable to reproduce the issue, but a cleanup of the flexcan close sequence has probably fixed the problem at the reporting user. This patch changes the sequence in flexcan_close() to: - stop the TX queue - disable the interrupts on the chip level and wait via free_irq() synchronously for the interrupt handler to finish - disable RX offload, which disables synchronously NAPI - disable the flexcan on the chip level - free RX offload - disable the transceiver - close the CAN device - disable the clocks Link: https://lore.kernel.org/r/20201119100917.3013281-6-mkl@pengutronix.de Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
2020-11-20can: flexcan: flexcan_open(): completely initialize controller before ↵Marc Kleine-Budde
requesting IRQ This patch changes the order in which the flexcan controller is brought up during flexcan_open(). It makes sure that the chip is completely initialized before the IRQs are requested and finally enabled. Link: https://lore.kernel.org/r/20201119100917.3013281-5-mkl@pengutronix.de Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
2020-11-20can: flexcan: flexcan_rx_offload_setup(): factor out mailbox and rx-offload ↵Marc Kleine-Budde
setup into separate function In an upcoming patch the order of operations in flexcan_open() are changed. Introduce convenience function to make that patch simpler. Link: https://lore.kernel.org/r/20201119100917.3013281-4-mkl@pengutronix.de Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>