2 * Actions Semi Owl Smart Power System (SPS) shared helpers
4 * Copyright 2012 Actions Semi Inc.
5 * Author: Actions Semi, Inc.
7 * Copyright (c) 2017 Andreas Färber
9 * This program is free software; you can redistribute it and/or modify it
10 * under the terms of the GNU General Public License as published by the
11 * Free Software Foundation; either version 2 of the License, or (at your
12 * option) any later version.
15 #include <linux/delay.h>
18 #define OWL_SPS_PG_CTL 0x0
20 int owl_sps_set_pg(void __iomem
*base
, u32 pwr_mask
, u32 ack_mask
, bool enable
)
26 val
= readl(base
+ OWL_SPS_PG_CTL
);
36 writel(val
, base
+ OWL_SPS_PG_CTL
);
38 for (timeout
= 5000; timeout
> 0; timeout
-= 50) {
39 val
= readl(base
+ OWL_SPS_PG_CTL
);
40 if ((val
& ack_mask
) == (enable
? ack_mask
: 0))
51 EXPORT_SYMBOL_GPL(owl_sps_set_pg
);