-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
soc: actions: owl-sps: Factor out owl_sps_set_pg() for power-gating
Allow the SMP code to reuse PM domain code for CPU2/CPU3 wakeup. Signed-off-by: Andreas Färber <afaerber@suse.de>
- Loading branch information
Andreas Färber
committed
Jun 23, 2017
1 parent
aa9f800
commit 6932ec6
Showing
5 changed files
with
70 additions
and
31 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,2 @@ | ||
obj-$(CONFIG_OWL_PM_DOMAINS_HELPER) += owl-sps-helper.o | ||
obj-$(CONFIG_OWL_PM_DOMAINS) += owl-sps.o |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
/* | ||
* Actions Semi Owl Smart Power System (SPS) shared helpers | ||
* | ||
* Copyright 2012 Actions Semi Inc. | ||
* Author: Actions Semi, Inc. | ||
* | ||
* Copyright (c) 2017 Andreas Färber | ||
* | ||
* This program is free software; you can redistribute it and/or modify it | ||
* under the terms of the GNU General Public License as published by the | ||
* Free Software Foundation; either version 2 of the License, or (at your | ||
* option) any later version. | ||
*/ | ||
|
||
#include <linux/delay.h> | ||
#include <linux/io.h> | ||
|
||
#define OWL_SPS_PG_CTL 0x0 | ||
|
||
int owl_sps_set_pg(void __iomem *base, u32 pwr_mask, u32 ack_mask, bool enable) | ||
{ | ||
u32 val; | ||
bool ack; | ||
int timeout; | ||
|
||
val = readl(base + OWL_SPS_PG_CTL); | ||
ack = val & ack_mask; | ||
if (ack == enable) | ||
return 0; | ||
|
||
if (enable) | ||
val |= pwr_mask; | ||
else | ||
val &= ~pwr_mask; | ||
|
||
writel(val, base + OWL_SPS_PG_CTL); | ||
|
||
for (timeout = 5000; timeout > 0; timeout -= 50) { | ||
val = readl(base + OWL_SPS_PG_CTL); | ||
if ((val & ack_mask) == (enable ? ack_mask : 0)) | ||
break; | ||
udelay(50); | ||
} | ||
if (timeout <= 0) | ||
return -ETIMEDOUT; | ||
|
||
udelay(10); | ||
|
||
return 0; | ||
} | ||
EXPORT_SYMBOL_GPL(owl_sps_set_pg); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
/* | ||
* Copyright (c) 2017 Andreas Färber | ||
* | ||
* SPDX-License-Identifier: GPL-2.0+ | ||
*/ | ||
#ifndef SOC_ACTIONS_OWL_SPS_H | ||
#define SOC_ACTIONS_OWL_SPS_H | ||
|
||
int owl_sps_set_pg(void __iomem *base, u32 pwr_mask, u32 ack_mask, bool enable); | ||
|
||
#endif |