From: Janusz Krzysztofik <jmkrzyszt@gmail.com> To: Tony Lindgren <tony@atomide.com> Cc: Aaro Koskinen <aaro.koskinen@iki.fi>, Linus Walleij <linus.walleij@linaro.org>, Greg Kroah-Hartman <gregkh@linuxfoundation.org>, Jiri Slaby <jslaby@suse.com>, linux-arm-kernel@lists.infradead.org, linux-omap@vger.kernel.org, linux-serial@vger.kernel.org, linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org, Janusz Krzysztofik <jmkrzyszt@gmail.com> Subject: [PATCH 3/3] ARM: OMAP1: ams-delta: register MODEM device earlier Date: Mon, 20 Aug 2018 20:13:33 +0200 [thread overview] Message-ID: <20180820181333.2527-4-jmkrzyszt@gmail.com> (raw) In-Reply-To: <20180820181333.2527-1-jmkrzyszt@gmail.com> Amstrad Delta MODEM device used to be initialized at arch_initcall before it was once moved to late_initcall by commit f7519d8c8290 ("ARM: OMAP1: ams-delta: register latch dependent devices later"). The purpose of that change was to postpone initialization of devices which depended on latch2 pins until latch2 converted to GPIO device was ready. After recent fixes to GPIO handling, it was possible to moove registration of most of those device back to where they were before. The same can be safely done with the MODEM device as initialization of GPIO pins it depends on was moved to machine_init by preceding patch. Move registration of the MODEM device to arch_initcall_sync, not to arch_initcall, so it is never exposed to potential conflictinh registration order hazard against OMAP serial ports. Signed-off-by: Janusz Krzysztofik <jmkrzyszt@gmail.com> --- arch/arm/mach-omap1/board-ams-delta.c | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/arch/arm/mach-omap1/board-ams-delta.c b/arch/arm/mach-omap1/board-ams-delta.c index c865c6921af8..a98783f98f3a 100644 --- a/arch/arm/mach-omap1/board-ams-delta.c +++ b/arch/arm/mach-omap1/board-ams-delta.c @@ -896,11 +896,28 @@ static int __init modem_nreset_init(void) /* * This function expects MODEM IRQ number already assigned to the port * and fails if it's not. + * The MODEM device requires its RESET# pin kept high during probe. + * That requirement can be fulfilled in several ways: + * - with a descriptor of already functional modem_nreset regulator + * assigned to the MODEM private data, + * - with the regulator not yet controlled by modem_pm function but + * already enabled by default on probe, + * - before the modem_nreset regulator is probed, with the pin already + * set high explicitly. + * The last one is already guaranteed by ams_delta_latch2_init() called + * from machine_init. + * In order to avoid taking over ttyS0 device slot, the MODEM device + * should be registered after OMAP serial ports. Since those ports + * are registered at arch_initcall, this function can be called safely + * at arch_initcall_sync earliest. */ static int __init ams_delta_modem_init(void) { int err; + if (!machine_is_ams_delta()) + return -ENODEV; + if (ams_delta_modem_ports[0].irq < 0) return ams_delta_modem_ports[0].irq; @@ -913,6 +930,7 @@ static int __init ams_delta_modem_init(void) return err; } +arch_initcall_sync(ams_delta_modem_init); static int __init late_init(void) { @@ -922,10 +940,6 @@ static int __init late_init(void) if (err) return err; - err = ams_delta_modem_init(); - if (err) - return err; - /* * Once the modem device is registered, the modem_nreset * regulator can be requested on behalf of that device. -- 2.16.4
WARNING: multiple messages have this Message-ID (diff)
From: jmkrzyszt@gmail.com (Janusz Krzysztofik) To: linux-arm-kernel@lists.infradead.org Subject: [PATCH 3/3] ARM: OMAP1: ams-delta: register MODEM device earlier Date: Mon, 20 Aug 2018 20:13:33 +0200 [thread overview] Message-ID: <20180820181333.2527-4-jmkrzyszt@gmail.com> (raw) In-Reply-To: <20180820181333.2527-1-jmkrzyszt@gmail.com> Amstrad Delta MODEM device used to be initialized at arch_initcall before it was once moved to late_initcall by commit f7519d8c8290 ("ARM: OMAP1: ams-delta: register latch dependent devices later"). The purpose of that change was to postpone initialization of devices which depended on latch2 pins until latch2 converted to GPIO device was ready. After recent fixes to GPIO handling, it was possible to moove registration of most of those device back to where they were before. The same can be safely done with the MODEM device as initialization of GPIO pins it depends on was moved to machine_init by preceding patch. Move registration of the MODEM device to arch_initcall_sync, not to arch_initcall, so it is never exposed to potential conflictinh registration order hazard against OMAP serial ports. Signed-off-by: Janusz Krzysztofik <jmkrzyszt@gmail.com> --- arch/arm/mach-omap1/board-ams-delta.c | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/arch/arm/mach-omap1/board-ams-delta.c b/arch/arm/mach-omap1/board-ams-delta.c index c865c6921af8..a98783f98f3a 100644 --- a/arch/arm/mach-omap1/board-ams-delta.c +++ b/arch/arm/mach-omap1/board-ams-delta.c @@ -896,11 +896,28 @@ static int __init modem_nreset_init(void) /* * This function expects MODEM IRQ number already assigned to the port * and fails if it's not. + * The MODEM device requires its RESET# pin kept high during probe. + * That requirement can be fulfilled in several ways: + * - with a descriptor of already functional modem_nreset regulator + * assigned to the MODEM private data, + * - with the regulator not yet controlled by modem_pm function but + * already enabled by default on probe, + * - before the modem_nreset regulator is probed, with the pin already + * set high explicitly. + * The last one is already guaranteed by ams_delta_latch2_init() called + * from machine_init. + * In order to avoid taking over ttyS0 device slot, the MODEM device + * should be registered after OMAP serial ports. Since those ports + * are registered at arch_initcall, this function can be called safely + * at arch_initcall_sync earliest. */ static int __init ams_delta_modem_init(void) { int err; + if (!machine_is_ams_delta()) + return -ENODEV; + if (ams_delta_modem_ports[0].irq < 0) return ams_delta_modem_ports[0].irq; @@ -913,6 +930,7 @@ static int __init ams_delta_modem_init(void) return err; } +arch_initcall_sync(ams_delta_modem_init); static int __init late_init(void) { @@ -922,10 +940,6 @@ static int __init late_init(void) if (err) return err; - err = ams_delta_modem_init(); - if (err) - return err; - /* * Once the modem device is registered, the modem_nreset * regulator can be requested on behalf of that device. -- 2.16.4
next prev parent reply other threads:[~2018-08-20 18:13 UTC|newest] Thread overview: 34+ messages / expand[flat|nested] mbox.gz Atom feed top 2018-08-20 18:13 [PATCH 0/3] ARM: OMAP1: ams-delta: Clean up GPIO setup for MODEM Janusz Krzysztofik 2018-08-20 18:13 ` Janusz Krzysztofik 2018-08-20 18:13 ` [PATCH 1/3] ARM: OMAP1: ams-delta: assign MODEM IRQ from GPIO descriptor Janusz Krzysztofik 2018-08-20 18:13 ` Janusz Krzysztofik 2018-08-23 10:42 ` Linus Walleij 2018-08-23 10:42 ` Linus Walleij 2018-08-20 18:13 ` [PATCH 2/3] ARM: OMAP1: ams-delta: initialize latch2 pins to safe values Janusz Krzysztofik 2018-08-20 18:13 ` Janusz Krzysztofik 2018-08-23 10:44 ` Linus Walleij 2018-08-23 10:44 ` Linus Walleij 2018-08-20 18:13 ` Janusz Krzysztofik [this message] 2018-08-20 18:13 ` [PATCH 3/3] ARM: OMAP1: ams-delta: register MODEM device earlier Janusz Krzysztofik 2018-08-23 10:45 ` Linus Walleij 2018-08-23 10:45 ` Linus Walleij 2018-09-07 16:56 ` [PATCH 0/3] ARM: OMAP1: ams-delta: Clean up GPIO setup for MODEM Tony Lindgren 2018-09-07 16:56 ` Tony Lindgren 2018-09-09 23:44 ` [PATCH v2 " Janusz Krzysztofik 2018-09-09 23:44 ` Janusz Krzysztofik 2018-09-09 23:44 ` Janusz Krzysztofik 2018-09-09 23:44 ` [PATCH v2 1/3] ARM: OMAP1: ams-delta: assign MODEM IRQ from GPIO descriptor Janusz Krzysztofik 2018-09-09 23:44 ` Janusz Krzysztofik 2018-09-09 23:44 ` Janusz Krzysztofik 2018-09-09 23:44 ` [PATCH v2 2/3] ARM: OMAP1: ams-delta: initialize latch2 pins to safe values Janusz Krzysztofik 2018-09-09 23:44 ` Janusz Krzysztofik 2018-09-09 23:44 ` Janusz Krzysztofik 2018-09-09 23:44 ` [PATCH v2 3/3] ARM: OMAP1: ams-delta: register MODEM device earlier Janusz Krzysztofik 2018-09-09 23:44 ` Janusz Krzysztofik 2018-09-09 23:44 ` Janusz Krzysztofik 2018-09-10 21:49 ` [PATCH v2 0/3] ARM: OMAP1: ams-delta: Clean up GPIO setup for MODEM Janusz Krzysztofik 2018-09-10 21:49 ` Janusz Krzysztofik 2018-09-20 21:23 ` Tony Lindgren 2018-09-20 21:23 ` Tony Lindgren 2018-09-20 22:43 ` Janusz Krzysztofik 2018-09-20 22:43 ` Janusz Krzysztofik
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20180820181333.2527-4-jmkrzyszt@gmail.com \ --to=jmkrzyszt@gmail.com \ --cc=aaro.koskinen@iki.fi \ --cc=gregkh@linuxfoundation.org \ --cc=jslaby@suse.com \ --cc=linus.walleij@linaro.org \ --cc=linux-arm-kernel@lists.infradead.org \ --cc=linux-gpio@vger.kernel.org \ --cc=linux-kernel@vger.kernel.org \ --cc=linux-omap@vger.kernel.org \ --cc=linux-serial@vger.kernel.org \ --cc=tony@atomide.com \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
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.