[U-Boot] [PATCH resend 7/7] mtd/st_smi: Add mtd support for smi

Stefan Roese sr at denx.de
Thu Dec 6 09:02:36 CET 2012


On 12/06/2012 07:21 AM, Vipin Kumar wrote:
> This patch adds mtd device support for smi devices
> 
> Signed-off-by: Vipin Kumar <vipin.kumar at st.com>
> ---
>  drivers/mtd/st_smi.c | 167 ++++++++++++++++++++++++++++++++++++++++++++++++++-
>  1 file changed, 165 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/mtd/st_smi.c b/drivers/mtd/st_smi.c
> index 0e529a4..4d1a6bd 100644
> --- a/drivers/mtd/st_smi.c
> +++ b/drivers/mtd/st_smi.c
> @@ -24,6 +24,7 @@
>  #include <common.h>
>  #include <flash.h>
>  #include <linux/err.h>
> +#include <linux/mtd/mtd.h>
>  #include <linux/mtd/st_smi.h>
>  
>  #include <asm/io.h>
> @@ -37,6 +38,14 @@ static ulong bank_base[CONFIG_SYS_MAX_FLASH_BANKS] =
>      CONFIG_SYS_FLASH_ADDR_BASE;
>  flash_info_t flash_info[CONFIG_SYS_MAX_FLASH_BANKS];
>  
> +#if defined(CONFIG_MTD_DEVICE)
> +/* MTD interface for SMI devices */
> +static struct mtd_info smi_mtd_info[CONFIG_SYS_MAX_FLASH_BANKS];
> +static char smi_mtd_names[CONFIG_SYS_MAX_FLASH_BANKS][16];
> +
> +static int smi_mtd_init(void);
> +#endif
> +
>  /* data structure to maintain flash ids from different vendors */
>  struct flash_device {
>  	char *name;
> @@ -482,7 +491,9 @@ unsigned long flash_init(void)
>  {
>  	unsigned long size = 0;
>  	int i, j;
> -
> +#if defined(CONFIG_MTD_DEVICE)
> +	int error;
> +#endif

Hmm, I don't like all those new #ifdef's. Can't we instead add a dummy
smi_mtd_init() functions for the non-MTD version? Something like:

#if defined(CONFIG_MTD_DEVICE)
/* MTD interface for SMI devices */
static struct mtd_info smi_mtd_info[CONFIG_SYS_MAX_FLASH_BANKS];
static char smi_mtd_names[CONFIG_SYS_MAX_FLASH_BANKS][16];

static int smi_mtd_init(void);
#else
static int smi_mtd_init(void)
{
	return 0;
}
#endif

What do you think?

Thanks,
Stefan



More information about the U-Boot mailing list