|
@@ -28,6 +28,7 @@
|
|
|
#include <linux/export.h>
|
|
|
#include <linux/init.h>
|
|
|
#include <linux/io.h>
|
|
|
+#include <linux/iopoll.h>
|
|
|
#include <linux/of.h>
|
|
|
#include <linux/of_address.h>
|
|
|
#include <linux/platform_device.h>
|
|
@@ -194,6 +195,9 @@ static inline bool tegra_powergate_is_valid(int id)
|
|
|
*/
|
|
|
static int tegra_powergate_set(unsigned int id, bool new_state)
|
|
|
{
|
|
|
+ bool status;
|
|
|
+ int err;
|
|
|
+
|
|
|
if (id == TEGRA_POWERGATE_3D && pmc->soc->has_gpu_clamps)
|
|
|
return -EINVAL;
|
|
|
|
|
@@ -206,9 +210,12 @@ static int tegra_powergate_set(unsigned int id, bool new_state)
|
|
|
|
|
|
tegra_pmc_writel(PWRGATE_TOGGLE_START | id, PWRGATE_TOGGLE);
|
|
|
|
|
|
+ err = readx_poll_timeout(tegra_powergate_state, id, status,
|
|
|
+ status == new_state, 10, 100000);
|
|
|
+
|
|
|
mutex_unlock(&pmc->powergates_lock);
|
|
|
|
|
|
- return 0;
|
|
|
+ return err;
|
|
|
}
|
|
|
|
|
|
/**
|