linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
* MPC823 Serial ports
@ 1999-10-22 14:37 Grant Carter
  1999-10-22 18:13 ` Dan Malek
  0 siblings, 1 reply; 11+ messages in thread
From: Grant Carter @ 1999-10-22 14:37 UTC (permalink / raw)
  To: linuxppc-embedded


Hi all

I am trying to get the second serial port (SMC2) up and running. I have
found that it was removed from arch/ppc/8xx_io/uart.c in the rs_table
struct. I have added this again and now the kernel (2.2.5) seems to find
it on bootup.

CPM UART driver version 0.02
ttyS00 at 0x0280 is a SMC
ttyS01 at 0x0380 is a SMC

What else do I need to do to get it working as when I echo something to
it, I get nothing out of the port.

Thanks in advance
Grant
-- 
Grant Carter                              gcarter@eng.uct.ac.za
Department of Electrical Engineering      University of Cape Town
Tel: +27 (0)21 650-3467                   Fax: +27 (0)21 650-3465
                     "Coffee not found - operator halted!"

** Sent via the linuxppc-embedded mail list. See http://lists.linuxppc.org/

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

* Re: MPC823 Serial ports
  1999-10-22 14:37 MPC823 Serial ports Grant Carter
@ 1999-10-22 18:13 ` Dan Malek
  1999-10-24 12:50   ` Console on SMC2 (was: Re: MPC823 Serial ports) Marcus Sundberg
  0 siblings, 1 reply; 11+ messages in thread
From: Dan Malek @ 1999-10-22 18:13 UTC (permalink / raw)
  To: Grant Carter; +Cc: linuxppc-embedded


Grant Carter wrote:
> 
> Hi all
> 
> I am trying to get the second serial port (SMC2) up and running. I have
> found that it was removed from arch/ppc/8xx_io/uart.c in the rs_table
> struct. I have added this again and now the kernel (2.2.5) seems to find
> it on bootup.

Yes.  I was using SMC2 on the TDM when I made the update.  You
can enable up to four (because of baud rate generators) serial
ports for uarts.  Pick any that you want.  This will be more
configurable in newer versions of the config scripts I am going
to check into CVS one of these days.

> What else do I need to do to get it working as when I echo something to
> it, I get nothing out of the port.

Make sure you have the device nodes in /dev properly defined.
They should be:
	ttyS0 4,64
	ttyS1 4,65
	ttyS2 4,66
	ttyS3 4,67



	-- Dan

** Sent via the linuxppc-embedded mail list. See http://lists.linuxppc.org/

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

* Console on SMC2 (was: Re: MPC823 Serial ports)
  1999-10-22 18:13 ` Dan Malek
@ 1999-10-24 12:50   ` Marcus Sundberg
  1999-10-24 17:07     ` Dan Malek
  1999-10-25  1:35     ` Graham Stoney
  0 siblings, 2 replies; 11+ messages in thread
From: Marcus Sundberg @ 1999-10-24 12:50 UTC (permalink / raw)
  To: Dan Malek; +Cc: linuxppc-embedded


Dan Malek <dan@netx4.com> writes:
>
> Yes.  I was using SMC2 on the TDM when I made the update.  You
> can enable up to four (because of baud rate generators) serial
> ports for uarts.  Pick any that you want.  This will be more
> configurable in newer versions of the config scripts I am going
> to check into CVS one of these days.

Speaking of SMCs and CVS, attached is a diff adding support for
having the boot console on SMC2. Currently I just set
CONFIG_SERIAL_CONSOLE_PORT in asm/board.h, but maybe it should be
a configuration option?

In uart.c I also fixed the major device of the console.
TTYAUX_MAJOR corresponds to the /dev/cua* devices, which are obsolete.

//Marcus
-- 
-------------------------------+------------------------------------
        Marcus Sundberg        | http://www.stacken.kth.se/~mackan/
 Royal Institute of Technology |       Phone: +46 707 295404
       Stockholm, Sweden       |   E-Mail: mackan@stacken.kth.se

===File ~/smc2-console.diff=================================
Index: uart.c
===================================================================
RCS file: /swb/cvs_repository/linux23/arch/ppc/8xx_io/uart.c,v
retrieving revision 1.1.1.4
retrieving revision 1.3
diff -u -r1.1.1.4 -r1.3
--- uart.c	1999/10/13 10:18:29	1.1.1.4
+++ uart.c	1999/10/21 12:44:44	1.3
@@ -2233,7 +2234,7 @@
 
 static kdev_t serial_console_device(struct console *c)
 {
-	return MKDEV(TTYAUX_MAJOR, 64 + c->index);
+	return MKDEV(TTY_MAJOR, 64 + c->index);
 }
 
 
@@ -2670,7 +2671,11 @@
 	 * from dual port ram, and a character buffer area from host mem.
 	 */
 	up = (smc_uart_t *)&cp->cp_dparam[ser->port];
+#if CONFIG_SERIAL_CONSOLE_PORT == 1
+	cp->cp_pbpar = 0x0c00;	/* Enable SMC2 instead of Port B I/O */
+#else
 	cp->cp_pbpar = 0x00c0;	/* Enable SMC1 instead of Port B I/O */
+#endif
 
 	/* Allocate space for two buffer descriptors in the DP ram.
 	*/
@@ -2707,7 +2712,11 @@
 
 	/* Send the CPM an initialize command.
 	*/
+#if CONFIG_SERIAL_CONSOLE_PORT == 1
+	cp->cp_cpcr = mk_cr_cmd(CPM_CR_CH_SMC2, CPM_CR_INIT_TRX) | CPM_CR_FLG;
+#else
 	cp->cp_cpcr = mk_cr_cmd(CPM_CR_CH_SMC1, CPM_CR_INIT_TRX) | CPM_CR_FLG;
+#endif
 	/*
 	 * delay for a bit - this is necessary on my board!
 	 *  -- Cort
Index: m8xx_tty.c
===================================================================
RCS file: /swb/cvs_repository/linux23/arch/ppc/mbxboot/m8xx_tty.c,v
retrieving revision 1.1.1.1
retrieving revision 1.3
diff -u -r1.1.1.1 -r1.3
--- m8xx_tty.c	1999/10/01 16:11:54	1.1.1.1
+++ m8xx_tty.c	1999/10/24 12:34:32	1.3
@@ -16,6 +16,18 @@
 #include <asm/mpc8xx.h>
 #include "../8xx_io/commproc.h"
 
+#ifndef CONFIG_SERIAL_CONSOLE_PORT
+#define CONFIG_SERIAL_CONSOLE_PORT	0
+#endif
+
+#if CONFIG_SERIAL_CONSOLE_PORT == 1
+# define PROFF_CONSMC	PROFF_SMC2
+# define CPM_CR_CH_CON	CPM_CR_CH_SMC2
+#else
+# define PROFF_CONSMC	PROFF_SMC1
+# define CPM_CR_CH_CON	CPM_CR_CH_SMC1
+#endif
+
 #ifdef CONFIG_MBX
 #define MBX_CSR1	((volatile u_char *)0xfa100000)
 #define CSR1_COMEN	(u_char)0x02
@@ -33,8 +45,8 @@
 	uint	dpaddr, memaddr;
 
 	cp = cpmp;
-	sp = (smc_t*)&(cp->cp_smc[0]);
-	up = (smc_uart_t *)&cp->cp_dparam[PROFF_SMC1];
+	sp = (smc_t*)&(cp->cp_smc[CONFIG_SERIAL_CONSOLE_PORT]);
+	up = (smc_uart_t *)&cp->cp_dparam[PROFF_CONSMC];
 
 	/* Disable transmitter/receiver.
 	*/
@@ -96,7 +108,11 @@
 	/* Set up the baud rate generator.
 	 * See 8xx_io/commproc.c for details.
 	 */
+#if CONFIG_SERIAL_CONSOLE_PORT == 1
+	cp->cp_simode = 0x00001000;
+#else
 	cp->cp_simode = 0x10000000;
+#endif
 	cp->cp_brgc1 =
 		((((bd->bi_intfreq * 1000000)/16) / bd->bi_baudrate) << 1) | CPM_BRG_EN;
 
@@ -174,7 +190,7 @@
 
 		/* Issue a stop transmit, and wait for it.
 		*/
-		cp->cp_cpcr = mk_cr_cmd(CPM_CR_CH_SMC1,
+		cp->cp_cpcr = mk_cr_cmd(CPM_CR_CH_CON,
 					CPM_CR_STOP_TX) | CPM_CR_FLG;
 		while (cp->cp_cpcr & CPM_CR_FLG);
 	}
@@ -191,7 +207,7 @@
 
 	/* Initialize Tx/Rx parameters.
 	*/
-	cp->cp_cpcr = mk_cr_cmd(CPM_CR_CH_SMC1, CPM_CR_INIT_TRX) | CPM_CR_FLG;
+	cp->cp_cpcr = mk_cr_cmd(CPM_CR_CH_CON, CPM_CR_INIT_TRX) | CPM_CR_FLG;
 	while (cp->cp_cpcr & CPM_CR_FLG);
 
 	/* Enable transmitter/receiver.
@@ -206,7 +222,7 @@
 	volatile char		*buf;
 	volatile smc_uart_t	*up;
 
-	up = (smc_uart_t *)&cpmp->cp_dparam[PROFF_SMC1];
+	up = (smc_uart_t *)&cpmp->cp_dparam[PROFF_CONSMC];
 	tbdf = (cbd_t *)&cpmp->cp_dpmem[up->smc_tbase];
 
 	/* Wait for last character to go.
@@ -227,7 +243,7 @@
 	volatile smc_uart_t	*up;
 	char			c;
 
-	up = (smc_uart_t *)&cpmp->cp_dparam[PROFF_SMC1];
+	up = (smc_uart_t *)&cpmp->cp_dparam[PROFF_CONSMC];
 	rbdf = (cbd_t *)&cpmp->cp_dpmem[up->smc_rbase];
 
 	/* Wait for character to show up.
@@ -246,7 +262,7 @@
 	volatile cbd_t		*rbdf;
 	volatile smc_uart_t	*up;
 
-	up = (smc_uart_t *)&cpmp->cp_dparam[PROFF_SMC1];
+	up = (smc_uart_t *)&cpmp->cp_dparam[PROFF_CONSMC];
 	rbdf = (cbd_t *)&cpmp->cp_dpmem[up->smc_rbase];
 
 	return(!(rbdf->cbd_sc & BD_SC_EMPTY));
============================================================

** Sent via the linuxppc-embedded mail list. See http://lists.linuxppc.org/

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

* Re: Console on SMC2 (was: Re: MPC823 Serial ports)
  1999-10-24 12:50   ` Console on SMC2 (was: Re: MPC823 Serial ports) Marcus Sundberg
@ 1999-10-24 17:07     ` Dan Malek
  1999-10-25 13:57       ` Marcus Sundberg
  1999-10-25  1:35     ` Graham Stoney
  1 sibling, 1 reply; 11+ messages in thread
From: Dan Malek @ 1999-10-24 17:07 UTC (permalink / raw)
  To: Marcus Sundberg; +Cc: Dan Malek, linuxppc-embedded


Marcus Sundberg wrote:


> Speaking of SMCs and CVS, attached is a diff adding support for
> having the boot console on SMC2. Currently I just set
> CONFIG_SERIAL_CONSOLE_PORT in asm/board.h, but maybe it should be
> a configuration option?

Yes, I am working on that.  It will appear in my next CVS update.
I have tried many different versions, and it appears the one
that works the best is just a simple ask the questions version.
I tried to make it smart about processor versions, what you
are using for Ethernet, etc., and in the end the only one that
seems to work is asking the individual questions about how you
want ports configured.

I also have code for consoles on the SCC ports, and it needs a
little more testing.  I have a board showing up this week that
should allow me to test that properly.


> In uart.c I also fixed the major device of the console.

The console (as in /dev/console) is currently a symbolic
link to the appropriate /dev/ttySx.  Should we change that to
be dynamically allocated?

> TTYAUX_MAJOR corresponds to the /dev/cua* devices, which are obsolete.

Yes, but be careful we need to change the device nodes in the
file systems......



	-- Dan

** Sent via the linuxppc-embedded mail list. See http://lists.linuxppc.org/

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

* Re: Console on SMC2 (was: Re: MPC823 Serial ports)
  1999-10-24 12:50   ` Console on SMC2 (was: Re: MPC823 Serial ports) Marcus Sundberg
  1999-10-24 17:07     ` Dan Malek
@ 1999-10-25  1:35     ` Graham Stoney
  1999-10-25  3:08       ` Noah Misch
  1999-10-25 12:47       ` Marcus Sundberg
  1 sibling, 2 replies; 11+ messages in thread
From: Graham Stoney @ 1999-10-25  1:35 UTC (permalink / raw)
  To: Marcus Sundberg; +Cc: linuxppc-embedded


Hi Marcus,

Marcus Sundberg writes:
> TTYAUX_MAJOR corresponds to the /dev/cua* devices, which are obsolete.

Could you please clarify what you mean here? Are you saying that the /dev/cua*
devices are obsolete? If so, what's the replacement?

Thanks,
Graham

** Sent via the linuxppc-embedded mail list. See http://lists.linuxppc.org/

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

* Re: Console on SMC2 (was: Re: MPC823 Serial ports)
  1999-10-25  1:35     ` Graham Stoney
@ 1999-10-25  3:08       ` Noah Misch
  1999-10-25  3:20         ` Graham Stoney
  1999-10-25 12:47       ` Marcus Sundberg
  1 sibling, 1 reply; 11+ messages in thread
From: Noah Misch @ 1999-10-25  3:08 UTC (permalink / raw)
  To: Graham Stoney; +Cc: linuxppc-embedded


They were replaced by /dev/ttyS*.

>Hi Marcus,
>
>Marcus Sundberg writes:
>> TTYAUX_MAJOR corresponds to the /dev/cua* devices, which are obsolete.
>
>Could you please clarify what you mean here? Are you saying that the /dev/cua*
>devices are obsolete? If so, what's the replacement?
>
>Thanks,
>Graham

Noah Misch
nmisch@erols.com

** Sent via the linuxppc-embedded mail list. See http://lists.linuxppc.org/

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

* Re: Console on SMC2 (was: Re: MPC823 Serial ports)
  1999-10-25  3:08       ` Noah Misch
@ 1999-10-25  3:20         ` Graham Stoney
  0 siblings, 0 replies; 11+ messages in thread
From: Graham Stoney @ 1999-10-25  3:20 UTC (permalink / raw)
  To: Noah Misch; +Cc: greyham, linuxppc-embedded


Noah Misch writes:
> They were replaced by /dev/ttyS*.

On our Linux 2.2 Intel boxes, opening /dev/ttyS* blocks until the modem
control lines become active if the port is in non-CLOCAL mode, whereas
/dev/cua* doesn't. Since you can't change mode without opening the device,
/dev/cua* is required to avoid the chicken-and-egg problem. Have the semantics
of /dev/ttyS* changed to remove the need for /dev/cua*?

Thanks,
Graham

** Sent via the linuxppc-embedded mail list. See http://lists.linuxppc.org/

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

* Re: Console on SMC2 (was: Re: MPC823 Serial ports)
  1999-10-25  1:35     ` Graham Stoney
  1999-10-25  3:08       ` Noah Misch
@ 1999-10-25 12:47       ` Marcus Sundberg
  1 sibling, 0 replies; 11+ messages in thread
From: Marcus Sundberg @ 1999-10-25 12:47 UTC (permalink / raw)
  To: Graham Stoney; +Cc: linuxppc-embedded


greyham@research.canon.com.au (Graham Stoney) writes:

> Hi Marcus,
> 
> Marcus Sundberg writes:
> > TTYAUX_MAJOR corresponds to the /dev/cua* devices, which are obsolete.
> 
> Could you please clarify what you mean here? Are you saying that the /dev/cua*
> devices are obsolete?

Yes, has been so since before 2.2.0 IIRC.

> If so, what's the replacement?

>From linux/Documentation/Changes:
     Also, please remember that cua* devices are now obsolete.  Switch to
  the corresponding ttyS* device instead (e.g., cua0 -> ttyS0, cua1 ->
  ttyS1, etc.).

//Marcus
-- 
-------------------------------+------------------------------------
        Marcus Sundberg        | http://www.stacken.kth.se/~mackan/
 Royal Institute of Technology |       Phone: +46 707 295404
       Stockholm, Sweden       |   E-Mail: mackan@stacken.kth.se

** Sent via the linuxppc-embedded mail list. See http://lists.linuxppc.org/

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

* Re: Console on SMC2 (was: Re: MPC823 Serial ports)
  1999-10-24 17:07     ` Dan Malek
@ 1999-10-25 13:57       ` Marcus Sundberg
  1999-10-25 14:20         ` Dan Malek
  0 siblings, 1 reply; 11+ messages in thread
From: Marcus Sundberg @ 1999-10-25 13:57 UTC (permalink / raw)
  To: Dan Malek; +Cc: linuxppc-embedded


Dan Malek <dan@netx4.com> writes:

> Marcus Sundberg wrote:
> 
> > Speaking of SMCs and CVS, attached is a diff adding support for
> > having the boot console on SMC2. Currently I just set
> > CONFIG_SERIAL_CONSOLE_PORT in asm/board.h, but maybe it should be
> > a configuration option?
> 
> Yes, I am working on that.  It will appear in my next CVS update.
> I have tried many different versions, and it appears the one
> that works the best is just a simple ask the questions version.
> I tried to make it smart about processor versions, what you
> are using for Ethernet, etc., and in the end the only one that
> seems to work is asking the individual questions about how you
> want ports configured.

It would be nice if we had "Board default" as an option for
the boot console (or as an alternative - make Config.in set
the correct default device when you change boards).

> I also have code for consoles on the SCC ports, and it needs a
> little more testing.  I have a board showing up this week that
> should allow me to test that properly.

I hope you will include an option to completely disable serial
ports on SCCs without changing uart.c too?

> > In uart.c I also fixed the major device of the console.
> 
> The console (as in /dev/console) is currently a symbolic
> link to the appropriate /dev/ttySx.

Well, not on any correct system running 2.1.71 or later. ;)

> Should we change that to be dynamically allocated?

I'm already running with /dev/console == char (5,1) as should be.
It works fine with 8xx kernels regardless of whether TTYAUX_MAJOR
or TTY_MAJOR is used for the console, except that I get the
	"tty_io.c: process %d (%s) used obsolete /dev/%s - "
	"update software to use /dev/ttyS%d\n"
warning when my init script starts if it uses TTYAUX_MAJOR.

> > TTYAUX_MAJOR corresponds to the /dev/cua* devices, which are obsolete.
> 
> Yes, but be careful we need to change the device nodes in the
> file systems......

That should be done anyway, but is it really mandatory?
Would anything break for people who have /dev/console as a symlink
if the console used TTY_MAJOR instead?

//Marcus
-- 
-------------------------------+------------------------------------
        Marcus Sundberg        | http://www.stacken.kth.se/~mackan/
 Royal Institute of Technology |       Phone: +46 707 295404
       Stockholm, Sweden       |   E-Mail: mackan@stacken.kth.se

** Sent via the linuxppc-embedded mail list. See http://lists.linuxppc.org/

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

* Re: Console on SMC2 (was: Re: MPC823 Serial ports)
  1999-10-25 13:57       ` Marcus Sundberg
@ 1999-10-25 14:20         ` Dan Malek
  1999-10-25 14:59           ` Marcus Sundberg
  0 siblings, 1 reply; 11+ messages in thread
From: Dan Malek @ 1999-10-25 14:20 UTC (permalink / raw)
  To: Marcus Sundberg; +Cc: Dan Malek, linuxppc-embedded


Marcus Sundberg wrote:


> It would be nice if we had "Board default" as an option for
> the boot console (or as an alternative - make Config.in set
> the correct default device when you change boards).

Yeah, I know, but as I have said before, I have more than a
dozen different boards in my office, all somewhat different.
The configuration files get increasingly complex with all of these
different possibilities.  Having separate default configurations
where the only difference is the console port is kind of
overkill.  Right now, you have to know where the console port
is connected, and simply select it.  I am trying to find a simple
configuration that will work with all boards, rather than track
lots of different ones.


> I hope you will include an option to completely disable serial
> ports on SCCs without changing uart.c too?

I can easily add that.


> Well, not on any correct system running 2.1.71 or later. ;)

If you say so.  I didn't make any 8xx changes until later
releases, and the standard distribution had a symbolic link,
so I just kept that......



	-- Dan

** Sent via the linuxppc-embedded mail list. See http://lists.linuxppc.org/

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

* Re: Console on SMC2 (was: Re: MPC823 Serial ports)
  1999-10-25 14:20         ` Dan Malek
@ 1999-10-25 14:59           ` Marcus Sundberg
  0 siblings, 0 replies; 11+ messages in thread
From: Marcus Sundberg @ 1999-10-25 14:59 UTC (permalink / raw)
  To: Dan Malek; +Cc: linuxppc-embedded


Dan Malek <dan@netx4.com> writes:

> Marcus Sundberg wrote:
> 
> 
> > It would be nice if we had "Board default" as an option for
> > the boot console (or as an alternative - make Config.in set
> > the correct default device when you change boards).
> 
> Yeah, I know, but as I have said before, I have more than a
> dozen different boards in my office, all somewhat different.
> The configuration files get increasingly complex with all of these
> different possibilities.  Having separate default configurations
> where the only difference is the console port is kind of
> overkill.  Right now, you have to know where the console port
> is connected, and simply select it.  I am trying to find a simple
> configuration that will work with all boards, rather than track
> lots of different ones.

Yes, that is the right way to go for the distribution kernel.
Howver, we have several different boards here too, and personally
I'd perfer if I could just select the CPU and board type at
configuration time, and have the rest taken from my board specific
file. This could be allowed even if the board files in the
distribution doesn't use this feature.

//Marcus
-- 
-------------------------------+------------------------------------
        Marcus Sundberg        | http://www.stacken.kth.se/~mackan/
 Royal Institute of Technology |       Phone: +46 707 295404
       Stockholm, Sweden       |   E-Mail: mackan@stacken.kth.se

** Sent via the linuxppc-embedded mail list. See http://lists.linuxppc.org/

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

end of thread, other threads:[~1999-10-25 14:59 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
1999-10-22 14:37 MPC823 Serial ports Grant Carter
1999-10-22 18:13 ` Dan Malek
1999-10-24 12:50   ` Console on SMC2 (was: Re: MPC823 Serial ports) Marcus Sundberg
1999-10-24 17:07     ` Dan Malek
1999-10-25 13:57       ` Marcus Sundberg
1999-10-25 14:20         ` Dan Malek
1999-10-25 14:59           ` Marcus Sundberg
1999-10-25  1:35     ` Graham Stoney
1999-10-25  3:08       ` Noah Misch
1999-10-25  3:20         ` Graham Stoney
1999-10-25 12:47       ` Marcus Sundberg

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).