On Fri, 19 Mar 2010 16:39:57 +0800
Christian Pellegrin <[email protected]> wrote:
> +#ifdef CONFIG_SERIAL_MAX3100_CONSOLE
> +
> +static void max3100_console_putchar(struct uart_port *port, int ch)
> +{
> + struct max3100_port *s = container_of(port, struct
> max3100_port, port);
> + unsigned long tout = 10 * HZ / 1000; /* 10ms */
> + unsigned long start;
> + u16 tx, rx;
> +
> + if (tout == 0)
> + tout = 1;
> + start = jiffies;
> + do {
> + tx = MAX3100_RC;
> + max3100_sr(s, tx, &rx);
Hi Christian,
You'd better not call max3110_sr (which calls spi_sync) here, a console's
putchar() func may be called in some atomic context.
I used similar method when I started to implement a console, but then I switch
to current method in my 3110 driver: save the printk buffer inside putchar,
and wake up a thread to really handle the spi transfer later.
Thanks,
Feng
> + } while ((rx & MAX3100_T) == 0 &&
> + !time_after(jiffies, start + tout));
> + tx = ch;
> + max3100_calc_parity(s, &tx);
> + tx |= MAX3100_WD | MAX3100_RTS;
> + max3100_sr(s, tx, &rx);
> +}
> +
> +static void max3100_console_write(struct console *co,
> + const char *str, unsigned int
> count) +{
> + struct max3100_port *s = max3100s[co->index];;
> +
> + uart_console_write(&s->port, str, count,
> max3100_console_putchar); +}
------------------------------------------------------------------------------
Download Intel® Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
_______________________________________________
spi-devel-general mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/spi-devel-general