From: Manivannan Sadhasivam <manivannan.sadhasivam@oss.qualcomm.com>
If an external connector like M.2 is connected to the serdev controller
in DT, then the serdev devices will be created dynamically by the connector
driver. So skip registering devices from DT node as there will be no
statically defined devices.
Signed-off-by: Manivannan Sadhasivam <manivannan.sadhasivam@oss.qualcomm.com>
---
drivers/tty/serdev/core.c | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/drivers/tty/serdev/core.c b/drivers/tty/serdev/core.c
index 8c2a40a537d93f4b9353a2f128cdf51b521929b1..1378587d386356ca4415fa455b2ee722b5e44d3e 100644
--- a/drivers/tty/serdev/core.c
+++ b/drivers/tty/serdev/core.c
@@ -12,6 +12,7 @@
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/of.h>
+#include <linux/of_graph.h>
#include <linux/of_device.h>
#include <linux/pm_domain.h>
#include <linux/pm_runtime.h>
@@ -560,6 +561,15 @@ static int of_serdev_register_devices(struct serdev_controller *ctrl)
int err;
bool found = false;
+ /*
+ * When the serdev controller is connected to an external connector like
+ * M.2 in DT, then the serdev devices will be created dynamically by the
+ * connector driver. So skip looking for devices in DT node as there will
+ * be no statically defined devices.
+ */
+ if (of_graph_is_present(ctrl->dev.of_node))
+ return 0;
+
for_each_available_child_of_node(ctrl->dev.of_node, node) {
if (!of_property_present(node, "compatible"))
continue;
--
2.48.1
On Wed, Nov 12, 2025 at 8:45 AM Manivannan Sadhasivam via B4 Relay <devnull+manivannan.sadhasivam.oss.qualcomm.com@kernel.org> wrote: > > From: Manivannan Sadhasivam <manivannan.sadhasivam@oss.qualcomm.com> > > If an external connector like M.2 is connected to the serdev controller > in DT, then the serdev devices will be created dynamically by the connector > driver. So skip registering devices from DT node as there will be no > statically defined devices. You could still have statically defined devices. You are just choosing to probe them later from the connector driver. > > Signed-off-by: Manivannan Sadhasivam <manivannan.sadhasivam@oss.qualcomm.com> > --- > drivers/tty/serdev/core.c | 10 ++++++++++ > 1 file changed, 10 insertions(+) > > diff --git a/drivers/tty/serdev/core.c b/drivers/tty/serdev/core.c > index 8c2a40a537d93f4b9353a2f128cdf51b521929b1..1378587d386356ca4415fa455b2ee722b5e44d3e 100644 > --- a/drivers/tty/serdev/core.c > +++ b/drivers/tty/serdev/core.c > @@ -12,6 +12,7 @@ > #include <linux/kernel.h> > #include <linux/module.h> > #include <linux/of.h> > +#include <linux/of_graph.h> > #include <linux/of_device.h> > #include <linux/pm_domain.h> > #include <linux/pm_runtime.h> > @@ -560,6 +561,15 @@ static int of_serdev_register_devices(struct serdev_controller *ctrl) > int err; > bool found = false; > > + /* > + * When the serdev controller is connected to an external connector like > + * M.2 in DT, then the serdev devices will be created dynamically by the > + * connector driver. So skip looking for devices in DT node as there will > + * be no statically defined devices. > + */ > + if (of_graph_is_present(ctrl->dev.of_node)) > + return 0; Where's the schema that allows graph nodes? Rob
On Tue, Nov 18, 2025 at 07:03:51AM -0600, Rob Herring wrote: > On Wed, Nov 12, 2025 at 8:45 AM Manivannan Sadhasivam via B4 Relay > <devnull+manivannan.sadhasivam.oss.qualcomm.com@kernel.org> wrote: > > > > From: Manivannan Sadhasivam <manivannan.sadhasivam@oss.qualcomm.com> > > > > If an external connector like M.2 is connected to the serdev controller > > in DT, then the serdev devices will be created dynamically by the connector > > driver. So skip registering devices from DT node as there will be no > > statically defined devices. > > You could still have statically defined devices. You are just choosing > to probe them later from the connector driver. > The point of coming up with the M.2 binding is to avoid hardcoding the devices in DT. So static devices are ruled out IMO. > > > > Signed-off-by: Manivannan Sadhasivam <manivannan.sadhasivam@oss.qualcomm.com> > > --- > > drivers/tty/serdev/core.c | 10 ++++++++++ > > 1 file changed, 10 insertions(+) > > > > diff --git a/drivers/tty/serdev/core.c b/drivers/tty/serdev/core.c > > index 8c2a40a537d93f4b9353a2f128cdf51b521929b1..1378587d386356ca4415fa455b2ee722b5e44d3e 100644 > > --- a/drivers/tty/serdev/core.c > > +++ b/drivers/tty/serdev/core.c > > @@ -12,6 +12,7 @@ > > #include <linux/kernel.h> > > #include <linux/module.h> > > #include <linux/of.h> > > +#include <linux/of_graph.h> > > #include <linux/of_device.h> > > #include <linux/pm_domain.h> > > #include <linux/pm_runtime.h> > > @@ -560,6 +561,15 @@ static int of_serdev_register_devices(struct serdev_controller *ctrl) > > int err; > > bool found = false; > > > > + /* > > + * When the serdev controller is connected to an external connector like > > + * M.2 in DT, then the serdev devices will be created dynamically by the > > + * connector driver. So skip looking for devices in DT node as there will > > + * be no statically defined devices. > > + */ > > + if (of_graph_is_present(ctrl->dev.of_node)) > > + return 0; > > Where's the schema that allows graph nodes? > Err... I missed updating it. Will do it in v2. - Mani -- மணிவண்ணன் சதாசிவம்
On Wed, Nov 19, 2025 at 7:33 AM Manivannan Sadhasivam <mani@kernel.org> wrote: > > On Tue, Nov 18, 2025 at 07:03:51AM -0600, Rob Herring wrote: > > On Wed, Nov 12, 2025 at 8:45 AM Manivannan Sadhasivam via B4 Relay > > <devnull+manivannan.sadhasivam.oss.qualcomm.com@kernel.org> wrote: > > > > > > From: Manivannan Sadhasivam <manivannan.sadhasivam@oss.qualcomm.com> > > > > > > If an external connector like M.2 is connected to the serdev controller > > > in DT, then the serdev devices will be created dynamically by the connector > > > driver. So skip registering devices from DT node as there will be no > > > statically defined devices. > > > > You could still have statically defined devices. You are just choosing > > to probe them later from the connector driver. > > > > The point of coming up with the M.2 binding is to avoid hardcoding the devices > in DT. So static devices are ruled out IMO. Until you have any one of the reasons we have PCIe devices described even when in a standard slot. Take your pick. An ethernet adapter that omits an EEPROM for the MAC address. Rob
On Thu, Nov 20, 2025 at 10:22:16AM -0600, Rob Herring wrote: > On Wed, Nov 19, 2025 at 7:33 AM Manivannan Sadhasivam <mani@kernel.org> wrote: > > > > On Tue, Nov 18, 2025 at 07:03:51AM -0600, Rob Herring wrote: > > > On Wed, Nov 12, 2025 at 8:45 AM Manivannan Sadhasivam via B4 Relay > > > <devnull+manivannan.sadhasivam.oss.qualcomm.com@kernel.org> wrote: > > > > > > > > From: Manivannan Sadhasivam <manivannan.sadhasivam@oss.qualcomm.com> > > > > > > > > If an external connector like M.2 is connected to the serdev controller > > > > in DT, then the serdev devices will be created dynamically by the connector > > > > driver. So skip registering devices from DT node as there will be no > > > > statically defined devices. > > > > > > You could still have statically defined devices. You are just choosing > > > to probe them later from the connector driver. > > > > > > > The point of coming up with the M.2 binding is to avoid hardcoding the devices > > in DT. So static devices are ruled out IMO. > > Until you have any one of the reasons we have PCIe devices described > even when in a standard slot. Take your pick. An ethernet adapter that > omits an EEPROM for the MAC address. > Hmm, I didn't envision the need to have static and dynamic devices at the same time. So you are suggesting to first look for the static devices and then look for graph port at the end? - Mani -- மணிவண்ணன் சதாசிவம்
© 2016 - 2026 Red Hat, Inc.