* Linux 2.6-10.rc3 8xx: debugging (over-writing) content of bd_in fo structure in the kernel booting code
@ 2005-01-18 11:45 Povolotsky, Alexander
2005-01-18 12:20 ` Hans Schillstrom
0 siblings, 1 reply; 3+ messages in thread
From: Povolotsky, Alexander @ 2005-01-18 11:45 UTC (permalink / raw)
To: 'linuxppc-embedded@ozlabs.org'
I am now suspecting that the content of my bd_info structure is set or is
handled incorrectly,
thus causing incorrect behavior of the serial driver upon kernel booting
(only 3 characters are printed correctly and the rest is the garbage - as I
reported before),
so I am trying (for debugging purposes) to over-write the values, passed
from bd_info
during the kernel booting, by the hard-coded "correct" values.
So far I tried forcing baud, bits, parity, flow directly in in
cpm_uart_console_setup()
( drivers/serial/cpm_uart/cpm_uar t_core.c ) - see below - it didn't help
...
Where in the kernel booting code the clock speed is handled (it also comes
from the bd_info)
- so I could try to force set clock speed there ?
Thanks,
Alex
****************************************************************
static int __init cpm_uart_console_setup(struct console *co, char *options)
{
struct uart_port *port;
struct uart_cpm_port *pinfo;
int baud = 38400;
int bits = 8;
int parity = 'n';
int flow = 'n';
int ret;
port =
(struct uart_port
*)&cpm_uart_ports[cpm_uart_port_map[co->index]];
pinfo = (struct uart_cpm_port *)port;
pinfo->flags |= FLAG_CONSOLE;
if (options) {
uart_parse_options(options, &baud, &parity, &bits, &flow);
} else {
bd_t *bd = (bd_t *) __res;
if (bd->bi_baudrate)
baud = bd->bi_baudrate;
else
baud = 9600;
}
baud = 38400;
<<===========================================
parity = 'n';
<<===========================================
flow = 'n';
<<===========================================
bits = 8;
<<===========================================
/*
* Setup any port IO, connect any baud rate generators,
* etc. This is expected to be handled by board
* dependant code
*/
if (pinfo->set_lineif)
pinfo->set_lineif(pinfo);
if (IS_SMC(pinfo)) {
pinfo->smcp->smc_smcm &= ~(SMCM_RX | SMCM_TX);
pinfo->smcp->smc_smcmr &= ~(SMCMR_REN | SMCMR_TEN);
} else {
pinfo->sccp->scc_sccm &= ~(UART_SCCM_TX | UART_SCCM_RX);
pinfo->sccp->scc_gsmrl &= ~(SCC_GSMRL_ENR | SCC_GSMRL_ENT);
}
ret = cpm_uart_allocbuf(pinfo, 1);
if (ret)
return ret;
cpm_uart_initbd(pinfo);
if (IS_SMC(pinfo))
cpm_uart_init_smc(pinfo);
else
cpm_uart_init_scc(pinfo);
uart_set_options(port, co, baud, parity, bits, flow);
return 0;
}
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: Linux 2.6-10.rc3 8xx: debugging (over-writing) content of bd_in fo structure in the kernel booting code
2005-01-18 11:45 Linux 2.6-10.rc3 8xx: debugging (over-writing) content of bd_in fo structure in the kernel booting code Povolotsky, Alexander
@ 2005-01-18 12:20 ` Hans Schillstrom
0 siblings, 0 replies; 3+ messages in thread
From: Hans Schillstrom @ 2005-01-18 12:20 UTC (permalink / raw)
To: Povolotsky, Alexander; +Cc: 'linuxppc-embedded@ozlabs.org'
Hi Alex,
On Tue, 2005-01-18 at 12:45, Povolotsky, Alexander wrote:
> I am now suspecting that the content of my bd_info structure is set or is
> handled incorrectly,
> thus causing incorrect behavior of the serial driver upon kernel booting
> (only 3 characters are printed correctly and the rest is the garbage - as I
> reported before),
> so I am trying (for debugging purposes) to over-write the values, passed
> from bd_info
> during the kernel booting, by the hard-coded "correct" values.
>
> So far I tried forcing baud, bits, parity, flow directly in in
> cpm_uart_console_setup()
> ( drivers/serial/cpm_uart/cpm_uar t_core.c ) - see below - it didn't help
> ...
>
> Where in the kernel booting code the clock speed is handled (it also comes
> from the bd_info)
> - so I could try to force set clock speed there ?
Have a look into ppc/8xx_io/commproc.c
There you have the baudrate dependency - "bi_intfreq"
#define BRG_INT_CLK (((bd_t *)__res)->bi_intfreq)
#define BRG_UART_CLK (BRG_INT_CLK/16)
#define BRG_UART_CLK_DIV16 (BRG_UART_CLK/16)
void
cpm_setbrg(uint brg, uint rate)
{
...
/Hans
>
> Thanks,
> Alex
> ****************************************************************
> static int __init cpm_uart_console_setup(struct console *co, char *options)
> {
> struct uart_port *port;
> struct uart_cpm_port *pinfo;
> int baud = 38400;
> int bits = 8;
> int parity = 'n';
> int flow = 'n';
> int ret;
>
> port =
> (struct uart_port
> *)&cpm_uart_ports[cpm_uart_port_map[co->index]];
> pinfo = (struct uart_cpm_port *)port;
>
> pinfo->flags |= FLAG_CONSOLE;
>
> if (options) {
> uart_parse_options(options, &baud, &parity, &bits, &flow);
> } else {
> bd_t *bd = (bd_t *) __res;
>
> if (bd->bi_baudrate)
> baud = bd->bi_baudrate;
> else
> baud = 9600;
> }
> baud = 38400;
> <<===========================================
> parity = 'n';
> <<===========================================
> flow = 'n';
> <<===========================================
> bits = 8;
> <<===========================================
> /*
> * Setup any port IO, connect any baud rate generators,
> * etc. This is expected to be handled by board
> * dependant code
> */
> if (pinfo->set_lineif)
> pinfo->set_lineif(pinfo);
>
> if (IS_SMC(pinfo)) {
> pinfo->smcp->smc_smcm &= ~(SMCM_RX | SMCM_TX);
> pinfo->smcp->smc_smcmr &= ~(SMCMR_REN | SMCMR_TEN);
> } else {
> pinfo->sccp->scc_sccm &= ~(UART_SCCM_TX | UART_SCCM_RX);
> pinfo->sccp->scc_gsmrl &= ~(SCC_GSMRL_ENR | SCC_GSMRL_ENT);
> }
>
> ret = cpm_uart_allocbuf(pinfo, 1);
>
> if (ret)
> return ret;
>
> cpm_uart_initbd(pinfo);
>
> if (IS_SMC(pinfo))
> cpm_uart_init_smc(pinfo);
> else
> cpm_uart_init_scc(pinfo);
>
> uart_set_options(port, co, baud, parity, bits, flow);
>
> return 0;
> }
>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: Linux 2.6-10.rc3 8xx: debugging (over-writing) content of bd_in fo structure in the kernel booting code
2005-01-18 15:01 Linux 2.6-10.rc3 8xx: debugging (over-writing) content of b d_in " Povolotsky, Alexander
@ 2005-01-18 15:23 ` Mark Chambers
0 siblings, 0 replies; 3+ messages in thread
From: Mark Chambers @ 2005-01-18 15:23 UTC (permalink / raw)
To: Povolotsky, Alexander, linuxppc-embedded
>
> So what could go wrong here in terms of setting the baudrate for the
serial
> uart
> (which "presumably" causes printing 3 good characters and then garbage
> during kernel booting) ?
>
If you can get your hands on an oscilloscope and look at the TxD from your
board, you can get an exact measurement of your baudrate and make sure
you are on the right track. (Baudrate = 1/shortest-high-or-low-time)
Mark Chambers
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2005-01-18 15:19 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-01-18 11:45 Linux 2.6-10.rc3 8xx: debugging (over-writing) content of bd_in fo structure in the kernel booting code Povolotsky, Alexander
2005-01-18 12:20 ` Hans Schillstrom
-- strict thread matches above, loose matches on Subject: below --
2005-01-18 15:01 Linux 2.6-10.rc3 8xx: debugging (over-writing) content of b d_in " Povolotsky, Alexander
2005-01-18 15:23 ` Linux 2.6-10.rc3 8xx: debugging (over-writing) content of bd_in " Mark Chambers
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).