mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Atsushi Nemoto <anemo@mba.ocn.ne.jp>
To: jason.wessel@windriver.com
Cc: linux-kernel@vger.kernel.org, ralf@linux-mips.org
Subject: Re: [PATCH 9/21] KGDB: This adds basic support to the MIPS architecture
Date: Wed, 17 Oct 2007 02:48:12 +0900 (JST)	[thread overview]
Message-ID: <20071017.024812.11596022.anemo@mba.ocn.ne.jp> (raw)
In-Reply-To: <4713B263.5090909@windriver.com> <mailman.0.1192554001.20421.linux-kernel-daily-digest@lists.us.dell.com>

On Mon, 15 Oct 2007 13:33:07 -0500, Jason Wessel <jason.wessel@windriver.com> wrote:
> --- /dev/null
> +++ b/drivers/serial/serial_txx9_kgdb.c
> @@ -0,0 +1,152 @@

Thank you for attempting to mainline it.  I have some cosmetic comments.

> +static inline unsigned int sio_in(struct uart_port *port, int offset)
> +{
> +	return *(volatile u32 *)(port->membase + offset);
> +}
> +
> +static inline void sio_out(struct uart_port *port, int offset,
> +	unsigned int value)
> +{
> +	*(volatile u32 *)(port->membase + offset) = value;
> +}

It would be better to avoid volatile.

static inline unsigned int sio_in(struct uart_port *port, int offset)
{
	return __raw_readl(port->membase + offset);
}

static inline void sio_out(struct uart_port *port, int offset,
	unsigned int value)
{
	__raw_writel(value, port->membase + offset);
}

> +	/* Reset the UART. */
> +	sio_out(kgdb_port, TXX9_SIFCR, TXX9_SIFCR_SWRST);
> +#ifdef CONFIG_CPU_TX49XX
> +	/*
> +	 * TX4925 BUG WORKAROUND.  Accessing SIOC register
> +	 * immediately after soft reset causes bus error.
> +	 */
> +	iob();
> +	udelay(1);
> +#endif
> +	/* Wait until reset is complete. */
> +	while (sio_in(kgdb_port, TXX9_SIFCR) & TXX9_SIFCR_SWRST);

A while ago, this part of serial_txx9.c was changed a bit (no ifdefs,
avoid endless loop).  Could you change it to:

	unsigned int tmout = 10000;

	sio_out(kgdb_port, TXX9_SIFCR, TXX9_SIFCR_SWRST);
	/* TX4925 BUG WORKAROUND.  Accessing SIOC register
	 * immediately after soft reset causes bus error. */
	mmiowb();
	udelay(1);
	while ((sio_in(kgdb_port, TXX9_SIFCR) & TXX9_SIFCR_SWRST) && --tmout)
		udelay(1);

> +	/* Select the input clock prescaler that fits the baud rate. */
> +	quot = (kgdb_port->uartclk + 8 * kgdb_txx9_baud) /
> +		(16 * kgdb_txx9_baud);

uart_get_divisor() can be used here:

	quot = uart_get_divisor(kgdb_port, kgdb_txx9_baud);

> +	if (quot < (256 << 1))
> +		sibgr = (quot >> 1) | TXX9_SIBGR_BCLK_T0;
> +	else if (quot < ( 256 << 3))
> +		sibgr = (quot >> 3) | TXX9_SIBGR_BCLK_T2;
> +	else if (quot < ( 256 << 5))
> +		sibgr = (quot >> 5) | TXX9_SIBGR_BCLK_T4;
> +	else if (quot < ( 256 << 7))
> +		sibgr = (quot >> 7) | TXX9_SIBGR_BCLK_T6;
> +	else
> +		sibgr = 0xff | TXX9_SIBGR_BCLK_T6;

It would be better to do it more similar to serial_txx9.c:

	quot >>= 1;
	if (quot < 256)
		sibgr = quot | TXX9_SIBGR_BCLK_T0;
	else if (quot < (256 << 2))
		sibgr = (quot >> 2) | TXX9_SIBGR_BCLK_T2;
	else if (quot < (256 << 4))
		sibgr = (quot >> 4) | TXX9_SIBGR_BCLK_T4;
	else if (quot < (256 << 6))
		sibgr = (quot >> 6) | TXX9_SIBGR_BCLK_T6;
	else
		sibgr = 0xff | TXX9_SIBGR_BCLK_T6;

---
Atsushi Nemoto

      parent reply	other threads:[~2007-10-16 17:46 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-10-15 18:33 Jason Wessel
     [not found] ` <mailman.0.1192554001.20421.linux-kernel-daily-digest@lists.us.dell.com>
2007-10-16 17:48   ` Atsushi Nemoto [this message]

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=20071017.024812.11596022.anemo@mba.ocn.ne.jp \
    --to=anemo@mba.ocn.ne.jp \
    --cc=jason.wessel@windriver.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=ralf@linux-mips.org \
    /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

all inboxes | Powered by JetHome®