[PATCH 3/3] ls1046ardb: enable IFC NAND.

Barbier, Renaud renaud.barbier at abaco.com
Tue Aug 10 03:33:09 PDT 2021



> diff --git a/arch/arm/boards/ls1046ardb/board.c 
> b/arch/arm/boards/ls1046ardb/board.c
> index ef68e9c7f9..b2cfba58a8 100644
> --- a/arch/arm/boards/ls1046ardb/board.c
> +++ b/arch/arm/boards/ls1046ardb/board.c
> @@ -8,10 +8,12 @@
>  #include <fs.h>
>  #include <envfs.h>
>  #include <libfile.h>
> +#include <of_address.h>
>  #include <asm/memory.h>
>  #include <linux/sizes.h>
>  #include <linux/clk.h>
>  #include <linux/clkdev.h>
> +#include <linux/fsl_ifc.h>
>  #include <asm/system.h>
>  #include <mach/layerscape.h>
>  #include <mach/bbu.h>
> @@ -35,6 +37,11 @@ struct nxid {
>       u32 crc;          /* 0xfc - 0xff CRC32 checksum */
>  } __packed;
>
> +static const struct of_device_id fsl_ifc_of_ids[] = {
> +     { .compatible = "fsl,ifc", },
> +     { },
> +};
> +
>  static int nxid_is_valid(struct nxid *nxid)  {
>       unsigned char id[] = { 'N', 'X', 'I', 'D' }; @@ -161,3 +168,38 
> @@ static int rdb_postcore_init(void)  }
>
>  postcore_initcall(rdb_postcore_init);
> +
> +static int rdb_nand_init(void)
> +{
> +     struct device_node *np;
> +     void __iomem *ifc;
> +

If you think this configuration should be done for _all_ boards, you should move it to arch/arm/mach-layerscape. If you intend it to be done only for this specific board, you should check the board compatible, otherwise this function is called even for boards that don't have NAND physically. Throwing an error there is inappropriate. If this is board-specific, please add:


        if (!of_machine_is_compatible("fsl,ls1046a-rdb"))

                return 0;

> +     np = of_find_matching_node(NULL, fsl_ifc_of_ids);

You can use of_find_compatible_node, which lets you drop the struct.



Indeed, this makes sense as we are going to have our own board support in a few months.



More information about the barebox mailing list