kernel: add Intel/Lantiq VRX518 EP driver
[openwrt/openwrt.git] / package / kernel / lantiq / vrx518_ep / patches / 200-fix-irq-masking.patch
1 Fix double negation of bitmask in dc_ep_icu_disable andwr32_mask.
2 Also add locking to ensure the masking is applied atomically.
3
4 --- a/misc.c
5 +++ b/misc.c
6 @@ -68,12 +68,22 @@ void dc_ep_icu_disable(struct dc_ep_priv
7
8 void dc_ep_icu_dis_intr(struct dc_ep_priv *priv, u32 bits)
9 {
10 - wr32_mask(~bits, 0, ICU_IMER);
11 + struct dc_aca *aca = to_aca(priv);
12 + unsigned long flags;
13 +
14 + spin_lock_irqsave(&aca->icu_lock, flags);
15 + wr32_mask(bits, 0, ICU_IMER);
16 + spin_unlock_irqrestore(&aca->icu_lock, flags);
17 }
18
19 void dc_ep_icu_en_intr(struct dc_ep_priv *priv, u32 bits)
20 {
21 + struct dc_aca *aca = to_aca(priv);
22 + unsigned long flags;
23 +
24 + spin_lock_irqsave(&aca->icu_lock, flags);
25 wr32_mask(0, bits, ICU_IMER);
26 + spin_unlock_irqrestore(&aca->icu_lock, flags);
27 }
28
29 void dc_ep_assert_device(struct dc_ep_priv *priv, u32 bits)
30 --- a/aca.c
31 +++ b/aca.c
32 @@ -1158,6 +1158,7 @@ void dc_aca_info_init(struct dc_ep_priv
33 struct dc_aca *aca = to_aca(priv);
34
35 aca->initialized = false;
36 + spin_lock_init(&aca->icu_lock);
37 spin_lock_init(&aca->clk_lock);
38 spin_lock_init(&aca->rcu_lock);
39 mutex_init(&aca->pin_lock);
40 --- a/aca.h
41 +++ b/aca.h
42 @@ -470,6 +470,7 @@ struct aca_hif_params {
43
44 struct dc_aca {
45 bool initialized;
46 + spinlock_t icu_lock;
47 spinlock_t clk_lock;
48 spinlock_t rcu_lock;
49 struct mutex pin_lock;