ARM: davinci: move the da8xx-ohci GPIO logic into the driver
Subsystems (5)
PATCH v2 1/8 usb: ohci-da8xx: add a new line after local variables
In reply to Bartosz GolaszewskiFrom: Bartosz Golaszewski <[email protected]>
Add a new line after local variables. This improves the coding style.
--- drivers/usb/host/ohci-da8xx.c | 1 + 1 file changed, 1 insertion(+)
drivers/usb/host/ohci-da8xx.c +1 -0
@@ -405,6 +405,7 @@ static int ohci_da8xx_probe(struct platform_device *pdev)struct usb_hcd *hcd;struct resource *mem;int error, irq; + hcd =usb_create_hcd (&ohci_da8xx_hc_driver, &pdev->dev,dev_name (&pdev->dev));if (!hcd)
PATCH v2 2/8 usb: ohci-da8xx: add a helper pointer to &pdev->dev
In reply to Bartosz GolaszewskiFrom: Bartosz Golaszewski <[email protected]>
Add a helper pointer to &pdev->dev. This improves readability by removing all the &pdev->dev dereferencing.
--- drivers/usb/host/ohci-da8xx.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-)
drivers/usb/host/ohci-da8xx.c +9 -9
@@ -402,35 +402,35 @@ MODULE_DEVICE_TABLE(of, da8xx_ohci_ids);static int ohci_da8xx_probe (struct platform_device *pdev) {struct da8xx_ohci_hcd *da8xx_ohci; +struct device *dev = &pdev->dev;struct usb_hcd *hcd;struct resource *mem;int error, irq; - hcd =usb_create_hcd (&ohci_da8xx_hc_driver, &pdev->dev, -dev_name (&pdev->dev)); + hcd =usb_create_hcd (&ohci_da8xx_hc_driver, dev,dev_name (dev));if (!hcd)return -ENOMEM ; da8xx_ohci =to_da8xx_ohci (hcd); da8xx_ohci->hcd = hcd; - da8xx_ohci->usb11_clk =devm_clk_get (&pdev->dev,NULL ); + da8xx_ohci->usb11_clk =devm_clk_get (dev,NULL );if (IS_ERR (da8xx_ohci->usb11_clk)) { error =PTR_ERR (da8xx_ohci->usb11_clk);if (error != -EPROBE_DEFER ) -dev_err (&pdev->dev,"Failed to get clock.\n" ); +dev_err (dev,"Failed to get clock.\n" ); goto err; } - da8xx_ohci->usb11_phy =devm_phy_get (&pdev->dev,"usb-phy" ); + da8xx_ohci->usb11_phy =devm_phy_get (dev,"usb-phy" );if (IS_ERR (da8xx_ohci->usb11_phy)) { error =PTR_ERR (da8xx_ohci->usb11_phy);if (error != -EPROBE_DEFER ) -dev_err (&pdev->dev,"Failed to get phy.\n" ); +dev_err (dev,"Failed to get phy.\n" ); goto err; } - da8xx_ohci->vbus_reg =devm_regulator_get_optional (&pdev->dev,"vbus" ); + da8xx_ohci->vbus_reg =devm_regulator_get_optional (dev,"vbus" );if (IS_ERR (da8xx_ohci->vbus_reg)) { error =PTR_ERR (da8xx_ohci->vbus_reg);if (error == -ENODEV ) {
@@ -438,13 +438,13 @@ static int ohci_da8xx_probe(struct platform_device *pdev) }else if (error == -EPROBE_DEFER ) { goto err; }else { -dev_err (&pdev->dev,"Failed to get regulator\n" ); +dev_err (dev,"Failed to get regulator\n" ); goto err; } } mem =platform_get_resource (pdev,IORESOURCE_MEM ,0 ); - hcd->regs =devm_ioremap_resource (&pdev->dev, mem); + hcd->regs =devm_ioremap_resource (dev, mem);if (IS_ERR (hcd->regs)) { error =PTR_ERR (hcd->regs); goto err;
PATCH v2 3/8 ARM: davinci: omapl138-hawk: use gpio lookup entries for usb gpios
In reply to Bartosz GolaszewskiFrom: Bartosz Golaszewski <[email protected]>
Add lookup entries for the vbus and overcurrent gpios for omapl138-hawk.
--- arch/arm/mach-davinci/board-omapl138-hawk.c | 10 ++++++++++ 1 file changed, 10 insertions(+)
arch/arm/mach-davinci/board-omapl138-hawk.c +10 -0
@@ -302,6 +302,14 @@ static const short da850_hawk_usb11_pins[] = { -1 }; +static struct gpiod_lookup_table hawk_usb_gpio_lookup = { + .dev_id ="ohci-da8xx" , + .table = { +GPIO_LOOKUP ("davinci_gpio" ,DA850_USB1_VBUS_PIN ,"vbus" ,0 ), +GPIO_LOOKUP ("davinci_gpio" ,DA850_USB1_OC_PIN ,"oc" ,0 ), + }, +}; +static int hawk_usb_set_power (unsigned port,int on) {gpio_set_value (DA850_USB1_VBUS_PIN , on);
@@ -390,6 +398,8 @@ static __init void omapl138_hawk_usb_init(void) goto usb11_setup_oc_fail; } +gpiod_add_lookup_table (&hawk_usb_gpio_lookup); + ret =da8xx_register_usb11 (&omapl138_hawk_usb11_pdata);if (ret) {pr_warn ("%s: USB 1.1 registration failed: %d\n" , __func__, ret);
PATCH v2 4/8 ARM: davinci: da830-evm: use gpio lookup entries for usb gpios
In reply to Bartosz GolaszewskiFrom: Bartosz Golaszewski <[email protected]>
Add lookup entries for vbus and overcurrent gpios for da830-evm.
--- arch/arm/mach-davinci/board-da830-evm.c | 10 ++++++++++ 1 file changed, 10 insertions(+)
arch/arm/mach-davinci/board-da830-evm.c +10 -0
@@ -54,6 +54,14 @@ static const short da830_evm_usb11_pins[] = {static da8xx_ocic_handler_t da830_evm_usb_ocic_handler; +static struct gpiod_lookup_table da830_evm_usb_gpio_lookup = { + .dev_id ="ohci-da8xx" , + .table = { +GPIO_LOOKUP ("davinci_gpio" ,ON_BD_USB_DRV ,"vbus" ,0 ), +GPIO_LOOKUP ("davinci_gpio" ,ON_BD_USB_OVC ,"oc" ,0 ), + }, +}; +static int da830_evm_usb_set_power (unsigned port,int on) {gpio_set_value (ON_BD_USB_DRV , on);
@@ -158,6 +166,8 @@ static __init void da830_evm_usb_init(void) }gpio_direction_input (ON_BD_USB_OVC ); +gpiod_add_lookup_table (&da830_evm_usb_gpio_lookup); + ret =da8xx_register_usb11 (&da830_evm_usb11_pdata);if (ret)pr_warn ("%s: USB 1.1 registration failed: %d\n" , __func__, ret);
PATCH v2 5/8 usb: ohci-da8xx: add vbus and overcurrent gpios
In reply to Bartosz GolaszewskiFrom: Bartosz Golaszewski <[email protected]>
There are two users upstream which register external callbacks for switching the port power on/off and overcurrent protection. Both users only use two GPIOs for that. Instead of having that functionality in the board files, move the logic into the OHCI driver - including the interrupt handler for overcurrent detection.
--- drivers/usb/host/ohci-da8xx.c | 99 ++++++++++++++++++----------------- 1 file changed, 50 insertions(+), 49 deletions(-)
drivers/usb/host/ohci-da8xx.c +50 -49
@@ -12,6 +12,7 @@#include <linux/io.h> #include <linux/interrupt.h> #include <linux/jiffies.h> +#include <linux/gpio/consumer.h> #include <linux/kernel.h> #include <linux/module.h> #include <linux/platform_device.h>
@@ -40,6 +41,8 @@ struct da8xx_ohci_hcd {struct regulator *vbus_reg;struct notifier_block nb;unsigned int reg_enabled; +struct gpio_desc *vbus_gpio; +struct gpio_desc *oc_gpio; };#define to_da8xx_ohci (hcd) (struct da8xx_ohci_hcd *)(hcd_to_ohci(hcd)->priv)
@@ -86,12 +89,13 @@ static void ohci_da8xx_disable(struct usb_hcd *hcd)static int ohci_da8xx_set_power (struct usb_hcd *hcd,int on) {struct da8xx_ohci_hcd *da8xx_ohci =to_da8xx_ohci (hcd); -struct device *dev = hcd->self.controller; -struct da8xx_ohci_root_hub *hub =dev_get_platdata (dev); +struct device *dev = hcd->self.controller;int ret; -if (hub && hub->set_power) -return hub->set_power (1 , on); +if (da8xx_ohci->vbus_gpio) { +gpiod_set_value_cansleep (da8xx_ohci->vbus_gpio, on); +return 0 ; + }if (!da8xx_ohci->vbus_reg)return 0 ;
@@ -119,11 +123,9 @@ static int ohci_da8xx_set_power(struct usb_hcd *hcd, int on)static int ohci_da8xx_get_power (struct usb_hcd *hcd) {struct da8xx_ohci_hcd *da8xx_ohci =to_da8xx_ohci (hcd); -struct device *dev = hcd->self.controller; -struct da8xx_ohci_root_hub *hub =dev_get_platdata (dev); -if (hub && hub->get_power) -return hub->get_power (1 ); +if (da8xx_ohci->vbus_gpio) +return gpiod_get_value_cansleep (da8xx_ohci->vbus_gpio);if (da8xx_ohci->vbus_reg)return regulator_is_enabled (da8xx_ohci->vbus_reg);
@@ -134,13 +136,11 @@ static int ohci_da8xx_get_power(struct usb_hcd *hcd)static int ohci_da8xx_get_oci (struct usb_hcd *hcd) {struct da8xx_ohci_hcd *da8xx_ohci =to_da8xx_ohci (hcd); -struct device *dev = hcd->self.controller; -struct da8xx_ohci_root_hub *hub =dev_get_platdata (dev);unsigned int flags;int ret; -if (hub && hub->get_oci) -return hub->get_oci (1 ); +if (da8xx_ohci->oc_gpio) +return gpiod_get_value_cansleep (da8xx_ohci->oc_gpio);if (!da8xx_ohci->vbus_reg)return 0 ;
@@ -158,10 +158,8 @@ static int ohci_da8xx_get_oci(struct usb_hcd *hcd)static int ohci_da8xx_has_set_power (struct usb_hcd *hcd) {struct da8xx_ohci_hcd *da8xx_ohci =to_da8xx_ohci (hcd); -struct device *dev = hcd->self.controller; -struct da8xx_ohci_root_hub *hub =dev_get_platdata (dev); -if (hub && hub->set_power) +if (da8xx_ohci->vbus_gpio)return 1 ;if (da8xx_ohci->vbus_reg)
@@ -173,10 +171,8 @@ static int ohci_da8xx_has_set_power(struct usb_hcd *hcd)static int ohci_da8xx_has_oci (struct usb_hcd *hcd) {struct da8xx_ohci_hcd *da8xx_ohci =to_da8xx_ohci (hcd); -struct device *dev = hcd->self.controller; -struct da8xx_ohci_root_hub *hub =dev_get_platdata (dev); -if (hub && hub->get_oci) +if (da8xx_ohci->oc_gpio)return 1 ;if (da8xx_ohci->vbus_reg)
@@ -196,19 +192,6 @@ static int ohci_da8xx_has_potpgt(struct usb_hcd *hcd)return 0 ; } -/* -* Handle the port over-current indicator change. -*/ -static void ohci_da8xx_ocic_handler (struct da8xx_ohci_root_hub *hub, -unsigned port) -{ - ocic_mask |=1 << port; - -/* Once over-current is detected, the port needs to be powered down */ -if (hub->get_oci (port) >0 ) - hub->set_power (port,0 ); -} -static int ohci_da8xx_regulator_event (struct notifier_block *nb,unsigned long event,void *data) {
@@ -223,16 +206,23 @@ static int ohci_da8xx_regulator_event(struct notifier_block *nb,return 0 ; } +static irqreturn_t ohci_da8xx_oc_handler (int irq,void *data) +{ +struct da8xx_ohci_hcd *da8xx_ohci = data; + +if (gpiod_get_value (da8xx_ohci->oc_gpio)) +gpiod_set_value (da8xx_ohci->vbus_gpio,0 ); + +return IRQ_HANDLED ; +} +static int ohci_da8xx_register_notify (struct usb_hcd *hcd) {struct da8xx_ohci_hcd *da8xx_ohci =to_da8xx_ohci (hcd);struct device *dev = hcd->self.controller; -struct da8xx_ohci_root_hub *hub =dev_get_platdata (dev);int ret =0 ; -if (hub && hub->ocic_notify) { - ret = hub->ocic_notify (ohci_da8xx_ocic_handler); - }else if (da8xx_ohci->vbus_reg) { +if (!da8xx_ohci->oc_gpio && da8xx_ohci->vbus_reg) { da8xx_ohci->nb.notifier_call = ohci_da8xx_regulator_event; ret =devm_regulator_register_notifier (da8xx_ohci->vbus_reg, &da8xx_ohci->nb);
@@ -244,15 +234,6 @@ static int ohci_da8xx_register_notify(struct usb_hcd *hcd)return ret; } -static void ohci_da8xx_unregister_notify (struct usb_hcd *hcd) -{ -struct device *dev = hcd->self.controller; -struct da8xx_ohci_root_hub *hub =dev_get_platdata (dev); - -if (hub && hub->ocic_notify) - hub->ocic_notify (NULL ); -} -static int ohci_da8xx_reset (struct usb_hcd *hcd) {struct device *dev = hcd->self.controller;
@@ -403,9 +384,9 @@ static int ohci_da8xx_probe(struct platform_device *pdev) {struct da8xx_ohci_hcd *da8xx_ohci;struct device *dev = &pdev->dev; +int error, hcd_irq, oc_irq;struct usb_hcd *hcd;struct resource *mem; -int error, irq; hcd =usb_create_hcd (&ohci_da8xx_hc_driver, dev,dev_name (dev));if (!hcd)
@@ -443,6 +424,27 @@ static int ohci_da8xx_probe(struct platform_device *pdev) } } + da8xx_ohci->vbus_gpio =devm_gpiod_get_optional (dev,"vbus" , +GPIOD_OUT_HIGH ); +if (IS_ERR (da8xx_ohci->vbus_gpio)) + goto err; + + da8xx_ohci->oc_gpio =devm_gpiod_get_optional (dev,"oc" ,GPIOD_IN ); +if (IS_ERR (da8xx_ohci->oc_gpio)) + goto err; + +if (da8xx_ohci->oc_gpio) { + oc_irq =gpiod_to_irq (da8xx_ohci->oc_gpio); +if (oc_irq <0 ) + goto err; + + error =devm_request_irq (dev, oc_irq, ohci_da8xx_oc_handler, +IRQF_TRIGGER_RISING |IRQF_TRIGGER_FALLING , +"OHCI over-current indicator" , da8xx_ohci); +if (error) + goto err; + } + mem =platform_get_resource (pdev,IORESOURCE_MEM ,0 ); hcd->regs =devm_ioremap_resource (dev, mem);if (IS_ERR (hcd->regs)) {
@@ -452,13 +454,13 @@ static int ohci_da8xx_probe(struct platform_device *pdev) hcd->rsrc_start = mem->start; hcd->rsrc_len =resource_size (mem); - irq =platform_get_irq (pdev,0 ); -if (irq <0 ) { + hcd_irq =platform_get_irq (pdev,0 ); +if (hcd_irq <0 ) { error = -ENODEV ; goto err; } - error =usb_add_hcd (hcd, irq,0 ); + error =usb_add_hcd (hcd, hcd_irq,0 );if (error) goto err;
@@ -481,7 +483,6 @@ static int ohci_da8xx_remove(struct platform_device *pdev) {struct usb_hcd *hcd =platform_get_drvdata (pdev); -ohci_da8xx_unregister_notify (hcd);usb_remove_hcd (hcd);usb_put_hcd (hcd);
PATCH v2 6/8 ARM: davinci: omapl138-hawk: remove legacy usb helpers
In reply to Bartosz GolaszewskiFrom: Bartosz Golaszewski <[email protected]>
The logic implemented by these routines now lives in the da8xx-ohci driver. Remove dead code.
--- arch/arm/mach-davinci/board-omapl138-hawk.c | 75 +-------------------- 1 file changed, 1 insertion(+), 74 deletions(-)
arch/arm/mach-davinci/board-omapl138-hawk.c +1 -74
@@ -294,9 +294,6 @@ static int omapl138_hawk_register_aemif(void)return platform_device_register (&omapl138_hawk_aemif_device); } -static irqreturn_t omapl138_hawk_usb_ocic_irq (int irq,void *dev_id); -static da8xx_ocic_handler_t hawk_usb_ocic_handler; -static const short da850_hawk_usb11_pins[] = {DA850_GPIO2_4 ,DA850_GPIO6_13 ,-1
@@ -310,58 +307,11 @@ static struct gpiod_lookup_table hawk_usb_gpio_lookup = { }, }; -static int hawk_usb_set_power (unsigned port,int on) -{ -gpio_set_value (DA850_USB1_VBUS_PIN , on); -return 0 ; -} - -static int hawk_usb_get_power (unsigned port) -{ -return gpio_get_value (DA850_USB1_VBUS_PIN ); -} - -static int hawk_usb_get_oci (unsigned port) -{ -return !gpio_get_value (DA850_USB1_OC_PIN ); -} - -static int hawk_usb_ocic_notify (da8xx_ocic_handler_t handler) -{ -int irq =gpio_to_irq (DA850_USB1_OC_PIN ); -int error =0 ; - -if (handler !=NULL ) { - hawk_usb_ocic_handler = handler; - - error =request_irq (irq, omapl138_hawk_usb_ocic_irq, -IRQF_TRIGGER_RISING | -IRQF_TRIGGER_FALLING , -"OHCI over-current indicator" ,NULL ); -if (error) -pr_err ("%s: could not request IRQ to watch " -"over-current indicator changes\n" , __func__); - }else { -free_irq (irq,NULL ); - } -return error; -} -static struct da8xx_ohci_root_hub omapl138_hawk_usb11_pdata = { - .set_power = hawk_usb_set_power, - .get_power = hawk_usb_get_power, - .get_oci = hawk_usb_get_oci, - .ocic_notify = hawk_usb_ocic_notify,/* TPS2087 switch @ 5V */ .potpgt = (3 +1 ) /2 ,/* 3 ms max */ }; -static irqreturn_t omapl138_hawk_usb_ocic_irq (int irq,void *dev_id) -{ -hawk_usb_ocic_handler (&omapl138_hawk_usb11_pdata,1 ); -return IRQ_HANDLED ; -} -static __init void omapl138_hawk_usb_init (void ) {int ret;
@@ -382,36 +332,13 @@ static __init void omapl138_hawk_usb_init(void)pr_warn ("%s: USB PHY registration failed: %d\n" , __func__, ret); - ret =gpio_request_one (DA850_USB1_VBUS_PIN , -GPIOF_DIR_OUT ,"USB1 VBUS" ); -if (ret <0 ) { -pr_err ("%s: failed to request GPIO for USB 1.1 port " -"power control: %d\n" , __func__, ret); -return ; - } - - ret =gpio_request_one (DA850_USB1_OC_PIN , -GPIOF_DIR_IN ,"USB1 OC" ); -if (ret <0 ) { -pr_err ("%s: failed to request GPIO for USB 1.1 port " -"over-current indicator: %d\n" , __func__, ret); - goto usb11_setup_oc_fail; - } -gpiod_add_lookup_table (&hawk_usb_gpio_lookup); ret =da8xx_register_usb11 (&omapl138_hawk_usb11_pdata); -if (ret) { +if (ret)pr_warn ("%s: USB 1.1 registration failed: %d\n" , __func__, ret); - goto usb11_setup_fail; - }return ; - -usb11_setup_fail: -gpio_free (DA850_USB1_OC_PIN ); -usb11_setup_oc_fail: -gpio_free (DA850_USB1_VBUS_PIN ); }static __init void omapl138_hawk_init (void )
PATCH v2 7/8 ARM: davinci: da830-evm: remove legacy usb helpers
In reply to Bartosz GolaszewskiFrom: Bartosz Golaszewski <[email protected]>
The logic implemented by these routines now lives in the da8xx-ohci driver. Remove dead code.
--- arch/arm/mach-davinci/board-da830-evm.c | 67 ------------------------- 1 file changed, 67 deletions(-)
arch/arm/mach-davinci/board-da830-evm.c +0 -67
@@ -52,8 +52,6 @@ static const short da830_evm_usb11_pins[] = {-1 }; -static da8xx_ocic_handler_t da830_evm_usb_ocic_handler; -static struct gpiod_lookup_table da830_evm_usb_gpio_lookup = { .dev_id ="ohci-da8xx" , .table = {
@@ -62,60 +60,11 @@ static struct gpiod_lookup_table da830_evm_usb_gpio_lookup = { }, }; -static int da830_evm_usb_set_power (unsigned port,int on) -{ -gpio_set_value (ON_BD_USB_DRV , on); -return 0 ; -} - -static int da830_evm_usb_get_power (unsigned port) -{ -return gpio_get_value (ON_BD_USB_DRV ); -} - -static int da830_evm_usb_get_oci (unsigned port) -{ -return !gpio_get_value (ON_BD_USB_OVC ); -} - -static irqreturn_t da830_evm_usb_ocic_irq (int ,void *); - -static int da830_evm_usb_ocic_notify (da8xx_ocic_handler_t handler) -{ -int irq =gpio_to_irq (ON_BD_USB_OVC ); -int error =0 ; - -if (handler !=NULL ) { - da830_evm_usb_ocic_handler = handler; - - error =request_irq (irq, da830_evm_usb_ocic_irq, -IRQF_TRIGGER_RISING |IRQF_TRIGGER_FALLING , -"OHCI over-current indicator" ,NULL ); -if (error) -pr_err ("%s: could not request IRQ to watch over-current indicator changes\n" , - __func__); - }else -free_irq (irq,NULL ); - -return error; -} -static struct da8xx_ohci_root_hub da830_evm_usb11_pdata = { - .set_power = da830_evm_usb_set_power, - .get_power = da830_evm_usb_get_power, - .get_oci = da830_evm_usb_get_oci, - .ocic_notify = da830_evm_usb_ocic_notify, -/* TPS2065 switch @ 5V */ .potpgt = (3 +1 ) /2 ,/* 3 ms max */ }; -static irqreturn_t da830_evm_usb_ocic_irq (int irq,void *dev_id) -{ -da830_evm_usb_ocic_handler (&da830_evm_usb11_pdata,1 ); -return IRQ_HANDLED ; -} -static __init void da830_evm_usb_init (void ) {int ret;
@@ -150,22 +99,6 @@ static __init void da830_evm_usb_init(void)return ; } - ret =gpio_request (ON_BD_USB_DRV ,"ON_BD_USB_DRV" ); -if (ret) { -pr_err ("%s: failed to request GPIO for USB 1.1 port power control: %d\n" , - __func__, ret); -return ; - } -gpio_direction_output (ON_BD_USB_DRV ,0 ); - - ret =gpio_request (ON_BD_USB_OVC ,"ON_BD_USB_OVC" ); -if (ret) { -pr_err ("%s: failed to request GPIO for USB 1.1 port over-current indicator: %d\n" , - __func__, ret); -return ; - } -gpio_direction_input (ON_BD_USB_OVC ); -gpiod_add_lookup_table (&da830_evm_usb_gpio_lookup); ret =da8xx_register_usb11 (&da830_evm_usb11_pdata);
PATCH v2 8/8 usb: ohci-da8xx: remove unused callbacks from platform data
In reply to Bartosz GolaszewskiFrom: Bartosz Golaszewski <[email protected]>
There are no more users of the platform_data callbacks in ohci-da8xx. Remove them.
--- include/linux/platform_data/usb-davinci.h | 14 -------------- 1 file changed, 14 deletions(-)
include/linux/platform_data/usb-davinci.h +0 -14
@@ -11,22 +11,8 @@#ifndef __ASM_ARCH_USB_H#define __ASM_ARCH_USB_H -struct da8xx_ohci_root_hub ; - -typedef void (*da8xx_ocic_handler_t )(struct da8xx_ohci_root_hub *hub, -unsigned port); -/* Passed as the platform data to the OHCI driver */ struct da8xx_ohci_root_hub { -/* Switch the port power on/off */ -int (*set_power)(unsigned port,int on); -/* Read the port power status */ -int (*get_power)(unsigned port); -/* Read the port over-current indicator */ -int (*get_oci)(unsigned port); -/* Over-current indicator change notification (pass NULL to disable) */ -int (*ocic_notify)(da8xx_ocic_handler_t handler); -/* Time from power on to power good (in 2 ms units) */ u8 potpgt; };
v2 cover ARM: davinci: move the da8xx-ohci GPIO logic into the driver
From: Bartosz Golaszewski <[email protected]>
In order to drop the hard-coded GPIO base values from the davinci GPIO driver's platform data, we first need to get rid of all calls to the legacy GPIO functions.
This series moves the GPIO logic related to da8xx-ohci out of the board files and into the driver code.
First two patches are just coding style tweaks. Next two add the GPIO lookup entries to the board files. Patch 5 add the vbus and overcurrent GPIO logic to the davinci USB host driver. Last three remove code that's no longer used.
v1 -> v2:
- use the non-sleeping version of gpiod_ functions in the irq handler
- improve commit messages (make them readable without the subject line)
- collect Acked-by and Reviewed-by tags
- rebase on top of v5.0-rc6
Bartosz Golaszewski (8):
usb: ohci-da8xx: add a new line after local variables
usb: ohci-da8xx: add a helper pointer to &pdev->dev
ARM: davinci: omapl138-hawk: use gpio lookup entries for usb gpios
ARM: davinci: da830-evm: use gpio lookup entries for usb gpios
usb: ohci-da8xx: add vbus and overcurrent gpios
ARM: davinci: omapl138-hawk: remove legacy usb helpers
ARM: davinci: da830-evm: remove legacy usb helpers
usb: ohci-da8xx: remove unused callbacks from platform data
arch/arm/mach-davinci/board-da830-evm.c | 73 ++---------- arch/arm/mach-davinci/board-omapl138-hawk.c | 81 ++------------ drivers/usb/host/ohci-da8xx.c | 118 ++++++++++---------- include/linux/platform_data/usb-davinci.h | 14 --- 4 files changed, 77 insertions(+), 209 deletions(-)
Signature · 1 line
2.20.1
Re: [PATCH v2 5/8] usb: ohci-da8xx: add vbus and overcurrent gpios
In reply to Bartosz GolaszewskiQuoted 19 lines · Bartosz Golaszewski
From: Bartosz Golaszewski <[email protected]>
There are two users upstream which register external callbacks for switching the port power on/off and overcurrent protection. Both users only use two GPIOs for that. Instead of having that functionality in the board files, move the logic into the OHCI driver - including the interrupt handler for overcurrent detection.
Signed-off-by Bartosz Golaszewski <[email protected]>Acked-by Alan Stern <[email protected]>--- drivers/usb/host/ohci-da8xx.c | 99 ++++++++++++++++++----------------- 1 file changed, 50 insertions(+), 49 deletions(-)drivers/usb/host/ohci-da8xx.c +0
-0
drivers/usb/host/ohci-da8xx.c line 18
Quoted 7 lines
drivers/usb/host/ohci-da8xx.c +1
-0@@ -12,6 +12,7 @@#include <linux/io.h> #include <linux/interrupt.h> #include <linux/jiffies.h> +#include <linux/gpio/consumer.h> #include <linux/kernel.h> #include <linux/module.h> #include <linux/platform_device.h>
Added the new include in alphabetical order. With that minor fix, series is applied to my v5.1/soc branch.
Thanks,
Sekhar