From: "Álvaro Fernández Rojas" <noltari@gmail.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH 3/6] dm: ram: bmips: split bcm6358_get_ram_size
Date: Sat, 13 May 2017 01:23:24 +0200 [thread overview]
Message-ID: <1494631407-28655-4-git-send-email-noltari@gmail.com> (raw)
In-Reply-To: <1494631407-28655-1-git-send-email-noltari@gmail.com>
This is done in order to reuse ram size calculation for BCM6338/BCM6348
Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
---
drivers/ram/bmips_ram.c | 23 +++++++++++++----------
1 file changed, 13 insertions(+), 10 deletions(-)
diff --git a/drivers/ram/bmips_ram.c b/drivers/ram/bmips_ram.c
index d0f7cd7..382e231 100644
--- a/drivers/ram/bmips_ram.c
+++ b/drivers/ram/bmips_ram.c
@@ -40,24 +40,27 @@ static ulong bcm6328_get_ram_size(struct bmips_ram_priv *priv)
return readl_be(priv->regs + DDR_CSEND_REG) << 24;
}
+static ulong bmips_dram_size(unsigned int cols, unsigned int rows,
+ unsigned int is_32b, unsigned int banks)
+{
+ rows += 11; /* 0 => 11 address bits ... 2 => 13 address bits */
+ cols += 8; /* 0 => 8 address bits ... 2 => 10 address bits */
+ is_32b += 1;
+
+ return 1 << (cols + rows + is_32b + banks);
+}
+
static ulong bcm6358_get_ram_size(struct bmips_ram_priv *priv)
{
- unsigned int cols = 0, rows = 0, is_32bits = 0, banks = 0;
+ unsigned int cols = 0, rows = 0, is_32b = 0;
u32 val;
val = readl_be(priv->regs + MEMC_CFG_REG);
rows = (val & MEMC_CFG_ROW_MASK) >> MEMC_CFG_ROW_SHIFT;
cols = (val & MEMC_CFG_COL_MASK) >> MEMC_CFG_COL_SHIFT;
- is_32bits = (val & MEMC_CFG_32B_MASK) ? 0 : 1;
- banks = 2;
-
- /* 0 => 11 address bits ... 2 => 13 address bits */
- rows += 11;
-
- /* 0 => 8 address bits ... 2 => 10 address bits */
- cols += 8;
+ is_32b = (val & MEMC_CFG_32B_MASK) ? 0 : 1;
- return 1 << (cols + rows + (is_32bits + 1) + banks);
+ return bmips_dram_size(cols, rows, is_32b, 2);
}
static int bmips_ram_get_info(struct udevice *dev, struct ram_info *info)
--
2.1.4
next prev parent reply other threads:[~2017-05-12 23:23 UTC|newest]
Thread overview: 28+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-05-12 23:23 [U-Boot] [PATCH 0/6] mips: bmips: add BCM6348 SoC support Álvaro Fernández Rojas
2017-05-12 23:23 ` [U-Boot] [PATCH 1/6] dm: cpu: bmips: rename cpu_desc specific functions Álvaro Fernández Rojas
2017-05-16 0:18 ` Simon Glass
2017-05-12 23:23 ` [U-Boot] [PATCH 2/6] dm: cpu: bmips: add BCM6348 support Álvaro Fernández Rojas
2017-05-12 23:23 ` Álvaro Fernández Rojas [this message]
2017-05-12 23:23 ` [U-Boot] [PATCH 4/6] dm: cpu: bmips: add BCM6338/BCM6348 support Álvaro Fernández Rojas
2017-05-16 0:18 ` Simon Glass
2017-05-12 23:23 ` [U-Boot] [PATCH 5/6] MIPS: add support for Broadcom MIPS BCM6348 SoC family Álvaro Fernández Rojas
2017-05-12 23:23 ` [U-Boot] [PATCH 6/6] MIPS: add BMIPS Comtrend CT-5361 board Álvaro Fernández Rojas
2017-05-15 17:13 ` [U-Boot] [PATCH v2 0/6] mips: bmips: add BCM6348 SoC support Álvaro Fernández Rojas
2017-05-15 17:13 ` [U-Boot] [PATCH v2 1/6] dm: cpu: bmips: rename cpu_desc specific functions Álvaro Fernández Rojas
2017-05-15 17:13 ` [U-Boot] [PATCH v2 2/6] dm: cpu: bmips: add BCM6348 support Álvaro Fernández Rojas
2017-05-16 0:18 ` Simon Glass
2017-05-15 17:13 ` [U-Boot] [PATCH v2 3/6] dm: ram: bmips: split bcm6358_get_ram_size Álvaro Fernández Rojas
2017-05-16 0:18 ` Simon Glass
2017-05-15 17:13 ` [U-Boot] [PATCH v2 4/6] dm: ram: bmips: add BCM6338/BCM6348 support Álvaro Fernández Rojas
2017-05-15 17:13 ` [U-Boot] [PATCH v2 5/6] MIPS: add support for Broadcom MIPS BCM6348 SoC family Álvaro Fernández Rojas
2017-05-16 0:18 ` Simon Glass
2017-05-15 17:13 ` [U-Boot] [PATCH v2 6/6] MIPS: add BMIPS Comtrend CT-5361 board Álvaro Fernández Rojas
2017-05-16 0:18 ` Simon Glass
2017-05-16 16:38 ` [U-Boot] [PATCH v3 0/6] mips: bmips: add BCM6348 SoC support* Álvaro Fernández Rojas
2017-05-16 16:38 ` [U-Boot] [PATCH v3 1/6] dm: cpu: bmips: rename cpu_desc specific functions Álvaro Fernández Rojas
2017-05-16 16:39 ` [U-Boot] [PATCH v3 2/6] dm: cpu: bmips: add BCM6348 support Álvaro Fernández Rojas
2017-05-16 16:39 ` [U-Boot] [PATCH v3 3/6] dm: ram: bmips: split bcm6358_get_ram_size Álvaro Fernández Rojas
2017-05-16 16:39 ` [U-Boot] [PATCH v3 4/6] dm: ram: bmips: add BCM6338/BCM6348 support Álvaro Fernández Rojas
2017-05-16 16:39 ` [U-Boot] [PATCH v3 5/6] MIPS: add support for Broadcom MIPS BCM6348 SoC family Álvaro Fernández Rojas
2017-05-16 16:39 ` [U-Boot] [PATCH v3 6/6] MIPS: add BMIPS Comtrend CT-5361 board Álvaro Fernández Rojas
2017-05-20 16:08 ` [U-Boot] [PATCH v3 0/6] mips: bmips: add BCM6348 SoC support* Daniel Schwierzeck
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1494631407-28655-4-git-send-email-noltari@gmail.com \
--to=noltari@gmail.com \
--cc=u-boot@lists.denx.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox