blob: 321a390c0d3092eb606b5f611a57597edbec9563 [file] [log] [blame]
Chris Packham1a07d212018-05-10 13:28:29 +12001/* 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
9extern const char mv_ddr_build_message[];
10extern const char mv_ddr_version_string[];
11
Chris Packham4bf81db2018-12-03 14:26:49 +130012#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)
Chris Packham1a07d212018-05-10 13:28:29 +120044#define MV_DDR_32_BITS_MASK 0xffffffff
45
Chris Packham4bf81db2018-12-03 14:26:49 +130046#define GET_MAX_VALUE(x, y) \
47 (((x) > (y)) ? (x) : (y))
48
49void mv_ddr_ver_print(void);
Chris Packham1a07d212018-05-10 13:28:29 +120050unsigned int ceil_div(unsigned int x, unsigned int y);
51unsigned int time_to_nclk(unsigned int t, unsigned int tclk);
52int round_div(unsigned int dividend, unsigned int divisor, unsigned int *quotient);
53
54#endif /* _MV_DDR_COMMON_H */