Re: [PATCH 08/10] ARM: OMAP2/3: Add generic onenand support when connected to GPMC

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, May 19, 2009 at 04:41:23PM -0700, Tony Lindgren wrote:
> +#if defined(CONFIG_MTD_ONENAND_OMAP2) || \
> +	defined(CONFIG_MTD_ONENAND_OMAP2_MODULE)
...
> +static void __init board_onenand_init(void)
> +{
> +	gpmc_onenand_init(&board_onenand_data);
> +}
> +
> +#endif
>  
>  void __init rx51_peripherals_init(void)
>  {
> @@ -415,5 +466,6 @@ void __init rx51_peripherals_init(void)
>  				ARRAY_SIZE(rx51_peripherals_devices));
>  	rx51_i2c_init();
>  	rx51_init_smc91x();
> +	board_onenand_init();

This breaks without onenand support.

> diff --git a/arch/arm/mach-omap2/gpmc-onenand.c b/arch/arm/mach-omap2/gpmc-onenand.c
> new file mode 100644
> index 0000000..712af59
> --- /dev/null
> +++ b/arch/arm/mach-omap2/gpmc-onenand.c
> @@ -0,0 +1,340 @@
> +/*
> + * linux/arch/arm/mach-omap2/gpmc-onenand.c
> + *
> + * Copyright (C) 2006 - 2009 Nokia Corporation
> + * Contacts:	Juha Yrjola
> + *		Tony Lindgren
> + *
> + * This program is free software; you can redistribute it and/or modify
> + * it under the terms of the GNU General Public License version 2 as
> + * published by the Free Software Foundation.
> + */
> +
> +#include <linux/kernel.h>
> +#include <linux/platform_device.h>
> +#include <asm/mach/flash.h>
> +#include <linux/mtd/onenand_regs.h>
> +
> +#include <linux/io.h>

linux/ includes together please (without asm/ includes mixed in).

> +static unsigned short omap2_onenand_readw(void __iomem *addr)
> +{
> +	return readw(addr);
> +}
> +
> +static void omap2_onenand_writew(unsigned short value, void __iomem *addr)
> +{
> +	writew(value, addr);
> +}

These two are pointless.  Just use readw/writew directly.

> diff --git a/arch/arm/plat-omap/include/mach/onenand.h b/arch/arm/plat-omap/include/mach/onenand.h
> index 4649d30..94cde73 100644
> --- a/arch/arm/plat-omap/include/mach/onenand.h
> +++ b/arch/arm/plat-omap/include/mach/onenand.h
> @@ -9,8 +9,14 @@
>   * published by the Free Software Foundation.
>   */
>  
> +#include <linux/mtd/mtd.h>
>  #include <linux/mtd/partitions.h>
>  
> +#ifndef __ASM_ARCH_OMAP_ONENAND_H__

This provides no protection against multiple includes on its own.  You're
missing a #define of this symbol.

> +
> +#define ONENAND_SYNC_READ	(1 << 0)
> +#define ONENAND_SYNC_READWRITE	(1 << 1)
> +
>  struct omap_onenand_platform_data {
>  	int			cs;
>  	int			gpio_irq;
> @@ -18,8 +24,27 @@ struct omap_onenand_platform_data {
>  	int			nr_parts;
>  	int                     (*onenand_setup)(void __iomem *, int freq);
>  	int			dma_channel;
> +	u8			flags;
>  };
>  
> -int omap2_onenand_rephase(void);
> -
>  #define ONENAND_MAX_PARTITIONS 8
> +
> +#if defined(CONFIG_MTD_ONENAND_OMAP2) || \
> +	defined(CONFIG_MTD_ONENAND_OMAP2_MODULE)
> +
> +extern void gpmc_onenand_init(struct omap_onenand_platform_data *d);
> +
> +#else
> +
> +#define board_onenand_data	NULL
> +
> +static inline void board_onenand_init(void)
> +{
> +}

Eww, you put it in a different file.  Disgusting.  Please put it in the
_same_ file as the place it's used.

> +
> +static inline void gpmc_onenand_init(struct omap_onenand_platform_data *d)
> +{
> +}
> +
> +#endif
> +#endif
> 
> 
> -------------------------------------------------------------------
> List admin: http://lists.arm.linux.org.uk/mailman/listinfo/linux-arm-kernel
> FAQ:        http://www.arm.linux.org.uk/mailinglists/faq.php
> Etiquette:  http://www.arm.linux.org.uk/mailinglists/etiquette.php
--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Arm (vger)]     [ARM Kernel]     [ARM MSM]     [Linux Tegra]     [Linux WPAN Networking]     [Linux Wireless Networking]     [Maemo Users]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite Trails]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux