Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 24 Feb 2006 01:53:21 GMT
From:      Warner Losh <imp@FreeBSD.org>
To:        Perforce Change Reviews <perforce@freebsd.org>
Subject:   PERFORCE change 92312 for review
Message-ID:  <200602240153.k1O1rLVp044881@repoman.freebsd.org>

next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=92312

Change 92312 by imp@imp_Speedy on 2006/02/24 01:52:54

	debug...
	# I had it working, removed debug committed, and now it doesn't	
	# work :-(

Affected files ...

.. //depot/projects/arm/src/sys/arm/at91/at91_pmc.c#11 edit
.. //depot/projects/arm/src/sys/arm/at91/ohci_atmelarm.c#10 edit

Differences ...

==== //depot/projects/arm/src/sys/arm/at91/at91_pmc.c#11 (text+ko) ====

@@ -69,7 +69,7 @@
 
 static struct at91_pmc_clock main_ck = {
 	.name = "main",		// Main clock
-	.refcnt = 1,
+	.refcnt = 0,
 	.id = 1,
 	.primary = 1,
 	.pmc_mask = PMC_IER_MOSCS,
@@ -113,7 +113,7 @@
 static struct at91_pmc_clock mck = {
 	.name = "mck",
 	.pmc_mask = PMC_IER_MCKRDY,
-	.refcnt = 1,
+	.refcnt = 0,
 };
 
 static struct at91_pmc_clock udc_clk = {
@@ -160,6 +160,7 @@
 	struct at91_pmc_softc *sc = pmc_softc;
 	uint32_t value;
 
+	printf("Turning PLLB %#x %s\n", sc->pllb_init, on ? "on" : "off");
 	if (on) {
 		on = PMC_IER_LOCKB;
 		value = sc->pllb_init;
@@ -169,6 +170,7 @@
 	WR4(sc, CKGR_PLLBR, value);
 	while ((RD4(sc, PMC_SR) & PMC_IER_LOCKB) != on)
 		continue;
+	printf("Done!\n");
 }
 
 static void
@@ -176,7 +178,15 @@
 {
 	struct at91_pmc_softc *sc = pmc_softc;
 
+	printf("Turning SC %#x %s\n", clk->pmc_mask, on ? "on" : "off");
 	WR4(sc, on ? PMC_SCER : PMC_SCDR, clk->pmc_mask);
+	if (on)
+		while ((RD4(sc, PMC_SCSR) & clk->pmc_mask) != clk->pmc_mask)
+			continue;
+	else
+		while ((RD4(sc, PMC_SCSR) & clk->pmc_mask) == clk->pmc_mask)
+			continue;
+	printf("Done!\n");
 }
 
 static void
@@ -184,7 +194,15 @@
 {
 	struct at91_pmc_softc *sc = pmc_softc;
 
+	printf("Turning PC %#x %s\n", clk->pmc_mask, on ? "on" : "off");
 	WR4(sc, on ? PMC_PCER : PMC_PCDR, clk->pmc_mask);
+	if (on)
+		while ((RD4(sc, PMC_PCSR) & clk->pmc_mask) != clk->pmc_mask)
+			continue;
+	else
+		while ((RD4(sc, PMC_PCSR) & clk->pmc_mask) == clk->pmc_mask)
+			continue;
+	printf("Done!\n");
 }
 
 struct at91_pmc_clock *
@@ -192,7 +210,6 @@
 {
 	int i;
 
-	/* XXX LOCKING? XXX */
 	for (i = 0; i < sizeof(clock_list) / sizeof(clock_list[0]); i++)
 		if (strcmp(name, clock_list[i]->name) == 0)
 			return (clock_list[i]);
@@ -208,6 +225,8 @@
 void
 at91_pmc_clock_enable(struct at91_pmc_clock *clk)
 {
+	/* XXX LOCKING? XXX */
+	printf("Enable %s\n", clk->name);
 	if (clk->parent)
 		at91_pmc_clock_enable(clk->parent);
 	if (clk->refcnt++ == 0 && clk->set_mode)
@@ -217,6 +236,7 @@
 void
 at91_pmc_clock_disable(struct at91_pmc_clock *clk)
 {
+	/* XXX LOCKING? XXX */
 	if (--clk->refcnt == 0 && clk->set_mode)
 		clk->set_mode(clk, 0);
 	if (clk->parent)

==== //depot/projects/arm/src/sys/arm/at91/ohci_atmelarm.c#10 (text+ko) ====

@@ -110,6 +110,7 @@
 	/*
 	 * turn on the clocks from the AT91's point of view.  Keep the unit in reset.
 	 */
+//	bus_space_write_4(sc->sc_ohci.iot, sc->sc_ohci.ioh, OHCI_CONTROL, 0);
 	at91_pmc_clock_enable(sc->iclk);
 	at91_pmc_clock_enable(sc->fclk);
 	bus_space_write_4(sc->sc_ohci.iot, sc->sc_ohci.ioh, OHCI_CONTROL, 0);



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200602240153.k1O1rLVp044881>