* [PATCH] tty: serial: cpm_uart: Add udbg support for enabling xmon
@ 2020-12-23 9:38 ` Christophe Leroy
0 siblings, 0 replies; 8+ messages in thread
From: Christophe Leroy @ 2020-12-23 9:38 UTC (permalink / raw)
To: Greg Kroah-Hartman, Jiri Slaby, linux-serial; +Cc: linux-kernel, linuxppc-dev
In order to use xmon with powerpc 8xx, the serial driver
must provide udbg_putc() and udpb_getc().
Provide them via cpm_put_poll_char() and cpm_get_poll_char().
This requires CONFIG_CONSOLE_POLL.
Signed-off-by: Christophe Leroy <christophe.leroy@csgroup.eu>
---
drivers/tty/serial/cpm_uart/cpm_uart_core.c | 40 ++++++++++++++++++++-
1 file changed, 39 insertions(+), 1 deletion(-)
diff --git a/drivers/tty/serial/cpm_uart/cpm_uart_core.c b/drivers/tty/serial/cpm_uart/cpm_uart_core.c
index ba14ec5b9bc4..2920b9b602b3 100644
--- a/drivers/tty/serial/cpm_uart/cpm_uart_core.c
+++ b/drivers/tty/serial/cpm_uart/cpm_uart_core.c
@@ -1145,6 +1145,32 @@ static void cpm_put_poll_char(struct uart_port *port,
ch[0] = (char)c;
cpm_uart_early_write(pinfo, ch, 1, false);
}
+
+static struct uart_port *udbg_port;
+
+static void udbg_cpm_putc(char c)
+{
+ if (c == '\n')
+ cpm_put_poll_char(udbg_port, '\r');
+ cpm_put_poll_char(udbg_port, c);
+}
+
+static int udbg_cpm_getc_poll(void)
+{
+ int c = cpm_get_poll_char(udbg_port);
+
+ return c == NO_POLL_CHAR ? -1 : c;
+}
+
+static int udbg_cpm_getc(void)
+{
+ int c;
+
+ while ((c = udbg_cpm_getc_poll()) == -1)
+ cpu_relax();
+ return c;
+}
+
#endif /* CONFIG_CONSOLE_POLL */
static const struct uart_ops cpm_uart_pops = {
@@ -1251,7 +1277,10 @@ static int cpm_uart_init_port(struct device_node *np,
pinfo->gpios[i] = NULL;
#ifdef CONFIG_PPC_EARLY_DEBUG_CPM
- udbg_putc = NULL;
+#ifdef CONFIG_CONSOLE_POLL
+ if (!udbg_port)
+#endif
+ udbg_putc = NULL;
#endif
return cpm_uart_request_port(&pinfo->port);
@@ -1370,6 +1399,15 @@ static int __init cpm_uart_console_setup(struct console *co, char *options)
uart_set_options(port, co, baud, parity, bits, flow);
cpm_line_cr_cmd(pinfo, CPM_CR_RESTART_TX);
+#ifdef CONFIG_CONSOLE_POLL
+ if (!udbg_port) {
+ udbg_port = &pinfo->port;
+ udbg_putc = udbg_cpm_putc;
+ udbg_getc = udbg_cpm_getc;
+ udbg_getc_poll = udbg_cpm_getc_poll;
+ }
+#endif
+
return 0;
}
--
2.25.0
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [PATCH] tty: serial: cpm_uart: Add udbg support for enabling xmon
@ 2020-12-23 9:38 ` Christophe Leroy
0 siblings, 0 replies; 8+ messages in thread
From: Christophe Leroy @ 2020-12-23 9:38 UTC (permalink / raw)
To: Greg Kroah-Hartman, Jiri Slaby, linux-serial; +Cc: linuxppc-dev, linux-kernel
In order to use xmon with powerpc 8xx, the serial driver
must provide udbg_putc() and udpb_getc().
Provide them via cpm_put_poll_char() and cpm_get_poll_char().
This requires CONFIG_CONSOLE_POLL.
Signed-off-by: Christophe Leroy <christophe.leroy@csgroup.eu>
---
drivers/tty/serial/cpm_uart/cpm_uart_core.c | 40 ++++++++++++++++++++-
1 file changed, 39 insertions(+), 1 deletion(-)
diff --git a/drivers/tty/serial/cpm_uart/cpm_uart_core.c b/drivers/tty/serial/cpm_uart/cpm_uart_core.c
index ba14ec5b9bc4..2920b9b602b3 100644
--- a/drivers/tty/serial/cpm_uart/cpm_uart_core.c
+++ b/drivers/tty/serial/cpm_uart/cpm_uart_core.c
@@ -1145,6 +1145,32 @@ static void cpm_put_poll_char(struct uart_port *port,
ch[0] = (char)c;
cpm_uart_early_write(pinfo, ch, 1, false);
}
+
+static struct uart_port *udbg_port;
+
+static void udbg_cpm_putc(char c)
+{
+ if (c == '\n')
+ cpm_put_poll_char(udbg_port, '\r');
+ cpm_put_poll_char(udbg_port, c);
+}
+
+static int udbg_cpm_getc_poll(void)
+{
+ int c = cpm_get_poll_char(udbg_port);
+
+ return c == NO_POLL_CHAR ? -1 : c;
+}
+
+static int udbg_cpm_getc(void)
+{
+ int c;
+
+ while ((c = udbg_cpm_getc_poll()) == -1)
+ cpu_relax();
+ return c;
+}
+
#endif /* CONFIG_CONSOLE_POLL */
static const struct uart_ops cpm_uart_pops = {
@@ -1251,7 +1277,10 @@ static int cpm_uart_init_port(struct device_node *np,
pinfo->gpios[i] = NULL;
#ifdef CONFIG_PPC_EARLY_DEBUG_CPM
- udbg_putc = NULL;
+#ifdef CONFIG_CONSOLE_POLL
+ if (!udbg_port)
+#endif
+ udbg_putc = NULL;
#endif
return cpm_uart_request_port(&pinfo->port);
@@ -1370,6 +1399,15 @@ static int __init cpm_uart_console_setup(struct console *co, char *options)
uart_set_options(port, co, baud, parity, bits, flow);
cpm_line_cr_cmd(pinfo, CPM_CR_RESTART_TX);
+#ifdef CONFIG_CONSOLE_POLL
+ if (!udbg_port) {
+ udbg_port = &pinfo->port;
+ udbg_putc = udbg_cpm_putc;
+ udbg_getc = udbg_cpm_getc;
+ udbg_getc_poll = udbg_cpm_getc_poll;
+ }
+#endif
+
return 0;
}
--
2.25.0
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [PATCH] powerpc/xmon: Select CONSOLE_POLL for the 8xx
2020-12-23 9:38 ` Christophe Leroy
@ 2020-12-23 9:38 ` Christophe Leroy
-1 siblings, 0 replies; 8+ messages in thread
From: Christophe Leroy @ 2020-12-23 9:38 UTC (permalink / raw)
To: Benjamin Herrenschmidt, Paul Mackerras, Michael Ellerman
Cc: linux-kernel, linuxppc-dev
Powerpc 8xx requires CONSOLE_POLL to get udbg_putc() and
udbg_getc() in CPM uart driver.
Signed-off-by: Christophe Leroy <christophe.leroy@csgroup.eu>
---
arch/powerpc/Kconfig.debug | 1 +
1 file changed, 1 insertion(+)
diff --git a/arch/powerpc/Kconfig.debug b/arch/powerpc/Kconfig.debug
index b88900f4832f..ae084357994e 100644
--- a/arch/powerpc/Kconfig.debug
+++ b/arch/powerpc/Kconfig.debug
@@ -88,6 +88,7 @@ config PPC_IRQ_SOFT_MASK_DEBUG
config XMON
bool "Include xmon kernel debugger"
depends on DEBUG_KERNEL
+ select CONSOLE_POLL if SERIAL_CPM_CONSOLE
help
Include in-kernel hooks for the xmon kernel monitor/debugger.
Unless you are intending to debug the kernel, say N here.
--
2.25.0
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [PATCH] powerpc/xmon: Select CONSOLE_POLL for the 8xx
@ 2020-12-23 9:38 ` Christophe Leroy
0 siblings, 0 replies; 8+ messages in thread
From: Christophe Leroy @ 2020-12-23 9:38 UTC (permalink / raw)
To: Benjamin Herrenschmidt, Paul Mackerras, Michael Ellerman
Cc: linuxppc-dev, linux-kernel
Powerpc 8xx requires CONSOLE_POLL to get udbg_putc() and
udbg_getc() in CPM uart driver.
Signed-off-by: Christophe Leroy <christophe.leroy@csgroup.eu>
---
arch/powerpc/Kconfig.debug | 1 +
1 file changed, 1 insertion(+)
diff --git a/arch/powerpc/Kconfig.debug b/arch/powerpc/Kconfig.debug
index b88900f4832f..ae084357994e 100644
--- a/arch/powerpc/Kconfig.debug
+++ b/arch/powerpc/Kconfig.debug
@@ -88,6 +88,7 @@ config PPC_IRQ_SOFT_MASK_DEBUG
config XMON
bool "Include xmon kernel debugger"
depends on DEBUG_KERNEL
+ select CONSOLE_POLL if SERIAL_CPM_CONSOLE
help
Include in-kernel hooks for the xmon kernel monitor/debugger.
Unless you are intending to debug the kernel, say N here.
--
2.25.0
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [PATCH] powerpc/xmon: Enable breakpoints on 8xx
2020-12-23 9:38 ` Christophe Leroy
@ 2020-12-23 9:38 ` Christophe Leroy
-1 siblings, 0 replies; 8+ messages in thread
From: Christophe Leroy @ 2020-12-23 9:38 UTC (permalink / raw)
To: Benjamin Herrenschmidt, Paul Mackerras, Michael Ellerman
Cc: linux-kernel, linuxppc-dev
Since commit 4ad8622dc548 ("powerpc/8xx: Implement hw_breakpoint"),
8xx has breakpoints so there is no reason to opt breakpoint logic
out of xmon for the 8xx.
Signed-off-by: Christophe Leroy <christophe.leroy@csgroup.eu>
Fixes: 4ad8622dc548 ("powerpc/8xx: Implement hw_breakpoint")
---
arch/powerpc/xmon/xmon.c | 4 ----
1 file changed, 4 deletions(-)
diff --git a/arch/powerpc/xmon/xmon.c b/arch/powerpc/xmon/xmon.c
index dcd817ca2edf..cec432eb9189 100644
--- a/arch/powerpc/xmon/xmon.c
+++ b/arch/powerpc/xmon/xmon.c
@@ -1383,7 +1383,6 @@ static long check_bp_loc(unsigned long addr)
return 1;
}
-#ifndef CONFIG_PPC_8xx
static int find_free_data_bpt(void)
{
int i;
@@ -1395,7 +1394,6 @@ static int find_free_data_bpt(void)
printf("Couldn't find free breakpoint register\n");
return -1;
}
-#endif
static void print_data_bpts(void)
{
@@ -1435,7 +1433,6 @@ bpt_cmds(void)
cmd = inchar();
switch (cmd) {
-#ifndef CONFIG_PPC_8xx
static const char badaddr[] = "Only kernel addresses are permitted for breakpoints\n";
int mode;
case 'd': /* bd - hardware data breakpoint */
@@ -1497,7 +1494,6 @@ bpt_cmds(void)
force_enable_xmon();
}
break;
-#endif
case 'c':
if (!scanhex(&a)) {
--
2.25.0
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [PATCH] powerpc/xmon: Enable breakpoints on 8xx
@ 2020-12-23 9:38 ` Christophe Leroy
0 siblings, 0 replies; 8+ messages in thread
From: Christophe Leroy @ 2020-12-23 9:38 UTC (permalink / raw)
To: Benjamin Herrenschmidt, Paul Mackerras, Michael Ellerman
Cc: linuxppc-dev, linux-kernel
Since commit 4ad8622dc548 ("powerpc/8xx: Implement hw_breakpoint"),
8xx has breakpoints so there is no reason to opt breakpoint logic
out of xmon for the 8xx.
Signed-off-by: Christophe Leroy <christophe.leroy@csgroup.eu>
Fixes: 4ad8622dc548 ("powerpc/8xx: Implement hw_breakpoint")
---
arch/powerpc/xmon/xmon.c | 4 ----
1 file changed, 4 deletions(-)
diff --git a/arch/powerpc/xmon/xmon.c b/arch/powerpc/xmon/xmon.c
index dcd817ca2edf..cec432eb9189 100644
--- a/arch/powerpc/xmon/xmon.c
+++ b/arch/powerpc/xmon/xmon.c
@@ -1383,7 +1383,6 @@ static long check_bp_loc(unsigned long addr)
return 1;
}
-#ifndef CONFIG_PPC_8xx
static int find_free_data_bpt(void)
{
int i;
@@ -1395,7 +1394,6 @@ static int find_free_data_bpt(void)
printf("Couldn't find free breakpoint register\n");
return -1;
}
-#endif
static void print_data_bpts(void)
{
@@ -1435,7 +1433,6 @@ bpt_cmds(void)
cmd = inchar();
switch (cmd) {
-#ifndef CONFIG_PPC_8xx
static const char badaddr[] = "Only kernel addresses are permitted for breakpoints\n";
int mode;
case 'd': /* bd - hardware data breakpoint */
@@ -1497,7 +1494,6 @@ bpt_cmds(void)
force_enable_xmon();
}
break;
-#endif
case 'c':
if (!scanhex(&a)) {
--
2.25.0
^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: [PATCH] tty: serial: cpm_uart: Add udbg support for enabling xmon
2020-12-23 9:38 ` Christophe Leroy
` (2 preceding siblings ...)
(?)
@ 2021-01-12 18:25 ` Christophe Leroy
-1 siblings, 0 replies; 8+ messages in thread
From: Christophe Leroy @ 2021-01-12 18:25 UTC (permalink / raw)
To: linuxppc-dev
Le 23/12/2020 à 10:38, Christophe Leroy a écrit :
> In order to use xmon with powerpc 8xx, the serial driver
> must provide udbg_putc() and udpb_getc().
>
> Provide them via cpm_put_poll_char() and cpm_get_poll_char().
>
> This requires CONFIG_CONSOLE_POLL.
>
> Signed-off-by: Christophe Leroy <christophe.leroy@csgroup.eu>
This patch has been merged in tty-next, it is visible in linux-next
Christophe
> ---
> drivers/tty/serial/cpm_uart/cpm_uart_core.c | 40 ++++++++++++++++++++-
> 1 file changed, 39 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/tty/serial/cpm_uart/cpm_uart_core.c b/drivers/tty/serial/cpm_uart/cpm_uart_core.c
> index ba14ec5b9bc4..2920b9b602b3 100644
> --- a/drivers/tty/serial/cpm_uart/cpm_uart_core.c
> +++ b/drivers/tty/serial/cpm_uart/cpm_uart_core.c
> @@ -1145,6 +1145,32 @@ static void cpm_put_poll_char(struct uart_port *port,
> ch[0] = (char)c;
> cpm_uart_early_write(pinfo, ch, 1, false);
> }
> +
> +static struct uart_port *udbg_port;
> +
> +static void udbg_cpm_putc(char c)
> +{
> + if (c == '\n')
> + cpm_put_poll_char(udbg_port, '\r');
> + cpm_put_poll_char(udbg_port, c);
> +}
> +
> +static int udbg_cpm_getc_poll(void)
> +{
> + int c = cpm_get_poll_char(udbg_port);
> +
> + return c == NO_POLL_CHAR ? -1 : c;
> +}
> +
> +static int udbg_cpm_getc(void)
> +{
> + int c;
> +
> + while ((c = udbg_cpm_getc_poll()) == -1)
> + cpu_relax();
> + return c;
> +}
> +
> #endif /* CONFIG_CONSOLE_POLL */
>
> static const struct uart_ops cpm_uart_pops = {
> @@ -1251,7 +1277,10 @@ static int cpm_uart_init_port(struct device_node *np,
> pinfo->gpios[i] = NULL;
>
> #ifdef CONFIG_PPC_EARLY_DEBUG_CPM
> - udbg_putc = NULL;
> +#ifdef CONFIG_CONSOLE_POLL
> + if (!udbg_port)
> +#endif
> + udbg_putc = NULL;
> #endif
>
> return cpm_uart_request_port(&pinfo->port);
> @@ -1370,6 +1399,15 @@ static int __init cpm_uart_console_setup(struct console *co, char *options)
> uart_set_options(port, co, baud, parity, bits, flow);
> cpm_line_cr_cmd(pinfo, CPM_CR_RESTART_TX);
>
> +#ifdef CONFIG_CONSOLE_POLL
> + if (!udbg_port) {
> + udbg_port = &pinfo->port;
> + udbg_putc = udbg_cpm_putc;
> + udbg_getc = udbg_cpm_getc;
> + udbg_getc_poll = udbg_cpm_getc_poll;
> + }
> +#endif
> +
> return 0;
> }
>
>
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] powerpc/xmon: Enable breakpoints on 8xx
2020-12-23 9:38 ` Christophe Leroy
(?)
@ 2021-02-03 11:40 ` Michael Ellerman
-1 siblings, 0 replies; 8+ messages in thread
From: Michael Ellerman @ 2021-02-03 11:40 UTC (permalink / raw)
To: Michael Ellerman, Benjamin Herrenschmidt, Christophe Leroy,
Paul Mackerras
Cc: linuxppc-dev, linux-kernel
On Wed, 23 Dec 2020 09:38:48 +0000 (UTC), Christophe Leroy wrote:
> Since commit 4ad8622dc548 ("powerpc/8xx: Implement hw_breakpoint"),
> 8xx has breakpoints so there is no reason to opt breakpoint logic
> out of xmon for the 8xx.
Applied to powerpc/next.
[1/1] powerpc/xmon: Enable breakpoints on 8xx
https://git.kernel.org/powerpc/c/30662217885d7341161924acf1665924d7d37d64
cheers
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2021-02-03 11:41 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-12-23 9:38 [PATCH] tty: serial: cpm_uart: Add udbg support for enabling xmon Christophe Leroy
2020-12-23 9:38 ` Christophe Leroy
2020-12-23 9:38 ` [PATCH] powerpc/xmon: Select CONSOLE_POLL for the 8xx Christophe Leroy
2020-12-23 9:38 ` Christophe Leroy
2020-12-23 9:38 ` [PATCH] powerpc/xmon: Enable breakpoints on 8xx Christophe Leroy
2020-12-23 9:38 ` Christophe Leroy
2021-02-03 11:40 ` Michael Ellerman
2021-01-12 18:25 ` [PATCH] tty: serial: cpm_uart: Add udbg support for enabling xmon Christophe Leroy
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.