aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/mtd
diff options
context:
space:
mode:
authorAlexander Shiyan <shc_work@mail.ru>2012-10-17 02:08:27 -0400
committerArtem Bityutskiy <artem.bityutskiy@linux.intel.com>2012-11-15 08:37:50 -0500
commit18afbc54c4944b6c93f3888d97db0d1257a4b5e9 (patch)
tree4d619de5e0d0e9d30bdf3a975c082ac24dc40131 /drivers/mtd
parent7483096665161d2567c2717e001654ad653d944e (diff)
mtd: gpio-nand: Ability to use driver for configurations without RDY-pin
In some configurations of "gpio-nand" RDY-pin may be not connected. This patch allow to use driver for these configurations. In this case we are assume that device always ready. Signed-off-by: Alexander Shiyan <shc_work@mail.ru> Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
Diffstat (limited to 'drivers/mtd')
-rw-r--r--drivers/mtd/nand/gpio.c22
1 files changed, 15 insertions, 7 deletions
diff --git a/drivers/mtd/nand/gpio.c b/drivers/mtd/nand/gpio.c
index bc73bc5f2713..0b3c815ef80c 100644
--- a/drivers/mtd/nand/gpio.c
+++ b/drivers/mtd/nand/gpio.c
@@ -134,7 +134,11 @@ static void gpio_nand_readbuf16(struct mtd_info *mtd, u_char *buf, int len)
134static int gpio_nand_devready(struct mtd_info *mtd) 134static int gpio_nand_devready(struct mtd_info *mtd)
135{ 135{
136 struct gpiomtd *gpiomtd = gpio_nand_getpriv(mtd); 136 struct gpiomtd *gpiomtd = gpio_nand_getpriv(mtd);
137 return gpio_get_value(gpiomtd->plat.gpio_rdy); 137
138 if (gpio_is_valid(gpiomtd->plat.gpio_rdy))
139 return gpio_get_value(gpiomtd->plat.gpio_rdy);
140
141 return 1;
138} 142}
139 143
140#ifdef CONFIG_OF 144#ifdef CONFIG_OF
@@ -252,7 +256,8 @@ static int __devexit gpio_nand_remove(struct platform_device *dev)
252 gpio_free(gpiomtd->plat.gpio_nce); 256 gpio_free(gpiomtd->plat.gpio_nce);
253 if (gpio_is_valid(gpiomtd->plat.gpio_nwp)) 257 if (gpio_is_valid(gpiomtd->plat.gpio_nwp))
254 gpio_free(gpiomtd->plat.gpio_nwp); 258 gpio_free(gpiomtd->plat.gpio_nwp);
255 gpio_free(gpiomtd->plat.gpio_rdy); 259 if (gpio_is_valid(gpiomtd->plat.gpio_rdy))
260 gpio_free(gpiomtd->plat.gpio_rdy);
256 261
257 kfree(gpiomtd); 262 kfree(gpiomtd);
258 263
@@ -336,10 +341,12 @@ static int __devinit gpio_nand_probe(struct platform_device *dev)
336 if (ret) 341 if (ret)
337 goto err_cle; 342 goto err_cle;
338 gpio_direction_output(gpiomtd->plat.gpio_cle, 0); 343 gpio_direction_output(gpiomtd->plat.gpio_cle, 0);
339 ret = gpio_request(gpiomtd->plat.gpio_rdy, "NAND RDY"); 344 if (gpio_is_valid(gpiomtd->plat.gpio_rdy)) {
340 if (ret) 345 ret = gpio_request(gpiomtd->plat.gpio_rdy, "NAND RDY");
341 goto err_rdy; 346 if (ret)
342 gpio_direction_input(gpiomtd->plat.gpio_rdy); 347 goto err_rdy;
348 gpio_direction_input(gpiomtd->plat.gpio_rdy);
349 }
343 350
344 351
345 this->IO_ADDR_W = this->IO_ADDR_R; 352 this->IO_ADDR_W = this->IO_ADDR_R;
@@ -386,7 +393,8 @@ static int __devinit gpio_nand_probe(struct platform_device *dev)
386err_wp: 393err_wp:
387 if (gpio_is_valid(gpiomtd->plat.gpio_nwp)) 394 if (gpio_is_valid(gpiomtd->plat.gpio_nwp))
388 gpio_set_value(gpiomtd->plat.gpio_nwp, 0); 395 gpio_set_value(gpiomtd->plat.gpio_nwp, 0);
389 gpio_free(gpiomtd->plat.gpio_rdy); 396 if (gpio_is_valid(gpiomtd->plat.gpio_rdy))
397 gpio_free(gpiomtd->plat.gpio_rdy);
390err_rdy: 398err_rdy:
391 gpio_free(gpiomtd->plat.gpio_cle); 399 gpio_free(gpiomtd->plat.gpio_cle);
392err_cle: 400err_cle: