]> git.ipfire.org Git - people/ms/u-boot.git/blame - arch/arm/mach-keystone/keystone.c
Merge git://git.denx.de/u-boot-tegra
[people/ms/u-boot.git] / arch / arm / mach-keystone / keystone.c
CommitLineData
4984bce4
HZ
1/*
2 * Keystone EVM : Board initialization
3 *
4 * (C) Copyright 2014
5 * Texas Instruments Incorporated, <www.ti.com>
6 *
7 * SPDX-License-Identifier: GPL-2.0+
8 */
9
10#include <common.h>
11#include <asm/io.h>
7b26c1f6
HZ
12#include <asm/arch/psc_defs.h>
13#include <asm/arch/hardware.h>
4984bce4
HZ
14
15/**
16 * cpu_to_bus - swap bytes of the 32-bit data if the device is BE
17 * @ptr - array of data
18 * @length - lenght of data array
19 */
20int cpu_to_bus(u32 *ptr, u32 length)
21{
22 u32 i;
23
3d315386 24 if (!(readl(KS2_DEVSTAT) & 0x1))
4984bce4
HZ
25 for (i = 0; i < length; i++, ptr++)
26 *ptr = cpu_to_be32(*ptr);
27
28 return 0;
29}
7b26c1f6 30
7b26c1f6
HZ
31static void turn_off_all_dsps(int num_dsps)
32{
33 int i;
34
35 for (i = 0; i < num_dsps; i++) {
36 if (psc_disable_module(i + KS2_LPSC_GEM_0))
37 printf("Cannot disable module for #%d DSP", i);
38
4ed8b2c9 39 if (psc_disable_domain(i + KS2_GEM_0_PWR_DOMAIN))
7b26c1f6
HZ
40 printf("Cannot disable domain for #%d DSP", i);
41 }
42}
43
7b26c1f6
HZ
44int misc_init_r(void)
45{
46 char *env;
47 long ks2_debug = 0;
48
00caae6d 49 env = env_get("ks2_debug");
7b26c1f6
HZ
50
51 if (env)
52 ks2_debug = simple_strtol(env, NULL, 0);
53
54 if ((ks2_debug & DBG_LEAVE_DSPS_ON) == 0)
55 turn_off_all_dsps(KS2_NUM_DSPS);
56
57 return 0;
58}