Module Name: src Committed By: riastradh Date: Tue Dec 11 18:51:38 UTC 2012
Modified Files: src/sys/arch/arm/omap: omap2_prcm.c omap2_prcm.h Log Message: Export a little more from the omap2 prcm driver. This is in anticipation of drivers that need to enable (and, for future power management, perhaps disable) modules on an SoC. Each SoC has a different notion of enabling and disabling modules and will need to implement prcm_module_enable and prcm_module_disable separately. To generate a diff of this commit: cvs rdiff -u -r1.3 -r1.4 src/sys/arch/arm/omap/omap2_prcm.c cvs rdiff -u -r1.1 -r1.2 src/sys/arch/arm/omap/omap2_prcm.h 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/omap/omap2_prcm.c diff -u src/sys/arch/arm/omap/omap2_prcm.c:1.3 src/sys/arch/arm/omap/omap2_prcm.c:1.4 --- src/sys/arch/arm/omap/omap2_prcm.c:1.3 Tue Jan 31 04:31:37 2012 +++ src/sys/arch/arm/omap/omap2_prcm.c Tue Dec 11 18:51:38 2012 @@ -1,4 +1,4 @@ -/* $NetBSD: omap2_prcm.c,v 1.3 2012/01/31 04:31:37 matt Exp $ */ +/* $NetBSD: omap2_prcm.c,v 1.4 2012/12/11 18:51:38 riastradh Exp $ */ /*- * Copyright (c) 2010 Adam Hoka @@ -28,7 +28,7 @@ #include "opt_omap.h" #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: omap2_prcm.c,v 1.3 2012/01/31 04:31:37 matt Exp $"); +__KERNEL_RCSID(0, "$NetBSD: omap2_prcm.c,v 1.4 2012/12/11 18:51:38 riastradh Exp $"); #include <sys/param.h> #include <sys/device.h> @@ -77,6 +77,7 @@ prcm_attach(device_t parent, device_t se { struct obio_attach_args *obio = aux; + KASSERT(prcm_sc == NULL); prcm_sc = device_private(self); prcm_sc->sc_dev = self; @@ -84,7 +85,7 @@ prcm_attach(device_t parent, device_t se prcm_sc->sc_base = obio->obio_addr; prcm_sc->sc_size = OMAP2_PRM_SIZE; - + /* map i/o space for PRM */ if (bus_space_map(prcm_sc->sc_iot, prcm_sc->sc_base, prcm_sc->sc_size, 0, &prcm_sc->sc_ioh) != 0) { @@ -95,16 +96,20 @@ prcm_attach(device_t parent, device_t se aprint_normal(": Power, Reset and Clock Management\n"); } -static uint32_t -prcm_read(bus_addr_t module, bus_addr_t reg) -{ +uint32_t +prcm_read_4(bus_size_t module, bus_size_t reg) +{ + + KASSERT(prcm_sc != NULL); return bus_space_read_4(prcm_sc->sc_iot, prcm_sc->sc_ioh, module + reg); } -static void -prcm_write(bus_addr_t module, bus_addr_t reg, uint32_t data) -{ +void +prcm_write_4(bus_size_t module, bus_size_t reg, uint32_t data) +{ + + KASSERT(prcm_sc != NULL); bus_space_write_4(prcm_sc->sc_iot, prcm_sc->sc_ioh, module + reg, data); } @@ -113,10 +118,10 @@ void prcm_cold_reset(void) { uint32_t val; - - val = prcm_read(OMAP3430_GR_MOD, OMAP2_RM_RSTCTRL); + + val = prcm_read_4(OMAP3430_GR_MOD, OMAP2_RM_RSTCTRL); val |= OMAP_RST_DPLL3; - prcm_write(OMAP3430_GR_MOD, OMAP2_RM_RSTCTRL, val); + prcm_write_4(OMAP3430_GR_MOD, OMAP2_RM_RSTCTRL, val); } Index: src/sys/arch/arm/omap/omap2_prcm.h diff -u src/sys/arch/arm/omap/omap2_prcm.h:1.1 src/sys/arch/arm/omap/omap2_prcm.h:1.2 --- src/sys/arch/arm/omap/omap2_prcm.h:1.1 Sat Aug 28 13:02:32 2010 +++ src/sys/arch/arm/omap/omap2_prcm.h Tue Dec 11 18:51:38 2012 @@ -1,4 +1,4 @@ -/* $NetBSD: omap2_prcm.h,v 1.1 2010/08/28 13:02:32 ahoka Exp $ */ +/* $NetBSD: omap2_prcm.h,v 1.2 2012/12/11 18:51:38 riastradh Exp $ */ /*- * Copyright (c) 2010 Adam Hoka @@ -26,9 +26,16 @@ * SUCH DAMAGE. */ -#ifndef _OMAP2_PRCM_H_ -#define _OMAP2_PRCM_H_ +#ifndef _ARM_OMAP_OMAP2_PRCM_H_ +#define _ARM_OMAP_OMAP2_PRCM_H_ -void prcm_cold_reset(void); +struct omap_module; -#endif +uint32_t prcm_read_4(bus_size_t, bus_size_t); +void prcm_write_4(bus_size_t, bus_size_t, uint32_t); +void prcm_cold_reset(void); + +void prcm_module_enable(const struct omap_module *); +void prcm_module_disable(const struct omap_module *); + +#endif /* _ARM_OMAP_OMAP2_PRCM_H_ */