Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp911026pxf; Thu, 1 Apr 2021 17:50:00 -0700 (PDT) X-Google-Smtp-Source: ABdhPJztrVb3v5VrA7a+Y5cHSpIgs6pTImV9k3ofkbJG9EOrLlQGSm4x48UXBDYO7GlytHuFfBy4 X-Received: by 2002:a05:6e02:de2:: with SMTP id m2mr9099604ilj.274.1617324600160; Thu, 01 Apr 2021 17:50:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1617324600; cv=none; d=google.com; s=arc-20160816; b=0P2cS2Awq+ZmJcSNivXHo6vAIifyc2j4IwpjTOgsrYPZwKdXsaAelwDvvrXpJNZDth VmE9wqrxfyWCV+4Hp7leP/eDeBj3fOyzoKr8nixO6sHJZy4OkhYBx9rzOO+A6ry2dJtY K3yQTuBnXAmfOjOtBsMeYXyNg/m4l52N/VIR7gUYvGNVDgyhEJapXjHC8bVWyG21EjyC CG8fn/R6ENLbhPySUqNIfOQCucEDMFsc5CvtkUShlASFBGU1ShTQwcJrwERjHsVTMZQf 8YNkZOuG8jt8JolNqzJ2Zk9j2bPIXyMRqNvSq4UZ0K0GC/iT6GHMor5RiGCXLGtXVVgR ISCQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=3xOUL4AIGVOffUxK324A/zK7JsmBLvhsbsncOdBEzDA=; b=wdQESJvqKfeqO6pQAKAt0Wa/YTz+BZSergCoT7aG7XIQoUZBVpCSdmrbFdnRry6Vy+ 9SmxCQY2wZ+NHFlcjdSMKU7dFoHxIQYm0fXeC4FnqebDm+ytP77c3e2cOeQy1314PShe VZocvwITyCQNVVajsfNstBiAIkzwHeVDZDgrxGm2Gume0goWtYCda2YO6AwfHEtXpT9L AupsSc+SXLNsaruZ8kkZUdhem2NFtXhLXgDCxGb9BpqVKnXUUsmmObd4aoV966EFhwa6 yNZvP3ZqvG+8ImGAu9Udz+T4A8W6tws75lGK+eJ+Opd50rtw2bGZaWG/cQgxnpOizf0S GhRw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@bewilderbeest.net header.s=thorn header.b=VPvqQcu2; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=bewilderbeest.net Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id z8si5833450jat.80.2021.04.01.17.49.46; Thu, 01 Apr 2021 17:50:00 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@bewilderbeest.net header.s=thorn header.b=VPvqQcu2; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=bewilderbeest.net Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234043AbhDBArn (ORCPT + 99 others); Thu, 1 Apr 2021 20:47:43 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38286 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234008AbhDBArf (ORCPT ); Thu, 1 Apr 2021 20:47:35 -0400 Received: from thorn.bewilderbeest.net (thorn.bewilderbeest.net [IPv6:2605:2700:0:5::4713:9cab]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 18CCAC061788; Thu, 1 Apr 2021 17:47:35 -0700 (PDT) Received: from hatter.bewilderbeest.net (unknown [IPv6:2600:6c44:7f:ba20::7c6]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: zev) by thorn.bewilderbeest.net (Postfix) with ESMTPSA id 11AA78FB; Thu, 1 Apr 2021 17:47:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bewilderbeest.net; s=thorn; t=1617324454; bh=3xOUL4AIGVOffUxK324A/zK7JsmBLvhsbsncOdBEzDA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=VPvqQcu2kzZzejl3tEJu1wjVRERQL3pkZa2lEAWPVoOuSjeN4FV5K7FkxyNGsf9a4 zyZp8nM7RN/T5PglyJVZh6zTDv74uM3cShpQ082uJoceKu1IhTklNlMYKtUe7KYBJF qLhpqNQBavvweFs6z7PwC4FeHe8hmyrrLmDhgMR0= From: Zev Weiss To: Joel Stanley Cc: openbmc@lists.ozlabs.org, linux-arm-kernel@lists.infradead.org, linux-aspeed@lists.ozlabs.org, linux-kernel@vger.kernel.org, Andrew Jeffery , Zev Weiss , Greg Kroah-Hartman , Jiri Slaby , linux-serial@vger.kernel.org Subject: [PATCH v3 3/4] drivers/tty/serial/8250: add aspeed,lpc-address and aspeed,sirq DT properties Date: Thu, 1 Apr 2021 19:47:15 -0500 Message-Id: <20210402004716.15961-4-zev@bewilderbeest.net> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210402004716.15961-1-zev@bewilderbeest.net> References: <20210402004716.15961-1-zev@bewilderbeest.net> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org These allow describing all the Aspeed VUART attributes currently available via sysfs. aspeed,sirq provides a replacement for the deprecated aspeed,sirq-polarity-sense property. Signed-off-by: Zev Weiss --- drivers/tty/serial/8250/8250_aspeed_vuart.c | 44 ++++++++++++++++++++- 1 file changed, 43 insertions(+), 1 deletion(-) diff --git a/drivers/tty/serial/8250/8250_aspeed_vuart.c b/drivers/tty/serial/8250/8250_aspeed_vuart.c index 8433f8dbb186..10b1f33386e6 100644 --- a/drivers/tty/serial/8250/8250_aspeed_vuart.c +++ b/drivers/tty/serial/8250/8250_aspeed_vuart.c @@ -28,6 +28,10 @@ #define ASPEED_VUART_ADDRL 0x28 #define ASPEED_VUART_ADDRH 0x2c +#define ASPEED_VUART_DEFAULT_LPC_ADDR 0x3f8 +#define ASPEED_VUART_DEFAULT_SIRQ 4 +#define ASPEED_VUART_DEFAULT_SIRQ_POLARITY IRQ_TYPE_LEVEL_LOW + struct aspeed_vuart { struct device *dev; void __iomem *regs; @@ -393,7 +397,8 @@ static int aspeed_vuart_probe(struct platform_device *pdev) struct aspeed_vuart *vuart; struct device_node *np; struct resource *res; - u32 clk, prop; + u32 clk, prop, sirq[2]; + bool sirq_polarity; int rc; np = pdev->dev.of_node; @@ -501,6 +506,43 @@ static int aspeed_vuart_probe(struct platform_device *pdev) of_node_put(sirq_polarity_sense_args.np); } + rc = of_property_read_u32(np, "aspeed,lpc-address", &prop); + if (rc < 0) + prop = ASPEED_VUART_DEFAULT_LPC_ADDR; + + rc = aspeed_vuart_set_lpc_address(vuart, prop); + if (rc < 0) { + dev_err(&pdev->dev, "invalid value in aspeed,lpc-address property\n"); + goto err_clk_disable; + } + + rc = of_property_read_u32_array(np, "aspeed,sirq", sirq, 2); + if (rc < 0) { + sirq[0] = ASPEED_VUART_DEFAULT_SIRQ; + sirq[1] = ASPEED_VUART_DEFAULT_SIRQ_POLARITY; + } + + rc = aspeed_vuart_set_sirq(vuart, sirq[0]); + if (rc < 0) { + dev_err(&pdev->dev, "invalid sirq number in aspeed,sirq property\n"); + goto err_clk_disable; + } + + switch (sirq[1]) { + case IRQ_TYPE_LEVEL_LOW: + sirq_polarity = false; + break; + case IRQ_TYPE_LEVEL_HIGH: + sirq_polarity = true; + break; + default: + dev_err(&pdev->dev, "invalid sirq polarity in aspeed,sirq property\n"); + rc = -EINVAL; + goto err_clk_disable; + } + + aspeed_vuart_set_sirq_polarity(vuart, sirq_polarity); + aspeed_vuart_set_enabled(vuart, true); aspeed_vuart_set_host_tx_discard(vuart, true); platform_set_drvdata(pdev, vuart); -- 2.31.1