2018-05-06 21:58:06 +00:00
|
|
|
// SPDX-License-Identifier: GPL-2.0+
|
2014-07-09 16:48:43 +00:00
|
|
|
/*
|
|
|
|
* Keystone EVM : Board initialization
|
|
|
|
*
|
|
|
|
* (C) Copyright 2014
|
|
|
|
* Texas Instruments Incorporated, <www.ti.com>
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <common.h>
|
|
|
|
#include <asm/io.h>
|
2014-07-09 16:48:44 +00:00
|
|
|
#include <asm/arch/psc_defs.h>
|
|
|
|
#include <asm/arch/hardware.h>
|
2014-07-09 16:48:43 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* cpu_to_bus - swap bytes of the 32-bit data if the device is BE
|
|
|
|
* @ptr - array of data
|
|
|
|
* @length - lenght of data array
|
|
|
|
*/
|
|
|
|
int cpu_to_bus(u32 *ptr, u32 length)
|
|
|
|
{
|
|
|
|
u32 i;
|
|
|
|
|
2014-07-09 20:44:44 +00:00
|
|
|
if (!(readl(KS2_DEVSTAT) & 0x1))
|
2014-07-09 16:48:43 +00:00
|
|
|
for (i = 0; i < length; i++, ptr++)
|
|
|
|
*ptr = cpu_to_be32(*ptr);
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
2014-07-09 16:48:44 +00:00
|
|
|
|
|
|
|
static void turn_off_all_dsps(int num_dsps)
|
|
|
|
{
|
|
|
|
int i;
|
|
|
|
|
|
|
|
for (i = 0; i < num_dsps; i++) {
|
|
|
|
if (psc_disable_module(i + KS2_LPSC_GEM_0))
|
|
|
|
printf("Cannot disable module for #%d DSP", i);
|
|
|
|
|
2016-03-04 16:36:38 +00:00
|
|
|
if (psc_disable_domain(i + KS2_GEM_0_PWR_DOMAIN))
|
2014-07-09 16:48:44 +00:00
|
|
|
printf("Cannot disable domain for #%d DSP", i);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
int misc_init_r(void)
|
|
|
|
{
|
|
|
|
char *env;
|
|
|
|
long ks2_debug = 0;
|
|
|
|
|
2017-08-03 18:22:12 +00:00
|
|
|
env = env_get("ks2_debug");
|
2014-07-09 16:48:44 +00:00
|
|
|
|
|
|
|
if (env)
|
|
|
|
ks2_debug = simple_strtol(env, NULL, 0);
|
|
|
|
|
|
|
|
if ((ks2_debug & DBG_LEAVE_DSPS_ON) == 0)
|
|
|
|
turn_off_all_dsps(KS2_NUM_DSPS);
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|