MTD: atmel nand: fix gpio missing request
PATCH 1/1 MTD: atmel nand: fix gpio missing request
without this the gpio will not be muxed as a gpio by the current custom pinmux or later by the pinctrl
Signed-off-by Jean-Christophe PLAGNIOL-VILLARD <[email protected]>
Cc Nicolas Ferre <[email protected]>
--- drivers/mtd/nand/atmel_nand.c | 25 ++++++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-)
drivers/mtd/nand/atmel_nand.c +24 -1
@@ -583,8 +583,24 @@ static int __init atmel_nand_probe(struct platform_device *pdev) 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) { +dev_err (&pdev->dev, +"can't request rdy gpio %d\n" , host->board.rdy_pin); + goto err_ecc_ioremap; + } 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) { +dev_err (&pdev->dev, +"can't request enable gpio %d\n" , host->board.enable_pin); + goto err_ecc_ioremap; + } + } nand_chip->ecc.mode = host->board.ecc_mode;
@@ -622,6 +638,13 @@ static int __init atmel_nand_probe(struct platform_device *pdev)atmel_nand_enable (host);if (gpio_is_valid (host->board.det_pin)) { + res =gpio_request (host->board.det_pin,"nand_det" ); +if (res) { +dev_err (&pdev->dev, +"can't request det gpio %d\n" , host->board.det_pin); + goto err_no_card; + } +if (gpio_get_value (host->board.det_pin)) {printk (KERN_INFO "No SmartMedia card inserted.\n" ); res = -ENXIO ;
Signature · 1 line
1.7.10
PATCH v2 1/1 MTD: atmel nand: fix gpio missing request
without this the gpio will not be muxed as a gpio by the current custom pinmux or later by the pinctrl
Signed-off-by Jean-Christophe PLAGNIOL-VILLARD <[email protected]>
Cc Nicolas Ferre <[email protected]>
---
V2:
set the direction too
today this is invisible as you mostly boot from nand and the bootloader configured them but if you load the kernel via nor you need to do it
Best Regards,
J.
drivers/mtd/nand/atmel_nand.c | 56 ++++++++++++++++++++++++++++++++++++++++- 1 file changed, 55 insertions(+), 1 deletion(-)
drivers/mtd/nand/atmel_nand.c +55 -1
@@ -583,8 +583,39 @@ static int __init atmel_nand_probe(struct platform_device *pdev) 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 (&pdev->dev, +"can't request rdy gpio %d\n" , host->board.rdy_pin); + goto err_ecc_ioremap; + } + + res =gpio_direction_input (host->board.rdy_pin); +if (res <0 ) { +dev_err (&pdev->dev, +"can't request input direction rdy gpio %d\n" , host->board.rdy_pin); + goto err_ecc_ioremap; + } + 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 (&pdev->dev, +"can't request enable gpio %d\n" , host->board.enable_pin); + goto err_ecc_ioremap; + } + + res =gpio_direction_output (host->board.enable_pin,1 ); +if (res <0 ) { +dev_err (&pdev->dev, +"can't request output direction enable gpio %d\n" , host->board.enable_pin); + goto err_ecc_ioremap; + } + } nand_chip->ecc.mode = host->board.ecc_mode;
@@ -622,6 +653,20 @@ static int __init atmel_nand_probe(struct platform_device *pdev)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 (&pdev->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 (&pdev->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 (KERN_INFO "No SmartMedia card inserted.\n" ); res = -ENXIO ;
@@ -738,6 +783,15 @@ static int __exit atmel_nand_remove(struct platform_device *pdev)atmel_nand_disable (host); +if (gpio_is_valid (host->board.det_pin)) +gpio_free (host->board.det_pin); + +if (gpio_is_valid (host->board.enable_pin)) +gpio_free (host->board.enable_pin); + +if (gpio_is_valid (host->board.rdy_pin)) +gpio_free (host->board.rdy_pin); +if (host->ecc)iounmap (host->ecc);
Signature · 1 line
1.7.10
Artem Bityutskiy
AppliedPATCH v2 1/1 MTD: atmel nand: fix gpio missing request
Quoted 5 lines · Jean-Christophe PLAGNIOL-VILLARD
without this the gpio will not be muxed as a gpio by the current custom pinmux or later by the pinctrl
Signed-off-by Jean-Christophe PLAGNIOL-VILLARD <[email protected]>Cc Nicolas Ferre <[email protected]>
Pushed to l2-mtd.git, thanks!
Signature · 9 lines
Best Regards, Artem Bityutskiy -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 836 bytes Desc: This is a digitally signed message part URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20120817/7a694f35/attachment.sig>