Linux Serial subsystem development
 help / color / mirror / Atom feed
From: Jacky Huang <ychuang570808@gmail.com>
To: Christophe JAILLET <christophe.jaillet@wanadoo.fr>,
	robh+dt@kernel.org, krzysztof.kozlowski+dt@linaro.org,
	lee@kernel.org, mturquette@baylibre.com, sboyd@kernel.org,
	p.zabel@pengutronix.de, gregkh@linuxfoundation.org,
	jirislaby@kernel.org, tmaimon77@gmail.com,
	catalin.marinas@arm.com, will@kernel.org
Cc: devicetree@vger.kernel.org, linux-clk@vger.kernel.org,
	linux-kernel@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org,
	linux-serial@vger.kernel.org, arnd@arndb.de, schung@nuvoton.com,
	mjchen@nuvoton.com, Jacky Huang <ychuang3@nuvoton.com>
Subject: Re: [PATCH v8 10/11] tty: serial: Add Nuvoton ma35d1 serial driver support
Date: Thu, 27 Apr 2023 15:22:09 +0800	[thread overview]
Message-ID: <d2d42bf5-fc7e-7a88-7e62-f35e16401012@gmail.com> (raw)
In-Reply-To: <46933536-2999-c3b0-f3d3-60e8830f50a6@wanadoo.fr>



On 2023/4/25 下午 06:38, Christophe JAILLET wrote:
> Le 25/04/2023 à 12:24, Jacky Huang a écrit :
>> From: Jacky Huang <ychuang3@nuvoton.com>
>>
>> This adds UART and console driver for Nuvoton ma35d1 Soc.
>> It supports full-duplex communication, FIFO control, and
>> hardware flow control.
>>
>> Signed-off-by: Jacky Huang <ychuang3@nuvoton.com>
>> ---
>>   drivers/tty/serial/Kconfig         |  18 +
>>   drivers/tty/serial/Makefile        |   1 +
>>   drivers/tty/serial/ma35d1_serial.c | 781 +++++++++++++++++++++++++++++
>>   3 files changed, 800 insertions(+)
>>   create mode 100644 drivers/tty/serial/ma35d1_serial.c
>>
>
> [...]
>
>> +static int ma35d1serial_probe(struct platform_device *pdev)
>> +{
>> +    struct resource *res_mem;
>> +    struct uart_ma35d1_port *up;
>> +    int ret = 0;
>> +    struct clk *clk;
>> +    int err;
>> +
>> +    if (pdev->dev.of_node) {
>> +        ret = of_alias_get_id(pdev->dev.of_node, "serial");
>> +        if (ret < 0) {
>> +            dev_err(&pdev->dev, "failed to get alias/pdev id, errno 
>> %d\n", ret);
>> +            return ret;
>> +        }
>> +    }
>> +    up = &ma35d1serial_ports[ret];
>> +    up->port.line = ret;
>> +    res_mem = platform_get_resource(pdev, IORESOURCE_MEM, 0);
>> +    if (!res_mem)
>> +        return -ENODEV;
>> +
>> +    up->port.iobase = res_mem->start;
>> +    up->port.membase = devm_ioremap(&pdev->dev, up->port.iobase, 
>> UART_REG_SIZE);
>> +    up->port.ops = &ma35d1serial_ops;
>> +
>> +    spin_lock_init(&up->port.lock);
>> +
>> +    clk = of_clk_get(pdev->dev.of_node, 0);
>
> Does this...
>
>> +    if (IS_ERR(clk)) {
>> +        err = PTR_ERR(clk);
>> +        dev_err(&pdev->dev, "failed to get core clk: %d\n", err);
>> +        return -ENOENT;
>> +    }
>> +
>> +    err = clk_prepare_enable(clk);
>
> ... and this be undone in the remove function?
>
> CJ
>

I will add clk_disable_unprepare() in the remove function.

>> +    if (err)
>> +        return -ENOENT;
>> +
>> +    if (up->port.line != 0)
>> +        up->port.uartclk = clk_get_rate(clk);
>> +
>> +    ret = platform_get_irq(pdev, 0);
>> +    if (ret < 0)
>> +        return ret;
>> +    up->port.irq = ret;
>> +    up->port.dev = &pdev->dev;
>> +    up->port.flags = UPF_BOOT_AUTOCONF;
>> +
>> +    platform_set_drvdata(pdev, up);
>> +
>> +    return uart_add_one_port(&ma35d1serial_reg, &up->port);
>> +}
>
> [...]
>

Best Regards,
Jacky Huang

  reply	other threads:[~2023-04-27  7:23 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-04-25 10:24 [PATCH v8 00/11] Introduce Nuvoton ma35d1 SoC Jacky Huang
2023-04-25 10:24 ` [PATCH v8 01/11] arm64: Kconfig.platforms: Add config for Nuvoton MA35 platform Jacky Huang
2023-04-25 10:24 ` [PATCH v8 02/11] arm64: defconfig: Add support for Nuvoton MA35 family SoCs Jacky Huang
2023-04-25 10:24 ` [PATCH v8 03/11] dt-bindings: clock: nuvoton: add binding for ma35d1 clock controller Jacky Huang
2023-04-25 10:24 ` [PATCH v8 04/11] dt-bindings: reset: nuvoton: Document ma35d1 reset control Jacky Huang
2023-04-25 10:24 ` [PATCH v8 05/11] dt-bindings: arm: Add initial bindings for Nuvoton platform Jacky Huang
2023-04-25 19:02   ` Rob Herring
2023-05-01  9:50   ` Krzysztof Kozlowski
2023-05-02  1:31     ` Jacky Huang
2023-05-02  6:31       ` Krzysztof Kozlowski
2023-05-02  6:40         ` Jacky Huang
2023-05-02  6:46           ` Krzysztof Kozlowski
2023-05-02  6:49             ` Jacky Huang
2023-04-25 10:24 ` [PATCH v8 06/11] dt-bindings: serial: Document ma35d1 uart controller Jacky Huang
2023-04-25 10:24 ` [PATCH v8 07/11] arm64: dts: nuvoton: Add initial ma35d1 device tree Jacky Huang
2023-04-25 10:24 ` [PATCH v8 08/11] clk: nuvoton: Add clock driver for ma35d1 clock controller Jacky Huang
2023-04-25 11:30   ` Ilpo Järvinen
2023-04-26  4:55     ` Jacky Huang
2023-04-25 10:24 ` [PATCH v8 09/11] reset: Add Nuvoton ma35d1 reset driver support Jacky Huang
2023-04-25 10:57   ` Ilpo Järvinen
2023-04-26  0:44     ` Jacky Huang
2023-04-26  7:39   ` Philipp Zabel
2023-04-25 10:24 ` [PATCH v8 10/11] tty: serial: Add Nuvoton ma35d1 serial " Jacky Huang
2023-04-25 10:38   ` Christophe JAILLET
2023-04-27  7:22     ` Jacky Huang [this message]
2023-04-25 14:01   ` kernel test robot
2023-04-25 10:24 ` [PATCH v8 11/11] MAINTAINERS: Add entry for NUVOTON MA35 Jacky Huang

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=d2d42bf5-fc7e-7a88-7e62-f35e16401012@gmail.com \
    --to=ychuang570808@gmail.com \
    --cc=arnd@arndb.de \
    --cc=catalin.marinas@arm.com \
    --cc=christophe.jaillet@wanadoo.fr \
    --cc=devicetree@vger.kernel.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=jirislaby@kernel.org \
    --cc=krzysztof.kozlowski+dt@linaro.org \
    --cc=lee@kernel.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-clk@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-serial@vger.kernel.org \
    --cc=mjchen@nuvoton.com \
    --cc=mturquette@baylibre.com \
    --cc=p.zabel@pengutronix.de \
    --cc=robh+dt@kernel.org \
    --cc=sboyd@kernel.org \
    --cc=schung@nuvoton.com \
    --cc=tmaimon77@gmail.com \
    --cc=will@kernel.org \
    --cc=ychuang3@nuvoton.com \
    /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