All of lore.kernel.org
 help / color / mirror / Atom feed
From: Russell King - ARM Linux <linux@arm.linux.org.uk>
To: Andre Przywara <andre.przywara@arm.com>
Cc: Peter Hurley <peter@hurleysoftware.com>,
	Andrew.Jackson@arm.com, Timur Tabi <timur@tabi.org>,
	linux-serial@vger.kernel.org, Jun Nie <jun.nie@linaro.org>,
	linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH DRAFT 2/2] drivers: serial: PL011: [DRAFT] implement register diverson for ZTE UART
Date: Tue, 3 Nov 2015 13:46:06 +0000	[thread overview]
Message-ID: <20151103134605.GW8644@n2100.arm.linux.org.uk> (raw)
In-Reply-To: <1446467042-24494-3-git-send-email-andre.przywara@arm.com>

On Mon, Nov 02, 2015 at 12:24:02PM +0000, Andre Przywara wrote:
> +int reg_table_zte[] = {
> +	[UART01x_DR]	= ZX_UART01x_DR,

No entry for RSR, so the value will be zero.  That means when we read
the RSR, we'll be reading the register at offset 0.  Maybe that's
intentional, maybe it isn't, but it's totally screwy.

Someone needs to document what the register layout for the ZTE UART
is.  Better still, point to where the spec can be found.

> +	[UART011_LCRH]	= ZX_UART011_LCRH_TX,
> +	[UART011_CR]	= ZX_UART011_CR,
> +	[UART01x_FR]	= ZX_UART01x_FR,
> +	[UART011_ICR]	= ZX_UART011_ICR,
> +	[UART011_IBRD]	= UART011_IBRD,
> +	[UART011_FBRD]	= UART011_FBRD,
> +	[UART011_IFLS]	= ZX_UART011_IFLS,
> +	[UART011_IMSC]	= ZX_UART011_IMSC,
> +	[UART011_RIS]	= ZX_UART011_RIS,
> +	[UART011_MIS]	= ZX_UART011_MIS,
> +	[UART011_DMACR]	= ZX_UART011_DMACR,
> +};
>  static unsigned int pl011_read(struct uart_amba_port *uap, int offset)
>  {
> +#ifdef CONFIG_SOC_ZX296702
> +	if (uap->vendor->reg_table)
> +		offset = uap->vendor->reg_table[offset];
> +#endif
>  	return readw(uap->port.membase + offset);
>  }
>  
>  static void pl011_write(struct uart_amba_port *uap, int val, int offset)
>  {
> +#ifdef CONFIG_SOC_ZX296702
> +	if (uap->vendor->reg_table)
> +		offset = uap->vendor->reg_table[offset];
> +#endif
>  	writew(val, uap->port.membase + offset);
>  }
>  
> diff --git a/include/linux/amba/serial.h b/include/linux/amba/serial.h
> index 0ddb5c0..1c71b83 100644
> --- a/include/linux/amba/serial.h
> +++ b/include/linux/amba/serial.h
> @@ -31,6 +31,7 @@
>   *  UART Register Offsets.
>   */
>  #define UART01x_DR		0x00	/* Data read or written from the interface. */
> +#define ZX_UART01x_DR		0x04	/* Different offset in the ZTE UART. */
>  #define UART01x_RSR		0x04	/* Receive status register (Read). */
>  #define UART01x_ECR		0x04	/* Error clear register (Write). */
>  #define UART010_LCRH		0x08	/* Line control register, high byte. */
> @@ -39,6 +40,7 @@
>  #define ST_UART011_TIMEOUT	0x0C    /* Timeout period register. */
>  #define UART010_LCRL		0x10	/* Line control register, low byte. */
>  #define UART010_CR		0x14	/* Control register. */
> +#define ZX_UART01x_FR		0x14	/* Different offset in the ZTE UART. */
>  #define UART01x_FR		0x18	/* Flag register (Read only). */
>  #define UART010_IIR		0x1C	/* Interrupt identification register (Read). */
>  #define UART010_ICR		0x1C	/* Interrupt clear register (Write). */
> @@ -48,14 +50,22 @@
>  #define UART011_FBRD		0x28	/* Fractional baud rate divisor register. */
>  #define UART011_LCRH		0x2c	/* Line control register. */
>  #define ST_UART011_LCRH_TX	0x2c    /* Tx Line control register. */
> +#define ZX_UART011_LCRH_TX	0x30    /* Different offset in the ZTE UART. */
>  #define UART011_CR		0x30	/* Control register. */
>  #define UART011_IFLS		0x34	/* Interrupt fifo level select. */
> +#define ZX_UART011_CR		0x34	/* Different offset in the ZTE UART. */
> +#define ZX_UART011_IFLS		0x38	/* Different offset in the ZTE UART. */
>  #define UART011_IMSC		0x38	/* Interrupt mask. */
>  #define UART011_RIS		0x3c	/* Raw interrupt status. */
>  #define UART011_MIS		0x40	/* Masked interrupt status. */
> +#define ZX_UART011_IMSC		0x40	/* Different offset in the ZTE UART. */
>  #define UART011_ICR		0x44	/* Interrupt clear register. */
> +#define ZX_UART011_RIS		0x44	/* Different offset in the ZTE UART. */
>  #define UART011_DMACR		0x48	/* DMA control register. */
> +#define ZX_UART011_MIS		0x48	/* Different offset in the ZTE UART. */
> +#define ZX_UART011_ICR		0x4c	/* Different offset in the ZTE UART. */
>  #define ST_UART011_XFCR		0x50	/* XON/XOFF control register. */
> +#define ZX_UART011_DMACR	0x50	/* Different offset in the ZTE UART. */
>  #define ST_UART011_XON1		0x54	/* XON1 register. */
>  #define ST_UART011_XON2		0x58	/* XON2 register. */
>  #define ST_UART011_XOFF1	0x5C	/* XON1 register. */
> -- 
> 2.5.1
> 

-- 
FTTC broadband for 0.8mile line: currently at 9.6Mbps down 400kbps up
according to speedtest.net.

WARNING: multiple messages have this Message-ID (diff)
From: linux@arm.linux.org.uk (Russell King - ARM Linux)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH DRAFT 2/2] drivers: serial: PL011: [DRAFT] implement register diverson for ZTE UART
Date: Tue, 3 Nov 2015 13:46:06 +0000	[thread overview]
Message-ID: <20151103134605.GW8644@n2100.arm.linux.org.uk> (raw)
In-Reply-To: <1446467042-24494-3-git-send-email-andre.przywara@arm.com>

On Mon, Nov 02, 2015 at 12:24:02PM +0000, Andre Przywara wrote:
> +int reg_table_zte[] = {
> +	[UART01x_DR]	= ZX_UART01x_DR,

No entry for RSR, so the value will be zero.  That means when we read
the RSR, we'll be reading the register at offset 0.  Maybe that's
intentional, maybe it isn't, but it's totally screwy.

Someone needs to document what the register layout for the ZTE UART
is.  Better still, point to where the spec can be found.

> +	[UART011_LCRH]	= ZX_UART011_LCRH_TX,
> +	[UART011_CR]	= ZX_UART011_CR,
> +	[UART01x_FR]	= ZX_UART01x_FR,
> +	[UART011_ICR]	= ZX_UART011_ICR,
> +	[UART011_IBRD]	= UART011_IBRD,
> +	[UART011_FBRD]	= UART011_FBRD,
> +	[UART011_IFLS]	= ZX_UART011_IFLS,
> +	[UART011_IMSC]	= ZX_UART011_IMSC,
> +	[UART011_RIS]	= ZX_UART011_RIS,
> +	[UART011_MIS]	= ZX_UART011_MIS,
> +	[UART011_DMACR]	= ZX_UART011_DMACR,
> +};
>  static unsigned int pl011_read(struct uart_amba_port *uap, int offset)
>  {
> +#ifdef CONFIG_SOC_ZX296702
> +	if (uap->vendor->reg_table)
> +		offset = uap->vendor->reg_table[offset];
> +#endif
>  	return readw(uap->port.membase + offset);
>  }
>  
>  static void pl011_write(struct uart_amba_port *uap, int val, int offset)
>  {
> +#ifdef CONFIG_SOC_ZX296702
> +	if (uap->vendor->reg_table)
> +		offset = uap->vendor->reg_table[offset];
> +#endif
>  	writew(val, uap->port.membase + offset);
>  }
>  
> diff --git a/include/linux/amba/serial.h b/include/linux/amba/serial.h
> index 0ddb5c0..1c71b83 100644
> --- a/include/linux/amba/serial.h
> +++ b/include/linux/amba/serial.h
> @@ -31,6 +31,7 @@
>   *  UART Register Offsets.
>   */
>  #define UART01x_DR		0x00	/* Data read or written from the interface. */
> +#define ZX_UART01x_DR		0x04	/* Different offset in the ZTE UART. */
>  #define UART01x_RSR		0x04	/* Receive status register (Read). */
>  #define UART01x_ECR		0x04	/* Error clear register (Write). */
>  #define UART010_LCRH		0x08	/* Line control register, high byte. */
> @@ -39,6 +40,7 @@
>  #define ST_UART011_TIMEOUT	0x0C    /* Timeout period register. */
>  #define UART010_LCRL		0x10	/* Line control register, low byte. */
>  #define UART010_CR		0x14	/* Control register. */
> +#define ZX_UART01x_FR		0x14	/* Different offset in the ZTE UART. */
>  #define UART01x_FR		0x18	/* Flag register (Read only). */
>  #define UART010_IIR		0x1C	/* Interrupt identification register (Read). */
>  #define UART010_ICR		0x1C	/* Interrupt clear register (Write). */
> @@ -48,14 +50,22 @@
>  #define UART011_FBRD		0x28	/* Fractional baud rate divisor register. */
>  #define UART011_LCRH		0x2c	/* Line control register. */
>  #define ST_UART011_LCRH_TX	0x2c    /* Tx Line control register. */
> +#define ZX_UART011_LCRH_TX	0x30    /* Different offset in the ZTE UART. */
>  #define UART011_CR		0x30	/* Control register. */
>  #define UART011_IFLS		0x34	/* Interrupt fifo level select. */
> +#define ZX_UART011_CR		0x34	/* Different offset in the ZTE UART. */
> +#define ZX_UART011_IFLS		0x38	/* Different offset in the ZTE UART. */
>  #define UART011_IMSC		0x38	/* Interrupt mask. */
>  #define UART011_RIS		0x3c	/* Raw interrupt status. */
>  #define UART011_MIS		0x40	/* Masked interrupt status. */
> +#define ZX_UART011_IMSC		0x40	/* Different offset in the ZTE UART. */
>  #define UART011_ICR		0x44	/* Interrupt clear register. */
> +#define ZX_UART011_RIS		0x44	/* Different offset in the ZTE UART. */
>  #define UART011_DMACR		0x48	/* DMA control register. */
> +#define ZX_UART011_MIS		0x48	/* Different offset in the ZTE UART. */
> +#define ZX_UART011_ICR		0x4c	/* Different offset in the ZTE UART. */
>  #define ST_UART011_XFCR		0x50	/* XON/XOFF control register. */
> +#define ZX_UART011_DMACR	0x50	/* Different offset in the ZTE UART. */
>  #define ST_UART011_XON1		0x54	/* XON1 register. */
>  #define ST_UART011_XON2		0x58	/* XON2 register. */
>  #define ST_UART011_XOFF1	0x5C	/* XON1 register. */
> -- 
> 2.5.1
> 

-- 
FTTC broadband for 0.8mile line: currently at 9.6Mbps down 400kbps up
according to speedtest.net.

  reply	other threads:[~2015-11-03 13:46 UTC|newest]

Thread overview: 72+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-11-02 12:24 [PATCH DRAFT 0/2] Sketch for ZTE ZX296702 UART integration Andre Przywara
2015-11-02 12:24 ` Andre Przywara
2015-11-02 12:24 ` [PATCH DRAFT 1/2] drivers: serial: PL011: refactor register access Andre Przywara
2015-11-02 12:24   ` Andre Przywara
2015-11-02 13:27   ` Timur Tabi
2015-11-02 13:27     ` Timur Tabi
2015-11-02 13:40     ` Andre Przywara
2015-11-02 13:40       ` Andre Przywara
2015-11-02 13:44       ` Timur Tabi
2015-11-02 13:44         ` Timur Tabi
2015-11-02 12:24 ` [PATCH DRAFT 2/2] drivers: serial: PL011: [DRAFT] implement register diverson for ZTE UART Andre Przywara
2015-11-02 12:24   ` Andre Przywara
2015-11-03 13:46   ` Russell King - ARM Linux [this message]
2015-11-03 13:46     ` Russell King - ARM Linux
2015-11-03 13:57     ` Andre Przywara
2015-11-03 13:57       ` Andre Przywara
2015-11-05  9:54     ` Jun Nie
2015-11-05  9:54       ` Jun Nie
2015-11-03 14:23   ` Russell King - ARM Linux
2015-11-03 14:23     ` Russell King - ARM Linux
2015-11-03 14:30     ` Andre Przywara
2015-11-03 14:30       ` Andre Przywara
2015-11-03 13:43 ` [PATCH DRAFT 0/2] Sketch for ZTE ZX296702 UART integration Russell King - ARM Linux
2015-11-03 13:43   ` Russell King - ARM Linux
2015-11-03 14:48   ` Russell King - ARM Linux
2015-11-03 14:48     ` Russell King - ARM Linux
2015-11-03 14:50   ` [PATCH 01/11] tty: amba-pl011: add register accessor functions Russell King
2015-11-03 14:50     ` Russell King
2015-11-03 14:53     ` Timur Tabi
2015-11-03 14:53       ` Timur Tabi
2015-11-03 15:18       ` Russell King - ARM Linux
2015-11-03 15:18         ` Russell King - ARM Linux
2015-11-03 14:51   ` [PATCH 02/11] tty: amba-pl011: convert accessor functions to take uart_amba_port Russell King
2015-11-03 14:51     ` Russell King
2015-11-03 14:51   ` [PATCH 03/11] tty: amba-pl011: add helper to detect split LCRH register Russell King
2015-11-03 14:51     ` Russell King
2015-11-03 14:51   ` [PATCH 04/11] tty: amba-pl011: prepare REG_* register indexes Russell King
2015-11-03 14:51     ` Russell King
2015-11-03 14:51   ` [PATCH 05/11] tty: amba-pl011: add register lookup table Russell King
2015-11-03 14:51     ` Russell King
2015-11-06  0:00     ` Timur Tabi
2015-11-06  0:00       ` Timur Tabi
2015-11-06  0:24       ` Russell King - ARM Linux
2015-11-06  0:24         ` Russell King - ARM Linux
2015-11-06  0:27         ` Timur Tabi
2015-11-06  0:27           ` Timur Tabi
2015-12-13  6:03     ` Greg Kroah-Hartman
2015-12-13  6:03       ` Greg Kroah-Hartman
2015-11-03 14:51   ` [PATCH 06/11] tty: amba-pl011: add register offset table to vendor data Russell King
2015-11-03 14:51     ` Russell King
2015-11-03 14:51   ` [PATCH 07/11] tty: amba-pl011: add ST register offset table Russell King
2015-11-03 14:51     ` Russell King
2015-11-03 14:51   ` [PATCH 08/11] tty: amba-pl011: clean up LCR register offsets Russell King
2015-11-03 14:51     ` Russell King
2015-11-03 14:51   ` [PATCH 09/11] tty: amba-pl011: remove ST micro registers from standard table Russell King
2015-11-03 14:51     ` Russell King
2015-11-03 14:51   ` [PATCH 10/11] tty: amba-pl011: add support for 32-bit register access Russell King
2015-11-03 14:51     ` Russell King
2015-11-03 14:57     ` Timur Tabi
2015-11-03 14:57       ` Timur Tabi
2015-11-03 16:19       ` Russell King - ARM Linux
2015-11-03 16:19         ` Russell King - ARM Linux
2015-11-05  4:46         ` Peter Hurley
2015-11-05  4:46           ` Peter Hurley
2015-11-03 14:51   ` [PATCH 11/11] tty: amba-pl011: add support for ZTE UART (EXPERIMENTAL) Russell King
2015-11-03 14:51     ` Russell King
2015-11-05  8:28     ` Linus Walleij
2015-11-05  8:28       ` Linus Walleij
2015-11-05  9:27       ` Russell King - ARM Linux
2015-11-05  9:27         ` Russell King - ARM Linux
2015-11-05  9:54         ` Linus Walleij
2015-11-05  9:54           ` Linus Walleij

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=20151103134605.GW8644@n2100.arm.linux.org.uk \
    --to=linux@arm.linux.org.uk \
    --cc=Andrew.Jackson@arm.com \
    --cc=andre.przywara@arm.com \
    --cc=jun.nie@linaro.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-serial@vger.kernel.org \
    --cc=peter@hurleysoftware.com \
    --cc=timur@tabi.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.