Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/arch/arm/nvidia wait for PWRGATE_TOGGLE.START to clear b...
details: https://anonhg.NetBSD.org/src/rev/e01c5aa5cb7b
branches: trunk
changeset: 338452:e01c5aa5cb7b
user: jmcneill <jmcneill%NetBSD.org@localhost>
date: Mon May 25 10:40:23 2015 +0000
description:
wait for PWRGATE_TOGGLE.START to clear before submitting a new request
diffstat:
sys/arch/arm/nvidia/tegra_pmc.c | 18 +++++++++++++++---
1 files changed, 15 insertions(+), 3 deletions(-)
diffs (47 lines):
diff -r 51c1c66d3ce5 -r e01c5aa5cb7b sys/arch/arm/nvidia/tegra_pmc.c
--- a/sys/arch/arm/nvidia/tegra_pmc.c Mon May 25 09:01:06 2015 +0000
+++ b/sys/arch/arm/nvidia/tegra_pmc.c Mon May 25 10:40:23 2015 +0000
@@ -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 <jmcneill%invisible.ca@localhost>
@@ -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 @@
{
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 @@
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);
Home |
Main Index |
Thread Index |
Old Index