blob: 806aeb913055ff3fc35383bc90de665d7c13b942 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
|
/*
* (c) 2012 Steffen Trumtrar <s.trumtrar@pengutronix.de>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation; either version 2 of
* the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
*/
#include <asm/system.h>
#include <bootsource.h>
#include <common.h>
#include <init.h>
#include <io.h>
#include <mach/zynq7000-regs.h>
#include <restart.h>
static void __noreturn zynq_restart_soc(struct restart_handler *rst)
{
/* write unlock key to slcr */
writel(0xDF0D, ZYNQ_SLCR_UNLOCK);
/* reset */
writel(0x1, ZYNQ_PSS_RST_CTRL);
hang();
}
static enum bootsource zynq_bootsource_get(void)
{
u32 boot_mode = readl(ZYNQ_SLCR_BOOT_MODE);
switch (boot_mode & 0x7) {
case 0x0:
return BOOTSOURCE_JTAG;
case 0x1:
return BOOTSOURCE_SPI;
case 0x2:
return BOOTSOURCE_NOR;
case 0x4:
return BOOTSOURCE_NAND;
case 0x5:
return BOOTSOURCE_MMC;
default:
return BOOTSOURCE_UNKNOWN;
}
}
static int zynq_init(void)
{
u32 val;
dsb();
isb();
writel(0xDF0D, ZYNQ_SLCR_UNLOCK);
/* remap ocm high */
writel(0x0000000F, 0xf8000910);
/* mpcore.filtering_start_address */
writel(0x00000000, 0xf8f00040);
/* mpcore.filtering_end_address */
writel(0xffe00000, 0xf8f00044);
val = readl(0xf8f00000);
val |= 0x2;
writel(val, 0xf8f00000);
dmb();
restart_handler_register_fn("soc", zynq_restart_soc);
bootsource_set(zynq_bootsource_get());
return 0;
}
postcore_initcall(zynq_init);
|