linux-spi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Feng Tang <feng.tang@intel.com>
To: Christian Pellegrin <chripell@fsfe.org>
Cc: "akpm@linux-foundation.org" <akpm@linux-foundation.org>,
	"greg@kroah.com" <greg@kroah.com>,
	"david-b@pacbell.net" <david-b@pacbell.net>,
	"grant.likely@secretlab.ca" <grant.likely@secretlab.ca>,
	"alan@lxorguk.ukuu.org.uk" <alan@lxorguk.ukuu.org.uk>,
	"spi-devel-general@lists.sourceforge.net"
	<spi-devel-general@lists.sourceforge.net>,
	"linux-serial@vger.kernel.org" <linux-serial@vger.kernel.org>,
	Christian Pellegrin <chripell@fsfe.org>
Subject: Re: [PATCH 3/3] max3100: adds console support for MAX3100
Date: Mon, 22 Mar 2010 09:31:57 +0800	[thread overview]
Message-ID: <20100322093157.705bf458@feng-i7> (raw)
In-Reply-To: <1268987997-22746-1-git-send-email-chripell@fsfe.org>

On Fri, 19 Mar 2010 16:39:57 +0800
Christian Pellegrin <chripell@fsfe.org> 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); +}


  parent reply	other threads:[~2010-03-22  1:31 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-03-19  8:39 [PATCH 0/3] max3100: improvements christian pellegrin
     [not found] ` <cabda6421003190139h344bc172h3556fca78e4b25cb-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2010-03-19  8:38   ` [PATCH 1/3] max3100: added raise_threaded_irq Christian Pellegrin
2010-03-19 17:48     ` Grant Likely
2010-03-21  7:31       ` christian pellegrin
2010-03-19  8:39   ` [PATCH 2/3] max3100: moved to threaded interrupt Christian Pellegrin
2010-03-19 17:58     ` Grant Likely
2010-03-21  7:34       ` christian pellegrin
2010-03-19  8:39   ` [PATCH 3/3] max3100: adds console support for MAX3100 Christian Pellegrin
2010-03-19 19:31     ` Grant Likely
2010-03-21  7:47       ` christian pellegrin
     [not found]         ` <cabda6421003210047i1d4545aasf8969bb70d48ceb9-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2010-03-21 16:28           ` David Brownell
2010-03-22  1:31     ` Feng Tang [this message]
2010-03-22  7:03       ` christian pellegrin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20100322093157.705bf458@feng-i7 \
    --to=feng.tang@intel.com \
    --cc=akpm@linux-foundation.org \
    --cc=alan@lxorguk.ukuu.org.uk \
    --cc=chripell@fsfe.org \
    --cc=david-b@pacbell.net \
    --cc=grant.likely@secretlab.ca \
    --cc=greg@kroah.com \
    --cc=linux-serial@vger.kernel.org \
    --cc=spi-devel-general@lists.sourceforge.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).