All of lore.kernel.org
 help / color / mirror / Atom feed
* The new "real" console doesn't display printk() messages like "early" console!
@ 2010-11-18 18:55 ` Ardelean, Andrei
  0 siblings, 0 replies; 17+ messages in thread
From: Ardelean, Andrei @ 2010-11-18 18:55 UTC (permalink / raw)
  To: linux-mips

Hi,

I am porting MIPS Linux on a new platform and my kernel crashes after
console is switched from early console to the new real console (8250.c)
I see messages displayed using the new console like "Freeing prom
memory: 956k freed" (this is the last message I have) so the new console
is up and running. 
My problem is that the new console doesn't display printk() messages.
The early console displays all printk() messages.

What do I need to set at compiling time that the new console to display
printk() messages like early console?

Thanks,
Andrei
 

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

* The new "real" console doesn't display printk() messages like "early" console!
@ 2010-11-18 18:55 ` Ardelean, Andrei
  0 siblings, 0 replies; 17+ messages in thread
From: Ardelean, Andrei @ 2010-11-18 18:55 UTC (permalink / raw)
  To: linux-mips

Hi,

I am porting MIPS Linux on a new platform and my kernel crashes after
console is switched from early console to the new real console (8250.c)
I see messages displayed using the new console like "Freeing prom
memory: 956k freed" (this is the last message I have) so the new console
is up and running. 
My problem is that the new console doesn't display printk() messages.
The early console displays all printk() messages.

What do I need to set at compiling time that the new console to display
printk() messages like early console?

Thanks,
Andrei
 

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

* Re: The new "real" console doesn't display printk() messages like "early" console!
  2010-11-18 18:55 ` Ardelean, Andrei
  (?)
@ 2010-11-18 19:20 ` Sergei Shtylyov
  2010-11-18 20:04     ` Ardelean, Andrei
  -1 siblings, 1 reply; 17+ messages in thread
From: Sergei Shtylyov @ 2010-11-18 19:20 UTC (permalink / raw)
  To: Ardelean, Andrei; +Cc: linux-mips

Hello.

Ardelean, Andrei wrote:

> I am porting MIPS Linux on a new platform and my kernel crashes after
> console is switched from early console to the new real console (8250.c)
> I see messages displayed using the new console like "Freeing prom
> memory: 956k freed" (this is the last message I have) so the new console
> is up and running. 
> My problem is that the new console doesn't display printk() messages.
> The early console displays all printk() messages.

> What do I need to set at compiling time that the new console to display
> printk() messages like early console?

    Have you specified "console=ttyS<n>,<baudrate> as the kernel parameter?

> Thanks,
> Andrei

WBR, Sergei

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

* RE: The new "real" console doesn't display printk() messages like "early" console!
@ 2010-11-18 20:04     ` Ardelean, Andrei
  0 siblings, 0 replies; 17+ messages in thread
From: Ardelean, Andrei @ 2010-11-18 20:04 UTC (permalink / raw)
  To: Sergei Shtylyov; +Cc: linux-mips

Hi Sergei,

I specified that when the bootloader calls the kernel and I did see that
the baudrate is correct and I have some messages but when the system is
crashing I cannot see printk messages. For instance, I step with JTAG
and I can see that printk(KERNEL_WARNING "unable to open initial
console") is called but on the terminal I cannot see the message. The
same, die() is called but there is no messages on UART terminal.

Thanks,
Andrei
 

-----Original Message-----
From: Sergei Shtylyov [mailto:sshtylyov@mvista.com] 
Sent: Thursday, November 18, 2010 2:21 PM
To: Ardelean, Andrei
Cc: linux-mips@linux-mips.org
Subject: Re: The new "real" console doesn't display printk() messages
like "early" console!

Hello.

Ardelean, Andrei wrote:

> I am porting MIPS Linux on a new platform and my kernel crashes after
> console is switched from early console to the new real console
(8250.c)
> I see messages displayed using the new console like "Freeing prom
> memory: 956k freed" (this is the last message I have) so the new
console
> is up and running. 
> My problem is that the new console doesn't display printk() messages.
> The early console displays all printk() messages.

> What do I need to set at compiling time that the new console to
display
> printk() messages like early console?

    Have you specified "console=ttyS<n>,<baudrate> as the kernel
parameter?

> Thanks,
> Andrei

WBR, Sergei

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

* RE: The new "real" console doesn't display printk() messages like "early" console!
@ 2010-11-18 20:04     ` Ardelean, Andrei
  0 siblings, 0 replies; 17+ messages in thread
From: Ardelean, Andrei @ 2010-11-18 20:04 UTC (permalink / raw)
  To: Sergei Shtylyov; +Cc: linux-mips

Hi Sergei,

I specified that when the bootloader calls the kernel and I did see that
the baudrate is correct and I have some messages but when the system is
crashing I cannot see printk messages. For instance, I step with JTAG
and I can see that printk(KERNEL_WARNING "unable to open initial
console") is called but on the terminal I cannot see the message. The
same, die() is called but there is no messages on UART terminal.

Thanks,
Andrei
 

-----Original Message-----
From: Sergei Shtylyov [mailto:sshtylyov@mvista.com] 
Sent: Thursday, November 18, 2010 2:21 PM
To: Ardelean, Andrei
Cc: linux-mips@linux-mips.org
Subject: Re: The new "real" console doesn't display printk() messages
like "early" console!

Hello.

Ardelean, Andrei wrote:

> I am porting MIPS Linux on a new platform and my kernel crashes after
> console is switched from early console to the new real console
(8250.c)
> I see messages displayed using the new console like "Freeing prom
> memory: 956k freed" (this is the last message I have) so the new
console
> is up and running. 
> My problem is that the new console doesn't display printk() messages.
> The early console displays all printk() messages.

> What do I need to set at compiling time that the new console to
display
> printk() messages like early console?

    Have you specified "console=ttyS<n>,<baudrate> as the kernel
parameter?

> Thanks,
> Andrei

WBR, Sergei

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

* Re: The new "real" console doesn't display printk() messages like "early" console!
  2010-11-18 20:04     ` Ardelean, Andrei
  (?)
@ 2010-11-18 21:21     ` Ricardo Mendoza
  2010-11-18 22:01         ` Ardelean, Andrei
  -1 siblings, 1 reply; 17+ messages in thread
From: Ricardo Mendoza @ 2010-11-18 21:21 UTC (permalink / raw)
  To: Ardelean, Andrei; +Cc: linux-mips

On Thu, Nov 18, 2010 at 8:04 PM, Ardelean, Andrei
<Andrei.Ardelean@idt.com> wrote:

> I specified that when the bootloader calls the kernel and I did see that
> the baudrate is correct and I have some messages but when the system is
> crashing I cannot see printk messages. For instance, I step with JTAG
> and I can see that printk(KERNEL_WARNING "unable to open initial
> console") is called but on the terminal I cannot see the message. The
> same, die() is called but there is no messages on UART terminal.

You say you are porting to a new system, perhaps you didn't set up
your 8250 platform device. Most boards will have an example for you in
the tree.


     Ricardo

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

* RE: The new "real" console doesn't display printk() messages like "early" console!
@ 2010-11-18 22:01         ` Ardelean, Andrei
  0 siblings, 0 replies; 17+ messages in thread
From: Ardelean, Andrei @ 2010-11-18 22:01 UTC (permalink / raw)
  To: Ricardo Mendoza; +Cc: linux-mips

Hi Ricardo,

I implemented serial platform driver taking as model serial.c from
cavium-octeon.

Here is my code:


/*
 * This file is subject to the terms and conditions of the GNU General
Public
 * License.  See the file "COPYING" in the main directory of this
archive
 * for more details.
 *
 * Copyright (C) 2004-2007 Cavium Networks
 */
 
#include <linux/console.h>
#include <linux/module.h>
#include <linux/init.h>
#include <linux/platform_device.h>
#include <linux/serial.h>
#include <linux/serial_8250.h>
#include <linux/serial_reg.h>
#include <linux/tty.h>
#include <asm/time.h>
#include <sys_defs.h>


#ifdef CONFIG_GDB_CONSOLE
#define DEBUG_UART 0
#else
#define DEBUG_UART 1
#endif

unsigned int gd_serial_in(struct uart_port *up, int offset)
{
	int rv = inl((unsigned int)(up->membase + (offset << 2)));
	if (offset == UART_IIR && (rv & 0xf) == 7) {
		/* Busy interrupt, read the USR (39) and try again. */
		inl((unsigned int)(up->membase + (39 << 2)));
		rv = inl((unsigned int)(up->membase + (offset << 2)));
	}
	return rv;
}

void gd_serial_out(struct uart_port *up, int offset, int value)
{
	outl( value & 0xff, (unsigned int)(up->membase + (offset <<
2)));
}

/*
 * Allocated in .bss, so it is all zeroed.
 */
#define GD_MAX_UARTS 1
static struct plat_serial8250_port gd_uart8250_data[GD_MAX_UARTS + 1];
static struct platform_device gd_uart8250_device = {
	.name			= "serial8250",
	.id			= PLAT8250_DEV_PLATFORM,
	.dev			= {
		.platform_data	= gd_uart8250_data,
	},
};

static void __init gd_uart_set_common(struct plat_serial8250_port *p)
{
	p->flags = ASYNC_SKIP_TEST | UPF_SHARE_IRQ | UPF_FIXED_TYPE;
	p->type = PORT_GD;
	p->iotype = UPIO_MEM;
	p->regshift = 2;	/* I/O addresses are every 4 bytes */
	p->uartclk = UART_CLK;  
	p->serial_in = gd_serial_in;
	p->serial_out = gd_serial_out;
}

static int __init gd_serial_init(void)
{
	int enable_uart0;
	struct plat_serial8250_port *p;

	enable_uart0 = 1;

	p = gd_uart8250_data;
	if (enable_uart0) {
		/* Add a ttyS device for hardware uart 0 */
		gd_uart_set_common(p);
		p->membase = (void *) offMCU_UART_THR_OR_RBR_OR_DLL;
		p->mapbase = offMCU_UART_THR_OR_RBR_OR_DLL;
		p->irq = MIPSCPU_INT_UART;
		p++;
	}

	return platform_device_register(&gd_uart8250_device);
}

device_initcall(gd_serial_init);


------------------------------------------------------------------------
-----------------------

Thanks,
Andrei














-----Original Message-----
From: mendoza.ricardo@gmail.com [mailto:mendoza.ricardo@gmail.com] On
Behalf Of Ricardo Mendoza
Sent: Thursday, November 18, 2010 4:21 PM
To: Ardelean, Andrei
Cc: linux-mips@linux-mips.org
Subject: Re: The new "real" console doesn't display printk() messages
like "early" console!

On Thu, Nov 18, 2010 at 8:04 PM, Ardelean, Andrei
<Andrei.Ardelean@idt.com> wrote:

> I specified that when the bootloader calls the kernel and I did see
that
> the baudrate is correct and I have some messages but when the system
is
> crashing I cannot see printk messages. For instance, I step with JTAG
> and I can see that printk(KERNEL_WARNING "unable to open initial
> console") is called but on the terminal I cannot see the message. The
> same, die() is called but there is no messages on UART terminal.

You say you are porting to a new system, perhaps you didn't set up
your 8250 platform device. Most boards will have an example for you in
the tree.


     Ricardo

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

* RE: The new "real" console doesn't display printk() messages like "early" console!
@ 2010-11-18 22:01         ` Ardelean, Andrei
  0 siblings, 0 replies; 17+ messages in thread
From: Ardelean, Andrei @ 2010-11-18 22:01 UTC (permalink / raw)
  To: Ricardo Mendoza; +Cc: linux-mips

Hi Ricardo,

I implemented serial platform driver taking as model serial.c from
cavium-octeon.

Here is my code:


/*
 * This file is subject to the terms and conditions of the GNU General
Public
 * License.  See the file "COPYING" in the main directory of this
archive
 * for more details.
 *
 * Copyright (C) 2004-2007 Cavium Networks
 */
 
#include <linux/console.h>
#include <linux/module.h>
#include <linux/init.h>
#include <linux/platform_device.h>
#include <linux/serial.h>
#include <linux/serial_8250.h>
#include <linux/serial_reg.h>
#include <linux/tty.h>
#include <asm/time.h>
#include <sys_defs.h>


#ifdef CONFIG_GDB_CONSOLE
#define DEBUG_UART 0
#else
#define DEBUG_UART 1
#endif

unsigned int gd_serial_in(struct uart_port *up, int offset)
{
	int rv = inl((unsigned int)(up->membase + (offset << 2)));
	if (offset == UART_IIR && (rv & 0xf) == 7) {
		/* Busy interrupt, read the USR (39) and try again. */
		inl((unsigned int)(up->membase + (39 << 2)));
		rv = inl((unsigned int)(up->membase + (offset << 2)));
	}
	return rv;
}

void gd_serial_out(struct uart_port *up, int offset, int value)
{
	outl( value & 0xff, (unsigned int)(up->membase + (offset <<
2)));
}

/*
 * Allocated in .bss, so it is all zeroed.
 */
#define GD_MAX_UARTS 1
static struct plat_serial8250_port gd_uart8250_data[GD_MAX_UARTS + 1];
static struct platform_device gd_uart8250_device = {
	.name			= "serial8250",
	.id			= PLAT8250_DEV_PLATFORM,
	.dev			= {
		.platform_data	= gd_uart8250_data,
	},
};

static void __init gd_uart_set_common(struct plat_serial8250_port *p)
{
	p->flags = ASYNC_SKIP_TEST | UPF_SHARE_IRQ | UPF_FIXED_TYPE;
	p->type = PORT_GD;
	p->iotype = UPIO_MEM;
	p->regshift = 2;	/* I/O addresses are every 4 bytes */
	p->uartclk = UART_CLK;  
	p->serial_in = gd_serial_in;
	p->serial_out = gd_serial_out;
}

static int __init gd_serial_init(void)
{
	int enable_uart0;
	struct plat_serial8250_port *p;

	enable_uart0 = 1;

	p = gd_uart8250_data;
	if (enable_uart0) {
		/* Add a ttyS device for hardware uart 0 */
		gd_uart_set_common(p);
		p->membase = (void *) offMCU_UART_THR_OR_RBR_OR_DLL;
		p->mapbase = offMCU_UART_THR_OR_RBR_OR_DLL;
		p->irq = MIPSCPU_INT_UART;
		p++;
	}

	return platform_device_register(&gd_uart8250_device);
}

device_initcall(gd_serial_init);


------------------------------------------------------------------------
-----------------------

Thanks,
Andrei














-----Original Message-----
From: mendoza.ricardo@gmail.com [mailto:mendoza.ricardo@gmail.com] On
Behalf Of Ricardo Mendoza
Sent: Thursday, November 18, 2010 4:21 PM
To: Ardelean, Andrei
Cc: linux-mips@linux-mips.org
Subject: Re: The new "real" console doesn't display printk() messages
like "early" console!

On Thu, Nov 18, 2010 at 8:04 PM, Ardelean, Andrei
<Andrei.Ardelean@idt.com> wrote:

> I specified that when the bootloader calls the kernel and I did see
that
> the baudrate is correct and I have some messages but when the system
is
> crashing I cannot see printk messages. For instance, I step with JTAG
> and I can see that printk(KERNEL_WARNING "unable to open initial
> console") is called but on the terminal I cannot see the message. The
> same, die() is called but there is no messages on UART terminal.

You say you are porting to a new system, perhaps you didn't set up
your 8250 platform device. Most boards will have an example for you in
the tree.


     Ricardo

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

* Re: The new "real" console doesn't display printk() messages like "early" console!
  2010-11-18 22:01         ` Ardelean, Andrei
  (?)
@ 2010-11-18 23:58         ` Ricardo Mendoza
  2010-11-19 14:04             ` Ardelean, Andrei
  -1 siblings, 1 reply; 17+ messages in thread
From: Ricardo Mendoza @ 2010-11-18 23:58 UTC (permalink / raw)
  To: Ardelean, Andrei; +Cc: linux-mips

On Thu, Nov 18, 2010 at 10:01 PM, Ardelean, Andrei
<Andrei.Ardelean@idt.com> wrote:

> Hi Ricardo,
>
> I implemented serial platform driver taking as model serial.c from
> cavium-octeon.
>
> Here is my code:
>
> ...

Why use the Octeon code which has platform specific bits that might
have nothing to do with your platform? Build up from the simple ones.


     Ricardo

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

* RE: The new "real" console doesn't display printk() messages like "early" console!
@ 2010-11-19 14:04             ` Ardelean, Andrei
  0 siblings, 0 replies; 17+ messages in thread
From: Ardelean, Andrei @ 2010-11-19 14:04 UTC (permalink / raw)
  To: Ricardo Mendoza; +Cc: linux-mips

Hi Ricardo,

I used Octeon just as a model, I added my own PORT_GD and my own
serial_in/out driver functions which work well, I have some messages on
the screen. My problem is that I can see messages like "Freeing unused
kernel memory..." but I cannot see printk() error/warning/debug
messages, like the messages printed by die().

Thanks,
Andrei



-----Original Message-----
From: mendoza.ricardo@gmail.com [mailto:mendoza.ricardo@gmail.com] On
Behalf Of Ricardo Mendoza
Sent: Thursday, November 18, 2010 6:58 PM
To: Ardelean, Andrei
Cc: linux-mips@linux-mips.org
Subject: Re: The new "real" console doesn't display printk() messages
like "early" console!

On Thu, Nov 18, 2010 at 10:01 PM, Ardelean, Andrei
<Andrei.Ardelean@idt.com> wrote:

> Hi Ricardo,
>
> I implemented serial platform driver taking as model serial.c from
> cavium-octeon.
>
> Here is my code:
>
> ...

Why use the Octeon code which has platform specific bits that might
have nothing to do with your platform? Build up from the simple ones.


     Ricardo

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

* RE: The new "real" console doesn't display printk() messages like "early" console!
@ 2010-11-19 14:04             ` Ardelean, Andrei
  0 siblings, 0 replies; 17+ messages in thread
From: Ardelean, Andrei @ 2010-11-19 14:04 UTC (permalink / raw)
  To: Ricardo Mendoza; +Cc: linux-mips

Hi Ricardo,

I used Octeon just as a model, I added my own PORT_GD and my own
serial_in/out driver functions which work well, I have some messages on
the screen. My problem is that I can see messages like "Freeing unused
kernel memory..." but I cannot see printk() error/warning/debug
messages, like the messages printed by die().

Thanks,
Andrei



-----Original Message-----
From: mendoza.ricardo@gmail.com [mailto:mendoza.ricardo@gmail.com] On
Behalf Of Ricardo Mendoza
Sent: Thursday, November 18, 2010 6:58 PM
To: Ardelean, Andrei
Cc: linux-mips@linux-mips.org
Subject: Re: The new "real" console doesn't display printk() messages
like "early" console!

On Thu, Nov 18, 2010 at 10:01 PM, Ardelean, Andrei
<Andrei.Ardelean@idt.com> wrote:

> Hi Ricardo,
>
> I implemented serial platform driver taking as model serial.c from
> cavium-octeon.
>
> Here is my code:
>
> ...

Why use the Octeon code which has platform specific bits that might
have nothing to do with your platform? Build up from the simple ones.


     Ricardo

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

* Re: The new "real" console doesn't display printk() messages like "early" console!
  2010-11-18 22:01         ` Ardelean, Andrei
  (?)
  (?)
@ 2010-11-19 16:08         ` Sergei Shtylyov
  2010-11-22 16:37             ` Ardelean, Andrei
  2010-11-22 20:51             ` Ardelean, Andrei
  -1 siblings, 2 replies; 17+ messages in thread
From: Sergei Shtylyov @ 2010-11-19 16:08 UTC (permalink / raw)
  To: Ardelean, Andrei; +Cc: Ricardo Mendoza, linux-mips

Ardelean, Andrei wrote:

> Hi Ricardo,

> I implemented serial platform driver taking as model serial.c from
> cavium-octeon.

    I think you should really have used something simpler as an example.

> Here is my code:


> /*
>  * This file is subject to the terms and conditions of the GNU General
> Public
>  * License.  See the file "COPYING" in the main directory of this
> archive
>  * for more details.
>  *
>  * Copyright (C) 2004-2007 Cavium Networks
>  */
>  
> #include <linux/console.h>
> #include <linux/module.h>
> #include <linux/init.h>
> #include <linux/platform_device.h>
> #include <linux/serial.h>
> #include <linux/serial_8250.h>
> #include <linux/serial_reg.h>
> #include <linux/tty.h>
> #include <asm/time.h>
> #include <sys_defs.h>
> 
> 
> #ifdef CONFIG_GDB_CONSOLE

    This is never defined for MIPS. And there shouldn't be such dependencies.

> #define DEBUG_UART 0
> #else
> #define DEBUG_UART 1
> #endif
> 
> unsigned int gd_serial_in(struct uart_port *up, int offset)
> {
> 	int rv = inl((unsigned int)(up->membase + (offset << 2)));

    Should be an empty line here.

> 	if (offset == UART_IIR && (rv & 0xf) == 7) {

    Are you sure this Octeon specific quirk also allpies to your UART?

> 		/* Busy interrupt, read the USR (39) and try again. */
> 		inl((unsigned int)(up->membase + (39 << 2)));
> 		rv = inl((unsigned int)(up->membase + (offset << 2)));
> 	}
> 	return rv;
> }
> 
> void gd_serial_out(struct uart_port *up, int offset, int value)
> {
> 	outl( value & 0xff, (unsigned int)(up->membase + (offset <<

    No spaces allowed after (.

> 2)));
> }
> 
> /*
>  * Allocated in .bss, so it is all zeroed.
>  */
> #define GD_MAX_UARTS 1

    Then how DEBUG_UART can be 1?

> static struct plat_serial8250_port gd_uart8250_data[GD_MAX_UARTS + 1];
> static struct platform_device gd_uart8250_device = {
> 	.name			= "serial8250",
> 	.id			= PLAT8250_DEV_PLATFORM,
> 	.dev			= {
> 		.platform_data	= gd_uart8250_data,

    Where is 'gd_uart8250_data'?

> 	},
> };

> static void __init gd_uart_set_common(struct plat_serial8250_port *p)
> {
> 	p->flags = ASYNC_SKIP_TEST | UPF_SHARE_IRQ | UPF_FIXED_TYPE;
> 	p->type = PORT_GD;

    What is PORT_GD?

> 	p->iotype = UPIO_MEM;

    Judging from your code, it should be UPIO_MEM32.

> 	p->regshift = 2;	/* I/O addresses are every 4 bytes */
> 	p->uartclk = UART_CLK;  
> 	p->serial_in = gd_serial_in;
> 	p->serial_out = gd_serial_out;
> }
> 
> static int __init gd_serial_init(void)
> {
> 	int enable_uart0;
> 	struct plat_serial8250_port *p;
> 
> 	enable_uart0 = 1;

    What's the point in existence of this variable?

> 	p = gd_uart8250_data;
> 	if (enable_uart0) {
> 		/* Add a ttyS device for hardware uart 0 */
> 		gd_uart_set_common(p);
> 		p->membase = (void *) offMCU_UART_THR_OR_RBR_OR_DLL;
> 		p->mapbase = offMCU_UART_THR_OR_RBR_OR_DLL;

     Are your UART registers identity mapped to virtual address space?
You are not obliged to pass 'membase', unless you have pre-existing mapping but 
in this case you also need to pass UPF_IOREMAP in 'flags'.

> 		p->irq = MIPSCPU_INT_UART;
> 		p++;
> 	}

> 	return platform_device_register(&gd_uart8250_device);
> }
> 
> device_initcall(gd_serial_init);


> ------------------------------------------------------------------------
> -----------------------
> 
> Thanks,
> Andrei

WBR, Sergei

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

* RE: The new "real" console doesn't display printk() messages like "early" console!
@ 2010-11-22 16:37             ` Ardelean, Andrei
  0 siblings, 0 replies; 17+ messages in thread
From: Ardelean, Andrei @ 2010-11-22 16:37 UTC (permalink / raw)
  To: Sergei Shtylyov; +Cc: Ricardo Mendoza, linux-mips

Hi Sergei,

- I will clean up the things you highlighted in the code, they come from
octeon code.
- Regarding PORT_GD, I added it in driver/serial/8250.c like octeon
model:

	[PORT_OCTEON] = {
		.name		= "OCTEON",
		.fifo_size	= 64,
		.tx_loadsz	= 64,
		.fcr		= UART_FCR_ENABLE_FIFO |
UART_FCR_R_TRIG_10,
		.flags		= UART_CAP_FIFO,
	},
	[PORT_GD] = {
		.name		= "GD",
		.fifo_size	= 16,
		.tx_loadsz	= 16,
		.fcr		= UART_FCR_ENABLE_FIFO |
UART_FCR_R_TRIG_10,
		.flags		= UART_CAP_FIFO,
	},


Thanks,
Andrei


-----Original Message-----
From: Sergei Shtylyov [mailto:sshtylyov@mvista.com] 
Sent: Friday, November 19, 2010 11:09 AM
To: Ardelean, Andrei
Cc: Ricardo Mendoza; linux-mips@linux-mips.org
Subject: Re: The new "real" console doesn't display printk() messages
like "early" console!

Ardelean, Andrei wrote:

> Hi Ricardo,

> I implemented serial platform driver taking as model serial.c from
> cavium-octeon.

    I think you should really have used something simpler as an example.

> Here is my code:


> /*
>  * This file is subject to the terms and conditions of the GNU General
> Public
>  * License.  See the file "COPYING" in the main directory of this
> archive
>  * for more details.
>  *
>  * Copyright (C) 2004-2007 Cavium Networks
>  */
>  
> #include <linux/console.h>
> #include <linux/module.h>
> #include <linux/init.h>
> #include <linux/platform_device.h>
> #include <linux/serial.h>
> #include <linux/serial_8250.h>
> #include <linux/serial_reg.h>
> #include <linux/tty.h>
> #include <asm/time.h>
> #include <sys_defs.h>
> 
> 
> #ifdef CONFIG_GDB_CONSOLE

    This is never defined for MIPS. And there shouldn't be such
dependencies.

> #define DEBUG_UART 0
> #else
> #define DEBUG_UART 1
> #endif
> 
> unsigned int gd_serial_in(struct uart_port *up, int offset)
> {
> 	int rv = inl((unsigned int)(up->membase + (offset << 2)));

    Should be an empty line here.

> 	if (offset == UART_IIR && (rv & 0xf) == 7) {

    Are you sure this Octeon specific quirk also allpies to your UART?

> 		/* Busy interrupt, read the USR (39) and try again. */
> 		inl((unsigned int)(up->membase + (39 << 2)));
> 		rv = inl((unsigned int)(up->membase + (offset << 2)));
> 	}
> 	return rv;
> }
> 
> void gd_serial_out(struct uart_port *up, int offset, int value)
> {
> 	outl( value & 0xff, (unsigned int)(up->membase + (offset <<

    No spaces allowed after (.

> 2)));
> }
> 
> /*
>  * Allocated in .bss, so it is all zeroed.
>  */
> #define GD_MAX_UARTS 1

    Then how DEBUG_UART can be 1?

> static struct plat_serial8250_port gd_uart8250_data[GD_MAX_UARTS + 1];
> static struct platform_device gd_uart8250_device = {
> 	.name			= "serial8250",
> 	.id			= PLAT8250_DEV_PLATFORM,
> 	.dev			= {
> 		.platform_data	= gd_uart8250_data,

    Where is 'gd_uart8250_data'?

> 	},
> };

> static void __init gd_uart_set_common(struct plat_serial8250_port *p)
> {
> 	p->flags = ASYNC_SKIP_TEST | UPF_SHARE_IRQ | UPF_FIXED_TYPE;
> 	p->type = PORT_GD;

    What is PORT_GD?

> 	p->iotype = UPIO_MEM;

    Judging from your code, it should be UPIO_MEM32.

> 	p->regshift = 2;	/* I/O addresses are every 4 bytes */
> 	p->uartclk = UART_CLK;  
> 	p->serial_in = gd_serial_in;
> 	p->serial_out = gd_serial_out;
> }
> 
> static int __init gd_serial_init(void)
> {
> 	int enable_uart0;
> 	struct plat_serial8250_port *p;
> 
> 	enable_uart0 = 1;

    What's the point in existence of this variable?

> 	p = gd_uart8250_data;
> 	if (enable_uart0) {
> 		/* Add a ttyS device for hardware uart 0 */
> 		gd_uart_set_common(p);
> 		p->membase = (void *) offMCU_UART_THR_OR_RBR_OR_DLL;
> 		p->mapbase = offMCU_UART_THR_OR_RBR_OR_DLL;

     Are your UART registers identity mapped to virtual address space?
You are not obliged to pass 'membase', unless you have pre-existing
mapping but 
in this case you also need to pass UPF_IOREMAP in 'flags'.

> 		p->irq = MIPSCPU_INT_UART;
> 		p++;
> 	}

> 	return platform_device_register(&gd_uart8250_device);
> }
> 
> device_initcall(gd_serial_init);


>
------------------------------------------------------------------------
> -----------------------
> 
> Thanks,
> Andrei

WBR, Sergei

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

* RE: The new "real" console doesn't display printk() messages like "early" console!
@ 2010-11-22 16:37             ` Ardelean, Andrei
  0 siblings, 0 replies; 17+ messages in thread
From: Ardelean, Andrei @ 2010-11-22 16:37 UTC (permalink / raw)
  To: Sergei Shtylyov; +Cc: Ricardo Mendoza, linux-mips

Hi Sergei,

- I will clean up the things you highlighted in the code, they come from
octeon code.
- Regarding PORT_GD, I added it in driver/serial/8250.c like octeon
model:

	[PORT_OCTEON] = {
		.name		= "OCTEON",
		.fifo_size	= 64,
		.tx_loadsz	= 64,
		.fcr		= UART_FCR_ENABLE_FIFO |
UART_FCR_R_TRIG_10,
		.flags		= UART_CAP_FIFO,
	},
	[PORT_GD] = {
		.name		= "GD",
		.fifo_size	= 16,
		.tx_loadsz	= 16,
		.fcr		= UART_FCR_ENABLE_FIFO |
UART_FCR_R_TRIG_10,
		.flags		= UART_CAP_FIFO,
	},


Thanks,
Andrei


-----Original Message-----
From: Sergei Shtylyov [mailto:sshtylyov@mvista.com] 
Sent: Friday, November 19, 2010 11:09 AM
To: Ardelean, Andrei
Cc: Ricardo Mendoza; linux-mips@linux-mips.org
Subject: Re: The new "real" console doesn't display printk() messages
like "early" console!

Ardelean, Andrei wrote:

> Hi Ricardo,

> I implemented serial platform driver taking as model serial.c from
> cavium-octeon.

    I think you should really have used something simpler as an example.

> Here is my code:


> /*
>  * This file is subject to the terms and conditions of the GNU General
> Public
>  * License.  See the file "COPYING" in the main directory of this
> archive
>  * for more details.
>  *
>  * Copyright (C) 2004-2007 Cavium Networks
>  */
>  
> #include <linux/console.h>
> #include <linux/module.h>
> #include <linux/init.h>
> #include <linux/platform_device.h>
> #include <linux/serial.h>
> #include <linux/serial_8250.h>
> #include <linux/serial_reg.h>
> #include <linux/tty.h>
> #include <asm/time.h>
> #include <sys_defs.h>
> 
> 
> #ifdef CONFIG_GDB_CONSOLE

    This is never defined for MIPS. And there shouldn't be such
dependencies.

> #define DEBUG_UART 0
> #else
> #define DEBUG_UART 1
> #endif
> 
> unsigned int gd_serial_in(struct uart_port *up, int offset)
> {
> 	int rv = inl((unsigned int)(up->membase + (offset << 2)));

    Should be an empty line here.

> 	if (offset == UART_IIR && (rv & 0xf) == 7) {

    Are you sure this Octeon specific quirk also allpies to your UART?

> 		/* Busy interrupt, read the USR (39) and try again. */
> 		inl((unsigned int)(up->membase + (39 << 2)));
> 		rv = inl((unsigned int)(up->membase + (offset << 2)));
> 	}
> 	return rv;
> }
> 
> void gd_serial_out(struct uart_port *up, int offset, int value)
> {
> 	outl( value & 0xff, (unsigned int)(up->membase + (offset <<

    No spaces allowed after (.

> 2)));
> }
> 
> /*
>  * Allocated in .bss, so it is all zeroed.
>  */
> #define GD_MAX_UARTS 1

    Then how DEBUG_UART can be 1?

> static struct plat_serial8250_port gd_uart8250_data[GD_MAX_UARTS + 1];
> static struct platform_device gd_uart8250_device = {
> 	.name			= "serial8250",
> 	.id			= PLAT8250_DEV_PLATFORM,
> 	.dev			= {
> 		.platform_data	= gd_uart8250_data,

    Where is 'gd_uart8250_data'?

> 	},
> };

> static void __init gd_uart_set_common(struct plat_serial8250_port *p)
> {
> 	p->flags = ASYNC_SKIP_TEST | UPF_SHARE_IRQ | UPF_FIXED_TYPE;
> 	p->type = PORT_GD;

    What is PORT_GD?

> 	p->iotype = UPIO_MEM;

    Judging from your code, it should be UPIO_MEM32.

> 	p->regshift = 2;	/* I/O addresses are every 4 bytes */
> 	p->uartclk = UART_CLK;  
> 	p->serial_in = gd_serial_in;
> 	p->serial_out = gd_serial_out;
> }
> 
> static int __init gd_serial_init(void)
> {
> 	int enable_uart0;
> 	struct plat_serial8250_port *p;
> 
> 	enable_uart0 = 1;

    What's the point in existence of this variable?

> 	p = gd_uart8250_data;
> 	if (enable_uart0) {
> 		/* Add a ttyS device for hardware uart 0 */
> 		gd_uart_set_common(p);
> 		p->membase = (void *) offMCU_UART_THR_OR_RBR_OR_DLL;
> 		p->mapbase = offMCU_UART_THR_OR_RBR_OR_DLL;

     Are your UART registers identity mapped to virtual address space?
You are not obliged to pass 'membase', unless you have pre-existing
mapping but 
in this case you also need to pass UPF_IOREMAP in 'flags'.

> 		p->irq = MIPSCPU_INT_UART;
> 		p++;
> 	}

> 	return platform_device_register(&gd_uart8250_device);
> }
> 
> device_initcall(gd_serial_init);


>
------------------------------------------------------------------------
> -----------------------
> 
> Thanks,
> Andrei

WBR, Sergei

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

* RE: The new "real" console doesn't display printk() messages like "early" console!
@ 2010-11-22 20:51             ` Ardelean, Andrei
  0 siblings, 0 replies; 17+ messages in thread
From: Ardelean, Andrei @ 2010-11-22 20:51 UTC (permalink / raw)
  To: Sergei Shtylyov; +Cc: Ricardo Mendoza, linux-mips

Hi Sergei,

"     Are your UART registers identity mapped to virtual address space?"

My system has DDR memory 0x80000000..0x90000000 (kseg0) and UART is
mapped starting with bbf01000 (kseg1). Can you give me some details
about your question? 

I didn't do anything special for the port other than 
	set_io_port_base(GD_PORT_BASE); 
in gd-init.c


Thanks,
Andrei
 



-----Original Message-----
From: Sergei Shtylyov [mailto:sshtylyov@mvista.com] 
Sent: Friday, November 19, 2010 11:09 AM
To: Ardelean, Andrei
Cc: Ricardo Mendoza; linux-mips@linux-mips.org
Subject: Re: The new "real" console doesn't display printk() messages
like "early" console!

Ardelean, Andrei wrote:

> Hi Ricardo,

> I implemented serial platform driver taking as model serial.c from
> cavium-octeon.

    I think you should really have used something simpler as an example.

> Here is my code:


> /*
>  * This file is subject to the terms and conditions of the GNU General
> Public
>  * License.  See the file "COPYING" in the main directory of this
> archive
>  * for more details.
>  *
>  * Copyright (C) 2004-2007 Cavium Networks
>  */
>  
> #include <linux/console.h>
> #include <linux/module.h>
> #include <linux/init.h>
> #include <linux/platform_device.h>
> #include <linux/serial.h>
> #include <linux/serial_8250.h>
> #include <linux/serial_reg.h>
> #include <linux/tty.h>
> #include <asm/time.h>
> #include <sys_defs.h>
> 
> 
> #ifdef CONFIG_GDB_CONSOLE

    This is never defined for MIPS. And there shouldn't be such
dependencies.

> #define DEBUG_UART 0
> #else
> #define DEBUG_UART 1
> #endif
> 
> unsigned int gd_serial_in(struct uart_port *up, int offset)
> {
> 	int rv = inl((unsigned int)(up->membase + (offset << 2)));

    Should be an empty line here.

> 	if (offset == UART_IIR && (rv & 0xf) == 7) {

    Are you sure this Octeon specific quirk also allpies to your UART?

> 		/* Busy interrupt, read the USR (39) and try again. */
> 		inl((unsigned int)(up->membase + (39 << 2)));
> 		rv = inl((unsigned int)(up->membase + (offset << 2)));
> 	}
> 	return rv;
> }
> 
> void gd_serial_out(struct uart_port *up, int offset, int value)
> {
> 	outl( value & 0xff, (unsigned int)(up->membase + (offset <<

    No spaces allowed after (.

> 2)));
> }
> 
> /*
>  * Allocated in .bss, so it is all zeroed.
>  */
> #define GD_MAX_UARTS 1

    Then how DEBUG_UART can be 1?

> static struct plat_serial8250_port gd_uart8250_data[GD_MAX_UARTS + 1];
> static struct platform_device gd_uart8250_device = {
> 	.name			= "serial8250",
> 	.id			= PLAT8250_DEV_PLATFORM,
> 	.dev			= {
> 		.platform_data	= gd_uart8250_data,

    Where is 'gd_uart8250_data'?

> 	},
> };

> static void __init gd_uart_set_common(struct plat_serial8250_port *p)
> {
> 	p->flags = ASYNC_SKIP_TEST | UPF_SHARE_IRQ | UPF_FIXED_TYPE;
> 	p->type = PORT_GD;

    What is PORT_GD?

> 	p->iotype = UPIO_MEM;

    Judging from your code, it should be UPIO_MEM32.

> 	p->regshift = 2;	/* I/O addresses are every 4 bytes */
> 	p->uartclk = UART_CLK;  
> 	p->serial_in = gd_serial_in;
> 	p->serial_out = gd_serial_out;
> }
> 
> static int __init gd_serial_init(void)
> {
> 	int enable_uart0;
> 	struct plat_serial8250_port *p;
> 
> 	enable_uart0 = 1;

    What's the point in existence of this variable?

> 	p = gd_uart8250_data;
> 	if (enable_uart0) {
> 		/* Add a ttyS device for hardware uart 0 */
> 		gd_uart_set_common(p);
> 		p->membase = (void *) offMCU_UART_THR_OR_RBR_OR_DLL;
> 		p->mapbase = offMCU_UART_THR_OR_RBR_OR_DLL;

     Are your UART registers identity mapped to virtual address space?
You are not obliged to pass 'membase', unless you have pre-existing
mapping but 
in this case you also need to pass UPF_IOREMAP in 'flags'.

> 		p->irq = MIPSCPU_INT_UART;
> 		p++;
> 	}

> 	return platform_device_register(&gd_uart8250_device);
> }
> 
> device_initcall(gd_serial_init);


>
------------------------------------------------------------------------
> -----------------------
> 
> Thanks,
> Andrei

WBR, Sergei

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

* RE: The new "real" console doesn't display printk() messages like "early" console!
@ 2010-11-22 20:51             ` Ardelean, Andrei
  0 siblings, 0 replies; 17+ messages in thread
From: Ardelean, Andrei @ 2010-11-22 20:51 UTC (permalink / raw)
  To: Sergei Shtylyov; +Cc: Ricardo Mendoza, linux-mips

Hi Sergei,

"     Are your UART registers identity mapped to virtual address space?"

My system has DDR memory 0x80000000..0x90000000 (kseg0) and UART is
mapped starting with bbf01000 (kseg1). Can you give me some details
about your question? 

I didn't do anything special for the port other than 
	set_io_port_base(GD_PORT_BASE); 
in gd-init.c


Thanks,
Andrei
 



-----Original Message-----
From: Sergei Shtylyov [mailto:sshtylyov@mvista.com] 
Sent: Friday, November 19, 2010 11:09 AM
To: Ardelean, Andrei
Cc: Ricardo Mendoza; linux-mips@linux-mips.org
Subject: Re: The new "real" console doesn't display printk() messages
like "early" console!

Ardelean, Andrei wrote:

> Hi Ricardo,

> I implemented serial platform driver taking as model serial.c from
> cavium-octeon.

    I think you should really have used something simpler as an example.

> Here is my code:


> /*
>  * This file is subject to the terms and conditions of the GNU General
> Public
>  * License.  See the file "COPYING" in the main directory of this
> archive
>  * for more details.
>  *
>  * Copyright (C) 2004-2007 Cavium Networks
>  */
>  
> #include <linux/console.h>
> #include <linux/module.h>
> #include <linux/init.h>
> #include <linux/platform_device.h>
> #include <linux/serial.h>
> #include <linux/serial_8250.h>
> #include <linux/serial_reg.h>
> #include <linux/tty.h>
> #include <asm/time.h>
> #include <sys_defs.h>
> 
> 
> #ifdef CONFIG_GDB_CONSOLE

    This is never defined for MIPS. And there shouldn't be such
dependencies.

> #define DEBUG_UART 0
> #else
> #define DEBUG_UART 1
> #endif
> 
> unsigned int gd_serial_in(struct uart_port *up, int offset)
> {
> 	int rv = inl((unsigned int)(up->membase + (offset << 2)));

    Should be an empty line here.

> 	if (offset == UART_IIR && (rv & 0xf) == 7) {

    Are you sure this Octeon specific quirk also allpies to your UART?

> 		/* Busy interrupt, read the USR (39) and try again. */
> 		inl((unsigned int)(up->membase + (39 << 2)));
> 		rv = inl((unsigned int)(up->membase + (offset << 2)));
> 	}
> 	return rv;
> }
> 
> void gd_serial_out(struct uart_port *up, int offset, int value)
> {
> 	outl( value & 0xff, (unsigned int)(up->membase + (offset <<

    No spaces allowed after (.

> 2)));
> }
> 
> /*
>  * Allocated in .bss, so it is all zeroed.
>  */
> #define GD_MAX_UARTS 1

    Then how DEBUG_UART can be 1?

> static struct plat_serial8250_port gd_uart8250_data[GD_MAX_UARTS + 1];
> static struct platform_device gd_uart8250_device = {
> 	.name			= "serial8250",
> 	.id			= PLAT8250_DEV_PLATFORM,
> 	.dev			= {
> 		.platform_data	= gd_uart8250_data,

    Where is 'gd_uart8250_data'?

> 	},
> };

> static void __init gd_uart_set_common(struct plat_serial8250_port *p)
> {
> 	p->flags = ASYNC_SKIP_TEST | UPF_SHARE_IRQ | UPF_FIXED_TYPE;
> 	p->type = PORT_GD;

    What is PORT_GD?

> 	p->iotype = UPIO_MEM;

    Judging from your code, it should be UPIO_MEM32.

> 	p->regshift = 2;	/* I/O addresses are every 4 bytes */
> 	p->uartclk = UART_CLK;  
> 	p->serial_in = gd_serial_in;
> 	p->serial_out = gd_serial_out;
> }
> 
> static int __init gd_serial_init(void)
> {
> 	int enable_uart0;
> 	struct plat_serial8250_port *p;
> 
> 	enable_uart0 = 1;

    What's the point in existence of this variable?

> 	p = gd_uart8250_data;
> 	if (enable_uart0) {
> 		/* Add a ttyS device for hardware uart 0 */
> 		gd_uart_set_common(p);
> 		p->membase = (void *) offMCU_UART_THR_OR_RBR_OR_DLL;
> 		p->mapbase = offMCU_UART_THR_OR_RBR_OR_DLL;

     Are your UART registers identity mapped to virtual address space?
You are not obliged to pass 'membase', unless you have pre-existing
mapping but 
in this case you also need to pass UPF_IOREMAP in 'flags'.

> 		p->irq = MIPSCPU_INT_UART;
> 		p++;
> 	}

> 	return platform_device_register(&gd_uart8250_device);
> }
> 
> device_initcall(gd_serial_init);


>
------------------------------------------------------------------------
> -----------------------
> 
> Thanks,
> Andrei

WBR, Sergei

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

* Re: The new "real" console doesn't display printk() messages like "early" console!
  2010-11-22 20:51             ` Ardelean, Andrei
  (?)
@ 2010-11-22 21:02             ` David Daney
  -1 siblings, 0 replies; 17+ messages in thread
From: David Daney @ 2010-11-22 21:02 UTC (permalink / raw)
  To: Ardelean, Andrei; +Cc: Sergei Shtylyov, Ricardo Mendoza, linux-mips

On 11/22/2010 12:51 PM, Ardelean, Andrei wrote:
> Hi Sergei,
>
> "     Are your UART registers identity mapped to virtual address space?"
>
> My system has DDR memory 0x80000000..0x90000000 (kseg0) and UART is
> mapped starting with bbf01000 (kseg1). Can you give me some details
> about your question?
>
> I didn't do anything special for the port other than
> 	set_io_port_base(GD_PORT_BASE);
> in gd-init.c
>
>

I think you need to reset your process here.

First you should probably get a prom_putchar() function working.  Then 
enable CONFIG_EARLY_PRINTK.  That will enable you to debug many things.

If need be, you can write a trivial prom_puts() to go with your 
prom_putchar().

If you have two serial ports available, all the better.  Use one for 
printing debugging information and the other as the port you are trying 
to debug.

Asking people to stare at the thousands of lines of code that make up 
the serial I/O system and spot the error in your configuration will 
probably be less fruitful than tracing through it to find the problem.

David Daney

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

end of thread, other threads:[~2010-11-22 21:03 UTC | newest]

Thread overview: 17+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-11-18 18:55 The new "real" console doesn't display printk() messages like "early" console! Ardelean, Andrei
2010-11-18 18:55 ` Ardelean, Andrei
2010-11-18 19:20 ` Sergei Shtylyov
2010-11-18 20:04   ` Ardelean, Andrei
2010-11-18 20:04     ` Ardelean, Andrei
2010-11-18 21:21     ` Ricardo Mendoza
2010-11-18 22:01       ` Ardelean, Andrei
2010-11-18 22:01         ` Ardelean, Andrei
2010-11-18 23:58         ` Ricardo Mendoza
2010-11-19 14:04           ` Ardelean, Andrei
2010-11-19 14:04             ` Ardelean, Andrei
2010-11-19 16:08         ` Sergei Shtylyov
2010-11-22 16:37           ` Ardelean, Andrei
2010-11-22 16:37             ` Ardelean, Andrei
2010-11-22 20:51           ` Ardelean, Andrei
2010-11-22 20:51             ` Ardelean, Andrei
2010-11-22 21:02             ` David Daney

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.