Linux MIPS Architecture development
 help / color / mirror / Atom feed
From: Paul Cercueil <paul@crapouillou.net>
To: Zhou Yanjie <zhouyanjie@wanyeetech.com>
Cc: jringle@gridpoint.com, shc_work@mail.ru,
	Rob Herring <robh@kernel.org>, Paul Boddie <paul@boddie.org.uk>,
	"H. Nikolaus Schaller" <hns@goldelico.com>,
	Jiaxun Yang <jiaxun.yang@flygoat.com>,
	linux-serial@vger.kernel.org,
	linux-mips <linux-mips@vger.kernel.org>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: Re: Question about SC16IS752 device tree.
Date: Mon, 09 May 2022 19:13:47 +0100	[thread overview]
Message-ID: <ZYNMBR.VDVV3VHFQBMO1@crapouillou.net> (raw)
In-Reply-To: <7c89db86-4055-90b5-6a67-611410f5759f@wanyeetech.com>

Hi Zhou,

Le mar., mai 10 2022 at 02:08:28 +0800, Zhou Yanjie 
<zhouyanjie@wanyeetech.com> a écrit :
> Hi folks,
> 
> I encountered a problem when using the SC16IS752 to expand the serial 
> port.
> I connected two Bluetooth modules to the two serial ports extended by 
> the
> SC16IS752. The device tree is as follows:
> 
> &ssi0 {
>     status = "okay";
> 
>     num-cs = <2>;
> 
>     pinctrl-names = "default";
>     pinctrl-0 = <&pins_ssi0>;
> 
>     sc16is752: expander@0 {
>         compatible = "nxp,sc16is752";
>         reg = <0>; /* CE0 */
> 
>         spi-rx-bus-width = <1>;
>         spi-tx-bus-width = <1>;
>         spi-max-frequency = <6000000>;
> 
>         clocks = <&exclk_sc16is752>;
> 
>         interrupt-parent = <&gpb>;
>         interrupts = <18 IRQ_TYPE_EDGE_FALLING>;
> 
>         gpio-controller;
>         #gpio-cells = <2>;
> 
>         bluetooth@0 {
>             compatible = "brcm,bcm43438-bt";
>             max-speed = <1000000>;
> 
>             device-wakeup-gpios = <&gpc 26 GPIO_ACTIVE_HIGH>;
>             reset-gpios = <&gpb 17 GPIO_ACTIVE_LOW>;
>         };
> 
>         bluetooth@1 {
>             compatible = "brcm,bcm43438-bt";
> 
>             device-wakeup-gpios = <&gpc 28 GPIO_ACTIVE_HIGH>;
>             reset-gpios = <&gpb 19 GPIO_ACTIVE_LOW>;
>         };
>     };
> };
> 
> 
> 
> There are the following error messages after startup:
> 
> [    0.548417] serial serial0-0: controller busy
> [    0.553572] serial serial0-0: failure adding device. status -EBUSY
> [    0.559764] serial serial0: tty port ttySC0 registered
> [    0.565545] spi0.0: ttySC1 at I/O 0x1 (irq = 18, base_baud = 
> 3000000) is a SC16IS752
> [    0.573987] serial serial1-0: controller busy
> [    0.578351] serial serial1-0: failure adding device. status -EBUSY
> [    0.585003] serial serial1: tty port ttySC1 registered
> 
> And only the module connected to the first serial port (ttySC0) can 
> work normally.

I can't say for sure that it's your problem, but your bluetooth nodes 
are missing "reg" properties.

Cheers,
-Paul

> 
> 
> 
> If I change the device tree to:
> 
> &ssi0 {
>     status = "okay";
> 
>     num-cs = <2>;
> 
>     pinctrl-names = "default";
>     pinctrl-0 = <&pins_ssi0>;
> 
>     sc16is752: expander@0 {
>         compatible = "nxp,sc16is752";
>         reg = <0>; /* CE0 */
> 
>         spi-rx-bus-width = <1>;
>         spi-tx-bus-width = <1>;
>         spi-max-frequency = <6000000>;
> 
>         clocks = <&exclk_sc16is752>;
> 
>         interrupt-parent = <&gpb>;
>         interrupts = <18 IRQ_TYPE_EDGE_FALLING>;
> 
>         gpio-controller;
>         #gpio-cells = <2>;
> 
>         bluetooth@0 {
>             compatible = "brcm,bcm43438-bt";
>             max-speed = <1000000>;
> 
>             device-wakeup-gpios = <&gpc 26 GPIO_ACTIVE_HIGH>;
>             reset-gpios = <&gpb 17 GPIO_ACTIVE_LOW>;
>         };
>     };
> };
> 
> Then there will be no error message, and the module connected to the 
> first
> serial port (ttySC0) can also work normally.
> 
> 
> 
> After tracing, the problem seems to be in "serdev_device_add()" (line 
> 111) of
> "drivers/tty/serdev/core.c":
> 
> int serdev_device_add(struct serdev_device *serdev)
> {
>     struct serdev_controller *ctrl = serdev->ctrl;
>     struct device *parent = serdev->dev.parent;
>     int err;
> 
>     dev_set_name(&serdev->dev, "%s-%d", dev_name(parent), serdev->nr);
> 
>     /* Only a single slave device is currently supported. */
>     if (ctrl->serdev) {
>         dev_err(&serdev->dev, "controller busy\n");
>         return -EBUSY;
>     }
>     ctrl->serdev = serdev;
> 
>     err = device_add(&serdev->dev);
>     if (err < 0) {
>         dev_err(&serdev->dev, "Can't add %s, status %pe\n",
>             dev_name(&serdev->dev), ERR_PTR(err));
>         goto err_clear_serdev;
>     }
> 
>     dev_dbg(&serdev->dev, "device %s registered\n", 
> dev_name(&serdev->dev));
> 
>     return 0;
> 
> err_clear_serdev:
>     ctrl->serdev = NULL;
>     return err;
> }
> EXPORT_SYMBOL_GPL(serdev_device_add);
> 
> 
> 
> Is there any way to correctly describe the device mounted on the 
> second
> serial port (ttySC1) in the device tree? Or how do I need to modify 
> the
> "drivers/tty/serdev/core.c" to make the SC16IS752 still work properly
> with two child nodes mounted?
> 
> Thanks and beset regards!



  reply	other threads:[~2022-05-09 18:14 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-05-09 18:08 Question about SC16IS752 device tree Zhou Yanjie
2022-05-09 18:13 ` Paul Cercueil [this message]
2022-05-09 18:41   ` Zhou Yanjie
2022-05-09 20:19     ` H. Nikolaus Schaller
2022-05-10  2:29       ` Zhou Yanjie
2022-05-10 15:31         ` H. Nikolaus Schaller
2022-05-10 17:53           ` Zhou Yanjie
2022-05-12 14:49             ` Rob Herring
2022-05-14 14:52               ` Zhou Yanjie

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=ZYNMBR.VDVV3VHFQBMO1@crapouillou.net \
    --to=paul@crapouillou.net \
    --cc=hns@goldelico.com \
    --cc=jiaxun.yang@flygoat.com \
    --cc=jringle@gridpoint.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mips@vger.kernel.org \
    --cc=linux-serial@vger.kernel.org \
    --cc=paul@boddie.org.uk \
    --cc=robh@kernel.org \
    --cc=shc_work@mail.ru \
    --cc=zhouyanjie@wanyeetech.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