* [U-Boot] [PATCH] ads5121: Set offset of NFC registers in device tree.
@ 2008-09-02 21:41 Wolfgang Denk
2008-09-03 14:59 ` John Rigby
0 siblings, 1 reply; 7+ messages in thread
From: Wolfgang Denk @ 2008-09-02 21:41 UTC (permalink / raw)
To: u-boot
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
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [U-Boot] [PATCH] ads5121: Set offset of NFC registers in device tree.
2008-09-02 21:41 [U-Boot] [PATCH] ads5121: Set offset of NFC registers in device tree Wolfgang Denk
@ 2008-09-03 14:59 ` John Rigby
2008-09-03 20:41 ` Wolfgang Denk
0 siblings, 1 reply; 7+ messages in thread
From: John Rigby @ 2008-09-03 14:59 UTC (permalink / raw)
To: u-boot
I'm not sure this right way to deal with this. Even with the modified
offset the 1.5 silicon linux nand driver will not work correctly with
the 2.0 silicon nand controller.
On Tue, Sep 2, 2008 at 3:41 PM, Wolfgang Denk <wd@denx.de> wrote:
> 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
>
> _______________________________________________
> U-Boot mailing list
> U-Boot at lists.denx.de
> http://lists.denx.de/mailman/listinfo/u-boot
>
^ permalink raw reply [flat|nested] 7+ messages in thread
* [U-Boot] [PATCH] ads5121: Set offset of NFC registers in device tree.
2008-09-03 14:59 ` John Rigby
@ 2008-09-03 20:41 ` Wolfgang Denk
2008-09-04 8:13 ` Kenneth Johansson
0 siblings, 1 reply; 7+ messages in thread
From: Wolfgang Denk @ 2008-09-03 20:41 UTC (permalink / raw)
To: u-boot
Dear "John Rigby",
In message <4b73d43f0809030759g123d5146lc9eb5348799b1838@mail.gmail.com> you wrote:
> I'm not sure this right way to deal with this. Even with the modified
> offset the 1.5 silicon linux nand driver will not work correctly with
> the 2.0 silicon nand controller.
That's right - but al least the Linux kernel will not crash if used on
one or the other board.
I think we should fix the NFC base address on the device tree level -
having to support different Linux kernel configurations depending on
if you are on old or new hardware is pretty painful.
Best regards,
Wolfgang Denk
--
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
The man on tops walks a lonely street; the "chain" of command is
often a noose.
^ permalink raw reply [flat|nested] 7+ messages in thread
* [U-Boot] [PATCH] ads5121: Set offset of NFC registers in device tree.
2008-09-03 20:41 ` Wolfgang Denk
@ 2008-09-04 8:13 ` Kenneth Johansson
2008-09-04 15:05 ` Scott Wood
0 siblings, 1 reply; 7+ messages in thread
From: Kenneth Johansson @ 2008-09-04 8:13 UTC (permalink / raw)
To: u-boot
On Wed, 2008-09-03 at 22:41 +0200, Wolfgang Denk wrote:
> Dear "John Rigby",
>
> In message <4b73d43f0809030759g123d5146lc9eb5348799b1838@mail.gmail.com> you wrote:
> > I'm not sure this right way to deal with this. Even with the modified
> > offset the 1.5 silicon linux nand driver will not work correctly with
> > the 2.0 silicon nand controller.
>
> That's right - but al least the Linux kernel will not crash if used on
> one or the other board.
yes but due to the large difference you will probably never se one
driver supporting both version so just changing the name of the hardware
node is probably easier.
> I think we should fix the NFC base address on the device tree level -
> having to support different Linux kernel configurations depending on
> if you are on old or new hardware is pretty painful.
>
> Best regards,
>
> Wolfgang Denk
>
^ permalink raw reply [flat|nested] 7+ messages in thread
* [U-Boot] [PATCH] ads5121: Set offset of NFC registers in device tree.
2008-09-04 8:13 ` Kenneth Johansson
@ 2008-09-04 15:05 ` Scott Wood
2008-09-05 1:21 ` John Rigby
0 siblings, 1 reply; 7+ messages in thread
From: Scott Wood @ 2008-09-04 15:05 UTC (permalink / raw)
To: u-boot
On Thu, Sep 04, 2008 at 10:13:49AM +0200, Kenneth Johansson wrote:
> On Wed, 2008-09-03 at 22:41 +0200, Wolfgang Denk wrote:
> > Dear "John Rigby",
> >
> > In message <4b73d43f0809030759g123d5146lc9eb5348799b1838@mail.gmail.com> you wrote:
> > > I'm not sure this right way to deal with this. Even with the modified
> > > offset the 1.5 silicon linux nand driver will not work correctly with
> > > the 2.0 silicon nand controller.
> >
> > That's right - but al least the Linux kernel will not crash if used on
> > one or the other board.
>
> yes but due to the large difference you will probably never se one
> driver supporting both version so just changing the name of the hardware
> node is probably easier.
s/name/compatible/
-Scott
^ permalink raw reply [flat|nested] 7+ messages in thread
* [U-Boot] [PATCH] ads5121: Set offset of NFC registers in device tree.
2008-09-04 15:05 ` Scott Wood
@ 2008-09-05 1:21 ` John Rigby
2008-09-06 23:15 ` Wolfgang Denk
0 siblings, 1 reply; 7+ messages in thread
From: John Rigby @ 2008-09-05 1:21 UTC (permalink / raw)
To: u-boot
I agree, here are the two device tree entries:
Original silicon rev 1 and 1.5:
compatible = "fsl,mpc5121-nfc";
rev 2:
compatible = "fsl,mpc5121rev2-nfc";
On Thu, Sep 4, 2008 at 9:05 AM, Scott Wood <scottwood@freescale.com> wrote:
> On Thu, Sep 04, 2008 at 10:13:49AM +0200, Kenneth Johansson wrote:
>> On Wed, 2008-09-03 at 22:41 +0200, Wolfgang Denk wrote:
>> > Dear "John Rigby",
>> >
>> > In message <4b73d43f0809030759g123d5146lc9eb5348799b1838@mail.gmail.com> you wrote:
>> > > I'm not sure this right way to deal with this. Even with the modified
>> > > offset the 1.5 silicon linux nand driver will not work correctly with
>> > > the 2.0 silicon nand controller.
>> >
>> > That's right - but al least the Linux kernel will not crash if used on
>> > one or the other board.
>>
>> yes but due to the large difference you will probably never se one
>> driver supporting both version so just changing the name of the hardware
>> node is probably easier.
>
> s/name/compatible/
>
> -Scott
>
^ permalink raw reply [flat|nested] 7+ messages in thread
* [U-Boot] [PATCH] ads5121: Set offset of NFC registers in device tree.
2008-09-05 1:21 ` John Rigby
@ 2008-09-06 23:15 ` Wolfgang Denk
0 siblings, 0 replies; 7+ messages in thread
From: Wolfgang Denk @ 2008-09-06 23:15 UTC (permalink / raw)
To: u-boot
Dear John Rigby,
In message <4b73d43f0809041821g3bada7d5i98954bd6f966f1e2@mail.gmail.com> you wrote:
> I agree, here are the two device tree entries:
> Original silicon rev 1 and 1.5:
> compatible = "fsl,mpc5121-nfc";
> rev 2:
> compatible = "fsl,mpc5121rev2-nfc";
Actually I woner it it makes sense at all to attempt to support the
old (pre-rev. 2 silicon based) hardware at all in newer versions of
U-Boot and Linux. There are only a few boards out in the field, and
those of the customers who are actually doing any work on them will
replace them by new hardware anyway. The others can stick as well with
the existing U-Boot and Linux support.
I vote to support only rev. 2 (and later) silicon in recent versions
of U-Boot and Linux.
Best regards,
Wolfgang Denk
--
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
An optimist believes we live in the best world possible; a pessimist
fears this is true.
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2008-09-06 23:15 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-09-02 21:41 [U-Boot] [PATCH] ads5121: Set offset of NFC registers in device tree Wolfgang Denk
2008-09-03 14:59 ` 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
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox