Skip to content

Commit

Permalink
Merge tag 'linux-can-next-for-6.6-20230728' of git://git.kernel.org/p…
Browse files Browse the repository at this point in the history
…ub/scm/linux/kernel/git/mkl/linux-can-next

linux-can-next-for-6.6-20230728

Marc Kleine-Budde says:

====================
Hello netdev-team,

this is a pull request of 21 patches for net-next/master.

The 1st patch is by Gerhard Uttenthaler, which adds Gerhard as the
maintainer ems_pci driver.

Peter Seiderer's patch removes a unused function from the peak_usb
driver.

The next 4 patches are by John Watts and add support for the sun4i_can
driver on the Allwinner D1.

Rob Herring's patch corrects the DT includes in various CAN drivers.

Followed by 14 patches from me concerning the gs_usb driver. The first
11 are various cleanups consisting of coding style improvements, error
path printout cleanups, and removal of unneeded
usb_kill_anchored_urbs(). The last 3 convert the driver to use NAPI to
avoid out-of-order reception of CAN frames.
====================

Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
David S. Miller committed Jul 28, 2023
2 parents 91fcb99 + 52be626 commit 8ad228b
Show file tree
Hide file tree
Showing 20 changed files with 225 additions and 124 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ properties:
- const: allwinner,sun4i-a10-can
- const: allwinner,sun4i-a10-can
- const: allwinner,sun8i-r40-can
- const: allwinner,sun20i-d1-can

reg:
maxItems: 1
Expand All @@ -37,8 +38,9 @@ properties:
if:
properties:
compatible:
contains:
const: allwinner,sun8i-r40-can
enum:
- allwinner,sun8i-r40-can
- allwinner,sun20i-d1-can

then:
required:
Expand Down
7 changes: 7 additions & 0 deletions MAINTAINERS
Original file line number Diff line number Diff line change
Expand Up @@ -7606,6 +7606,13 @@ L: linux-mmc@vger.kernel.org
S: Supported
F: drivers/mmc/host/cqhci*

EMS CPC-PCI CAN DRIVER
M: Gerhard Uttenthaler <uttenthaler@ems-wuensche.com>
M: support@ems-wuensche.com
L: linux-can@vger.kernel.org
S: Maintained
F: drivers/net/can/sja1000/ems_pci.c

EMULEX 10Gbps iSCSI - OneConnect DRIVER
M: Ketan Mukadam <ketan.mukadam@broadcom.com>
L: linux-scsi@vger.kernel.org
Expand Down
30 changes: 30 additions & 0 deletions arch/riscv/boot/dts/allwinner/sunxi-d1s-t113.dtsi
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,18 @@
pins = "PB6", "PB7";
function = "uart3";
};

/omit-if-no-ref/
can0_pins: can0-pins {
pins = "PB2", "PB3";
function = "can0";
};

/omit-if-no-ref/
can1_pins: can1-pins {
pins = "PB4", "PB5";
function = "can1";
};
};

ccu: clock-controller@2001000 {
Expand Down Expand Up @@ -879,5 +891,23 @@
clock-names = "bus", "hosc", "ahb";
#clock-cells = <1>;
};

can0: can@2504000 {
compatible = "allwinner,sun20i-d1-can";
reg = <0x02504000 0x400>;
interrupts = <SOC_PERIPHERAL_IRQ(21) IRQ_TYPE_LEVEL_HIGH>;
clocks = <&ccu CLK_BUS_CAN0>;
resets = <&ccu RST_BUS_CAN0>;
status = "disabled";
};

can1: can@2504400 {
compatible = "allwinner,sun20i-d1-can";
reg = <0x02504400 0x400>;
interrupts = <SOC_PERIPHERAL_IRQ(22) IRQ_TYPE_LEVEL_HIGH>;
clocks = <&ccu CLK_BUS_CAN1>;
resets = <&ccu RST_BUS_CAN1>;
status = "disabled";
};
};
};
4 changes: 2 additions & 2 deletions drivers/net/can/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -190,10 +190,10 @@ config CAN_SLCAN

config CAN_SUN4I
tristate "Allwinner A10 CAN controller"
depends on MACH_SUN4I || MACH_SUN7I || COMPILE_TEST
depends on MACH_SUN4I || MACH_SUN7I || RISCV || COMPILE_TEST
help
Say Y here if you want to use CAN controller found on Allwinner
A10/A20 SoCs.
A10/A20/D1 SoCs.

To compile this driver as a module, choose M here: the module will
be called sun4i_can.
Expand Down
1 change: 0 additions & 1 deletion drivers/net/can/bxcan.c
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
#include <linux/mfd/syscon.h>
#include <linux/module.h>
#include <linux/of.h>
#include <linux/of_device.h>
#include <linux/platform_device.h>
#include <linux/regmap.h>

Expand Down
36 changes: 31 additions & 5 deletions drivers/net/can/dev/rx-offload.c
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// SPDX-License-Identifier: GPL-2.0-only
/* Copyright (c) 2014 Protonic Holland,
* David Jander
* Copyright (C) 2014-2021 Pengutronix,
* Copyright (C) 2014-2021, 2023 Pengutronix,
* Marc Kleine-Budde <kernel@pengutronix.de>
*/

Expand Down Expand Up @@ -240,9 +240,10 @@ int can_rx_offload_queue_timestamp(struct can_rx_offload *offload,
}
EXPORT_SYMBOL_GPL(can_rx_offload_queue_timestamp);

unsigned int can_rx_offload_get_echo_skb(struct can_rx_offload *offload,
unsigned int idx, u32 timestamp,
unsigned int *frame_len_ptr)
unsigned int
can_rx_offload_get_echo_skb_queue_timestamp(struct can_rx_offload *offload,
unsigned int idx, u32 timestamp,
unsigned int *frame_len_ptr)
{
struct net_device *dev = offload->dev;
struct net_device_stats *stats = &dev->stats;
Expand All @@ -262,7 +263,7 @@ unsigned int can_rx_offload_get_echo_skb(struct can_rx_offload *offload,

return len;
}
EXPORT_SYMBOL_GPL(can_rx_offload_get_echo_skb);
EXPORT_SYMBOL_GPL(can_rx_offload_get_echo_skb_queue_timestamp);

int can_rx_offload_queue_tail(struct can_rx_offload *offload,
struct sk_buff *skb)
Expand All @@ -279,6 +280,31 @@ int can_rx_offload_queue_tail(struct can_rx_offload *offload,
}
EXPORT_SYMBOL_GPL(can_rx_offload_queue_tail);

unsigned int
can_rx_offload_get_echo_skb_queue_tail(struct can_rx_offload *offload,
unsigned int idx,
unsigned int *frame_len_ptr)
{
struct net_device *dev = offload->dev;
struct net_device_stats *stats = &dev->stats;
struct sk_buff *skb;
unsigned int len;
int err;

skb = __can_get_echo_skb(dev, idx, &len, frame_len_ptr);
if (!skb)
return 0;

err = can_rx_offload_queue_tail(offload, skb);
if (err) {
stats->rx_errors++;
stats->tx_fifo_errors++;
}

return len;
}
EXPORT_SYMBOL_GPL(can_rx_offload_get_echo_skb_queue_tail);

void can_rx_offload_irq_finish(struct can_rx_offload *offload)
{
unsigned long flags;
Expand Down
4 changes: 2 additions & 2 deletions drivers/net/can/flexcan/flexcan-core.c
Original file line number Diff line number Diff line change
Expand Up @@ -1097,8 +1097,8 @@ static irqreturn_t flexcan_irq(int irq, void *dev_id)

handled = IRQ_HANDLED;
stats->tx_bytes +=
can_rx_offload_get_echo_skb(&priv->offload, 0,
reg_ctrl << 16, NULL);
can_rx_offload_get_echo_skb_queue_timestamp(&priv->offload, 0,
reg_ctrl << 16, NULL);
stats->tx_packets++;

/* after sending a RTR frame MB is in RX mode */
Expand Down
1 change: 0 additions & 1 deletion drivers/net/can/ifi_canfd/ifi_canfd.c
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
#include <linux/module.h>
#include <linux/netdevice.h>
#include <linux/of.h>
#include <linux/of_device.h>
#include <linux/platform_device.h>

#include <linux/can/dev.h>
Expand Down
9 changes: 4 additions & 5 deletions drivers/net/can/m_can/m_can.c
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
#include <linux/module.h>
#include <linux/netdevice.h>
#include <linux/of.h>
#include <linux/of_device.h>
#include <linux/phy/phy.h>
#include <linux/pinctrl/consumer.h>
#include <linux/platform_device.h>
Expand Down Expand Up @@ -1017,10 +1016,10 @@ static void m_can_tx_update_stats(struct m_can_classdev *cdev,

if (cdev->is_peripheral)
stats->tx_bytes +=
can_rx_offload_get_echo_skb(&cdev->offload,
msg_mark,
timestamp,
NULL);
can_rx_offload_get_echo_skb_queue_timestamp(&cdev->offload,
msg_mark,
timestamp,
NULL);
else
stats->tx_bytes += can_get_echo_skb(dev, msg_mark, NULL);

Expand Down
1 change: 0 additions & 1 deletion drivers/net/can/m_can/m_can.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
#include <linux/module.h>
#include <linux/netdevice.h>
#include <linux/of.h>
#include <linux/of_device.h>
#include <linux/phy/phy.h>
#include <linux/pinctrl/consumer.h>
#include <linux/pm_runtime.h>
Expand Down
1 change: 0 additions & 1 deletion drivers/net/can/rcar/rcar_canfd.c
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@
#include <linux/moduleparam.h>
#include <linux/netdevice.h>
#include <linux/of.h>
#include <linux/of_device.h>
#include <linux/phy/phy.h>
#include <linux/platform_device.h>
#include <linux/reset.h>
Expand Down
1 change: 0 additions & 1 deletion drivers/net/can/sja1000/sja1000_platform.c
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
#include <linux/clk.h>
#include <linux/io.h>
#include <linux/of.h>
#include <linux/of_device.h>

#include "sja1000.h"

Expand Down
6 changes: 3 additions & 3 deletions drivers/net/can/spi/mcp251xfd/mcp251xfd-tef.c
Original file line number Diff line number Diff line change
Expand Up @@ -111,9 +111,9 @@ mcp251xfd_handle_tefif_one(struct mcp251xfd_priv *priv,
if (skb)
mcp251xfd_skb_set_timestamp(priv, skb, hw_tef_obj->ts);
stats->tx_bytes +=
can_rx_offload_get_echo_skb(&priv->offload,
tef_tail, hw_tef_obj->ts,
frame_len_ptr);
can_rx_offload_get_echo_skb_queue_timestamp(&priv->offload,
tef_tail, hw_tef_obj->ts,
frame_len_ptr);
stats->tx_packets++;
priv->tef->tail++;

Expand Down
23 changes: 19 additions & 4 deletions drivers/net/can/sun4i_can.c
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,6 @@
#include <linux/io.h>
#include <linux/module.h>
#include <linux/of.h>
#include <linux/of_device.h>
#include <linux/platform_device.h>
#include <linux/reset.h>

Expand Down Expand Up @@ -91,6 +90,8 @@
#define SUN4I_REG_BUF12_ADDR 0x0070 /* CAN Tx/Rx Buffer 12 */
#define SUN4I_REG_ACPC_ADDR 0x0040 /* CAN Acceptance Code 0 */
#define SUN4I_REG_ACPM_ADDR 0x0044 /* CAN Acceptance Mask 0 */
#define SUN4I_REG_ACPC_ADDR_D1 0x0028 /* CAN Acceptance Code 0 on the D1 */
#define SUN4I_REG_ACPM_ADDR_D1 0x002C /* CAN Acceptance Mask 0 on the D1 */
#define SUN4I_REG_RBUF_RBACK_START_ADDR 0x0180 /* CAN transmit buffer start */
#define SUN4I_REG_RBUF_RBACK_END_ADDR 0x01b0 /* CAN transmit buffer end */

Expand Down Expand Up @@ -205,9 +206,11 @@
* struct sun4ican_quirks - Differences between SoC variants.
*
* @has_reset: SoC needs reset deasserted.
* @acp_offset: Offset of ACPC and ACPM registers
*/
struct sun4ican_quirks {
bool has_reset;
int acp_offset;
};

struct sun4ican_priv {
Expand All @@ -216,6 +219,7 @@ struct sun4ican_priv {
struct clk *clk;
struct reset_control *reset;
spinlock_t cmdreg_lock; /* lock for concurrent cmd register writes */
int acp_offset;
};

static const struct can_bittiming_const sun4ican_bittiming_const = {
Expand Down Expand Up @@ -338,8 +342,8 @@ static int sun4i_can_start(struct net_device *dev)
}

/* set filters - we accept all */
writel(0x00000000, priv->base + SUN4I_REG_ACPC_ADDR);
writel(0xFFFFFFFF, priv->base + SUN4I_REG_ACPM_ADDR);
writel(0x00000000, priv->base + SUN4I_REG_ACPC_ADDR + priv->acp_offset);
writel(0xFFFFFFFF, priv->base + SUN4I_REG_ACPM_ADDR + priv->acp_offset);

/* clear error counters and error code capture */
writel(0, priv->base + SUN4I_REG_ERRC_ADDR);
Expand Down Expand Up @@ -768,10 +772,17 @@ static const struct ethtool_ops sun4ican_ethtool_ops = {

static const struct sun4ican_quirks sun4ican_quirks_a10 = {
.has_reset = false,
.acp_offset = 0,
};

static const struct sun4ican_quirks sun4ican_quirks_r40 = {
.has_reset = true,
.acp_offset = 0,
};

static const struct sun4ican_quirks sun4ican_quirks_d1 = {
.has_reset = true,
.acp_offset = (SUN4I_REG_ACPC_ADDR_D1 - SUN4I_REG_ACPC_ADDR),
};

static const struct of_device_id sun4ican_of_match[] = {
Expand All @@ -784,6 +795,9 @@ static const struct of_device_id sun4ican_of_match[] = {
}, {
.compatible = "allwinner,sun8i-r40-can",
.data = &sun4ican_quirks_r40
}, {
.compatible = "allwinner,sun20i-d1-can",
.data = &sun4ican_quirks_d1
}, {
/* sentinel */
},
Expand Down Expand Up @@ -870,6 +884,7 @@ static int sun4ican_probe(struct platform_device *pdev)
priv->base = addr;
priv->clk = clk;
priv->reset = reset;
priv->acp_offset = quirks->acp_offset;
spin_lock_init(&priv->cmdreg_lock);

platform_set_drvdata(pdev, dev);
Expand Down Expand Up @@ -907,4 +922,4 @@ module_platform_driver(sun4i_can_driver);
MODULE_AUTHOR("Peter Chen <xingkongcp@gmail.com>");
MODULE_AUTHOR("Gerhard Bertelsmann <info@gerhard-bertelsmann.de>");
MODULE_LICENSE("Dual BSD/GPL");
MODULE_DESCRIPTION("CAN driver for Allwinner SoCs (A10/A20)");
MODULE_DESCRIPTION("CAN driver for Allwinner SoCs (A10/A20/D1)");
5 changes: 2 additions & 3 deletions drivers/net/can/ti_hecc.c
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
#include <linux/clk.h>
#include <linux/io.h>
#include <linux/of.h>
#include <linux/of_device.h>
#include <linux/regulator/consumer.h>

#include <linux/can/dev.h>
Expand Down Expand Up @@ -748,8 +747,8 @@ static irqreturn_t ti_hecc_interrupt(int irq, void *dev_id)
spin_unlock_irqrestore(&priv->mbx_lock, flags);
stamp = hecc_read_stamp(priv, mbxno);
stats->tx_bytes +=
can_rx_offload_get_echo_skb(&priv->offload,
mbxno, stamp, NULL);
can_rx_offload_get_echo_skb_queue_timestamp(&priv->offload,
mbxno, stamp, NULL);
stats->tx_packets++;
--priv->tx_tail;
}
Expand Down
1 change: 1 addition & 0 deletions drivers/net/can/usb/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ config CAN_F81604

config CAN_GS_USB
tristate "Geschwister Schneider UG and candleLight compatible interfaces"
select CAN_RX_OFFLOAD
help
This driver supports the Geschwister Schneider and
bytewerk.org candleLight compatible
Expand Down
Loading

0 comments on commit 8ad228b

Please sign in to comment.