* [PATCH] omap: cleanup NAND platform data
@ 2011-06-03 19:56 Grazvydas Ignotas
  2011-06-03 21:14 ` Vimal Singh
  0 siblings, 1 reply; 4+ messages in thread
From: Grazvydas Ignotas @ 2011-06-03 19:56 UTC (permalink / raw)
  To: linux-arm-kernel
omap_nand_platform_data fields 'options', 'gpio_irq', 'nand_setup' and
'dma_channel' are never referenced by the NAND driver, yet various
board files are initializing those fields. This is both incorrect and
confusing, so remove them. This allows to get rid of a global
variable in gpmc-nand.c.
This also corrects an issue where some boards are trying to pass NAND
16bit flag through .options, but the driver is using .devsize instead
and ignoring .options.
Finally, .dev_ready is treated as a flag by the driver, so make it bool
instead of a function pointer.
Signed-off-by: Grazvydas Ignotas <notasas@gmail.com>
---
 arch/arm/mach-omap2/board-cm-t35.c         |    2 --
 arch/arm/mach-omap2/board-cm-t3517.c       |    1 -
 arch/arm/mach-omap2/board-flash.c          |    4 ----
 arch/arm/mach-omap2/common-board-devices.c |    6 ++----
 arch/arm/mach-omap2/gpmc-nand.c            |   10 +++-------
 arch/arm/plat-omap/include/plat/nand.h     |    6 +-----
 6 files changed, 6 insertions(+), 23 deletions(-)
diff --git a/arch/arm/mach-omap2/board-cm-t35.c b/arch/arm/mach-omap2/board-cm-t35.c
index c63115b..99238e6 100644
--- a/arch/arm/mach-omap2/board-cm-t35.c
+++ b/arch/arm/mach-omap2/board-cm-t35.c
@@ -164,9 +164,7 @@ static struct mtd_partition cm_t35_nand_partitions[] = {
 static struct omap_nand_platform_data cm_t35_nand_data = {
 	.parts			= cm_t35_nand_partitions,
 	.nr_parts		= ARRAY_SIZE(cm_t35_nand_partitions),
-	.dma_channel		= -1,	/* disable DMA in OMAP NAND driver */
 	.cs			= 0,
-
 };
 
 static void __init cm_t35_init_nand(void)
diff --git a/arch/arm/mach-omap2/board-cm-t3517.c b/arch/arm/mach-omap2/board-cm-t3517.c
index 08f08e8..c80d862 100644
--- a/arch/arm/mach-omap2/board-cm-t3517.c
+++ b/arch/arm/mach-omap2/board-cm-t3517.c
@@ -237,7 +237,6 @@ static struct mtd_partition cm_t3517_nand_partitions[] = {
 static struct omap_nand_platform_data cm_t3517_nand_data = {
 	.parts			= cm_t3517_nand_partitions,
 	.nr_parts		= ARRAY_SIZE(cm_t3517_nand_partitions),
-	.dma_channel		= -1,	/* disable DMA in OMAP NAND driver */
 	.cs			= 0,
 };
 
diff --git a/arch/arm/mach-omap2/board-flash.c b/arch/arm/mach-omap2/board-flash.c
index 729892f..aa1b0cb 100644
--- a/arch/arm/mach-omap2/board-flash.c
+++ b/arch/arm/mach-omap2/board-flash.c
@@ -132,11 +132,7 @@ static struct gpmc_timings nand_timings = {
 };
 
 static struct omap_nand_platform_data board_nand_data = {
-	.nand_setup	= NULL,
 	.gpmc_t		= &nand_timings,
-	.dma_channel	= -1,		/* disable DMA in OMAP NAND driver */
-	.dev_ready	= NULL,
-	.devsize	= 0,	/* '0' for 8-bit, '1' for 16-bit device */
 };
 
 void
diff --git a/arch/arm/mach-omap2/common-board-devices.c b/arch/arm/mach-omap2/common-board-devices.c
index e94903b..366171d 100644
--- a/arch/arm/mach-omap2/common-board-devices.c
+++ b/arch/arm/mach-omap2/common-board-devices.c
@@ -115,9 +115,7 @@ void __init omap_ads7846_init(int bus_num, int gpio_pendown, int gpio_debounce,
 #endif
 
 #if defined(CONFIG_MTD_NAND_OMAP2) || defined(CONFIG_MTD_NAND_OMAP2_MODULE)
-static struct omap_nand_platform_data nand_data = {
-	.dma_channel	= -1,		/* disable DMA in OMAP NAND driver */
-};
+static struct omap_nand_platform_data nand_data;
 
 void __init omap_nand_flash_init(int options, struct mtd_partition *parts,
 				 int nr_parts)
@@ -148,7 +146,7 @@ void __init omap_nand_flash_init(int options, struct mtd_partition *parts,
 		nand_data.cs = nandcs;
 		nand_data.parts = parts;
 		nand_data.nr_parts = nr_parts;
-		nand_data.options = options;
+		nand_data.devsize = options;
 
 		printk(KERN_INFO "Registering NAND on CS%d\n", nandcs);
 		if (gpmc_nand_init(&nand_data) < 0)
diff --git a/arch/arm/mach-omap2/gpmc-nand.c b/arch/arm/mach-omap2/gpmc-nand.c
index c1791d0..8ad210b 100644
--- a/arch/arm/mach-omap2/gpmc-nand.c
+++ b/arch/arm/mach-omap2/gpmc-nand.c
@@ -20,8 +20,6 @@
 #include <plat/board.h>
 #include <plat/gpmc.h>
 
-static struct omap_nand_platform_data *gpmc_nand_data;
-
 static struct resource gpmc_nand_resource = {
 	.flags		= IORESOURCE_MEM,
 };
@@ -33,7 +31,7 @@ static struct platform_device gpmc_nand_device = {
 	.resource	= &gpmc_nand_resource,
 };
 
-static int omap2_nand_gpmc_retime(void)
+static int omap2_nand_gpmc_retime(struct omap_nand_platform_data *gpmc_nand_data)
 {
 	struct gpmc_timings t;
 	int err;
@@ -83,13 +81,11 @@ static int omap2_nand_gpmc_retime(void)
 	return 0;
 }
 
-int __init gpmc_nand_init(struct omap_nand_platform_data *_nand_data)
+int __init gpmc_nand_init(struct omap_nand_platform_data *gpmc_nand_data)
 {
 	int err	= 0;
 	struct device *dev = &gpmc_nand_device.dev;
 
-	gpmc_nand_data = _nand_data;
-	gpmc_nand_data->nand_setup = omap2_nand_gpmc_retime;
 	gpmc_nand_device.dev.platform_data = gpmc_nand_data;
 
 	err = gpmc_cs_request(gpmc_nand_data->cs, NAND_IO_SIZE,
@@ -100,7 +96,7 @@ int __init gpmc_nand_init(struct omap_nand_platform_data *_nand_data)
 	}
 
 	 /* Set timings in GPMC */
-	err = omap2_nand_gpmc_retime();
+	err = omap2_nand_gpmc_retime(gpmc_nand_data);
 	if (err < 0) {
 		dev_err(dev, "Unable to set gpmc timings: %d\n", err);
 		return err;
diff --git a/arch/arm/plat-omap/include/plat/nand.h b/arch/arm/plat-omap/include/plat/nand.h
index d86d1ec..67fc506 100644
--- a/arch/arm/plat-omap/include/plat/nand.h
+++ b/arch/arm/plat-omap/include/plat/nand.h
@@ -19,15 +19,11 @@ enum nand_io {
 };
 
 struct omap_nand_platform_data {
-	unsigned int		options;
 	int			cs;
-	int			gpio_irq;
 	struct mtd_partition	*parts;
 	struct gpmc_timings	*gpmc_t;
 	int			nr_parts;
-	int			(*nand_setup)(void);
-	int			(*dev_ready)(struct omap_nand_platform_data *);
-	int			dma_channel;
+	bool			dev_ready;
 	int			gpmc_irq;
 	enum nand_io		xfer_type;
 	unsigned long		phys_base;
-- 
1.7.0.4
^ permalink raw reply related	[flat|nested] 4+ messages in thread- * [PATCH] omap: cleanup NAND platform data
  2011-06-03 19:56 [PATCH] omap: cleanup NAND platform data Grazvydas Ignotas
@ 2011-06-03 21:14 ` Vimal Singh
  2011-06-03 22:05   ` Grazvydas Ignotas
  0 siblings, 1 reply; 4+ messages in thread
From: Vimal Singh @ 2011-06-03 21:14 UTC (permalink / raw)
  To: linux-arm-kernel
On Sat, Jun 4, 2011 at 1:26 AM, Grazvydas Ignotas <notasas@gmail.com> wrote:
> omap_nand_platform_data fields 'options', 'gpio_irq', 'nand_setup' and
> 'dma_channel' are never referenced by the NAND driver, yet various
> board files are initializing those fields. This is both incorrect and
> confusing, so remove them. This allows to get rid of a global
> variable in gpmc-nand.c.
>
> This also corrects an issue where some boards are trying to pass NAND
> 16bit flag through .options, but the driver is using .devsize instead
> and ignoring .options.
>
> Finally, .dev_ready is treated as a flag by the driver, so make it bool
> instead of a function pointer.
>
> Signed-off-by: Grazvydas Ignotas <notasas@gmail.com>
> ---
> ?arch/arm/mach-omap2/board-cm-t35.c ? ? ? ? | ? ?2 --
> ?arch/arm/mach-omap2/board-cm-t3517.c ? ? ? | ? ?1 -
> ?arch/arm/mach-omap2/board-flash.c ? ? ? ? ?| ? ?4 ----
> ?arch/arm/mach-omap2/common-board-devices.c | ? ?6 ++----
> ?arch/arm/mach-omap2/gpmc-nand.c ? ? ? ? ? ?| ? 10 +++-------
> ?arch/arm/plat-omap/include/plat/nand.h ? ? | ? ?6 +-----
> ?6 files changed, 6 insertions(+), 23 deletions(-)
>
> diff --git a/arch/arm/mach-omap2/board-cm-t35.c b/arch/arm/mach-omap2/board-cm-t35.c
> index c63115b..99238e6 100644
> --- a/arch/arm/mach-omap2/board-cm-t35.c
> +++ b/arch/arm/mach-omap2/board-cm-t35.c
> @@ -164,9 +164,7 @@ static struct mtd_partition cm_t35_nand_partitions[] = {
> ?static struct omap_nand_platform_data cm_t35_nand_data = {
> ? ? ? ?.parts ? ? ? ? ? ? ? ? ?= cm_t35_nand_partitions,
> ? ? ? ?.nr_parts ? ? ? ? ? ? ? = ARRAY_SIZE(cm_t35_nand_partitions),
> - ? ? ? .dma_channel ? ? ? ? ? ?= -1, ? /* disable DMA in OMAP NAND driver */
> ? ? ? ?.cs ? ? ? ? ? ? ? ? ? ? = 0,
> -
> ?};
>
> ?static void __init cm_t35_init_nand(void)
> diff --git a/arch/arm/mach-omap2/board-cm-t3517.c b/arch/arm/mach-omap2/board-cm-t3517.c
> index 08f08e8..c80d862 100644
> --- a/arch/arm/mach-omap2/board-cm-t3517.c
> +++ b/arch/arm/mach-omap2/board-cm-t3517.c
> @@ -237,7 +237,6 @@ static struct mtd_partition cm_t3517_nand_partitions[] = {
> ?static struct omap_nand_platform_data cm_t3517_nand_data = {
> ? ? ? ?.parts ? ? ? ? ? ? ? ? ?= cm_t3517_nand_partitions,
> ? ? ? ?.nr_parts ? ? ? ? ? ? ? = ARRAY_SIZE(cm_t3517_nand_partitions),
> - ? ? ? .dma_channel ? ? ? ? ? ?= -1, ? /* disable DMA in OMAP NAND driver */
> ? ? ? ?.cs ? ? ? ? ? ? ? ? ? ? = 0,
> ?};
>
> diff --git a/arch/arm/mach-omap2/board-flash.c b/arch/arm/mach-omap2/board-flash.c
> index 729892f..aa1b0cb 100644
> --- a/arch/arm/mach-omap2/board-flash.c
> +++ b/arch/arm/mach-omap2/board-flash.c
> @@ -132,11 +132,7 @@ static struct gpmc_timings nand_timings = {
> ?};
>
> ?static struct omap_nand_platform_data board_nand_data = {
> - ? ? ? .nand_setup ? ? = NULL,
> ? ? ? ?.gpmc_t ? ? ? ? = &nand_timings,
> - ? ? ? .dma_channel ? ?= -1, ? ? ? ? ? /* disable DMA in OMAP NAND driver */
> - ? ? ? .dev_ready ? ? ?= NULL,
> - ? ? ? .devsize ? ? ? ?= 0, ? ?/* '0' for 8-bit, '1' for 16-bit device */
> ?};
>
> ?void
> diff --git a/arch/arm/mach-omap2/common-board-devices.c b/arch/arm/mach-omap2/common-board-devices.c
> index e94903b..366171d 100644
> --- a/arch/arm/mach-omap2/common-board-devices.c
> +++ b/arch/arm/mach-omap2/common-board-devices.c
> @@ -115,9 +115,7 @@ void __init omap_ads7846_init(int bus_num, int gpio_pendown, int gpio_debounce,
> ?#endif
>
> ?#if defined(CONFIG_MTD_NAND_OMAP2) || defined(CONFIG_MTD_NAND_OMAP2_MODULE)
> -static struct omap_nand_platform_data nand_data = {
> - ? ? ? .dma_channel ? ?= -1, ? ? ? ? ? /* disable DMA in OMAP NAND driver */
> -};
> +static struct omap_nand_platform_data nand_data;
>
> ?void __init omap_nand_flash_init(int options, struct mtd_partition *parts,
> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? int nr_parts)
> @@ -148,7 +146,7 @@ void __init omap_nand_flash_init(int options, struct mtd_partition *parts,
> ? ? ? ? ? ? ? ?nand_data.cs = nandcs;
> ? ? ? ? ? ? ? ?nand_data.parts = parts;
> ? ? ? ? ? ? ? ?nand_data.nr_parts = nr_parts;
> - ? ? ? ? ? ? ? nand_data.options = options;
> + ? ? ? ? ? ? ? nand_data.devsize = options;
>
> ? ? ? ? ? ? ? ?printk(KERN_INFO "Registering NAND on CS%d\n", nandcs);
> ? ? ? ? ? ? ? ?if (gpmc_nand_init(&nand_data) < 0)
> diff --git a/arch/arm/mach-omap2/gpmc-nand.c b/arch/arm/mach-omap2/gpmc-nand.c
> index c1791d0..8ad210b 100644
> --- a/arch/arm/mach-omap2/gpmc-nand.c
> +++ b/arch/arm/mach-omap2/gpmc-nand.c
> @@ -20,8 +20,6 @@
> ?#include <plat/board.h>
> ?#include <plat/gpmc.h>
>
> -static struct omap_nand_platform_data *gpmc_nand_data;
> -
> ?static struct resource gpmc_nand_resource = {
> ? ? ? ?.flags ? ? ? ? ?= IORESOURCE_MEM,
> ?};
> @@ -33,7 +31,7 @@ static struct platform_device gpmc_nand_device = {
> ? ? ? ?.resource ? ? ? = &gpmc_nand_resource,
> ?};
>
> -static int omap2_nand_gpmc_retime(void)
> +static int omap2_nand_gpmc_retime(struct omap_nand_platform_data *gpmc_nand_data)
> ?{
> ? ? ? ?struct gpmc_timings t;
> ? ? ? ?int err;
> @@ -83,13 +81,11 @@ static int omap2_nand_gpmc_retime(void)
> ? ? ? ?return 0;
> ?}
>
> -int __init gpmc_nand_init(struct omap_nand_platform_data *_nand_data)
> +int __init gpmc_nand_init(struct omap_nand_platform_data *gpmc_nand_data)
> ?{
> ? ? ? ?int err = 0;
> ? ? ? ?struct device *dev = &gpmc_nand_device.dev;
>
> - ? ? ? gpmc_nand_data = _nand_data;
> - ? ? ? gpmc_nand_data->nand_setup = omap2_nand_gpmc_retime;
Purpose of doing this was to be able to utilise
'omap2_nand_gpmc_retime', when DVFS is ready to use it,
for changing timing parameter dynamically when a frequency change is done.
-- 
Regards,
Vimal Singh
^ permalink raw reply	[flat|nested] 4+ messages in thread
- * [PATCH] omap: cleanup NAND platform data
  2011-06-03 21:14 ` Vimal Singh
@ 2011-06-03 22:05   ` Grazvydas Ignotas
  2011-06-29  8:12     ` Tony Lindgren
  0 siblings, 1 reply; 4+ messages in thread
From: Grazvydas Ignotas @ 2011-06-03 22:05 UTC (permalink / raw)
  To: linux-arm-kernel
On Sat, Jun 4, 2011 at 12:14 AM, Vimal Singh <vimal.newwork@gmail.com> wrote:
> On Sat, Jun 4, 2011 at 1:26 AM, Grazvydas Ignotas <notasas@gmail.com> wrote:
>>
>> -static int omap2_nand_gpmc_retime(void)
>> +static int omap2_nand_gpmc_retime(struct omap_nand_platform_data *gpmc_nand_data)
>> ?{
>> ? ? ? ?struct gpmc_timings t;
>> ? ? ? ?int err;
>> @@ -83,13 +81,11 @@ static int omap2_nand_gpmc_retime(void)
>> ? ? ? ?return 0;
>> ?}
>>
>> -int __init gpmc_nand_init(struct omap_nand_platform_data *_nand_data)
>> +int __init gpmc_nand_init(struct omap_nand_platform_data *gpmc_nand_data)
>> ?{
>> ? ? ? ?int err = 0;
>> ? ? ? ?struct device *dev = &gpmc_nand_device.dev;
>>
>> - ? ? ? gpmc_nand_data = _nand_data;
>> - ? ? ? gpmc_nand_data->nand_setup = omap2_nand_gpmc_retime;
>
> Purpose of doing this was to be able to utilise
> 'omap2_nand_gpmc_retime', when DVFS is ready to use it,
> for changing timing parameter dynamically when a frequency change is done.
Well but it seems currently ...retime() only does single static
configuration, I guess when it's updated to do DVFS stuff callback can
easily be added back..
^ permalink raw reply	[flat|nested] 4+ messages in thread
- * [PATCH] omap: cleanup NAND platform data
  2011-06-03 22:05   ` Grazvydas Ignotas
@ 2011-06-29  8:12     ` Tony Lindgren
  0 siblings, 0 replies; 4+ messages in thread
From: Tony Lindgren @ 2011-06-29  8:12 UTC (permalink / raw)
  To: linux-arm-kernel
* Grazvydas Ignotas <notasas@gmail.com> [110603 15:01]:
> On Sat, Jun 4, 2011 at 12:14 AM, Vimal Singh <vimal.newwork@gmail.com> wrote:
> > On Sat, Jun 4, 2011 at 1:26 AM, Grazvydas Ignotas <notasas@gmail.com> wrote:
> >>
> >> -static int omap2_nand_gpmc_retime(void)
> >> +static int omap2_nand_gpmc_retime(struct omap_nand_platform_data *gpmc_nand_data)
> >> ?{
> >> ? ? ? ?struct gpmc_timings t;
> >> ? ? ? ?int err;
> >> @@ -83,13 +81,11 @@ static int omap2_nand_gpmc_retime(void)
> >> ? ? ? ?return 0;
> >> ?}
> >>
> >> -int __init gpmc_nand_init(struct omap_nand_platform_data *_nand_data)
> >> +int __init gpmc_nand_init(struct omap_nand_platform_data *gpmc_nand_data)
> >> ?{
> >> ? ? ? ?int err = 0;
> >> ? ? ? ?struct device *dev = &gpmc_nand_device.dev;
> >>
> >> - ? ? ? gpmc_nand_data = _nand_data;
> >> - ? ? ? gpmc_nand_data->nand_setup = omap2_nand_gpmc_retime;
> >
> > Purpose of doing this was to be able to utilise
> > 'omap2_nand_gpmc_retime', when DVFS is ready to use it,
> > for changing timing parameter dynamically when a frequency change is done.
> 
> Well but it seems currently ...retime() only does single static
> configuration, I guess when it's updated to do DVFS stuff callback can
> easily be added back..
Applying this into devel-cleanup.
Regards,
Tony
^ permalink raw reply	[flat|nested] 4+ messages in thread
 
 
end of thread, other threads:[~2011-06-29  8:12 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-06-03 19:56 [PATCH] omap: cleanup NAND platform data Grazvydas Ignotas
2011-06-03 21:14 ` Vimal Singh
2011-06-03 22:05   ` Grazvydas Ignotas
2011-06-29  8:12     ` Tony Lindgren
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).