blob: ef81f50c6c758818b7526f9ff9dcbf7a71cac88c [file] [log] [blame]
// SPDX-License-Identifier: GPL-2.0+
/*
* K3: R5 Common Architecture initialization
*
* Copyright (C) 2023 Texas Instruments Incorporated - https://www.ti.com/
*/
#include <linux/types.h>
#include <asm/hardware.h>
#include <asm/io.h>
#include "../common.h"
void disable_linefill_optimization(void)
{
u32 actlr;
/*
* On K3 devices there are 2 conditions where R5F can deadlock:
* 1.When software is performing series of store operations to
* cacheable write back/write allocate memory region and later
* on software execute barrier operation (DSB or DMB). R5F may
* hang at the barrier instruction.
* 2.When software is performing a mix of load and store operations
* within a tight loop and store operations are all writing to
* cacheable write back/write allocates memory regions, R5F may
* hang at one of the load instruction.
*
* To avoid the above two conditions disable linefill optimization
* inside Cortex R5F.
*/
asm("mrc p15, 0, %0, c1, c0, 1" : "=r" (actlr));
actlr |= (1 << 13); /* Set DLFO bit */
asm("mcr p15, 0, %0, c1, c0, 1" : : "r" (actlr));
}