Skip to content

Commit ddcc2f6

Browse files
claudiubezneageertu
authored andcommitted
clk: renesas: rzg2l-cpg: Use GENPD_FLAG_* flags instead of local ones
For watchdog PM domain it is necessary to provide GENPD_FLAG_IRQ_SAFE flag to be able to power on the watchdog PM domain from atomic context. For this, adjust the current infrastructure to be able to provide GENPD_FLAG_* for individual PM domains. With this, remove the always_on flag from rzg2l_cpg_add_pm_domains() as it is not necessary anymore. Signed-off-by: Claudiu Beznea <[email protected]> Reviewed-by: Geert Uytterhoeven <[email protected]> Reviewed-by: Ulf Hansson <[email protected]> Link: https://lore.kernel.org/[email protected] Signed-off-by: Geert Uytterhoeven <[email protected]>
1 parent b739073 commit ddcc2f6

File tree

3 files changed

+24
-43
lines changed

3 files changed

+24
-43
lines changed

drivers/clk/renesas/r9a08g045-cpg.c

Lines changed: 20 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
#include <linux/device.h>
1010
#include <linux/init.h>
1111
#include <linux/kernel.h>
12+
#include <linux/pm_domain.h>
1213

1314
#include <dt-bindings/clock/r9a08g045-cpg.h>
1415

@@ -266,61 +267,47 @@ static const struct rzg2l_cpg_pm_domain_init_data r9a08g045_pm_domains[] = {
266267
/* Keep always-on domain on the first position for proper domains registration. */
267268
DEF_PD("always-on", R9A08G045_PD_ALWAYS_ON,
268269
DEF_REG_CONF(0, 0),
269-
RZG2L_PD_F_ALWAYS_ON),
270+
GENPD_FLAG_ALWAYS_ON),
270271
DEF_PD("gic", R9A08G045_PD_GIC,
271272
DEF_REG_CONF(CPG_BUS_ACPU_MSTOP, BIT(3)),
272-
RZG2L_PD_F_ALWAYS_ON),
273+
GENPD_FLAG_ALWAYS_ON),
273274
DEF_PD("ia55", R9A08G045_PD_IA55,
274275
DEF_REG_CONF(CPG_BUS_PERI_CPU_MSTOP, BIT(13)),
275-
RZG2L_PD_F_ALWAYS_ON),
276+
GENPD_FLAG_ALWAYS_ON),
276277
DEF_PD("dmac", R9A08G045_PD_DMAC,
277278
DEF_REG_CONF(CPG_BUS_REG1_MSTOP, GENMASK(3, 0)),
278-
RZG2L_PD_F_ALWAYS_ON),
279+
GENPD_FLAG_ALWAYS_ON),
279280
DEF_PD("wdt0", R9A08G045_PD_WDT0,
280-
DEF_REG_CONF(CPG_BUS_REG0_MSTOP, BIT(0)),
281-
RZG2L_PD_F_NONE),
281+
DEF_REG_CONF(CPG_BUS_REG0_MSTOP, BIT(0)), 0),
282282
DEF_PD("sdhi0", R9A08G045_PD_SDHI0,
283-
DEF_REG_CONF(CPG_BUS_PERI_COM_MSTOP, BIT(0)),
284-
RZG2L_PD_F_NONE),
283+
DEF_REG_CONF(CPG_BUS_PERI_COM_MSTOP, BIT(0)), 0),
285284
DEF_PD("sdhi1", R9A08G045_PD_SDHI1,
286-
DEF_REG_CONF(CPG_BUS_PERI_COM_MSTOP, BIT(1)),
287-
RZG2L_PD_F_NONE),
285+
DEF_REG_CONF(CPG_BUS_PERI_COM_MSTOP, BIT(1)), 0),
288286
DEF_PD("sdhi2", R9A08G045_PD_SDHI2,
289-
DEF_REG_CONF(CPG_BUS_PERI_COM_MSTOP, BIT(11)),
290-
RZG2L_PD_F_NONE),
287+
DEF_REG_CONF(CPG_BUS_PERI_COM_MSTOP, BIT(11)), 0),
291288
DEF_PD("usb0", R9A08G045_PD_USB0,
292-
DEF_REG_CONF(CPG_BUS_PERI_COM_MSTOP, GENMASK(6, 5)),
293-
RZG2L_PD_F_NONE),
289+
DEF_REG_CONF(CPG_BUS_PERI_COM_MSTOP, GENMASK(6, 5)), 0),
294290
DEF_PD("usb1", R9A08G045_PD_USB1,
295-
DEF_REG_CONF(CPG_BUS_PERI_COM_MSTOP, BIT(7)),
296-
RZG2L_PD_F_NONE),
291+
DEF_REG_CONF(CPG_BUS_PERI_COM_MSTOP, BIT(7)), 0),
297292
DEF_PD("usb-phy", R9A08G045_PD_USB_PHY,
298-
DEF_REG_CONF(CPG_BUS_PERI_COM_MSTOP, BIT(4)),
299-
RZG2L_PD_F_NONE),
293+
DEF_REG_CONF(CPG_BUS_PERI_COM_MSTOP, BIT(4)), 0),
300294
DEF_PD("eth0", R9A08G045_PD_ETHER0,
301-
DEF_REG_CONF(CPG_BUS_PERI_COM_MSTOP, BIT(2)),
302-
RZG2L_PD_F_NONE),
295+
DEF_REG_CONF(CPG_BUS_PERI_COM_MSTOP, BIT(2)), 0),
303296
DEF_PD("eth1", R9A08G045_PD_ETHER1,
304-
DEF_REG_CONF(CPG_BUS_PERI_COM_MSTOP, BIT(3)),
305-
RZG2L_PD_F_NONE),
297+
DEF_REG_CONF(CPG_BUS_PERI_COM_MSTOP, BIT(3)), 0),
306298
DEF_PD("i2c0", R9A08G045_PD_I2C0,
307-
DEF_REG_CONF(CPG_BUS_MCPU2_MSTOP, BIT(10)),
308-
RZG2L_PD_F_NONE),
299+
DEF_REG_CONF(CPG_BUS_MCPU2_MSTOP, BIT(10)), 0),
309300
DEF_PD("i2c1", R9A08G045_PD_I2C1,
310-
DEF_REG_CONF(CPG_BUS_MCPU2_MSTOP, BIT(11)),
311-
RZG2L_PD_F_NONE),
301+
DEF_REG_CONF(CPG_BUS_MCPU2_MSTOP, BIT(11)), 0),
312302
DEF_PD("i2c2", R9A08G045_PD_I2C2,
313-
DEF_REG_CONF(CPG_BUS_MCPU2_MSTOP, BIT(12)),
314-
RZG2L_PD_F_NONE),
303+
DEF_REG_CONF(CPG_BUS_MCPU2_MSTOP, BIT(12)), 0),
315304
DEF_PD("i2c3", R9A08G045_PD_I2C3,
316-
DEF_REG_CONF(CPG_BUS_MCPU2_MSTOP, BIT(13)),
317-
RZG2L_PD_F_NONE),
305+
DEF_REG_CONF(CPG_BUS_MCPU2_MSTOP, BIT(13)), 0),
318306
DEF_PD("scif0", R9A08G045_PD_SCIF0,
319-
DEF_REG_CONF(CPG_BUS_MCPU2_MSTOP, BIT(1)),
320-
RZG2L_PD_F_NONE),
307+
DEF_REG_CONF(CPG_BUS_MCPU2_MSTOP, BIT(1)), 0),
321308
DEF_PD("vbat", R9A08G045_PD_VBAT,
322309
DEF_REG_CONF(CPG_BUS_MCPU3_MSTOP, BIT(8)),
323-
RZG2L_PD_F_ALWAYS_ON),
310+
GENPD_FLAG_ALWAYS_ON),
324311
};
325312

326313
const struct rzg2l_cpg_info r9a08g045_cpg_info = {

drivers/clk/renesas/rzg2l-cpg.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1786,16 +1786,14 @@ static int __init rzg2l_cpg_add_pm_domains(struct rzg2l_cpg_priv *priv)
17861786
return ret;
17871787

17881788
for (unsigned int i = 0; i < info->num_pm_domains; i++) {
1789-
bool always_on = !!(info->pm_domains[i].flags & RZG2L_PD_F_ALWAYS_ON);
17901789
struct rzg2l_cpg_pd *pd;
17911790

17921791
pd = devm_kzalloc(dev, sizeof(*pd), GFP_KERNEL);
17931792
if (!pd)
17941793
return -ENOMEM;
17951794

17961795
pd->genpd.name = info->pm_domains[i].name;
1797-
if (always_on)
1798-
pd->genpd.flags = GENPD_FLAG_ALWAYS_ON;
1796+
pd->genpd.flags = info->pm_domains[i].genpd_flags;
17991797
pd->conf = info->pm_domains[i].conf;
18001798
pd->id = info->pm_domains[i].id;
18011799
pd->priv = priv;

drivers/clk/renesas/rzg2l-cpg.h

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -270,14 +270,14 @@ struct rzg2l_cpg_pm_domain_conf {
270270
* struct rzg2l_cpg_pm_domain_init_data - PM domain init data
271271
* @name: PM domain name
272272
* @conf: PM domain configuration
273-
* @flags: RZG2L PM domain flags (see RZG2L_PD_F_*)
273+
* @genpd_flags: genpd flags (see GENPD_FLAG_*)
274274
* @id: PM domain ID (similar to the ones defined in
275275
* include/dt-bindings/clock/<soc-id>-cpg.h)
276276
*/
277277
struct rzg2l_cpg_pm_domain_init_data {
278278
const char * const name;
279279
struct rzg2l_cpg_pm_domain_conf conf;
280-
u32 flags;
280+
u32 genpd_flags;
281281
u16 id;
282282
};
283283

@@ -288,13 +288,9 @@ struct rzg2l_cpg_pm_domain_init_data {
288288
.conf = { \
289289
.mstop = (_mstop_conf), \
290290
}, \
291-
.flags = (_flags), \
291+
.genpd_flags = (_flags), \
292292
}
293293

294-
/* Power domain flags. */
295-
#define RZG2L_PD_F_ALWAYS_ON BIT(0)
296-
#define RZG2L_PD_F_NONE (0)
297-
298294
/**
299295
* struct rzg2l_cpg_info - SoC-specific CPG Description
300296
*

0 commit comments

Comments
 (0)