From: "Pali Rohár" <pali@kernel.org>
To: Stefan Roese <sr@denx.de>, Michael Walle <michael@walle.cc>
Cc: u-boot@lists.denx.de
Subject: [PATCH] arm: kirkwood: 88f6281: Detect CONFIG_SYS_TCLK from SAR register
Date: Tue, 16 Aug 2022 22:00:16 +0200 [thread overview]
Message-ID: <20220816200016.18288-1-pali@kernel.org> (raw)
Bit 21 in SAR register specifies if TCLK is running at 166 MHz or 200 MHz.
This information is undocumented in public Marvell Kirkwood Functional
Specifications [2], but is available in Linux v3.15 kirkwood code [1].
Commit 8ac303d49f89 ("arm: kirkwood: Do not overwrite CONFIG_SYS_TCLK")
broke support for Marvell 88F6281 SoCs because it was expected that all
those SoCs have TCLK running at 200 MHz as specified in Marvell 88F6281
Hardware Specifications [3].
Fix broken support for 88F6281 by detecting CONFIG_SYS_TCLK from SAR
register, like it was doing Linux v3.15.
[1] - https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/tree/arch/arm/mach-kirkwood/common.c?h=v3.15#n542
[2] - https://web.archive.org/web/20130730091033/http://www.marvell.com/embedded-processors/kirkwood/assets/FS_88F6180_9x_6281_OpenSource.pdf
[3] - https://web.archive.org/web/20120620073511/http://www.marvell.com/embedded-processors/kirkwood/assets/HW_88F6281_OpenSource.pdf
Fixes: 8ac303d49f89 ("arm: kirkwood: Do not overwrite CONFIG_SYS_TCLK")
Signed-off-by: Pali Rohár <pali@kernel.org>
---
Michael, please test this patch, if it fixes your boards.
---
arch/arm/mach-kirkwood/include/mach/kw88f6281.h | 3 ++-
arch/arm/mach-kirkwood/include/mach/soc.h | 2 ++
2 files changed, 4 insertions(+), 1 deletion(-)
diff --git a/arch/arm/mach-kirkwood/include/mach/kw88f6281.h b/arch/arm/mach-kirkwood/include/mach/kw88f6281.h
index 87406081cf54..f86cd0bb6013 100644
--- a/arch/arm/mach-kirkwood/include/mach/kw88f6281.h
+++ b/arch/arm/mach-kirkwood/include/mach/kw88f6281.h
@@ -15,6 +15,7 @@
#define KW_REGS_PHY_BASE KW88F6281_REGS_PHYS_BASE
/* TCLK Core Clock definition */
-#define CONFIG_SYS_TCLK 200000000 /* 200MHz */
+#define CONFIG_SYS_TCLK ((readl(CONFIG_SAR_REG) & BIT(21)) ? \
+ 166666667 : 200000000)
#endif /* _ASM_ARCH_KW88F6281_H */
diff --git a/arch/arm/mach-kirkwood/include/mach/soc.h b/arch/arm/mach-kirkwood/include/mach/soc.h
index 1d7f2828cd38..5f545c6f4349 100644
--- a/arch/arm/mach-kirkwood/include/mach/soc.h
+++ b/arch/arm/mach-kirkwood/include/mach/soc.h
@@ -62,6 +62,8 @@
#define MVCPU_WIN_ENABLE KWCPU_WIN_ENABLE
#define MVCPU_WIN_DISABLE KWCPU_WIN_DISABLE
+#define CONFIG_SAR_REG (KW_MPP_BASE + 0x0030)
+
#if defined (CONFIG_KW88F6281)
#include <asm/arch/kw88f6281.h>
#elif defined (CONFIG_KW88F6192)
--
2.20.1
next reply other threads:[~2022-08-16 20:00 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-08-16 20:00 Pali Rohár [this message]
2022-08-16 21:34 ` [PATCH] arm: kirkwood: 88f6281: Detect CONFIG_SYS_TCLK from SAR register Michael Walle
2022-08-16 22:14 ` Pali Rohár
2022-08-16 22:39 ` Pali Rohár
2022-08-16 23:23 ` Michael Walle
2022-08-17 8:36 ` Pali Rohár
2022-08-17 8:43 ` Michael Walle
2022-08-17 9:13 ` Michael Walle
2022-08-17 10:42 ` Stefan Roese
2022-08-17 11:17 ` Pali Rohár
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=20220816200016.18288-1-pali@kernel.org \
--to=pali@kernel.org \
--cc=michael@walle.cc \
--cc=sr@denx.de \
--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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.