From: Wolfgang Denk <wd@denx.de>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH] ads5121: Set offset of NFC registers in device tree.
Date: Tue, 2 Sep 2008 23:41:40 +0200 [thread overview]
Message-ID: <1220391700-2155-1-git-send-email-wd@denx.de> (raw)
From: Grzegorz Bernacki <gjb@semihalf.com>
Offset of NFC register has changed in rev 2 of SoC.
U-Boot passes information about it in <offset> property of nfc node.
Signed-off-by: Grzegorz Bernacki <gjb@semihalf.com>
Signed-off-by: Wolfgang Denk <wd@denx.de>
---
board/ads5121/ads5121.c | 33 +++++++++++++++++++++++++++++++++
include/mpc512x.h | 4 ++++
2 files changed, 37 insertions(+), 0 deletions(-)
diff --git a/board/ads5121/ads5121.c b/board/ads5121/ads5121.c
index deaa292..a6cba28 100644
--- a/board/ads5121/ads5121.c
+++ b/board/ads5121/ads5121.c
@@ -27,6 +27,7 @@
#include <command.h>
#include <asm/processor.h>
#include <fdt_support.h>
+#include <libfdt.h>
#ifdef CONFIG_MISC_INIT_R
#include <i2c.h>
#endif
@@ -306,9 +307,41 @@ int checkboard (void)
}
#if defined(CONFIG_OF_LIBFDT) && defined(CONFIG_OF_BOARD_SETUP)
+static int fdt_set_nfc_offset(void* blob)
+{
+ int err, nodeoffset;
+ unsigned int offset;
+ volatile immap_t *im = (immap_t *) CFG_IMMR;
+
+ if (SVR_MJREV (im->sysconf.spridr) >= 2)
+ offset = NFC_REV2_REG_OFFSET;
+ else
+ offset = NFC_REG_OFFSET;
+
+ err = fdt_check_header(blob);
+ if (err < 0) {
+ printf("%s: %s\n", __FUNCTION__, fdt_strerror(err));
+ return err;
+ }
+
+ /* update nfc node */
+ nodeoffset = fdt_path_offset(blob, "/nfc");
+ if (nodeoffset < 0)
+ return 0;
+
+ err = fdt_setprop(blob, nodeoffset, "offset", &offset, sizeof(offset));
+ if (err < 0) {
+ printf("WARNING: could not set NFC offset property %s.\n",
+ fdt_strerror(err));
+ return err;
+ }
+
+}
+
void ft_board_setup(void *blob, bd_t *bd)
{
ft_cpu_setup(blob, bd);
fdt_fixup_memory(blob, (u64)bd->bi_memstart, (u64)bd->bi_memsize);
+ fdt_set_nfc_offset(blob);
}
#endif /* defined(CONFIG_OF_LIBFDT) && defined(CONFIG_OF_BOARD_SETUP) */
diff --git a/include/mpc512x.h b/include/mpc512x.h
index cb418d1..12f95fb 100644
--- a/include/mpc512x.h
+++ b/include/mpc512x.h
@@ -674,4 +674,8 @@ void iopin_initialize(iopin_t *,int);
#define PIWAR_IWS_1G 0x0000001D
#define PIWAR_IWS_2G 0x0000001E
+/* NAND Flash controller registers offset */
+#define NFC_REG_OFFSET 0x0E00
+#define NFC_REV2_REG_OFFSET 0x1E00
+
#endif /* __MPC512X_H__ */
--
1.5.4.2
next reply other threads:[~2008-09-02 21:41 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-09-02 21:41 Wolfgang Denk [this message]
2008-09-03 14:59 ` [U-Boot] [PATCH] ads5121: Set offset of NFC registers in device tree John Rigby
2008-09-03 20:41 ` Wolfgang Denk
2008-09-04 8:13 ` Kenneth Johansson
2008-09-04 15:05 ` Scott Wood
2008-09-05 1:21 ` John Rigby
2008-09-06 23:15 ` Wolfgang Denk
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=1220391700-2155-1-git-send-email-wd@denx.de \
--to=wd@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox