diff options
author | Andrey Smirnov <andrew.smirnov@gmail.com> | 2018-04-10 16:53:20 -0700 |
---|---|---|
committer | Sascha Hauer <s.hauer@pengutronix.de> | 2018-04-12 09:37:52 +0200 |
commit | 20ddfbdada2d45b3e3da31e498dbfb07b39e4aee (patch) | |
tree | 3f8f14d2d8461b4c881b9e8380527b6bddc8812c /include/memory.h | |
parent | 811547c0eee06d6c9047afa580e9a2d82813fb93 (diff) | |
download | barebox-20ddfbdada2d45b3e3da31e498dbfb07b39e4aee.tar.gz barebox-20ddfbdada2d45b3e3da31e498dbfb07b39e4aee.tar.xz |
ARM: i.MX: esdctl: Introduce memory_sdram_size()
Introduce memory_sdram_size() - subroutine to calculate size of SDRAM
chip base on its parameters such as # or rows, columns, banks and bus
width.
Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'include/memory.h')
-rw-r--r-- | include/memory.h | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/include/memory.h b/include/memory.h index 56d16d20c8..73ee7661ef 100644 --- a/include/memory.h +++ b/include/memory.h @@ -32,4 +32,12 @@ void memory_bank_find_space(struct memory_bank *bank, resource_size_t *retstart, int memory_bank_first_find_space(resource_size_t *retstart, resource_size_t *retend); +static inline u64 memory_sdram_size(unsigned int cols, + unsigned int rows, + unsigned int banks, + unsigned int width) +{ + return (u64)banks * width << (rows + cols); +} + #endif |