[PATCH 4/4] mtd: nand: raw: atmel: Remove duplicate definitions

Eugen Hristev eugen.hristev at collabora.com
Tue Dec 19 15:32:07 CET 2023


On 12/12/23 18:04, Alexander Dahl wrote:
> These removed definitions were specific to some sam9 SoCs, but not
> generic over all at91 SoCs.  The correct SoC specific definitions for
> ATMEL_BASE_PMECC are spread over different header files in
> arch/arm/mach-at91/include/mach directory.
> 
> Fixes a build error on a custon board based on SAMA5D2:
> 
>     Building current source for 73 boards (16 threads, 1 job per thread)
>            arm:  +   vera2
>     +drivers/mtd/nand/raw/atmel/pmecc.c:819: warning: "ATMEL_BASE_PMECC" redefined
>     +  819 | #define ATMEL_BASE_PMECC        0xffffe000
>     +      |
>     +In file included from include/configs/vera2.h:11,
>     +                 from include/config.h:3,
>     +                 from include/linux/mtd/rawnand.h:16,
>     +                 from drivers/mtd/nand/raw/atmel/pmecc.c:44:
>     +include/asm/arch/sama5d2.h:171: note: this is the location of the previous definition
>     +  171 | #define ATMEL_BASE_PMECC        (ATMEL_BASE_HSMC + 0x70)
>     +drivers/mtd/nand/raw/atmel/pmecc.c:820: warning: "ATMEL_BASE_PMERRLOC" redefined
>     +  820 | #define ATMEL_BASE_PMERRLOC     0xffffe600
>     +include/asm/arch/sama5d2.h:172: note: this is the location of the previous definition
>     +  172 | #define ATMEL_BASE_PMERRLOC     (ATMEL_BASE_HSMC + 0x500)
> 
> Fixes: a490e1b7c017 ("nand: atmel: Add pmecc driver")
> Signed-off-by: Alexander Dahl <ada at thorsis.com>
> ---
>  drivers/mtd/nand/raw/atmel/pmecc.c | 3 ---
>  1 file changed, 3 deletions(-)
> 
> diff --git a/drivers/mtd/nand/raw/atmel/pmecc.c b/drivers/mtd/nand/raw/atmel/pmecc.c
> index e2e3f1ee6b5..51f6bd2e65b 100644
> --- a/drivers/mtd/nand/raw/atmel/pmecc.c
> +++ b/drivers/mtd/nand/raw/atmel/pmecc.c
> @@ -816,9 +816,6 @@ int atmel_pmecc_wait_rdy(struct atmel_pmecc_user *user)
>  }
>  EXPORT_SYMBOL_GPL(atmel_pmecc_wait_rdy);
>  
> -#define ATMEL_BASE_PMECC	0xffffe000
> -#define ATMEL_BASE_PMERRLOC	0xffffe600
> -
>  static struct atmel_pmecc *
>  atmel_pmecc_create(struct udevice *dev,
>  		   const struct atmel_pmecc_caps *caps,


Hi Alexander,

What happens if we try to select and build this driver without
sama5d2/sama5d3/sama5d4/sam9x5/sam9x60 ?
Is it even possible ?
Because it appears these defines are done for those SoCs in their mach header, but
the driver uses them in any situation. And currently, these warnings are being
ignored if the driver is built with sama5d2/sama5d3/sama5d4/sam9x5/sam9x60 ? or the
driver actually isn't even built with these platforms at all ?

So, I guess it would be safer to do #ifndef ATMEL_BASE_PMECC, #define ...

Or, we could fix the driver to get these base addresses from the platform/DT ?

Eugen


More information about the U-Boot mailing list