ARM: at91: fix check of valid GPIO for SPI and USB
authorNicolas Ferre <nicolas.ferre@atmel.com>
Wed, 28 Mar 2012 09:58:58 +0000 (11:58 +0200)
committerNicolas Ferre <nicolas.ferre@atmel.com>
Wed, 4 Apr 2012 16:35:52 +0000 (18:35 +0200)
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
arch/arm/mach-at91/at91sam9261_devices.c
arch/arm/mach-at91/at91sam9263_devices.c
arch/arm/mach-at91/at91sam9g45_devices.c
arch/arm/mach-at91/at91sam9rl_devices.c

index 7e5651ee9f859f9689b76f07ca5bc834d3aa871a..5652dde4bbe291fd5723481ab9a978eb66bd5ec9 100644 (file)
@@ -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
index 096da87dc00d41359fa793f6dd25f541516dd86c..4db961a93085566e80973e241f910223484ccd96 100644 (file)
@@ -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
index 27cfce3d7845d5b454847fa014b30329a7b40a47..fe99206de8802b549dc099b65f3daa62a53f5768 100644 (file)
@@ -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
index ddf210ab8d123a0c5a73e31cdb35717af89fa17d..6b008aee1dffad648874e6318e397d7d640e2d31 100644 (file)
@@ -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
index eda72e83037dc7dd176c859e7f4ad874a9506a75..fe4ae22e8561bc9084b9d64870d063cfca88ed9a 100644 (file)
@@ -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);