diff mbox

[1/5] ARM: OMAP2+: omap_hwmod: Add support for earlycon

Message ID 20170117040336.21700-2-lokeshvutla@ti.com (mailing list archive)
State New, archived
Headers show

Commit Message

Lokesh Vutla Jan. 17, 2017, 4:03 a.m. UTC
Hwmod core tries to reset and idles each IP that is registered with hwmod.
In case of earlycon, that specific uart IP cannot be reset or keep it in
idle state else earlycon hangs once hwmod resets that uart IP. So add support
to not reset uart that is being used as earlycon only if CONFIG_SERIAL_EARLYCON
is enabled.

Signed-off-by: Lokesh Vutla <lokeshvutla@ti.com>
---
 arch/arm/mach-omap2/omap_hwmod.c | 36 ++++++++++++++++++++++++++++++++++++
 1 file changed, 36 insertions(+)

Comments

Mark Rutland Jan. 17, 2017, 10:47 a.m. UTC | #1
On Tue, Jan 17, 2017 at 09:33:32AM +0530, Lokesh Vutla wrote:
> Hwmod core tries to reset and idles each IP that is registered with hwmod.
> In case of earlycon, that specific uart IP cannot be reset or keep it in
> idle state else earlycon hangs once hwmod resets that uart IP. So add support
> to not reset uart that is being used as earlycon only if CONFIG_SERIAL_EARLYCON
> is enabled.

> +	np = of_find_node_by_path("/chosen");
> +	if (!np)
> +		np = of_find_node_by_path("/chosen@0");

I think you can drop the second case here. There shouldn't be an "@0" on
a chosen node; core code handles that only to cater for some legacy
(PPC?) DTBs, and I don't beleive it's necessary for OMAP.

Thanks,
Mark.
--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Lokesh Vutla Jan. 17, 2017, 1:47 p.m. UTC | #2
On Tuesday 17 January 2017 04:17 PM, Mark Rutland wrote:
> On Tue, Jan 17, 2017 at 09:33:32AM +0530, Lokesh Vutla wrote:
>> Hwmod core tries to reset and idles each IP that is registered with hwmod.
>> In case of earlycon, that specific uart IP cannot be reset or keep it in
>> idle state else earlycon hangs once hwmod resets that uart IP. So add support
>> to not reset uart that is being used as earlycon only if CONFIG_SERIAL_EARLYCON
>> is enabled.
> 
>> +	np = of_find_node_by_path("/chosen");
>> +	if (!np)
>> +		np = of_find_node_by_path("/chosen@0");
> 
> I think you can drop the second case here. There shouldn't be an "@0" on
> a chosen node; core code handles that only to cater for some legacy
> (PPC?) DTBs, and I don't beleive it's necessary for OMAP.

Right. Ill repost this series by dropping this case.

Thanks and regards,
Lokesh
--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Tony Lindgren Jan. 17, 2017, 11:23 p.m. UTC | #3
* Lokesh Vutla <lokeshvutla@ti.com> [170116 20:06]:
> Hwmod core tries to reset and idles each IP that is registered with hwmod.
> In case of earlycon, that specific uart IP cannot be reset or keep it in
> idle state else earlycon hangs once hwmod resets that uart IP. So add support
> to not reset uart that is being used as earlycon only if CONFIG_SERIAL_EARLYCON
> is enabled.

Nice :)

I guess this has no dependency to SERIAL_OMAP vs 8250_OMAP selection?

Regards,

Tony
--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Lokesh Vutla Jan. 18, 2017, 3:47 a.m. UTC | #4
On Wednesday 18 January 2017 04:53 AM, Tony Lindgren wrote:
> * Lokesh Vutla <lokeshvutla@ti.com> [170116 20:06]:
>> Hwmod core tries to reset and idles each IP that is registered with hwmod.
>> In case of earlycon, that specific uart IP cannot be reset or keep it in
>> idle state else earlycon hangs once hwmod resets that uart IP. So add support
>> to not reset uart that is being used as earlycon only if CONFIG_SERIAL_EARLYCON
>> is enabled.
> 
> Nice :)
> 
> I guess this has no dependency to SERIAL_OMAP vs 8250_OMAP selection?

Unfortunately SERIAL_OMAP does not support earlycon yet. As I mentioned
in my cover letter, I verified this series only with 8250_OMAP.

Thanks and regards,
Lokesh
--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Tony Lindgren Jan. 18, 2017, 5 p.m. UTC | #5
* Lokesh Vutla <lokeshvutla@ti.com> [170117 19:50]:
> 
> 
> On Wednesday 18 January 2017 04:53 AM, Tony Lindgren wrote:
> > * Lokesh Vutla <lokeshvutla@ti.com> [170116 20:06]:
> >> Hwmod core tries to reset and idles each IP that is registered with hwmod.
> >> In case of earlycon, that specific uart IP cannot be reset or keep it in
> >> idle state else earlycon hangs once hwmod resets that uart IP. So add support
> >> to not reset uart that is being used as earlycon only if CONFIG_SERIAL_EARLYCON
> >> is enabled.
> > 
> > Nice :)
> > 
> > I guess this has no dependency to SERIAL_OMAP vs 8250_OMAP selection?
> 
> Unfortunately SERIAL_OMAP does not support earlycon yet. As I mentioned
> in my cover letter, I verified this series only with 8250_OMAP.

OK. So just to understand why it would not work with omap-serial, do we
need something implemented in drivers/tty/serial/earlycon.c for non 8250
drivers to make it work? Or are there other dependencies?

Regards,

Tony
--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Lokesh Vutla Jan. 19, 2017, 10:05 a.m. UTC | #6
On Wednesday 18 January 2017 10:30 PM, Tony Lindgren wrote:
> * Lokesh Vutla <lokeshvutla@ti.com> [170117 19:50]:
>>
>>
>> On Wednesday 18 January 2017 04:53 AM, Tony Lindgren wrote:
>>> * Lokesh Vutla <lokeshvutla@ti.com> [170116 20:06]:
>>>> Hwmod core tries to reset and idles each IP that is registered with hwmod.
>>>> In case of earlycon, that specific uart IP cannot be reset or keep it in
>>>> idle state else earlycon hangs once hwmod resets that uart IP. So add support
>>>> to not reset uart that is being used as earlycon only if CONFIG_SERIAL_EARLYCON
>>>> is enabled.
>>>
>>> Nice :)
>>>
>>> I guess this has no dependency to SERIAL_OMAP vs 8250_OMAP selection?
>>
>> Unfortunately SERIAL_OMAP does not support earlycon yet. As I mentioned
>> in my cover letter, I verified this series only with 8250_OMAP.
> 
> OK. So just to understand why it would not work with omap-serial, do we
> need something implemented in drivers/tty/serial/earlycon.c for non 8250
> drivers to make it work? Or are there other dependencies?

Yeah,  OF_EARLYCON_DECLARE should be declared for omap-serial. Just
posted a patch[1] adding support for earlycon in omap-serial.

[1] https://patchwork.kernel.org/patch/9525377/

Thanks and regards,
Lokesh
--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Tony Lindgren Jan. 19, 2017, 2:56 p.m. UTC | #7
* Lokesh Vutla <lokeshvutla@ti.com> [170119 02:08]:
> 
> 
> On Wednesday 18 January 2017 10:30 PM, Tony Lindgren wrote:
> > * Lokesh Vutla <lokeshvutla@ti.com> [170117 19:50]:
> >>
> >>
> >> On Wednesday 18 January 2017 04:53 AM, Tony Lindgren wrote:
> >>> * Lokesh Vutla <lokeshvutla@ti.com> [170116 20:06]:
> >>>> Hwmod core tries to reset and idles each IP that is registered with hwmod.
> >>>> In case of earlycon, that specific uart IP cannot be reset or keep it in
> >>>> idle state else earlycon hangs once hwmod resets that uart IP. So add support
> >>>> to not reset uart that is being used as earlycon only if CONFIG_SERIAL_EARLYCON
> >>>> is enabled.
> >>>
> >>> Nice :)
> >>>
> >>> I guess this has no dependency to SERIAL_OMAP vs 8250_OMAP selection?
> >>
> >> Unfortunately SERIAL_OMAP does not support earlycon yet. As I mentioned
> >> in my cover letter, I verified this series only with 8250_OMAP.
> > 
> > OK. So just to understand why it would not work with omap-serial, do we
> > need something implemented in drivers/tty/serial/earlycon.c for non 8250
> > drivers to make it work? Or are there other dependencies?
> 
> Yeah,  OF_EARLYCON_DECLARE should be declared for omap-serial. Just
> posted a patch[1] adding support for earlycon in omap-serial.

OK great. And with Vignesh's fix for omap5, I think we then have 8250-omap
and omap-serial behaving the same way on all SoC variants.

Regards,

Tony

> [1] https://patchwork.kernel.org/patch/9525377/

--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/arch/arm/mach-omap2/omap_hwmod.c b/arch/arm/mach-omap2/omap_hwmod.c
index e8b988714a09..7b1ac69a2209 100644
--- a/arch/arm/mach-omap2/omap_hwmod.c
+++ b/arch/arm/mach-omap2/omap_hwmod.c
@@ -3249,6 +3249,39 @@  int __init omap_hwmod_setup_one(const char *oh_name)
 }
 
 /**
+ * omap_hwmod_setup_earlycon_flags - set up flags for early console
+ *
+ * Enable DEBUG_OMAPUART_FLAGS for uart hwmod that is being used as
+ * early concole so that hwmod core doesn't reset and keep it in idle
+ * that specific uart.
+ */
+#ifdef CONFIG_SERIAL_EARLYCON
+static void __init omap_hwmod_setup_earlycon_flags(void)
+{
+	struct device_node *np;
+	struct omap_hwmod *oh;
+	const char *uart;
+
+	np = of_find_node_by_path("/chosen");
+	if (!np)
+		np = of_find_node_by_path("/chosen@0");
+
+	if (np) {
+		uart = of_get_property(np, "stdout-path", NULL);
+		if (uart) {
+			np = of_find_node_by_path(uart);
+			if (np) {
+				uart = of_get_property(np, "ti,hwmods", NULL);
+				oh = omap_hwmod_lookup(uart);
+				if (oh)
+					oh->flags |= DEBUG_OMAPUART_FLAGS;
+			}
+		}
+	}
+}
+#endif
+
+/**
  * omap_hwmod_setup_all - set up all registered IP blocks
  *
  * Initialize and set up all IP blocks registered with the hwmod code.
@@ -3261,6 +3294,9 @@  static int __init omap_hwmod_setup_all(void)
 	_ensure_mpu_hwmod_is_setup(NULL);
 
 	omap_hwmod_for_each(_init, NULL);
+#ifdef CONFIG_SERIAL_EARLYCON
+	omap_hwmod_setup_earlycon_flags();
+#endif
 	omap_hwmod_for_each(_setup, NULL);
 
 	return 0;