linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: shijie.huang@arm.com (Huang Shijie)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 05/12] tty: amba-pl011: add register lookup table
Date: Thu, 24 Dec 2015 06:54:40 +0000	[thread overview]
Message-ID: <20151224065437.GA18445@robwan01-pc.asiapac.arm.com> (raw)
In-Reply-To: <E1ZyNlS-0003jg-46@rmk-PC.arm.linux.org.uk>

On Mon, Nov 16, 2015 at 05:40:26PM +0000, Russell King wrote:
Hi Russell,

> Add a register lookup table, which allows the register offsets to be
> adjusted on a per-port basis.
I met a console hang with my ARM juno-r1 board after the linux-next merge this patch.

The console hang like this:

==================================
on will start in   1 seconds
EFI stub: Booting Linux Kernel...
EFI stub: Using DTB from command line
EFI stub: Exiting boot services and installing virtual address map...
==================================

The console runs well if I revert this patch. Does anyone also meet the
same hang issue?

My kernel cmdline:
  console=ttyAMA0,115200 earlycon=pl011,0x7ff80000 root=/dev/sda1 rootwait verbose debug sky2.mac_address=0x00,0x02,0xF7,0x00,0x63,0x3C dtb=r1a57.dtb

thanks
Huang Shijie
>
> Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
> ---
>  drivers/tty/serial/amba-pl011.c | 33 ++++++++++++++++++++++++-
>  drivers/tty/serial/amba-pl011.h | 53 ++++++++++++++++++++++-------------------
>  2 files changed, 60 insertions(+), 26 deletions(-)
>
> diff --git a/drivers/tty/serial/amba-pl011.c b/drivers/tty/serial/amba-pl011.c
> index 5ea5b0a3dbb9..628557f6a7a1 100644
> --- a/drivers/tty/serial/amba-pl011.c
> +++ b/drivers/tty/serial/amba-pl011.c
> @@ -73,6 +73,34 @@
>  #define UART_DR_ERROR                (UART011_DR_OE|UART011_DR_BE|UART011_DR_PE|UART011_DR_FE)
>  #define UART_DUMMY_DR_RX     (1 << 16)
>
> +static u16 pl011_std_offsets[REG_ARRAY_SIZE] = {
> +     [REG_DR] = UART01x_DR,
> +     [REG_ST_DMAWM] = ST_UART011_DMAWM,
> +     [REG_ST_TIMEOUT] = ST_UART011_TIMEOUT,
> +     [REG_FR] = UART01x_FR,
> +     [REG_ST_LCRH_RX] = ST_UART011_LCRH_RX,
> +     [REG_IBRD] = UART011_IBRD,
> +     [REG_FBRD] = UART011_FBRD,
> +     [REG_LCRH] = UART011_LCRH,
> +     [REG_ST_LCRH_TX] = ST_UART011_LCRH_TX,
> +     [REG_CR] = UART011_CR,
> +     [REG_IFLS] = UART011_IFLS,
> +     [REG_IMSC] = UART011_IMSC,
> +     [REG_RIS] = UART011_RIS,
> +     [REG_MIS] = UART011_MIS,
> +     [REG_ICR] = UART011_ICR,
> +     [REG_DMACR] = UART011_DMACR,
> +     [REG_ST_XFCR] = ST_UART011_XFCR,
> +     [REG_ST_XON1] = ST_UART011_XON1,
> +     [REG_ST_XON2] = ST_UART011_XON2,
> +     [REG_ST_XOFF1] = ST_UART011_XOFF1,
> +     [REG_ST_XOFF2] = ST_UART011_XOFF2,
> +     [REG_ST_ITCR] = ST_UART011_ITCR,
> +     [REG_ST_ITIP] = ST_UART011_ITIP,
> +     [REG_ST_ABCR] = ST_UART011_ABCR,
> +     [REG_ST_ABIMSC] = ST_UART011_ABIMSC,
> +};
> +
>  /* There is by now at least one vendor with differing details, so handle it */
>  struct vendor_data {
>       unsigned int            ifls;
> @@ -164,6 +192,7 @@ struct pl011_dmatx_data {
>   */
>  struct uart_amba_port {
>       struct uart_port        port;
> +     const u16               *reg_offset;
>       struct clk              *clk;
>       const struct vendor_data *vendor;
>       unsigned int            dmacr;          /* dma control reg */
> @@ -189,7 +218,7 @@ struct uart_amba_port {
>  static unsigned int pl011_reg_to_offset(const struct uart_amba_port *uap,
>       unsigned int reg)
>  {
> -     return reg;
> +     return uap->reg_offset[reg];
>  }
>
>  static unsigned int pl011_read(const struct uart_amba_port *uap,
> @@ -2397,6 +2426,7 @@ static int pl011_probe(struct amba_device *dev, const struct amba_id *id)
>       if (IS_ERR(uap->clk))
>               return PTR_ERR(uap->clk);
>
> +     uap->reg_offset = pl011_std_offsets;
>       uap->vendor = vendor;
>       uap->lcrh_rx = vendor->lcrh_rx;
>       uap->lcrh_tx = vendor->lcrh_tx;
> @@ -2478,6 +2508,7 @@ static int sbsa_uart_probe(struct platform_device *pdev)
>       if (!uap)
>               return -ENOMEM;
>
> +     uap->reg_offset = pl011_std_offsets;
>       uap->vendor     = &vendor_sbsa;
>       uap->fifosize   = 32;
>       uap->port.irq   = platform_get_irq(pdev, 0);
> diff --git a/drivers/tty/serial/amba-pl011.h b/drivers/tty/serial/amba-pl011.h
> index b7eb1bc2fab9..0c6756dba2fe 100644
> --- a/drivers/tty/serial/amba-pl011.h
> +++ b/drivers/tty/serial/amba-pl011.h
> @@ -2,31 +2,34 @@
>  #define AMBA_PL011_H
>
>  enum {
> -     REG_DR = UART01x_DR,
> -     REG_ST_DMAWM = ST_UART011_DMAWM,
> -     REG_ST_TIMEOUT = ST_UART011_TIMEOUT,
> -     REG_FR = UART01x_FR,
> -     REG_ST_LCRH_RX = ST_UART011_LCRH_RX,
> -     REG_IBRD = UART011_IBRD,
> -     REG_FBRD = UART011_FBRD,
> -     REG_LCRH = UART011_LCRH,
> -     REG_ST_LCRH_TX = ST_UART011_LCRH_TX,
> -     REG_CR = UART011_CR,
> -     REG_IFLS = UART011_IFLS,
> -     REG_IMSC = UART011_IMSC,
> -     REG_RIS = UART011_RIS,
> -     REG_MIS = UART011_MIS,
> -     REG_ICR = UART011_ICR,
> -     REG_DMACR = UART011_DMACR,
> -     REG_ST_XFCR = ST_UART011_XFCR,
> -     REG_ST_XON1 = ST_UART011_XON1,
> -     REG_ST_XON2 = ST_UART011_XON2,
> -     REG_ST_XOFF1 = ST_UART011_XOFF1,
> -     REG_ST_XOFF2 = ST_UART011_XOFF2,
> -     REG_ST_ITCR = ST_UART011_ITCR,
> -     REG_ST_ITIP = ST_UART011_ITIP,
> -     REG_ST_ABCR = ST_UART011_ABCR,
> -     REG_ST_ABIMSC = ST_UART011_ABIMSC,
> +     REG_DR,
> +     REG_ST_DMAWM,
> +     REG_ST_TIMEOUT,
> +     REG_FR,
> +     REG_ST_LCRH_RX,
> +     REG_IBRD,
> +     REG_FBRD,
> +     REG_LCRH,
> +     REG_ST_LCRH_TX,
> +     REG_CR,
> +     REG_IFLS,
> +     REG_IMSC,
> +     REG_RIS,
> +     REG_MIS,
> +     REG_ICR,
> +     REG_DMACR,
> +     REG_ST_XFCR,
> +     REG_ST_XON1,
> +     REG_ST_XON2,
> +     REG_ST_XOFF1,
> +     REG_ST_XOFF2,
> +     REG_ST_ITCR,
> +     REG_ST_ITIP,
> +     REG_ST_ABCR,
> +     REG_ST_ABIMSC,
> +
> +     /* The size of the array - must be last */
> +     REG_ARRAY_SIZE,
>  };
>
>  #endif
> --
> 2.1.0
>
>
> _______________________________________________
> linux-arm-kernel mailing list
> linux-arm-kernel at lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
>
IMPORTANT NOTICE: The contents of this email and any attachments are confidential and may also be privileged. If you are not the intended recipient, please notify the sender immediately and do not disclose the contents to any other person, use it for any purpose, or store or copy the information in any medium. Thank you.

  parent reply	other threads:[~2015-12-24  6:54 UTC|newest]

Thread overview: 35+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-11-16 17:39 [PATCH 00/12] Prepare amba-pl011 for ZTE UART support Russell King - ARM Linux
2015-11-16 17:40 ` [PATCH 01/12] tty: amba-pl011: add register accessor functions Russell King
2015-12-05 18:57   ` Peter Hurley
2015-12-24 15:14     ` Russell King - ARM Linux
2015-11-16 17:40 ` [PATCH 02/12] tty: amba-pl011: convert accessor functions to take uart_amba_port Russell King
2015-11-16 17:40 ` [PATCH 03/12] tty: amba-pl011: add helper to detect split LCRH register Russell King
2015-11-16 17:40 ` [PATCH 04/12] tty: amba-pl011: prepare REG_* register indexes Russell King
2015-11-16 17:40 ` [PATCH 05/12] tty: amba-pl011: add register lookup table Russell King
2015-11-19 14:10   ` Dave Martin
2015-12-24  6:54   ` Huang Shijie [this message]
2015-12-24 11:01     ` Russell King - ARM Linux
2015-12-24 15:03     ` Timur Tabi
2015-12-24 15:05       ` Russell King - ARM Linux
2015-12-24 15:35         ` Timur Tabi
2015-12-24 15:40           ` Russell King - ARM Linux
2015-12-24 15:50             ` Timur Tabi
2015-12-24 15:54               ` Russell King - ARM Linux
2015-12-24 16:07                 ` Russell King - ARM Linux
2015-12-24 16:51                   ` Russell King - ARM Linux
2015-11-16 17:40 ` [PATCH 06/12] tty: amba-pl011: add register offset table to vendor data Russell King
2015-11-16 17:40 ` [PATCH 07/12] tty: amba-pl011: add ST register offset table Russell King
2015-11-16 17:40 ` [PATCH 08/12] tty: amba-pl011: clean up LCR register offsets Russell King
2015-11-16 17:40 ` [PATCH 09/12] tty: amba-pl011: remove ST micro registers from standard table Russell King
2015-11-16 17:40 ` [PATCH 10/12] tty: amba-pl011: add support for 32-bit register access Russell King
2015-11-16 17:45   ` Timur Tabi
2015-11-16 17:52     ` Russell King - ARM Linux
2015-11-16 18:25       ` Timur Tabi
2015-11-16 18:30         ` Russell King - ARM Linux
2015-11-16 20:52           ` Timur Tabi
2015-11-16 21:18           ` Peter Hurley
2015-11-16 17:40 ` [PATCH 11/12] tty: amba-pl011: add support for ZTE UART (EXPERIMENTAL) Russell King
2015-11-16 17:41 ` [PATCH 12/12] tty: amba-pl011: switch to using relaxed IO accessors Russell King
2015-12-05 18:49 ` [PATCH 00/12] Prepare amba-pl011 for ZTE UART support Peter Hurley
2015-12-05 19:06   ` Timur Tabi
2015-12-13  6:36     ` Greg Kroah-Hartman

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=20151224065437.GA18445@robwan01-pc.asiapac.arm.com \
    --to=shijie.huang@arm.com \
    --cc=linux-arm-kernel@lists.infradead.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;
as well as URLs for NNTP newsgroup(s).