~funderscore blog cgit wiki get in touch
aboutsummaryrefslogtreecommitdiff
blob: d94d9b8a19e55bd31c31aeee80185d7a6bc170fb (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
// SPDX-License-Identifier: GPL-2.0+
/*
 * GXP timer driver
 *
 * (C) Copyright 2022 Hewlett Packard Enterprise Development LP.
 * Author: Nick Hawkins <nick.hawkins@hpe.com>
 * Author: Jean-Marie Verdun <verdun@hpe.com>
 */

#include <linux/sizes.h>
#include <asm/io.h>
#include <dm.h>
#include <dm/uclass.h>
#include <ram.h>

DECLARE_GLOBAL_DATA_PTR;

#define ECHI_CMD 0xcefe0010

int board_init(void)
{
	writel(0x00080002, ECHI_CMD);

	return 0;
}

int dram_init(void)
{
	if (IS_ENABLED(CONFIG_TARGET_GXP)) {
		if (IS_ENABLED(CONFIG_GXP_ECC)) {
			/* 0x0f800000 */
			gd->ram_size = SZ_128M + SZ_64M + SZ_32M + SZ_16M + SZ_8M;
		} else {
			/* 0x1f000000 */
			gd->ram_size = SZ_256M + SZ_128M + SZ_64M + SZ_32M + SZ_16M;
		}

		if (IS_ENABLED(CONFIG_GXP_VROM_64MB)) {
			if (IS_ENABLED(CONFIG_GXP_ECC)) {
				/* 0x0c000000 */
				gd->ram_size = SZ_128M + SZ_64M;
			} else {
				/* 0x18000000 */
				gd->ram_size = SZ_256M + SZ_128M;
			}
		}

		if (IS_ENABLED(CONFIG_GXP_VROM_32MB)) {
			if (IS_ENABLED(CONFIG_GXP_ECC)) {
				/* 0x0e000000 */
				gd->ram_size = SZ_128M + SZ_64M + SZ_32M;
			} else {
				/* 0x1c000000 */
				gd->ram_size = SZ_256M + SZ_128M + SZ_64M;
			}
		}
	}

	if (IS_ENABLED(CONFIG_TARGET_GXP2)) {
		/* 0x1b200000 */
		gd->ram_size = SZ_256M + SZ_128M + SZ_32M + SZ_16M + SZ_2M;
		if (IS_ENABLED(CONFIG_GXP_VROM_64MB)) {
			/* 0x14000000 */
			gd->ram_size = SZ_256M + SZ_64M;
		}

		if (IS_ENABLED(CONFIG_GXP_VROM_32MB)) {
			/* 0x18000000 */
			gd->ram_size = SZ_256M + SZ_128M;
		}
	}

	return 0;
}