All of lore.kernel.org
 help / color / mirror / Atom feed
* serial driver question
@ 2001-03-22 23:07 John Covici
  2001-03-23  0:02 ` Thorsten Kranzkowski
  0 siblings, 1 reply; 5+ messages in thread
From: John Covici @ 2001-03-22 23:07 UTC (permalink / raw)
  To: linux-kernel

I have been wondering about the serial drivers shared irq
configuration parameter.  Will it allow two dumb serial ports which
know nothing about sharing irq's to actually share the same irq, or
does the actual hardware have to support some kind of irq sharing for
this to work?

I did try two ports on the same irq, but one of them isn't seem at all
by Linux, so I am quite curious whether I am barking up the wrong
line?

Thanks.


-- 
         John Covici
         covici@ccs.covici.com

^ permalink raw reply	[flat|nested] 5+ messages in thread
* serial driver question
@ 2002-04-12 15:35 Guennadi Liakhovetski
  0 siblings, 0 replies; 5+ messages in thread
From: Guennadi Liakhovetski @ 2002-04-12 15:35 UTC (permalink / raw)
  To: linux-kernel

(asking on kernelnewbies didn't produceany results, so, I'm protected:-))

Hello all

The function
static int size_fifo(struct async_struct *info)
{
...
ends as follows:
	serial_outp(info, UART_LCR, UART_LCR_DLAB);
	serial_outp(info, UART_DLL, old_dll);
	serial_outp(info, UART_DLM, old_dlm);

	return count;
}

Which means, that DLAB is not re-set, and, in particular, all subsequent
read/write operations on offsets 0 and 1 will not affect the data and
interrupt enable registers, but the divisor latch register... Or is this
register somehow magically restored elsewhere or by the hardware (say, on
an interrupt)? This function seems to be only called for startech UARTs.

Thanks
Guennadi
---------------------------------
Guennadi Liakhovetski, Ph.D.
DSA Daten- und Systemtechnik GmbH
Pascalstr. 28
D-52076 Aachen
Germany



^ permalink raw reply	[flat|nested] 5+ messages in thread
* RE: serial driver question
@ 2002-04-12 15:54 Ed Vance
  0 siblings, 0 replies; 5+ messages in thread
From: Ed Vance @ 2002-04-12 15:54 UTC (permalink / raw)
  To: 'Guennadi Liakhovetski'; +Cc: 'linux-kernel'

Guennadi Liakhovetski wrote:
> Hello all
> 
> The function
> static int size_fifo(struct async_struct *info)
> {
> ...
> ends as follows:
> 	serial_outp(info, UART_LCR, UART_LCR_DLAB);
> 	serial_outp(info, UART_DLL, old_dll);
> 	serial_outp(info, UART_DLM, old_dlm);
> 
> 	return count;
> }
> 
> Which means, that DLAB is not re-set, and, in particular, all 
> subsequent read/write operations on offsets 0 and 1 will not 
> affect the data and interrupt enable registers, but the divisor 
> latch register... Or is this register somehow magically restored 
> elsewhere or by the hardware (say, on an interrupt)? This 
> function seems to be only called for startech UARTs.

Hi Guennadi,

I'll look at it as soon as my system is up. It's morning boot-up time here.
Have a good evening.

Ed Vance

---------------------------------------------------------------- 
Ed Vance              edv@macrolink.com
Macrolink, Inc.       1500 N. Kellogg Dr  Anaheim, CA  92807
----------------------------------------------------------------


^ permalink raw reply	[flat|nested] 5+ messages in thread
* RE: serial driver question
@ 2002-04-12 21:54 Ed Vance
  0 siblings, 0 replies; 5+ messages in thread
From: Ed Vance @ 2002-04-12 21:54 UTC (permalink / raw)
  To: 'Guennadi Liakhovetski'; +Cc: linux-kernel, 'linux-serial'

Guennadi Liakhovetski wrote:
> Hello all
> 
> The function
> static int size_fifo(struct async_struct *info)
> {
> ...
> ends as follows:
> 	serial_outp(info, UART_LCR, UART_LCR_DLAB);
> 	serial_outp(info, UART_DLL, old_dll);
> 	serial_outp(info, UART_DLM, old_dlm);
> 
> 	return count;
> }
> 
> Which means, that DLAB is not re-set, and, in particular, all 
> subsequent read/write operations on offsets 0 and 1 will not 
> affect the data and interrupt enable registers, but the divisor 
> latch register... Or is this register somehow magically restored 
> elsewhere or by the hardware (say, on an interrupt)? This 
> function seems to be only called for startech UARTs.

Hi Guennadi,

It is somehow magically restored elsewhere. The divisor latch bit (DLAB)
does remain set when size_fifo() returns, but the state does not persist.
Here is why the code works anyway, albeit with a trap or two for the
insufficiently paranoid ... and it can be explained without magic. :)

Notice that function size_fifo() does not save the LCR value before changing
it. Static function size_fifo() is called only from the very end of static
function autoconfig_startech_uarts(). Notice that function
autoconfig_startech_uarts() never returns with state->type set to
PORT_16550A. All code paths change state->type to something else. Static
function autoconfig_startech_uarts() is only called from the middle of
static function autoconfig(). Function autoconfig() saves the LCR value
before the testing of the alleged UART, which may include calling
autoconfig_startech_uarts(). When autoconfig_startech_uarts() returns to
autoconfig(), state->type cannot be PORT_16550A so the bodies of the next
two "if" statements that check state->type are skipped. The next line of
UART touching code that runs after size_fifo() and
autoconfig_startech_uarts() return to autoconfig(), is at about 50 lines
after the call to autoconfig_startech_uarts(), just before the check for
state->type == PORT_16450:

	serial_outp(info, UART_LCR, save_lcr);

which restores autoconfig()'s saved LCR value, including the DLAB bit. 

Yeah, I agree that size_fifo() should clean up after itself, but it doesn't
break anything as the code currently sits. Care to submit a one-line patch
for size_fifo() to clean up the UART state? 

Best regards,
Ed Vance

---------------------------------------------------------------- 
Ed Vance              edv@macrolink.com
Macrolink, Inc.       1500 N. Kellogg Dr  Anaheim, CA  92807
----------------------------------------------------------------

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

end of thread, other threads:[~2002-04-12 21:54 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2001-03-22 23:07 serial driver question John Covici
2001-03-23  0:02 ` Thorsten Kranzkowski
  -- strict thread matches above, loose matches on Subject: below --
2002-04-12 15:35 Guennadi Liakhovetski
2002-04-12 15:54 Ed Vance
2002-04-12 21:54 Ed Vance

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.