public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: "Álvaro Fernández Rojas" <noltari@gmail.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH 1/4] dm: cpu: bmips: add BCM6318 support
Date: Sat, 20 Jan 2018 14:17:22 +0100	[thread overview]
Message-ID: <20180120131725.4451-2-noltari@gmail.com> (raw)
In-Reply-To: <20180120131725.4451-1-noltari@gmail.com>

Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
---
 drivers/cpu/bmips_cpu.c | 35 +++++++++++++++++++++++++++++++++++
 1 file changed, 35 insertions(+)

diff --git a/drivers/cpu/bmips_cpu.c b/drivers/cpu/bmips_cpu.c
index 2e3f1de74e..1fe5d106d0 100644
--- a/drivers/cpu/bmips_cpu.c
+++ b/drivers/cpu/bmips_cpu.c
@@ -26,6 +26,10 @@ DECLARE_GLOBAL_DATA_PTR;
 #define REG_BCM6328_OTP			0x62c
 #define BCM6328_TP1_DISABLED		BIT(9)
 
+#define REG_BCM6328_STRAP_OVRDBUS	0x900
+#define OVRDBUS_6318_FREQ_SHIFT		23
+#define OVRDBUS_6318_FREQ_MASK		(0x3 << OVRDBUS_6318_FREQ_SHIFT)
+
 #define REG_BCM6328_MISC_STRAPBUS	0x1a40
 #define STRAPBUS_6328_FCVO_SHIFT	7
 #define STRAPBUS_6328_FCVO_MASK		(0x1f << STRAPBUS_6328_FCVO_SHIFT)
@@ -112,6 +116,28 @@ static ulong bcm3380_get_cpu_freq(struct bmips_cpu_priv *priv)
 	return 333000000;
 }
 
+static ulong bcm6318_get_cpu_freq(struct bmips_cpu_priv *priv)
+{
+	unsigned int mips_pll_fcvo;
+
+	mips_pll_fcvo = readl_be(priv->regs + REG_BCM6328_STRAP_OVRDBUS);
+	mips_pll_fcvo = (mips_pll_fcvo & OVRDBUS_6318_FREQ_MASK)
+			>> OVRDBUS_6318_FREQ_SHIFT;
+
+	switch (mips_pll_fcvo) {
+	case 0:
+		return 166000000;
+	case 1:
+		return 400000000;
+	case 2:
+		return 250000000;
+	case 3:
+		return 333000000;
+	default:
+		return 0;
+	}
+}
+
 static ulong bcm6328_get_cpu_freq(struct bmips_cpu_priv *priv)
 {
 	unsigned int mips_pll_fcvo;
@@ -233,6 +259,12 @@ static const struct bmips_cpu_hw bmips_cpu_bcm3380 = {
 	.get_cpu_count = bcm6358_get_cpu_count,
 };
 
+static const struct bmips_cpu_hw bmips_cpu_bcm6318 = {
+	.get_cpu_desc = bmips_short_cpu_desc,
+	.get_cpu_freq = bcm6318_get_cpu_freq,
+	.get_cpu_count = bcm6345_get_cpu_count,
+};
+
 static const struct bmips_cpu_hw bmips_cpu_bcm6328 = {
 	.get_cpu_desc = bmips_long_cpu_desc,
 	.get_cpu_freq = bcm6328_get_cpu_freq,
@@ -348,6 +380,9 @@ static const struct udevice_id bmips_cpu_ids[] = {
 		.compatible = "brcm,bcm3380-cpu",
 		.data = (ulong)&bmips_cpu_bcm3380,
 	}, {
+		.compatible = "brcm,bcm6318-cpu",
+		.data = (ulong)&bmips_cpu_bcm6318,
+	}, {
 		.compatible = "brcm,bcm6328-cpu",
 		.data = (ulong)&bmips_cpu_bcm6328,
 	}, {
-- 
2.11.0

  reply	other threads:[~2018-01-20 13:17 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-01-20 13:17 [U-Boot] [PATCH 0/4] mips: bmips: add BCM6318 SoC support Álvaro Fernández Rojas
2018-01-20 13:17 ` Álvaro Fernández Rojas [this message]
2018-01-20 13:17 ` [U-Boot] [PATCH 2/4] dm: ram: bmips: add BCM6318 support Álvaro Fernández Rojas
2018-01-20 13:17 ` [U-Boot] [PATCH 3/4] MIPS: add support for Broadcom MIPS BCM6318 SoC family Álvaro Fernández Rojas
2018-01-20 13:17 ` [U-Boot] [PATCH 4/4] MIPS: add BMIPS Comtrend AR-5315u board Álvaro Fernández Rojas
2018-01-20 18:16 ` [U-Boot] [PATCH v2 0/4] mips: bmips: add BCM6318 SoC support Álvaro Fernández Rojas
2018-01-20 18:16   ` [U-Boot] [PATCH v2 1/4] dm: cpu: bmips: add BCM6318 support Álvaro Fernández Rojas
2018-01-21 16:47     ` Daniel Schwierzeck
2018-01-21 17:04     ` Daniel Schwierzeck
2018-01-20 18:16   ` [U-Boot] [PATCH v2 2/4] dm: ram: " Álvaro Fernández Rojas
2018-01-21 16:47     ` Daniel Schwierzeck
2018-01-21 17:03     ` Daniel Schwierzeck
2018-01-20 18:16   ` [U-Boot] [PATCH v2 3/4] MIPS: add support for Broadcom MIPS BCM6318 SoC family Álvaro Fernández Rojas
2018-01-21 16:47     ` Daniel Schwierzeck
2018-01-20 18:16   ` [U-Boot] [PATCH v2 4/4] MIPS: add BMIPS Comtrend AR-5315u board Álvaro Fernández Rojas
2018-01-21 16:48     ` Daniel Schwierzeck
2018-01-26 12:17 ` [U-Boot] [PATCH 0/4] mips: bmips: add BCM6318 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=20180120131725.4451-2-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