Path: blob/main/sys/arm/freescale/imx/imx6_pl310.c
39537 views
/*-1* SPDX-License-Identifier: BSD-2-Clause2*3* Copyright (c) 2012 Olivier Houchard.4* All rights reserved.5*6* Redistribution and use in source and binary forms, with or without7* modification, are permitted provided that the following conditions8* are met:9* 1. Redistributions of source code must retain the above copyright10* notice, this list of conditions and the following disclaimer.11* 2. Redistributions in binary form must reproduce the above copyright12* notice, this list of conditions and the following disclaimer in the13* documentation and/or other materials provided with the distribution.14*15* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR16* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES17* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.18* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,19* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT20* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,21* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY22* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT23* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF24* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.25*/2627#include <sys/cdefs.h>28/*29* The machine-dependent part of the arm/pl310 driver for imx6 SoCs.30*/3132#include <sys/types.h>33#include <sys/param.h>34#include <sys/systm.h>35#include <sys/bus.h>36#include <sys/rman.h>37#include <sys/lock.h>38#include <sys/mutex.h>3940#include <machine/bus.h>41#include <machine/pl310.h>42#include <machine/platformvar.h>4344#include <arm/freescale/imx/imx6_machdep.h>4546#include "platform_pl310_if.h"4748void49imx6_pl310_init(platform_t plat, struct pl310_softc *sc)50{51uint32_t reg;5253/*54* Enable power saving modes:55* - Dynamic Gating stops the clock when the controller is idle.56* - Standby stops the clock when the cores are in WFI mode.57*/58reg = pl310_read4(sc, PL310_POWER_CTRL);59reg |= POWER_CTRL_ENABLE_GATING | POWER_CTRL_ENABLE_STANDBY;60pl310_write4(sc, PL310_POWER_CTRL, reg);6162pl310_set_ram_latency(sc, PL310_TAG_RAM_CTRL, 4, 2, 3);63pl310_set_ram_latency(sc, PL310_DATA_RAM_CTRL, 4, 2, 3);64}656667