1 // SPDX-License-Identifier: GPL-2.0+
3 * Actions Semi Owl Smart Power System (SPS) shared helpers
5 * Copyright 2012 Actions Semi Inc.
6 * Author: Actions Semi, Inc.
8 * Copyright (c) 2017 Andreas Färber
11 #include <linux/delay.h>
14 #define OWL_SPS_PG_CTL 0x0
16 int owl_sps_set_pg(void __iomem
*base
, u32 pwr_mask
, u32 ack_mask
, bool enable
)
22 val
= readl(base
+ OWL_SPS_PG_CTL
);
32 writel(val
, base
+ OWL_SPS_PG_CTL
);
34 for (timeout
= 5000; timeout
> 0; timeout
-= 50) {
35 val
= readl(base
+ OWL_SPS_PG_CTL
);
36 if ((val
& ack_mask
) == (enable
? ack_mask
: 0))
47 EXPORT_SYMBOL_GPL(owl_sps_set_pg
);