* [PATCH 00/12] at91: 3.4-rc1 fixes
@ 2012-03-29 13:27 ` Nicolas Ferre
0 siblings, 0 replies; 38+ messages in thread
From: Nicolas Ferre @ 2012-03-29 13:27 UTC (permalink / raw)
To: linux-arm-kernel, linux-usb
Cc: plagnioj, ludovic.desroches, linux-kernel, arnd, olof, Nicolas Ferre
Here is a bunch of fixes for AT91 that will go on top of material already
included in linus' tree.
Some modifications are related to certain drivers (USB ohci-at91 for instance)
but are touching the core AT91 devices/board files and Device Tree files.
The modification of "vbus_pin_active_low" in particular cannot be separated
from the modification of .dts[i] and devices/board files.
I will have to collect "Acked-by" from USB people on the ohci-at91
modifications (Greg?).
Best regards,
Nicolas Ferre (12):
ARM: at91/at91sam9x5: add clkdev entries for DMA controllers
USB: ohci-at91: fix vbus_pin_active_low handling
ARM: at91/USB host: specify and handle properly vbus_pin_active_low
ARM: at91/dts: USB host vbus is active low
USB: ohci-at91: rework and fix initialization
USB: ohci-at91: change maximum number of ports
USB: ohci-at91: coding style modifications with one-line ifs
USB: ohci-at91: trivial return code name change
ARM: at91/at91sam9x5.dtsi: fix NAND ale/cle in DT file
ARM: at91/NAND DT bindings: add comments
USB: ehci-atmel: add needed of.h header file
ARM: at91: fix check of valid GPIO for SPI and USB
.../devicetree/bindings/mtd/atmel-nand.txt | 10 +-
arch/arm/boot/dts/at91sam9g25ek.dts | 4 +-
arch/arm/boot/dts/at91sam9m10g45ek.dts | 4 +-
arch/arm/boot/dts/at91sam9x5.dtsi | 4 +-
arch/arm/mach-at91/at91sam9260_devices.c | 3 +
arch/arm/mach-at91/at91sam9261_devices.c | 3 +
arch/arm/mach-at91/at91sam9263_devices.c | 6 +-
arch/arm/mach-at91/at91sam9g45_devices.c | 11 +-
arch/arm/mach-at91/at91sam9rl_devices.c | 3 +
arch/arm/mach-at91/at91sam9x5.c | 2 +
arch/arm/mach-at91/board-sam9263ek.c | 1 +
arch/arm/mach-at91/board-sam9m10g45ek.c | 1 +
arch/arm/mach-at91/include/mach/board.h | 13 +-
drivers/usb/host/ehci-atmel.c | 1 +
drivers/usb/host/ohci-at91.c | 129 ++++++++++----------
15 files changed, 111 insertions(+), 84 deletions(-)
--
1.7.9.4
^ permalink raw reply [flat|nested] 38+ messages in thread
* [PATCH 00/12] at91: 3.4-rc1 fixes
@ 2012-03-29 13:27 ` Nicolas Ferre
0 siblings, 0 replies; 38+ messages in thread
From: Nicolas Ferre @ 2012-03-29 13:27 UTC (permalink / raw)
To: linux-arm-kernel
Here is a bunch of fixes for AT91 that will go on top of material already
included in linus' tree.
Some modifications are related to certain drivers (USB ohci-at91 for instance)
but are touching the core AT91 devices/board files and Device Tree files.
The modification of "vbus_pin_active_low" in particular cannot be separated
from the modification of .dts[i] and devices/board files.
I will have to collect "Acked-by" from USB people on the ohci-at91
modifications (Greg?).
Best regards,
Nicolas Ferre (12):
ARM: at91/at91sam9x5: add clkdev entries for DMA controllers
USB: ohci-at91: fix vbus_pin_active_low handling
ARM: at91/USB host: specify and handle properly vbus_pin_active_low
ARM: at91/dts: USB host vbus is active low
USB: ohci-at91: rework and fix initialization
USB: ohci-at91: change maximum number of ports
USB: ohci-at91: coding style modifications with one-line ifs
USB: ohci-at91: trivial return code name change
ARM: at91/at91sam9x5.dtsi: fix NAND ale/cle in DT file
ARM: at91/NAND DT bindings: add comments
USB: ehci-atmel: add needed of.h header file
ARM: at91: fix check of valid GPIO for SPI and USB
.../devicetree/bindings/mtd/atmel-nand.txt | 10 +-
arch/arm/boot/dts/at91sam9g25ek.dts | 4 +-
arch/arm/boot/dts/at91sam9m10g45ek.dts | 4 +-
arch/arm/boot/dts/at91sam9x5.dtsi | 4 +-
arch/arm/mach-at91/at91sam9260_devices.c | 3 +
arch/arm/mach-at91/at91sam9261_devices.c | 3 +
arch/arm/mach-at91/at91sam9263_devices.c | 6 +-
arch/arm/mach-at91/at91sam9g45_devices.c | 11 +-
arch/arm/mach-at91/at91sam9rl_devices.c | 3 +
arch/arm/mach-at91/at91sam9x5.c | 2 +
arch/arm/mach-at91/board-sam9263ek.c | 1 +
arch/arm/mach-at91/board-sam9m10g45ek.c | 1 +
arch/arm/mach-at91/include/mach/board.h | 13 +-
drivers/usb/host/ehci-atmel.c | 1 +
drivers/usb/host/ohci-at91.c | 129 ++++++++++----------
15 files changed, 111 insertions(+), 84 deletions(-)
--
1.7.9.4
^ permalink raw reply [flat|nested] 38+ messages in thread
* [PATCH 01/12] ARM: at91/at91sam9x5: add clkdev entries for DMA controllers
2012-03-29 13:27 ` Nicolas Ferre
@ 2012-03-29 13:27 ` Nicolas Ferre
-1 siblings, 0 replies; 38+ messages in thread
From: Nicolas Ferre @ 2012-03-29 13:27 UTC (permalink / raw)
To: linux-arm-kernel, linux-usb
Cc: plagnioj, ludovic.desroches, linux-kernel, arnd, olof, Nicolas Ferre
Signed-off-by: Nicolas Ferre <nicolas.ferre@atmel.com>
Acked-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
---
arch/arm/mach-at91/at91sam9x5.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/arch/arm/mach-at91/at91sam9x5.c b/arch/arm/mach-at91/at91sam9x5.c
index b6831ee..13c8cae 100644
--- a/arch/arm/mach-at91/at91sam9x5.c
+++ b/arch/arm/mach-at91/at91sam9x5.c
@@ -223,6 +223,8 @@ static struct clk_lookup periph_clocks_lookups[] = {
CLKDEV_CON_DEV_ID("usart", "f8028000.serial", &usart3_clk),
CLKDEV_CON_DEV_ID("t0_clk", "f8008000.timer", &tcb0_clk),
CLKDEV_CON_DEV_ID("t0_clk", "f800c000.timer", &tcb0_clk),
+ CLKDEV_CON_DEV_ID("dma_clk", "ffffec00.dma-controller", &dma0_clk),
+ CLKDEV_CON_DEV_ID("dma_clk", "ffffee00.dma-controller", &dma1_clk),
CLKDEV_CON_ID("pioA", &pioAB_clk),
CLKDEV_CON_ID("pioB", &pioAB_clk),
CLKDEV_CON_ID("pioC", &pioCD_clk),
--
1.7.9.4
^ permalink raw reply related [flat|nested] 38+ messages in thread
* [PATCH 01/12] ARM: at91/at91sam9x5: add clkdev entries for DMA controllers
@ 2012-03-29 13:27 ` Nicolas Ferre
0 siblings, 0 replies; 38+ messages in thread
From: Nicolas Ferre @ 2012-03-29 13:27 UTC (permalink / raw)
To: linux-arm-kernel
Signed-off-by: Nicolas Ferre <nicolas.ferre@atmel.com>
Acked-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
---
arch/arm/mach-at91/at91sam9x5.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/arch/arm/mach-at91/at91sam9x5.c b/arch/arm/mach-at91/at91sam9x5.c
index b6831ee..13c8cae 100644
--- a/arch/arm/mach-at91/at91sam9x5.c
+++ b/arch/arm/mach-at91/at91sam9x5.c
@@ -223,6 +223,8 @@ static struct clk_lookup periph_clocks_lookups[] = {
CLKDEV_CON_DEV_ID("usart", "f8028000.serial", &usart3_clk),
CLKDEV_CON_DEV_ID("t0_clk", "f8008000.timer", &tcb0_clk),
CLKDEV_CON_DEV_ID("t0_clk", "f800c000.timer", &tcb0_clk),
+ CLKDEV_CON_DEV_ID("dma_clk", "ffffec00.dma-controller", &dma0_clk),
+ CLKDEV_CON_DEV_ID("dma_clk", "ffffee00.dma-controller", &dma1_clk),
CLKDEV_CON_ID("pioA", &pioAB_clk),
CLKDEV_CON_ID("pioB", &pioAB_clk),
CLKDEV_CON_ID("pioC", &pioCD_clk),
--
1.7.9.4
^ permalink raw reply related [flat|nested] 38+ messages in thread
* [PATCH 02/12] USB: ohci-at91: fix vbus_pin_active_low handling
2012-03-29 13:27 ` Nicolas Ferre
@ 2012-03-29 13:27 ` Nicolas Ferre
-1 siblings, 0 replies; 38+ messages in thread
From: Nicolas Ferre @ 2012-03-29 13:27 UTC (permalink / raw)
To: linux-arm-kernel, linux-usb
Cc: plagnioj, ludovic.desroches, linux-kernel, arnd, olof, Nicolas Ferre
The information is not properly taken into account
for {get|set}_power() functions.
Signed-off-by: Nicolas Ferre <nicolas.ferre@atmel.com>
Acked-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
Cc: stable <stable@vger.kernel.org> [3.2+]
---
drivers/usb/host/ohci-at91.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/usb/host/ohci-at91.c b/drivers/usb/host/ohci-at91.c
index db8963f..4d266ae 100644
--- a/drivers/usb/host/ohci-at91.c
+++ b/drivers/usb/host/ohci-at91.c
@@ -247,7 +247,7 @@ static void ohci_at91_usb_set_power(struct at91_usbh_data *pdata, int port, int
return;
gpio_set_value(pdata->vbus_pin[port],
- !pdata->vbus_pin_active_low[port] ^ enable);
+ pdata->vbus_pin_active_low[port] ^ enable);
}
static int ohci_at91_usb_get_power(struct at91_usbh_data *pdata, int port)
@@ -259,7 +259,7 @@ static int ohci_at91_usb_get_power(struct at91_usbh_data *pdata, int port)
return -EINVAL;
return gpio_get_value(pdata->vbus_pin[port]) ^
- !pdata->vbus_pin_active_low[port];
+ pdata->vbus_pin_active_low[port];
}
/*
--
1.7.9.4
^ permalink raw reply related [flat|nested] 38+ messages in thread
* [PATCH 02/12] USB: ohci-at91: fix vbus_pin_active_low handling
@ 2012-03-29 13:27 ` Nicolas Ferre
0 siblings, 0 replies; 38+ messages in thread
From: Nicolas Ferre @ 2012-03-29 13:27 UTC (permalink / raw)
To: linux-arm-kernel
The information is not properly taken into account
for {get|set}_power() functions.
Signed-off-by: Nicolas Ferre <nicolas.ferre@atmel.com>
Acked-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
Cc: stable <stable@vger.kernel.org> [3.2+]
---
drivers/usb/host/ohci-at91.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/usb/host/ohci-at91.c b/drivers/usb/host/ohci-at91.c
index db8963f..4d266ae 100644
--- a/drivers/usb/host/ohci-at91.c
+++ b/drivers/usb/host/ohci-at91.c
@@ -247,7 +247,7 @@ static void ohci_at91_usb_set_power(struct at91_usbh_data *pdata, int port, int
return;
gpio_set_value(pdata->vbus_pin[port],
- !pdata->vbus_pin_active_low[port] ^ enable);
+ pdata->vbus_pin_active_low[port] ^ enable);
}
static int ohci_at91_usb_get_power(struct at91_usbh_data *pdata, int port)
@@ -259,7 +259,7 @@ static int ohci_at91_usb_get_power(struct at91_usbh_data *pdata, int port)
return -EINVAL;
return gpio_get_value(pdata->vbus_pin[port]) ^
- !pdata->vbus_pin_active_low[port];
+ pdata->vbus_pin_active_low[port];
}
/*
--
1.7.9.4
^ permalink raw reply related [flat|nested] 38+ messages in thread
* [PATCH 03/12] ARM: at91/USB host: specify and handle properly vbus_pin_active_low
2012-03-29 13:27 ` Nicolas Ferre
@ 2012-03-29 13:27 ` Nicolas Ferre
-1 siblings, 0 replies; 38+ messages in thread
From: Nicolas Ferre @ 2012-03-29 13:27 UTC (permalink / raw)
To: linux-arm-kernel, linux-usb
Cc: plagnioj, ludovic.desroches, linux-kernel, arnd, olof, Nicolas Ferre
Due to an error while handling vbus_pin_active_low in ohci-at91 driver,
the specification of this property was not good in devices/board files.
Signed-off-by: Nicolas Ferre <nicolas.ferre@atmel.com>
Acked-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
Cc: stable <stable@vger.kernel.org> [3.2+]
---
arch/arm/mach-at91/at91sam9263_devices.c | 3 ++-
arch/arm/mach-at91/at91sam9g45_devices.c | 6 ++++--
arch/arm/mach-at91/board-sam9263ek.c | 1 +
arch/arm/mach-at91/board-sam9m10g45ek.c | 1 +
4 files changed, 8 insertions(+), 3 deletions(-)
diff --git a/arch/arm/mach-at91/at91sam9263_devices.c b/arch/arm/mach-at91/at91sam9263_devices.c
index 53688c4..5cdca89d 100644
--- a/arch/arm/mach-at91/at91sam9263_devices.c
+++ b/arch/arm/mach-at91/at91sam9263_devices.c
@@ -72,7 +72,8 @@ void __init at91_add_device_usbh(struct at91_usbh_data *data)
/* Enable VBus control for UHP ports */
for (i = 0; i < data->ports; i++) {
if (gpio_is_valid(data->vbus_pin[i]))
- at91_set_gpio_output(data->vbus_pin[i], 0);
+ at91_set_gpio_output(data->vbus_pin[i],
+ data->vbus_pin_active_low[i] ^ 0);
}
/* Enable overcurrent notification */
diff --git a/arch/arm/mach-at91/at91sam9g45_devices.c b/arch/arm/mach-at91/at91sam9g45_devices.c
index 4320b20..763deba 100644
--- a/arch/arm/mach-at91/at91sam9g45_devices.c
+++ b/arch/arm/mach-at91/at91sam9g45_devices.c
@@ -127,7 +127,8 @@ void __init at91_add_device_usbh_ohci(struct at91_usbh_data *data)
/* Enable VBus control for UHP ports */
for (i = 0; i < data->ports; i++) {
if (gpio_is_valid(data->vbus_pin[i]))
- at91_set_gpio_output(data->vbus_pin[i], 0);
+ at91_set_gpio_output(data->vbus_pin[i],
+ data->vbus_pin_active_low[i] ^ 0);
}
/* Enable overcurrent notification */
@@ -188,7 +189,8 @@ void __init at91_add_device_usbh_ehci(struct at91_usbh_data *data)
/* Enable VBus control for UHP ports */
for (i = 0; i < data->ports; i++) {
if (gpio_is_valid(data->vbus_pin[i]))
- at91_set_gpio_output(data->vbus_pin[i], 0);
+ at91_set_gpio_output(data->vbus_pin[i],
+ data->vbus_pin_active_low[i] ^ 0);
}
usbh_ehci_data = *data;
diff --git a/arch/arm/mach-at91/board-sam9263ek.c b/arch/arm/mach-at91/board-sam9263ek.c
index 66f0ddf..2ffe50f 100644
--- a/arch/arm/mach-at91/board-sam9263ek.c
+++ b/arch/arm/mach-at91/board-sam9263ek.c
@@ -74,6 +74,7 @@ static void __init ek_init_early(void)
static struct at91_usbh_data __initdata ek_usbh_data = {
.ports = 2,
.vbus_pin = { AT91_PIN_PA24, AT91_PIN_PA21 },
+ .vbus_pin_active_low = {1, 1},
.overcurrent_pin= {-EINVAL, -EINVAL},
};
diff --git a/arch/arm/mach-at91/board-sam9m10g45ek.c b/arch/arm/mach-at91/board-sam9m10g45ek.c
index e1bea73..c88e908 100644
--- a/arch/arm/mach-at91/board-sam9m10g45ek.c
+++ b/arch/arm/mach-at91/board-sam9m10g45ek.c
@@ -71,6 +71,7 @@ static void __init ek_init_early(void)
static struct at91_usbh_data __initdata ek_usbh_hs_data = {
.ports = 2,
.vbus_pin = {AT91_PIN_PD1, AT91_PIN_PD3},
+ .vbus_pin_active_low = {1, 1},
.overcurrent_pin= {-EINVAL, -EINVAL},
};
--
1.7.9.4
^ permalink raw reply related [flat|nested] 38+ messages in thread
* [PATCH 03/12] ARM: at91/USB host: specify and handle properly vbus_pin_active_low
@ 2012-03-29 13:27 ` Nicolas Ferre
0 siblings, 0 replies; 38+ messages in thread
From: Nicolas Ferre @ 2012-03-29 13:27 UTC (permalink / raw)
To: linux-arm-kernel
Due to an error while handling vbus_pin_active_low in ohci-at91 driver,
the specification of this property was not good in devices/board files.
Signed-off-by: Nicolas Ferre <nicolas.ferre@atmel.com>
Acked-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
Cc: stable <stable@vger.kernel.org> [3.2+]
---
arch/arm/mach-at91/at91sam9263_devices.c | 3 ++-
arch/arm/mach-at91/at91sam9g45_devices.c | 6 ++++--
arch/arm/mach-at91/board-sam9263ek.c | 1 +
arch/arm/mach-at91/board-sam9m10g45ek.c | 1 +
4 files changed, 8 insertions(+), 3 deletions(-)
diff --git a/arch/arm/mach-at91/at91sam9263_devices.c b/arch/arm/mach-at91/at91sam9263_devices.c
index 53688c4..5cdca89d 100644
--- a/arch/arm/mach-at91/at91sam9263_devices.c
+++ b/arch/arm/mach-at91/at91sam9263_devices.c
@@ -72,7 +72,8 @@ void __init at91_add_device_usbh(struct at91_usbh_data *data)
/* Enable VBus control for UHP ports */
for (i = 0; i < data->ports; i++) {
if (gpio_is_valid(data->vbus_pin[i]))
- at91_set_gpio_output(data->vbus_pin[i], 0);
+ at91_set_gpio_output(data->vbus_pin[i],
+ data->vbus_pin_active_low[i] ^ 0);
}
/* Enable overcurrent notification */
diff --git a/arch/arm/mach-at91/at91sam9g45_devices.c b/arch/arm/mach-at91/at91sam9g45_devices.c
index 4320b20..763deba 100644
--- a/arch/arm/mach-at91/at91sam9g45_devices.c
+++ b/arch/arm/mach-at91/at91sam9g45_devices.c
@@ -127,7 +127,8 @@ void __init at91_add_device_usbh_ohci(struct at91_usbh_data *data)
/* Enable VBus control for UHP ports */
for (i = 0; i < data->ports; i++) {
if (gpio_is_valid(data->vbus_pin[i]))
- at91_set_gpio_output(data->vbus_pin[i], 0);
+ at91_set_gpio_output(data->vbus_pin[i],
+ data->vbus_pin_active_low[i] ^ 0);
}
/* Enable overcurrent notification */
@@ -188,7 +189,8 @@ void __init at91_add_device_usbh_ehci(struct at91_usbh_data *data)
/* Enable VBus control for UHP ports */
for (i = 0; i < data->ports; i++) {
if (gpio_is_valid(data->vbus_pin[i]))
- at91_set_gpio_output(data->vbus_pin[i], 0);
+ at91_set_gpio_output(data->vbus_pin[i],
+ data->vbus_pin_active_low[i] ^ 0);
}
usbh_ehci_data = *data;
diff --git a/arch/arm/mach-at91/board-sam9263ek.c b/arch/arm/mach-at91/board-sam9263ek.c
index 66f0ddf..2ffe50f 100644
--- a/arch/arm/mach-at91/board-sam9263ek.c
+++ b/arch/arm/mach-at91/board-sam9263ek.c
@@ -74,6 +74,7 @@ static void __init ek_init_early(void)
static struct at91_usbh_data __initdata ek_usbh_data = {
.ports = 2,
.vbus_pin = { AT91_PIN_PA24, AT91_PIN_PA21 },
+ .vbus_pin_active_low = {1, 1},
.overcurrent_pin= {-EINVAL, -EINVAL},
};
diff --git a/arch/arm/mach-at91/board-sam9m10g45ek.c b/arch/arm/mach-at91/board-sam9m10g45ek.c
index e1bea73..c88e908 100644
--- a/arch/arm/mach-at91/board-sam9m10g45ek.c
+++ b/arch/arm/mach-at91/board-sam9m10g45ek.c
@@ -71,6 +71,7 @@ static void __init ek_init_early(void)
static struct at91_usbh_data __initdata ek_usbh_hs_data = {
.ports = 2,
.vbus_pin = {AT91_PIN_PD1, AT91_PIN_PD3},
+ .vbus_pin_active_low = {1, 1},
.overcurrent_pin= {-EINVAL, -EINVAL},
};
--
1.7.9.4
^ permalink raw reply related [flat|nested] 38+ messages in thread
* [PATCH 04/12] ARM: at91/dts: USB host vbus is active low
2012-03-29 13:27 ` Nicolas Ferre
@ 2012-03-29 13:27 ` Nicolas Ferre
-1 siblings, 0 replies; 38+ messages in thread
From: Nicolas Ferre @ 2012-03-29 13:27 UTC (permalink / raw)
To: linux-arm-kernel, linux-usb
Cc: plagnioj, ludovic.desroches, linux-kernel, arnd, olof,
Nicolas Ferre, stable
Change vbus gpio configuration in .dts files to switch to
active low configuration.
Signed-off-by: Nicolas Ferre <nicolas.ferre@atmel.com>
Acked-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
Cc: stable <stable@vger.kernel.org>
---
arch/arm/boot/dts/at91sam9g25ek.dts | 4 ++--
arch/arm/boot/dts/at91sam9m10g45ek.dts | 4 ++--
2 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/arch/arm/boot/dts/at91sam9g25ek.dts b/arch/arm/boot/dts/at91sam9g25ek.dts
index ac0dc00..7829a4d 100644
--- a/arch/arm/boot/dts/at91sam9g25ek.dts
+++ b/arch/arm/boot/dts/at91sam9g25ek.dts
@@ -37,8 +37,8 @@
usb0: ohci@00600000 {
status = "okay";
num-ports = <2>;
- atmel,vbus-gpio = <&pioD 19 0
- &pioD 20 0
+ atmel,vbus-gpio = <&pioD 19 1
+ &pioD 20 1
>;
};
diff --git a/arch/arm/boot/dts/at91sam9m10g45ek.dts b/arch/arm/boot/dts/at91sam9m10g45ek.dts
index c4c8ae4..6abb571 100644
--- a/arch/arm/boot/dts/at91sam9m10g45ek.dts
+++ b/arch/arm/boot/dts/at91sam9m10g45ek.dts
@@ -73,8 +73,8 @@
usb0: ohci@00700000 {
status = "okay";
num-ports = <2>;
- atmel,vbus-gpio = <&pioD 1 0
- &pioD 3 0>;
+ atmel,vbus-gpio = <&pioD 1 1
+ &pioD 3 1>;
};
usb1: ehci@00800000 {
--
1.7.9.4
^ permalink raw reply related [flat|nested] 38+ messages in thread
* [PATCH 04/12] ARM: at91/dts: USB host vbus is active low
@ 2012-03-29 13:27 ` Nicolas Ferre
0 siblings, 0 replies; 38+ messages in thread
From: Nicolas Ferre @ 2012-03-29 13:27 UTC (permalink / raw)
To: linux-arm-kernel
Change vbus gpio configuration in .dts files to switch to
active low configuration.
Signed-off-by: Nicolas Ferre <nicolas.ferre@atmel.com>
Acked-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
Cc: stable <stable@vger.kernel.org>
---
arch/arm/boot/dts/at91sam9g25ek.dts | 4 ++--
arch/arm/boot/dts/at91sam9m10g45ek.dts | 4 ++--
2 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/arch/arm/boot/dts/at91sam9g25ek.dts b/arch/arm/boot/dts/at91sam9g25ek.dts
index ac0dc00..7829a4d 100644
--- a/arch/arm/boot/dts/at91sam9g25ek.dts
+++ b/arch/arm/boot/dts/at91sam9g25ek.dts
@@ -37,8 +37,8 @@
usb0: ohci at 00600000 {
status = "okay";
num-ports = <2>;
- atmel,vbus-gpio = <&pioD 19 0
- &pioD 20 0
+ atmel,vbus-gpio = <&pioD 19 1
+ &pioD 20 1
>;
};
diff --git a/arch/arm/boot/dts/at91sam9m10g45ek.dts b/arch/arm/boot/dts/at91sam9m10g45ek.dts
index c4c8ae4..6abb571 100644
--- a/arch/arm/boot/dts/at91sam9m10g45ek.dts
+++ b/arch/arm/boot/dts/at91sam9m10g45ek.dts
@@ -73,8 +73,8 @@
usb0: ohci at 00700000 {
status = "okay";
num-ports = <2>;
- atmel,vbus-gpio = <&pioD 1 0
- &pioD 3 0>;
+ atmel,vbus-gpio = <&pioD 1 1
+ &pioD 3 1>;
};
usb1: ehci at 00800000 {
--
1.7.9.4
^ permalink raw reply related [flat|nested] 38+ messages in thread
* [PATCH 05/12] USB: ohci-at91: rework and fix initialization
2012-03-29 13:27 ` Nicolas Ferre
@ 2012-03-29 13:27 ` Nicolas Ferre
-1 siblings, 0 replies; 38+ messages in thread
From: Nicolas Ferre @ 2012-03-29 13:27 UTC (permalink / raw)
To: linux-arm-kernel, linux-usb
Cc: plagnioj, ludovic.desroches, linux-kernel, arnd, olof, Nicolas Ferre
The DT information are filled in a pdata structure and then passed on
to the usual check code of the probe function. Thus we do not need to
redo the gpio checking and irq configuration in the DT-related code.
On the other hand, we setup GPIO direction in driver for vbus and
overcurrent. It will be useful when moving to pinctrl subsystem.
Signed-off-by: Nicolas Ferre <nicolas.ferre@atmel.com>
Acked-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
---
drivers/usb/host/ohci-at91.c | 88 ++++++++++++++++++++++--------------------
1 file changed, 46 insertions(+), 42 deletions(-)
diff --git a/drivers/usb/host/ohci-at91.c b/drivers/usb/host/ohci-at91.c
index 4d266ae..1262532 100644
--- a/drivers/usb/host/ohci-at91.c
+++ b/drivers/usb/host/ohci-at91.c
@@ -492,7 +492,7 @@ static u64 at91_ohci_dma_mask = DMA_BIT_MASK(32);
static int __devinit ohci_at91_of_init(struct platform_device *pdev)
{
struct device_node *np = pdev->dev.of_node;
- int i, ret, gpio;
+ int i, gpio;
enum of_gpio_flags flags;
struct at91_usbh_data *pdata;
u32 ports;
@@ -520,42 +520,11 @@ static int __devinit ohci_at91_of_init(struct platform_device *pdev)
if (!gpio_is_valid(gpio))
continue;
pdata->vbus_pin_active_low[i] = flags & OF_GPIO_ACTIVE_LOW;
- ret = gpio_request(gpio, "ohci_vbus");
- if (ret) {
- dev_warn(&pdev->dev, "can't request vbus gpio %d", gpio);
- continue;
- }
- ret = gpio_direction_output(gpio, !(flags & OF_GPIO_ACTIVE_LOW) ^ 1);
- if (ret)
- dev_warn(&pdev->dev, "can't put vbus gpio %d as output %d",
- !(flags & OF_GPIO_ACTIVE_LOW) ^ 1, gpio);
}
- for (i = 0; i < 2; i++) {
- gpio = of_get_named_gpio_flags(np, "atmel,oc-gpio", i, &flags);
- pdata->overcurrent_pin[i] = gpio;
- if (!gpio_is_valid(gpio))
- continue;
- ret = gpio_request(gpio, "ohci_overcurrent");
- if (ret) {
- dev_err(&pdev->dev, "can't request overcurrent gpio %d", gpio);
- continue;
- }
-
- ret = gpio_direction_input(gpio);
- if (ret) {
- dev_err(&pdev->dev, "can't configure overcurrent gpio %d as input", gpio);
- continue;
- }
-
- ret = request_irq(gpio_to_irq(gpio),
- ohci_hcd_at91_overcurrent_irq,
- IRQF_SHARED, "ohci_overcurrent", pdev);
- if (ret) {
- gpio_free(gpio);
- dev_warn(& pdev->dev, "cannot get GPIO IRQ for overcurrent\n");
- }
- }
+ for (i = 0; i < 2; i++)
+ pdata->overcurrent_pin[i] =
+ of_get_named_gpio_flags(np, "atmel,oc-gpio", i, &flags);
pdev->dev.platform_data = pdata;
@@ -574,6 +543,8 @@ static int ohci_hcd_at91_drv_probe(struct platform_device *pdev)
{
struct at91_usbh_data *pdata;
int i;
+ int gpio;
+ int ret;
i = ohci_at91_of_init(pdev);
@@ -586,23 +557,56 @@ static int ohci_hcd_at91_drv_probe(struct platform_device *pdev)
for (i = 0; i < ARRAY_SIZE(pdata->vbus_pin); i++) {
if (!gpio_is_valid(pdata->vbus_pin[i]))
continue;
- gpio_request(pdata->vbus_pin[i], "ohci_vbus");
+ gpio = pdata->vbus_pin[i];
+
+ ret = gpio_request(gpio, "ohci_vbus");
+ if (ret) {
+ dev_err(&pdev->dev,
+ "can't request vbus gpio %d\n", gpio);
+ continue;
+ }
+ ret = gpio_direction_output(gpio,
+ pdata->vbus_pin_active_low[i] ^ 1);
+ if (ret) {
+ dev_err(&pdev->dev,
+ "can't put vbus gpio %d as output %d\n",
+ gpio, pdata->vbus_pin_active_low[i] ^ 1);
+ gpio_free(gpio);
+ continue;
+ }
+
ohci_at91_usb_set_power(pdata, i, 1);
}
for (i = 0; i < ARRAY_SIZE(pdata->overcurrent_pin); i++) {
- int ret;
-
if (!gpio_is_valid(pdata->overcurrent_pin[i]))
continue;
- gpio_request(pdata->overcurrent_pin[i], "ohci_overcurrent");
+ gpio = pdata->overcurrent_pin[i];
+
+ ret = gpio_request(gpio, "ohci_overcurrent");
+ if (ret) {
+ dev_err(&pdev->dev,
+ "can't request overcurrent gpio %d\n",
+ gpio);
+ continue;
+ }
+
+ ret = gpio_direction_input(gpio);
+ if (ret) {
+ dev_err(&pdev->dev,
+ "can't configure overcurrent gpio %d as input\n",
+ gpio);
+ gpio_free(gpio);
+ continue;
+ }
- ret = request_irq(gpio_to_irq(pdata->overcurrent_pin[i]),
+ ret = request_irq(gpio_to_irq(gpio),
ohci_hcd_at91_overcurrent_irq,
IRQF_SHARED, "ohci_overcurrent", pdev);
if (ret) {
- gpio_free(pdata->overcurrent_pin[i]);
- dev_warn(& pdev->dev, "cannot get GPIO IRQ for overcurrent\n");
+ gpio_free(gpio);
+ dev_err(&pdev->dev,
+ "can't get gpio IRQ for overcurrent\n");
}
}
}
--
1.7.9.4
^ permalink raw reply related [flat|nested] 38+ messages in thread
* [PATCH 05/12] USB: ohci-at91: rework and fix initialization
@ 2012-03-29 13:27 ` Nicolas Ferre
0 siblings, 0 replies; 38+ messages in thread
From: Nicolas Ferre @ 2012-03-29 13:27 UTC (permalink / raw)
To: linux-arm-kernel
The DT information are filled in a pdata structure and then passed on
to the usual check code of the probe function. Thus we do not need to
redo the gpio checking and irq configuration in the DT-related code.
On the other hand, we setup GPIO direction in driver for vbus and
overcurrent. It will be useful when moving to pinctrl subsystem.
Signed-off-by: Nicolas Ferre <nicolas.ferre@atmel.com>
Acked-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
---
drivers/usb/host/ohci-at91.c | 88 ++++++++++++++++++++++--------------------
1 file changed, 46 insertions(+), 42 deletions(-)
diff --git a/drivers/usb/host/ohci-at91.c b/drivers/usb/host/ohci-at91.c
index 4d266ae..1262532 100644
--- a/drivers/usb/host/ohci-at91.c
+++ b/drivers/usb/host/ohci-at91.c
@@ -492,7 +492,7 @@ static u64 at91_ohci_dma_mask = DMA_BIT_MASK(32);
static int __devinit ohci_at91_of_init(struct platform_device *pdev)
{
struct device_node *np = pdev->dev.of_node;
- int i, ret, gpio;
+ int i, gpio;
enum of_gpio_flags flags;
struct at91_usbh_data *pdata;
u32 ports;
@@ -520,42 +520,11 @@ static int __devinit ohci_at91_of_init(struct platform_device *pdev)
if (!gpio_is_valid(gpio))
continue;
pdata->vbus_pin_active_low[i] = flags & OF_GPIO_ACTIVE_LOW;
- ret = gpio_request(gpio, "ohci_vbus");
- if (ret) {
- dev_warn(&pdev->dev, "can't request vbus gpio %d", gpio);
- continue;
- }
- ret = gpio_direction_output(gpio, !(flags & OF_GPIO_ACTIVE_LOW) ^ 1);
- if (ret)
- dev_warn(&pdev->dev, "can't put vbus gpio %d as output %d",
- !(flags & OF_GPIO_ACTIVE_LOW) ^ 1, gpio);
}
- for (i = 0; i < 2; i++) {
- gpio = of_get_named_gpio_flags(np, "atmel,oc-gpio", i, &flags);
- pdata->overcurrent_pin[i] = gpio;
- if (!gpio_is_valid(gpio))
- continue;
- ret = gpio_request(gpio, "ohci_overcurrent");
- if (ret) {
- dev_err(&pdev->dev, "can't request overcurrent gpio %d", gpio);
- continue;
- }
-
- ret = gpio_direction_input(gpio);
- if (ret) {
- dev_err(&pdev->dev, "can't configure overcurrent gpio %d as input", gpio);
- continue;
- }
-
- ret = request_irq(gpio_to_irq(gpio),
- ohci_hcd_at91_overcurrent_irq,
- IRQF_SHARED, "ohci_overcurrent", pdev);
- if (ret) {
- gpio_free(gpio);
- dev_warn(& pdev->dev, "cannot get GPIO IRQ for overcurrent\n");
- }
- }
+ for (i = 0; i < 2; i++)
+ pdata->overcurrent_pin[i] =
+ of_get_named_gpio_flags(np, "atmel,oc-gpio", i, &flags);
pdev->dev.platform_data = pdata;
@@ -574,6 +543,8 @@ static int ohci_hcd_at91_drv_probe(struct platform_device *pdev)
{
struct at91_usbh_data *pdata;
int i;
+ int gpio;
+ int ret;
i = ohci_at91_of_init(pdev);
@@ -586,23 +557,56 @@ static int ohci_hcd_at91_drv_probe(struct platform_device *pdev)
for (i = 0; i < ARRAY_SIZE(pdata->vbus_pin); i++) {
if (!gpio_is_valid(pdata->vbus_pin[i]))
continue;
- gpio_request(pdata->vbus_pin[i], "ohci_vbus");
+ gpio = pdata->vbus_pin[i];
+
+ ret = gpio_request(gpio, "ohci_vbus");
+ if (ret) {
+ dev_err(&pdev->dev,
+ "can't request vbus gpio %d\n", gpio);
+ continue;
+ }
+ ret = gpio_direction_output(gpio,
+ pdata->vbus_pin_active_low[i] ^ 1);
+ if (ret) {
+ dev_err(&pdev->dev,
+ "can't put vbus gpio %d as output %d\n",
+ gpio, pdata->vbus_pin_active_low[i] ^ 1);
+ gpio_free(gpio);
+ continue;
+ }
+
ohci_at91_usb_set_power(pdata, i, 1);
}
for (i = 0; i < ARRAY_SIZE(pdata->overcurrent_pin); i++) {
- int ret;
-
if (!gpio_is_valid(pdata->overcurrent_pin[i]))
continue;
- gpio_request(pdata->overcurrent_pin[i], "ohci_overcurrent");
+ gpio = pdata->overcurrent_pin[i];
+
+ ret = gpio_request(gpio, "ohci_overcurrent");
+ if (ret) {
+ dev_err(&pdev->dev,
+ "can't request overcurrent gpio %d\n",
+ gpio);
+ continue;
+ }
+
+ ret = gpio_direction_input(gpio);
+ if (ret) {
+ dev_err(&pdev->dev,
+ "can't configure overcurrent gpio %d as input\n",
+ gpio);
+ gpio_free(gpio);
+ continue;
+ }
- ret = request_irq(gpio_to_irq(pdata->overcurrent_pin[i]),
+ ret = request_irq(gpio_to_irq(gpio),
ohci_hcd_at91_overcurrent_irq,
IRQF_SHARED, "ohci_overcurrent", pdev);
if (ret) {
- gpio_free(pdata->overcurrent_pin[i]);
- dev_warn(& pdev->dev, "cannot get GPIO IRQ for overcurrent\n");
+ gpio_free(gpio);
+ dev_err(&pdev->dev,
+ "can't get gpio IRQ for overcurrent\n");
}
}
}
--
1.7.9.4
^ permalink raw reply related [flat|nested] 38+ messages in thread
* [PATCH 06/12] USB: ohci-at91: change maximum number of ports
2012-03-29 13:27 ` Nicolas Ferre
@ 2012-03-29 13:27 ` Nicolas Ferre
-1 siblings, 0 replies; 38+ messages in thread
From: Nicolas Ferre @ 2012-03-29 13:27 UTC (permalink / raw)
To: linux-arm-kernel, linux-usb
Cc: plagnioj, ludovic.desroches, linux-kernel, arnd, olof, Nicolas Ferre
Change number of ports to 3 for newer SoCs. Modify pdata structure
and ohci-at91 code that was dealing with ports information and check
of port indexes.
Signed-off-by: Nicolas Ferre <nicolas.ferre@atmel.com>
Acked-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
---
arch/arm/mach-at91/include/mach/board.h | 13 +++++++------
drivers/usb/host/ohci-at91.c | 22 +++++++++++++---------
2 files changed, 20 insertions(+), 15 deletions(-)
diff --git a/arch/arm/mach-at91/include/mach/board.h b/arch/arm/mach-at91/include/mach/board.h
index 544a5d5..49a8211 100644
--- a/arch/arm/mach-at91/include/mach/board.h
+++ b/arch/arm/mach-at91/include/mach/board.h
@@ -86,14 +86,15 @@ extern void __init at91_add_device_mci(short mmc_id, struct mci_platform_data *d
extern void __init at91_add_device_eth(struct macb_platform_data *data);
/* USB Host */
+#define AT91_MAX_USBH_PORTS 3
struct at91_usbh_data {
- u8 ports; /* number of ports on root hub */
- int vbus_pin[2]; /* port power-control pin */
- u8 vbus_pin_active_low[2];
+ int vbus_pin[AT91_MAX_USBH_PORTS]; /* port power-control pin */
+ int overcurrent_pin[AT91_MAX_USBH_PORTS];
+ u8 ports; /* number of ports on root hub */
u8 overcurrent_supported;
- int overcurrent_pin[2];
- u8 overcurrent_status[2];
- u8 overcurrent_changed[2];
+ u8 vbus_pin_active_low[AT91_MAX_USBH_PORTS];
+ u8 overcurrent_status[AT91_MAX_USBH_PORTS];
+ u8 overcurrent_changed[AT91_MAX_USBH_PORTS];
};
extern void __init at91_add_device_usbh(struct at91_usbh_data *data);
extern void __init at91_add_device_usbh_ohci(struct at91_usbh_data *data);
diff --git a/drivers/usb/host/ohci-at91.c b/drivers/usb/host/ohci-at91.c
index 1262532..cf9707d 100644
--- a/drivers/usb/host/ohci-at91.c
+++ b/drivers/usb/host/ohci-at91.c
@@ -240,7 +240,7 @@ ohci_at91_start (struct usb_hcd *hcd)
static void ohci_at91_usb_set_power(struct at91_usbh_data *pdata, int port, int enable)
{
- if (port < 0 || port >= 2)
+ if (port < 0 || port >= ARRAY_SIZE(pdata->vbus_pin))
return;
if (!gpio_is_valid(pdata->vbus_pin[port]))
@@ -252,7 +252,7 @@ static void ohci_at91_usb_set_power(struct at91_usbh_data *pdata, int port, int
static int ohci_at91_usb_get_power(struct at91_usbh_data *pdata, int port)
{
- if (port < 0 || port >= 2)
+ if (port < 0 || port >= ARRAY_SIZE(pdata->vbus_pin))
return -EINVAL;
if (!gpio_is_valid(pdata->vbus_pin[port]))
@@ -301,7 +301,11 @@ static int ohci_at91_hub_control(struct usb_hcd *hcd, u16 typeReq, u16 wValue,
case SetPortFeature:
if (wValue == USB_PORT_FEAT_POWER) {
dev_dbg(hcd->self.controller, "SetPortFeat: POWER\n");
- ohci_at91_usb_set_power(pdata, wIndex - 1, 1);
+ if (wIndex && wIndex <= ARRAY_SIZE(pdata->vbus_pin)) {
+ ohci_at91_usb_set_power(pdata, wIndex - 1, 1);
+ ret = 0;
+ }
+
goto out;
}
break;
@@ -312,7 +316,7 @@ static int ohci_at91_hub_control(struct usb_hcd *hcd, u16 typeReq, u16 wValue,
dev_dbg(hcd->self.controller,
"ClearPortFeature: C_OVER_CURRENT\n");
- if (wIndex == 1 || wIndex == 2) {
+ if (wIndex && wIndex <= ARRAY_SIZE(pdata->vbus_pin)) {
pdata->overcurrent_changed[wIndex-1] = 0;
pdata->overcurrent_status[wIndex-1] = 0;
}
@@ -323,7 +327,7 @@ static int ohci_at91_hub_control(struct usb_hcd *hcd, u16 typeReq, u16 wValue,
dev_dbg(hcd->self.controller,
"ClearPortFeature: OVER_CURRENT\n");
- if (wIndex == 1 || wIndex == 2) {
+ if (wIndex && wIndex <= ARRAY_SIZE(pdata->vbus_pin)) {
pdata->overcurrent_status[wIndex-1] = 0;
}
@@ -333,7 +337,7 @@ static int ohci_at91_hub_control(struct usb_hcd *hcd, u16 typeReq, u16 wValue,
dev_dbg(hcd->self.controller,
"ClearPortFeature: POWER\n");
- if (wIndex == 1 || wIndex == 2) {
+ if (wIndex && wIndex <= ARRAY_SIZE(pdata->vbus_pin)) {
ohci_at91_usb_set_power(pdata, wIndex - 1, 0);
return 0;
}
@@ -377,7 +381,7 @@ static int ohci_at91_hub_control(struct usb_hcd *hcd, u16 typeReq, u16 wValue,
dev_dbg(hcd->self.controller, "GetPortStatus(%d)\n", wIndex);
- if (wIndex == 1 || wIndex == 2) {
+ if (wIndex && wIndex <= ARRAY_SIZE(pdata->vbus_pin)) {
if (! ohci_at91_usb_get_power(pdata, wIndex-1)) {
*data &= ~cpu_to_le32(RH_PS_PPS);
}
@@ -514,7 +518,7 @@ static int __devinit ohci_at91_of_init(struct platform_device *pdev)
if (!of_property_read_u32(np, "num-ports", &ports))
pdata->ports = ports;
- for (i = 0; i < 2; i++) {
+ for (i = 0; i < ARRAY_SIZE(pdata->vbus_pin); i++) {
gpio = of_get_named_gpio_flags(np, "atmel,vbus-gpio", i, &flags);
pdata->vbus_pin[i] = gpio;
if (!gpio_is_valid(gpio))
@@ -522,7 +526,7 @@ static int __devinit ohci_at91_of_init(struct platform_device *pdev)
pdata->vbus_pin_active_low[i] = flags & OF_GPIO_ACTIVE_LOW;
}
- for (i = 0; i < 2; i++)
+ for (i = 0; i < ARRAY_SIZE(pdata->overcurrent_pin); i++)
pdata->overcurrent_pin[i] =
of_get_named_gpio_flags(np, "atmel,oc-gpio", i, &flags);
--
1.7.9.4
^ permalink raw reply related [flat|nested] 38+ messages in thread
* [PATCH 06/12] USB: ohci-at91: change maximum number of ports
@ 2012-03-29 13:27 ` Nicolas Ferre
0 siblings, 0 replies; 38+ messages in thread
From: Nicolas Ferre @ 2012-03-29 13:27 UTC (permalink / raw)
To: linux-arm-kernel
Change number of ports to 3 for newer SoCs. Modify pdata structure
and ohci-at91 code that was dealing with ports information and check
of port indexes.
Signed-off-by: Nicolas Ferre <nicolas.ferre@atmel.com>
Acked-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
---
arch/arm/mach-at91/include/mach/board.h | 13 +++++++------
drivers/usb/host/ohci-at91.c | 22 +++++++++++++---------
2 files changed, 20 insertions(+), 15 deletions(-)
diff --git a/arch/arm/mach-at91/include/mach/board.h b/arch/arm/mach-at91/include/mach/board.h
index 544a5d5..49a8211 100644
--- a/arch/arm/mach-at91/include/mach/board.h
+++ b/arch/arm/mach-at91/include/mach/board.h
@@ -86,14 +86,15 @@ extern void __init at91_add_device_mci(short mmc_id, struct mci_platform_data *d
extern void __init at91_add_device_eth(struct macb_platform_data *data);
/* USB Host */
+#define AT91_MAX_USBH_PORTS 3
struct at91_usbh_data {
- u8 ports; /* number of ports on root hub */
- int vbus_pin[2]; /* port power-control pin */
- u8 vbus_pin_active_low[2];
+ int vbus_pin[AT91_MAX_USBH_PORTS]; /* port power-control pin */
+ int overcurrent_pin[AT91_MAX_USBH_PORTS];
+ u8 ports; /* number of ports on root hub */
u8 overcurrent_supported;
- int overcurrent_pin[2];
- u8 overcurrent_status[2];
- u8 overcurrent_changed[2];
+ u8 vbus_pin_active_low[AT91_MAX_USBH_PORTS];
+ u8 overcurrent_status[AT91_MAX_USBH_PORTS];
+ u8 overcurrent_changed[AT91_MAX_USBH_PORTS];
};
extern void __init at91_add_device_usbh(struct at91_usbh_data *data);
extern void __init at91_add_device_usbh_ohci(struct at91_usbh_data *data);
diff --git a/drivers/usb/host/ohci-at91.c b/drivers/usb/host/ohci-at91.c
index 1262532..cf9707d 100644
--- a/drivers/usb/host/ohci-at91.c
+++ b/drivers/usb/host/ohci-at91.c
@@ -240,7 +240,7 @@ ohci_at91_start (struct usb_hcd *hcd)
static void ohci_at91_usb_set_power(struct at91_usbh_data *pdata, int port, int enable)
{
- if (port < 0 || port >= 2)
+ if (port < 0 || port >= ARRAY_SIZE(pdata->vbus_pin))
return;
if (!gpio_is_valid(pdata->vbus_pin[port]))
@@ -252,7 +252,7 @@ static void ohci_at91_usb_set_power(struct at91_usbh_data *pdata, int port, int
static int ohci_at91_usb_get_power(struct at91_usbh_data *pdata, int port)
{
- if (port < 0 || port >= 2)
+ if (port < 0 || port >= ARRAY_SIZE(pdata->vbus_pin))
return -EINVAL;
if (!gpio_is_valid(pdata->vbus_pin[port]))
@@ -301,7 +301,11 @@ static int ohci_at91_hub_control(struct usb_hcd *hcd, u16 typeReq, u16 wValue,
case SetPortFeature:
if (wValue == USB_PORT_FEAT_POWER) {
dev_dbg(hcd->self.controller, "SetPortFeat: POWER\n");
- ohci_at91_usb_set_power(pdata, wIndex - 1, 1);
+ if (wIndex && wIndex <= ARRAY_SIZE(pdata->vbus_pin)) {
+ ohci_at91_usb_set_power(pdata, wIndex - 1, 1);
+ ret = 0;
+ }
+
goto out;
}
break;
@@ -312,7 +316,7 @@ static int ohci_at91_hub_control(struct usb_hcd *hcd, u16 typeReq, u16 wValue,
dev_dbg(hcd->self.controller,
"ClearPortFeature: C_OVER_CURRENT\n");
- if (wIndex == 1 || wIndex == 2) {
+ if (wIndex && wIndex <= ARRAY_SIZE(pdata->vbus_pin)) {
pdata->overcurrent_changed[wIndex-1] = 0;
pdata->overcurrent_status[wIndex-1] = 0;
}
@@ -323,7 +327,7 @@ static int ohci_at91_hub_control(struct usb_hcd *hcd, u16 typeReq, u16 wValue,
dev_dbg(hcd->self.controller,
"ClearPortFeature: OVER_CURRENT\n");
- if (wIndex == 1 || wIndex == 2) {
+ if (wIndex && wIndex <= ARRAY_SIZE(pdata->vbus_pin)) {
pdata->overcurrent_status[wIndex-1] = 0;
}
@@ -333,7 +337,7 @@ static int ohci_at91_hub_control(struct usb_hcd *hcd, u16 typeReq, u16 wValue,
dev_dbg(hcd->self.controller,
"ClearPortFeature: POWER\n");
- if (wIndex == 1 || wIndex == 2) {
+ if (wIndex && wIndex <= ARRAY_SIZE(pdata->vbus_pin)) {
ohci_at91_usb_set_power(pdata, wIndex - 1, 0);
return 0;
}
@@ -377,7 +381,7 @@ static int ohci_at91_hub_control(struct usb_hcd *hcd, u16 typeReq, u16 wValue,
dev_dbg(hcd->self.controller, "GetPortStatus(%d)\n", wIndex);
- if (wIndex == 1 || wIndex == 2) {
+ if (wIndex && wIndex <= ARRAY_SIZE(pdata->vbus_pin)) {
if (! ohci_at91_usb_get_power(pdata, wIndex-1)) {
*data &= ~cpu_to_le32(RH_PS_PPS);
}
@@ -514,7 +518,7 @@ static int __devinit ohci_at91_of_init(struct platform_device *pdev)
if (!of_property_read_u32(np, "num-ports", &ports))
pdata->ports = ports;
- for (i = 0; i < 2; i++) {
+ for (i = 0; i < ARRAY_SIZE(pdata->vbus_pin); i++) {
gpio = of_get_named_gpio_flags(np, "atmel,vbus-gpio", i, &flags);
pdata->vbus_pin[i] = gpio;
if (!gpio_is_valid(gpio))
@@ -522,7 +526,7 @@ static int __devinit ohci_at91_of_init(struct platform_device *pdev)
pdata->vbus_pin_active_low[i] = flags & OF_GPIO_ACTIVE_LOW;
}
- for (i = 0; i < 2; i++)
+ for (i = 0; i < ARRAY_SIZE(pdata->overcurrent_pin); i++)
pdata->overcurrent_pin[i] =
of_get_named_gpio_flags(np, "atmel,oc-gpio", i, &flags);
--
1.7.9.4
^ permalink raw reply related [flat|nested] 38+ messages in thread
* [PATCH 07/12] USB: ohci-at91: coding style modifications with one-line ifs
2012-03-29 13:27 ` Nicolas Ferre
@ 2012-03-29 13:27 ` Nicolas Ferre
-1 siblings, 0 replies; 38+ messages in thread
From: Nicolas Ferre @ 2012-03-29 13:27 UTC (permalink / raw)
To: linux-arm-kernel, linux-usb
Cc: plagnioj, ludovic.desroches, linux-kernel, arnd, olof, Nicolas Ferre
Signed-off-by: Nicolas Ferre <nicolas.ferre@atmel.com>
Acked-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
---
drivers/usb/host/ohci-at91.c | 12 ++++--------
1 file changed, 4 insertions(+), 8 deletions(-)
diff --git a/drivers/usb/host/ohci-at91.c b/drivers/usb/host/ohci-at91.c
index cf9707d..dd58b555 100644
--- a/drivers/usb/host/ohci-at91.c
+++ b/drivers/usb/host/ohci-at91.c
@@ -327,9 +327,8 @@ static int ohci_at91_hub_control(struct usb_hcd *hcd, u16 typeReq, u16 wValue,
dev_dbg(hcd->self.controller,
"ClearPortFeature: OVER_CURRENT\n");
- if (wIndex && wIndex <= ARRAY_SIZE(pdata->vbus_pin)) {
+ if (wIndex && wIndex <= ARRAY_SIZE(pdata->vbus_pin))
pdata->overcurrent_status[wIndex-1] = 0;
- }
goto out;
@@ -382,17 +381,14 @@ static int ohci_at91_hub_control(struct usb_hcd *hcd, u16 typeReq, u16 wValue,
dev_dbg(hcd->self.controller, "GetPortStatus(%d)\n", wIndex);
if (wIndex && wIndex <= ARRAY_SIZE(pdata->vbus_pin)) {
- if (! ohci_at91_usb_get_power(pdata, wIndex-1)) {
+ if (! ohci_at91_usb_get_power(pdata, wIndex-1))
*data &= ~cpu_to_le32(RH_PS_PPS);
- }
- if (pdata->overcurrent_changed[wIndex-1]) {
+ if (pdata->overcurrent_changed[wIndex-1])
*data |= cpu_to_le32(RH_PS_OCIC);
- }
- if (pdata->overcurrent_status[wIndex-1]) {
+ if (pdata->overcurrent_status[wIndex-1])
*data |= cpu_to_le32(RH_PS_POCI);
- }
}
}
--
1.7.9.4
^ permalink raw reply related [flat|nested] 38+ messages in thread
* [PATCH 07/12] USB: ohci-at91: coding style modifications with one-line ifs
@ 2012-03-29 13:27 ` Nicolas Ferre
0 siblings, 0 replies; 38+ messages in thread
From: Nicolas Ferre @ 2012-03-29 13:27 UTC (permalink / raw)
To: linux-arm-kernel
Signed-off-by: Nicolas Ferre <nicolas.ferre@atmel.com>
Acked-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
---
drivers/usb/host/ohci-at91.c | 12 ++++--------
1 file changed, 4 insertions(+), 8 deletions(-)
diff --git a/drivers/usb/host/ohci-at91.c b/drivers/usb/host/ohci-at91.c
index cf9707d..dd58b555 100644
--- a/drivers/usb/host/ohci-at91.c
+++ b/drivers/usb/host/ohci-at91.c
@@ -327,9 +327,8 @@ static int ohci_at91_hub_control(struct usb_hcd *hcd, u16 typeReq, u16 wValue,
dev_dbg(hcd->self.controller,
"ClearPortFeature: OVER_CURRENT\n");
- if (wIndex && wIndex <= ARRAY_SIZE(pdata->vbus_pin)) {
+ if (wIndex && wIndex <= ARRAY_SIZE(pdata->vbus_pin))
pdata->overcurrent_status[wIndex-1] = 0;
- }
goto out;
@@ -382,17 +381,14 @@ static int ohci_at91_hub_control(struct usb_hcd *hcd, u16 typeReq, u16 wValue,
dev_dbg(hcd->self.controller, "GetPortStatus(%d)\n", wIndex);
if (wIndex && wIndex <= ARRAY_SIZE(pdata->vbus_pin)) {
- if (! ohci_at91_usb_get_power(pdata, wIndex-1)) {
+ if (! ohci_at91_usb_get_power(pdata, wIndex-1))
*data &= ~cpu_to_le32(RH_PS_PPS);
- }
- if (pdata->overcurrent_changed[wIndex-1]) {
+ if (pdata->overcurrent_changed[wIndex-1])
*data |= cpu_to_le32(RH_PS_OCIC);
- }
- if (pdata->overcurrent_status[wIndex-1]) {
+ if (pdata->overcurrent_status[wIndex-1])
*data |= cpu_to_le32(RH_PS_POCI);
- }
}
}
--
1.7.9.4
^ permalink raw reply related [flat|nested] 38+ messages in thread
* [PATCH 08/12] USB: ohci-at91: trivial return code name change
2012-03-29 13:27 ` Nicolas Ferre
@ 2012-03-29 13:27 ` Nicolas Ferre
-1 siblings, 0 replies; 38+ messages in thread
From: Nicolas Ferre @ 2012-03-29 13:27 UTC (permalink / raw)
To: linux-arm-kernel, linux-usb
Cc: plagnioj, ludovic.desroches, linux-kernel, arnd, olof, Nicolas Ferre
Signed-off-by: Nicolas Ferre <nicolas.ferre@atmel.com>
Acked-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
---
drivers/usb/host/ohci-at91.c | 7 +++----
1 file changed, 3 insertions(+), 4 deletions(-)
diff --git a/drivers/usb/host/ohci-at91.c b/drivers/usb/host/ohci-at91.c
index dd58b555..81c1f3d 100644
--- a/drivers/usb/host/ohci-at91.c
+++ b/drivers/usb/host/ohci-at91.c
@@ -546,10 +546,9 @@ static int ohci_hcd_at91_drv_probe(struct platform_device *pdev)
int gpio;
int ret;
- i = ohci_at91_of_init(pdev);
-
- if (i)
- return i;
+ ret = ohci_at91_of_init(pdev);
+ if (ret)
+ return ret;
pdata = pdev->dev.platform_data;
--
1.7.9.4
^ permalink raw reply related [flat|nested] 38+ messages in thread
* [PATCH 08/12] USB: ohci-at91: trivial return code name change
@ 2012-03-29 13:27 ` Nicolas Ferre
0 siblings, 0 replies; 38+ messages in thread
From: Nicolas Ferre @ 2012-03-29 13:27 UTC (permalink / raw)
To: linux-arm-kernel
Signed-off-by: Nicolas Ferre <nicolas.ferre@atmel.com>
Acked-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
---
drivers/usb/host/ohci-at91.c | 7 +++----
1 file changed, 3 insertions(+), 4 deletions(-)
diff --git a/drivers/usb/host/ohci-at91.c b/drivers/usb/host/ohci-at91.c
index dd58b555..81c1f3d 100644
--- a/drivers/usb/host/ohci-at91.c
+++ b/drivers/usb/host/ohci-at91.c
@@ -546,10 +546,9 @@ static int ohci_hcd_at91_drv_probe(struct platform_device *pdev)
int gpio;
int ret;
- i = ohci_at91_of_init(pdev);
-
- if (i)
- return i;
+ ret = ohci_at91_of_init(pdev);
+ if (ret)
+ return ret;
pdata = pdev->dev.platform_data;
--
1.7.9.4
^ permalink raw reply related [flat|nested] 38+ messages in thread
* [PATCH 09/12] ARM: at91/at91sam9x5.dtsi: fix NAND ale/cle in DT file
2012-03-29 13:27 ` Nicolas Ferre
@ 2012-03-29 13:27 ` Nicolas Ferre
-1 siblings, 0 replies; 38+ messages in thread
From: Nicolas Ferre @ 2012-03-29 13:27 UTC (permalink / raw)
To: linux-arm-kernel, linux-usb
Cc: plagnioj, ludovic.desroches, linux-kernel, arnd, olof, Nicolas Ferre
Signed-off-by: Nicolas Ferre <nicolas.ferre@atmel.com>
Acked-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
---
arch/arm/boot/dts/at91sam9x5.dtsi | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/arch/arm/boot/dts/at91sam9x5.dtsi b/arch/arm/boot/dts/at91sam9x5.dtsi
index c111001..6597177 100644
--- a/arch/arm/boot/dts/at91sam9x5.dtsi
+++ b/arch/arm/boot/dts/at91sam9x5.dtsi
@@ -201,8 +201,8 @@
>;
atmel,nand-addr-offset = <21>;
atmel,nand-cmd-offset = <22>;
- gpios = <&pioC 8 0
- &pioC 14 0
+ gpios = <&pioD 5 0
+ &pioD 4 0
0
>;
status = "disabled";
--
1.7.9.4
^ permalink raw reply related [flat|nested] 38+ messages in thread
* [PATCH 09/12] ARM: at91/at91sam9x5.dtsi: fix NAND ale/cle in DT file
@ 2012-03-29 13:27 ` Nicolas Ferre
0 siblings, 0 replies; 38+ messages in thread
From: Nicolas Ferre @ 2012-03-29 13:27 UTC (permalink / raw)
To: linux-arm-kernel
Signed-off-by: Nicolas Ferre <nicolas.ferre@atmel.com>
Acked-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
---
arch/arm/boot/dts/at91sam9x5.dtsi | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/arch/arm/boot/dts/at91sam9x5.dtsi b/arch/arm/boot/dts/at91sam9x5.dtsi
index c111001..6597177 100644
--- a/arch/arm/boot/dts/at91sam9x5.dtsi
+++ b/arch/arm/boot/dts/at91sam9x5.dtsi
@@ -201,8 +201,8 @@
>;
atmel,nand-addr-offset = <21>;
atmel,nand-cmd-offset = <22>;
- gpios = <&pioC 8 0
- &pioC 14 0
+ gpios = <&pioD 5 0
+ &pioD 4 0
0
>;
status = "disabled";
--
1.7.9.4
^ permalink raw reply related [flat|nested] 38+ messages in thread
* [PATCH 10/12] ARM: at91/NAND DT bindings: add comments
2012-03-29 13:27 ` Nicolas Ferre
@ 2012-03-29 13:27 ` Nicolas Ferre
-1 siblings, 0 replies; 38+ messages in thread
From: Nicolas Ferre @ 2012-03-29 13:27 UTC (permalink / raw)
To: linux-arm-kernel, linux-usb
Cc: plagnioj, ludovic.desroches, linux-kernel, arnd, olof, Nicolas Ferre
Add comments to NAND "gpios" property to make it clearer.
Signed-off-by: Nicolas Ferre <nicolas.ferre@atmel.com>
Acked-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
---
.../devicetree/bindings/mtd/atmel-nand.txt | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/Documentation/devicetree/bindings/mtd/atmel-nand.txt b/Documentation/devicetree/bindings/mtd/atmel-nand.txt
index 5903ecf..a200695 100644
--- a/Documentation/devicetree/bindings/mtd/atmel-nand.txt
+++ b/Documentation/devicetree/bindings/mtd/atmel-nand.txt
@@ -27,13 +27,13 @@ nand0: nand@40000000,0 {
reg = <0x40000000 0x10000000
0xffffe800 0x200
>;
- atmel,nand-addr-offset = <21>;
- atmel,nand-cmd-offset = <22>;
+ atmel,nand-addr-offset = <21>; /* ale */
+ atmel,nand-cmd-offset = <22>; /* cle */
nand-on-flash-bbt;
nand-ecc-mode = "soft";
- gpios = <&pioC 13 0
- &pioC 14 0
- 0
+ gpios = <&pioC 13 0 /* rdy */
+ &pioC 14 0 /* nce */
+ 0 /* cd */
>;
partition@0 {
...
--
1.7.9.4
^ permalink raw reply related [flat|nested] 38+ messages in thread
* [PATCH 10/12] ARM: at91/NAND DT bindings: add comments
@ 2012-03-29 13:27 ` Nicolas Ferre
0 siblings, 0 replies; 38+ messages in thread
From: Nicolas Ferre @ 2012-03-29 13:27 UTC (permalink / raw)
To: linux-arm-kernel
Add comments to NAND "gpios" property to make it clearer.
Signed-off-by: Nicolas Ferre <nicolas.ferre@atmel.com>
Acked-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
---
.../devicetree/bindings/mtd/atmel-nand.txt | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/Documentation/devicetree/bindings/mtd/atmel-nand.txt b/Documentation/devicetree/bindings/mtd/atmel-nand.txt
index 5903ecf..a200695 100644
--- a/Documentation/devicetree/bindings/mtd/atmel-nand.txt
+++ b/Documentation/devicetree/bindings/mtd/atmel-nand.txt
@@ -27,13 +27,13 @@ nand0: nand at 40000000,0 {
reg = <0x40000000 0x10000000
0xffffe800 0x200
>;
- atmel,nand-addr-offset = <21>;
- atmel,nand-cmd-offset = <22>;
+ atmel,nand-addr-offset = <21>; /* ale */
+ atmel,nand-cmd-offset = <22>; /* cle */
nand-on-flash-bbt;
nand-ecc-mode = "soft";
- gpios = <&pioC 13 0
- &pioC 14 0
- 0
+ gpios = <&pioC 13 0 /* rdy */
+ &pioC 14 0 /* nce */
+ 0 /* cd */
>;
partition at 0 {
...
--
1.7.9.4
^ permalink raw reply related [flat|nested] 38+ messages in thread
* [PATCH 11/12] USB: ehci-atmel: add needed of.h header file
2012-03-29 13:27 ` Nicolas Ferre
@ 2012-03-29 13:27 ` Nicolas Ferre
-1 siblings, 0 replies; 38+ messages in thread
From: Nicolas Ferre @ 2012-03-29 13:27 UTC (permalink / raw)
To: linux-arm-kernel, linux-usb
Cc: plagnioj, ludovic.desroches, linux-kernel, arnd, olof, Nicolas Ferre
Compilation error in case of non-DT configuration without this
of.h header file.
Signed-off-by: Nicolas Ferre <nicolas.ferre@atmel.com>
Acked-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
---
drivers/usb/host/ehci-atmel.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/drivers/usb/host/ehci-atmel.c b/drivers/usb/host/ehci-atmel.c
index 19f318a..cf14c95 100644
--- a/drivers/usb/host/ehci-atmel.c
+++ b/drivers/usb/host/ehci-atmel.c
@@ -13,6 +13,7 @@
#include <linux/clk.h>
#include <linux/platform_device.h>
+#include <linux/of.h>
#include <linux/of_platform.h>
/* interface and function clocks */
--
1.7.9.4
^ permalink raw reply related [flat|nested] 38+ messages in thread
* [PATCH 11/12] USB: ehci-atmel: add needed of.h header file
@ 2012-03-29 13:27 ` Nicolas Ferre
0 siblings, 0 replies; 38+ messages in thread
From: Nicolas Ferre @ 2012-03-29 13:27 UTC (permalink / raw)
To: linux-arm-kernel
Compilation error in case of non-DT configuration without this
of.h header file.
Signed-off-by: Nicolas Ferre <nicolas.ferre@atmel.com>
Acked-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
---
drivers/usb/host/ehci-atmel.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/drivers/usb/host/ehci-atmel.c b/drivers/usb/host/ehci-atmel.c
index 19f318a..cf14c95 100644
--- a/drivers/usb/host/ehci-atmel.c
+++ b/drivers/usb/host/ehci-atmel.c
@@ -13,6 +13,7 @@
#include <linux/clk.h>
#include <linux/platform_device.h>
+#include <linux/of.h>
#include <linux/of_platform.h>
/* interface and function clocks */
--
1.7.9.4
^ permalink raw reply related [flat|nested] 38+ messages in thread
* [PATCH 12/12] ARM: at91: fix check of valid GPIO for SPI and USB
2012-03-29 13:27 ` Nicolas Ferre
@ 2012-03-29 13:27 ` Nicolas Ferre
-1 siblings, 0 replies; 38+ messages in thread
From: Nicolas Ferre @ 2012-03-29 13:27 UTC (permalink / raw)
To: linux-arm-kernel, linux-usb
Cc: plagnioj, ludovic.desroches, linux-kernel, arnd, olof, Nicolas Ferre
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 5cdca89d..32ce589 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 763deba..9cff8b4 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);
}
@@ -788,6 +788,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
^ permalink raw reply related [flat|nested] 38+ messages in thread
* [PATCH 12/12] ARM: at91: fix check of valid GPIO for SPI and USB
@ 2012-03-29 13:27 ` Nicolas Ferre
0 siblings, 0 replies; 38+ messages in thread
From: Nicolas Ferre @ 2012-03-29 13:27 UTC (permalink / raw)
To: linux-arm-kernel
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 5cdca89d..32ce589 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 763deba..9cff8b4 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);
}
@@ -788,6 +788,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
^ permalink raw reply related [flat|nested] 38+ messages in thread
* Re: [PATCH 06/12] USB: ohci-at91: change maximum number of ports
2012-03-29 13:27 ` Nicolas Ferre
@ 2012-03-29 15:04 ` Alan Stern
-1 siblings, 0 replies; 38+ messages in thread
From: Alan Stern @ 2012-03-29 15:04 UTC (permalink / raw)
To: Nicolas Ferre
Cc: linux-arm-kernel, linux-usb, plagnioj, ludovic.desroches,
linux-kernel, arnd, olof
On Thu, 29 Mar 2012, Nicolas Ferre wrote:
> Change number of ports to 3 for newer SoCs. Modify pdata structure
> and ohci-at91 code that was dealing with ports information and check
> of port indexes.
>
> Signed-off-by: Nicolas Ferre <nicolas.ferre@atmel.com>
> Acked-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
> ---
> arch/arm/mach-at91/include/mach/board.h | 13 +++++++------
> drivers/usb/host/ohci-at91.c | 22 +++++++++++++---------
> 2 files changed, 20 insertions(+), 15 deletions(-)
>
> diff --git a/arch/arm/mach-at91/include/mach/board.h b/arch/arm/mach-at91/include/mach/board.h
> index 544a5d5..49a8211 100644
> --- a/arch/arm/mach-at91/include/mach/board.h
> +++ b/arch/arm/mach-at91/include/mach/board.h
> @@ -86,14 +86,15 @@ extern void __init at91_add_device_mci(short mmc_id, struct mci_platform_data *d
> extern void __init at91_add_device_eth(struct macb_platform_data *data);
>
> /* USB Host */
> +#define AT91_MAX_USBH_PORTS 3
> struct at91_usbh_data {
> - u8 ports; /* number of ports on root hub */
> - int vbus_pin[2]; /* port power-control pin */
> - u8 vbus_pin_active_low[2];
> + int vbus_pin[AT91_MAX_USBH_PORTS]; /* port power-control pin */
> + int overcurrent_pin[AT91_MAX_USBH_PORTS];
> + u8 ports; /* number of ports on root hub */
> u8 overcurrent_supported;
> - int overcurrent_pin[2];
> - u8 overcurrent_status[2];
> - u8 overcurrent_changed[2];
> + u8 vbus_pin_active_low[AT91_MAX_USBH_PORTS];
> + u8 overcurrent_status[AT91_MAX_USBH_PORTS];
> + u8 overcurrent_changed[AT91_MAX_USBH_PORTS];
> };
> extern void __init at91_add_device_usbh(struct at91_usbh_data *data);
> extern void __init at91_add_device_usbh_ohci(struct at91_usbh_data *data);
> diff --git a/drivers/usb/host/ohci-at91.c b/drivers/usb/host/ohci-at91.c
> index 1262532..cf9707d 100644
> --- a/drivers/usb/host/ohci-at91.c
> +++ b/drivers/usb/host/ohci-at91.c
> @@ -240,7 +240,7 @@ ohci_at91_start (struct usb_hcd *hcd)
>
> static void ohci_at91_usb_set_power(struct at91_usbh_data *pdata, int port, int enable)
> {
> - if (port < 0 || port >= 2)
> + if (port < 0 || port >= ARRAY_SIZE(pdata->vbus_pin))
Here and below, it will be a lot clearer to write AT91_MAX_USBH_PORTS
instead of ARRAY_SIZE(padata->...).
> @@ -301,7 +301,11 @@ static int ohci_at91_hub_control(struct usb_hcd *hcd, u16 typeReq, u16 wValue,
> case SetPortFeature:
> if (wValue == USB_PORT_FEAT_POWER) {
> dev_dbg(hcd->self.controller, "SetPortFeat: POWER\n");
> - ohci_at91_usb_set_power(pdata, wIndex - 1, 1);
> + if (wIndex && wIndex <= ARRAY_SIZE(pdata->vbus_pin)) {
> + ohci_at91_usb_set_power(pdata, wIndex - 1, 1);
Here and throughout the hub_control routine, things will be a lot
simpler if you decrement wIndex at the start of the SetPortFeature
case. Same for ClearPortFeature and maybe also GetPortStatus.
Alan Stern
^ permalink raw reply [flat|nested] 38+ messages in thread
* [PATCH 06/12] USB: ohci-at91: change maximum number of ports
@ 2012-03-29 15:04 ` Alan Stern
0 siblings, 0 replies; 38+ messages in thread
From: Alan Stern @ 2012-03-29 15:04 UTC (permalink / raw)
To: linux-arm-kernel
On Thu, 29 Mar 2012, Nicolas Ferre wrote:
> Change number of ports to 3 for newer SoCs. Modify pdata structure
> and ohci-at91 code that was dealing with ports information and check
> of port indexes.
>
> Signed-off-by: Nicolas Ferre <nicolas.ferre@atmel.com>
> Acked-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
> ---
> arch/arm/mach-at91/include/mach/board.h | 13 +++++++------
> drivers/usb/host/ohci-at91.c | 22 +++++++++++++---------
> 2 files changed, 20 insertions(+), 15 deletions(-)
>
> diff --git a/arch/arm/mach-at91/include/mach/board.h b/arch/arm/mach-at91/include/mach/board.h
> index 544a5d5..49a8211 100644
> --- a/arch/arm/mach-at91/include/mach/board.h
> +++ b/arch/arm/mach-at91/include/mach/board.h
> @@ -86,14 +86,15 @@ extern void __init at91_add_device_mci(short mmc_id, struct mci_platform_data *d
> extern void __init at91_add_device_eth(struct macb_platform_data *data);
>
> /* USB Host */
> +#define AT91_MAX_USBH_PORTS 3
> struct at91_usbh_data {
> - u8 ports; /* number of ports on root hub */
> - int vbus_pin[2]; /* port power-control pin */
> - u8 vbus_pin_active_low[2];
> + int vbus_pin[AT91_MAX_USBH_PORTS]; /* port power-control pin */
> + int overcurrent_pin[AT91_MAX_USBH_PORTS];
> + u8 ports; /* number of ports on root hub */
> u8 overcurrent_supported;
> - int overcurrent_pin[2];
> - u8 overcurrent_status[2];
> - u8 overcurrent_changed[2];
> + u8 vbus_pin_active_low[AT91_MAX_USBH_PORTS];
> + u8 overcurrent_status[AT91_MAX_USBH_PORTS];
> + u8 overcurrent_changed[AT91_MAX_USBH_PORTS];
> };
> extern void __init at91_add_device_usbh(struct at91_usbh_data *data);
> extern void __init at91_add_device_usbh_ohci(struct at91_usbh_data *data);
> diff --git a/drivers/usb/host/ohci-at91.c b/drivers/usb/host/ohci-at91.c
> index 1262532..cf9707d 100644
> --- a/drivers/usb/host/ohci-at91.c
> +++ b/drivers/usb/host/ohci-at91.c
> @@ -240,7 +240,7 @@ ohci_at91_start (struct usb_hcd *hcd)
>
> static void ohci_at91_usb_set_power(struct at91_usbh_data *pdata, int port, int enable)
> {
> - if (port < 0 || port >= 2)
> + if (port < 0 || port >= ARRAY_SIZE(pdata->vbus_pin))
Here and below, it will be a lot clearer to write AT91_MAX_USBH_PORTS
instead of ARRAY_SIZE(padata->...).
> @@ -301,7 +301,11 @@ static int ohci_at91_hub_control(struct usb_hcd *hcd, u16 typeReq, u16 wValue,
> case SetPortFeature:
> if (wValue == USB_PORT_FEAT_POWER) {
> dev_dbg(hcd->self.controller, "SetPortFeat: POWER\n");
> - ohci_at91_usb_set_power(pdata, wIndex - 1, 1);
> + if (wIndex && wIndex <= ARRAY_SIZE(pdata->vbus_pin)) {
> + ohci_at91_usb_set_power(pdata, wIndex - 1, 1);
Here and throughout the hub_control routine, things will be a lot
simpler if you decrement wIndex at the start of the SetPortFeature
case. Same for ClearPortFeature and maybe also GetPortStatus.
Alan Stern
^ permalink raw reply [flat|nested] 38+ messages in thread
* [PATCH] ARM: at91: include newly created system_misc.h file
2012-03-29 13:27 ` Nicolas Ferre
@ 2012-03-30 12:31 ` Nicolas Ferre
-1 siblings, 0 replies; 38+ messages in thread
From: Nicolas Ferre @ 2012-03-30 12:31 UTC (permalink / raw)
To: linux-arm-kernel, plagnioj
Cc: ludovic.desroches, linux-kernel, arnd, olof, Nicolas Ferre
system.h file has been split by commit "0195c00". Now include
system_misc.h for having access to arm_pm_restart.
Signed-off-by: Nicolas Ferre <nicolas.ferre@atmel.com>
---
Hi,
It seems that this split of system.h is now in linus' tree. AT91 build
is broken without this patch.
I will include it in a "at91-fixes" series that I will rebase on top
of 3.4-rc1.
arch/arm/mach-at91/setup.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/arch/arm/mach-at91/setup.c b/arch/arm/mach-at91/setup.c
index 1083739..d4d334a 100644
--- a/arch/arm/mach-at91/setup.c
+++ b/arch/arm/mach-at91/setup.c
@@ -12,6 +12,7 @@
#include <linux/of_address.h>
#include <asm/mach/map.h>
+#include <asm/system_misc.h>
#include <mach/hardware.h>
#include <mach/cpu.h>
--
1.7.9.4
^ permalink raw reply related [flat|nested] 38+ messages in thread
* [PATCH] ARM: at91: include newly created system_misc.h file
@ 2012-03-30 12:31 ` Nicolas Ferre
0 siblings, 0 replies; 38+ messages in thread
From: Nicolas Ferre @ 2012-03-30 12:31 UTC (permalink / raw)
To: linux-arm-kernel
system.h file has been split by commit "0195c00". Now include
system_misc.h for having access to arm_pm_restart.
Signed-off-by: Nicolas Ferre <nicolas.ferre@atmel.com>
---
Hi,
It seems that this split of system.h is now in linus' tree. AT91 build
is broken without this patch.
I will include it in a "at91-fixes" series that I will rebase on top
of 3.4-rc1.
arch/arm/mach-at91/setup.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/arch/arm/mach-at91/setup.c b/arch/arm/mach-at91/setup.c
index 1083739..d4d334a 100644
--- a/arch/arm/mach-at91/setup.c
+++ b/arch/arm/mach-at91/setup.c
@@ -12,6 +12,7 @@
#include <linux/of_address.h>
#include <asm/mach/map.h>
+#include <asm/system_misc.h>
#include <mach/hardware.h>
#include <mach/cpu.h>
--
1.7.9.4
^ permalink raw reply related [flat|nested] 38+ messages in thread
* Re: [PATCH] ARM: at91: include newly created system_misc.h file
2012-03-30 12:31 ` Nicolas Ferre
@ 2012-03-31 21:38 ` Sergei Shtylyov
-1 siblings, 0 replies; 38+ messages in thread
From: Sergei Shtylyov @ 2012-03-31 21:38 UTC (permalink / raw)
To: Nicolas Ferre
Cc: linux-arm-kernel, plagnioj, olof, ludovic.desroches, linux-kernel, arnd
Hello.
On 30-03-2012 16:31, Nicolas Ferre wrote:
> system.h file has been split by commit "0195c00".
Please also specify that commit's summary in parens. And don't put commit
ID into quoates.
> Now include
> system_misc.h for having access to arm_pm_restart.
> Signed-off-by: Nicolas Ferre <nicolas.ferre@atmel.com>
WBR, Sergei
^ permalink raw reply [flat|nested] 38+ messages in thread
* [PATCH] ARM: at91: include newly created system_misc.h file
@ 2012-03-31 21:38 ` Sergei Shtylyov
0 siblings, 0 replies; 38+ messages in thread
From: Sergei Shtylyov @ 2012-03-31 21:38 UTC (permalink / raw)
To: linux-arm-kernel
Hello.
On 30-03-2012 16:31, Nicolas Ferre wrote:
> system.h file has been split by commit "0195c00".
Please also specify that commit's summary in parens. And don't put commit
ID into quoates.
> Now include
> system_misc.h for having access to arm_pm_restart.
> Signed-off-by: Nicolas Ferre <nicolas.ferre@atmel.com>
WBR, Sergei
^ permalink raw reply [flat|nested] 38+ messages in thread
* Re: [PATCH 03/12] ARM: at91/USB host: specify and handle properly vbus_pin_active_low
2012-03-29 13:27 ` Nicolas Ferre
@ 2012-03-31 21:51 ` Sergei Shtylyov
-1 siblings, 0 replies; 38+ messages in thread
From: Sergei Shtylyov @ 2012-03-31 21:51 UTC (permalink / raw)
To: Nicolas Ferre
Cc: linux-arm-kernel, linux-usb, plagnioj, ludovic.desroches,
linux-kernel, arnd, olof
Hello.
On 29-03-2012 17:27, Nicolas Ferre wrote:
> Due to an error while handling vbus_pin_active_low in ohci-at91 driver,
> the specification of this property was not good in devices/board files.
> Signed-off-by: Nicolas Ferre<nicolas.ferre@atmel.com>
> Acked-by: Jean-Christophe PLAGNIOL-VILLARD<plagnioj@jcrosoft.com>
> Cc: stable<stable@vger.kernel.org> [3.2+]
> ---
> arch/arm/mach-at91/at91sam9263_devices.c | 3 ++-
> arch/arm/mach-at91/at91sam9g45_devices.c | 6 ++++--
> arch/arm/mach-at91/board-sam9263ek.c | 1 +
> arch/arm/mach-at91/board-sam9m10g45ek.c | 1 +
> 4 files changed, 8 insertions(+), 3 deletions(-)
>
> diff --git a/arch/arm/mach-at91/at91sam9263_devices.c b/arch/arm/mach-at91/at91sam9263_devices.c
> index 53688c4..5cdca89d 100644
> --- a/arch/arm/mach-at91/at91sam9263_devices.c
> +++ b/arch/arm/mach-at91/at91sam9263_devices.c
> @@ -72,7 +72,8 @@ void __init at91_add_device_usbh(struct at91_usbh_data *data)
> /* Enable VBus control for UHP ports */
> for (i = 0; i< data->ports; i++) {
> if (gpio_is_valid(data->vbus_pin[i]))
> - at91_set_gpio_output(data->vbus_pin[i], 0);
> + at91_set_gpio_output(data->vbus_pin[i],
> + data->vbus_pin_active_low[i] ^ 0);
Note that XOR with 0 is a nop, left operand doesn't change its value.
WBR, Sergei
^ permalink raw reply [flat|nested] 38+ messages in thread
* [PATCH 03/12] ARM: at91/USB host: specify and handle properly vbus_pin_active_low
@ 2012-03-31 21:51 ` Sergei Shtylyov
0 siblings, 0 replies; 38+ messages in thread
From: Sergei Shtylyov @ 2012-03-31 21:51 UTC (permalink / raw)
To: linux-arm-kernel
Hello.
On 29-03-2012 17:27, Nicolas Ferre wrote:
> Due to an error while handling vbus_pin_active_low in ohci-at91 driver,
> the specification of this property was not good in devices/board files.
> Signed-off-by: Nicolas Ferre<nicolas.ferre@atmel.com>
> Acked-by: Jean-Christophe PLAGNIOL-VILLARD<plagnioj@jcrosoft.com>
> Cc: stable<stable@vger.kernel.org> [3.2+]
> ---
> arch/arm/mach-at91/at91sam9263_devices.c | 3 ++-
> arch/arm/mach-at91/at91sam9g45_devices.c | 6 ++++--
> arch/arm/mach-at91/board-sam9263ek.c | 1 +
> arch/arm/mach-at91/board-sam9m10g45ek.c | 1 +
> 4 files changed, 8 insertions(+), 3 deletions(-)
>
> diff --git a/arch/arm/mach-at91/at91sam9263_devices.c b/arch/arm/mach-at91/at91sam9263_devices.c
> index 53688c4..5cdca89d 100644
> --- a/arch/arm/mach-at91/at91sam9263_devices.c
> +++ b/arch/arm/mach-at91/at91sam9263_devices.c
> @@ -72,7 +72,8 @@ void __init at91_add_device_usbh(struct at91_usbh_data *data)
> /* Enable VBus control for UHP ports */
> for (i = 0; i< data->ports; i++) {
> if (gpio_is_valid(data->vbus_pin[i]))
> - at91_set_gpio_output(data->vbus_pin[i], 0);
> + at91_set_gpio_output(data->vbus_pin[i],
> + data->vbus_pin_active_low[i] ^ 0);
Note that XOR with 0 is a nop, left operand doesn't change its value.
WBR, Sergei
^ permalink raw reply [flat|nested] 38+ messages in thread
* Re: [PATCH 03/12] ARM: at91/USB host: specify and handle properly vbus_pin_active_low
2012-03-31 21:51 ` Sergei Shtylyov
@ 2012-04-02 10:19 ` Nicolas Ferre
-1 siblings, 0 replies; 38+ messages in thread
From: Nicolas Ferre @ 2012-04-02 10:19 UTC (permalink / raw)
To: Sergei Shtylyov
Cc: linux-arm-kernel, linux-usb, plagnioj, ludovic.desroches,
linux-kernel, arnd, olof
On 03/31/2012 11:51 PM, Sergei Shtylyov :
> Hello.
>
> On 29-03-2012 17:27, Nicolas Ferre wrote:
>
>> Due to an error while handling vbus_pin_active_low in ohci-at91 driver,
>> the specification of this property was not good in devices/board files.
>
>> Signed-off-by: Nicolas Ferre<nicolas.ferre@atmel.com>
>> Acked-by: Jean-Christophe PLAGNIOL-VILLARD<plagnioj@jcrosoft.com>
>> Cc: stable<stable@vger.kernel.org> [3.2+]
>> ---
>> arch/arm/mach-at91/at91sam9263_devices.c | 3 ++-
>> arch/arm/mach-at91/at91sam9g45_devices.c | 6 ++++--
>> arch/arm/mach-at91/board-sam9263ek.c | 1 +
>> arch/arm/mach-at91/board-sam9m10g45ek.c | 1 +
>> 4 files changed, 8 insertions(+), 3 deletions(-)
>>
>> diff --git a/arch/arm/mach-at91/at91sam9263_devices.c
>> b/arch/arm/mach-at91/at91sam9263_devices.c
>> index 53688c4..5cdca89d 100644
>> --- a/arch/arm/mach-at91/at91sam9263_devices.c
>> +++ b/arch/arm/mach-at91/at91sam9263_devices.c
>> @@ -72,7 +72,8 @@ void __init at91_add_device_usbh(struct
>> at91_usbh_data *data)
>> /* Enable VBus control for UHP ports */
>> for (i = 0; i< data->ports; i++) {
>> if (gpio_is_valid(data->vbus_pin[i]))
>> - at91_set_gpio_output(data->vbus_pin[i], 0);
>> + at91_set_gpio_output(data->vbus_pin[i],
>> + data->vbus_pin_active_low[i] ^ 0);
>
> Note that XOR with 0 is a nop, left operand doesn't change its value.
Sure I will correct that.
Thanks, best regards,
--
Nicolas Ferre
^ permalink raw reply [flat|nested] 38+ messages in thread
* [PATCH 03/12] ARM: at91/USB host: specify and handle properly vbus_pin_active_low
@ 2012-04-02 10:19 ` Nicolas Ferre
0 siblings, 0 replies; 38+ messages in thread
From: Nicolas Ferre @ 2012-04-02 10:19 UTC (permalink / raw)
To: linux-arm-kernel
On 03/31/2012 11:51 PM, Sergei Shtylyov :
> Hello.
>
> On 29-03-2012 17:27, Nicolas Ferre wrote:
>
>> Due to an error while handling vbus_pin_active_low in ohci-at91 driver,
>> the specification of this property was not good in devices/board files.
>
>> Signed-off-by: Nicolas Ferre<nicolas.ferre@atmel.com>
>> Acked-by: Jean-Christophe PLAGNIOL-VILLARD<plagnioj@jcrosoft.com>
>> Cc: stable<stable@vger.kernel.org> [3.2+]
>> ---
>> arch/arm/mach-at91/at91sam9263_devices.c | 3 ++-
>> arch/arm/mach-at91/at91sam9g45_devices.c | 6 ++++--
>> arch/arm/mach-at91/board-sam9263ek.c | 1 +
>> arch/arm/mach-at91/board-sam9m10g45ek.c | 1 +
>> 4 files changed, 8 insertions(+), 3 deletions(-)
>>
>> diff --git a/arch/arm/mach-at91/at91sam9263_devices.c
>> b/arch/arm/mach-at91/at91sam9263_devices.c
>> index 53688c4..5cdca89d 100644
>> --- a/arch/arm/mach-at91/at91sam9263_devices.c
>> +++ b/arch/arm/mach-at91/at91sam9263_devices.c
>> @@ -72,7 +72,8 @@ void __init at91_add_device_usbh(struct
>> at91_usbh_data *data)
>> /* Enable VBus control for UHP ports */
>> for (i = 0; i< data->ports; i++) {
>> if (gpio_is_valid(data->vbus_pin[i]))
>> - at91_set_gpio_output(data->vbus_pin[i], 0);
>> + at91_set_gpio_output(data->vbus_pin[i],
>> + data->vbus_pin_active_low[i] ^ 0);
>
> Note that XOR with 0 is a nop, left operand doesn't change its value.
Sure I will correct that.
Thanks, best regards,
--
Nicolas Ferre
^ permalink raw reply [flat|nested] 38+ messages in thread
* Re: [PATCH 06/12] USB: ohci-at91: change maximum number of ports
2012-03-29 15:04 ` Alan Stern
@ 2012-04-02 10:21 ` Nicolas Ferre
-1 siblings, 0 replies; 38+ messages in thread
From: Nicolas Ferre @ 2012-04-02 10:21 UTC (permalink / raw)
To: Alan Stern
Cc: linux-arm-kernel, linux-usb, plagnioj, ludovic.desroches,
linux-kernel, arnd, olof
On 03/29/2012 05:04 PM, Alan Stern :
> On Thu, 29 Mar 2012, Nicolas Ferre wrote:
>
>> Change number of ports to 3 for newer SoCs. Modify pdata structure
>> and ohci-at91 code that was dealing with ports information and check
>> of port indexes.
>>
>> Signed-off-by: Nicolas Ferre <nicolas.ferre@atmel.com>
>> Acked-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
>> ---
>> arch/arm/mach-at91/include/mach/board.h | 13 +++++++------
>> drivers/usb/host/ohci-at91.c | 22 +++++++++++++---------
>> 2 files changed, 20 insertions(+), 15 deletions(-)
>>
>> diff --git a/arch/arm/mach-at91/include/mach/board.h b/arch/arm/mach-at91/include/mach/board.h
>> index 544a5d5..49a8211 100644
>> --- a/arch/arm/mach-at91/include/mach/board.h
>> +++ b/arch/arm/mach-at91/include/mach/board.h
>> @@ -86,14 +86,15 @@ extern void __init at91_add_device_mci(short mmc_id, struct mci_platform_data *d
>> extern void __init at91_add_device_eth(struct macb_platform_data *data);
>>
>> /* USB Host */
>> +#define AT91_MAX_USBH_PORTS 3
>> struct at91_usbh_data {
>> - u8 ports; /* number of ports on root hub */
>> - int vbus_pin[2]; /* port power-control pin */
>> - u8 vbus_pin_active_low[2];
>> + int vbus_pin[AT91_MAX_USBH_PORTS]; /* port power-control pin */
>> + int overcurrent_pin[AT91_MAX_USBH_PORTS];
>> + u8 ports; /* number of ports on root hub */
>> u8 overcurrent_supported;
>> - int overcurrent_pin[2];
>> - u8 overcurrent_status[2];
>> - u8 overcurrent_changed[2];
>> + u8 vbus_pin_active_low[AT91_MAX_USBH_PORTS];
>> + u8 overcurrent_status[AT91_MAX_USBH_PORTS];
>> + u8 overcurrent_changed[AT91_MAX_USBH_PORTS];
>> };
>> extern void __init at91_add_device_usbh(struct at91_usbh_data *data);
>> extern void __init at91_add_device_usbh_ohci(struct at91_usbh_data *data);
>> diff --git a/drivers/usb/host/ohci-at91.c b/drivers/usb/host/ohci-at91.c
>> index 1262532..cf9707d 100644
>> --- a/drivers/usb/host/ohci-at91.c
>> +++ b/drivers/usb/host/ohci-at91.c
>> @@ -240,7 +240,7 @@ ohci_at91_start (struct usb_hcd *hcd)
>>
>> static void ohci_at91_usb_set_power(struct at91_usbh_data *pdata, int port, int enable)
>> {
>> - if (port < 0 || port >= 2)
>> + if (port < 0 || port >= ARRAY_SIZE(pdata->vbus_pin))
>
> Here and below, it will be a lot clearer to write AT91_MAX_USBH_PORTS
> instead of ARRAY_SIZE(padata->...).
>
>> @@ -301,7 +301,11 @@ static int ohci_at91_hub_control(struct usb_hcd *hcd, u16 typeReq, u16 wValue,
>> case SetPortFeature:
>> if (wValue == USB_PORT_FEAT_POWER) {
>> dev_dbg(hcd->self.controller, "SetPortFeat: POWER\n");
>> - ohci_at91_usb_set_power(pdata, wIndex - 1, 1);
>> + if (wIndex && wIndex <= ARRAY_SIZE(pdata->vbus_pin)) {
>> + ohci_at91_usb_set_power(pdata, wIndex - 1, 1);
>
> Here and throughout the hub_control routine, things will be a lot
> simpler if you decrement wIndex at the start of the SetPortFeature
> case. Same for ClearPortFeature and maybe also GetPortStatus.
Ok, I will modify it according to your sugestions in a v2 patch series.
Best regards,
--
Nicolas Ferre
^ permalink raw reply [flat|nested] 38+ messages in thread
* [PATCH 06/12] USB: ohci-at91: change maximum number of ports
@ 2012-04-02 10:21 ` Nicolas Ferre
0 siblings, 0 replies; 38+ messages in thread
From: Nicolas Ferre @ 2012-04-02 10:21 UTC (permalink / raw)
To: linux-arm-kernel
On 03/29/2012 05:04 PM, Alan Stern :
> On Thu, 29 Mar 2012, Nicolas Ferre wrote:
>
>> Change number of ports to 3 for newer SoCs. Modify pdata structure
>> and ohci-at91 code that was dealing with ports information and check
>> of port indexes.
>>
>> Signed-off-by: Nicolas Ferre <nicolas.ferre@atmel.com>
>> Acked-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
>> ---
>> arch/arm/mach-at91/include/mach/board.h | 13 +++++++------
>> drivers/usb/host/ohci-at91.c | 22 +++++++++++++---------
>> 2 files changed, 20 insertions(+), 15 deletions(-)
>>
>> diff --git a/arch/arm/mach-at91/include/mach/board.h b/arch/arm/mach-at91/include/mach/board.h
>> index 544a5d5..49a8211 100644
>> --- a/arch/arm/mach-at91/include/mach/board.h
>> +++ b/arch/arm/mach-at91/include/mach/board.h
>> @@ -86,14 +86,15 @@ extern void __init at91_add_device_mci(short mmc_id, struct mci_platform_data *d
>> extern void __init at91_add_device_eth(struct macb_platform_data *data);
>>
>> /* USB Host */
>> +#define AT91_MAX_USBH_PORTS 3
>> struct at91_usbh_data {
>> - u8 ports; /* number of ports on root hub */
>> - int vbus_pin[2]; /* port power-control pin */
>> - u8 vbus_pin_active_low[2];
>> + int vbus_pin[AT91_MAX_USBH_PORTS]; /* port power-control pin */
>> + int overcurrent_pin[AT91_MAX_USBH_PORTS];
>> + u8 ports; /* number of ports on root hub */
>> u8 overcurrent_supported;
>> - int overcurrent_pin[2];
>> - u8 overcurrent_status[2];
>> - u8 overcurrent_changed[2];
>> + u8 vbus_pin_active_low[AT91_MAX_USBH_PORTS];
>> + u8 overcurrent_status[AT91_MAX_USBH_PORTS];
>> + u8 overcurrent_changed[AT91_MAX_USBH_PORTS];
>> };
>> extern void __init at91_add_device_usbh(struct at91_usbh_data *data);
>> extern void __init at91_add_device_usbh_ohci(struct at91_usbh_data *data);
>> diff --git a/drivers/usb/host/ohci-at91.c b/drivers/usb/host/ohci-at91.c
>> index 1262532..cf9707d 100644
>> --- a/drivers/usb/host/ohci-at91.c
>> +++ b/drivers/usb/host/ohci-at91.c
>> @@ -240,7 +240,7 @@ ohci_at91_start (struct usb_hcd *hcd)
>>
>> static void ohci_at91_usb_set_power(struct at91_usbh_data *pdata, int port, int enable)
>> {
>> - if (port < 0 || port >= 2)
>> + if (port < 0 || port >= ARRAY_SIZE(pdata->vbus_pin))
>
> Here and below, it will be a lot clearer to write AT91_MAX_USBH_PORTS
> instead of ARRAY_SIZE(padata->...).
>
>> @@ -301,7 +301,11 @@ static int ohci_at91_hub_control(struct usb_hcd *hcd, u16 typeReq, u16 wValue,
>> case SetPortFeature:
>> if (wValue == USB_PORT_FEAT_POWER) {
>> dev_dbg(hcd->self.controller, "SetPortFeat: POWER\n");
>> - ohci_at91_usb_set_power(pdata, wIndex - 1, 1);
>> + if (wIndex && wIndex <= ARRAY_SIZE(pdata->vbus_pin)) {
>> + ohci_at91_usb_set_power(pdata, wIndex - 1, 1);
>
> Here and throughout the hub_control routine, things will be a lot
> simpler if you decrement wIndex at the start of the SetPortFeature
> case. Same for ClearPortFeature and maybe also GetPortStatus.
Ok, I will modify it according to your sugestions in a v2 patch series.
Best regards,
--
Nicolas Ferre
^ permalink raw reply [flat|nested] 38+ messages in thread
end of thread, other threads:[~2012-04-02 10:21 UTC | newest]
Thread overview: 38+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-03-29 13:27 [PATCH 00/12] at91: 3.4-rc1 fixes Nicolas Ferre
2012-03-29 13:27 ` Nicolas Ferre
2012-03-29 13:27 ` [PATCH 01/12] ARM: at91/at91sam9x5: add clkdev entries for DMA controllers Nicolas Ferre
2012-03-29 13:27 ` Nicolas Ferre
2012-03-29 13:27 ` [PATCH 02/12] USB: ohci-at91: fix vbus_pin_active_low handling Nicolas Ferre
2012-03-29 13:27 ` Nicolas Ferre
2012-03-29 13:27 ` [PATCH 03/12] ARM: at91/USB host: specify and handle properly vbus_pin_active_low Nicolas Ferre
2012-03-29 13:27 ` Nicolas Ferre
2012-03-31 21:51 ` Sergei Shtylyov
2012-03-31 21:51 ` Sergei Shtylyov
2012-04-02 10:19 ` Nicolas Ferre
2012-04-02 10:19 ` Nicolas Ferre
2012-03-29 13:27 ` [PATCH 04/12] ARM: at91/dts: USB host vbus is active low Nicolas Ferre
2012-03-29 13:27 ` Nicolas Ferre
2012-03-29 13:27 ` [PATCH 05/12] USB: ohci-at91: rework and fix initialization Nicolas Ferre
2012-03-29 13:27 ` Nicolas Ferre
2012-03-29 13:27 ` [PATCH 06/12] USB: ohci-at91: change maximum number of ports Nicolas Ferre
2012-03-29 13:27 ` Nicolas Ferre
2012-03-29 15:04 ` Alan Stern
2012-03-29 15:04 ` Alan Stern
2012-04-02 10:21 ` Nicolas Ferre
2012-04-02 10:21 ` Nicolas Ferre
2012-03-29 13:27 ` [PATCH 07/12] USB: ohci-at91: coding style modifications with one-line ifs Nicolas Ferre
2012-03-29 13:27 ` Nicolas Ferre
2012-03-29 13:27 ` [PATCH 08/12] USB: ohci-at91: trivial return code name change Nicolas Ferre
2012-03-29 13:27 ` Nicolas Ferre
2012-03-29 13:27 ` [PATCH 09/12] ARM: at91/at91sam9x5.dtsi: fix NAND ale/cle in DT file Nicolas Ferre
2012-03-29 13:27 ` Nicolas Ferre
2012-03-29 13:27 ` [PATCH 10/12] ARM: at91/NAND DT bindings: add comments Nicolas Ferre
2012-03-29 13:27 ` Nicolas Ferre
2012-03-29 13:27 ` [PATCH 11/12] USB: ehci-atmel: add needed of.h header file Nicolas Ferre
2012-03-29 13:27 ` Nicolas Ferre
2012-03-29 13:27 ` [PATCH 12/12] ARM: at91: fix check of valid GPIO for SPI and USB Nicolas Ferre
2012-03-29 13:27 ` Nicolas Ferre
2012-03-30 12:31 ` [PATCH] ARM: at91: include newly created system_misc.h file Nicolas Ferre
2012-03-30 12:31 ` Nicolas Ferre
2012-03-31 21:38 ` Sergei Shtylyov
2012-03-31 21:38 ` Sergei Shtylyov
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.