layerscape: add patches-5.4
[openwrt/staging/chunkeey.git] / target / linux / layerscape / patches-5.4 / 701-net-0148-bus-fsl-mc-use-raw-spin-lock-to-serialize-mc-cmds.patch
1 From 035546179039d430b32b2cace256552455abf061 Mon Sep 17 00:00:00 2001
2 From: Laurentiu Tudor <laurentiu.tudor@nxp.com>
3 Date: Thu, 29 Aug 2019 11:39:45 +0300
4 Subject: [PATCH] bus: fsl-mc: use raw spin lock to serialize mc cmds
5
6 Replace the spinlock that serializes the MC commands with a raw
7 spinlock. This is needed for the RT kernel because there are MC
8 commands sent in interrupt context.
9
10 Signed-off-by: Laurentiu Tudor <laurentiu.tudor@nxp.com>
11 ---
12 drivers/bus/fsl-mc/mc-io.c | 2 +-
13 drivers/bus/fsl-mc/mc-sys.c | 4 ++--
14 include/linux/fsl/mc.h | 2 +-
15 3 files changed, 4 insertions(+), 4 deletions(-)
16
17 --- a/drivers/bus/fsl-mc/mc-io.c
18 +++ b/drivers/bus/fsl-mc/mc-io.c
19 @@ -82,7 +82,7 @@ int __must_check fsl_create_mc_io(struct
20 mc_io->portal_phys_addr = mc_portal_phys_addr;
21 mc_io->portal_size = mc_portal_size;
22 if (flags & FSL_MC_IO_ATOMIC_CONTEXT_PORTAL)
23 - spin_lock_init(&mc_io->spinlock);
24 + raw_spin_lock_init(&mc_io->spinlock);
25 else
26 mutex_init(&mc_io->mutex);
27
28 --- a/drivers/bus/fsl-mc/mc-sys.c
29 +++ b/drivers/bus/fsl-mc/mc-sys.c
30 @@ -251,7 +251,7 @@ int mc_send_command(struct fsl_mc_io *mc
31 return -EINVAL;
32
33 if (mc_io->flags & FSL_MC_IO_ATOMIC_CONTEXT_PORTAL)
34 - spin_lock_irqsave(&mc_io->spinlock, irq_flags);
35 + raw_spin_lock_irqsave(&mc_io->spinlock, irq_flags);
36 else
37 mutex_lock(&mc_io->mutex);
38
39 @@ -287,7 +287,7 @@ int mc_send_command(struct fsl_mc_io *mc
40 error = 0;
41 common_exit:
42 if (mc_io->flags & FSL_MC_IO_ATOMIC_CONTEXT_PORTAL)
43 - spin_unlock_irqrestore(&mc_io->spinlock, irq_flags);
44 + raw_spin_unlock_irqrestore(&mc_io->spinlock, irq_flags);
45 else
46 mutex_unlock(&mc_io->mutex);
47
48 --- a/include/linux/fsl/mc.h
49 +++ b/include/linux/fsl/mc.h
50 @@ -340,7 +340,7 @@ struct fsl_mc_io {
51 * This field is only meaningful if the
52 * FSL_MC_IO_ATOMIC_CONTEXT_PORTAL flag is set
53 */
54 - spinlock_t spinlock; /* serializes mc_send_command() */
55 + raw_spinlock_t spinlock; /* serializes mc_send_command() */
56 };
57 };
58