Re: [PATCH v2 5/7] MTD: NAND: ams-delta: use GPIO instead of custom I/O

2011-12-21 Thread Artem Bityutskiy
On Tue, 2011-12-20 at 00:08 +0100, Janusz Krzysztofik wrote:
> Don't use Amstrad Delta custom I/O functions for controlling the device,
> use GPIO API instead.
> 
> While being at it, add missing gpio_free(AMS_DELTA_GPIO_PIN_NAND_RB).
> 
> Depends on patch 2/7 "ARM: OMAP1: ams-delta: convert latches to
> basic_mmio_gpio"
> 
> Signed-off-by: Janusz Krzysztofik 
> Cc: David Woodhouse 
> Cc: Tony Lindgren 

Looks good, thanks!

Reviewed-by: Artem Bityutskiy 

--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH v2 5/7] MTD: NAND: ams-delta: use GPIO instead of custom I/O

2011-12-21 Thread Janusz Krzysztofik
On Wednesday 21 of December 2011 at 20:12:12, Tony Lindgren wrote:
> * Janusz Krzysztofik  [111219 14:41]:
> > Don't use Amstrad Delta custom I/O functions for controlling the device,
> > use GPIO API instead.
> > 
> > While being at it, add missing gpio_free(AMS_DELTA_GPIO_PIN_NAND_RB).
> > 
> > Depends on patch 2/7 "ARM: OMAP1: ams-delta: convert latches to
> > basic_mmio_gpio"
> > 
> > Signed-off-by: Janusz Krzysztofik 
> > Cc: David Woodhouse 
> > Cc: Tony Lindgren 
> 
> Artem, care to ack this one?


BTW, following the get_maintainer.pl script suggestions, I tried to 
include Artem in the Cc: list, but that script provided me with an 
invalid Artem's email address at nokia.com, and I gave up once my email 
gateway refused to accept that message. Now I've verified that several 
half or more year old commits signed by Artem were the sources of that 
apparently outdated information. Looks like the get_maintainer.pl script 
needs improvement, or should be used with care by people who don't 
follow all email address changes ;).

Thanks,
Janusz
--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH v2 5/7] MTD: NAND: ams-delta: use GPIO instead of custom I/O

2011-12-21 Thread Tony Lindgren
* Janusz Krzysztofik  [111219 14:41]:
> Don't use Amstrad Delta custom I/O functions for controlling the device,
> use GPIO API instead.
> 
> While being at it, add missing gpio_free(AMS_DELTA_GPIO_PIN_NAND_RB).
> 
> Depends on patch 2/7 "ARM: OMAP1: ams-delta: convert latches to
> basic_mmio_gpio"
> 
> Signed-off-by: Janusz Krzysztofik 
> Cc: David Woodhouse 
> Cc: Tony Lindgren 

Artem, care to ack this one?

Regards,

Tony


> ---
> Changes against initial version:
> * no functional changes,
> * rebased on top of v2 of patch 2/7, just in case.
> 
> Comments copied from initial submission:
> 
> Hi,
> I considered dropping the Amstrad Delta NAND driver and moving to either
> gpio-nand or gen_nand, but finally decided to keep it for now.
> 
> The problem with the gpio-nand is that it seems to match a different
> hardware interface model. Having no knowledge about the original
> hardware that driver was designed in mind, I'd rather not try to
> modify it, and creating another GPIO based NAND driver also seems not
> a really good idea.
> 
> If I decided to use gen_nand instead, I would have to move virtually all
> of the old driver callback functions somewhere under arch, either to the
> board file or to a new one, and still use some hacks unless either
> nand_base.c or plat_nand.c is modified.
> 
> I'm willing to take one of those two approaches in a follow up series if
> I get a positive feedback.
> 
> Thanks,
> Janusz
> 
> 
>  arch/arm/mach-omap1/board-ams-delta.c |   30 
>  arch/arm/plat-omap/include/plat/board-ams-delta.h |6 --
>  drivers/mtd/nand/ams-delta.c  |   74 ++--
>  3 files changed, 52 insertions(+), 58 deletions(-)
> 
> diff --git a/arch/arm/mach-omap1/board-ams-delta.c 
> b/arch/arm/mach-omap1/board-ams-delta.c
> index 034d009..cc6f962 100644
> --- a/arch/arm/mach-omap1/board-ams-delta.c
> +++ b/arch/arm/mach-omap1/board-ams-delta.c
> @@ -237,36 +237,6 @@ static struct gpio latch_gpios[] __initconst = {
>   .label  = "lcd_ndisp",
>   },
>   {
> - .gpio   = AMS_DELTA_GPIO_PIN_NAND_NCE,
> - .flags  = GPIOF_OUT_INIT_LOW,
> - .label  = "nand_nce",
> - },
> - {
> - .gpio   = AMS_DELTA_GPIO_PIN_NAND_NRE,
> - .flags  = GPIOF_OUT_INIT_LOW,
> - .label  = "nand_nre",
> - },
> - {
> - .gpio   = AMS_DELTA_GPIO_PIN_NAND_NWP,
> - .flags  = GPIOF_OUT_INIT_LOW,
> - .label  = "nand_nwp",
> - },
> - {
> - .gpio   = AMS_DELTA_GPIO_PIN_NAND_NWE,
> - .flags  = GPIOF_OUT_INIT_LOW,
> - .label  = "nand_nwe",
> - },
> - {
> - .gpio   = AMS_DELTA_GPIO_PIN_NAND_ALE,
> - .flags  = GPIOF_OUT_INIT_LOW,
> - .label  = "nand_ale",
> - },
> - {
> - .gpio   = AMS_DELTA_GPIO_PIN_NAND_CLE,
> - .flags  = GPIOF_OUT_INIT_LOW,
> - .label  = "nand_cle",
> - },
> - {
>   .gpio   = AMS_DELTA_GPIO_PIN_KEYBRD_PWR,
>   .flags  = GPIOF_OUT_INIT_LOW,
>   .label  = "keybrd_pwr",
> diff --git a/arch/arm/plat-omap/include/plat/board-ams-delta.h 
> b/arch/arm/plat-omap/include/plat/board-ams-delta.h
> index a0f86ca..3e57833 100644
> --- a/arch/arm/plat-omap/include/plat/board-ams-delta.h
> +++ b/arch/arm/plat-omap/include/plat/board-ams-delta.h
> @@ -30,12 +30,6 @@
>  
>  #define AMS_DELTA_LATCH2_LCD_VBLEN   0x0001
>  #define AMS_DELTA_LATCH2_LCD_NDISP   0x0002
> -#define AMS_DELTA_LATCH2_NAND_NCE0x0004
> -#define AMS_DELTA_LATCH2_NAND_NRE0x0008
> -#define AMS_DELTA_LATCH2_NAND_NWP0x0010
> -#define AMS_DELTA_LATCH2_NAND_NWE0x0020
> -#define AMS_DELTA_LATCH2_NAND_ALE0x0040
> -#define AMS_DELTA_LATCH2_NAND_CLE0x0080
>  #define AMD_DELTA_LATCH2_KEYBRD_PWR  0x0100
>  #define AMD_DELTA_LATCH2_KEYBRD_DATA 0x0200
>  #define AMD_DELTA_LATCH2_SCARD_RSTIN 0x0400
> diff --git a/drivers/mtd/nand/ams-delta.c b/drivers/mtd/nand/ams-delta.c
> index 9e6b498..5769bd2 100644
> --- a/drivers/mtd/nand/ams-delta.c
> +++ b/drivers/mtd/nand/ams-delta.c
> @@ -26,7 +26,7 @@
>  #include 
>  #include 
>  #include 
> -#include 
> +#include 
>  #include 
>  
>  /*
> @@ -34,8 +34,6 @@
>   */
>  static struct mtd_info *ams_delta_mtd = NULL;
>  
> -#define NAND_MASK (AMS_DELTA_LATCH2_NAND_NRE | AMS_DELTA_LATCH2_NAND_NWE | 
> AMS_DELTA_LATCH2_NAND_CLE | AMS_DELTA_LATCH2_NAND_ALE | 
> AMS_DELTA_LATCH2_NAND_NCE | AMS_DELTA_LATCH2_NAND_NWP)
> -
>  /*
>   * Define partitions for flash devices
>   */
> @@ -68,10 +66,9 @@ static void ams_delta_write_byte(struct mtd_info *mtd, 
> u_char byte)
>  
>   writew(0, io_base + OMAP_MPUIO_IO_CNTL);
>   writew(byte, this->IO_ADDR_W);
> - ams_delta_latch2_write(AMS_DELTA_LATCH2_NAND_NWE, 0);
> + gpio_set_value(AMS_DELTA_GPIO_PIN_NAND_NWE, 0);
>   ndelay(40);
> - ams_delta_latch2_write(AMS_DELTA_LATCH2_NAND_NWE,
> - 

[PATCH v2 5/7] MTD: NAND: ams-delta: use GPIO instead of custom I/O

2011-12-19 Thread Janusz Krzysztofik
Don't use Amstrad Delta custom I/O functions for controlling the device,
use GPIO API instead.

While being at it, add missing gpio_free(AMS_DELTA_GPIO_PIN_NAND_RB).

Depends on patch 2/7 "ARM: OMAP1: ams-delta: convert latches to
basic_mmio_gpio"

Signed-off-by: Janusz Krzysztofik 
Cc: David Woodhouse 
Cc: Tony Lindgren 
---
Changes against initial version:
* no functional changes,
* rebased on top of v2 of patch 2/7, just in case.

Comments copied from initial submission:

Hi,
I considered dropping the Amstrad Delta NAND driver and moving to either
gpio-nand or gen_nand, but finally decided to keep it for now.

The problem with the gpio-nand is that it seems to match a different
hardware interface model. Having no knowledge about the original
hardware that driver was designed in mind, I'd rather not try to
modify it, and creating another GPIO based NAND driver also seems not
a really good idea.

If I decided to use gen_nand instead, I would have to move virtually all
of the old driver callback functions somewhere under arch, either to the
board file or to a new one, and still use some hacks unless either
nand_base.c or plat_nand.c is modified.

I'm willing to take one of those two approaches in a follow up series if
I get a positive feedback.

Thanks,
Janusz


 arch/arm/mach-omap1/board-ams-delta.c |   30 
 arch/arm/plat-omap/include/plat/board-ams-delta.h |6 --
 drivers/mtd/nand/ams-delta.c  |   74 ++--
 3 files changed, 52 insertions(+), 58 deletions(-)

diff --git a/arch/arm/mach-omap1/board-ams-delta.c 
b/arch/arm/mach-omap1/board-ams-delta.c
index 034d009..cc6f962 100644
--- a/arch/arm/mach-omap1/board-ams-delta.c
+++ b/arch/arm/mach-omap1/board-ams-delta.c
@@ -237,36 +237,6 @@ static struct gpio latch_gpios[] __initconst = {
.label  = "lcd_ndisp",
},
{
-   .gpio   = AMS_DELTA_GPIO_PIN_NAND_NCE,
-   .flags  = GPIOF_OUT_INIT_LOW,
-   .label  = "nand_nce",
-   },
-   {
-   .gpio   = AMS_DELTA_GPIO_PIN_NAND_NRE,
-   .flags  = GPIOF_OUT_INIT_LOW,
-   .label  = "nand_nre",
-   },
-   {
-   .gpio   = AMS_DELTA_GPIO_PIN_NAND_NWP,
-   .flags  = GPIOF_OUT_INIT_LOW,
-   .label  = "nand_nwp",
-   },
-   {
-   .gpio   = AMS_DELTA_GPIO_PIN_NAND_NWE,
-   .flags  = GPIOF_OUT_INIT_LOW,
-   .label  = "nand_nwe",
-   },
-   {
-   .gpio   = AMS_DELTA_GPIO_PIN_NAND_ALE,
-   .flags  = GPIOF_OUT_INIT_LOW,
-   .label  = "nand_ale",
-   },
-   {
-   .gpio   = AMS_DELTA_GPIO_PIN_NAND_CLE,
-   .flags  = GPIOF_OUT_INIT_LOW,
-   .label  = "nand_cle",
-   },
-   {
.gpio   = AMS_DELTA_GPIO_PIN_KEYBRD_PWR,
.flags  = GPIOF_OUT_INIT_LOW,
.label  = "keybrd_pwr",
diff --git a/arch/arm/plat-omap/include/plat/board-ams-delta.h 
b/arch/arm/plat-omap/include/plat/board-ams-delta.h
index a0f86ca..3e57833 100644
--- a/arch/arm/plat-omap/include/plat/board-ams-delta.h
+++ b/arch/arm/plat-omap/include/plat/board-ams-delta.h
@@ -30,12 +30,6 @@
 
 #define AMS_DELTA_LATCH2_LCD_VBLEN 0x0001
 #define AMS_DELTA_LATCH2_LCD_NDISP 0x0002
-#define AMS_DELTA_LATCH2_NAND_NCE  0x0004
-#define AMS_DELTA_LATCH2_NAND_NRE  0x0008
-#define AMS_DELTA_LATCH2_NAND_NWP  0x0010
-#define AMS_DELTA_LATCH2_NAND_NWE  0x0020
-#define AMS_DELTA_LATCH2_NAND_ALE  0x0040
-#define AMS_DELTA_LATCH2_NAND_CLE  0x0080
 #define AMD_DELTA_LATCH2_KEYBRD_PWR0x0100
 #define AMD_DELTA_LATCH2_KEYBRD_DATA   0x0200
 #define AMD_DELTA_LATCH2_SCARD_RSTIN   0x0400
diff --git a/drivers/mtd/nand/ams-delta.c b/drivers/mtd/nand/ams-delta.c
index 9e6b498..5769bd2 100644
--- a/drivers/mtd/nand/ams-delta.c
+++ b/drivers/mtd/nand/ams-delta.c
@@ -26,7 +26,7 @@
 #include 
 #include 
 #include 
-#include 
+#include 
 #include 
 
 /*
@@ -34,8 +34,6 @@
  */
 static struct mtd_info *ams_delta_mtd = NULL;
 
-#define NAND_MASK (AMS_DELTA_LATCH2_NAND_NRE | AMS_DELTA_LATCH2_NAND_NWE | 
AMS_DELTA_LATCH2_NAND_CLE | AMS_DELTA_LATCH2_NAND_ALE | 
AMS_DELTA_LATCH2_NAND_NCE | AMS_DELTA_LATCH2_NAND_NWP)
-
 /*
  * Define partitions for flash devices
  */
@@ -68,10 +66,9 @@ static void ams_delta_write_byte(struct mtd_info *mtd, 
u_char byte)
 
writew(0, io_base + OMAP_MPUIO_IO_CNTL);
writew(byte, this->IO_ADDR_W);
-   ams_delta_latch2_write(AMS_DELTA_LATCH2_NAND_NWE, 0);
+   gpio_set_value(AMS_DELTA_GPIO_PIN_NAND_NWE, 0);
ndelay(40);
-   ams_delta_latch2_write(AMS_DELTA_LATCH2_NAND_NWE,
-  AMS_DELTA_LATCH2_NAND_NWE);
+   gpio_set_value(AMS_DELTA_GPIO_PIN_NAND_NWE, 1);
 }
 
 static u_char ams_delta_read_byte(struct mtd_info *mtd)
@@ -80,12 +77,11 @@ static u_char ams_delta_read_byte(struct mtd_info *mtd)
struct