03001370179cc1789004efc837a3a3e44d75deff
[openwrt/openwrt.git] / target / linux / layerscape / patches-5.4 / 802-can-0017-can-flexcan-flexcan_mailbox_read-make-use-of-flexcan.patch
1 From 6340760d0671e92b15ff92b7eda41bbdd9702437 Mon Sep 17 00:00:00 2001
2 From: Marc Kleine-Budde <mkl@pengutronix.de>
3 Date: Fri, 1 Mar 2019 16:27:59 +0100
4 Subject: [PATCH] can: flexcan: flexcan_mailbox_read() make use of
5 flexcan_write64() to mark the mailbox as read
6
7 In the previous patch the function flexcan_write64() was introduced.
8
9 This patch replaces the open coded variant in flexcan_mailbox_read()
10 that marks a mailbox as read, by a single call to flexcan_write64().
11
12 Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
13 ---
14 drivers/net/can/flexcan.c | 11 +++--------
15 1 file changed, 3 insertions(+), 8 deletions(-)
16
17 --- a/drivers/net/can/flexcan.c
18 +++ b/drivers/net/can/flexcan.c
19 @@ -885,15 +885,10 @@ static struct sk_buff *flexcan_mailbox_r
20 }
21
22 mark_as_read:
23 - if (priv->devtype_data->quirks & FLEXCAN_QUIRK_USE_OFF_TIMESTAMP) {
24 - /* Clear IRQ */
25 - if (n < 32)
26 - priv->write(BIT(n), &regs->iflag1);
27 - else
28 - priv->write(BIT(n - 32), &regs->iflag2);
29 - } else {
30 + if (priv->devtype_data->quirks & FLEXCAN_QUIRK_USE_OFF_TIMESTAMP)
31 + flexcan_write64(priv, FLEXCAN_IFLAG_MB(n), &regs->iflag1);
32 + else
33 priv->write(FLEXCAN_IFLAG_RX_FIFO_AVAILABLE, &regs->iflag1);
34 - }
35
36 /* Read the Free Running Timer. It is optional but recommended
37 * to unlock Mailbox as soon as possible and make it available