PERFORCE change 168944 for review

Ulf Lilleengen lulf at FreeBSD.org
Sun Sep 27 20:59:55 UTC 2009


http://perforce.freebsd.org/chv.cgi?CH=168944

Change 168944 by lulf at lulf_nobby on 2009/09/27 20:58:55

	- Enable devclk for timer/counter.

Affected files ...

.. //depot/projects/avr32/src/sys/avr32/avr32/at32_tc.c#4 edit
.. //depot/projects/avr32/src/sys/avr32/avr32/at32_tc_channel.c#4 edit
.. //depot/projects/avr32/src/sys/avr32/conf/cpu/at32ap700x.hints#8 edit

Differences ...

==== //depot/projects/avr32/src/sys/avr32/avr32/at32_tc.c#4 (text+ko) ====

@@ -77,6 +77,7 @@
 	struct rman		irq_rman;
 	bus_space_tag_t		bst;
 	bus_space_handle_t	bsh;
+	devclk_t		clk;
 };
 struct at32_tc_ivar {
 	struct resource_list	resources;
@@ -125,7 +126,9 @@
 	int rid, err = ENOMEM;
 
 	/* Make sure device clock is enabled before writing */
-	//devclk_enable(dev);
+	sc->clk = devclk_alloc(dev);
+	if (sc->clk == NULL)
+		return (ENOMEM);
 
 	/* Setup register space */
 	rid = 0;
@@ -167,6 +170,7 @@
 	bus_generic_probe(dev);
 	bus_enumerate_hinted_children(dev);
 	bus_generic_attach(dev);
+	devclk_enable(sc->clk);
 	return (0);
 
 errout:
@@ -189,9 +193,9 @@
 		    rman_get_rid(sc->regs_res), sc->regs_res);
 		sc->regs_res = NULL;
 	}
+	devclk_disable(sc->clk);
+	devclk_free(sc->clk);
 
-	/* Turn off device clock */
-	//devclk_disable(dev);
 	return (0);
 }
 

==== //depot/projects/avr32/src/sys/avr32/avr32/at32_tc_channel.c#4 (text+ko) ====

@@ -44,7 +44,6 @@
 #include <sys/module.h>
 #include <sys/time.h>
 #include <sys/bus.h>
-#include <sys/devclk.h>
 #include <sys/resource.h>
 #include <sys/rman.h>
 #include <sys/clock.h>
@@ -103,9 +102,6 @@
 	struct at32_tc_channel_softc *sc = device_get_softc(dev);
 	int rid, err = ENOMEM;
 
-	/* Make sure device clock is enabled before writing */
-	//devclk_enable(dev);
-
 	/* Setup register space */
 	rid = 0;
 	sc->regs_res = bus_alloc_resource_any(dev, SYS_RES_MEMORY, &rid,
@@ -156,8 +152,6 @@
 		sc->regs_res = NULL;
 	}
 
-	/* Turn off device clock */
-	//devclk_disable(dev);
 	return (0);
 }
 

==== //depot/projects/avr32/src/sys/avr32/conf/cpu/at32ap700x.hints#8 (text+ko) ====

@@ -144,7 +144,7 @@
 hint.at32_tc.0.maddr="0xFFF00C00"
 hint.at32_tc.0.msize="0x400"
 hint.at32_tc.0.irq="22"
-hint.at32_tc.0.clk="pbb:3"
+hint.at32_tc.0.clk="TC0"
 
 hint.at32_tc_channel.0.at="at32_tc0"
 hint.at32_tc_channel.0.offset="0x00"
@@ -159,7 +159,7 @@
 hint.at32_tc.1.maddr="0xFFF01000"
 hint.at32_tc.1.msize="0x400"
 hint.at32_tc.1.irq="23"
-hint.at32_tc.1.clk="pbb:4"
+hint.at32_tc.1.clk="TC1"
 
 hint.at32_tc_channel.3.at="at32_tc1"
 hint.at32_tc_channel.3.offset="0x00"


More information about the p4-projects mailing list