From: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
To: barebox@lists.infradead.org
Subject: [PATCH 1/3] mtd: atmel_nand: request and configure pio via gpiolib
Date: Fri, 28 Dec 2012 17:46:29 +0100 [thread overview]
Message-ID: <1356713191-9614-1-git-send-email-plagnioj@jcrosoft.com> (raw)
In-Reply-To: <20121228164327.GB7216@game.jcrosoft.org>
Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
---
drivers/mtd/nand/atmel_nand.c | 53 +++++++++++++++++++++++++++++++++++++++--
1 file changed, 51 insertions(+), 2 deletions(-)
diff --git a/drivers/mtd/nand/atmel_nand.c b/drivers/mtd/nand/atmel_nand.c
index 7e0de51..2a57dbb 100644
--- a/drivers/mtd/nand/atmel_nand.c
+++ b/drivers/mtd/nand/atmel_nand.c
@@ -1114,8 +1114,42 @@ static int __init atmel_nand_probe(struct device_d *dev)
nand_chip->IO_ADDR_W = host->io_base;
nand_chip->cmd_ctrl = atmel_nand_cmd_ctrl;
- if (gpio_is_valid(host->board->rdy_pin))
+ if (gpio_is_valid(host->board->rdy_pin)) {
+ res = gpio_request(host->board->rdy_pin, "nand_rdy");
+ if (res < 0) {
+ dev_err(dev, "can't request rdy gpio %d\n",
+ host->board->rdy_pin);
+ goto err_no_card;
+ }
+
+ res = gpio_direction_input(host->board->rdy_pin);
+ if (res < 0) {
+ dev_err(dev,
+ "can't request input direction rdy gpio %d\n",
+ host->board->rdy_pin);
+ goto err_no_card;
+ }
+
nand_chip->dev_ready = atmel_nand_device_ready;
+ }
+
+ if (gpio_is_valid(host->board->enable_pin)) {
+ res = gpio_request(host->board->enable_pin, "nand_enable");
+ if (res < 0) {
+ dev_err(dev,
+ "can't request enable gpio %d\n",
+ host->board->enable_pin);
+ goto err_no_card;
+ }
+
+ res = gpio_direction_output(host->board->enable_pin, 1);
+ if (res < 0) {
+ dev_err(dev,
+ "can't request output direction enable gpio %d\n",
+ host->board->enable_pin);
+ goto err_no_card;
+ }
+ }
nand_chip->ecc.mode = NAND_ECC_SOFT;
@@ -1138,9 +1172,24 @@ static int __init atmel_nand_probe(struct device_d *dev)
atmel_nand_enable(host);
if (gpio_is_valid(host->board->det_pin)) {
+ res = gpio_request(host->board->det_pin, "nand_det");
+ if (res < 0) {
+ dev_err(dev, "can't request det gpio %d\n",
+ host->board->det_pin);
+ goto err_no_card;
+ }
+
+ res = gpio_direction_input(host->board->det_pin);
+ if (res < 0) {
+ dev_err(dev,
+ "can't request input direction det gpio %d\n",
+ host->board->det_pin);
+ goto err_no_card;
+ }
+
if (gpio_get_value(host->board->det_pin)) {
printk("No SmartMedia card inserted.\n");
- res = ENXIO;
+ res = -ENXIO;
goto err_no_card;
}
}
--
1.7.10.4
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
next prev parent reply other threads:[~2012-12-28 16:59 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-12-28 16:43 [PATCH 0/3] atmel nand/spi/udc: request gpio Jean-Christophe PLAGNIOL-VILLARD
2012-12-28 16:46 ` Jean-Christophe PLAGNIOL-VILLARD [this message]
2012-12-28 16:46 ` [PATCH 2/3] usb: at91_udc: request and configure vbus pin via gpiolib Jean-Christophe PLAGNIOL-VILLARD
2012-12-28 16:46 ` [PATCH 3/3] spi: atmel: request cs " Jean-Christophe PLAGNIOL-VILLARD
2013-01-02 10:07 ` [PATCH 0/3] atmel nand/spi/udc: request gpio Sascha Hauer
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1356713191-9614-1-git-send-email-plagnioj@jcrosoft.com \
--to=plagnioj@jcrosoft.com \
--cc=barebox@lists.infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox