linux-serial.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* serial_core's port->count mess
@ 2011-05-19  9:38 Pavan Savoy
  2011-05-19 10:25 ` Alan Cox
       [not found] ` <BANLkTim7OmA1y+Z_4CHZBCKu-uG_=9jJ=A@mail.gmail.com>
  0 siblings, 2 replies; 4+ messages in thread
From: Pavan Savoy @ 2011-05-19  9:38 UTC (permalink / raw)
  To: linux-serial; +Cc: pavan_savoy

Hi,

I have a device connected to my apps processor over UART, the serial
core's hooked up with omap-serial UART driver.
There is a scenario, where the device just fails to respond, and I
should be closing the UART & opening it again to re-try the request.
This is also coupled with power-cycling the chip.

However a normal start/stop sequence where chip responds to every
request & I close UART when I'm done - is something like this,
[function name & line number in logs)
uart_open(1) called
uart_open: 1635
uart_open: 1651
uart_open: 1663
uart_open: 1674
omap-hsuart omap-hsuart.1: serial_omap_pm+1
omap-hsuart omap-hsuart.1: Enable CTS wakeup for UART 1
omap-hsuart omap-hsuart.1: serial_omap_startup+1
omap-hsuart omap-hsuart.1: serial_omap_set_mctrl+1
omap-hsuart omap-hsuart.1: serial_omap_get_mctrl+1
uart_open: 1686
uart_open: 1694
omap-hsuart omap-hsuart.1: serial_omap_set_mctrl+1
omap-hsuart omap-hsuart.1: serial_omap_set_termios+1
omap-hsuart omap-hsuart.1: serial_omap_set_mctrl+1
uart_open: 1705
uart_flush_buffer(1) called
omap-hsuart omap-hsuart.1: serial_omap_set_mctrl+1
omap-hsuart omap-hsuart.1: serial_omap_set_termios+1
omap-hsuart omap-hsuart.1: serial_omap_set_mctrl+1
omap-hsuart omap-hsuart.1: serial_omap_set_termios+1
uart_flush_buffer(1) called
uart_flush_buffer(1) called
uart_flush_buffer(1) called
omap-hsuart omap-hsuart.1: serial_omap_set_mctrl+1
omap-hsuart omap-hsuart.1: serial_omap_set_termios+1
uart_wait_until_sent(1), jiffies=4294954470, expire=4294954474...
omap-hsuart omap-hsuart.1: serial_omap_tx_empty+1
uart_wait_until_sent(1), jiffies=4294954471, expire=4294954475...
omap-hsuart omap-hsuart.1: serial_omap_tx_empty+1
(stc): st_tty_open

uart_flush_buffer(1) called
uart_flush_buffer(1) called
uart_flush_buffer(1) called
(stk) :ldisc_install = 0
uart_close(1) called
uart_close: 1295
uart_close: 1316
uart_wait_until_sent(1), jiffies=4294951992, expire=4294951996...
omap-hsuart omap-hsuart.1: serial_omap_tx_empty+1
uart_close: 1327
omap-hsuart omap-hsuart.1: Disable CTS wakeup for UART1
uart_wait_until_sent(1), jiffies=4294951994, expire=4294951996...
omap-hsuart omap-hsuart.1: serial_omap_tx_empty+1
uart_close: 1345
omap-hsuart omap-hsuart.1: serial_omap_set_mctrl+1
omap-hsuart omap-hsuart.1: serial_omap_shutdown+1
omap-hsuart omap-hsuart.1: serial_omap_set_mctrl+1
uart_flush_buffer(1) called
uart_flush_buffer(1) called
omap-hsuart omap-hsuart.1: serial_omap_pm+1
uart_close: 1368
(stc): st_tty_close

However, in a scenario where the chip fails to respond to one of the
requests, the start/stop sequence becomes something like this,
uart_open(1) called
uart_open: 1635
uart_open: 1651
uart_open: 1663
uart_open: 1705

So, the problem seems to be that the port->count in the serial_core
isn't 1 & hence the call,
        if (port->count == 1)
                uart_change_pm(state, 0);
doesn't seem to be happening, which is very critical. Also no calls
are made to uart_startup & hence omap-serial's startup.

Where should I be looking as to why the port->count is messed up ?
What is the this count used for?
Also how is this related to chip not responding to certain commands?

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

* Re: serial_core's port->count mess
  2011-05-19  9:38 serial_core's port->count mess Pavan Savoy
@ 2011-05-19 10:25 ` Alan Cox
       [not found] ` <BANLkTim7OmA1y+Z_4CHZBCKu-uG_=9jJ=A@mail.gmail.com>
  1 sibling, 0 replies; 4+ messages in thread
From: Alan Cox @ 2011-05-19 10:25 UTC (permalink / raw)
  To: Pavan Savoy; +Cc: linux-serial

> So, the problem seems to be that the port->count in the serial_core
> isn't 1 & hence the call,

So you've got it open in two places

> What is the this count used for?

Number of live openers basically

> Also how is this related to chip not responding to certain commands?

No idea

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

* Re: serial_core's port->count mess
       [not found] ` <BANLkTim7OmA1y+Z_4CHZBCKu-uG_=9jJ=A@mail.gmail.com>
@ 2011-05-19 12:51   ` Pavan Savoy
       [not found]     ` <BANLkTik6f4rFcr+X=ov4y=48QCxF1=zvkg@mail.gmail.com>
  0 siblings, 1 reply; 4+ messages in thread
From: Pavan Savoy @ 2011-05-19 12:51 UTC (permalink / raw)
  To: Govindraj; +Cc: linux-serial

On Thu, May 19, 2011 at 3:58 PM, Govindraj <govindraj.ti@gmail.com> wrote:
>
> On Thu, May 19, 2011 at 3:08 PM, Pavan Savoy <pavan_savoy@sify.com> wrote:
>>
>> Hi,
>>
>> I have a device connected to my apps processor over UART, the serial
>> core's hooked up with omap-serial UART driver.
>> There is a scenario, where the device just fails to respond, and I
>> should be closing the UART & opening it again to re-try the request.
>> This is also coupled with power-cycling the chip.
>>
>> However a normal start/stop sequence where chip responds to every
>> request & I close UART when I'm done - is something like this,
>> [function name & line number in logs)
>> uart_open(1) called
>> uart_open: 1635
>> uart_open: 1651
>> uart_open: 1663
>> uart_open: 1674
>> omap-hsuart omap-hsuart.1: serial_omap_pm+1
>> omap-hsuart omap-hsuart.1: Enable CTS wakeup for UART 1
>> omap-hsuart omap-hsuart.1: serial_omap_startup+1
>> omap-hsuart omap-hsuart.1: serial_omap_set_mctrl+1
>> omap-hsuart omap-hsuart.1: serial_omap_get_mctrl+1
>> uart_open: 1686
>> uart_open: 1694
>> omap-hsuart omap-hsuart.1: serial_omap_set_mctrl+1
>> omap-hsuart omap-hsuart.1: serial_omap_set_termios+1
>> omap-hsuart omap-hsuart.1: serial_omap_set_mctrl+1
>> uart_open: 1705
>> uart_flush_buffer(1) called
>> omap-hsuart omap-hsuart.1: serial_omap_set_mctrl+1
>> omap-hsuart omap-hsuart.1: serial_omap_set_termios+1
>> omap-hsuart omap-hsuart.1: serial_omap_set_mctrl+1
>> omap-hsuart omap-hsuart.1: serial_omap_set_termios+1
>> uart_flush_buffer(1) called
>> uart_flush_buffer(1) called
>> uart_flush_buffer(1) called
>> omap-hsuart omap-hsuart.1: serial_omap_set_mctrl+1
>> omap-hsuart omap-hsuart.1: serial_omap_set_termios+1
>> uart_wait_until_sent(1), jiffies=4294954470, expire=4294954474...
>> omap-hsuart omap-hsuart.1: serial_omap_tx_empty+1
>> uart_wait_until_sent(1), jiffies=4294954471, expire=4294954475...
>> omap-hsuart omap-hsuart.1: serial_omap_tx_empty+1
>> (stc): st_tty_open
>>
>> uart_flush_buffer(1) called
>> uart_flush_buffer(1) called
>> uart_flush_buffer(1) called
>> (stk) :ldisc_install = 0
>> uart_close(1) called
>> uart_close: 1295
>> uart_close: 1316
>> uart_wait_until_sent(1), jiffies=4294951992, expire=4294951996...
>> omap-hsuart omap-hsuart.1: serial_omap_tx_empty+1
>> uart_close: 1327
>> omap-hsuart omap-hsuart.1: Disable CTS wakeup for UART1
>> uart_wait_until_sent(1), jiffies=4294951994, expire=4294951996...
>> omap-hsuart omap-hsuart.1: serial_omap_tx_empty+1
>> uart_close: 1345
>> omap-hsuart omap-hsuart.1: serial_omap_set_mctrl+1
>> omap-hsuart omap-hsuart.1: serial_omap_shutdown+1
>> omap-hsuart omap-hsuart.1: serial_omap_set_mctrl+1
>> uart_flush_buffer(1) called
>> uart_flush_buffer(1) called
>> omap-hsuart omap-hsuart.1: serial_omap_pm+1
>> uart_close: 1368
>> (stc): st_tty_close
>>
>> However, in a scenario where the chip fails to respond to one of the
>> requests, the start/stop sequence becomes something like this,
>> uart_open(1) called
>> uart_open: 1635
>> uart_open: 1651
>> uart_open: 1663
>> uart_open: 1705
>>
>> So, the problem seems to be that the port->count in the serial_core
>> isn't 1 & hence the call,
>>        if (port->count == 1)
>>                uart_change_pm(state, 0);
>
> Actually port count will be incremented based on number of times
> the port will be opened. (file open do on the the given ttyOx interface)
> for the first tty open the count gets incremented to one and sets state to
> active
> (state, 0)
> if you open multiple times then the serial_core knows port in active state
> so it is not necessary to call uart_change_pm(state, 0)

Assuming multiple opens isn't that big a deal...
But I get a tcgetattr() failure then, and thereby unable to set the
default baud-rate
and hence send data over UART.

>> doesn't seem to be happening, which is very critical. Also no calls
>> are made to uart_startup & hence omap-serial's startup.
>>
>> Where should I be looking as to why the port->count is messed up ?
>> What is the this count used for?
>> Also how is this related to chip not responding to certain commands?
>
> Is the uart_clks cut? Try keeping uart clocks active always.

Need to check this then....
How do I make sure they stay on ?

> Govindraj.R
>
>>
>> --
>> To unsubscribe from this list: send the line "unsubscribe linux-serial" in
>> the body of a message to majordomo@vger.kernel.org
>> More majordomo info at  http://vger.kernel.org/majordomo-info.html
>
>
--
To unsubscribe from this list: send the line "unsubscribe linux-serial" 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] 4+ messages in thread

* Re: serial_core's port->count mess
       [not found]     ` <BANLkTik6f4rFcr+X=ov4y=48QCxF1=zvkg@mail.gmail.com>
@ 2011-05-19 13:17       ` Pavan Savoy
  0 siblings, 0 replies; 4+ messages in thread
From: Pavan Savoy @ 2011-05-19 13:17 UTC (permalink / raw)
  To: Govindraj; +Cc: linux-serial

On Thu, May 19, 2011 at 6:42 PM, Govindraj <govindraj.ti@gmail.com> wrote:
>
> On Thu, May 19, 2011 at 6:21 PM, Pavan Savoy <pavan_savoy@sify.com> wrote:
>>
>> On Thu, May 19, 2011 at 3:58 PM, Govindraj <govindraj.ti@gmail.com> wrote:
>> >
>> > On Thu, May 19, 2011 at 3:08 PM, Pavan Savoy <pavan_savoy@sify.com>
>> > wrote:
>> >>
>> >> Hi,
>> >>
>> >> I have a device connected to my apps processor over UART, the serial
>> >> core's hooked up with omap-serial UART driver.
>> >> There is a scenario, where the device just fails to respond, and I
>> >> should be closing the UART & opening it again to re-try the request.
>> >> This is also coupled with power-cycling the chip.
>> >>
>> >> However a normal start/stop sequence where chip responds to every
>> >> request & I close UART when I'm done - is something like this,
>> >> [function name & line number in logs)
>> >> uart_open(1) called
>> >> uart_open: 1635
>> >> uart_open: 1651
>> >> uart_open: 1663
>> >> uart_open: 1674
>> >> omap-hsuart omap-hsuart.1: serial_omap_pm+1
>> >> omap-hsuart omap-hsuart.1: Enable CTS wakeup for UART 1
>> >> omap-hsuart omap-hsuart.1: serial_omap_startup+1
>> >> omap-hsuart omap-hsuart.1: serial_omap_set_mctrl+1
>> >> omap-hsuart omap-hsuart.1: serial_omap_get_mctrl+1
>> >> uart_open: 1686
>> >> uart_open: 1694
>> >> omap-hsuart omap-hsuart.1: serial_omap_set_mctrl+1
>> >> omap-hsuart omap-hsuart.1: serial_omap_set_termios+1
>> >> omap-hsuart omap-hsuart.1: serial_omap_set_mctrl+1
>> >> uart_open: 1705
>> >> uart_flush_buffer(1) called
>> >> omap-hsuart omap-hsuart.1: serial_omap_set_mctrl+1
>> >> omap-hsuart omap-hsuart.1: serial_omap_set_termios+1
>> >> omap-hsuart omap-hsuart.1: serial_omap_set_mctrl+1
>> >> omap-hsuart omap-hsuart.1: serial_omap_set_termios+1
>> >> uart_flush_buffer(1) called
>> >> uart_flush_buffer(1) called
>> >> uart_flush_buffer(1) called
>> >> omap-hsuart omap-hsuart.1: serial_omap_set_mctrl+1
>> >> omap-hsuart omap-hsuart.1: serial_omap_set_termios+1
>> >> uart_wait_until_sent(1), jiffies=4294954470, expire=4294954474...
>> >> omap-hsuart omap-hsuart.1: serial_omap_tx_empty+1
>> >> uart_wait_until_sent(1), jiffies=4294954471, expire=4294954475...
>> >> omap-hsuart omap-hsuart.1: serial_omap_tx_empty+1
>> >> (stc): st_tty_open
>> >>
>> >> uart_flush_buffer(1) called
>> >> uart_flush_buffer(1) called
>> >> uart_flush_buffer(1) called
>> >> (stk) :ldisc_install = 0
>> >> uart_close(1) called
>> >> uart_close: 1295
>> >> uart_close: 1316
>> >> uart_wait_until_sent(1), jiffies=4294951992, expire=4294951996...
>> >> omap-hsuart omap-hsuart.1: serial_omap_tx_empty+1
>> >> uart_close: 1327
>> >> omap-hsuart omap-hsuart.1: Disable CTS wakeup for UART1
>> >> uart_wait_until_sent(1), jiffies=4294951994, expire=4294951996...
>> >> omap-hsuart omap-hsuart.1: serial_omap_tx_empty+1
>> >> uart_close: 1345
>> >> omap-hsuart omap-hsuart.1: serial_omap_set_mctrl+1
>> >> omap-hsuart omap-hsuart.1: serial_omap_shutdown+1
>> >> omap-hsuart omap-hsuart.1: serial_omap_set_mctrl+1
>> >> uart_flush_buffer(1) called
>> >> uart_flush_buffer(1) called
>> >> omap-hsuart omap-hsuart.1: serial_omap_pm+1
>> >> uart_close: 1368
>> >> (stc): st_tty_close
>> >>
>> >> However, in a scenario where the chip fails to respond to one of the
>> >> requests, the start/stop sequence becomes something like this,
>> >> uart_open(1) called
>> >> uart_open: 1635
>> >> uart_open: 1651
>> >> uart_open: 1663
>> >> uart_open: 1705
>> >>
>> >> So, the problem seems to be that the port->count in the serial_core
>> >> isn't 1 & hence the call,
>> >>        if (port->count == 1)
>> >>                uart_change_pm(state, 0);
>> >
>> > Actually port count will be incremented based on number of times
>> > the port will be opened. (file open do on the the given ttyOx interface)
>> > for the first tty open the count gets incremented to one and sets state
>> > to
>> > active
>> > (state, 0)
>> > if you open multiple times then the serial_core knows port in active
>> > state
>> > so it is not necessary to call uart_change_pm(state, 0)
>>
>> Assuming multiple opens isn't that big a deal...
>> But I get a tcgetattr() failure then, and thereby unable to set the
>> default baud-rate
>> and hence send data over UART.
>
> Whats the error number?

strerror throws me Invalid arguments when the tcgetattr() fails.

>> >> doesn't seem to be happening, which is very critical. Also no calls
>> >> are made to uart_startup & hence omap-serial's startup.
>> >>
>> >> Where should I be looking as to why the port->count is messed up ?
>> >> What is the this count used for?
>> >> Also how is this related to chip not responding to certain commands?
>> >
>> > Is the uart_clks cut? Try keeping uart clocks active always.
>>
>> Need to check this then....
>> How do I make sure they stay on ?
>
> you an avoid setting uart timeouts from sysfs entry or
> comment out omap_device_idle from */mach-omap2/serial.c file.

Yes, kind of familiar with 2nd approach - but need help on the sysfs entry ...
which one should I be looking for ? (hopefully available on all omap kernels..)

>>
>> > Govindraj.R
>> >
>> >>
>> >> --
>> >> To unsubscribe from this list: send the line "unsubscribe linux-serial"
>> >> in
>> >> the body of a message to majordomo@vger.kernel.org
>> >> More majordomo info at  http://vger.kernel.org/majordomo-info.html
>> >
>> >
>
>
--
To unsubscribe from this list: send the line "unsubscribe linux-serial" 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] 4+ messages in thread

end of thread, other threads:[~2011-05-19 13:17 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-05-19  9:38 serial_core's port->count mess Pavan Savoy
2011-05-19 10:25 ` Alan Cox
     [not found] ` <BANLkTim7OmA1y+Z_4CHZBCKu-uG_=9jJ=A@mail.gmail.com>
2011-05-19 12:51   ` Pavan Savoy
     [not found]     ` <BANLkTik6f4rFcr+X=ov4y=48QCxF1=zvkg@mail.gmail.com>
2011-05-19 13:17       ` Pavan Savoy

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).