From: Marc Kleine-Budde <mkl@pengutronix.de> Date: 2021-07-26 14:12:03
Hello Jakub, hello David,
this is a pull request of 46 patches for net-next/master.
The first 6 patches target the CAN J1939 protocol. One is from
gushengxian, fixing a grammatical error, 5 are by me fixing a checkpatch
warning, make use of the fallthrough pseudo-keyword, and use
consistent variable naming.
The next 3 patches target the rx-offload helper, are by me and improve
the performance and fix the local softirq work pending error, when
napi_schedule() is called from threaded IRQ context.
The next 3 patches are by Vincent Mailhol and me update the CAN
bittiming and transmitter delay compensation, the documentation for
the struct can_tdc is fixed, clear data_bittiming if FD mode is turned
off and a redundant check is removed.
Followed by 4 patches targeting the m_can driver. Faiz Abbas's patches
add support for CAN PHY via the generic phy subsystem. Yang Yingliang
converts the driver to use devm_platform_ioremap_resource_byname().
And a patch by me which removes the unused support for custom bit
timing.
Andy Shevchenko contributes 2 patches for the mcp251xfd driver to
prepare the driver for ACPI support. A patch by me adds support for
shared IRQ handlers.
Zhen Lei contributes 3 patches to convert the esd_usb2, janz-ican3 and
the at91_can driver to make use of the DEVICE_ATTR_RO/RW() macros.
The next 8 patches are by Peng Li and provide general cleanups for the
at91_can driver.
The next 7 patches target the peak driver. Frist 2 cleanup patches by
me for the peak_pci driver, followed by Stephane Grosjean' patch to
print the name and firmware version of the detected hardware. The
peak_usb driver gets a cleanup patch, loopback and one-shot mode and
an upgrading of the bus state change handling in Stephane Grosjean's
patches.
Vincent Mailhol provides 6 cleanup patches for the etas_es58x driver.
In the last 3 patches Angelo Dureghello add support for the mcf5441x
SoC to the flexcan driver.
regards,
Marc
---
The following changes since commit 0e804326759de7b9991353dd66b03595b5c3f544:
Merge branch 'nfc-const' (2021-07-25 09:21:32 +0100)
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-5.15-20210725
for you to fetch changes up to 8dad5561c13ade87238d9de6dd410b43f7562447:
can: flexcan: update Kconfig to enable coldfire (2021-07-25 11:36:29 +0200)
----------------------------------------------------------------
linux-can-next-for-5.15-20210725
----------------------------------------------------------------
Andy Shevchenko (2):
can: mcp251xfd: mcp251xfd_probe(): try to get crystal clock rate from property
can: mcp251xfd: Fix header block to clarify independence from OF
Angelo Dureghello (3):
can: flexcan: add platform data header
can: flexcan: add mcf5441x support
can: flexcan: update Kconfig to enable coldfire
Faiz Abbas (2):
dt-bindings: net: can: Document transceiver implementation as phy
can: m_can: Add support for transceiver as phy
Marc Kleine-Budde (13):
can: j1939: fix checkpatch warnings
can: j1939: replace fall through comment by fallthrough pseudo-keyword
can: j1939: j1939_session_completed(): use consistent name se_skb for the session skb
can: j1939: j1939_session_tx_dat(): use consistent name se_skcb for session skb control buffer
can: j1939: j1939_xtp_rx_dat_one(): use separate pointer for session skb control buffer
can: rx-offload: add skb queue for use during ISR
can: rx-offload: can_rx_offload_irq_finish(): directly call napi_schedule()
can: rx-offload: can_rx_offload_threaded_irq_finish(): add new function to be called from threaded interrupt
can: bittiming: fix documentation for struct can_tdc
can: m_can: remove support for custom bit timing
can: mcp251xfd: mcp251xfd_open(): request IRQ as shared
can: peak_pci: convert comments to network style comments
can: peak_pci: fix checkpatch warnings
Peng Li (8):
net: at91_can: remove redundant blank lines
net: at91_can: add blank line after declarations
net: at91_can: fix the code style issue about macro
net: at91_can: use BIT macro
net: at91_can: fix the alignment issue
net: at91_can: add braces {} to all arms of the statement
net: at91_can: remove redundant space
net: at91_can: fix the comments style issue
Stephane Grosjean (5):
can: peak_pci: Add name and FW version of the card in kernel buffer
can: peak_usb: pcan_usb_get_device_id(): read value only in case of success
can: peak_usb: PCAN-USB: add support of loopback and one-shot mode
can: peak_usb: pcan_usb_encode_msg(): add information
can: peak_usb: pcan_usb_decode_error(): upgrade handling of bus state changes
Vincent Mailhol (8):
can: netlink: clear data_bittiming if FD is turned off
can: netlink: remove redundant check in can_validate()
can: etas_es58x: fix three typos in author name and documentation
can: etas_es58x: use error pointer during device probing
can: etas_es58x: use devm_kzalloc() to allocate device resources
can: etas_es58x: add es58x_free_netdevs() to factorize code
can: etas_es58x: use sizeof and sizeof_field macros instead of constant values
can: etas_es58x: rewrite the message cast in es58{1,_fd}_tx_can_msg to increase readability
Yang Yingliang (1):
can: m_can: use devm_platform_ioremap_resource_byname
Zhen Lei (3):
can: esd_usb2: use DEVICE_ATTR_RO() helper macro
can: janz-ican3: use DEVICE_ATTR_RO/RW() helper macro
can: at91_can: use DEVICE_ATTR_RW() helper macro
gushengxian (1):
can: j1939: j1939_sk_sock_destruct(): correct a grammatical error
.../devicetree/bindings/net/can/bosch,m_can.yaml | 3 +
drivers/net/can/Kconfig | 3 +-
drivers/net/can/at91_can.c | 137 ++++++-------
drivers/net/can/dev/netlink.c | 9 +-
drivers/net/can/dev/rx-offload.c | 90 +++++---
drivers/net/can/flexcan.c | 127 ++++++++++--
drivers/net/can/janz-ican3.c | 23 +--
drivers/net/can/m_can/m_can.c | 38 ++--
drivers/net/can/m_can/m_can.h | 5 +-
drivers/net/can/m_can/m_can_platform.c | 16 +-
drivers/net/can/sja1000/peak_pci.c | 119 ++++++-----
drivers/net/can/spi/mcp251xfd/mcp251xfd-core.c | 28 ++-
drivers/net/can/ti_hecc.c | 2 +
drivers/net/can/usb/esd_usb2.c | 12 +-
drivers/net/can/usb/etas_es58x/es581_4.c | 5 +-
drivers/net/can/usb/etas_es58x/es58x_core.c | 82 ++++----
drivers/net/can/usb/etas_es58x/es58x_core.h | 2 +-
drivers/net/can/usb/etas_es58x/es58x_fd.c | 19 +-
drivers/net/can/usb/peak_usb/pcan_usb.c | 228 +++++++++------------
include/linux/can/bittiming.h | 4 +-
include/linux/can/platform/flexcan.h | 23 +++
include/linux/can/rx-offload.h | 8 +-
net/can/j1939/socket.c | 2 +-
net/can/j1939/transport.c | 42 ++--
24 files changed, 584 insertions(+), 443 deletions(-)
create mode 100644 include/linux/can/platform/flexcan.h
@@ -352,7 +352,7 @@ static void j1939_sk_sock_destruct(struct sock *sk){structj1939_sock*jsk=j1939_sk(sk);-/* This function will be call by the generic networking code, when then+/* This function will be called by the generic networking code, when*thesocketisultimatelyclosed(sk->sk_destruct).**Theracebetween
From: Marc Kleine-Budde <mkl@pengutronix.de> Date: 2021-07-26 14:12:05
This patch fixes a checkpatch warning about a long line and wrong
indention.
Cc: Robin van der Gracht <robin@protonic.nl>
Cc: Oleksij Rempel <o.rempel@pengutronix.de>
Link: https://lore.kernel.org/r/20210616102811.2449426-2-mkl@pengutronix.de
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
---
net/can/j1939/transport.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
From: Marc Kleine-Budde <mkl@pengutronix.de> Date: 2021-07-26 14:12:08
Replace the existing /* fall through */ comments the new
pseudo-keyword macro fallthrough.
Cc: Robin van der Gracht <robin@protonic.nl>
Cc: Oleksij Rempel <o.rempel@pengutronix.de>
Link: https://lore.kernel.org/r/20210616102811.2449426-3-mkl@pengutronix.de
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
---
net/can/j1939/transport.c | 15 ++++++++++-----
1 file changed, 10 insertions(+), 5 deletions(-)
@@ -1264,12 +1264,14 @@ static bool j1939_xtp_rx_cmd_bad_pgn(struct j1939_session *session,break;caseJ1939_ETP_CMD_RTS:-caseJ1939_TP_CMD_RTS:/* fall through */+fallthrough;+caseJ1939_TP_CMD_RTS:abort=J1939_XTP_ABORT_BUSY;break;caseJ1939_ETP_CMD_CTS:-caseJ1939_TP_CMD_CTS:/* fall through */+fallthrough;+caseJ1939_TP_CMD_CTS:abort=J1939_XTP_ABORT_ECTS_UNXPECTED_PGN;break;
@@ -1278,7 +1280,8 @@ static bool j1939_xtp_rx_cmd_bad_pgn(struct j1939_session *session,break;caseJ1939_ETP_CMD_EOMA:-caseJ1939_TP_CMD_EOMA:/* fall through */+fallthrough;+caseJ1939_TP_CMD_EOMA:abort=J1939_XTP_ABORT_OTHER;break;
@@ -1793,7 +1796,8 @@ static void j1939_xtp_rx_dat_one(struct j1939_session *session,break;fallthrough;caseJ1939_TP_CMD_BAM:-caseJ1939_TP_CMD_CTS:/* fall through */+fallthrough;+caseJ1939_TP_CMD_CTS:if(skcb->addr.type!=J1939_ETP)break;fallthrough;
@@ -1996,7 +2000,8 @@ static void j1939_tp_cmd_recv(struct j1939_priv *priv, struct sk_buff *skb)extd=J1939_ETP;fallthrough;caseJ1939_TP_CMD_BAM:-caseJ1939_TP_CMD_RTS:/* fall through */+fallthrough;+caseJ1939_TP_CMD_RTS:if(skcb->addr.type!=extd)return;
From: Marc Kleine-Budde <mkl@pengutronix.de> Date: 2021-07-26 14:12:10
This patch changes the name of the "skb" variable in
j1939_session_completed() to "se_skb" as it's the session skb. The
same name is used in other functions for the session skb.
Cc: Robin van der Gracht <robin@protonic.nl>
Cc: Oleksij Rempel <o.rempel@pengutronix.de>
Link: https://lore.kernel.org/r/20210616102811.2449426-4-mkl@pengutronix.de
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
---
net/can/j1939/transport.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
From: Marc Kleine-Budde <mkl@pengutronix.de> Date: 2021-07-26 14:12:30
Instead of calling can_rx_offload_schedule() call napi_schedule()
directly. As this was the last use of can_rx_offload_schedule() remove
this helper function.
Link: https://lore.kernel.org/r/20210724204745.736053-3-mkl@pengutronix.de
Tested-by: Oleksij Rempel <o.rempel@pengutronix.de>
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
---
drivers/net/can/dev/rx-offload.c | 2 +-
include/linux/can/rx-offload.h | 5 -----
2 files changed, 1 insertion(+), 6 deletions(-)
From: Marc Kleine-Budde <mkl@pengutronix.de> Date: 2021-07-26 14:12:32
From: Vincent Mailhol <redacted>
When the FD is turned off through the netlink interface, the data bit
timing values still remain in data_bittiming and are displayed despite
of the feature being disabled.
Example:
| $ ip link set can0 type can bitrate 500000 dbitrate 2000000 fd on
| $ ip --details link show can0
| 1: can0: <NOARP,ECHO> mtu 72 qdisc pfifo_fast state DOWN mode DEFAULT group default qlen 10
| link/can promiscuity 0 minmtu 0 maxmtu 0
| can <FD> state STOPPED restart-ms 0
| bitrate 500000 sample-point 0.875
| tq 12 prop-seg 69 phase-seg1 70 phase-seg2 20 sjw 1
| ES582.1/ES584.1: tseg1 2..256 tseg2 2..128 sjw 1..128 brp 1..512 brp-inc 1
| dbitrate 2000000 dsample-point 0.750
| dtq 12 dprop-seg 14 dphase-seg1 15 dphase-seg2 10 dsjw 1
| ES582.1/ES584.1: dtseg1 2..32 dtseg2 1..16 dsjw 1..8 dbrp 1..32 dbrp-inc 1
| clock 80000000 numtxqueues 1 numrxqueues 1 gso_max_size 65536 gso_max_segs 65535
|
| $ ip link set can0 type can bitrate 500000 fd off
| $ ip --details link show can0
| 1: can0: <NOARP,ECHO> mtu 16 qdisc pfifo_fast state DOWN mode DEFAULT group default qlen 10
| link/can promiscuity 0 minmtu 0 maxmtu 0
| can state STOPPED restart-ms 0
| bitrate 500000 sample-point 0.875
| tq 12 prop-seg 69 phase-seg1 70 phase-seg2 20 sjw 1
| ES582.1/ES584.1: tseg1 2..256 tseg2 2..128 sjw 1..128 brp 1..512 brp-inc 1
| dbitrate 2000000 dsample-point 0.750
| dtq 12 dprop-seg 14 dphase-seg1 15 dphase-seg2 10 dsjw 1
| ES582.1/ES584.1: dtseg1 2..32 dtseg2 1..16 dsjw 1..8 dbrp 1..32 dbrp-inc 1
| clock 80000000 numtxqueues 1 numrxqueues 1 gso_max_size 65536 gso_max_segs 65535
Remark: once FD is turned off, it is not possible to turn fd back on
and reuse the previously input data bit timing values:
| $ ip link set can0 type can bitrate 500000 fd on
| RTNETLINK answers: Operation not supported
This means that the user will need to re-configure the data bit timing
in order to turn fd on again.
Because old data bit timing values cannot be reused, this patch clears
priv->data_bit timing whenever FD is turned off. This way, the data
bit timing variables are not displayed anymore.
Link: https://lore.kernel.org/r/20210618081904.141114-2-mailhol.vincent@wanadoo.fr
Signed-off-by: Vincent Mailhol <redacted>
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
---
drivers/net/can/dev/netlink.c | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
@@ -132,10 +132,13 @@ static int can_changelink(struct net_device *dev, struct nlattr *tb[],priv->ctrlmode|=maskedflags;/* CAN_CTRLMODE_FD can only be set when driver supports FD */-if(priv->ctrlmode&CAN_CTRLMODE_FD)+if(priv->ctrlmode&CAN_CTRLMODE_FD){dev->mtu=CANFD_MTU;-else+}else{dev->mtu=CAN_MTU;+memset(&priv->data_bittiming,0,+sizeof(priv->data_bittiming));+}}if(data[IFLA_CAN_RESTART_MS]){
From: Marc Kleine-Budde <mkl@pengutronix.de> Date: 2021-07-26 14:12:35
After reading all CAN frames from the controller in the IRQ handler
and storing them into a skb_queue, the driver calls napi_schedule().
In the napi poll function the skb from the skb_queue are then pushed
into the networking stack.
However if napi_schedule() is called from a threaded IRQ handler this
triggers the following error:
| NOHZ tick-stop error: Non-RCU local softirq work is pending, handler #08!!!
To avoid this, create a new rx-offload
function (can_rx_offload_threaded_irq_finish()) with a call to
local_bh_disable()/local_bh_enable() around the napi_schedule() call.
Convert all drivers that call can_rx_offload_irq_finish() from
threaded IRQ context to can_rx_offload_threaded_irq_finish().
Link: https://lore.kernel.org/r/20210724204745.736053-4-mkl@pengutronix.de
Suggested-by: Daniel Glöckner <redacted>
Tested-by: Oleksij Rempel <o.rempel@pengutronix.de>
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
---
drivers/net/can/dev/rx-offload.c | 23 +++++++++++++++++++
drivers/net/can/m_can/m_can.c | 2 +-
.../net/can/spi/mcp251xfd/mcp251xfd-core.c | 4 ++--
include/linux/can/rx-offload.h | 1 +
4 files changed, 27 insertions(+), 3 deletions(-)
From: Marc Kleine-Budde <mkl@pengutronix.de> Date: 2021-07-26 14:12:36
Adding a skb to the skb_queue in rx-offload requires to take a lock.
This commit avoids this by adding an unlocked skb queue that is
appended at the end of the ISR. Having one lock at the end of the ISR
should be OK as the HW is empty, not about to overflow.
Link: https://lore.kernel.org/r/20210724204745.736053-2-mkl@pengutronix.de
Tested-by: Oleksij Rempel <o.rempel@pengutronix.de>
Co-developed-by: Kurt Van Dijck <redacted>
Signed-off-by: Kurt Van Dijck <redacted>
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
---
drivers/net/can/dev/rx-offload.c | 67 +++++++++----------
drivers/net/can/flexcan.c | 3 +
drivers/net/can/m_can/m_can.c | 3 +
.../net/can/spi/mcp251xfd/mcp251xfd-core.c | 6 +-
drivers/net/can/ti_hecc.c | 2 +
include/linux/can/rx-offload.h | 2 +
6 files changed, 48 insertions(+), 35 deletions(-)
@@ -2195,8 +2195,10 @@ static irqreturn_t mcp251xfd_irq(int irq, void *dev_id)FIELD_GET(MCP251XFD_REG_INT_IE_MASK,priv->regs_status.intf);-if(!(intf_pending))+if(!(intf_pending)){+can_rx_offload_irq_finish(&priv->offload);returnhandled;+}/* Some interrupts must be ACKed in the*MCP251XFD_REG_INTregister.
From: Marc Kleine-Budde <mkl@pengutronix.de> Date: 2021-07-26 14:12:38
From: Vincent Mailhol <redacted>
can_validate() does a first check:
| if (is_can_fd) {
| if (!data[IFLA_CAN_BITTIMING] || !data[IFLA_CAN_DATA_BITTIMING])
| return -EOPNOTSUPP;
| }
If that first if succeeds, we know that if is_can_fd is true then
data[IFLA_CAN_BITTIMING is set.
However, the next if switch does not leverage on above knowledge and
redoes the check:
| if (data[IFLA_CAN_DATA_BITTIMING]) {
| if (!is_can_fd || !data[IFLA_CAN_BITTIMING])
| ^~~~~~~~~~~~~~~~~~~~~~~~
| return -EOPNOTSUPP;
| }
This patch removes that redundant check.
Link: https://lore.kernel.org/r/20210603151550.140727-2-mailhol.vincent@wanadoo.fr
Signed-off-by: Vincent Mailhol <redacted>
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
---
drivers/net/can/dev/netlink.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
From: Marc Kleine-Budde <mkl@pengutronix.de> Date: 2021-07-26 14:12:45
This patch fixes a typo in the documentation for struct can_tdc::tdcv.
The number "0" refers to automatic mode not the letter "O".
Further two grammar errors in the documentation for struct can_tdc are
fixed.
First grammar error: add a missing third person 's'.
Second grammar error: replace "such as" by "such that". The intent is
to give a condition, not an example.
Fixes: 289ea9e4ae59 ("can: add new CAN FD bittiming parameters: Transmitter Delay Compensation (TDC)")
Link: https://lore.kernel.org/r/20210616095922.2430415-1-mkl@pengutronix.de
Link: https://lore.kernel.org/r/20210616124057.60723-1-mailhol.vincent@wanadoo.fr
Co-developed-by: Vincent Mailhol <redacted>
Signed-off-by: Vincent Mailhol <redacted>
Acked-by: Vincent Mailhol <redacted>
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
---
include/linux/can/bittiming.h | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
From: Marc Kleine-Budde <mkl@pengutronix.de> Date: 2021-07-26 14:12:49
This patch changes the name of the "skcb" variable in
j1939_session_tx_dat() to "se_skcb" as it's the session skb's control
buffer. The same name is used in other functions for the session skb's
control buffer.
Cc: Robin van der Gracht <robin@protonic.nl>
Cc: Oleksij Rempel <o.rempel@pengutronix.de>
Link: https://lore.kernel.org/r/20210616102811.2449426-5-mkl@pengutronix.de
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
---
net/can/j1939/transport.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
From: Marc Kleine-Budde <mkl@pengutronix.de> Date: 2021-07-26 14:12:50
In the j1939_xtp_rx_dat_one() function, there are 2 variables (skb and
se_skb) holding a skb. The control buffer of the skbs is accessed one
after the other, but using the same "skcb" variable.
To avoid confusion introduce a new variable "se_skcb" to access the
se_skb's control buffer as done in the rest of this file, too.
Cc: Robin van der Gracht <robin@protonic.nl>
Cc: Oleksij Rempel <o.rempel@pengutronix.de>
Link: https://lore.kernel.org/r/20210616102811.2449426-6-mkl@pengutronix.de
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
---
net/can/j1939/transport.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
From: Marc Kleine-Budde <mkl@pengutronix.de> Date: 2021-07-26 14:12:53
From: Faiz Abbas <redacted>
Some transceivers need a configuration step (for example, pulling the
standby or enable lines) for them to start sending messages. The
transceiver can be implemented as a phy with the configuration done in
the phy driver. The bit rate limitation can the be obtained by the
driver using the phy node.
Document the above implementation in the bosch mcan bindings.
Link: https://lore.kernel.org/r/20210510052541.14168-2-a-govindraju@ti.com
Signed-off-by: Faiz Abbas <redacted>
Signed-off-by: Aswath Govindraju <redacted>
Acked-by: Rob Herring <robh@kernel.org>
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
---
Documentation/devicetree/bindings/net/can/bosch,m_can.yaml | 3 +++
1 file changed, 3 insertions(+)
@@ -1521,6 +1522,8 @@ static int m_can_close(struct net_device *dev)close_candev(dev);can_led_event(dev,CAN_LED_EVENT_STOP);+phy_power_off(cdev->transceiver);+return0;}
@@ -1706,10 +1709,14 @@ static int m_can_open(struct net_device *dev)structm_can_classdev*cdev=netdev_priv(dev);interr;-err=m_can_clk_start(cdev);+err=phy_power_on(cdev->transceiver);if(err)returnerr;+err=m_can_clk_start(cdev);+if(err)+gotoout_phy_power_off;+/* open the can device */err=open_candev(dev);if(err){
@@ -1766,6 +1773,8 @@ static int m_can_open(struct net_device *dev)close_candev(dev);exit_disable_clks:m_can_clk_stop(cdev);+out_phy_power_off:+phy_power_off(cdev->transceiver);returnerr;}
@@ -67,6 +68,7 @@ static int m_can_plat_probe(struct platform_device *pdev)structresource*res;void__iomem*addr;void__iomem*mram_addr;+structphy*transceiver;intirq,ret=0;mcan_class=m_can_class_allocate_dev(&pdev->dev,
@@ -101,6 +103,16 @@ static int m_can_plat_probe(struct platform_device *pdev)gotoprobe_fail;}+transceiver=devm_phy_optional_get(&pdev->dev,NULL);+if(IS_ERR(transceiver)){+ret=PTR_ERR(transceiver);+dev_err_probe(&pdev->dev,ret,"failed to get phy\n");+gotoprobe_fail;+}++if(transceiver)+mcan_class->can.bitrate_max=transceiver->attrs.max_link_rate;+priv->base=addr;priv->mram_base=mram_addr;
@@ -108,6 +120,7 @@ static int m_can_plat_probe(struct platform_device *pdev)mcan_class->pm_clock_support=1;mcan_class->can.clock.freq=clk_get_rate(mcan_class->cclk);mcan_class->dev=&pdev->dev;+mcan_class->transceiver=transceiver;mcan_class->ops=&m_can_plat_ops;
From: Marc Kleine-Budde <mkl@pengutronix.de> Date: 2021-07-26 14:13:28
From: Zhen Lei <redacted>
Use DEVICE_ATTR_RO() helper macro instead of plain DEVICE_ATTR(), which
makes the code a bit shorter and easier to read.
Link: https://lore.kernel.org/r/20210603110902.11930-1-thunder.leizhen@huawei.com
Signed-off-by: Zhen Lei <redacted>
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
---
drivers/net/can/usb/esd_usb2.c | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
From: Marc Kleine-Budde <mkl@pengutronix.de> Date: 2021-07-26 14:13:31
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 <redacted>
Link: https://lore.kernel.org/r/20210616102811.2449426-7-mkl@pengutronix.de
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
---
drivers/net/can/m_can/m_can.c | 24 ++++++------------------
drivers/net/can/m_can/m_can.h | 3 ---
2 files changed, 6 insertions(+), 21 deletions(-)
@@ -1440,32 +1440,20 @@ static int m_can_dev_setup(struct m_can_classdev *cdev)case30:/* CAN_CTRLMODE_FD_NON_ISO is fixed with M_CAN IP v3.0.x */can_set_static_ctrlmode(dev,CAN_CTRLMODE_FD_NON_ISO);-cdev->can.bittiming_const=cdev->bit_timing?-cdev->bit_timing:&m_can_bittiming_const_30X;--cdev->can.data_bittiming_const=cdev->data_timing?-cdev->data_timing:-&m_can_data_bittiming_const_30X;+cdev->can.bittiming_const=&m_can_bittiming_const_30X;+cdev->can.data_bittiming_const=&m_can_data_bittiming_const_30X;break;case31:/* CAN_CTRLMODE_FD_NON_ISO is fixed with M_CAN IP v3.1.x */can_set_static_ctrlmode(dev,CAN_CTRLMODE_FD_NON_ISO);-cdev->can.bittiming_const=cdev->bit_timing?-cdev->bit_timing:&m_can_bittiming_const_31X;--cdev->can.data_bittiming_const=cdev->data_timing?-cdev->data_timing:-&m_can_data_bittiming_const_31X;+cdev->can.bittiming_const=&m_can_bittiming_const_31X;+cdev->can.data_bittiming_const=&m_can_data_bittiming_const_31X;break;case32:case33:/* Support both MCAN version v3.2.x and v3.3.0 */-cdev->can.bittiming_const=cdev->bit_timing?-cdev->bit_timing:&m_can_bittiming_const_31X;--cdev->can.data_bittiming_const=cdev->data_timing?-cdev->data_timing:-&m_can_data_bittiming_const_31X;+cdev->can.bittiming_const=&m_can_bittiming_const_31X;+cdev->can.data_bittiming_const=&m_can_data_bittiming_const_31X;cdev->can.ctrlmode_supported|=(m_can_niso_supported(cdev)?
From: Marc Kleine-Budde <mkl@pengutronix.de> Date: 2021-07-26 14:13:32
From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
In some configurations, mainly ACPI-based, the clock frequency of the
device is supplied by very well established 'clock-frequency'
property. Hence, try to get it from the property at last if no other
providers are available.
Link: https://lore.kernel.org/r/20210531084444.1785397-1-mkl@pengutronix.de
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
---
drivers/net/can/spi/mcp251xfd/mcp251xfd-core.c | 14 +++++++++++---
1 file changed, 11 insertions(+), 3 deletions(-)
@@ -2860,7 +2860,7 @@ static int mcp251xfd_probe(struct spi_device *spi)structgpio_desc*rx_int;structregulator*reg_vdd,*reg_xceiver;structclk*clk;-u32freq;+u32freq=0;interr;if(!spi->irq)
@@ -2887,11 +2887,19 @@ static int mcp251xfd_probe(struct spi_device *spi)returndev_err_probe(&spi->dev,PTR_ERR(reg_xceiver),"Failed to get Transceiver regulator!\n");-clk=devm_clk_get(&spi->dev,NULL);+clk=devm_clk_get_optional(&spi->dev,NULL);if(IS_ERR(clk))returndev_err_probe(&spi->dev,PTR_ERR(clk),"Failed to get Oscillator (clock)!\n");-freq=clk_get_rate(clk);+if(clk){+freq=clk_get_rate(clk);+}else{+err=device_property_read_u32(&spi->dev,"clock-frequency",+&freq);+if(err)+returndev_err_probe(&spi->dev,err,+"Failed to get clock-frequency!\n");+}/* Sanity check */if(freq<MCP251XFD_SYSCLOCK_HZ_MIN||
From: Marc Kleine-Budde <mkl@pengutronix.de> Date: 2021-07-26 14:13:46
From: Zhen Lei <redacted>
Use DEVICE_ATTR_RW() helper macro instead of plain DEVICE_ATTR(), which
makes the code a bit shorter and easier to read.
Link: https://lore.kernel.org/r/20210603100233.11877-1-thunder.leizhen@huawei.com
Signed-off-by: Zhen Lei <redacted>
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
---
drivers/net/can/at91_can.c | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
From: Marc Kleine-Budde <mkl@pengutronix.de> Date: 2021-07-26 14:13:46
From: Zhen Lei <redacted>
Use DEVICE_ATTR_RO/RW() helper macro instead of plain DEVICE_ATTR(), which
makes the code a bit shorter and easier to read.
Link: https://lore.kernel.org/r/20210603111739.11983-1-thunder.leizhen@huawei.com
Signed-off-by: Zhen Lei <redacted>
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
---
drivers/net/can/janz-ican3.c | 23 +++++++++++------------
1 file changed, 11 insertions(+), 12 deletions(-)
From: Marc Kleine-Budde <mkl@pengutronix.de> Date: 2021-07-26 14:13:46
From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
The driver is neither dependent on OF, nor it requires any OF headers.
Fix header block to clarify independence from OF.
Link: https://lore.kernel.org/r/http://lore.kernel.org/r/20210531084444.1785397-2-mkl@pengutronix.de
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
---
drivers/net/can/spi/mcp251xfd/mcp251xfd-core.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
From: Marc Kleine-Budde <mkl@pengutronix.de> Date: 2021-07-26 14:13:47
From: Peng Li <redacted>
This patch uses the BIT macro for setting individual bits,
to fix the following checkpatch.pl issue:
CHECK: Prefer using the BIT macro.
Link: https://lore.kernel.org/r/1624096589-13452-5-git-send-email-huangguangbin2@huawei.com
Signed-off-by: Peng Li <redacted>
Signed-off-by: Guangbin Huang <redacted>
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
---
drivers/net/can/at91_can.c | 26 +++++++++++++-------------
1 file changed, 13 insertions(+), 13 deletions(-)
From: Marc Kleine-Budde <mkl@pengutronix.de> Date: 2021-07-26 14:13:51
From: Peng Li <redacted>
Braces {} should be used on all arms of this statement.
Link: https://lore.kernel.org/r/1624096589-13452-7-git-send-email-huangguangbin2@huawei.com
Signed-off-by: Peng Li <redacted>
Signed-off-by: Guangbin Huang <redacted>
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
---
drivers/net/can/at91_can.c | 14 +++++++-------
1 file changed, 7 insertions(+), 7 deletions(-)
@@ -1020,15 +1020,15 @@ static void at91_irq_err(struct net_device *dev)reg_sr=at91_read(priv,AT91_SR);/* we need to look at the unmasked reg_sr */-if(unlikely(reg_sr&AT91_IRQ_BOFF))+if(unlikely(reg_sr&AT91_IRQ_BOFF)){new_state=CAN_STATE_BUS_OFF;-elseif(unlikely(reg_sr&AT91_IRQ_ERRP))+}elseif(unlikely(reg_sr&AT91_IRQ_ERRP)){new_state=CAN_STATE_ERROR_PASSIVE;-elseif(unlikely(reg_sr&AT91_IRQ_WARN))+}elseif(unlikely(reg_sr&AT91_IRQ_WARN)){new_state=CAN_STATE_ERROR_WARNING;-elseif(likely(reg_sr&AT91_IRQ_ERRA))+}elseif(likely(reg_sr&AT91_IRQ_ERRA)){new_state=CAN_STATE_ERROR_ACTIVE;-else{+}else{netdev_err(dev,"BUG! hardware in undefined state\n");return;}
@@ -687,7 +688,7 @@ static int at91_poll_rx(struct net_device *dev, int quota)if(priv->rx_next>get_mb_rx_low_last(priv)&®_sr&get_mb_rx_low_mask(priv))netdev_info(dev,-"order of incoming frames cannot be guaranteed\n");+"order of incoming frames cannot be guaranteed\n");again:for(mb=find_next_bit(addr,get_mb_tx_first(priv),priv->rx_next);
@@ -720,7 +721,7 @@ static int at91_poll_rx(struct net_device *dev, int quota)}staticvoidat91_poll_err_frame(structnet_device*dev,-structcan_frame*cf,u32reg_sr)+structcan_frame*cf,u32reg_sr){structat91_priv*priv=netdev_priv(dev);
@@ -935,7 +935,6 @@ static void at91_irq_err_state(struct net_device *dev,break;}-/* process state changes depending on the new state */switch(new_state){caseCAN_STATE_ERROR_ACTIVE:
@@ -1004,7 +1003,6 @@ static int at91_get_state_by_bec(const struct net_device *dev,return0;}-staticvoidat91_irq_err(structnet_device*dev){structat91_priv*priv=netdev_priv(dev);
@@ -242,7 +244,7 @@ static int peak_pciec_write_pca9553(struct peak_pciec_card *card,intret;/* cache led mask */-if((offset==5)&&(data==card->led_cache))+if(offset==5&&data==card->led_cache)return0;ret=i2c_transfer(&card->led_chip,&msg,1);
@@ -424,7 +426,7 @@ static int peak_pciec_probe(struct pci_dev *pdev, struct net_device *dev)/* channel is the first one: do the init part */}else{/* create the bit banging I2C adapter structure */-card=kzalloc(sizeof(structpeak_pciec_card),GFP_KERNEL);+card=kzalloc(sizeof(*card),GFP_KERNEL);if(!card)return-ENOMEM;
@@ -230,9 +226,7 @@ static int pita_getscl(void *data)return(readb(card->cfg_base+PITA_GPIN)&PITA_GPIN_SCL)?1:0;}-/*-*writecommandstotheLEDchipthoughtheI2C-busofthePCAN-PCIeC-*/+/* write commands to the LED chip though the I2C-bus of the PCAN-PCIeC */staticintpeak_pciec_write_pca9553(structpeak_pciec_card*card,u8offset,u8data){
@@ -261,9 +255,7 @@ static int peak_pciec_write_pca9553(struct peak_pciec_card *card,return0;}-/*-*delayedworkcallbackusedtocontroltheLEDs-*/+/* delayed work callback used to control the LEDs */staticvoidpeak_pciec_led_work(structwork_struct*work){structpeak_pciec_card*card=
@@ -309,9 +301,7 @@ static void peak_pciec_led_work(struct work_struct *work)schedule_delayed_work(&card->led_work,HZ);}-/*-*setLEDsblinkingstate-*/+/* set LEDs blinking state */staticvoidpeak_pciec_set_leds(structpeak_pciec_card*card,u8led_mask,u8s){u8new_led=card->led_cache;
@@ -328,25 +318,19 @@ static void peak_pciec_set_leds(struct peak_pciec_card *card, u8 led_mask, u8 s)peak_pciec_write_pca9553(card,5,new_led);}-/*-*startoneseconddelayedworktocontrolLEDs-*/+/* start one second delayed work to control LEDs */staticvoidpeak_pciec_start_led_work(structpeak_pciec_card*card){schedule_delayed_work(&card->led_work,HZ);}-/*-*stopLEDsdelayedwork-*/+/* stop LEDs delayed work */staticvoidpeak_pciec_stop_led_work(structpeak_pciec_card*card){cancel_delayed_work_sync(&card->led_work);}-/*-*initializethePCA95534-bitI2C-busLEDchip-*/+/* initialize the PCA9553 4-bit I2C-bus LED chip */staticintpeak_pciec_init_leds(structpeak_pciec_card*card){interr;
@@ -375,17 +359,14 @@ static int peak_pciec_init_leds(struct peak_pciec_card *card)returnpeak_pciec_write_pca9553(card,5,PCA9553_LS0_INIT);}-/*-*restoreLEDsstatetooffpeak_pciec_leds_exit-*/+/* restore LEDs state to off peak_pciec_leds_exit */staticvoidpeak_pciec_leds_exit(structpeak_pciec_card*card){/* switch LEDs to off */peak_pciec_write_pca9553(card,5,PCA9553_LED_OFF_ALL);}-/*-*normalwritesja1000registermethodoverloadedtocatchwhencontroller+/* normal write sja1000 register method overloaded to catch when controller*isstartedorstopped,tocontrolleds*/staticvoidpeak_pciec_write_reg(conststructsja1000_priv*priv,
@@ -506,9 +487,7 @@ static void peak_pciec_remove(struct peak_pciec_card *card)#else /* CONFIG_CAN_PEAK_PCIEC */-/*-*PlacebofunctionswhenPCAN-ExpressCardsupportisnotselected-*/+/* Placebo functions when PCAN-ExpressCard support is not selected */staticinlineintpeak_pciec_probe(structpci_dev*pdev,structnet_device*dev){return-ENODEV;
@@ -642,8 +621,7 @@ static int peak_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent)chan->prev_dev=pci_get_drvdata(pdev);pci_set_drvdata(pdev,dev);-/*-*PCAN-ExpressCardneedssomeadditionali2cinit.+/* PCAN-ExpressCard needs some additional i2c init.*Thismustbedone*before*register_sja1000dev()but**after*deviceslinkage*/
From: Marc Kleine-Budde <mkl@pengutronix.de> Date: 2021-07-26 14:13:55
From: Peng Li <redacted>
This patch fixes the checkpatch error about missing a blank line
after declarations.
Link: https://lore.kernel.org/r/1624096589-13452-3-git-send-email-huangguangbin2@huawei.com
Signed-off-by: Peng Li <redacted>
Signed-off-by: Guangbin Huang <redacted>
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
---
drivers/net/can/at91_can.c | 3 +++
1 file changed, 3 insertions(+)
@@ -807,6 +809,7 @@ static int at91_poll(struct napi_struct *napi, int quota)if(work_done<quota){/* enable IRQs for frame errors and all mailboxes >= rx_next */u32reg_ier=AT91_IRQ_ERR_FRAME;+reg_ier|=get_irq_mb_rx(priv)&~AT91_MB_MASK(priv->rx_next);napi_complete_done(napi,work_done);
From: Marc Kleine-Budde <mkl@pengutronix.de> Date: 2021-07-26 14:13:56
From: Peng Li <redacted>
According to the chackpatch.pl, no space before tabs.
Link: https://lore.kernel.org/r/1624096589-13452-8-git-send-email-huangguangbin2@huawei.com
Signed-off-by: Peng Li <redacted>
Signed-off-by: Guangbin Huang <redacted>
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
---
drivers/net/can/at91_can.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
From: Marc Kleine-Budde <mkl@pengutronix.de> Date: 2021-07-26 14:14:06
From: Vincent Mailhol <redacted>
Make es58x_init_es58x_dev return a pointer to the allocated structure
instead of returning an integer. Errors are handled through the helper
function ERR_PTR and IS_ERR.
This slightly simplifies the code.
Link: https://lore.kernel.org/r/20210628155420.1176217-3-mailhol.vincent@wanadoo.fr
Signed-off-by: Vincent Mailhol <redacted>
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
---
drivers/net/can/usb/etas_es58x/es58x_core.c | 23 +++++++++------------
1 file changed, 10 insertions(+), 13 deletions(-)
From: Marc Kleine-Budde <mkl@pengutronix.de> Date: 2021-07-26 14:14:07
From: Stephane Grosjean <redacted>
This patch adds name and (possibly) firmware version information to
the kernel about the detected PEAK-System CAN - PCI/PCIe interface
card.
Link: https://lore.kernel.org/r/20210607151720.13571-1-s.grosjean@peak-system.com
Signed-off-by: Stephane Grosjean <redacted>
[mkl: reformated struct pci_device_id peak_pci_tbl]
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
---
drivers/net/can/sja1000/peak_pci.c | 64 +++++++++++++++++++++++++-----
1 file changed, 53 insertions(+), 11 deletions(-)
@@ -583,6 +610,21 @@ static int peak_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent)/* Leave parport mux mode */writeb(0x04,cfg_base+PITA_MISC+3);+/* FPGA equipped card if not 0 */+if(readl(cfg_base+PEAK_VER_REG1)){+/* FPGA card: display version of the running firmware */+u32fw_ver=readl(cfg_base+PEAK_VER_REG2);++snprintf(fw_str,sizeof(fw_str)," FW v%u.%u.%u",+(fw_ver>>12)&0xf,+(fw_ver>>8)&0xf,+(fw_ver>>4)&0xf);+}++/* Display commercial name (and, eventually, FW version) of the card */+dev_info(&pdev->dev,"%ux CAN %s%s\n",+channels,(constchar*)ent->driver_data,fw_str);+icr=readw(cfg_base+PITA_ICR+2);for(i=0;i<channels;i++){
From: Marc Kleine-Budde <mkl@pengutronix.de> Date: 2021-07-26 14:14:09
From: Stephane Grosjean <redacted>
The CAN - USB PCAN-USB interface is able to generate one-shot frames
as well as loopback frames that it transmits starting from version 4.1
of its firmware.
This patch adds support for the one-shot and loopback functionality to
the driver, that can be activated if the embedded firmware allows it.
If the driver detects that the PCAN-USB device runs an old firmware
(< 4.1) it prints a message suggesting to contact
[off-list ref] for a possible firmware update.
Link: https://lore.kernel.org/r/20210625130931.27438-3-s.grosjean@peak-system.com
Signed-off-by: Stephane Grosjean <redacted>
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
---
drivers/net/can/usb/peak_usb/pcan_usb.c | 53 +++++++++++++++++++++++--
1 file changed, 49 insertions(+), 4 deletions(-)
@@ -743,6 +750,10 @@ static int pcan_usb_decode_data(struct pcan_usb_msg_context *mc, u8 status_len)memcpy(cf->data,mc->ptr,cf->len);mc->ptr+=rec_len;++/* Ignore next byte (client private id) if SRR bit is set */+if(can_id_flags&PCAN_USB_TX_SRR)+mc->ptr++;}/* convert timestamp into kernel time */
@@ -853,6 +881,10 @@ static int pcan_usb_encode_msg(struct peak_usb_device *dev, struct sk_buff *skb,pc+=cf->len;}+/* SRR bit needs a writer id (useless here) */+if(can_id_flags&PCAN_USB_TX_SRR)+*pc++=0x80;+obuf[(*size)-1]=(u8)(stats->tx_packets&0xff);return0;
@@ -927,6 +959,19 @@ static int pcan_usb_init(struct peak_usb_device *dev)returnerr;}+/* Since rev 4.1, PCAN-USB is able to make single-shot as well as+*loopedbackframes.+*/+if(dev->device_rev>=41){+structcan_priv*priv=netdev_priv(dev->netdev);++priv->ctrlmode_supported|=CAN_CTRLMODE_ONE_SHOT|+CAN_CTRLMODE_LOOPBACK;+}else{+dev_info(dev->netdev->dev.parent,+"Firmware update available. Please contact support@peak-system.com\n");+}+dev_info(dev->netdev->dev.parent,"PEAK-System %s adapter hwrev %u serial %08X (%u channel)\n",pcan_usb.name,dev->device_rev,serial_number,
From: Marc Kleine-Budde <mkl@pengutronix.de> Date: 2021-07-26 14:14:17
From: Vincent Mailhol <redacted>
Replace kzalloc() with devm_kzalloc(). By doing this, we do not need
to care anymore about having to call kfree(). This result in a
simpler and more easy to read code.
Link: https://lore.kernel.org/r/20210628155420.1176217-4-mailhol.vincent@wanadoo.fr
Signed-off-by: Vincent Mailhol <redacted>
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
---
drivers/net/can/usb/etas_es58x/es58x_core.c | 9 +++------
1 file changed, 3 insertions(+), 6 deletions(-)
From: Marc Kleine-Budde <mkl@pengutronix.de> Date: 2021-07-26 14:14:26
From: Vincent Mailhol <redacted>
Replace two constant values by a call to sizeof{,_field} on the
relevant field to make the logic easier to understand.
Link: https://lore.kernel.org/r/20210628155420.1176217-6-mailhol.vincent@wanadoo.fr
Signed-off-by: Vincent Mailhol <redacted>
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
---
drivers/net/can/usb/etas_es58x/es581_4.c | 2 +-
drivers/net/can/usb/etas_es58x/es58x_core.c | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
From: Marc Kleine-Budde <mkl@pengutronix.de> Date: 2021-07-26 14:14:29
From: Vincent Mailhol <redacted>
Change the author name from "lastname firstname" to "firstname
lastname".
Fix a typo in a variable name in the documentation of struct
es58x_parameters::fifo_mask.
Fix a typo in the title of the datasheet (E701 -> E70) and re-indent
the comments.
Link: https://lore.kernel.org/r/20210628155420.1176217-2-mailhol.vincent@wanadoo.fr
Signed-off-by: Vincent Mailhol <redacted>
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
---
drivers/net/can/usb/etas_es58x/es58x_core.c | 2 +-
drivers/net/can/usb/etas_es58x/es58x_core.h | 2 +-
drivers/net/can/usb/etas_es58x/es58x_fd.c | 16 ++++++++--------
3 files changed, 10 insertions(+), 10 deletions(-)
@@ -19,7 +19,7 @@#include"es58x_core.h"#define DRV_VERSION "1.00"-MODULE_AUTHOR("Mailhol Vincent <mailhol.vincent@wanadoo.fr>");+MODULE_AUTHOR("Vincent Mailhol <mailhol.vincent@wanadoo.fr>");MODULE_AUTHOR("Arunachalam Santhanam <arunachalam.santhanam@in.bosch.com>");MODULE_DESCRIPTION("Socket CAN driver for ETAS ES58X USB adapters");MODULE_VERSION(DRV_VERSION);
@@ -463,9 +463,9 @@ static int es58x_fd_get_timestamp(struct es58x_device *es58x_dev)}/* Nominal bittiming constants for ES582.1 and ES584.1 as specified in-*themicrocontrollerdatasheet:"SAM E701/S70/V70/V71 Family"-*section49.6.8"MCAN Nominal Bit Timing and Prescaler Register"-*fromMicrochip.+*themicrocontrollerdatasheet:"SAM E70/S70/V70/V71 Family"section+*49.6.8"MCAN Nominal Bit Timing and Prescaler Register"from+*Microchip.**Thevaluesfromthespecificationarethehardwareregister*values.Toconvertthemtothefunctionalvalues,allrangeswere
@@ -484,8 +484,8 @@ static const struct can_bittiming_const es58x_fd_nom_bittiming_const = {};/* Data bittiming constants for ES582.1 and ES584.1 as specified in-*themicrocontrollerdatasheet:"SAM E701/S70/V70/V71 Family"-*section49.6.4"MCAN Data Bit Timing and Prescaler Register"from+*themicrocontrollerdatasheet:"SAM E70/S70/V70/V71 Family"section+*49.6.4"MCAN Data Bit Timing and Prescaler Register"from*Microchip.*/staticconststructcan_bittiming_constes58x_fd_data_bittiming_const={
@@ -501,9 +501,9 @@ static const struct can_bittiming_const es58x_fd_data_bittiming_const = {};/* Transmission Delay Compensation constants for ES582.1 and ES584.1-*asspecifiedinthemicrocontrollerdatasheet:"SAM-*E701/S70/V70/V71Family" section 49.6.15 "MCANTransmitterDelay-*CompensationRegister" from Microchip.+*asspecifiedinthemicrocontrollerdatasheet:"SAM E70/S70/V70/V71+*Family" section 49.6.15 "MCANTransmitterDelayCompensation+*Register" from Microchip.*/staticconststructcan_tdc_constes58x_tdc_const={.tdcv_max=0,/* Manual mode not supported. */
From: Marc Kleine-Budde <mkl@pengutronix.de> Date: 2021-07-26 14:14:30
From: Vincent Mailhol <redacted>
The es581_tx_can_msg() does below cast:
| tx_can_msg = (struct es581_4_tx_can_msg *)
| &es581_4_urb_cmd->bulk_tx_can_msg.tx_can_msg_buf[msg_len - 1];
The -1 offset is to skip the first member of struct
es581_4_tx_can_msg. However, es581_4_urb_cmd already has a raw_msg
field which can be used instead without the use of an offset
calculation.
The function es58x_fd_tx_can_msg() is also modified to mirror
es581_tx_can_msg().
Link: https://lore.kernel.org/r/20210628155420.1176217-7-mailhol.vincent@wanadoo.fr
Signed-off-by: Vincent Mailhol <redacted>
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
---
drivers/net/can/usb/etas_es58x/es581_4.c | 3 +--
drivers/net/can/usb/etas_es58x/es58x_fd.c | 3 +--
2 files changed, 2 insertions(+), 4 deletions(-)
From: Marc Kleine-Budde <mkl@pengutronix.de> Date: 2021-07-26 14:14:30
From: Vincent Mailhol <redacted>
Both es58x_probe() and es58x_disconnect() use a similar code snippet
to release the netdev resources. Factorize it in an helper function
named es58x_free_netdevs().
Link: https://lore.kernel.org/r/20210628155420.1176217-5-mailhol.vincent@wanadoo.fr
Signed-off-by: Vincent Mailhol <redacted>
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
---
drivers/net/can/usb/etas_es58x/es58x_core.c | 46 +++++++++++----------
1 file changed, 24 insertions(+), 22 deletions(-)
From: Marc Kleine-Budde <mkl@pengutronix.de> Date: 2021-07-26 14:14:31
From: Stephane Grosjean <redacted>
This patch adds information by replacing a hard-coded values with its
symbol and a adding comment.
Link: https://lore.kernel.org/r/20210625130931.27438-5-s.grosjean@peak-system.com
Signed-off-by: Stephane Grosjean <redacted>
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
---
drivers/net/can/usb/peak_usb/pcan_usb.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
@@ -63,6 +63,8 @@#define PCAN_USB_MSG_HEADER_LEN 2+#define PCAN_USB_MSG_TX_CAN 2 /* Tx msg is a CAN frame */+/* PCAN-USB adapter internal clock (MHz) */#define PCAN_USB_CRYSTAL_HZ 16000000
@@ -834,8 +836,8 @@ static int pcan_usb_encode_msg(struct peak_usb_device *dev, struct sk_buff *skb,u32can_id_flags=cf->can_id&CAN_ERR_MASK;u8*pc;-obuf[0]=2;-obuf[1]=1;+obuf[0]=PCAN_USB_MSG_TX_CAN;+obuf[1]=1;/* only one CAN frame is stored in the packet */pc=obuf+PCAN_USB_MSG_HEADER_LEN;
From: Marc Kleine-Budde <mkl@pengutronix.de> Date: 2021-07-26 14:14:51
From: Stephane Grosjean <redacted>
This patch updates old code by using the can_change_state() function
published since by the socket-can module.
In particular, this new code better manages the change of bus state by
also using the value of the error counters that the driver now
systematically asks for when initializing the channel.
Link: https://lore.kernel.org/r/20210715142842.35793-1-s.grosjean@peak-system.com
Signed-off-by: Stephane Grosjean <redacted>
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
---
drivers/net/can/usb/peak_usb/pcan_usb.c | 166 ++++++------------------
1 file changed, 43 insertions(+), 123 deletions(-)
@@ -452,145 +452,65 @@ static int pcan_usb_decode_error(struct pcan_usb_msg_context *mc, u8 n,{structsk_buff*skb;structcan_frame*cf;-enumcan_statenew_state;+enumcan_statenew_state=CAN_STATE_ERROR_ACTIVE;/* ignore this error until 1st ts received */if(n==PCAN_USB_ERROR_QOVR)if(!mc->pdev->time_ref.tick_count)return0;-new_state=mc->pdev->dev.can.state;--switch(mc->pdev->dev.can.state){-caseCAN_STATE_ERROR_ACTIVE:-if(n&PCAN_USB_ERROR_BUS_LIGHT){-new_state=CAN_STATE_ERROR_WARNING;-break;-}-fallthrough;--caseCAN_STATE_ERROR_WARNING:-if(n&PCAN_USB_ERROR_BUS_HEAVY){-new_state=CAN_STATE_ERROR_PASSIVE;-break;-}-if(n&PCAN_USB_ERROR_BUS_OFF){-new_state=CAN_STATE_BUS_OFF;-break;-}-if(n&~PCAN_USB_ERROR_BUS){-/*-*tricktobypassnextcomparisonandprocessother-*errors-*/-new_state=CAN_STATE_MAX;-break;-}-if((n&PCAN_USB_ERROR_BUS_LIGHT)==0){-/* no error (back to active state) */-new_state=CAN_STATE_ERROR_ACTIVE;-break;-}-break;--caseCAN_STATE_ERROR_PASSIVE:-if(n&PCAN_USB_ERROR_BUS_OFF){-new_state=CAN_STATE_BUS_OFF;-break;-}-if(n&PCAN_USB_ERROR_BUS_LIGHT){-new_state=CAN_STATE_ERROR_WARNING;-break;-}-if(n&~PCAN_USB_ERROR_BUS){-/*-*tricktobypassnextcomparisonandprocessother-*errors-*/-new_state=CAN_STATE_MAX;-break;-}--if((n&PCAN_USB_ERROR_BUS_HEAVY)==0){-/* no error (back to warning state) */-new_state=CAN_STATE_ERROR_WARNING;-break;-}-break;--default:-/* do nothing waiting for restart */-return0;-}--/* donot post any error if current state didn't change */-if(mc->pdev->dev.can.state==new_state)-return0;-/* allocate an skb to store the error frame */skb=alloc_can_err_skb(mc->netdev,&cf);-if(!skb)-return-ENOMEM;--switch(new_state){-caseCAN_STATE_BUS_OFF:-cf->can_id|=CAN_ERR_BUSOFF;-mc->pdev->dev.can.can_stats.bus_off++;-can_bus_off(mc->netdev);-break;--caseCAN_STATE_ERROR_PASSIVE:-cf->can_id|=CAN_ERR_CRTL;-cf->data[1]=(mc->pdev->bec.txerr>mc->pdev->bec.rxerr)?-CAN_ERR_CRTL_TX_PASSIVE:-CAN_ERR_CRTL_RX_PASSIVE;-cf->data[6]=mc->pdev->bec.txerr;-cf->data[7]=mc->pdev->bec.rxerr;--mc->pdev->dev.can.can_stats.error_passive++;-break;--caseCAN_STATE_ERROR_WARNING:-cf->can_id|=CAN_ERR_CRTL;-cf->data[1]=(mc->pdev->bec.txerr>mc->pdev->bec.rxerr)?-CAN_ERR_CRTL_TX_WARNING:-CAN_ERR_CRTL_RX_WARNING;-cf->data[6]=mc->pdev->bec.txerr;-cf->data[7]=mc->pdev->bec.rxerr;--mc->pdev->dev.can.can_stats.error_warning++;-break;-caseCAN_STATE_ERROR_ACTIVE:-cf->can_id|=CAN_ERR_CRTL;-cf->data[1]=CAN_ERR_CRTL_ACTIVE;--/* sync local copies of rxerr/txerr counters */-mc->pdev->bec.txerr=0;-mc->pdev->bec.rxerr=0;-break;--default:-/* CAN_STATE_MAX (trick to handle other errors) */-if(n&PCAN_USB_ERROR_TXQFULL)-netdev_dbg(mc->netdev,"device Tx queue full)\n");--if(n&PCAN_USB_ERROR_RXQOVR){-netdev_dbg(mc->netdev,"data overrun interrupt\n");+if(n&PCAN_USB_ERROR_RXQOVR){+/* data overrun interrupt */+netdev_dbg(mc->netdev,"data overrun interrupt\n");+mc->netdev->stats.rx_over_errors++;+mc->netdev->stats.rx_errors++;+if(cf){cf->can_id|=CAN_ERR_CRTL;cf->data[1]|=CAN_ERR_CRTL_RX_OVERFLOW;-mc->netdev->stats.rx_over_errors++;-mc->netdev->stats.rx_errors++;}+}-cf->data[6]=mc->pdev->bec.txerr;-cf->data[7]=mc->pdev->bec.rxerr;+if(n&PCAN_USB_ERROR_TXQFULL)+netdev_dbg(mc->netdev,"device Tx queue full)\n");-new_state=mc->pdev->dev.can.state;-break;+if(n&PCAN_USB_ERROR_BUS_OFF){+new_state=CAN_STATE_BUS_OFF;+}elseif(n&PCAN_USB_ERROR_BUS_HEAVY){+new_state=((mc->pdev->bec.txerr>=128)||+(mc->pdev->bec.rxerr>=128))?+CAN_STATE_ERROR_PASSIVE:+CAN_STATE_ERROR_WARNING;+}else{+new_state=CAN_STATE_ERROR_ACTIVE;}-mc->pdev->dev.can.state=new_state;+/* handle change of state */+if(new_state!=mc->pdev->dev.can.state){+enumcan_statetx_state=+(mc->pdev->bec.txerr>=mc->pdev->bec.rxerr)?+new_state:0;+enumcan_staterx_state=+(mc->pdev->bec.txerr<=mc->pdev->bec.rxerr)?+new_state:0;++can_change_state(mc->netdev,cf,tx_state,rx_state);++if(new_state==CAN_STATE_BUS_OFF){+can_bus_off(mc->netdev);+}elseif(cf&&(cf->can_id&CAN_ERR_CRTL)){+/* Supply TX/RX error counters in case of+*controllererror.+*/+cf->data[6]=mc->pdev->bec.txerr;+cf->data[7]=mc->pdev->bec.rxerr;+}+}++if(!skb)+return-ENOMEM;if(status_len&PCAN_USB_STATUSLEN_TIMESTAMP){structskb_shared_hwtstamps*hwts=skb_hwtstamps(skb);
From: Marc Kleine-Budde <mkl@pengutronix.de> Date: 2021-07-26 14:14:52
From: Angelo Dureghello <redacted>
Add flexcan support for NXP ColdFire mcf5441x family.
This flexcan module is quite similar to imx6 flexcan module, but
with some exceptions:
- 3 separate interrupt sources, MB, BOFF and ERR,
- implements 16 mb only,
- m68k architecture is not supporting devicetrees, so a
platform data check/case has been added,
- ColdFire is m68k, so big-endian cpu, with a little-endian flexcan
module.
Link: https://lore.kernel.org/r/20210702094841.327679-5-angelo@kernel-space.org
Signed-off-by: Angelo Dureghello <redacted>
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
---
drivers/net/can/flexcan.c | 124 ++++++++++++++++++++++++++++++++------
1 file changed, 104 insertions(+), 20 deletions(-)
From: Marc Kleine-Budde <mkl@pengutronix.de> Date: 2021-07-26 14:14:56
From: Peng Li <redacted>
Networking block comments don't use an empty /* line,
use /* Comment...
Block comments use * on subsequent lines.
Block comments use a trailing */ on a separate line.
This patch fixes the comments style issues.
Link: https://lore.kernel.org/r/1624096589-13452-9-git-send-email-huangguangbin2@huawei.com
Signed-off-by: Peng Li <redacted>
Signed-off-by: Guangbin Huang <redacted>
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
---
drivers/net/can/at91_can.c | 42 +++++++++++++-------------------------
1 file changed, 14 insertions(+), 28 deletions(-)
@@ -317,8 +317,7 @@ static void at91_setup_mailboxes(struct net_device *dev)unsignedinti;u32reg_mid;-/*-*Duetoachipbug(errata50.2.6.3&50.3.5.3)thefirst+/* Due to a chip bug (errata 50.2.6.3 & 50.3.5.3) the first*mailboxisdisabled.Thenext11mailboxesareusedasa*receptionFIFO.Thelastmailboxisconfiguredwith*overwriteoption.TheoverwriteflagindicatesaFIFO
@@ -424,8 +423,7 @@ static void at91_chip_stop(struct net_device *dev, enum can_state state)priv->can.state=state;}-/*-*theoryofoperation:+/* theory of operation:**Accordingtothedatasheetpriority0isthehighestpriority,15*isthelowest.Iftwomailboxeshavethesameprioritylevelthe
@@ -487,8 +485,7 @@ static netdev_tx_t at91_start_xmit(struct sk_buff *skb, struct net_device *dev)/* _NOTE_: subtract AT91_MB_TX_FIRST offset from mb! */can_put_echo_skb(skb,dev,mb-get_mb_tx_first(priv),0);-/*-*wehavetostopthequeueanddeliverallmessagesincase+/* we have to stop the queue and deliver all messages in case*ofaprio+mbcounterwraparound.Thisisthecaseif*tx_nextbufferprioandmailboxequals0.*
@@ -799,8 +796,7 @@ static int at91_poll(struct napi_struct *napi, int quota)if(reg_sr&get_irq_mb_rx(priv))work_done+=at91_poll_rx(dev,quota-work_done);-/*-*Theerrorbitsareclearonread,+/* The error bits are clear on read,*sousesavedvaluefromirqhandler.*/reg_sr|=priv->reg_sr;
@@ -820,8 +816,7 @@ static int at91_poll(struct napi_struct *napi, int quota)returnwork_done;}-/*-*theoryofoperation:+/* theory of operation:**priv->tx_echoholdsthenumberoftheoldestcan_frameputfor*transmissionintothehardware,butnotyetACKedbytheCANtx
@@ -850,8 +845,7 @@ static void at91_irq_tx(struct net_device *dev, u32 reg_sr)/* Disable irq for this TX mailbox */at91_write(priv,AT91_IDR,1<<mb);-/*-*onlyechoifmailboxsignalsusatransfer+/* only echo if mailbox signals us a transfer*complete(MSR_MRDY).Otherwiseit'satansfer*abort."can_bus_off()"takescareabouttheskbs*parkedintheechoqueue.
@@ -866,8 +860,7 @@ static void at91_irq_tx(struct net_device *dev, u32 reg_sr)}}-/*-*restartqueueifwedon'thaveawraparoundbutrestartif+/* restart queue if we don't have a wrap around but restart if*wegetaTXintforthelastcanframedirectlybeforea*wraparound.*/
@@ -942,8 +932,7 @@ static void at91_irq_err_state(struct net_device *dev,/* process state changes depending on the new state */switch(new_state){caseCAN_STATE_ERROR_ACTIVE:-/*-*actuallywewanttoenableAT91_IRQ_WARNhere,but+/* actually we want to enable AT91_IRQ_WARN here, but*itscrewsupthesystemundercertain*circumstances.sojustenableAT91_IRQ_ERRP,thus*the"fallthrough"
@@ -1077,8 +1065,7 @@ static irqreturn_t at91_irq(int irq, void *dev_id)/* Receive or error interrupt? -> napi */if(reg_sr&(get_irq_mb_rx(priv)|AT91_IRQ_ERR_FRAME)){-/*-*Theerrorbitsareclearonread,+/* The error bits are clear on read,*saveforlateruse.*/priv->reg_sr=reg_sr;
@@ -1135,8 +1122,7 @@ static int at91_open(struct net_device *dev)returnerr;}-/*-*stopCANbusactivity+/* stop CAN bus activity*/staticintat91_close(structnet_device*dev){
From: Marc Kleine-Budde <mkl@pengutronix.de> Date: 2021-07-26 14:14:56
From: Angelo Dureghello <redacted>
Update flexcan to support coldfire architecture.
Any new platform should use OF, but coldfire architecture is
actually not supporting devicetrees.
Link: https://lore.kernel.org/r/20210702094841.327679-4-angelo@kernel-space.org
Signed-off-by: Angelo Dureghello <redacted>
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
---
drivers/net/can/Kconfig | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
Hello:
This pull request was applied to netdev/net-next.git (refs/heads/master):
On Mon, 26 Jul 2021 16:10:58 +0200 you wrote:
Hello Jakub, hello David,
this is a pull request of 46 patches for net-next/master.
The first 6 patches target the CAN J1939 protocol. One is from
gushengxian, fixing a grammatical error, 5 are by me fixing a checkpatch
warning, make use of the fallthrough pseudo-keyword, and use
consistent variable naming.
[...]