Skip to contentSkip to conversation

CPM uart

DISCUSSION Marco Schramel 3 participants 7 messages Apr 14, 2005 – Apr 15, 2005

lore
Share & tools
lore
#0 lore raw

Hi,

on my target (MPC8270, 2.4.25) SCC1, SCC2 and SCC3 will work fine as ttyS0 .. ttyS2 with console at ttyS0.

It works with this code in arch/ppc/8260_io/uart.c
#define CONFIG_SERIAL_CONSOLE_PORT 0

#define SCC_NUM_BASE 0 /* SCC base tty "number" */
#define SCC_IDX_BASE 0 /* table index */

static struct serial_state rs_table[] = {
	/* UART CLK   PORT          IRQ      FLAGS  NUM   */
	{ 0,     0, PROFF_SCC1, SIU_INT_SCC1,   0, SCC_NUM_BASE},          /* SCC1 ttyS0 */
	{ 0,     0, PROFF_SCC2, SIU_INT_SCC2,   0, SCC_NUM_BASE + 1},    /* SCC2 ttyS1 */
	{ 0,     0, PROFF_SCC3, SIU_INT_SCC3,   0, SCC_NUM_BASE +2},     /* SCC3 ttyS2 */

Now i need the two SMC's.
I changed the source to:
#define CONFIG_SERIAL_CONSOLE_PORT 2
#define SCC_NUM_BASE 2 /* SCC base tty "number" */
#define SCC_IDX_BASE 2 /* table index */

static struct serial_state rs_table[] = {
	/* UART CLK   PORT          IRQ      FLAGS  NUM   */
	{ 0,     0, PROFF_SMC1, SIU_INT_SMC1,   0, 0},    /* SMC1 ttyS0 */
	{ 0,     0, PROFF_SMC2, SIU_INT_SMC2,   0, 1},    /* SMC2 ttyS1 */	
	{ 0,     0, PROFF_SCC1, SIU_INT_SCC1,   0, SCC_NUM_BASE},    /* SCC1 ttyS2 */
	{ 0,     0, PROFF_SCC2, SIU_INT_SCC2,   0, SCC_NUM_BASE + 1},    /* SCC2 ttyS3 */
	{ 0,     0, PROFF_SCC3, SIU_INT_SCC3,   0, SCC_NUM_BASE + 2},    /* SCC3 ttyS4 */

and passed the bootloader the correct console=ttyS2.

During booting kernel hangs on initializing ttyS2 forever.

What could be wrong ? I only changed the io port configuration in the init function.

Thanks in advance
Marco

---------
Marco Schramel

#1 lore raw
Quoted 1 line · Marco Schramel

During booting kernel hangs on initializing ttyS2 forever.

That is the console port, so take a look at the code for its initialization for something affected by this configuration. What kernel are you using? There have been lots of updates in recent versions.

Quoted 1 line

What could be wrong ? I only changed the io port configuration in the init function.

Heh :-) There are lots of permutations of serial ports that probably haven't been tested. You probably found one of them.

Thanks.

	-- Dan
#2 lore raw

Hi Dan,

thanks for your answer.

Quoted 6 lines
Quoted 1 line

During booting kernel hangs on initializing ttyS2 forever.

That is the console port, so take a look at the code for its initialization for something affected by this configuration. What kernel are you using? There have been lots of updates in recent versions.

I use kernel version 2.4.25 of denx and the uart version is static char *serial_name = "CPM UART driver"; static char *serial_version = "0.01";

Are there newer versions? Sorry, but i am not up to date with the uart. Is my configuration so extraordinary ;-) ?

Thanks
Marco

Signature · 2 lines
---------
Marco Schramel
#3 lore raw
Quoted 3 lines · Marco Schramel

I use kernel version 2.4.25 of denx and the uart version is static char *serial_name = "CPM UART driver"; static char *serial_version = "0.01";

I don't remember the progress of the new cpm serial drivers in 2.4, I've been spending too much time in 2.6. If you find a 2.4 kernel with the new serial driver model (drivers/seral/cpm_uart) that would be a big help.

Quoted 2 lines

Are there newer versions? Sorry, but i am not up to date with the uart. Is my configuration so extraordinary ;-) ?

Yes, there are newer versions and I've never tried what you are doing. The console code has always been sensitive to configurations. Although the #defines may look like it will work, the code often isn't there to support it, and I know wasn't there in that old version of the code.

Thanks.

	-- Dan
#4 lore raw
In reply to Marco Schramel

Hi Marco,

Quoted 4 lines · Marco Schramel

Hi Dan,

thanks for your answer.

Quoted 8 lines
Quoted 6 lines
Quoted 1 line

During booting kernel hangs on initializing ttyS2 forever.

That is the console port, so take a look at the code for its initialization for something affected by this configuration. What kernel are you using? There have been lots of updates in recent versions.

I use kernel version 2.4.25 of denx and the uart version is

                       ^^^^^^^^^^^^^^

Perusing that code, I can see that the console routines assume that there=
are=20
_no_ SMC ports initialized before the SCC ports in rs_table. This should = be=20
fixed before attempting to run your system again.

I suggest you to seek all smc_scc_num references inside both the console=20 routines and the #ifdef SCC_CONSOLE ... #endif code snippets. They should=
be=20
subtracted by SCC_NUM_BASE whenever they're used to access SCC-related st= uff,=20
AFAIK.

HTH,

Ricardo Scop.

        \|/
    ___ -*-
   (@ @)/|\
  /  V  \|  R SCOP Consult.
 /(     )\  Linux-based communications

--^^---^^+------------------------------
[email protected]
+55 51 999-36-777
Porto Alegre, RS - BRazil

#5 lore raw
Quoted 3 lines · Ricardo Scop

I suggest you to seek all smc_scc_num references inside both the console routines and the #ifdef SCC_CONSOLE ... #endif code snippets. They should be subtracted by SCC_NUM_BASE whenever they're used to access SCC-related stuff,

This has all been corrected in later versions of the driver. Take a look at the linuxppc_2.4_devel or some other BK ppc kernels. Start at penguinppc.org for kernel access information.

Yes, I know, it shouldn't be in this state, but it is. Find the various kernel sources and peruse for what fits your requirements.

Thanks.

	-- Dan
#6 lore raw

Hi all,

thanks for helping me.
Now it works with my configuration.
I added SCC_NUM_BASE as it is without console. And now it works.

#ifdef SCC_CONSOLE
				switch (state->smc_scc_num - SCC_NUM_BASE) {  /*SCC_NUM_BASE added*/
				case 0:
					page = CPM_CR_SCC1_PAGE;
					sblock = CPM_CR_SCC1_SBLOCK;
					break;
				case 1:
					page = CPM_CR_SCC2_PAGE;
					sblock = CPM_CR_SCC2_SBLOCK;
					break;
				case 2:
					page = CPM_CR_SCC3_PAGE;
					sblock = CPM_CR_SCC3_SBLOCK;
					break;
				}

#else
.
.
.

Seems the use of SMC in conjunction with console on SCC was not planed in this version. Furthermore i will test it and post if it fails.

Best regards
Marco

---------
Marco Schramel