1 /* SPDX-License-Identifier: GPL-2.0 */
2 /*
3  * Copyright (C) Marvell International Ltd. and its affiliates
4  */
5 
6 #ifndef _MV_DDR_COMMON_H
7 #define _MV_DDR_COMMON_H
8 
9 extern const char mv_ddr_build_message[];
10 extern const char mv_ddr_version_string[];
11 
12 #define _1K	0x00000400
13 #define _4K	0x00001000
14 #define _8K	0x00002000
15 #define _16K	0x00004000
16 #define _32K	0x00008000
17 #define _64K	0x00010000
18 #define _128K	0x00020000
19 #define _256K	0x00040000
20 #define _512K	0x00080000
21 
22 #define _1M	0x00100000
23 #define _2M	0x00200000
24 #define _4M	0x00400000
25 #define _8M	0x00800000
26 #define _16M	0x01000000
27 #define _32M	0x02000000
28 #define _64M	0x04000000
29 #define _128M	0x08000000
30 #define _256M	0x10000000
31 #define _512M	0x20000000
32 
33 #define _1G	0x40000000
34 #define _2G	0x80000000
35 #define _4G	0x100000000
36 #define _8G	0x200000000
37 #define _16G	0x400000000
38 #define _32G	0x800000000
39 #define _64G	0x1000000000
40 #define _128G	0x2000000000
41 
42 #define MEGA			1000000
43 #define MV_DDR_MEGABYTE		(1024 * 1024)
44 #define MV_DDR_32_BITS_MASK	0xffffffff
45 
46 #define GET_MAX_VALUE(x, y) \
47 	(((x) > (y)) ? (x) : (y))
48 
49 void mv_ddr_ver_print(void);
50 unsigned int ceil_div(unsigned int x, unsigned int y);
51 unsigned int time_to_nclk(unsigned int t, unsigned int tclk);
52 int round_div(unsigned int dividend, unsigned int divisor, unsigned int *quotient);
53 
54 #endif /* _MV_DDR_COMMON_H */
55