pull-request: can-next 2023-04-04-2
Subsystems (9)
Marc Kleine-Budde
maintainercover pull-request: can-next 2023-04-04-2
Hello netdev-team,
this is the corrected pull request of 10 patches for net-next/master.
The first patch is by Oliver Hartkopp and makes the maximum pdu size of the CAN ISOTP protocol configurable.
The following 5 patches are by Dario Binacchi and add support for the bxCAN controller by ST.
Geert Uytterhoeven's patch for the rcar_canfd driver fixes a sparse warning.
Peng Fan's patch adds an optional power-domains property to the flexcan device tree binding.
Frank Jungclaus adds support for CAN_CTRLMODE_BERR_REPORTING to the esd_usb driver.
The last patch is by Oliver Hartkopp and converts the USB IDs of the kvaser_usb driver to hexadecimal values.
regards,
Marc
---
The following changes since commit 4cee0fb9cc4b5477637fdeb2e965f5fc7d624622:
Merge tag 'linux-can-next-for-6.4-20230327' of git://git.kernel.org/pub/scm/linux/kernel/git/mkl/linux-can-next (2023-03-27 19:55:10 -0700)
are available in the Git repository at:
git://git.kernel.org/pub/scm/linux/kernel/git/mkl/linux-can-next.git tags/linux-can-next-for-6.4-20230404-2
for you to fetch changes up to 1afae605e0b2da606d5fff4a8a5849da207128b3:
kvaser_usb: convert USB IDs to hexadecimal values (2023-04-04 16:48:45 +0200)
----------------------------------------------------------------
linux-can-next-for-6.4-20230404-2
----------------------------------------------------------------
Dario Binacchi (5):
dt-bindings: arm: stm32: add compatible for syscon gcan node
dt-bindings: net: can: add STM32 bxcan DT bindings
ARM: dts: stm32: add CAN support on stm32f429
ARM: dts: stm32: add pin map for CAN controller on stm32f4
can: bxcan: add support for ST bxCAN controller
Frank Jungclaus (1):
can: esd_usb: Add support for CAN_CTRLMODE_BERR_REPORTING
Geert Uytterhoeven (1):
can: rcar_canfd: rcar_canfd_probe(): fix plain integer in transceivers[] init
Marc Kleine-Budde (1):
Merge patch series "can: bxcan: add support for ST bxCAN controller"
Oliver Hartkopp (2):
can: isotp: add module parameter for maximum pdu size
kvaser_usb: convert USB IDs to hexadecimal values
Peng Fan (1):
dt-bindings: can: fsl,flexcan: add optional power-domains property
.../bindings/arm/stm32/st,stm32-syscon.yaml | 2 + .../devicetree/bindings/net/can/fsl,flexcan.yaml | 3 + .../bindings/net/can/st,stm32-bxcan.yaml | 85 ++ MAINTAINERS | 7 + arch/arm/boot/dts/stm32f4-pinctrl.dtsi | 30 + arch/arm/boot/dts/stm32f429.dtsi | 29 + drivers/net/can/Kconfig | 12 + drivers/net/can/Makefile | 1 + drivers/net/can/bxcan.c | 1098 ++++++++++++++++++++ drivers/net/can/rcar/rcar_canfd.c | 2 +- drivers/net/can/usb/esd_usb.c | 35 +- drivers/net/can/usb/kvaser_usb/kvaser_usb_core.c | 102 +- net/can/isotp.c | 65 +- 13 files changed, 1395 insertions(+), 76 deletions(-) create mode 100644 Documentation/devicetree/bindings/net/can/st,stm32-bxcan.yaml create mode 100644 drivers/net/can/bxcan.c
Marc Kleine-Budde
maintainerPATCH 1/10 can: isotp: add module parameter for maximum pdu size
From: Oliver Hartkopp <[email protected]>
With ISO 15765-2:2016 the PDU size is not limited to 2^12 - 1 (4095) bytes but can be represented as a 32 bit unsigned integer value which allows 2^32 - 1 bytes (~4GB). The use-cases like automotive unified diagnostic services (UDS) and flashing of ECUs still use the small static buffers which are provided at socket creation time.
When a use-case requires to transfer PDUs up to 1025 kByte the maximum PDU size can now be extended by setting the module parameter max_pdu_size. The extended size buffers are only allocated on a per-socket/connection base when needed at run-time.
changes since v2: https://lore.kernel.org/all/[email protected]
- use ARRAY_SIZE() to reference DEFAULT_MAX_PDU_SIZE only at one place
changes since v1: https://lore.kernel.org/all/[email protected]
- limit the minimum 'max_pdu_size' to 4095 to maintain the classic
behavior before ISO 15765-2:2016
--- net/can/isotp.c | 65 ++++++++++++++++++++++++++++++++++++++++++------- 1 file changed, 56 insertions(+), 9 deletions(-)
net/can/isotp.c +56 -9
@@ -85,10 +85,21 @@ MODULE_ALIAS("can-proto-6");/* ISO 15765-2:2016 supports more than 4095 byte per ISO PDU as the FF_DL can * take full 32 bit values (4 Gbyte). We would need some good concept to handle -* this between user space and kernel space. For now increase the static buffer -* to something about 64 kbyte to be able to test this new functionality. +* this between user space and kernel space. For now set the static buffer to +* something about 8 kbyte to be able to test this new functionality. */ -#define MAX_MSG_LENGTH 66000 +#define DEFAULT_MAX_PDU_SIZE 8300 + +/* maximum PDU size before ISO 15765-2:2016 extension was 4095 */ +#define MAX_12BIT_PDU_SIZE 4095 + +/* limit the isotp pdu size from the optional module parameter to 1MByte */ +#define MAX_PDU_SIZE (1025 * 1024U) + +static unsigned int max_pdu_size__read_mostly =DEFAULT_MAX_PDU_SIZE ; +module_param (max_pdu_size, uint,0444 ); +MODULE_PARM_DESC(max_pdu_size, "maximum isotp pdu size (default " + __stringify(DEFAULT_MAX_PDU_SIZE) ")");/* N_PCI type values in bits 7-4 of N_PCI bytes */ #define N_PCI_SF 0x00/* single frame */
@@ -123,13 +134,15 @@ enum { };struct tpcon { -unsigned int idx; +u8 *buf; +unsigned int buflen;unsigned int len; +unsigned int idx;u32 state;u8 bs;u8 sn;u8 ll_dl; -u8 buf[MAX_MSG_LENGTH +1 ]; +u8 sbuf[DEFAULT_MAX_PDU_SIZE ]; };struct isotp_sock {
@@ -503,7 +516,17 @@ static int isotp_rcv_ff(struct sock *sk, struct canfd_frame *cf, int ae)if (so->rx.len + ae + off + ff_pci_sz < so->rx.ll_dl)return 1 ; -if (so->rx.len >MAX_MSG_LENGTH ) { +/* PDU size > default => try max_pdu_size */ +if (so->rx.len > so->rx.buflen && so->rx.buflen < max_pdu_size) { +u8 *newbuf =kmalloc (max_pdu_size,GFP_ATOMIC ); + +if (newbuf) { + so->rx.buf = newbuf; + so->rx.buflen = max_pdu_size; + } + } + +if (so->rx.len > so->rx.buflen) {/* send FC frame with overflow status */ isotp_send_fc (sk, ae,ISOTP_FC_OVFLW );return 1 ;
@@ -807,7 +830,7 @@ static void isotp_create_fframe(struct canfd_frame *cf, struct isotp_sock *so, cf->data[0 ] = so->opt.ext_address;/* create N_PCI bytes with 12/32 bit FF_DL data length */ -if (so->tx.len >4095 ) { +if (so->tx.len >MAX_12BIT_PDU_SIZE ) {/* use 32 bit FF_DL notation */ cf->data[ae] =N_PCI_FF ; cf->data[ae +1 ] =0 ;
@@ -947,7 +970,17 @@ static int isotp_sendmsg(struct socket *sock, struct msghdr *msg, size_t size) so->tx.state =ISOTP_SENDING ; } -if (!size || size >MAX_MSG_LENGTH ) { +/* PDU size > default => try max_pdu_size */ +if (size > so->tx.buflen && so->tx.buflen < max_pdu_size) { +u8 *newbuf =kmalloc (max_pdu_size,GFP_KERNEL ); + +if (newbuf) { + so->tx.buf = newbuf; + so->tx.buflen = max_pdu_size; + } + } + +if (!size || size > so->tx.buflen) { err = -EINVAL ; goto err_out_drop; }
@@ -1195,6 +1228,12 @@ static int isotp_release(struct socket *sock) so->ifindex =0 ; so->bound =0 ; +if (so->rx.buf != so->rx.sbuf) +kfree (so->rx.buf); + +if (so->tx.buf != so->tx.sbuf) +kfree (so->tx.buf); +sock_orphan (sk); sock->sk =NULL ;
@@ -1591,6 +1630,11 @@ static int isotp_init(struct sock *sk) so->rx.state =ISOTP_IDLE ; so->tx.state =ISOTP_IDLE ; + so->rx.buf = so->rx.sbuf; + so->tx.buf = so->tx.sbuf; + so->rx.buflen =ARRAY_SIZE (so->rx.sbuf); + so->tx.buflen =ARRAY_SIZE (so->tx.sbuf); +hrtimer_init (&so->rxtimer,CLOCK_MONOTONIC ,HRTIMER_MODE_REL_SOFT ); so->rxtimer.function = isotp_rx_timer_handler;hrtimer_init (&so->txtimer,CLOCK_MONOTONIC ,HRTIMER_MODE_REL_SOFT );
@@ -1658,7 +1702,10 @@ static __init int isotp_module_init(void) {int err; -pr_info ("can: isotp protocol\n" ); + max_pdu_size = max_t(unsigned int, max_pdu_size, MAX_12BIT_PDU_SIZE); + max_pdu_size = min_t(unsigned int, max_pdu_size, MAX_PDU_SIZE); + +pr_info ("can: isotp protocol (max_pdu_size %d)\n" , max_pdu_size); err =can_proto_register (&isotp_can_proto);if (err <0 )
base-commit: 4cee0fb9cc4b5477637fdeb2e965f5fc7d624622
Signature · 1 line
2.39.2
Re: [PATCH net-next 01/10] can: isotp: add module parameter for maximum pdu size
This series was applied to netdev/net-next.git (main) by Marc Kleine-Budde <[email protected]>:
Hello:
This series was applied to netdev/net-next.git (main) by Marc Kleine-Budde <[email protected]>:
Quoted 9 lines · On Tue, 4 Apr 2023 16:58:59 +0200 you wrote:
From: Oliver Hartkopp <[email protected]>
With ISO 15765-2:2016 the PDU size is not limited to 2^12 - 1 (4095) bytes but can be represented as a 32 bit unsigned integer value which allows 2^32 - 1 bytes (~4GB). The use-cases like automotive unified diagnostic services (UDS) and flashing of ECUs still use the small static buffers which are provided at socket creation time.
[...]
Here is the summary with links:
- [net-next,01/10] can: isotp: add module parameter for maximum pdu size
https://git.kernel.org/netdev/net-next/c/96d1c81e6a04 - [net-next,02/10] dt-bindings: arm: stm32: add compatible for syscon gcan node https://git.kernel.org/netdev/net-next/c/b341be6de98c - [net-next,03/10] dt-bindings: net: can: add STM32 bxcan DT bindings https://git.kernel.org/netdev/net-next/c/e43250c0ac81 - [net-next,04/10] ARM: dts: stm32: add CAN support on stm32f429 https://git.kernel.org/netdev/net-next/c/7355ad1950f4 - [net-next,05/10] ARM: dts: stm32: add pin map for CAN controller on stm32f4 https://git.kernel.org/netdev/net-next/c/559a6e75b4bc - [net-next,06/10] can: bxcan: add support for ST bxCAN controller https://git.kernel.org/netdev/net-next/c/f00647d8127b - [net-next,07/10] can: rcar_canfd: rcar_canfd_probe(): fix plain integer in transceivers[] init https://git.kernel.org/netdev/net-next/c/8e85d550c127 - [net-next,08/10] dt-bindings: can: fsl,flexcan: add optional power-domains property https://git.kernel.org/netdev/net-next/c/066b41a599d6 - [net-next,09/10] can: esd_usb: Add support for CAN_CTRLMODE_BERR_REPORTING https://git.kernel.org/netdev/net-next/c/c42fc3694923 - [net-next,10/10] kvaser_usb: convert USB IDs to hexadecimal values https://git.kernel.org/netdev/net-next/c/1afae605e0b2
You are awesome, thank you!
Signature · 2 lines
Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/patchwork/pwbot.html
Marc Kleine-Budde
maintainerPATCH 2/10 dt-bindings: arm: stm32: add compatible for syscon gcan node
In reply to Marc Kleine-BuddeFrom: Dario Binacchi <[email protected]>
Since commit ad440432d1f9 ("dt-bindings: mfd: Ensure 'syscon' has a more specific compatible") it is required to provide at least 2 compatibles string for syscon node.
This patch documents the new compatible for stm32f4 SoC to support global/shared CAN registers access for bxCAN controllers.
--- .../devicetree/bindings/arm/stm32/st,stm32-syscon.yaml | 2 ++ 1 file changed, 2 insertions(+)
Documentation/devicetree/bindings/arm/stm32/st,stm32-syscon.yaml +2 -0
@@ -20,6 +20,7 @@ properties: - st,stm32-syscfg - st,stm32-power-config - st,stm32-tamp + - st,stm32f4-gcan - const: syscon - items: - const: st,stm32-tamp
@@ -42,6 +43,7 @@ if: contains: enum: - st,stm32mp157-syscfg + - st,stm32f4-gcan then: required: - clocks
Signature · 1 line
2.39.2
Marc Kleine-Budde
maintainerPATCH 3/10 dt-bindings: net: can: add STM32 bxcan DT bindings
In reply to Marc Kleine-BuddeFrom: Dario Binacchi <[email protected]>
Add documentation of device tree bindings for the STM32 basic extended CAN (bxcan) controller.
--- .../bindings/net/can/st,stm32-bxcan.yaml | 85 +++++++++++++++++++ 1 file changed, 85 insertions(+) create mode 100644 Documentation/devicetree/bindings/net/can/st,stm32-bxcan.yaml
Documentation/devicetree/bindings/net/can/st,stm32-bxcan.yaml new file +85 -0
@@ -0,0 +1,85 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/net/can/st,stm32-bxcan.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: STMicroelectronics bxCAN controller + +description: STMicroelectronics BxCAN controller for CAN bus + +maintainers: + - Dario Binacchi <[email protected]> + +allOf: + - $ref: can-controller.yaml# + +properties: + compatible: + enum: + - st,stm32f4-bxcan + + st,can-primary: + description: + Primary and secondary mode of the bxCAN peripheral is only relevant + if the chip has two CAN peripherals. In that case they share some + of the required logic. + To avoid misunderstandings, it should be noted that ST documentation + uses the terms master/slave instead of primary/secondary. + type: boolean + + reg: + maxItems: 1 + + interrupts: + items: + - description: transmit interrupt + - description: FIFO 0 receive interrupt + - description: FIFO 1 receive interrupt + - description: status change error interrupt + + interrupt-names: + items: + - const: tx + - const: rx0 + - const: rx1 + - const: sce + + resets: + maxItems: 1 + + clocks: + maxItems: 1 + + st,gcan: + $ref: /schemas/types.yaml#/definitions/phandle-array + description: + The phandle to the gcan node which allows to access the 512-bytes + SRAM memory shared by the two bxCAN cells (CAN1 primary and CAN2 + secondary) in dual CAN peripheral configuration. + +required: + - compatible + - reg + - interrupts + - resets + - clocks + - st,gcan + +additionalProperties: false + +examples: + - | + #include <dt-bindings/clock/stm32fx-clock.h> + #include <dt-bindings/mfd/stm32f4-rcc.h> + + can1: can@40006400 { + compatible = "st,stm32f4-bxcan"; + reg = <0x40006400 0x200>; + interrupts = <19>, <20>, <21>, <22>; + interrupt-names = "tx", "rx0", "rx1", "sce"; + resets = <&rcc STM32F4_APB1_RESET(CAN1)>; + clocks = <&rcc 0 STM32F4_APB1_CLOCK(CAN1)>; + st,can-primary; + st,gcan = <&gcan>; + };
Signature · 1 line
2.39.2
Marc Kleine-Budde
maintainerPATCH 4/10 ARM: dts: stm32: add CAN support on stm32f429
In reply to Marc Kleine-BuddeFrom: Dario Binacchi <[email protected]>
Add support for bxcan (Basic eXtended CAN controller) to STM32F429. The chip contains two CAN peripherals, CAN1 the primary and CAN2 the secondary, that share some of the required logic like clock and filters. This means that the secondary CAN can't be used without the primary CAN.
--- arch/arm/boot/dts/stm32f429.dtsi | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+)
arch/arm/boot/dts/stm32f429.dtsi +29 -0
@@ -362,6 +362,35 @@ i2c3: i2c@40005c00 { status = "disabled"; }; + can1: can@40006400 { + compatible = "st,stm32f4-bxcan"; + reg = <0x40006400 0x200>; + interrupts = <19>, <20>, <21>, <22>; + interrupt-names = "tx", "rx0", "rx1", "sce"; + resets = <&rcc STM32F4_APB1_RESET(CAN1)>; + clocks = <&rcc 0 STM32F4_APB1_CLOCK(CAN1)>; + st,can-primary; + st,gcan = <&gcan>; + status = "disabled"; + }; + + gcan: gcan@40006600 { + compatible = "st,stm32f4-gcan", "syscon"; + reg = <0x40006600 0x200>; + clocks = <&rcc 0 STM32F4_APB1_CLOCK(CAN1)>; + }; + + can2: can@40006800 { + compatible = "st,stm32f4-bxcan"; + reg = <0x40006800 0x200>; + interrupts = <63>, <64>, <65>, <66>; + interrupt-names = "tx", "rx0", "rx1", "sce"; + resets = <&rcc STM32F4_APB1_RESET(CAN2)>; + clocks = <&rcc 0 STM32F4_APB1_CLOCK(CAN2)>; + st,gcan = <&gcan>; + status = "disabled"; + }; + dac: dac@40007400 { compatible = "st,stm32f4-dac-core"; reg = <0x40007400 0x400>;
Signature · 1 line
2.39.2
Marc Kleine-Budde
maintainerPATCH 5/10 ARM: dts: stm32: add pin map for CAN controller on stm32f4
In reply to Marc Kleine-BuddeFrom: Dario Binacchi <[email protected]>
Add pin configurations for using CAN controller on stm32f469-disco board. They are located on the Arduino compatible connector CN5 (CAN1) and on the extension connector CN12 (CAN2).
--- arch/arm/boot/dts/stm32f4-pinctrl.dtsi | 30 ++++++++++++++++++++++++++ 1 file changed, 30 insertions(+)
arch/arm/boot/dts/stm32f4-pinctrl.dtsi +30 -0
@@ -447,6 +447,36 @@ pins2 { slew-rate = <2>; }; }; + + can1_pins_a: can1-0 { + pins1 { + pinmux = <STM32_PINMUX('B', 9, AF9)>; /* CAN1_TX */ + }; + pins2 { + pinmux = <STM32_PINMUX('B', 8, AF9)>; /* CAN1_RX */ + bias-pull-up; + }; + }; + + can2_pins_a: can2-0 { + pins1 { + pinmux = <STM32_PINMUX('B', 13, AF9)>; /* CAN2_TX */ + }; + pins2 { + pinmux = <STM32_PINMUX('B', 5, AF9)>; /* CAN2_RX */ + bias-pull-up; + }; + }; + + can2_pins_b: can2-1 { + pins1 { + pinmux = <STM32_PINMUX('B', 13, AF9)>; /* CAN2_TX */ + }; + pins2 { + pinmux = <STM32_PINMUX('B', 12, AF9)>; /* CAN2_RX */ + bias-pull-up; + }; + }; }; }; };
Signature · 1 line
2.39.2
Marc Kleine-Budde
maintainerPATCH 6/10 can: bxcan: add support for ST bxCAN controller
In reply to Marc Kleine-BuddeFrom: Dario Binacchi <[email protected]>
Add support for the basic extended CAN controller (bxCAN) found in many low- to middle-end STM32 SoCs. It supports the Basic Extended CAN protocol versions 2.0A and B with a maximum bit rate of 1 Mbit/s.
The controller supports two channels (CAN1 as primary and CAN2 as secondary) and the driver can enable either or both of the channels. They share some of the required logic (e. g. clocks and filters), and that means you cannot use the secondary CAN without enabling some hardware resources managed by the primary CAN.
Each channel has 3 transmit mailboxes, 2 receive FIFOs with 3 stages and 28 scalable filter banks.
It also manages 4 dedicated interrupt vectors:
- transmit interrupt
- FIFO 0 receive interrupt
- FIFO 1 receive interrupt
- status change error interrupt
Driver uses all 3 available mailboxes for transmission and FIFO 0 for reception. Rx filter rules are configured to the minimum. They accept all messages and assign filter 0 to CAN1 and filter 14 to CAN2 in identifier mask mode with 32 bits width. It enables and uses transmit, receive buffers for FIFO 0 and error and status change interrupts.
--- MAINTAINERS | 7 + drivers/net/can/Kconfig | 12 + drivers/net/can/Makefile | 1 + drivers/net/can/bxcan.c | 1098 ++++++++++++++++++++++++++++++++++++++ 4 files changed, 1118 insertions(+) create mode 100644 drivers/net/can/bxcan.c
MAINTAINERS +7 -0
@@ -4431,6 +4431,13 @@ S: Maintained F: drivers/scsi/BusLogic.* F: drivers/scsi/FlashPoint.* +BXCAN CAN NETWORK DRIVER +M: Dario Binacchi <[email protected]> +L: [email protected] +S: Maintained +F: Documentation/devicetree/bindings/net/can/st,stm32-bxcan.yaml +F: drivers/net/can/bxcan.c + C-MEDIA CMI8788 DRIVER M: Clemens Ladisch <[email protected]> L: [email protected] (moderated for non-subscribers)
drivers/net/can/Kconfig +12 -0
@@ -93,6 +93,18 @@ config CAN_AT91 This is a driver for the SoC CAN controller in Atmel's AT91SAM9263 and AT91SAM9X5 processors. +config CAN_BXCAN + tristate "STM32 Basic Extended CAN (bxCAN) devices" + depends on OF || ARCH_STM32 || COMPILE_TEST + depends on HAS_IOMEM + select CAN_RX_OFFLOAD + help + Say yes here to build support for the STMicroelectronics STM32 basic + extended CAN Controller (bxCAN). + + This driver can also be built as a module. If so, the module + will be called bxcan. + config CAN_CAN327 tristate "Serial / USB serial ELM327 based OBD-II Interfaces (can327)" depends on TTY
drivers/net/can/Makefile +1 -0
@@ -14,6 +14,7 @@ obj-y += usb/ obj-y += softing/ obj-$(CONFIG_CAN_AT91) += at91_can.o +obj-$(CONFIG_CAN_BXCAN) += bxcan.o obj-$(CONFIG_CAN_CAN327) += can327.o obj-$(CONFIG_CAN_CC770) += cc770/ obj-$(CONFIG_CAN_C_CAN) += c_can/
drivers/net/can/bxcan.c new file +1098 -0
1,098 lines not on this page · raw message
Signature · 1 line
2.39.2
Marc Kleine-Budde
maintainerPATCH 7/10 can: rcar_canfd: rcar_canfd_probe(): fix plain integer in transceivers[] init
In reply to Marc Kleine-BuddeFrom: Geert Uytterhoeven <[email protected]>
Fix the following compile warning with C=1:
| drivers/net/can/rcar/rcar_canfd.c:1852:59: warning: Using plain integer as NULL pointer
--- drivers/net/can/rcar/rcar_canfd.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/can/rcar/rcar_canfd.c +1 -1
@@ -1848,7 +1848,7 @@ static void rcar_canfd_channel_remove(struct rcar_canfd_global *gpriv, u32 ch)static int rcar_canfd_probe (struct platform_device *pdev) { -struct phy *transceivers[RCANFD_NUM_CHANNELS ] = {0 , }; +struct phy *transceivers[RCANFD_NUM_CHANNELS ] = {NULL , };const struct rcar_canfd_hw_info *info;struct device *dev = &pdev->dev;void __iomem *addr;
Signature · 1 line
2.39.2
Marc Kleine-Budde
maintainerPATCH 8/10 dt-bindings: can: fsl,flexcan: add optional power-domains property
In reply to Marc Kleine-BuddeFrom: Peng Fan <[email protected]>
Add optional power-domains property for i.MX8 usage.
--- Documentation/devicetree/bindings/net/can/fsl,flexcan.yaml | 3 +++ 1 file changed, 3 insertions(+)
Documentation/devicetree/bindings/net/can/fsl,flexcan.yaml +3 -0
@@ -63,6 +63,9 @@ properties: boot loader. This property should only be used the used operating system doesn't support the clocks and clock-names property. + power-domains: + maxItems: 1 + xceiver-supply: description: Regulator that powers the CAN transceiver.
Signature · 1 line
2.39.2
Marc Kleine-Budde
maintainerPATCH 9/10 can: esd_usb: Add support for CAN_CTRLMODE_BERR_REPORTING
In reply to Marc Kleine-BuddeFrom: Frank Jungclaus <[email protected]>
Announce that the driver supports CAN_CTRLMODE_BERR_REPORTING by means of priv->can.ctrlmode_supported. Until now berr reporting always has been active without taking care of the berr-reporting parameter given to an "ip link set ..." command.
Additionally apply some changes to function esd_usb_rx_event():
- If berr reporting is off and it is also no state change, then immediately return.
- Unconditionally (even in case of the above "immediate return") store tx- and rx-error counters, so directly use priv->bec.txerr and priv->bec.rxerr instead of intermediate variables.
- Not directly related, but to better point out the linkage between a failed alloc_can_err_skb() and stats->rx_dropped++:
Move the increment of the rx_dropped statistic counter (back) to directly behind the err_skb allocation.
--- drivers/net/can/usb/esd_usb.c | 35 ++++++++++++++++++++--------------- 1 file changed, 20 insertions(+), 15 deletions(-)
drivers/net/can/usb/esd_usb.c +20 -15
@@ -237,14 +237,23 @@ static void esd_usb_rx_event(struct esd_usb_net_priv *priv,if (id ==ESD_EV_CAN_ERROR_EXT ) {u8 state = msg->rx.ev_can_err_ext.status;u8 ecc = msg->rx.ev_can_err_ext.ecc; -u8 rxerr = msg->rx.ev_can_err_ext.rec; -u8 txerr = msg->rx.ev_can_err_ext.tec; + + priv->bec.rxerr = msg->rx.ev_can_err_ext.rec; + priv->bec.txerr = msg->rx.ev_can_err_ext.tec;netdev_dbg (priv->netdev,"CAN_ERR_EV_EXT: dlc=%#02x state=%02x ecc=%02x rec=%02x tec=%02x\n" , - msg->rx.dlc, state, ecc, rxerr, txerr); + msg->rx.dlc, state, ecc, + priv->bec.rxerr, priv->bec.txerr); + +/* if berr-reporting is off, only pass through on state change ... */ +if (!(priv->can.ctrlmode &CAN_CTRLMODE_BERR_REPORTING ) && + state == priv->old_state) +return ; skb =alloc_can_err_skb (priv->netdev, &cf); +if (!skb) + stats->rx_dropped++;if (state != priv->old_state) {enum can_state tx_state, rx_state;
@@ -265,14 +274,14 @@ static void esd_usb_rx_event(struct esd_usb_net_priv *priv,break ;default : new_state =CAN_STATE_ERROR_ACTIVE ; - txerr =0 ; - rxerr =0 ; + priv->bec.txerr =0 ; + priv->bec.rxerr =0 ;break ; }if (new_state != priv->can.state) { - tx_state = (txerr >= rxerr) ? new_state :0 ; - rx_state = (txerr <= rxerr) ? new_state :0 ; + tx_state = (priv->bec.txerr >= priv->bec.rxerr) ? new_state :0 ; + rx_state = (priv->bec.txerr <= priv->bec.rxerr) ? new_state :0 ;can_change_state (priv->netdev, cf, tx_state, rx_state); }
@@ -304,17 +313,12 @@ static void esd_usb_rx_event(struct esd_usb_net_priv *priv, cf->data[3 ] = ecc &SJA1000_ECC_SEG ; } - priv->bec.txerr = txerr; - priv->bec.rxerr = rxerr; -if (skb) { cf->can_id |=CAN_ERR_CNT ; - cf->data[6 ] = txerr; - cf->data[7 ] = rxerr; + cf->data[6 ] = priv->bec.txerr; + cf->data[7 ] = priv->bec.rxerr;netif_rx (skb); - }else { - stats->rx_dropped++; } } }
@@ -1016,7 +1020,8 @@ static int esd_usb_probe_one_net(struct usb_interface *intf, int index) priv->can.state =CAN_STATE_STOPPED ; priv->can.ctrlmode_supported =CAN_CTRLMODE_LISTENONLY | -CAN_CTRLMODE_CC_LEN8_DLC ; +CAN_CTRLMODE_CC_LEN8_DLC | +CAN_CTRLMODE_BERR_REPORTING ;if (le16_to_cpu (dev->udev->descriptor.idProduct) ==USB_CANUSBM_PRODUCT_ID )
Signature · 1 line
2.39.2
Marc Kleine-Budde
maintainerPATCH 10/10 kvaser_usb: convert USB IDs to hexadecimal values
In reply to Marc Kleine-BuddeFrom: Oliver Hartkopp <[email protected]>
USB IDs are usually represented in 16 bit hexadecimal values. To match the common representation in lsusb and for searching USB IDs in the internet convert the decimal values to lowercase hexadecimal.
changes since v1: https://lore.kernel.org/all/[email protected]
- drop the aligned block indentation (suggested by Jimmy)
- use lowercase hex values (suggested by Alex)
--- .../net/can/usb/kvaser_usb/kvaser_usb_core.c | 102 +++++++++--------- 1 file changed, 51 insertions(+), 51 deletions(-)
drivers/net/can/usb/kvaser_usb/kvaser_usb_core.c +51 -51
@@ -31,63 +31,63 @@#include "kvaser_usb.h" /* Kvaser USB vendor id. */ -#define KVASER_VENDOR_ID 0x0bfd +#define KVASER_VENDOR_ID 0x0bfd/* Kvaser Leaf USB devices product ids */ -#define USB_LEAF_DEVEL_PRODUCT_ID 10 -#define USB_LEAF_LITE_PRODUCT_ID 11 -#define USB_LEAF_PRO_PRODUCT_ID 12 -#define USB_LEAF_SPRO_PRODUCT_ID 14 -#define USB_LEAF_PRO_LS_PRODUCT_ID 15 -#define USB_LEAF_PRO_SWC_PRODUCT_ID 16 -#define USB_LEAF_PRO_LIN_PRODUCT_ID 17 -#define USB_LEAF_SPRO_LS_PRODUCT_ID 18 -#define USB_LEAF_SPRO_SWC_PRODUCT_ID 19 -#define USB_MEMO2_DEVEL_PRODUCT_ID 22 -#define USB_MEMO2_HSHS_PRODUCT_ID 23 -#define USB_UPRO_HSHS_PRODUCT_ID 24 -#define USB_LEAF_LITE_GI_PRODUCT_ID 25 -#define USB_LEAF_PRO_OBDII_PRODUCT_ID 26 -#define USB_MEMO2_HSLS_PRODUCT_ID 27 -#define USB_LEAF_LITE_CH_PRODUCT_ID 28 -#define USB_BLACKBIRD_SPRO_PRODUCT_ID 29 -#define USB_OEM_MERCURY_PRODUCT_ID 34 -#define USB_OEM_LEAF_PRODUCT_ID 35 -#define USB_CAN_R_PRODUCT_ID 39 -#define USB_LEAF_LITE_V2_PRODUCT_ID 288 -#define USB_MINI_PCIE_HS_PRODUCT_ID 289 -#define USB_LEAF_LIGHT_HS_V2_OEM_PRODUCT_ID 290 -#define USB_USBCAN_LIGHT_2HS_PRODUCT_ID 291 -#define USB_MINI_PCIE_2HS_PRODUCT_ID 292 -#define USB_USBCAN_R_V2_PRODUCT_ID 294 -#define USB_LEAF_LIGHT_R_V2_PRODUCT_ID 295 -#define USB_LEAF_LIGHT_HS_V2_OEM2_PRODUCT_ID 296 +#define USB_LEAF_DEVEL_PRODUCT_ID 0x000a +#define USB_LEAF_LITE_PRODUCT_ID 0x000b +#define USB_LEAF_PRO_PRODUCT_ID 0x000c +#define USB_LEAF_SPRO_PRODUCT_ID 0x000e +#define USB_LEAF_PRO_LS_PRODUCT_ID 0x000f +#define USB_LEAF_PRO_SWC_PRODUCT_ID 0x0010 +#define USB_LEAF_PRO_LIN_PRODUCT_ID 0x0011 +#define USB_LEAF_SPRO_LS_PRODUCT_ID 0x0012 +#define USB_LEAF_SPRO_SWC_PRODUCT_ID 0x0013 +#define USB_MEMO2_DEVEL_PRODUCT_ID 0x0016 +#define USB_MEMO2_HSHS_PRODUCT_ID 0x0017 +#define USB_UPRO_HSHS_PRODUCT_ID 0x0018 +#define USB_LEAF_LITE_GI_PRODUCT_ID 0x0019 +#define USB_LEAF_PRO_OBDII_PRODUCT_ID 0x001a +#define USB_MEMO2_HSLS_PRODUCT_ID 0x001b +#define USB_LEAF_LITE_CH_PRODUCT_ID 0x001c +#define USB_BLACKBIRD_SPRO_PRODUCT_ID 0x001d +#define USB_OEM_MERCURY_PRODUCT_ID 0x0022 +#define USB_OEM_LEAF_PRODUCT_ID 0x0023 +#define USB_CAN_R_PRODUCT_ID 0x0027 +#define USB_LEAF_LITE_V2_PRODUCT_ID 0x0120 +#define USB_MINI_PCIE_HS_PRODUCT_ID 0x0121 +#define USB_LEAF_LIGHT_HS_V2_OEM_PRODUCT_ID 0x0122 +#define USB_USBCAN_LIGHT_2HS_PRODUCT_ID 0x0123 +#define USB_MINI_PCIE_2HS_PRODUCT_ID 0x0124 +#define USB_USBCAN_R_V2_PRODUCT_ID 0x0126 +#define USB_LEAF_LIGHT_R_V2_PRODUCT_ID 0x0127 +#define USB_LEAF_LIGHT_HS_V2_OEM2_PRODUCT_ID 0x0128/* Kvaser USBCan-II devices product ids */ -#define USB_USBCAN_REVB_PRODUCT_ID 2 -#define USB_VCI2_PRODUCT_ID 3 -#define USB_USBCAN2_PRODUCT_ID 4 -#define USB_MEMORATOR_PRODUCT_ID 5 +#define USB_USBCAN_REVB_PRODUCT_ID 0x0002 +#define USB_VCI2_PRODUCT_ID 0x0003 +#define USB_USBCAN2_PRODUCT_ID 0x0004 +#define USB_MEMORATOR_PRODUCT_ID 0x0005/* Kvaser Minihydra USB devices product ids */ -#define USB_BLACKBIRD_V2_PRODUCT_ID 258 -#define USB_MEMO_PRO_5HS_PRODUCT_ID 260 -#define USB_USBCAN_PRO_5HS_PRODUCT_ID 261 -#define USB_USBCAN_LIGHT_4HS_PRODUCT_ID 262 -#define USB_LEAF_PRO_HS_V2_PRODUCT_ID 263 -#define USB_USBCAN_PRO_2HS_V2_PRODUCT_ID 264 -#define USB_MEMO_2HS_PRODUCT_ID 265 -#define USB_MEMO_PRO_2HS_V2_PRODUCT_ID 266 -#define USB_HYBRID_2CANLIN_PRODUCT_ID 267 -#define USB_ATI_USBCAN_PRO_2HS_V2_PRODUCT_ID 268 -#define USB_ATI_MEMO_PRO_2HS_V2_PRODUCT_ID 269 -#define USB_HYBRID_PRO_2CANLIN_PRODUCT_ID 270 -#define USB_U100_PRODUCT_ID 273 -#define USB_U100P_PRODUCT_ID 274 -#define USB_U100S_PRODUCT_ID 275 -#define USB_USBCAN_PRO_4HS_PRODUCT_ID 276 -#define USB_HYBRID_CANLIN_PRODUCT_ID 277 -#define USB_HYBRID_PRO_CANLIN_PRODUCT_ID 278 +#define USB_BLACKBIRD_V2_PRODUCT_ID 0x0102 +#define USB_MEMO_PRO_5HS_PRODUCT_ID 0x0104 +#define USB_USBCAN_PRO_5HS_PRODUCT_ID 0x0105 +#define USB_USBCAN_LIGHT_4HS_PRODUCT_ID 0x0106 +#define USB_LEAF_PRO_HS_V2_PRODUCT_ID 0x0107 +#define USB_USBCAN_PRO_2HS_V2_PRODUCT_ID 0x0108 +#define USB_MEMO_2HS_PRODUCT_ID 0x0109 +#define USB_MEMO_PRO_2HS_V2_PRODUCT_ID 0x010a +#define USB_HYBRID_2CANLIN_PRODUCT_ID 0x010b +#define USB_ATI_USBCAN_PRO_2HS_V2_PRODUCT_ID 0x010c +#define USB_ATI_MEMO_PRO_2HS_V2_PRODUCT_ID 0x010d +#define USB_HYBRID_PRO_2CANLIN_PRODUCT_ID 0x010e +#define USB_U100_PRODUCT_ID 0x0111 +#define USB_U100P_PRODUCT_ID 0x0112 +#define USB_U100S_PRODUCT_ID 0x0113 +#define USB_USBCAN_PRO_4HS_PRODUCT_ID 0x0114 +#define USB_HYBRID_CANLIN_PRODUCT_ID 0x0115 +#define USB_HYBRID_PRO_CANLIN_PRODUCT_ID 0x0116static const struct kvaser_usb_driver_info kvaser_usb_driver_info_hydra = { .quirks =KVASER_USB_QUIRK_HAS_HARDWARE_TIMESTAMP ,
Signature · 1 line
2.39.2