Module Name: src
Committed By: jmcneill
Date: Mon May 25 10:40:23 UTC 2015
Modified Files:
src/sys/arch/arm/nvidia: tegra_pmc.c
Log Message:
wait for PWRGATE_TOGGLE.START to clear before submitting a new request
To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/sys/arch/arm/nvidia/tegra_pmc.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/sys/arch/arm/nvidia/tegra_pmc.c
diff -u src/sys/arch/arm/nvidia/tegra_pmc.c:1.5 src/sys/arch/arm/nvidia/tegra_pmc.c:1.6
--- src/sys/arch/arm/nvidia/tegra_pmc.c:1.5 Mon May 18 21:03:36 2015
+++ src/sys/arch/arm/nvidia/tegra_pmc.c Mon May 25 10:40:23 2015
@@ -1,4 +1,4 @@
-/* $NetBSD: tegra_pmc.c,v 1.5 2015/05/18 21:03:36 jmcneill Exp $ */
+/* $NetBSD: tegra_pmc.c,v 1.6 2015/05/25 10:40:23 jmcneill Exp $ */
/*-
* Copyright (c) 2015 Jared D. McNeill <[email protected]>
@@ -29,7 +29,7 @@
#include "locators.h"
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: tegra_pmc.c,v 1.5 2015/05/18 21:03:36 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: tegra_pmc.c,v 1.6 2015/05/25 10:40:23 jmcneill Exp $");
#include <sys/param.h>
#include <sys/bus.h>
@@ -117,8 +117,9 @@ tegra_pmc_power(u_int partid, bool enabl
{
bus_space_tag_t bst;
bus_space_handle_t bsh;
- uint32_t status;
+ uint32_t status, toggle;
bool state;
+ int retry = 10000;
tegra_pmc_get_bs(&bst, &bsh);
@@ -127,6 +128,17 @@ tegra_pmc_power(u_int partid, bool enabl
if (state == enable)
return;
+ while (--retry > 0) {
+ toggle = bus_space_read_4(bst, bsh, PMC_PWRGATE_TOGGLE_0_REG);
+ if ((toggle & PMC_PWRGATE_TOGGLE_0_START) == 0)
+ break;
+ delay(1);
+ }
+ if (retry == 0) {
+ printf("ERROR: Couldn't enable PMC partition %#x\n", partid);
+ return;
+ }
+
bus_space_write_4(bst, bsh, PMC_PWRGATE_TOGGLE_0_REG,
__SHIFTIN(partid, PMC_PWRGATE_TOGGLE_0_PARTID) |
PMC_PWRGATE_TOGGLE_0_START);