Commit 0812db94 authored by Janusz Krzysztofik's avatar Janusz Krzysztofik Committed by Tony Lindgren

ARM: OMAP1: ams-delta: assign MODEM IRQ from GPIO descriptor

Don't request MODEM IRQ GPIO by its global number in
ams_delta_modem_init().  Instead, obtain its GPIO descriptor
and assign related IRQ to the MODEM.  Do that from
omap_gpio_deps_init(), where the chip is already looked up.  Then, in
ams_delta_modem_init(), just check for the IRQ number having been
already assigned.
Signed-off-by: default avatarJanusz Krzysztofik <jmkrzyszt@gmail.com>
Reviewed-by: default avatarLinus Walleij <linus.walleij@linaro.org>
Signed-off-by: default avatarTony Lindgren <tony@atomide.com>
parent 5b394b2d
...@@ -630,6 +630,28 @@ static struct gpiod_hog ams_delta_gpio_hogs[] = { ...@@ -630,6 +630,28 @@ static struct gpiod_hog ams_delta_gpio_hogs[] = {
{}, {},
}; };
static struct plat_serial8250_port ams_delta_modem_ports[];
/*
* Obtain MODEM IRQ GPIO descriptor using its hardware pin
* number and assign related IRQ number to the MODEM port.
* Keep the GPIO descriptor open so nobody steps in.
*/
static void __init modem_assign_irq(struct gpio_chip *chip)
{
struct gpio_desc *gpiod;
gpiod = gpiochip_request_own_desc(chip, AMS_DELTA_GPIO_PIN_MODEM_IRQ,
"modem_irq");
if (IS_ERR(gpiod)) {
pr_err("%s: modem IRQ GPIO request failed (%ld)\n", __func__,
PTR_ERR(gpiod));
} else {
gpiod_direction_input(gpiod);
ams_delta_modem_ports[0].irq = gpiod_to_irq(gpiod);
}
}
/* /*
* The purpose of this function is to take care of proper initialization of * The purpose of this function is to take care of proper initialization of
* devices and data structures which depend on GPIO lines provided by OMAP GPIO * devices and data structures which depend on GPIO lines provided by OMAP GPIO
...@@ -649,7 +671,13 @@ static void __init omap_gpio_deps_init(void) ...@@ -649,7 +671,13 @@ static void __init omap_gpio_deps_init(void)
return; return;
} }
/*
* Start with FIQ initialization as it may have to request
* and release successfully each OMAP GPIO pin in turn.
*/
ams_delta_init_fiq(chip, &ams_delta_serio_device); ams_delta_init_fiq(chip, &ams_delta_serio_device);
modem_assign_irq(chip);
} }
static void __init ams_delta_init(void) static void __init ams_delta_init(void)
...@@ -844,20 +872,18 @@ static int __init modem_nreset_init(void) ...@@ -844,20 +872,18 @@ static int __init modem_nreset_init(void)
} }
/*
* This function expects MODEM IRQ number already assigned to the port
* and fails if it's not.
*/
static int __init ams_delta_modem_init(void) static int __init ams_delta_modem_init(void)
{ {
int err; int err;
omap_cfg_reg(M14_1510_GPIO2); if (ams_delta_modem_ports[0].irq < 0)
ams_delta_modem_ports[0].irq = return ams_delta_modem_ports[0].irq;
gpio_to_irq(AMS_DELTA_GPIO_PIN_MODEM_IRQ);
err = gpio_request(AMS_DELTA_GPIO_PIN_MODEM_IRQ, "modem"); omap_cfg_reg(M14_1510_GPIO2);
if (err) {
pr_err("Couldn't request gpio pin for modem\n");
return err;
}
gpio_direction_input(AMS_DELTA_GPIO_PIN_MODEM_IRQ);
/* Initialize the modem_nreset regulator consumer before use */ /* Initialize the modem_nreset regulator consumer before use */
modem_priv.regulator = ERR_PTR(-ENODEV); modem_priv.regulator = ERR_PTR(-ENODEV);
...@@ -866,8 +892,6 @@ static int __init ams_delta_modem_init(void) ...@@ -866,8 +892,6 @@ static int __init ams_delta_modem_init(void)
AMS_DELTA_LATCH2_MODEM_CODEC); AMS_DELTA_LATCH2_MODEM_CODEC);
err = platform_device_register(&ams_delta_modem_device); err = platform_device_register(&ams_delta_modem_device);
if (err)
gpio_free(AMS_DELTA_GPIO_PIN_MODEM_IRQ);
return err; return err;
} }
...@@ -898,7 +922,6 @@ static int __init late_init(void) ...@@ -898,7 +922,6 @@ static int __init late_init(void)
unregister: unregister:
platform_device_unregister(&ams_delta_modem_device); platform_device_unregister(&ams_delta_modem_device);
gpio_free(AMS_DELTA_GPIO_PIN_MODEM_IRQ);
return err; return err;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment