blob: d94d9b8a19e55bd31c31aeee80185d7a6bc170fb [file] [log] [blame]
Nick Hawkinse7ea0a22022-06-08 16:21:37 -05001// SPDX-License-Identifier: GPL-2.0+
2/*
3 * GXP timer driver
4 *
5 * (C) Copyright 2022 Hewlett Packard Enterprise Development LP.
6 * Author: Nick Hawkins <nick.hawkins@hpe.com>
7 * Author: Jean-Marie Verdun <verdun@hpe.com>
8 */
9
10#include <linux/sizes.h>
11#include <asm/io.h>
12#include <dm.h>
13#include <dm/uclass.h>
14#include <ram.h>
15
16DECLARE_GLOBAL_DATA_PTR;
17
18#define ECHI_CMD 0xcefe0010
19
20int board_init(void)
21{
22 writel(0x00080002, ECHI_CMD);
23
24 return 0;
25}
26
27int dram_init(void)
28{
29 if (IS_ENABLED(CONFIG_TARGET_GXP)) {
30 if (IS_ENABLED(CONFIG_GXP_ECC)) {
31 /* 0x0f800000 */
32 gd->ram_size = SZ_128M + SZ_64M + SZ_32M + SZ_16M + SZ_8M;
33 } else {
34 /* 0x1f000000 */
35 gd->ram_size = SZ_256M + SZ_128M + SZ_64M + SZ_32M + SZ_16M;
36 }
37
38 if (IS_ENABLED(CONFIG_GXP_VROM_64MB)) {
39 if (IS_ENABLED(CONFIG_GXP_ECC)) {
40 /* 0x0c000000 */
41 gd->ram_size = SZ_128M + SZ_64M;
42 } else {
43 /* 0x18000000 */
44 gd->ram_size = SZ_256M + SZ_128M;
45 }
46 }
47
48 if (IS_ENABLED(CONFIG_GXP_VROM_32MB)) {
49 if (IS_ENABLED(CONFIG_GXP_ECC)) {
50 /* 0x0e000000 */
51 gd->ram_size = SZ_128M + SZ_64M + SZ_32M;
52 } else {
53 /* 0x1c000000 */
54 gd->ram_size = SZ_256M + SZ_128M + SZ_64M;
55 }
56 }
57 }
58
59 if (IS_ENABLED(CONFIG_TARGET_GXP2)) {
60 /* 0x1b200000 */
61 gd->ram_size = SZ_256M + SZ_128M + SZ_32M + SZ_16M + SZ_2M;
62 if (IS_ENABLED(CONFIG_GXP_VROM_64MB)) {
63 /* 0x14000000 */
64 gd->ram_size = SZ_256M + SZ_64M;
65 }
66
67 if (IS_ENABLED(CONFIG_GXP_VROM_32MB)) {
68 /* 0x18000000 */
69 gd->ram_size = SZ_256M + SZ_128M;
70 }
71 }
72
73 return 0;
74}
75