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.
This commit is contained in:
riastradh 2012-12-11 18:51:38 +00:00
parent 7175086342
commit d2477942b2
2 changed files with 29 additions and 17 deletions

View File

@ -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 self, void *aux)
{
struct obio_attach_args *obio = aux;
KASSERT(prcm_sc == NULL);
prcm_sc = device_private(self);
prcm_sc->sc_dev = self;
@ -95,16 +96,20 @@ prcm_attach(device_t parent, device_t self, void *aux)
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);
}
@ -114,9 +119,9 @@ 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);
}

View File

@ -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_ */