From patchwork Sun Nov 4 13:51:30 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sasha Levin X-Patchwork-Id: 150108 Delivered-To: patch@linaro.org Received: by 2002:a2e:299d:0:0:0:0:0 with SMTP id p29-v6csp1537534ljp; Sun, 4 Nov 2018 05:52:32 -0800 (PST) X-Google-Smtp-Source: AJdET5fCWWbcskjvr0WPyid/PO6pqtWzZJLUmdQXoyd6oR8iuC2qo9OX0PXglb1wr/97YqUa8zmE X-Received: by 2002:a63:5c16:: with SMTP id q22-v6mr16925634pgb.417.1541339552677; Sun, 04 Nov 2018 05:52:32 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1541339552; cv=none; d=google.com; s=arc-20160816; b=hs+v2AqBuPNeKMR8b8MjZLsdFwjBy9bxpq6eYuatExR2/ztpiXX1tyGstroghDI+2K yzHrrgxd6c9dWQg4KNbD0GKJM44mQ2ItWuORLKN+ClWYUHj+THqsH/WZMcjo0gceN3vq dtrBzJ+7OHRKSRoM4IBJtjQrc3furCTLJIAMUzsQdT+iKmqK/X3zDvC4ijf9FEdDFFne ae76QT8lSe9BkMLNT0m9/bgGfS0Ix/nA51XV3AgKl36Rw3nSDWXGG4QxNNZTkSlCQLbV a8OU9qtfxOPOwPqSc2YbLbvQVhwmt/D7e4s3iL4y/lDhlfR0M44Y6cRGcNB/GBu1LtXw h+pw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature; bh=Hlf+RTMzsenL1GFAVghJ3KUAHyt9eVytsHhkf5uM04o=; b=h3Y06fD9To/gqHne1roKhrK/VJwMFn6ra4sPxPsl6p33JdRPjutYtysG+9CIsbSAeo ok5MuMP8noBm2dzeg0memmdqyeZuUrexcH5UmeijC44IShZ3dYZmPeuVQVPef7EKmeta Ejl2BRxrZoJ80oxtoAk8IIS9kWByJ4sAalY892skRRzqJny6sYHBJ/QOnk3JrjQx0LM+ 5k+fJIXio+hpic7zqy7WxXZFkSOnOJw31Gv+ExAR8QI3Z4lcCj4EyycC5RSVl52E/v1M jzbL9m4jAdpCr03njn7GIw4T/aNsosiKFt9mU7/czfc89FMR91gnstU+wsIZ7hdUhujS 9rTA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=y2ufjeVK; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id j20si770654pgg.162.2018.11.04.05.52.32; Sun, 04 Nov 2018 05:52:32 -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; dkim=pass header.i=@kernel.org header.s=default header.b=y2ufjeVK; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730408AbeKDXHd (ORCPT + 32 others); Sun, 4 Nov 2018 18:07:33 -0500 Received: from mail.kernel.org ([198.145.29.99]:45402 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730390AbeKDXHb (ORCPT ); Sun, 4 Nov 2018 18:07:31 -0500 Received: from sasha-vm.mshome.net (c-73-47-72-35.hsd1.nh.comcast.net [73.47.72.35]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 879062085B; Sun, 4 Nov 2018 13:52:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1541339548; bh=A5jCYSplBYoOFQ8zRetf6AmvXC5z+rSE1tCGxdnEW/I=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=y2ufjeVKYsxoG3vwdc5rzHegI1OqXsAQajPc59YR2IJuRgoezKOhLpbU29kqPlD6t cWJpTaol5vH7tXlWHAUkmRMDWfk6golCr+r9A55yPGHLTl56BIs0zwCe3QNCPgwnwx IvQ2YxqEXCnNIZ8gYAPsArDlrlsVEadvPlk4NE/Y= From: Sasha Levin To: stable@vger.kernel.org, linux-kernel@vger.kernel.org Cc: John Garry , Greg Kroah-Hartman , Sasha Levin Subject: [PATCH AUTOSEL 4.19 43/57] serial: 8250_of: Fix for lack of interrupt support Date: Sun, 4 Nov 2018 08:51:30 -0500 Message-Id: <20181104135144.88324-43-sashal@kernel.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20181104135144.88324-1-sashal@kernel.org> References: <20181104135144.88324-1-sashal@kernel.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: John Garry [ Upstream commit a27d938251ef40c43db81af16fc26b2cec181d4d ] In commit c58caaab3bf8 ("serial: 8250: of: Defer probe on missing IRQ"), a check was added for the UART driver being probed prior to the parent IRQ controller. Unfortunately this breaks certain boards which have no interrupt support, like Huawei D03. Indeed, the 8250 DT bindings state that interrupts should be supported - not must. To fix, switch from irq_of_parse_and_map() to of_irq_get(), which does relay whether the IRQ host controller domain is not ready, i.e. defer probe, instead of assuming it. Fixes: c58caaab3bf8 ("serial: 8250: of: Defer probe on missing IRQ") Signed-off-by: John Garry Reviewed-by: Rob Herring Reviewed-by: Alexander Sverdlin Tested-by: Alexander Sverdlin Signed-off-by: Greg Kroah-Hartman Signed-off-by: Sasha Levin --- drivers/tty/serial/8250/8250_of.c | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) -- 2.17.1 diff --git a/drivers/tty/serial/8250/8250_of.c b/drivers/tty/serial/8250/8250_of.c index af8beefe9b5c..877fd7f8a8ed 100644 --- a/drivers/tty/serial/8250/8250_of.c +++ b/drivers/tty/serial/8250/8250_of.c @@ -58,7 +58,7 @@ static int of_platform_serial_setup(struct platform_device *ofdev, struct resource resource; struct device_node *np = ofdev->dev.of_node; u32 clk, spd, prop; - int ret; + int ret, irq; memset(port, 0, sizeof *port); @@ -143,21 +143,27 @@ static int of_platform_serial_setup(struct platform_device *ofdev, if (ret >= 0) port->line = ret; - port->irq = irq_of_parse_and_map(np, 0); - if (!port->irq) { - ret = -EPROBE_DEFER; - goto err_unprepare; + irq = of_irq_get(np, 0); + if (irq < 0) { + if (irq == -EPROBE_DEFER) { + ret = -EPROBE_DEFER; + goto err_unprepare; + } + /* IRQ support not mandatory */ + irq = 0; } + port->irq = irq; + info->rst = devm_reset_control_get_optional_shared(&ofdev->dev, NULL); if (IS_ERR(info->rst)) { ret = PTR_ERR(info->rst); - goto err_dispose; + goto err_unprepare; } ret = reset_control_deassert(info->rst); if (ret) - goto err_dispose; + goto err_unprepare; port->type = type; port->uartclk = clk; @@ -184,8 +190,6 @@ static int of_platform_serial_setup(struct platform_device *ofdev, port->handle_irq = fsl8250_handle_irq; return 0; -err_dispose: - irq_dispose_mapping(port->irq); err_unprepare: clk_disable_unprepare(info->clk); err_pmruntime: