All of lore.kernel.org
 help / color / mirror / Atom feed
* kgdb on S5PV210
@ 2011-08-29  7:03 xf liu
  2011-08-29  7:13 ` xf liu
       [not found] ` <CAJuYYwTrQdLYAPa1Uf9aFWHyNHfufff35-_unRNJ3mVmYdZ3BA@mail.gmail.com>
  0 siblings, 2 replies; 5+ messages in thread
From: xf liu @ 2011-08-29  7:03 UTC (permalink / raw)
  To: linux-samsung-soc

Hi list,


I try to enable kgdb on S5PV210 using the same serial port (UART 0)
with the console, but after adding "kgdboc=ttySAC0,115200 kgdbwait" I
found tty_find_polling_driver returns NULL.
The cause is that the poll_get_char and poll_put_char handlers are not
set in static struct uart_ops s3c24xx_serial_ops.

I tried google but do net found any patch for this, but maybe I lost something.
Is there any patch I can get from anywhere or should I implement the
functions by myself?

Thanks in advance.

Regards,
Ryan

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: kgdb on S5PV210
  2011-08-29  7:03 kgdb on S5PV210 xf liu
@ 2011-08-29  7:13 ` xf liu
       [not found] ` <CAJuYYwTrQdLYAPa1Uf9aFWHyNHfufff35-_unRNJ3mVmYdZ3BA@mail.gmail.com>
  1 sibling, 0 replies; 5+ messages in thread
From: xf liu @ 2011-08-29  7:13 UTC (permalink / raw)
  To: linux-samsung-soc

I do not subscribe the list, so pls add me in the cc list if any reply.
Thanks.

2011/8/29 xf liu <7inchpalace@gmail.com>:
> Hi list,
>
>
> I try to enable kgdb on S5PV210 using the same serial port (UART 0)
> with the console, but after adding "kgdboc=ttySAC0,115200 kgdbwait" I
> found tty_find_polling_driver returns NULL.
> The cause is that the poll_get_char and poll_put_char handlers are not
> set in static struct uart_ops s3c24xx_serial_ops.
>
> I tried google but do net found any patch for this, but maybe I lost something.
> Is there any patch I can get from anywhere or should I implement the
> functions by myself?
>
> Thanks in advance.
>
> Regards,
> Ryan
>

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: kgdb on S5PV210
       [not found] ` <CAJuYYwTrQdLYAPa1Uf9aFWHyNHfufff35-_unRNJ3mVmYdZ3BA@mail.gmail.com>
@ 2011-08-30  6:46   ` xf liu
  2011-08-31  0:59     ` xf liu
  0 siblings, 1 reply; 5+ messages in thread
From: xf liu @ 2011-08-30  6:46 UTC (permalink / raw)
  To: Thomas Abraham; +Cc: linux-samsung-soc

Hi Thomas,

Thanks for your reply.
I tried this patch, but the result is the same. :(
I use minicom in host PC as console terminal to display the kernel trace.
Is there still anything wrong?
Thanks.

Regards,
Ryan

2011/8/30 Thomas Abraham <thomas.abraham@linaro.org>:
> Hi Ryan,
>
> On 29 August 2011 12:33, xf liu <7inchpalace@gmail.com> wrote:
>>
>> Hi list,
>>
>>
>> I try to enable kgdb on S5PV210 using the same serial port (UART 0)
>> with the console, but after adding "kgdboc=ttySAC0,115200 kgdbwait" I
>> found tty_find_polling_driver returns NULL.
>> The cause is that the poll_get_char and poll_put_char handlers are not
>> set in static struct uart_ops s3c24xx_serial_ops.
>>
>> I tried google but do net found any patch for this, but maybe I lost
>> something.
>> Is there any patch I can get from anywhere or should I implement the
>> functions by myself?
>
> This has not been supported in the mainline yet. Following diff can be used
> for this but please note that this is not been compile and run tested.
>
> diff --git a/drivers/tty/serial/samsung.c b/drivers/tty/serial/samsung.c
> index ae7a302..5664ec0 100644
> --- a/drivers/tty/serial/samsung.c
> +++ b/drivers/tty/serial/samsung.c
> @@ -66,6 +66,9 @@
>  /* flag to ignore all characters coming in */
>  #define RXSTAT_DUMMY_READ (0x10000000)
>
> +static char s3c24xx_serial_console_putchar(struct uart_port *port);
> +static char s3c24xx_serial_console_getchar(struct uart_port *port);
> +
>  static inline struct s3c24xx_uart_port *to_ourport(struct uart_port *port)
>  {
>      return container_of(port, struct s3c24xx_uart_port, port);
> @@ -957,6 +960,10 @@ static struct uart_ops s3c24xx_serial_ops = {
>      .request_port    = s3c24xx_serial_request_port,
>      .config_port    = s3c24xx_serial_config_port,
>      .verify_port    = s3c24xx_serial_verify_port,
> +#ifdef CONFIG_CONSOLE_POLL
> +    .poll_put_char    = s3c24xx_serial_console_putchar,
> +    .poll_get_char    = s3c24xx_serial_console_getchar,
> +#endif
>  };
>
>  static struct uart_driver s3c24xx_uart_drv = {
> @@ -1382,6 +1389,25 @@ s3c24xx_serial_console_txrdy(struct uart_port *port,
> unsigned int ufcon)
>      return (utrstat & S3C2410_UTRSTAT_TXE) ? 1 : 0;
>  }
>
> +static int
> +s3c24xx_serial_console_rxrdy(struct uart_port *port, unsigned int ufcon)
> +{
> +    struct s3c24xx_uart_info *info = s3c24xx_port_to_info(port);
> +    unsigned long ufstat, utrstat;
> +
> +    if (ufcon & S3C2410_UFCON_FIFOMODE) {
> +        /* fifo mode - check amount of data in fifo registers... */
> +
> +        ufstat = rd_regl(port, S3C2410_UFSTAT);
> +        return (ufstat & info->rx_fifofull) ? 1 : 0;
> +    }
> +
> +    /* in non-fifo mode, we go and use the rx buffer full */
> +
> +    utrstat = rd_regl(port, S3C2410_UTRSTAT);
> +    return (utrstat & S3C2410_UTRSTAT_RXDR) ? 1 : 0;
> +}
> +
>  static void
>  s3c24xx_serial_console_putchar(struct uart_port *port, int ch)
>  {
> @@ -1391,6 +1417,15 @@ s3c24xx_serial_console_putchar(struct uart_port
> *port, int ch)
>      wr_regb(cons_uart, S3C2410_UTXH, ch);
>  }
>
> +static char
> +s3c24xx_serial_console_getchar(struct uart_port *port)
> +{
> +    unsigned int ufcon = rd_regl(cons_uart, S3C2410_UFCON);
> +    while (!s3c24xx_serial_console_rxrdy(port, ufcon))
> +        barrier();
> +    rd_regb(cons_uart, S3C2410_URXH);
> +}
> +
>  static void
>  s3c24xx_serial_console_write(struct console *co, const char *s,
>                   unsigned int count)
>
> Regards,
> Thomas.
>
>
>>
>> Thanks in advance.
>>
>> Regards,
>> Ryan
>> --
>> To unsubscribe from this list: send the line "unsubscribe
>> linux-samsung-soc" in
>> the body of a message to majordomo@vger.kernel.org
>> More majordomo info at  http://vger.kernel.org/majordomo-info.html
>
>

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: kgdb on S5PV210
  2011-08-30  6:46   ` xf liu
@ 2011-08-31  0:59     ` xf liu
  2011-08-31  3:27       ` xf liu
  0 siblings, 1 reply; 5+ messages in thread
From: xf liu @ 2011-08-31  0:59 UTC (permalink / raw)
  To: Thomas Abraham; +Cc: linux-samsung-soc

Hi Thomas and All,

I modified the poll_get_char and poll_put_char function and retried.
I got the result of
"+$S05#b8+$OK#9a+$QC0000000000000001#95+$000000000100000054c87fc0b8c97fc00100000"
when connecting .
I don't know the details about the RSP but the 1st step seems OK while
connecting.
Can anyone help to figure out what problem may happened while
connecting GDB with the remote device?
Thanks.

Ryan

2011/8/30 xf liu <7inchpalace@gmail.com>:
> Hi Thomas,
>
> Thanks for your reply.
> I tried this patch, but the result is the same. :(
> I use minicom in host PC as console terminal to display the kernel trace.
> Is there still anything wrong?
> Thanks.
>
> Regards,
> Ryan
>
> 2011/8/30 Thomas Abraham <thomas.abraham@linaro.org>:
>> Hi Ryan,
>>
>> On 29 August 2011 12:33, xf liu <7inchpalace@gmail.com> wrote:
>>>
>>> Hi list,
>>>
>>>
>>> I try to enable kgdb on S5PV210 using the same serial port (UART 0)
>>> with the console, but after adding "kgdboc=ttySAC0,115200 kgdbwait" I
>>> found tty_find_polling_driver returns NULL.
>>> The cause is that the poll_get_char and poll_put_char handlers are not
>>> set in static struct uart_ops s3c24xx_serial_ops.
>>>
>>> I tried google but do net found any patch for this, but maybe I lost
>>> something.
>>> Is there any patch I can get from anywhere or should I implement the
>>> functions by myself?
>>
>> This has not been supported in the mainline yet. Following diff can be used
>> for this but please note that this is not been compile and run tested.
>>
>> diff --git a/drivers/tty/serial/samsung.c b/drivers/tty/serial/samsung.c
>> index ae7a302..5664ec0 100644
>> --- a/drivers/tty/serial/samsung.c
>> +++ b/drivers/tty/serial/samsung.c
>> @@ -66,6 +66,9 @@
>>  /* flag to ignore all characters coming in */
>>  #define RXSTAT_DUMMY_READ (0x10000000)
>>
>> +static char s3c24xx_serial_console_putchar(struct uart_port *port);
>> +static char s3c24xx_serial_console_getchar(struct uart_port *port);
>> +
>>  static inline struct s3c24xx_uart_port *to_ourport(struct uart_port *port)
>>  {
>>      return container_of(port, struct s3c24xx_uart_port, port);
>> @@ -957,6 +960,10 @@ static struct uart_ops s3c24xx_serial_ops = {
>>      .request_port    = s3c24xx_serial_request_port,
>>      .config_port    = s3c24xx_serial_config_port,
>>      .verify_port    = s3c24xx_serial_verify_port,
>> +#ifdef CONFIG_CONSOLE_POLL
>> +    .poll_put_char    = s3c24xx_serial_console_putchar,
>> +    .poll_get_char    = s3c24xx_serial_console_getchar,
>> +#endif
>>  };
>>
>>  static struct uart_driver s3c24xx_uart_drv = {
>> @@ -1382,6 +1389,25 @@ s3c24xx_serial_console_txrdy(struct uart_port *port,
>> unsigned int ufcon)
>>      return (utrstat & S3C2410_UTRSTAT_TXE) ? 1 : 0;
>>  }
>>
>> +static int
>> +s3c24xx_serial_console_rxrdy(struct uart_port *port, unsigned int ufcon)
>> +{
>> +    struct s3c24xx_uart_info *info = s3c24xx_port_to_info(port);
>> +    unsigned long ufstat, utrstat;
>> +
>> +    if (ufcon & S3C2410_UFCON_FIFOMODE) {
>> +        /* fifo mode - check amount of data in fifo registers... */
>> +
>> +        ufstat = rd_regl(port, S3C2410_UFSTAT);
>> +        return (ufstat & info->rx_fifofull) ? 1 : 0;
>> +    }
>> +
>> +    /* in non-fifo mode, we go and use the rx buffer full */
>> +
>> +    utrstat = rd_regl(port, S3C2410_UTRSTAT);
>> +    return (utrstat & S3C2410_UTRSTAT_RXDR) ? 1 : 0;
>> +}
>> +
>>  static void
>>  s3c24xx_serial_console_putchar(struct uart_port *port, int ch)
>>  {
>> @@ -1391,6 +1417,15 @@ s3c24xx_serial_console_putchar(struct uart_port
>> *port, int ch)
>>      wr_regb(cons_uart, S3C2410_UTXH, ch);
>>  }
>>
>> +static char
>> +s3c24xx_serial_console_getchar(struct uart_port *port)
>> +{
>> +    unsigned int ufcon = rd_regl(cons_uart, S3C2410_UFCON);
>> +    while (!s3c24xx_serial_console_rxrdy(port, ufcon))
>> +        barrier();
>> +    rd_regb(cons_uart, S3C2410_URXH);
>> +}
>> +
>>  static void
>>  s3c24xx_serial_console_write(struct console *co, const char *s,
>>                   unsigned int count)
>>
>> Regards,
>> Thomas.
>>
>>
>>>
>>> Thanks in advance.
>>>
>>> Regards,
>>> Ryan
>>> --
>>> To unsubscribe from this list: send the line "unsubscribe
>>> linux-samsung-soc" in
>>> the body of a message to majordomo@vger.kernel.org
>>> More majordomo info at  http://vger.kernel.org/majordomo-info.html
>>
>>
>

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: kgdb on S5PV210
  2011-08-31  0:59     ` xf liu
@ 2011-08-31  3:27       ` xf liu
  0 siblings, 0 replies; 5+ messages in thread
From: xf liu @ 2011-08-31  3:27 UTC (permalink / raw)
  To: Thomas Abraham; +Cc: linux-samsung-soc

Hi,

After retrying several times, remote GDB can sometimes attach my
device, and sometimes meet problems.
Some info listed below:

$ sudo gdb new_vmlinux
GNU gdb (GDB) 7.2-ubuntu
Copyright (C) 2010 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-linux-gnu".
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>...
Reading symbols from /media/disk-1/ryan/download/gdb-7.3/gdb/new_vmlinux...done.
warning: not using untrusted file ".gdbinit"
(gdb) target remote /dev/ttyS0
Remote debugging using /dev/ttyS0
0x00000000 in ?? ()
(gdb) b bq27200_read
Ignoring packet error, continuing...
Reply contains invalid hex digit 116
(gdb) b bq27200_read
Ignoring packet error, continuing...
Reply contains invalid hex digit 116
(gdb) b bq27200_read
Breakpoint 1 at 0xc0274884: file drivers/power/bq27x00_battery.c, line 1207.
(gdb) continue
Continuing.

Program received signal SIGTRAP, Trace/breakpoint trap.
0xc06e3824 in power_supply_attrs ()
(gdb) continue
Continuing.
Ignoring packet error, continuing...
Reply contains invalid hex digit 116
(gdb) continue
Continuing.

Program received signal SIGTRAP, Trace/breakpoint trap.
0x00000000 in ?? ()
(gdb) continue
Continuing.
Ignoring packet error, continuing...
Reply contains invalid hex digit 32
(gdb) continue
Continuing.

It seems that there's some problem within my modified poll_get_char
and poll_put_char functions.
Here are my modified functions(seems ugly), can anyone help to figure
out what problems may be?
BTW, I also disable the default IRQ handlers for UART0 TX and RX.

static void ryan_wait_for_tx_empty(struct uart_port *port)
{
	//unsigned int tmout = 100000;
	while (true) {
		unsigned long stat = readl(port->membase + S3C2410_UFSTAT);
		if (!(stat & (S5PV210_UFSTAT_TXMASK | S5PV210_UFSTAT_TXFULL)))
			break;
		//if (--tmout == 0)
			//break;
		udelay(1);
	}
}

static void ryan_poll_put_char (struct uart_port *port, unsigned char ch)
{
	ryan_wait_for_tx_empty(port);
	writeb(ch, port->membase + S3C2410_UTXH);
	ryan_wait_for_tx_empty(port);
}

static int ryan_poll_get_char(struct uart_port * port)
{
	unsigned int stat;
	int ch;
	stat = readl(port->membase + S3C2410_UFSTAT);
	if (!(stat & (S5PV210_UFSTAT_RXMASK | S5PV210_UFSTAT_RXFULL)))
		return NO_POLL_CHAR;
	 ch = readb(port->membase + S3C2410_URXH);
	return ch;
}

Thanks for any suggestions and comments.

Regards,
Ryan

2011/8/31 xf liu <7inchpalace@gmail.com>:
> Hi Thomas and All,
>
> I modified the poll_get_char and poll_put_char function and retried.
> I got the result of
> "+$S05#b8+$OK#9a+$QC0000000000000001#95+$000000000100000054c87fc0b8c97fc00100000"
> when connecting .
> I don't know the details about the RSP but the 1st step seems OK while
> connecting.
> Can anyone help to figure out what problem may happened while
> connecting GDB with the remote device?
> Thanks.
>
> Ryan
>
> 2011/8/30 xf liu <7inchpalace@gmail.com>:
>> Hi Thomas,
>>
>> Thanks for your reply.
>> I tried this patch, but the result is the same. :(
>> I use minicom in host PC as console terminal to display the kernel trace.
>> Is there still anything wrong?
>> Thanks.
>>
>> Regards,
>> Ryan
>>
>> 2011/8/30 Thomas Abraham <thomas.abraham@linaro.org>:
>>> Hi Ryan,
>>>
>>> On 29 August 2011 12:33, xf liu <7inchpalace@gmail.com> wrote:
>>>>
>>>> Hi list,
>>>>
>>>>
>>>> I try to enable kgdb on S5PV210 using the same serial port (UART 0)
>>>> with the console, but after adding "kgdboc=ttySAC0,115200 kgdbwait" I
>>>> found tty_find_polling_driver returns NULL.
>>>> The cause is that the poll_get_char and poll_put_char handlers are not
>>>> set in static struct uart_ops s3c24xx_serial_ops.
>>>>
>>>> I tried google but do net found any patch for this, but maybe I lost
>>>> something.
>>>> Is there any patch I can get from anywhere or should I implement the
>>>> functions by myself?
>>>
>>> This has not been supported in the mainline yet. Following diff can be used
>>> for this but please note that this is not been compile and run tested.
>>>
>>> diff --git a/drivers/tty/serial/samsung.c b/drivers/tty/serial/samsung.c
>>> index ae7a302..5664ec0 100644
>>> --- a/drivers/tty/serial/samsung.c
>>> +++ b/drivers/tty/serial/samsung.c
>>> @@ -66,6 +66,9 @@
>>>  /* flag to ignore all characters coming in */
>>>  #define RXSTAT_DUMMY_READ (0x10000000)
>>>
>>> +static char s3c24xx_serial_console_putchar(struct uart_port *port);
>>> +static char s3c24xx_serial_console_getchar(struct uart_port *port);
>>> +
>>>  static inline struct s3c24xx_uart_port *to_ourport(struct uart_port *port)
>>>  {
>>>      return container_of(port, struct s3c24xx_uart_port, port);
>>> @@ -957,6 +960,10 @@ static struct uart_ops s3c24xx_serial_ops = {
>>>      .request_port    = s3c24xx_serial_request_port,
>>>      .config_port    = s3c24xx_serial_config_port,
>>>      .verify_port    = s3c24xx_serial_verify_port,
>>> +#ifdef CONFIG_CONSOLE_POLL
>>> +    .poll_put_char    = s3c24xx_serial_console_putchar,
>>> +    .poll_get_char    = s3c24xx_serial_console_getchar,
>>> +#endif
>>>  };
>>>
>>>  static struct uart_driver s3c24xx_uart_drv = {
>>> @@ -1382,6 +1389,25 @@ s3c24xx_serial_console_txrdy(struct uart_port *port,
>>> unsigned int ufcon)
>>>      return (utrstat & S3C2410_UTRSTAT_TXE) ? 1 : 0;
>>>  }
>>>
>>> +static int
>>> +s3c24xx_serial_console_rxrdy(struct uart_port *port, unsigned int ufcon)
>>> +{
>>> +    struct s3c24xx_uart_info *info = s3c24xx_port_to_info(port);
>>> +    unsigned long ufstat, utrstat;
>>> +
>>> +    if (ufcon & S3C2410_UFCON_FIFOMODE) {
>>> +        /* fifo mode - check amount of data in fifo registers... */
>>> +
>>> +        ufstat = rd_regl(port, S3C2410_UFSTAT);
>>> +        return (ufstat & info->rx_fifofull) ? 1 : 0;
>>> +    }
>>> +
>>> +    /* in non-fifo mode, we go and use the rx buffer full */
>>> +
>>> +    utrstat = rd_regl(port, S3C2410_UTRSTAT);
>>> +    return (utrstat & S3C2410_UTRSTAT_RXDR) ? 1 : 0;
>>> +}
>>> +
>>>  static void
>>>  s3c24xx_serial_console_putchar(struct uart_port *port, int ch)
>>>  {
>>> @@ -1391,6 +1417,15 @@ s3c24xx_serial_console_putchar(struct uart_port
>>> *port, int ch)
>>>      wr_regb(cons_uart, S3C2410_UTXH, ch);
>>>  }
>>>
>>> +static char
>>> +s3c24xx_serial_console_getchar(struct uart_port *port)
>>> +{
>>> +    unsigned int ufcon = rd_regl(cons_uart, S3C2410_UFCON);
>>> +    while (!s3c24xx_serial_console_rxrdy(port, ufcon))
>>> +        barrier();
>>> +    rd_regb(cons_uart, S3C2410_URXH);
>>> +}
>>> +
>>>  static void
>>>  s3c24xx_serial_console_write(struct console *co, const char *s,
>>>                   unsigned int count)
>>>
>>> Regards,
>>> Thomas.
>>>
>>>
>>>>
>>>> Thanks in advance.
>>>>
>>>> Regards,
>>>> Ryan
>>>> --
>>>> To unsubscribe from this list: send the line "unsubscribe
>>>> linux-samsung-soc" in
>>>> the body of a message to majordomo@vger.kernel.org
>>>> More majordomo info at  http://vger.kernel.org/majordomo-info.html
>>>
>>>
>>
>

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2011-08-31  3:27 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-08-29  7:03 kgdb on S5PV210 xf liu
2011-08-29  7:13 ` xf liu
     [not found] ` <CAJuYYwTrQdLYAPa1Uf9aFWHyNHfufff35-_unRNJ3mVmYdZ3BA@mail.gmail.com>
2011-08-30  6:46   ` xf liu
2011-08-31  0:59     ` xf liu
2011-08-31  3:27       ` xf liu

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.