Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp7922pxf; Wed, 7 Apr 2021 18:19:21 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyFKcCrpV4iqqFtygjHtkhzx+0bQot+5d+Xk10t7JfrTIfsABZF73MjGjGAuM1bTO0l7pmC X-Received: by 2002:a05:6402:350f:: with SMTP id b15mr7962156edd.6.1617844760957; Wed, 07 Apr 2021 18:19:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1617844760; cv=none; d=google.com; s=arc-20160816; b=oTf7Vy0+6Mp/oF47x06B5jNwgj/SXtJ3GoyYCFjTRI9VWrPA9ZBX19zXDXhXVFPdbi g69InwFZ2V5/ZBnLoFbtI+iLiNgkysPC9kpcHqtpYzztxNjz7b5k72mKG2U6g5h51TA6 lhFxocj2ektxSqS/BwwZQfetOafuk3qU18DoSTZi6Zda7OAOYYK6cNTVEC2aCPvgQLqz nMrYLM6K8w7Pc1l/KbB/aB6jdNuEBnM8y29C5LR38TXN7cqU82ozuGw1JoRa3WzOB4pA t17jx+qfs0JCladjIVmzmbHFA7xAO8OitliIU523leYO8pcgG/gwY/WD+UUGR8o4VLbG rWdA== 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=tyW6sXNRBj6Uk4Ih7WWBioGPwnfyDpbZ0v47TOM8+4g=; b=hdTXLQqTQEyxTE2gu++WJT7d1DgrInSO5bpE19HdFJHWXtp49XVr20fgcC1BKLAx6G TtIui2RFQ5AkLwIZQnotosZ5Z86QOUlfy+VoG7pMbtv5bL7dXPxj2SGgr9FZKonaZbgs wd823RfPwl+e8NiR/Y9NPide+PWeyMJBxNA3VtxGDdoQyZ0126R4/IxNGGWjgQLsz9F3 djxmCasEf8faAbfiP7XksyZoz3vwGV1e/hIpV9eFc2g3u37TapmswiScZnU/Fnc9If+R MpwNCWO5BvhaysFH92jdOCFDI58pt1bYZFylI5N4jGkqMlaymgQTsq4tF5sjw4sPt4SF Dpyw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@bewilderbeest.net header.s=thorn header.b="CWQcr8s/"; 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 df9si9458230edb.422.2021.04.07.18.18.55; Wed, 07 Apr 2021 18:19:20 -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="CWQcr8s/"; 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 S230406AbhDHBRP (ORCPT + 99 others); Wed, 7 Apr 2021 21:17:15 -0400 Received: from thorn.bewilderbeest.net ([71.19.156.171]:44239 "EHLO thorn.bewilderbeest.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230320AbhDHBRK (ORCPT ); Wed, 7 Apr 2021 21:17:10 -0400 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 42485754; Wed, 7 Apr 2021 18:16:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bewilderbeest.net; s=thorn; t=1617844620; bh=tyW6sXNRBj6Uk4Ih7WWBioGPwnfyDpbZ0v47TOM8+4g=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=CWQcr8s/C5finE2Op6i6f1lCbq8gx9HGwxzEoD9KQPr/ZQTc1yQ20ekED6uhulx3+ n31j/PUcpKSU2F7DKzvpopeZsLTHDvs0xYfn/NpkBiYvwTfqLLfq2oQqtuOYxKvl80 /q6iOIZvpIyXiMJDQserP/2Vd+lMCn8vhgeMSW9A= 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 v5 3/4] drivers/tty/serial/8250: add aspeed,lpc-io-reg and aspeed,lpc-interrupts DT properties Date: Wed, 7 Apr 2021 20:16:36 -0500 Message-Id: <20210408011637.5361-4-zev@bewilderbeest.net> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210408011637.5361-1-zev@bewilderbeest.net> References: <20210408011637.5361-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..75ef006fa24b 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-io-reg", &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-io-reg property\n"); + goto err_clk_disable; + } + + rc = of_property_read_u32_array(np, "aspeed,lpc-interrupts", 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,lpc-interrupts 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,lpc-interrupts 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