[PATCH v4 0/2] JH7110 PMU Support

Walker Chen
2023-01-19T09:45:18Z

Hello,

This patchset adds PMU (Power Management Unit) controller driver for the
StarFive JH7110 SoC. In order to meet low power requirements, PMU is
designed for including multiple PM domains that can be used for power
gating of selected IP blocks for power saving by reduced leakage
current. The first patch adds device tree binding for PM domain provider
and consumer. The second patch adds pmu driver and support JH7110 SoC.

The series has been tested on the VisionFive 2 boards which equip with
JH7110 SoC and works normally.

Changes since v3:
- Rebased on Linux 6.2-rc4.
- Dropped the statement that 'is_on' is set in error case in
jh71xx_pmu_get_state().
- Replaced dev_info() with dev_dbg() at the bottom of
jh71xx_pmu_probe().
- Added '.suppress_bind_attrs = true,' for jh71xx_pmu_driver structure.
- Dropped patch 3, which is about device tree node of pmu for jh7110.
Because it depends on the submission of others, it will be upstream
separately later.

v3: https://lore.kernel.org/all/20230116074259.22874-1-walker.chen@starfivetech.com/

Changes since v2:
- Rebased on Linux 6.1.
- Renamed the dt-bindings 'starfive,jh71xx-power.yaml' to
'starfive,jh7110-pmu.yaml' which is matching compatible.
- Fixed wrong indentation and error when running 'make dt_binding_check'
in dt-bindings.
- Changed the license of the dt-bindings header to be same with
dt-bindings.
- Changed a little bit on dependency conditions in Kconfig of driver.
- Dropped some macros that are temporarily useless.
- Simplified the definition of macro 'JH71XX_PMU_INT_ALL_MASK'.
- Changed the sorting of structure members, such as 'struct
jh71xx_domain_info', 'struct jh71xx_pmu', etc.
- Modified detailed comment about controlling power domain.
- Dropped useless comment when running 'platform_get_irq'.

v2: https://lore.kernel.org/all/20221208084523.9733-1-walker.chen@starfivetech.com/

Changes since v1:
- Squashed 1st patch (dt-bindings header) into 2nd which is related to
dt-bindings stuff.
- Renamed the dt-bindings header 'jh7110-power.h' to
'starfive,jh7110-pmu.h' and used dual license for it.
- Renamed the dt-bindings 'starfive,jh71xx-power.yaml' to
'starfive,jh71xx-pmu.yaml', dropped items from properties.
- Change of MAINTAINERS: added the entry of 'starfive soc drivers';
changed status to 'Supported' for the entry of
'STARFIVE JH71XX PMU CONTROLLER DRIVER' and sorted the lines alphabetically.
- Dropped the header file 'include/soc/starfive/pm_domains.h'.
- Dropped starfive_pmu_hw_event_turn_on() and starfive_pmu_hw_event_turn_off().
- Added 'default SOC_STARFIVE' and expanded help text in the Kconfig.
- Added a JH71XX_PMU_ prefix to those macro definitions in driver.
- Replaced the data type 'uint8_t / uint32_t' with 'u8 / u32'.
- Fixed some complains by using checkpatch.pl
- Added spinlock to jh71xx_pmu_int_enable().
- Dropped spinlock from jh71xx_pmu_interrupt().
- Used jh71xx_pmu_ as prefix to all functions.
- Replaced io accessors '__raw_readl / __raw_writel' with 'readl / writel'.
- Added jh71xx_pmu_get_state() to the beginning of jh71xx_pmu_set_state().
- Added more detailed comment about controlling power domain.
- Simplified the usage of loop when performing pm_genpd_init() to register
power domain.
- Added more detailed description about the features of power domain
hardware to commit message in 2nd patch.
- Replaced dev_info() with dev_dbg() in jh71xx_pmu_set_state().
- Decreased the timeout numbers of polling power status when switching
power mode.

v1: https://lore.kernel.org/all/20221118133216.17037-1-walker.chen@starfivetech.com/

Best regards,
Walker

Walker Chen (2):
dt-bindings: power: Add starfive,jh7110-pmu
soc: starfive: Add StarFive JH71XX pmu driver

.../bindings/power/starfive,jh7110-pmu.yaml | 45 ++
MAINTAINERS | 14 +
drivers/soc/Kconfig | 1 +
drivers/soc/Makefile | 1 +
drivers/soc/starfive/Kconfig | 12 +
drivers/soc/starfive/Makefile | 3 +
drivers/soc/starfive/jh71xx_pmu.c | 383 ++++++++++++++++++
.../dt-bindings/power/starfive,jh7110-pmu.h | 17 +
8 files changed, 476 insertions(+)
create mode 100644 Documentation/devicetree/bindings/power/starfive,jh7110-pmu.yaml
create mode 100644 drivers/soc/starfive/Kconfig
create mode 100644 drivers/soc/starfive/Makefile
create mode 100644 drivers/soc/starfive/jh71xx_pmu.c
create mode 100644 include/dt-bindings/power/starfive,jh7110-pmu.h

base-commit: 5dc4c995db9eb45f6373a956eb1f69460e69e6d4
--
2.17.1