From: DrEagle <dreagle@doukki.net>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH 1/8] arm kirkwood - add kirkwood_id
Date: Mon, 08 Jul 2013 01:44:14 +0200 [thread overview]
Message-ID: <51D9FD4E.6030703@doukki.net> (raw)
In-Reply-To: <20130705230848.457e1e24@lilith>
- add kirkwood_id to detect supported devices and revisions
Signed-off-by: drEagle <uboot@doukki.net>
arch/arm/cpu/arm926ejs/kirkwood/cpu.c |
arch/arm/include/asm/arch-kirkwood/cpu.h |
diff --git a/arch/arm/cpu/arm926ejs/kirkwood/cpu.c b/arch/arm/cpu/arm926ejs/kirkwood/cpu.c
index fba5e01..720fccf 100644
--- a/arch/arm/cpu/arm926ejs/kirkwood/cpu.c
+++ b/arch/arm/cpu/arm926ejs/kirkwood/cpu.c
@@ -350,6 +350,64 @@ int arch_cpu_init(void)
}
#endif /* CONFIG_ARCH_CPU_INIT */
+/*****************************************************************************
+ * General
+ ****************************************************************************/
+#if defined(CONFIG_ARCH_DEV_ID)
+
+void kirkwood_pcie_id(u32 *dev, u32 *rev)
+{
+ *dev = (readl(KW_REG_PCIE_DEVID) >> 16) & 0xffff;
+ *rev = readl(KW_REG_PCIE_REVID) & 0xff;
+}
+
+/*
+ * Identify device ID and revision.
+ */
+char *kirkwood_id(void)
+{
+ u32 dev, rev;
+
+ kirkwood_pcie_id(&dev, &rev);
+
+ if (dev == MV88F6281_DEV_ID) {
+ if (rev == MV88F6281_REV_Z0)
+ return "MV88F6281-Z0";
+ else if (rev == MV88F6281_REV_A0)
+ return "MV88F6281-A0";
+ else if (rev == MV88F6281_REV_A1)
+ return "MV88F6281-A1";
+ else
+ return "MV88F6281-Rev-Unsupported";
+ } else if (dev == MV88F6192_DEV_ID) {
+ if (rev == MV88F6192_REV_Z0)
+ return "MV88F6192-Z0";
+ else if (rev == MV88F6192_REV_A0)
+ return "MV88F6192-A0";
+ else if (rev == MV88F6192_REV_A1)
+ return "MV88F6192-A1";
+ else
+ return "MV88F6192-Rev-Unsupported";
+ } else if (dev == MV88F6180_DEV_ID) {
+ if (rev == MV88F6180_REV_A0)
+ return "MV88F6180-Rev-A0";
+ else if (rev == MV88F6180_REV_A1)
+ return "MV88F6180-Rev-A1";
+ else
+ return "MV88F6180-Rev-Unsupported";
+ } else if (dev == MV88F6282_DEV_ID) {
+ if (rev == MV88F6282_REV_A0)
+ return "MV88F6282-Rev-A0";
+ else if (rev == MV88F6282_REV_A1)
+ return "MV88F6282-Rev-A1";
+ else
+ return "MV88F6282-Rev-Unsupported";
+ } else {
+ return "Device-Unknown";
+ }
+}
+#endif /* CONFIG_ARCH_DEV_ID */
+
/*
* SOC specific misc init
*/
--- a/arch/arm/include/asm/arch-kirkwood/cpu.h
+++ b/arch/arm/include/asm/arch-kirkwood/cpu.h
@@ -167,5 +167,7 @@ int kw_config_mpp(unsigned int mpp0_7, unsigned int mpp8_15,
unsigned int mpp32_39, unsigned int mpp40_47,
unsigned int mpp48_55);
unsigned int kw_winctrl_calcsize(unsigned int sizeval);
+void kirkwood_pcie_id(u32 *dev, u32 *rev);
+char *kirkwood_id(void);
#endif /* __ASSEMBLY__ */
#endif /* _KWCPU_H */
next prev parent reply other threads:[~2013-07-07 23:44 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-07-02 21:17 [U-Boot] Marvell SheevaPlug v2013.04 Refresh (ask for review) DrEagle
2013-07-05 21:08 ` Albert ARIBAUD
2013-07-07 23:41 ` DrEagle
2013-07-08 9:46 ` Albert ARIBAUD
2013-07-07 23:43 ` [U-Boot] [PATCH 0/8] arm kirkwood - sheevaplug refresh DrEagle
2013-07-07 23:44 ` DrEagle [this message]
2013-07-07 23:44 ` [U-Boot] [PATCH 2/8] arm kirkwood update supported devices and revisions DrEagle
2013-07-07 23:45 ` [U-Boot] [PATCH 3/8] arm kirkwood add kw88f6282 support DrEagle
2013-07-07 23:46 ` [U-Boot] [PATCH 4/8] arm kirkwood add MVSDIO driver v3 DrEagle
2013-07-07 23:47 ` [U-Boot] [PATCH 5/8] arm kirkwood add MVSDIO kirkwood support DrEagle
2013-07-07 23:47 ` [U-Boot] [PATCH 6/8] arm kirkwood add MVSDIO sheevaplug support DrEagle
2013-07-07 23:48 ` [U-Boot] [PATCH 7/8] arm kirkwood add MVSATA " DrEagle
2013-07-07 23:49 ` [U-Boot] [PATCH 8/8] arm kirkwood update sheevaplug defaults config DrEagle
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=51D9FD4E.6030703@doukki.net \
--to=dreagle@doukki.net \
--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