From: Nicolas Ferre <nicolas.ferre@atmel.com>
To: linux-arm-kernel@lists.infradead.org, linux-usb@vger.kernel.org
Cc: plagnioj@jcrosoft.com, ludovic.desroches@atmel.com,
linux-kernel@vger.kernel.org, arnd@arndb.de, olof@lixom.net,
Nicolas Ferre <nicolas.ferre@atmel.com>
Subject: [PATCH v2 12/13] ARM: at91: fix check of valid GPIO for SPI and USB
Date: Tue, 3 Apr 2012 09:32:56 +0200 [thread overview]
Message-ID: <e453a558cc4c5e03c5d3090e0bfb632bde885bed.1333437885.git.nicolas.ferre@atmel.com> (raw)
In-Reply-To: <cover.1333437885.git.nicolas.ferre@atmel.com>
In-Reply-To: <cover.1333437885.git.nicolas.ferre@atmel.com>
SPI chip select pins have to be checked by gpio_is_valid().
The USB host overcurrent_pin checking was missing.
Signed-off-by: Nicolas Ferre <nicolas.ferre@atmel.com>
Acked-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
---
arch/arm/mach-at91/at91sam9260_devices.c | 3 +++
arch/arm/mach-at91/at91sam9261_devices.c | 3 +++
arch/arm/mach-at91/at91sam9263_devices.c | 3 +++
arch/arm/mach-at91/at91sam9g45_devices.c | 5 ++++-
arch/arm/mach-at91/at91sam9rl_devices.c | 3 +++
5 files changed, 16 insertions(+), 1 deletion(-)
diff --git a/arch/arm/mach-at91/at91sam9260_devices.c b/arch/arm/mach-at91/at91sam9260_devices.c
index 7e5651e..5652dde 100644
--- a/arch/arm/mach-at91/at91sam9260_devices.c
+++ b/arch/arm/mach-at91/at91sam9260_devices.c
@@ -598,6 +598,9 @@ void __init at91_add_device_spi(struct spi_board_info *devices, int nr_devices)
else
cs_pin = spi1_standard_cs[devices[i].chip_select];
+ if (!gpio_is_valid(cs_pin))
+ continue;
+
if (devices[i].bus_num == 0)
enable_spi0 = 1;
else
diff --git a/arch/arm/mach-at91/at91sam9261_devices.c b/arch/arm/mach-at91/at91sam9261_devices.c
index 096da87..4db961a 100644
--- a/arch/arm/mach-at91/at91sam9261_devices.c
+++ b/arch/arm/mach-at91/at91sam9261_devices.c
@@ -415,6 +415,9 @@ void __init at91_add_device_spi(struct spi_board_info *devices, int nr_devices)
else
cs_pin = spi1_standard_cs[devices[i].chip_select];
+ if (!gpio_is_valid(cs_pin))
+ continue;
+
if (devices[i].bus_num == 0)
enable_spi0 = 1;
else
diff --git a/arch/arm/mach-at91/at91sam9263_devices.c b/arch/arm/mach-at91/at91sam9263_devices.c
index 27cfce3..fe99206 100644
--- a/arch/arm/mach-at91/at91sam9263_devices.c
+++ b/arch/arm/mach-at91/at91sam9263_devices.c
@@ -672,6 +672,9 @@ void __init at91_add_device_spi(struct spi_board_info *devices, int nr_devices)
else
cs_pin = spi1_standard_cs[devices[i].chip_select];
+ if (!gpio_is_valid(cs_pin))
+ continue;
+
if (devices[i].bus_num == 0)
enable_spi0 = 1;
else
diff --git a/arch/arm/mach-at91/at91sam9g45_devices.c b/arch/arm/mach-at91/at91sam9g45_devices.c
index ddf210a..6b008ae 100644
--- a/arch/arm/mach-at91/at91sam9g45_devices.c
+++ b/arch/arm/mach-at91/at91sam9g45_devices.c
@@ -133,7 +133,7 @@ void __init at91_add_device_usbh_ohci(struct at91_usbh_data *data)
/* Enable overcurrent notification */
for (i = 0; i < data->ports; i++) {
- if (data->overcurrent_pin[i])
+ if (gpio_is_valid(data->overcurrent_pin[i]))
at91_set_gpio_input(data->overcurrent_pin[i], 1);
}
@@ -787,6 +787,9 @@ void __init at91_add_device_spi(struct spi_board_info *devices, int nr_devices)
else
cs_pin = spi1_standard_cs[devices[i].chip_select];
+ if (!gpio_is_valid(cs_pin))
+ continue;
+
if (devices[i].bus_num == 0)
enable_spi0 = 1;
else
diff --git a/arch/arm/mach-at91/at91sam9rl_devices.c b/arch/arm/mach-at91/at91sam9rl_devices.c
index eda72e8..fe4ae22 100644
--- a/arch/arm/mach-at91/at91sam9rl_devices.c
+++ b/arch/arm/mach-at91/at91sam9rl_devices.c
@@ -419,6 +419,9 @@ void __init at91_add_device_spi(struct spi_board_info *devices, int nr_devices)
else
cs_pin = spi_standard_cs[devices[i].chip_select];
+ if (!gpio_is_valid(cs_pin))
+ continue;
+
/* enable chip-select pin */
at91_set_gpio_output(cs_pin, 1);
--
1.7.9.4
next prev parent reply other threads:[~2012-04-03 7:33 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-04-03 7:32 [PATCH v2 00/13] at91: 3.4-rc1 fixes Nicolas Ferre
2012-04-03 7:32 ` [PATCH v2 01/13] ARM: at91/at91sam9x5: add clkdev entries for DMA controllers Nicolas Ferre
2012-04-03 7:32 ` [PATCH v2 02/13] USB: ohci-at91: fix vbus_pin_active_low handling Nicolas Ferre
2012-04-03 7:32 ` [PATCH v2 03/13] ARM: at91/USB host: specify and handle properly vbus_pin_active_low Nicolas Ferre
2012-04-03 7:32 ` [PATCH v2 04/13] ARM: at91/dts: USB host vbus is active low Nicolas Ferre
2012-04-03 7:32 ` [PATCH v2 05/13] USB: ohci-at91: rework and fix initialization Nicolas Ferre
2012-04-03 7:32 ` [PATCH v2 06/13] USB: ohci-at91: change maximum number of ports Nicolas Ferre
2012-04-03 14:11 ` Alan Stern
2012-04-03 15:04 ` Nicolas Ferre
2012-04-03 15:25 ` Alan Stern
2012-04-03 15:30 ` [PATCH v3 06/12] " Nicolas Ferre
2012-04-04 16:07 ` Alan Stern
2012-04-03 7:32 ` [PATCH v2 07/13] USB: ohci-at91: coding style modifications with one-line ifs Nicolas Ferre
2012-04-03 7:32 ` [PATCH v2 08/13] USB: ohci-at91: trivial return code name change Nicolas Ferre
2012-04-03 7:32 ` [PATCH v2 09/13] ARM: at91/at91sam9x5.dtsi: fix NAND ale/cle in DT file Nicolas Ferre
2012-04-03 7:32 ` [PATCH v2 10/13] ARM: at91/NAND DT bindings: add comments Nicolas Ferre
2012-04-03 7:32 ` [PATCH v2 11/13] USB: ehci-atmel: add needed of.h header file Nicolas Ferre
2012-04-03 7:32 ` Nicolas Ferre [this message]
2012-04-03 7:32 ` [PATCH v2 13/13] ARM: at91: dt: remove unit-address part for memory nodes Nicolas Ferre
2012-04-04 19:17 ` Olof Johansson
2012-04-07 1:43 ` Grant Likely
2012-04-03 11:55 ` [PATCH v2 00/13] at91: 3.4-rc1 fixes Nicolas Ferre
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=e453a558cc4c5e03c5d3090e0bfb632bde885bed.1333437885.git.nicolas.ferre@atmel.com \
--to=nicolas.ferre@atmel.com \
--cc=arnd@arndb.de \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-usb@vger.kernel.org \
--cc=ludovic.desroches@atmel.com \
--cc=olof@lixom.net \
--cc=plagnioj@jcrosoft.com \
/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;
as well as URLs for NNTP newsgroup(s).