openbmc.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
From: "Andrew Jeffery" <andrew@aj.id.au>
To: "Zev Weiss" <zev@bewilderbeest.net>, "Joel Stanley" <joel@jms.id.au>
Cc: linux-aspeed@lists.ozlabs.org,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	openbmc@lists.ozlabs.org, linux-kernel@vger.kernel.org,
	linux-serial@vger.kernel.org, Jiri Slaby <jirislaby@kernel.org>,
	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
Date: Fri, 09 Apr 2021 14:44:54 +0930	[thread overview]
Message-ID: <3eef2478-c5b8-4f14-a937-16bbe0a3e05a@www.fastmail.com> (raw)
In-Reply-To: <20210408011637.5361-4-zev@bewilderbeest.net>

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

> provides a replacement for the
> deprecated aspeed,sirq-polarity-sense property.
> 
> Signed-off-by: Zev Weiss <zev@bewilderbeest.net>
> ---
>  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?

Looks okay otherwise.

Cheers,

Andrew

  reply	other threads:[~2021-04-09  5:15 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-04-08  1:16 [PATCH v5 0/4] serial: 8250_aspeed_vuart: generalized DT properties Zev Weiss
2021-04-08  1:16 ` [PATCH v5 1/4] dt-bindings: serial: 8250: deprecate aspeed, sirq-polarity-sense Zev Weiss
2021-04-08 15:59   ` Rob Herring
2021-04-08  1:16 ` [PATCH v5 2/4] drivers/tty/serial/8250: refactor sirq and lpc address setting code Zev Weiss
2021-04-09  5:06   ` Andrew Jeffery
2021-04-09  7:01     ` Zev Weiss
2021-04-09  7:24   ` Andy Shevchenko
2021-04-09  7:38     ` Zev Weiss
2021-04-09  9:51       ` Andy Shevchenko
2021-04-08  1:16 ` [PATCH v5 3/4] drivers/tty/serial/8250: add aspeed, lpc-io-reg and aspeed, lpc-interrupts DT properties Zev Weiss
2021-04-09  5:14   ` Andrew Jeffery [this message]
2021-04-09  6:35     ` Zev Weiss
2021-04-08  1:16 ` [PATCH v5 4/4] dt-bindings: serial: 8250: add aspeed, lpc-io-reg and aspeed, lpc-interrupts Zev Weiss
2021-04-08 16:00   ` Rob Herring

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=3eef2478-c5b8-4f14-a937-16bbe0a3e05a@www.fastmail.com \
    --to=andrew@aj.id.au \
    --cc=gregkh@linuxfoundation.org \
    --cc=jirislaby@kernel.org \
    --cc=joel@jms.id.au \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-aspeed@lists.ozlabs.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-serial@vger.kernel.org \
    --cc=openbmc@lists.ozlabs.org \
    --cc=zev@bewilderbeest.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).