blob: 875bd7bf7a9bfb0996bf03676a9c6eefac684376 [file] [log] [blame]
developerc6a6a192023-09-04 14:03:35 +08001--- a/drivers/pinctrl/mediatek/pinctrl-moore.c
2+++ b/drivers/pinctrl/mediatek/pinctrl-moore.c
3@@ -662,6 +662,7 @@ int mtk_moore_pinctrl_probe(struct platf
4 }
5
6 hw->nbase = hw->soc->nbase_names;
7+ spin_lock_init(&hw->lock);
8
9 /* Copy from internal struct mtk_pin_desc to register to the core */
10 pins = devm_kmalloc_array(&pdev->dev, hw->soc->npins, sizeof(*pins),
11--- a/drivers/pinctrl/mediatek/pinctrl-mtk-common-v2.c
12+++ b/drivers/pinctrl/mediatek/pinctrl-mtk-common-v2.c
13@@ -55,11 +55,16 @@ static u32 mtk_r32(struct mtk_pinctrl *p
14 void mtk_rmw(struct mtk_pinctrl *pctl, u8 i, u32 reg, u32 mask, u32 set)
15 {
16 u32 val;
17+ unsigned long flags;
18+
19+ spin_lock_irqsave(&pctl->lock, flags);
20
21 val = mtk_r32(pctl, i, reg);
22 val &= ~mask;
23 val |= set;
24 mtk_w32(pctl, i, reg, val);
25+
26+ spin_unlock_irqrestore(&pctl->lock, flags);
27 }
28
29 static int mtk_hw_pin_field_lookup(struct mtk_pinctrl *hw,