[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <d2d42bf5-fc7e-7a88-7e62-f35e16401012@gmail.com>
Date: Thu, 27 Apr 2023 15:22:09 +0800
From: Jacky Huang <ychuang570808@...il.com>
To: Christophe JAILLET <christophe.jaillet@...adoo.fr>,
robh+dt@...nel.org, krzysztof.kozlowski+dt@...aro.org,
lee@...nel.org, mturquette@...libre.com, sboyd@...nel.org,
p.zabel@...gutronix.de, gregkh@...uxfoundation.org,
jirislaby@...nel.org, tmaimon77@...il.com, catalin.marinas@....com,
will@...nel.org
Cc: devicetree@...r.kernel.org, linux-clk@...r.kernel.org,
linux-kernel@...r.kernel.org, linux-arm-kernel@...ts.infradead.org,
linux-serial@...r.kernel.org, arnd@...db.de, schung@...oton.com,
mjchen@...oton.com, Jacky Huang <ychuang3@...oton.com>
Subject: Re: [PATCH v8 10/11] tty: serial: Add Nuvoton ma35d1 serial driver
support
On 2023/4/25 下午 06:38, Christophe JAILLET wrote:
> Le 25/04/2023 à 12:24, Jacky Huang a écrit :
>> From: Jacky Huang <ychuang3@...oton.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@...oton.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
Powered by blists - more mailing lists