From patchwork Fri Sep 16 14:23:57 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sudeep Holla X-Patchwork-Id: 76385 Delivered-To: patch@linaro.org Received: by 10.140.106.72 with SMTP id d66csp525157qgf; Fri, 16 Sep 2016 07:24:04 -0700 (PDT) X-Received: by 10.66.194.196 with SMTP id hy4mr23516619pac.63.1474035844455; Fri, 16 Sep 2016 07:24:04 -0700 (PDT) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id j127si45601902pfc.62.2016.09.16.07.24.04; Fri, 16 Sep 2016 07:24:04 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-serial-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-serial-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-serial-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S934339AbcIPOYD (ORCPT + 2 others); Fri, 16 Sep 2016 10:24:03 -0400 Received: from foss.arm.com ([217.140.101.70]:58136 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933865AbcIPOYC (ORCPT ); Fri, 16 Sep 2016 10:24:02 -0400 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id F2ADB687; Fri, 16 Sep 2016 07:24:01 -0700 (PDT) Received: from [10.1.210.28] (e107155-lin.cambridge.arm.com [10.1.210.28]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 1F8A13F251; Fri, 16 Sep 2016 07:23:59 -0700 (PDT) Subject: Re: [PATCH v3 1/3] tty: amba-pl011: define flag register bits for ZTE device To: Shawn Guo , Russell King References: <1467968441-4056-1-git-send-email-shawn.guo@linaro.org> <1467968441-4056-2-git-send-email-shawn.guo@linaro.org> Cc: Greg Kroah-Hartman , Sudeep Holla , Peter Hurley , Jason Liu , Andre Przywara , Timur Tabi , xie.baoyou@zte.com.cn, linux-serial@vger.kernel.org, Jun Nie , linux-arm-kernel@lists.infradead.org From: Sudeep Holla Organization: ARM Message-ID: Date: Fri, 16 Sep 2016 15:23:57 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.2.0 MIME-Version: 1.0 In-Reply-To: <1467968441-4056-2-git-send-email-shawn.guo@linaro.org> Sender: linux-serial-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-serial@vger.kernel.org Hi Shawn, Russell, I noticed this change is in linux-next and but I happen to hit an issue with this as I tested it with earlycon enabled today for the first time. On 08/07/16 10:00, Shawn Guo wrote: > For some reason we do not really understand, ZTE hardware designers > choose to define PL011 Flag Register bit positions differently from > standard ones as below. > > Bit Standard ZTE > ----------------------------------- > CTS 0 1 > DSR 1 3 > BUSY 3 8 > RI 8 0 > > Let's define these bits into vendor data and get ZTE PL011 supported > properly. > > Signed-off-by: Shawn Guo [...] > @@ -2303,13 +2325,16 @@ static struct console amba_console = { > > static void pl011_putc(struct uart_port *port, int c) > { > + struct uart_amba_port *uap = > + container_of(port, struct uart_amba_port, port); > + > while (readl(port->membase + UART01x_FR) & UART01x_FR_TXFF) > cpu_relax(); > if (port->iotype == UPIO_MEM32) > writel(c, port->membase + UART01x_DR); > else > writeb(c, port->membase + UART01x_DR); > - while (readl(port->membase + UART01x_FR) & UART01x_FR_BUSY) > + while (readl(port->membase + UART01x_FR) & uap->vendor->fr_busy) > cpu_relax(); > } The above hunk won't work for early console devices. The earlycon_device just has uart_port and is not uart_amba_port. I don't know how to fix this properly but I thought we could reuse private_data in uart_port for early_con devices. Something like below(incomplete for other vendors, works only for ARM) Regards, Sudeep -->8 } -- To unsubscribe from this list: send the line "unsubscribe linux-serial" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git i/drivers/tty/serial/amba-pl011.c w/drivers/tty/serial/amba-pl011.c index 0b78b04e895e..abe88223790c 100644 --- i/drivers/tty/serial/amba-pl011.c +++ w/drivers/tty/serial/amba-pl011.c @@ -2330,8 +2330,7 @@ static struct console amba_console = { static void pl011_putc(struct uart_port *port, int c) { - struct uart_amba_port *uap = - container_of(port, struct uart_amba_port, port); + struct vendor_data *vendor = port->private_data; while (readl(port->membase + UART01x_FR) & UART01x_FR_TXFF) cpu_relax(); @@ -2339,7 +2338,7 @@ static void pl011_putc(struct uart_port *port, int c) writel(c, port->membase + UART01x_DR); else writeb(c, port->membase + UART01x_DR); - while (readl(port->membase + UART01x_FR) & uap->vendor->fr_busy) + while (readl(port->membase + UART01x_FR) & vendor->fr_busy) cpu_relax(); } @@ -2356,6 +2355,7 @@ static int __init pl011_early_console_setup(struct earlycon_device *device, if (!device->port.membase) return -ENODEV; + device->port.private_data = &vendor_arm; device->con->write = pl011_early_write; return 0;