From patchwork Thu Feb 22 18:42:02 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Garry X-Patchwork-Id: 129307 Delivered-To: patch@linaro.org Received: by 10.46.66.2 with SMTP id p2csp857734lja; Thu, 22 Feb 2018 09:50:17 -0800 (PST) X-Google-Smtp-Source: AH8x226uNZVmY9SbOs+peWVEQyV2qXA/9RjGkaEc1jwZ9jp4PHecW3ijdwbcsgArnWlSQ2NL1F41 X-Received: by 10.99.0.147 with SMTP id 141mr6360155pga.364.1519321816372; Thu, 22 Feb 2018 09:50:16 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519321816; cv=none; d=google.com; s=arc-20160816; b=o5h0mYoznFBRV/OMKYtVyR1ITyKSjDSSTmX5GxXfOqfXzJmR+RgCW01kCpcEH738fZ GvlYGfAIv7c2hwIrHjBlvNl/6PteOQb4YgdQUIBkPptXQlRGKu8Mcim3a2WE8M0Z2QFS Ngsf+aXeGusNdKQlG0yUkbh56+kYx7MKTegfTBdS3EutSEvMugHXQJodGD5IyBFSS7AP wrwkdh3Wyfq6zzy0z7wD3SMutylIYYbfMfe+7GNsY7qEvxDYF1ugmNaXK+qS5J/JXXIQ LJPhPmgWQVob5gBOZAU1B4KIw8cwA5JnGbqICyys30qJSyyKhkbjD5Ajd/w62QSINGCu W4Bg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:arc-authentication-results; bh=D2n7L88tbbQNByoJBRJm9IbZgxrmJ+fCozVvEZY8YKY=; b=C/E7dSWnkgRJduTLi7chbGrImcczvD0R6NYJZ2hZzipAEDYmnHcY8fYxfkZfa/p0pk EPaV/xpILH0nii6Tb3vESeRK2i7pnSB5RVePQYybDIZ3hLugcgkyYZ/YYrUU9r+ttrW0 XJOzh3OGBXcq5uq9dZyttW0F604c80eG71/dcAkKAW+Fe3N4DkDe/A1VMYkJYu0PbLLC sV8J0wiCKk35RSGO5hv67y4BOLGnyg3KwkbP/Q1zvYI+vD9Wky3FdrjMvlatqm6v34h7 tuXRtpx0NQwCIYO95yKQKe5koYGyOsBZRHwUsHmncvT+WdZu5+Gxep9APkBZdJjMPefG LiDg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id c2-v6si358922plr.681.2018.02.22.09.50.15; Thu, 22 Feb 2018 09:50:16 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-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-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933609AbeBVRuM (ORCPT + 28 others); Thu, 22 Feb 2018 12:50:12 -0500 Received: from szxga04-in.huawei.com ([45.249.212.190]:5662 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S933441AbeBVRuF (ORCPT ); Thu, 22 Feb 2018 12:50:05 -0500 Received: from DGGEMS409-HUB.china.huawei.com (unknown [172.30.72.58]) by Forcepoint Email with ESMTP id 4B9B08C17CF16; Fri, 23 Feb 2018 01:49:49 +0800 (CST) Received: from localhost.localdomain (10.67.212.75) by DGGEMS409-HUB.china.huawei.com (10.3.19.209) with Microsoft SMTP Server id 14.3.361.1; Fri, 23 Feb 2018 01:49:42 +0800 From: John Garry To: , , , , , , CC: , , Subject: [RFC PATCH 1/2] serial: 8250_dw: add IO space support Date: Fri, 23 Feb 2018 02:42:02 +0800 Message-ID: <1519324923-196857-2-git-send-email-john.garry@huawei.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1519324923-196857-1-git-send-email-john.garry@huawei.com> References: <1519324923-196857-1-git-send-email-john.garry@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.67.212.75] X-CFilter-Loop: Reflected Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The current 8250_dw driver only supports MEM iotype. It is desired to have a platform device-based 8250 UART driver for ACPI FW with IO port iotype, so update the driver to support this. Note: a solution needs to be found for autconfig using MEM accessors only. Signed-off-by: John Garry --- drivers/tty/serial/8250/8250_dw.c | 25 +++++++++++++++++-------- 1 file changed, 17 insertions(+), 8 deletions(-) -- 1.9.1 diff --git a/drivers/tty/serial/8250/8250_dw.c b/drivers/tty/serial/8250/8250_dw.c index cd1b94a..28fbc8f 100644 --- a/drivers/tty/serial/8250/8250_dw.c +++ b/drivers/tty/serial/8250/8250_dw.c @@ -405,7 +405,7 @@ static void dw8250_setup_port(struct uart_port *p) static int dw8250_probe(struct platform_device *pdev) { struct uart_8250_port uart = {}; - struct resource *regs = platform_get_resource(pdev, IORESOURCE_MEM, 0); + struct resource *regs; int irq = platform_get_irq(pdev, 0); struct uart_port *p = &uart.port; struct device *dev = &pdev->dev; @@ -413,6 +413,9 @@ static int dw8250_probe(struct platform_device *pdev) int err; u32 val; + regs = platform_get_resource(pdev, IORESOURCE_MEM, 0) ?: + platform_get_resource(pdev, IORESOURCE_IO, 0); + if (!regs) { dev_err(dev, "no registers defined\n"); return -EINVAL; @@ -425,22 +428,28 @@ static int dw8250_probe(struct platform_device *pdev) } spin_lock_init(&p->lock); - p->mapbase = regs->start; p->irq = irq; p->handle_irq = dw8250_handle_irq; p->pm = dw8250_do_pm; p->type = PORT_8250; p->flags = UPF_SHARE_IRQ | UPF_FIXED_PORT; p->dev = dev; - p->iotype = UPIO_MEM; - p->serial_in = dw8250_serial_in; - p->serial_out = dw8250_serial_out; p->set_ldisc = dw8250_set_ldisc; p->set_termios = dw8250_set_termios; - p->membase = devm_ioremap(dev, regs->start, resource_size(regs)); - if (!p->membase) - return -ENOMEM; + if ((regs->flags & IORESOURCE_TYPE_BITS) == IORESOURCE_MEM) { + p->mapbase = regs->start; + p->membase = devm_ioremap(dev, regs->start, + resource_size(regs)); + if (!p->membase) + return -ENOMEM; + p->iotype = UPIO_MEM; + p->serial_in = dw8250_serial_in; + p->serial_out = dw8250_serial_out; + } else { + p->iobase = regs->start; + p->iotype = UPIO_PORT; + } data = devm_kzalloc(dev, sizeof(*data), GFP_KERNEL); if (!data)