Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp1112255pxf; Thu, 8 Apr 2021 23:39:16 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx6Jp8Kshx8Nen1P/mLhuFe06ZFKPqQfqeSnUmK7pGfcSwBEK6Mb38A+K7ccoJjvu+HSbrw X-Received: by 2002:aa7:d88b:: with SMTP id u11mr16020227edq.254.1617950355882; Thu, 08 Apr 2021 23:39:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1617950355; cv=none; d=google.com; s=arc-20160816; b=SAtGezQQOHOeSv89LLyxnm9KSx++f/BPKbd1cS/vWYg2Q1yyGHGjfofSd0ixkrfETn 3OeQyGba7J4H3WnbIDclpyGLSxTyhyJWurD2ehhBg9mXQHy/tiqV+Z+D3pA5sU3iYBVR v3pn6XpoF/pIMuWw+UbJk7yiV9pelUHLpRNEk4nuDcIGpoiYMNfyNlfQpC2TKvmUD3LU ccBfQ01B2T3V4kF1ZG4lz5nqrzvDVISup0wmVZkCP1VI3fY3GhrZCKiOs3/fCLcJ5hpu fOo4q4DP+iRD8OsHbZWYAxLWLwcQpNEG4TtoKg6SE/BjnkR+9MYFhUC+M0pcst737WjA F7eg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=hL8ydsRBjSGH93b6DxoXiwuUEU1J17Wd5fwxzHWrkNk=; b=yUIcsstcc5RSD/SXUlb8pXn44kPy3bXFEdeXWkTGe5jUnwfFXqo3ZwgC8TSNDGsHTQ JLkANvX2YChRq/iZFeOz9gQzERV1y6LzvsZksdAvMDPJa3p99whg7igO3xiTJSSmxxpW 7SAU/oAr2ehXftviWmxsXtKUaRXpU1CKYfDQtWVnv7fSgnZPouz6kDdVy0YymV4XRVgU Gbj5K3ynde7AvQa8WWozvW7QR5xhZURtIwKpflhlFCBpn/zOt5CTzlkANUNHsL27oTsA iKxg9e+JNdAicuNoZwIuHyUgzcykdAT79GLuJfVtBw+m6YobwGV80URinLie7uKCiJ0d WCxA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@bewilderbeest.net header.s=thorn header.b=mKveTuIk; 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 ji12si1241507ejc.448.2021.04.08.23.38.52; Thu, 08 Apr 2021 23:39:15 -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=mKveTuIk; 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 S233296AbhDIGfz (ORCPT + 99 others); Fri, 9 Apr 2021 02:35:55 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36946 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229715AbhDIGfz (ORCPT ); Fri, 9 Apr 2021 02:35:55 -0400 Received: from thorn.bewilderbeest.net (thorn.bewilderbeest.net [IPv6:2605:2700:0:5::4713:9cab]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 01ADBC061760; Thu, 8 Apr 2021 23:35:42 -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 BE0C286; Thu, 8 Apr 2021 23:35:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bewilderbeest.net; s=thorn; t=1617950142; bh=hL8ydsRBjSGH93b6DxoXiwuUEU1J17Wd5fwxzHWrkNk=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=mKveTuIk1LSmdqqibJKuKd4WfGGtVPH2qUmK7P0kElsfhc2lKlcw9tuMcG0DDd2wX xPsuYjCibyjCeDJ0A7GHT6pacWenP3xpeJwVSvL3LsCYMpYrpXhUP42V/nHUCQJ419 guR2vdR+BBTQBLRxhVIPUmO+WorScztFE/rt3vI0= Date: Fri, 9 Apr 2021 01:35:39 -0500 From: Zev Weiss To: Andrew Jeffery Cc: Joel Stanley , linux-aspeed@lists.ozlabs.org, Greg Kroah-Hartman , openbmc@lists.ozlabs.org, linux-kernel@vger.kernel.org, linux-serial@vger.kernel.org, Jiri Slaby , linux-arm-kernel@lists.infradead.org Subject: Re: [PATCH v5 3/4] drivers/tty/serial/8250: add aspeed, lpc-io-reg and aspeed, lpc-interrupts DT properties Message-ID: References: <20210408011637.5361-1-zev@bewilderbeest.net> <20210408011637.5361-4-zev@bewilderbeest.net> <3eef2478-c5b8-4f14-a937-16bbe0a3e05a@www.fastmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii; format=flowed Content-Disposition: inline In-Reply-To: <3eef2478-c5b8-4f14-a937-16bbe0a3e05a@www.fastmail.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Apr 09, 2021 at 12:14:54AM CDT, Andrew Jeffery wrote: >Hi Zev, > >A couple of minor comments: > >On Thu, 8 Apr 2021, at 10:46, Zev Weiss wrote: >> These allow describing all the Aspeed VUART attributes currently >> available via sysfs. aspeed,sirq > >aspeed,lpc-interrupts now Ah right, thanks. > >> 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; >> + } > >A bit ugly open-coding the mapping and error handling, maybe worth a helper? > Yeah, that sounds reasonable -- will do. Thanks! Zev