soc: mediatek: pm-domains: Allow bus protection to ignore clear ack
authorMatthias Brugger <mbrugger@suse.com>
Fri, 30 Oct 2020 11:36:15 +0000 (12:36 +0100)
committerMatthias Brugger <matthias.bgg@gmail.com>
Fri, 27 Nov 2020 11:04:43 +0000 (12:04 +0100)
In some cases the hardware does not create an acknowledgment of the
bus protection clearing. Add a flag to the bus protection indicating
that a clear event will be ignored.

Signed-off-by: Matthias Brugger <mbrugger@suse.com>
Signed-off-by: Enric Balletbo i Serra <enric.balletbo@collabora.com>
Link: https://lore.kernel.org/r/20201030113622.201188-10-enric.balletbo@collabora.com
Signed-off-by: Matthias Brugger <matthias.bgg@gmail.com>
drivers/soc/mediatek/mtk-pm-domains.c
drivers/soc/mediatek/mtk-pm-domains.h

index 88dec58aedd9a1b81509e9d0e3231b4739f9f4e5..03279a999dfc452edfd2ebd6ea02c371505756e5 100644 (file)
@@ -161,6 +161,9 @@ static int _scpsys_bus_protect_disable(const struct scpsys_bus_prot_data *bpd,
                else
                        regmap_write(regmap, bpd[i].bus_prot_clr, mask);
 
+               if (bpd[i].ignore_clr_ack)
+                       continue;
+
                ret = regmap_read_poll_timeout(regmap, bpd[i].bus_prot_sta,
                                               val, !(val & mask),
                                               MTK_POLL_DELAY_US, MTK_POLL_TIMEOUT);
index 20df5689739bcb02bf130e2beac2f541b47c5272..809d2d43f01df6ba49cdee61f24a360c72f38a8a 100644 (file)
 
 #define SPM_MAX_BUS_PROT_DATA          5
 
-#define _BUS_PROT(_mask, _set, _clr, _sta, _update) {  \
-               .bus_prot_mask = (_mask),               \
-               .bus_prot_set = _set,                   \
-               .bus_prot_clr = _clr,                   \
-               .bus_prot_sta = _sta,                   \
-               .bus_prot_reg_update = _update,         \
+#define _BUS_PROT(_mask, _set, _clr, _sta, _update, _ignore) { \
+               .bus_prot_mask = (_mask),                       \
+               .bus_prot_set = _set,                           \
+               .bus_prot_clr = _clr,                           \
+               .bus_prot_sta = _sta,                           \
+               .bus_prot_reg_update = _update,                 \
+               .ignore_clr_ack = _ignore,                      \
        }
 
-#define BUS_PROT_WR(_mask, _set, _clr, _sta)           \
-               _BUS_PROT(_mask, _set, _clr, _sta, false)
+#define BUS_PROT_WR(_mask, _set, _clr, _sta)                   \
+               _BUS_PROT(_mask, _set, _clr, _sta, false, false)
+
+#define BUS_PROT_WR_IGN(_mask, _set, _clr, _sta)               \
+               _BUS_PROT(_mask, _set, _clr, _sta, false, true)
 
 #define BUS_PROT_UPDATE(_mask, _set, _clr, _sta)               \
-               _BUS_PROT(_mask, _set, _clr, _sta, true)
+               _BUS_PROT(_mask, _set, _clr, _sta, true, false)
 
 #define BUS_PROT_UPDATE_TOPAXI(_mask)                          \
                BUS_PROT_UPDATE(_mask,                          \
@@ -61,6 +65,7 @@ struct scpsys_bus_prot_data {
        u32 bus_prot_clr;
        u32 bus_prot_sta;
        bool bus_prot_reg_update;
+       bool ignore_clr_ack;
 };
 
 #define MAX_SUBSYS_CLKS 10