All of lore.kernel.org
 help / color / mirror / Atom feed
* serial tty name
@ 2011-12-14 14:43 Richard Zhao
  2011-12-14 15:10 ` Igor Grinberg
                   ` (2 more replies)
  0 siblings, 3 replies; 12+ messages in thread
From: Richard Zhao @ 2011-12-14 14:43 UTC (permalink / raw)
  To: linux-arm-kernel

How to map different uart port to ttymxc0 (take imx for example)?

In rootfs, it usually "getty ttymxc0"  to get
serial console. And the rootfs may be shared by different boards.
Traditionaly way is to set right platform device ID.

But with DT, UART2 always generate ttymxc1, UART3 for ttymxc2. You
always needs to modify the getty command when your change another board.

Is there a way to fix it?


Thanks
Richard

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

* serial tty name
  2011-12-14 14:43 serial tty name Richard Zhao
@ 2011-12-14 15:10 ` Igor Grinberg
  2011-12-14 18:33   ` Uwe Kleine-König
  2011-12-14 15:31 ` Rob Herring
  2011-12-19  3:56 ` Shawn Guo
  2 siblings, 1 reply; 12+ messages in thread
From: Igor Grinberg @ 2011-12-14 15:10 UTC (permalink / raw)
  To: linux-arm-kernel

Hi Richard,

On 12/14/11 16:43, Richard Zhao wrote:
> How to map different uart port to ttymxc0 (take imx for example)?
> 
> In rootfs, it usually "getty ttymxc0"  to get
> serial console. And the rootfs may be shared by different boards.
> Traditionaly way is to set right platform device ID.
> 
> But with DT, UART2 always generate ttymxc1, UART3 for ttymxc2. You
> always needs to modify the getty command when your change another board.
> 
> Is there a way to fix it?

As for fix in userspace, you can spawn getty on every ttymxc*,
so you will get it always.

Another (userspace) fix would be:
Instead of getty, add a script (say getty.sh) which will do something like:
-----------
CONSOLE=`cat /proc/cmdline | tr " " "\n" | grep console= | tr "=" " " | tr "," " "`
TTY=`echo $CONSOLE | cut -d' ' -f 2`
SPEED=`echo $CONSOLE | cut -d' ' -f 3`

/sbin/getty -L $TTY $SPEED vt100
--------------

I use the above, because I have not just multiple boards,
but multiple platforms each with its own tty name...

-- 
Regards,
Igor.

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

* serial tty name
  2011-12-14 14:43 serial tty name Richard Zhao
  2011-12-14 15:10 ` Igor Grinberg
@ 2011-12-14 15:31 ` Rob Herring
  2011-12-15  0:31   ` Richard Zhao
  2011-12-19  4:08   ` Shawn Guo
  2011-12-19  3:56 ` Shawn Guo
  2 siblings, 2 replies; 12+ messages in thread
From: Rob Herring @ 2011-12-14 15:31 UTC (permalink / raw)
  To: linux-arm-kernel

Richard,

On 12/14/2011 08:43 AM, Richard Zhao wrote:
> How to map different uart port to ttymxc0 (take imx for example)?
> 
> In rootfs, it usually "getty ttymxc0"  to get
> serial console. And the rootfs may be shared by different boards.
> Traditionaly way is to set right platform device ID.
> 
> But with DT, UART2 always generate ttymxc1, UART3 for ttymxc2. You
> always needs to modify the getty command when your change another board.
> 
> Is there a way to fix it?

That's what the aliases are for.

Rob

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

* serial tty name
  2011-12-14 15:10 ` Igor Grinberg
@ 2011-12-14 18:33   ` Uwe Kleine-König
  2011-12-15  0:44     ` Richard Zhao
  0 siblings, 1 reply; 12+ messages in thread
From: Uwe Kleine-König @ 2011-12-14 18:33 UTC (permalink / raw)
  To: linux-arm-kernel

On Wed, Dec 14, 2011 at 05:10:10PM +0200, Igor Grinberg wrote:
> Hi Richard,
> 
> On 12/14/11 16:43, Richard Zhao wrote:
> > How to map different uart port to ttymxc0 (take imx for example)?
> > 
> > In rootfs, it usually "getty ttymxc0"  to get
> > serial console. And the rootfs may be shared by different boards.
> > Traditionaly way is to set right platform device ID.
> > 
> > But with DT, UART2 always generate ttymxc1, UART3 for ttymxc2. You
> > always needs to modify the getty command when your change another board.
> > 
> > Is there a way to fix it?
> 
> As for fix in userspace, you can spawn getty on every ttymxc*,
> so you will get it always.
> 
> Another (userspace) fix would be:
> Instead of getty, add a script (say getty.sh) which will do something like:
> -----------
> CONSOLE=`cat /proc/cmdline | tr " " "\n" | grep console= | tr "=" " " | tr "," " "`
> TTY=`echo $CONSOLE | cut -d' ' -f 2`
> SPEED=`echo $CONSOLE | cut -d' ' -f 3`
> 
> /sbin/getty -L $TTY $SPEED vt100
> --------------

what about:

	eval "$(sed 's/.*console=\([^,]*\),\([0-9]*\).*/tty=\1; speed=\2/'" /proc/cmdline)"

this should prevent getting a "useless use of cat award".

Best regards
Uwe

-- 
Pengutronix e.K.                           | Uwe Kleine-K?nig            |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |

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

* serial tty name
  2011-12-14 15:31 ` Rob Herring
@ 2011-12-15  0:31   ` Richard Zhao
  2011-12-19  4:08   ` Shawn Guo
  1 sibling, 0 replies; 12+ messages in thread
From: Richard Zhao @ 2011-12-15  0:31 UTC (permalink / raw)
  To: linux-arm-kernel

On Wed, Dec 14, 2011 at 09:31:59AM -0600, Rob Herring wrote:
> Richard,
> 
> On 12/14/2011 08:43 AM, Richard Zhao wrote:
> > How to map different uart port to ttymxc0 (take imx for example)?
> > 
> > In rootfs, it usually "getty ttymxc0"  to get
> > serial console. And the rootfs may be shared by different boards.
> > Traditionaly way is to set right platform device ID.
> > 
> > But with DT, UART2 always generate ttymxc1, UART3 for ttymxc2. You
> > always needs to modify the getty command when your change another board.
> > 
> > Is there a way to fix it?
> 
> That's what the aliases are for.
so, why do I see people define uart aliases in $SOC.dtsi, rather not in $BOARD.dts?

Thanks
Richard
> 
> Rob
> 
> _______________________________________________
> linux-arm-kernel mailing list
> linux-arm-kernel at lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
> 

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

* serial tty name
  2011-12-14 18:33   ` Uwe Kleine-König
@ 2011-12-15  0:44     ` Richard Zhao
  0 siblings, 0 replies; 12+ messages in thread
From: Richard Zhao @ 2011-12-15  0:44 UTC (permalink / raw)
  To: linux-arm-kernel

On Wed, Dec 14, 2011 at 07:33:41PM +0100, Uwe Kleine-K?nig wrote:
> On Wed, Dec 14, 2011 at 05:10:10PM +0200, Igor Grinberg wrote:
> > Hi Richard,
> > 
> > On 12/14/11 16:43, Richard Zhao wrote:
> > > How to map different uart port to ttymxc0 (take imx for example)?
> > > 
> > > In rootfs, it usually "getty ttymxc0"  to get
> > > serial console. And the rootfs may be shared by different boards.
> > > Traditionaly way is to set right platform device ID.
> > > 
> > > But with DT, UART2 always generate ttymxc1, UART3 for ttymxc2. You
> > > always needs to modify the getty command when your change another board.
> > > 
> > > Is there a way to fix it?
> > 
> > As for fix in userspace, you can spawn getty on every ttymxc*,
> > so you will get it always.
> > 
> > Another (userspace) fix would be:
> > Instead of getty, add a script (say getty.sh) which will do something like:
> > -----------
> > CONSOLE=`cat /proc/cmdline | tr " " "\n" | grep console= | tr "=" " " | tr "," " "`
> > TTY=`echo $CONSOLE | cut -d' ' -f 2`
> > SPEED=`echo $CONSOLE | cut -d' ' -f 3`
> > 
> > /sbin/getty -L $TTY $SPEED vt100
> > --------------
> 
> what about:
> 
> 	eval "$(sed 's/.*console=\([^,]*\),\([0-9]*\).*/tty=\1; speed=\2/'" /proc/cmdline)"
> 
> this should prevent getting a "useless use of cat award".
Thanks.
Richard
> 
> Best regards
> Uwe
> 
> -- 
> Pengutronix e.K.                           | Uwe Kleine-K?nig            |
> Industrial Linux Solutions                 | http://www.pengutronix.de/  |
> 
> _______________________________________________
> linux-arm-kernel mailing list
> linux-arm-kernel at lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
> 

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

* serial tty name
  2011-12-14 14:43 serial tty name Richard Zhao
  2011-12-14 15:10 ` Igor Grinberg
  2011-12-14 15:31 ` Rob Herring
@ 2011-12-19  3:56 ` Shawn Guo
  2011-12-19  5:40   ` Richard Zhao
  2 siblings, 1 reply; 12+ messages in thread
From: Shawn Guo @ 2011-12-19  3:56 UTC (permalink / raw)
  To: linux-arm-kernel

On Wed, Dec 14, 2011 at 10:43:47PM +0800, Richard Zhao wrote:
> How to map different uart port to ttymxc0 (take imx for example)?
> 
> In rootfs, it usually "getty ttymxc0"  to get
> serial console. And the rootfs may be shared by different boards.
> Traditionaly way is to set right platform device ID.
> 
> But with DT, UART2 always generate ttymxc1, UART3 for ttymxc2. You
> always needs to modify the getty command when your change another board.
> 
> Is there a way to fix it?
> 
I'm using Linaro rootfs and do not see this problem at all.  So as
people have suggested, you need to fix it in your user space.

-- 
Regards,
Shawn

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

* serial tty name
  2011-12-14 15:31 ` Rob Herring
  2011-12-15  0:31   ` Richard Zhao
@ 2011-12-19  4:08   ` Shawn Guo
  2011-12-19  4:49     ` Jason Liu
  1 sibling, 1 reply; 12+ messages in thread
From: Shawn Guo @ 2011-12-19  4:08 UTC (permalink / raw)
  To: linux-arm-kernel

On Wed, Dec 14, 2011 at 09:31:59AM -0600, Rob Herring wrote:
> Richard,
> 
> On 12/14/2011 08:43 AM, Richard Zhao wrote:
> > How to map different uart port to ttymxc0 (take imx for example)?
> > 
> > In rootfs, it usually "getty ttymxc0"  to get
> > serial console. And the rootfs may be shared by different boards.
> > Traditionaly way is to set right platform device ID.
> > 
> > But with DT, UART2 always generate ttymxc1, UART3 for ttymxc2. You
> > always needs to modify the getty command when your change another board.
> > 
> > Is there a way to fix it?
> 
> That's what the aliases are for.
> 
I understand it differently.  The aliases was introduced to help
tty/serial driver identify the correct hardware port for given serial
node from device tree.  (Ab)using it to fool 'console' setting may
eventually confuse users, saying they will think the uart port on his
board is UART0.

-- 
Regards,
Shawn

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

* serial tty name
  2011-12-19  4:08   ` Shawn Guo
@ 2011-12-19  4:49     ` Jason Liu
  2011-12-19  5:41       ` Richard Zhao
  0 siblings, 1 reply; 12+ messages in thread
From: Jason Liu @ 2011-12-19  4:49 UTC (permalink / raw)
  To: linux-arm-kernel

2011/12/19 Shawn Guo <shawn.guo@freescale.com>:
> On Wed, Dec 14, 2011 at 09:31:59AM -0600, Rob Herring wrote:
>> Richard,
>>
>> On 12/14/2011 08:43 AM, Richard Zhao wrote:
>> > How to map different uart port to ttymxc0 (take imx for example)?
>> >
>> > In rootfs, it usually "getty ttymxc0" ?to get
>> > serial console. And the rootfs may be shared by different boards.
>> > Traditionaly way is to set right platform device ID.
>> >
>> > But with DT, UART2 always generate ttymxc1, UART3 for ttymxc2. You
>> > always needs to modify the getty command when your change another board.
>> >
>> > Is there a way to fix it?
>>
>> That's what the aliases are for.
>>
> I understand it differently. ?The aliases was introduced to help
> tty/serial driver identify the correct hardware port for given serial
> node from device tree. ?(Ab)using it to fool 'console' setting may
> eventually confuse users, saying they will think the uart port on his
> board is UART0.

We absolutely need document this in detail to avoid confusion. Otherwise,
the ARM DT support will also mess up in the end.

>
> --
> Regards,
> Shawn
>
>
> _______________________________________________
> linux-arm-kernel mailing list
> linux-arm-kernel at lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* serial tty name
  2011-12-19  3:56 ` Shawn Guo
@ 2011-12-19  5:40   ` Richard Zhao
  2011-12-19  6:05     ` Shawn Guo
  0 siblings, 1 reply; 12+ messages in thread
From: Richard Zhao @ 2011-12-19  5:40 UTC (permalink / raw)
  To: linux-arm-kernel

On Mon, Dec 19, 2011 at 11:56:37AM +0800, Shawn Guo wrote:
> On Wed, Dec 14, 2011 at 10:43:47PM +0800, Richard Zhao wrote:
> > How to map different uart port to ttymxc0 (take imx for example)?
> > 
> > In rootfs, it usually "getty ttymxc0"  to get
> > serial console. And the rootfs may be shared by different boards.
> > Traditionaly way is to set right platform device ID.
> > 
> > But with DT, UART2 always generate ttymxc1, UART3 for ttymxc2. You
> > always needs to modify the getty command when your change another board.
> > 
> > Is there a way to fix it?
> > 
> I'm using Linaro rootfs and do not see this problem at all.  So as
> people have suggested, you need to fix it in your user space.
Why not past your linaro rootfs solution?

Thanks
Richard
> 
> -- 
> Regards,
> Shawn
> 
> 
> _______________________________________________
> linux-arm-kernel mailing list
> linux-arm-kernel at lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
> 

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

* serial tty name
  2011-12-19  4:49     ` Jason Liu
@ 2011-12-19  5:41       ` Richard Zhao
  0 siblings, 0 replies; 12+ messages in thread
From: Richard Zhao @ 2011-12-19  5:41 UTC (permalink / raw)
  To: linux-arm-kernel

On Mon, Dec 19, 2011 at 12:49:11PM +0800, Jason Liu wrote:
> 2011/12/19 Shawn Guo <shawn.guo@freescale.com>:
> > On Wed, Dec 14, 2011 at 09:31:59AM -0600, Rob Herring wrote:
> >> Richard,
> >>
> >> On 12/14/2011 08:43 AM, Richard Zhao wrote:
> >> > How to map different uart port to ttymxc0 (take imx for example)?
> >> >
> >> > In rootfs, it usually "getty ttymxc0" ?to get
> >> > serial console. And the rootfs may be shared by different boards.
> >> > Traditionaly way is to set right platform device ID.
> >> >
> >> > But with DT, UART2 always generate ttymxc1, UART3 for ttymxc2. You
> >> > always needs to modify the getty command when your change another board.
> >> >
> >> > Is there a way to fix it?
> >>
> >> That's what the aliases are for.
> >>
> > I understand it differently. ?The aliases was introduced to help
> > tty/serial driver identify the correct hardware port for given serial
> > node from device tree. ?(Ab)using it to fool 'console' setting may
> > eventually confuse users, saying they will think the uart port on his
> > board is UART0.
> 
> We absolutely need document this in detail to avoid confusion. Otherwise,
> the ARM DT support will also mess up in the end.
Yes, why not come a patch to doc it?

THanks
Richard
> 
> >
> > --
> > Regards,
> > Shawn
> >
> >
> > _______________________________________________
> > linux-arm-kernel mailing list
> > linux-arm-kernel at lists.infradead.org
> > http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
> 
> _______________________________________________
> linux-arm-kernel mailing list
> linux-arm-kernel at lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
> 

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

* serial tty name
  2011-12-19  5:40   ` Richard Zhao
@ 2011-12-19  6:05     ` Shawn Guo
  0 siblings, 0 replies; 12+ messages in thread
From: Shawn Guo @ 2011-12-19  6:05 UTC (permalink / raw)
  To: linux-arm-kernel

On Mon, Dec 19, 2011 at 01:40:13PM +0800, Richard Zhao wrote:
> On Mon, Dec 19, 2011 at 11:56:37AM +0800, Shawn Guo wrote:
> > On Wed, Dec 14, 2011 at 10:43:47PM +0800, Richard Zhao wrote:
> > > How to map different uart port to ttymxc0 (take imx for example)?
> > > 
> > > In rootfs, it usually "getty ttymxc0"  to get
> > > serial console. And the rootfs may be shared by different boards.
> > > Traditionaly way is to set right platform device ID.
> > > 
> > > But with DT, UART2 always generate ttymxc1, UART3 for ttymxc2. You
> > > always needs to modify the getty command when your change another board.
> > > 
> > > Is there a way to fix it?
> > > 
> > I'm using Linaro rootfs and do not see this problem at all.  So as
> > people have suggested, you need to fix it in your user space.
> Why not past your linaro rootfs solution?
> 
You do have Linaro rootfs, don't you?

-- 
Regards,
Shawn

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

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

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-12-14 14:43 serial tty name Richard Zhao
2011-12-14 15:10 ` Igor Grinberg
2011-12-14 18:33   ` Uwe Kleine-König
2011-12-15  0:44     ` Richard Zhao
2011-12-14 15:31 ` Rob Herring
2011-12-15  0:31   ` Richard Zhao
2011-12-19  4:08   ` Shawn Guo
2011-12-19  4:49     ` Jason Liu
2011-12-19  5:41       ` Richard Zhao
2011-12-19  3:56 ` Shawn Guo
2011-12-19  5:40   ` Richard Zhao
2011-12-19  6:05     ` Shawn Guo

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.