mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH 0/3] atmel nand/spi/udc: request gpio
@ 2012-12-28 16:43 Jean-Christophe PLAGNIOL-VILLARD
  2012-12-28 16:46 ` [PATCH 1/3] mtd: atmel_nand: request and configure pio via gpiolib Jean-Christophe PLAGNIOL-VILLARD
  2013-01-02 10:07 ` [PATCH 0/3] atmel nand/spi/udc: request gpio Sascha Hauer
  0 siblings, 2 replies; 5+ messages in thread
From: Jean-Christophe PLAGNIOL-VILLARD @ 2012-12-28 16:43 UTC (permalink / raw)
  To: barebox

Hi,

	request and configure gpio via gpiolib for some of the Atmel drivers:

	 - Nand
	 - SPI
	 - at91 udc

The following changes since commit 95bc1eacae260a56c233179bc0fbd6245f2c68ed:

  qil-a9260-64: ser2net config (2012-12-28 00:33:06 +0800)

are available in the git repository at:

  git://git.jcrosoft.org/barebox.git delivery/at91_gpio

for you to fetch changes up to 52f0cda71c7e10a8bdf4a0976c7f7dee3a4f9678:

  spi: atmel: request cs pin via gpiolib (2012-12-29 00:29:39 +0800)

----------------------------------------------------------------
Jean-Christophe PLAGNIOL-VILLARD (3):
      mtd: atmel_nand: request and configure pio via gpiolib
      usb: at91_udc: request and configure vbus pin via gpiolib
      spi: atmel: request cs pin via gpiolib

 drivers/mtd/nand/atmel_nand.c |   53 +++++++++++++++++++++++++++++++++++++++++++++++++++--
 drivers/spi/atmel_spi.c       |    8 ++++++++
 drivers/usb/gadget/at91_udc.c |    7 +++++++
 3 files changed, 66 insertions(+), 2 deletions(-)

Best Regards,
J.

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH 1/3] mtd: atmel_nand: request and configure pio via gpiolib
  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
  2012-12-28 16:46   ` [PATCH 2/3] usb: at91_udc: request and configure vbus pin " 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
  1 sibling, 2 replies; 5+ messages in thread
From: Jean-Christophe PLAGNIOL-VILLARD @ 2012-12-28 16:46 UTC (permalink / raw)
  To: barebox

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

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH 2/3] usb: at91_udc: request and configure vbus pin via gpiolib
  2012-12-28 16:46 ` [PATCH 1/3] mtd: atmel_nand: request and configure pio via gpiolib Jean-Christophe PLAGNIOL-VILLARD
@ 2012-12-28 16:46   ` Jean-Christophe PLAGNIOL-VILLARD
  2012-12-28 16:46   ` [PATCH 3/3] spi: atmel: request cs " Jean-Christophe PLAGNIOL-VILLARD
  1 sibling, 0 replies; 5+ messages in thread
From: Jean-Christophe PLAGNIOL-VILLARD @ 2012-12-28 16:46 UTC (permalink / raw)
  To: barebox

Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
---
 drivers/usb/gadget/at91_udc.c |    7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/drivers/usb/gadget/at91_udc.c b/drivers/usb/gadget/at91_udc.c
index 8a678f9..3899db2 100644
--- a/drivers/usb/gadget/at91_udc.c
+++ b/drivers/usb/gadget/at91_udc.c
@@ -1497,6 +1497,13 @@ static int __init at91udc_probe(struct device_d *dev)
 	clk_disable(udc->iclk);
 
 	if (gpio_is_valid(udc->board.vbus_pin)) {
+		retval = gpio_request(udc->board.vbus_pin, "udc_vbus");
+		if (retval < 0) {
+			dev_err(dev, "request vbus pin failed\n");
+			goto fail0a;
+		}
+		gpio_direction_input(udc->board.vbus_pin);
+
 		/*
 		 * Get the initial state of VBUS - we cannot expect
 		 * a pending interrupt.
-- 
1.7.10.4


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH 3/3] spi: atmel: request cs pin via gpiolib
  2012-12-28 16:46 ` [PATCH 1/3] mtd: atmel_nand: request and configure pio via gpiolib Jean-Christophe PLAGNIOL-VILLARD
  2012-12-28 16:46   ` [PATCH 2/3] usb: at91_udc: request and configure vbus pin " Jean-Christophe PLAGNIOL-VILLARD
@ 2012-12-28 16:46   ` Jean-Christophe PLAGNIOL-VILLARD
  1 sibling, 0 replies; 5+ messages in thread
From: Jean-Christophe PLAGNIOL-VILLARD @ 2012-12-28 16:46 UTC (permalink / raw)
  To: barebox

Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
---
 drivers/spi/atmel_spi.c |    8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/drivers/spi/atmel_spi.c b/drivers/spi/atmel_spi.c
index 793933e..08cb416 100644
--- a/drivers/spi/atmel_spi.c
+++ b/drivers/spi/atmel_spi.c
@@ -371,6 +371,7 @@ err:
 static int atmel_spi_probe(struct device_d *dev)
 {
 	int ret = 0;
+	int i;
 	struct spi_master *master;
 	struct atmel_spi *as;
 	struct at91_spi_platform_data *pdata = dev->platform_data;
@@ -399,6 +400,12 @@ static int atmel_spi_probe(struct device_d *dev)
 	as->cs_pins = pdata->chipselect;
 	as->regs = dev_request_mem_region(dev, 0);
 
+	for (i = 0; i <= master->num_chipselect; i++) {
+		ret = gpio_request(as->cs_pins[i], dev_name(dev));
+		if (ret)
+			goto out_gpio;
+	}
+
 	/* Initialize the hardware */
 	clk_enable(as->clk);
 	spi_writel(as, CR, SPI_BIT(SWRST));
@@ -418,6 +425,7 @@ static int atmel_spi_probe(struct device_d *dev)
 out_reset_hw:
 	spi_writel(as, CR, SPI_BIT(SWRST));
 	spi_writel(as, CR, SPI_BIT(SWRST)); /* AT91SAM9263 Rev B workaround */
+out_gpio:
 	clk_disable(as->clk);
 	clk_put(as->clk);
 out_free:
-- 
1.7.10.4


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH 0/3] atmel nand/spi/udc: request gpio
  2012-12-28 16:43 [PATCH 0/3] atmel nand/spi/udc: request gpio Jean-Christophe PLAGNIOL-VILLARD
  2012-12-28 16:46 ` [PATCH 1/3] mtd: atmel_nand: request and configure pio via gpiolib Jean-Christophe PLAGNIOL-VILLARD
@ 2013-01-02 10:07 ` Sascha Hauer
  1 sibling, 0 replies; 5+ messages in thread
From: Sascha Hauer @ 2013-01-02 10:07 UTC (permalink / raw)
  To: Jean-Christophe PLAGNIOL-VILLARD; +Cc: barebox

On Fri, Dec 28, 2012 at 05:43:27PM +0100, Jean-Christophe PLAGNIOL-VILLARD wrote:
> Hi,
> 
> 	request and configure gpio via gpiolib for some of the Atmel drivers:
> 
> 	 - Nand
> 	 - SPI
> 	 - at91 udc
> 
> The following changes since commit 95bc1eacae260a56c233179bc0fbd6245f2c68ed:
> 
>   qil-a9260-64: ser2net config (2012-12-28 00:33:06 +0800)
> 
> are available in the git repository at:
> 
>   git://git.jcrosoft.org/barebox.git delivery/at91_gpio
> 

Applied, thanks

Sascha

> for you to fetch changes up to 52f0cda71c7e10a8bdf4a0976c7f7dee3a4f9678:
> 
>   spi: atmel: request cs pin via gpiolib (2012-12-29 00:29:39 +0800)
> 
> ----------------------------------------------------------------
> Jean-Christophe PLAGNIOL-VILLARD (3):
>       mtd: atmel_nand: request and configure pio via gpiolib
>       usb: at91_udc: request and configure vbus pin via gpiolib
>       spi: atmel: request cs pin via gpiolib
> 
>  drivers/mtd/nand/atmel_nand.c |   53 +++++++++++++++++++++++++++++++++++++++++++++++++++--
>  drivers/spi/atmel_spi.c       |    8 ++++++++
>  drivers/usb/gadget/at91_udc.c |    7 +++++++
>  3 files changed, 66 insertions(+), 2 deletions(-)
> 
> Best Regards,
> J.
> 
> _______________________________________________
> barebox mailing list
> barebox@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/barebox
> 

-- 
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2013-01-02 10:07 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-12-28 16:43 [PATCH 0/3] atmel nand/spi/udc: request gpio Jean-Christophe PLAGNIOL-VILLARD
2012-12-28 16:46 ` [PATCH 1/3] mtd: atmel_nand: request and configure pio via gpiolib Jean-Christophe PLAGNIOL-VILLARD
2012-12-28 16:46   ` [PATCH 2/3] usb: at91_udc: request and configure vbus pin " 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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox