Subject: [PATCH v7 0/8] soc: mediatek: MT8365 power support

Hi,

this version just fixes some small style issues and rebases to v6.5-rc1.

Thanks for any feedback!

Best,
Markus

Based on v6.5-rc1

Changes in v7:
- Rebased to v6.5-rc1
- Fixed a couple of small style issues pointed out by Angelo

Changes in v6:
- Change flags field to be u8 instead of u32
- Use macro concatenation to simplify BUS_PROT macros:
BUS_PROT_WR(_hwip, ...) etc.
- Use the final bit values for scpsys_bus_prot_flags from the beginning
of the series.
- Changed scpsys_domain_data->caps to be u16 to accommodate the new flag
MTK_SCPD_STRICT_BUS_PROTECTION.

Changes in v5:
- Create defines for all registers and bits in mt8365 power domain patch
- Redesign scpsys_bus_prot_data to use flags to store reg_update,
clr_ack as well as the difference between SMI and INFRACFG. The code
uses the appropriate regmap depending on the flags.
- The WAY_EN patch now uses two flags, one for inverted operations
'BUS_PROT_INVERTED' and one to use infracfg-nao for the status flags
'BUS_PROT_STA_COMPONENT_INFRA_NAO'.

Changes in v4:
- Redesigned WAY_EN patch and split it up in smaller patches.
- Added two documentation patches.
- Added mediatek,infracfg-nao field to the binding.

Changes in v3:
- Mainly redesigned WAY_EN patch to be easier to understand
- Rebased onto v6.0-rc1
- Several other stuff that is described in the individual patches

Changes in v2:
- Updated error handling path for scpsys_power_on()
- Minor updates described in each patch

Previous versions:
v1 - https://lore.kernel.org/linux-mediatek/[email protected]/
v2 - https://lore.kernel.org/linux-mediatek/[email protected]/
v3 - https://lore.kernel.org/linux-mediatek/[email protected]/
v4 - https://lore.kernel.org/linux-arm-kernel/[email protected]/
v5 - https://lore.kernel.org/linux-arm-kernel/[email protected]/
v6 - https://lore.kernel.org/linux-arm-kernel/[email protected]/

Alexandre Bailon (2):
soc: mediatek: Add support for WAY_EN operations
soc: mediatek: Add support for MTK_SCPD_STRICT_BUS_PROTECTION cap

Fabien Parent (2):
dt-bindings: power: Add MT8365 power domains
soc: mediatek: pm-domains: Add support for MT8365

Markus Schneider-Pargmann (4):
soc: mediatek: pm-domains: Move bools to a flags field
soc: mediatek: pm-domains: Split bus_prot_mask
soc: mediatek: pm-domains: Create bus protection operation functions
soc: mediatek: pm-domains: Unify configuration for infracfg and smi

.../power/mediatek,power-controller.yaml | 6 +
drivers/soc/mediatek/mt6795-pm-domains.h | 16 +-
drivers/soc/mediatek/mt8167-pm-domains.h | 20 +-
drivers/soc/mediatek/mt8173-pm-domains.h | 16 +-
drivers/soc/mediatek/mt8183-pm-domains.h | 125 ++++++----
drivers/soc/mediatek/mt8186-pm-domains.h | 236 ++++++++++--------
drivers/soc/mediatek/mt8188-pm-domains.h | 223 +++++++++++------
drivers/soc/mediatek/mt8192-pm-domains.h | 112 ++++++---
drivers/soc/mediatek/mt8195-pm-domains.h | 199 +++++++++------
drivers/soc/mediatek/mt8365-pm-domains.h | 197 +++++++++++++++
drivers/soc/mediatek/mtk-pm-domains.c | 157 ++++++++----
drivers/soc/mediatek/mtk-pm-domains.h | 51 ++--
.../dt-bindings/power/mediatek,mt8365-power.h | 19 ++
include/linux/soc/mediatek/infracfg.h | 41 +++
14 files changed, 972 insertions(+), 446 deletions(-)
create mode 100644 drivers/soc/mediatek/mt8365-pm-domains.h
create mode 100644 include/dt-bindings/power/mediatek,mt8365-power.h


base-commit: 06c2afb862f9da8dc5efa4b6076a0e48c3fbaaa5
--
2.40.1



Subject: [PATCH v7 2/8] soc: mediatek: pm-domains: Move bools to a flags field

To simplify the macros, use a flags field for simple bools. This is in
preparation for more flags.

Signed-off-by: Markus Schneider-Pargmann <[email protected]>
Reviewed-by: AngeloGioacchino Del Regno <[email protected]>
Reviewed-by: Alexandre Mergnat <[email protected]>
Tested-by: Alexandre Mergnat <[email protected]>
---
drivers/soc/mediatek/mtk-pm-domains.c | 6 +++---
drivers/soc/mediatek/mtk-pm-domains.h | 19 +++++++++++--------
2 files changed, 14 insertions(+), 11 deletions(-)

diff --git a/drivers/soc/mediatek/mtk-pm-domains.c b/drivers/soc/mediatek/mtk-pm-domains.c
index 354249cc1b12..aa9ab413479e 100644
--- a/drivers/soc/mediatek/mtk-pm-domains.c
+++ b/drivers/soc/mediatek/mtk-pm-domains.c
@@ -128,7 +128,7 @@ static int _scpsys_bus_protect_enable(const struct scpsys_bus_prot_data *bpd, st
if (!mask)
break;

- if (bpd[i].bus_prot_reg_update)
+ if (bpd[i].flags & BUS_PROT_REG_UPDATE)
regmap_set_bits(regmap, bpd[i].bus_prot_set, mask);
else
regmap_write(regmap, bpd[i].bus_prot_set, mask);
@@ -165,12 +165,12 @@ static int _scpsys_bus_protect_disable(const struct scpsys_bus_prot_data *bpd,
if (!mask)
continue;

- if (bpd[i].bus_prot_reg_update)
+ if (bpd[i].flags & BUS_PROT_REG_UPDATE)
regmap_clear_bits(regmap, bpd[i].bus_prot_clr, mask);
else
regmap_write(regmap, bpd[i].bus_prot_clr, mask);

- if (bpd[i].ignore_clr_ack)
+ if (bpd[i].flags & BUS_PROT_IGNORE_CLR_ACK)
continue;

ret = regmap_read_poll_timeout(regmap, bpd[i].bus_prot_sta,
diff --git a/drivers/soc/mediatek/mtk-pm-domains.h b/drivers/soc/mediatek/mtk-pm-domains.h
index 5ec53ee073c4..d8c0c299dd45 100644
--- a/drivers/soc/mediatek/mtk-pm-domains.h
+++ b/drivers/soc/mediatek/mtk-pm-domains.h
@@ -42,23 +42,27 @@

#define SPM_MAX_BUS_PROT_DATA 6

-#define _BUS_PROT(_mask, _set, _clr, _sta, _update, _ignore) { \
+enum scpsys_bus_prot_flags {
+ BUS_PROT_REG_UPDATE = BIT(1),
+ BUS_PROT_IGNORE_CLR_ACK = BIT(2),
+};
+
+#define _BUS_PROT(_mask, _set, _clr, _sta, _flags) { \
.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, \
+ .flags = _flags \
}

#define BUS_PROT_WR(_mask, _set, _clr, _sta) \
- _BUS_PROT(_mask, _set, _clr, _sta, false, false)
+ _BUS_PROT(_mask, _set, _clr, _sta, 0)

#define BUS_PROT_WR_IGN(_mask, _set, _clr, _sta) \
- _BUS_PROT(_mask, _set, _clr, _sta, false, true)
+ _BUS_PROT(_mask, _set, _clr, _sta, BUS_PROT_IGNORE_CLR_ACK)

#define BUS_PROT_UPDATE(_mask, _set, _clr, _sta) \
- _BUS_PROT(_mask, _set, _clr, _sta, true, false)
+ _BUS_PROT(_mask, _set, _clr, _sta, BUS_PROT_REG_UPDATE)

#define BUS_PROT_UPDATE_TOPAXI(_mask) \
BUS_PROT_UPDATE(_mask, \
@@ -71,8 +75,7 @@ struct scpsys_bus_prot_data {
u32 bus_prot_set;
u32 bus_prot_clr;
u32 bus_prot_sta;
- bool bus_prot_reg_update;
- bool ignore_clr_ack;
+ u8 flags;
};

/**
--
2.40.1


2023-08-03 10:34:35

by Alexandre Mergnat

[permalink] [raw]
Subject: Re: [PATCH v7 0/8] soc: mediatek: MT8365 power support

Hi Matthias,

Gentle ping, because I think this serie is ready to be merged. Do you
agree ?

Alex

On 13/07/2023 17:04, Markus Schneider-Pargmann wrote:
> Hi,
>
> this version just fixes some small style issues and rebases to v6.5-rc1.
>
> Thanks for any feedback!
>
> Best,
> Markus
>
> Based on v6.5-rc1
>
> Changes in v7:
> - Rebased to v6.5-rc1
> - Fixed a couple of small style issues pointed out by Angelo
>
> Changes in v6:
> - Change flags field to be u8 instead of u32
> - Use macro concatenation to simplify BUS_PROT macros:
> BUS_PROT_WR(_hwip, ...) etc.
> - Use the final bit values for scpsys_bus_prot_flags from the beginning
> of the series.
> - Changed scpsys_domain_data->caps to be u16 to accommodate the new flag
> MTK_SCPD_STRICT_BUS_PROTECTION.
>
> Changes in v5:
> - Create defines for all registers and bits in mt8365 power domain patch
> - Redesign scpsys_bus_prot_data to use flags to store reg_update,
> clr_ack as well as the difference between SMI and INFRACFG. The code
> uses the appropriate regmap depending on the flags.
> - The WAY_EN patch now uses two flags, one for inverted operations
> 'BUS_PROT_INVERTED' and one to use infracfg-nao for the status flags
> 'BUS_PROT_STA_COMPONENT_INFRA_NAO'.
>
> Changes in v4:
> - Redesigned WAY_EN patch and split it up in smaller patches.
> - Added two documentation patches.
> - Added mediatek,infracfg-nao field to the binding.
>
> Changes in v3:
> - Mainly redesigned WAY_EN patch to be easier to understand
> - Rebased onto v6.0-rc1
> - Several other stuff that is described in the individual patches
>
> Changes in v2:
> - Updated error handling path for scpsys_power_on()
> - Minor updates described in each patch
>
> Previous versions:
> v1 - https://lore.kernel.org/linux-mediatek/[email protected]/
> v2 - https://lore.kernel.org/linux-mediatek/[email protected]/
> v3 - https://lore.kernel.org/linux-mediatek/[email protected]/
> v4 - https://lore.kernel.org/linux-arm-kernel/[email protected]/
> v5 - https://lore.kernel.org/linux-arm-kernel/[email protected]/
> v6 - https://lore.kernel.org/linux-arm-kernel/[email protected]/
>
> Alexandre Bailon (2):
> soc: mediatek: Add support for WAY_EN operations
> soc: mediatek: Add support for MTK_SCPD_STRICT_BUS_PROTECTION cap
>
> Fabien Parent (2):
> dt-bindings: power: Add MT8365 power domains
> soc: mediatek: pm-domains: Add support for MT8365
>
> Markus Schneider-Pargmann (4):
> soc: mediatek: pm-domains: Move bools to a flags field
> soc: mediatek: pm-domains: Split bus_prot_mask
> soc: mediatek: pm-domains: Create bus protection operation functions
> soc: mediatek: pm-domains: Unify configuration for infracfg and smi
>
> .../power/mediatek,power-controller.yaml | 6 +
> drivers/soc/mediatek/mt6795-pm-domains.h | 16 +-
> drivers/soc/mediatek/mt8167-pm-domains.h | 20 +-
> drivers/soc/mediatek/mt8173-pm-domains.h | 16 +-
> drivers/soc/mediatek/mt8183-pm-domains.h | 125 ++++++----
> drivers/soc/mediatek/mt8186-pm-domains.h | 236 ++++++++++--------
> drivers/soc/mediatek/mt8188-pm-domains.h | 223 +++++++++++------
> drivers/soc/mediatek/mt8192-pm-domains.h | 112 ++++++---
> drivers/soc/mediatek/mt8195-pm-domains.h | 199 +++++++++------
> drivers/soc/mediatek/mt8365-pm-domains.h | 197 +++++++++++++++
> drivers/soc/mediatek/mtk-pm-domains.c | 157 ++++++++----
> drivers/soc/mediatek/mtk-pm-domains.h | 51 ++--
> .../dt-bindings/power/mediatek,mt8365-power.h | 19 ++
> include/linux/soc/mediatek/infracfg.h | 41 +++
> 14 files changed, 972 insertions(+), 446 deletions(-)
> create mode 100644 drivers/soc/mediatek/mt8365-pm-domains.h
> create mode 100644 include/dt-bindings/power/mediatek,mt8365-power.h
>
>
> base-commit: 06c2afb862f9da8dc5efa4b6076a0e48c3fbaaa5

--
Regards,
Alexandre