[U-Boot] [PATCH] ads5121: Set offset of NFC registers in device tree.

John Rigby jcrigby at gmail.com
Wed Sep 3 16:59:32 CEST 2008


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 at denx.de> wrote:
> From: Grzegorz Bernacki <gjb at 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 at semihalf.com>
> Signed-off-by: Wolfgang Denk <wd at 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
>


More information about the U-Boot mailing list