Skip to content

Commit 42f0213

Browse files
committed
Merge tag 'linux-can-fixes-for-4.17-20180508' of ssh://gitolite.kernel.org/pub/scm/linux/kernel/git/mkl/linux-can
Marc Kleine-Budde says: ==================== pull-request: can 2018-05-08 this is a pull request for 7 patches for net/master. The first patch is by Jakob Unterwurzacher and increases the severity of bus-off messages in the generic CAN device infrastructure. The next two patches are by Uwe Kleine-König and fix the endianess detection in the flexcan driver. Jimmy Assarsson's patch for the kvaser driver corrects the stats counter for dropped tx-messages. Geert Uytterhoeven provides one patch and Sergei Shtylyov two patches for the rcan_canfd device tree binding description. ==================== Signed-off-by: David S. Miller <[email protected]>
2 parents 2dabf9f + 7a25ac2 commit 42f0213

File tree

6 files changed

+23
-19
lines changed

6 files changed

+23
-19
lines changed

Documentation/devicetree/bindings/net/can/rcar_canfd.txt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,9 @@ Required properties:
55
- compatible: Must contain one or more of the following:
66
- "renesas,rcar-gen3-canfd" for R-Car Gen3 compatible controller.
77
- "renesas,r8a7795-canfd" for R8A7795 (R-Car H3) compatible controller.
8-
- "renesas,r8a7796-canfd" for R8A7796 (R-Car M3) compatible controller.
8+
- "renesas,r8a7796-canfd" for R8A7796 (R-Car M3-W) compatible controller.
9+
- "renesas,r8a77970-canfd" for R8A77970 (R-Car V3M) compatible controller.
10+
- "renesas,r8a77980-canfd" for R8A77980 (R-Car V3H) compatible controller.
911

1012
When compatible with the generic version, nodes must list the
1113
SoC-specific version corresponding to the platform first, followed by the

arch/arm/boot/dts/imx35.dtsi

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -303,7 +303,7 @@
303303
};
304304

305305
can1: can@53fe4000 {
306-
compatible = "fsl,imx35-flexcan";
306+
compatible = "fsl,imx35-flexcan", "fsl,imx25-flexcan";
307307
reg = <0x53fe4000 0x1000>;
308308
clocks = <&clks 33>, <&clks 33>;
309309
clock-names = "ipg", "per";
@@ -312,7 +312,7 @@
312312
};
313313

314314
can2: can@53fe8000 {
315-
compatible = "fsl,imx35-flexcan";
315+
compatible = "fsl,imx35-flexcan", "fsl,imx25-flexcan";
316316
reg = <0x53fe8000 0x1000>;
317317
clocks = <&clks 34>, <&clks 34>;
318318
clock-names = "ipg", "per";

arch/arm/boot/dts/imx53.dtsi

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -551,7 +551,7 @@
551551
};
552552

553553
can1: can@53fc8000 {
554-
compatible = "fsl,imx53-flexcan";
554+
compatible = "fsl,imx53-flexcan", "fsl,imx25-flexcan";
555555
reg = <0x53fc8000 0x4000>;
556556
interrupts = <82>;
557557
clocks = <&clks IMX5_CLK_CAN1_IPG_GATE>,
@@ -561,7 +561,7 @@
561561
};
562562

563563
can2: can@53fcc000 {
564-
compatible = "fsl,imx53-flexcan";
564+
compatible = "fsl,imx53-flexcan", "fsl,imx25-flexcan";
565565
reg = <0x53fcc000 0x4000>;
566566
interrupts = <83>;
567567
clocks = <&clks IMX5_CLK_CAN2_IPG_GATE>,

drivers/net/can/dev.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -605,7 +605,7 @@ void can_bus_off(struct net_device *dev)
605605
{
606606
struct can_priv *priv = netdev_priv(dev);
607607

608-
netdev_dbg(dev, "bus-off\n");
608+
netdev_info(dev, "bus-off\n");
609609

610610
netif_carrier_off(dev);
611611

drivers/net/can/flexcan.c

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -200,6 +200,7 @@
200200
#define FLEXCAN_QUIRK_DISABLE_MECR BIT(4) /* Disable Memory error detection */
201201
#define FLEXCAN_QUIRK_USE_OFF_TIMESTAMP BIT(5) /* Use timestamp based offloading */
202202
#define FLEXCAN_QUIRK_BROKEN_PERR_STATE BIT(6) /* No interrupt for error passive */
203+
#define FLEXCAN_QUIRK_DEFAULT_BIG_ENDIAN BIT(7) /* default to BE register access */
203204

204205
/* Structure of the message buffer */
205206
struct flexcan_mb {
@@ -287,6 +288,12 @@ struct flexcan_priv {
287288
};
288289

289290
static const struct flexcan_devtype_data fsl_p1010_devtype_data = {
291+
.quirks = FLEXCAN_QUIRK_BROKEN_WERR_STATE |
292+
FLEXCAN_QUIRK_BROKEN_PERR_STATE |
293+
FLEXCAN_QUIRK_DEFAULT_BIG_ENDIAN,
294+
};
295+
296+
static const struct flexcan_devtype_data fsl_imx25_devtype_data = {
290297
.quirks = FLEXCAN_QUIRK_BROKEN_WERR_STATE |
291298
FLEXCAN_QUIRK_BROKEN_PERR_STATE,
292299
};
@@ -1251,9 +1258,9 @@ static void unregister_flexcandev(struct net_device *dev)
12511258
static const struct of_device_id flexcan_of_match[] = {
12521259
{ .compatible = "fsl,imx6q-flexcan", .data = &fsl_imx6q_devtype_data, },
12531260
{ .compatible = "fsl,imx28-flexcan", .data = &fsl_imx28_devtype_data, },
1254-
{ .compatible = "fsl,imx53-flexcan", .data = &fsl_p1010_devtype_data, },
1255-
{ .compatible = "fsl,imx35-flexcan", .data = &fsl_p1010_devtype_data, },
1256-
{ .compatible = "fsl,imx25-flexcan", .data = &fsl_p1010_devtype_data, },
1261+
{ .compatible = "fsl,imx53-flexcan", .data = &fsl_imx25_devtype_data, },
1262+
{ .compatible = "fsl,imx35-flexcan", .data = &fsl_imx25_devtype_data, },
1263+
{ .compatible = "fsl,imx25-flexcan", .data = &fsl_imx25_devtype_data, },
12571264
{ .compatible = "fsl,p1010-flexcan", .data = &fsl_p1010_devtype_data, },
12581265
{ .compatible = "fsl,vf610-flexcan", .data = &fsl_vf610_devtype_data, },
12591266
{ .compatible = "fsl,ls1021ar2-flexcan", .data = &fsl_ls1021a_r2_devtype_data, },
@@ -1337,18 +1344,13 @@ static int flexcan_probe(struct platform_device *pdev)
13371344

13381345
priv = netdev_priv(dev);
13391346

1340-
if (of_property_read_bool(pdev->dev.of_node, "big-endian")) {
1347+
if (of_property_read_bool(pdev->dev.of_node, "big-endian") ||
1348+
devtype_data->quirks & FLEXCAN_QUIRK_DEFAULT_BIG_ENDIAN) {
13411349
priv->read = flexcan_read_be;
13421350
priv->write = flexcan_write_be;
13431351
} else {
1344-
if (of_device_is_compatible(pdev->dev.of_node,
1345-
"fsl,p1010-flexcan")) {
1346-
priv->read = flexcan_read_be;
1347-
priv->write = flexcan_write_be;
1348-
} else {
1349-
priv->read = flexcan_read_le;
1350-
priv->write = flexcan_write_le;
1351-
}
1352+
priv->read = flexcan_read_le;
1353+
priv->write = flexcan_write_le;
13521354
}
13531355

13541356
priv->can.clock.freq = clock_freq;

drivers/net/can/usb/kvaser_usb.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1179,7 +1179,7 @@ static void kvaser_usb_rx_can_msg(const struct kvaser_usb *dev,
11791179

11801180
skb = alloc_can_skb(priv->netdev, &cf);
11811181
if (!skb) {
1182-
stats->tx_dropped++;
1182+
stats->rx_dropped++;
11831183
return;
11841184
}
11851185

0 commit comments

Comments
 (0)