diff options
author | Linus Walleij <linus.walleij@linaro.org> | 2020-11-23 11:23:46 +0100 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2020-11-26 09:15:31 +0100 |
commit | f3ef38160e3dacb490483eb2104b4ce05cd97058 (patch) | |
tree | f6c04949c31dff4465f8e17e0b379e1c0d1bcdbf /drivers/usb/phy/phy-isp1301-omap.c | |
parent | usb: Fix fall-through warnings for Clang (diff) | |
download | linux-f3ef38160e3dacb490483eb2104b4ce05cd97058.tar.xz linux-f3ef38160e3dacb490483eb2104b4ce05cd97058.zip |
usb: isp1301-omap: Convert to use GPIO descriptors
This modernized the ISP1301 a bit by switching it to provide
a GPIO descriptor from the H2 board if used.
Cc: Tony Lindgren <tony@atomide.com>
Cc: Felipe Balbi <felipe.balbi@linux.intel.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Link: https://lore.kernel.org/r/20201123102346.48284-1-linus.walleij@linaro.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/usb/phy/phy-isp1301-omap.c')
-rw-r--r-- | drivers/usb/phy/phy-isp1301-omap.c | 21 |
1 files changed, 13 insertions, 8 deletions
diff --git a/drivers/usb/phy/phy-isp1301-omap.c b/drivers/usb/phy/phy-isp1301-omap.c index 4a6462c92ef2..00506fb01bda 100644 --- a/drivers/usb/phy/phy-isp1301-omap.c +++ b/drivers/usb/phy/phy-isp1301-omap.c @@ -1208,9 +1208,6 @@ static int isp1301_remove(struct i2c_client *i2c) #ifdef CONFIG_USB_OTG otg_unbind(isp); #endif - if (machine_is_omap_h2()) - gpio_free(2); - set_bit(WORK_STOP, &isp->todo); del_timer_sync(&isp->timer); flush_work(&isp->work); @@ -1480,6 +1477,7 @@ isp1301_probe(struct i2c_client *i2c, const struct i2c_device_id *id) { int status; struct isp1301 *isp; + int irq; if (the_transceiver) return 0; @@ -1543,20 +1541,27 @@ isp1301_probe(struct i2c_client *i2c, const struct i2c_device_id *id) #endif if (machine_is_omap_h2()) { + struct gpio_desc *gpiod; + /* full speed signaling by default */ isp1301_set_bits(isp, ISP1301_MODE_CONTROL_1, MC1_SPEED); isp1301_set_bits(isp, ISP1301_MODE_CONTROL_2, MC2_SPD_SUSP_CTRL); - /* IRQ wired at M14 */ - omap_cfg_reg(M14_1510_GPIO2); - if (gpio_request(2, "isp1301") == 0) - gpio_direction_input(2); + gpiod = devm_gpiod_get(&i2c->dev, NULL, GPIOD_IN); + if (IS_ERR(gpiod)) { + dev_err(&i2c->dev, "cannot obtain H2 GPIO\n"); + goto fail; + } + gpiod_set_consumer_name(gpiod, "isp1301"); + irq = gpiod_to_irq(gpiod); isp->irq_type = IRQF_TRIGGER_FALLING; + } else { + irq = i2c->irq; } - status = request_irq(i2c->irq, isp1301_irq, + status = request_irq(irq, isp1301_irq, isp->irq_type, DRIVER_NAME, isp); if (status < 0) { dev_dbg(&i2c->dev, "can't get IRQ %d, err %d\n", |