From: Nicolas Ferre <hidden> Date: 2012-03-29 13:29:54
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
From: Nicolas Ferre <hidden> Date: 2012-03-29 13:28:02
Compilation error in case of non-DT configuration without this
of.h header file.
Signed-off-by: Nicolas Ferre <redacted>
Acked-by: Jean-Christophe PLAGNIOL-VILLARD <redacted>
---
drivers/usb/host/ehci-atmel.c | 1 +
1 file changed, 1 insertion(+)
@@ -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 */
From: Nicolas Ferre <hidden> Date: 2012-03-29 13:28:53
The information is not properly taken into account
for {get|set}_power() functions.
Signed-off-by: Nicolas Ferre <redacted>
Acked-by: Jean-Christophe PLAGNIOL-VILLARD <redacted>
Cc: stable <redacted> [3.2+]
---
drivers/usb/host/ohci-at91.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
From: Nicolas Ferre <hidden> Date: 2012-03-29 13:30:06
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 <redacted>
Acked-by: Jean-Christophe PLAGNIOL-VILLARD <redacted>
---
arch/arm/mach-at91/include/mach/board.h | 13 +++++++------
drivers/usb/host/ohci-at91.c | 22 +++++++++++++---------
2 files changed, 20 insertions(+), 15 deletions(-)
@@ -86,14 +86,15 @@ extern void __init at91_add_device_mci(short mmc_id, struct mci_platform_data *dexternvoid__initat91_add_device_eth(structmacb_platform_data*data);/* USB Host */+#define AT91_MAX_USBH_PORTS 3structat91_usbh_data{-u8ports;/* number of ports on root hub */-intvbus_pin[2];/* port power-control pin */-u8vbus_pin_active_low[2];+intvbus_pin[AT91_MAX_USBH_PORTS];/* port power-control pin */+intovercurrent_pin[AT91_MAX_USBH_PORTS];+u8ports;/* number of ports on root hub */u8overcurrent_supported;-intovercurrent_pin[2];-u8overcurrent_status[2];-u8overcurrent_changed[2];+u8vbus_pin_active_low[AT91_MAX_USBH_PORTS];+u8overcurrent_status[AT91_MAX_USBH_PORTS];+u8overcurrent_changed[AT91_MAX_USBH_PORTS];};externvoid__initat91_add_device_usbh(structat91_usbh_data*data);externvoid__initat91_add_device_usbh_ohci(structat91_usbh_data*data);
From: Alan Stern <stern@rowland.harvard.edu> Date: 2012-03-29 15:04:46
On Thu, 29 Mar 2012, Nicolas Ferre wrote:
quoted hunk
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 <redacted>
Acked-by: Jean-Christophe PLAGNIOL-VILLARD <redacted>
---
arch/arm/mach-at91/include/mach/board.h | 13 +++++++------
drivers/usb/host/ohci-at91.c | 22 +++++++++++++---------
2 files changed, 20 insertions(+), 15 deletions(-)
@@ -86,14 +86,15 @@ extern void __init at91_add_device_mci(short mmc_id, struct mci_platform_data *dexternvoid__initat91_add_device_eth(structmacb_platform_data*data);/* USB Host */+#define AT91_MAX_USBH_PORTS 3structat91_usbh_data{-u8ports;/* number of ports on root hub */-intvbus_pin[2];/* port power-control pin */-u8vbus_pin_active_low[2];+intvbus_pin[AT91_MAX_USBH_PORTS];/* port power-control pin */+intovercurrent_pin[AT91_MAX_USBH_PORTS];+u8ports;/* number of ports on root hub */u8overcurrent_supported;-intovercurrent_pin[2];-u8overcurrent_status[2];-u8overcurrent_changed[2];+u8vbus_pin_active_low[AT91_MAX_USBH_PORTS];+u8overcurrent_status[AT91_MAX_USBH_PORTS];+u8overcurrent_changed[AT91_MAX_USBH_PORTS];};externvoid__initat91_add_device_usbh(structat91_usbh_data*data);externvoid__initat91_add_device_usbh_ohci(structat91_usbh_data*data);
Here and below, it will be a lot clearer to write AT91_MAX_USBH_PORTS
instead of ARRAY_SIZE(padata->...).
quoted hunk
@@ -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
From: Nicolas Ferre <hidden> Date: 2012-04-02 10:21:41
On 03/29/2012 05:04 PM, Alan Stern :
On Thu, 29 Mar 2012, Nicolas Ferre wrote:
quoted
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 <redacted>
Acked-by: Jean-Christophe PLAGNIOL-VILLARD <redacted>
---
arch/arm/mach-at91/include/mach/board.h | 13 +++++++------
drivers/usb/host/ohci-at91.c | 22 +++++++++++++---------
2 files changed, 20 insertions(+), 15 deletions(-)
@@ -86,14 +86,15 @@ extern void __init at91_add_device_mci(short mmc_id, struct mci_platform_data *dexternvoid__initat91_add_device_eth(structmacb_platform_data*data);/* USB Host */+#define AT91_MAX_USBH_PORTS 3structat91_usbh_data{-u8ports;/* number of ports on root hub */-intvbus_pin[2];/* port power-control pin */-u8vbus_pin_active_low[2];+intvbus_pin[AT91_MAX_USBH_PORTS];/* port power-control pin */+intovercurrent_pin[AT91_MAX_USBH_PORTS];+u8ports;/* number of ports on root hub */u8overcurrent_supported;-intovercurrent_pin[2];-u8overcurrent_status[2];-u8overcurrent_changed[2];+u8vbus_pin_active_low[AT91_MAX_USBH_PORTS];+u8overcurrent_status[AT91_MAX_USBH_PORTS];+u8overcurrent_changed[AT91_MAX_USBH_PORTS];};externvoid__initat91_add_device_usbh(structat91_usbh_data*data);externvoid__initat91_add_device_usbh_ohci(structat91_usbh_data*data);
Here and below, it will be a lot clearer to write AT91_MAX_USBH_PORTS
instead of ARRAY_SIZE(padata->...).
quoted
@@ -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
From: Nicolas Ferre <hidden> Date: 2012-03-29 13:30:11
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 <redacted>
Acked-by: Jean-Christophe PLAGNIOL-VILLARD <redacted>
Cc: stable <redacted> [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(-)
From: Nicolas Ferre <hidden> Date: 2012-03-29 13:30:18
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 <redacted>
Acked-by: Jean-Christophe PLAGNIOL-VILLARD <redacted>
---
drivers/usb/host/ohci-at91.c | 88 ++++++++++++++++++++++--------------------
1 file changed, 46 insertions(+), 42 deletions(-)
@@ -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){structat91_usbh_data*pdata;inti;+intgpio;+intret;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++){-intret;-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");}}}
From: Nicolas Ferre <hidden> Date: 2012-03-30 12:31:46
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 <redacted>
---
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(+)