Re: [PATCH 9/21] KGDB: This adds basic support to the MIPS architecture

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, 15 Oct 2007 13:33:07 -0500, Jason Wessel <[email protected]> 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
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Stuff]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]     [Linux Resources]
  Powered by Linux