All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Paweł Anikiel" <pan@semihalf.com>
To: Alexandre Belloni <alexandre.belloni@bootlin.com>
Cc: Arnd Bergmann <arnd@arndb.de>,
	jarkko.nikula@linux.intel.com,
	Andy Shevchenko <andriy.shevchenko@linux.intel.com>,
	Mika Westerberg <mika.westerberg@linux.intel.com>,
	Rob Herring <robh+dt@kernel.org>,
	Philipp Zabel <p.zabel@pengutronix.de>,
	Olof Johansson <olof@lixom.net>, SoC Team <soc@kernel.org>,
	Dinh Nguyen <dinguyen@kernel.org>,
	Pratyush Yadav <p.yadav@ti.com>,
	Tudor Ambarus <Tudor.Ambarus@microchip.com>,
	Linux I2C <linux-i2c@vger.kernel.org>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	Sebastian Reichel <sre@kernel.org>,
	"Leizhen (ThunderTown)" <thunder.leizhen@huawei.com>,
	Jonathan Cameron <Jonathan.Cameron@huawei.com>,
	DTML <devicetree@vger.kernel.org>,
	Linux ARM <linux-arm-kernel@lists.infradead.org>,
	Konrad Adamczyk <ka@semihalf.com>,
	Tomasz Nowicki <tn@semihalf.com>,
	Jacek Majkowski <jam@semihalf.com>,
	Alexandru Stan <amstan@google.com>
Subject: Re: [PATCH v2 2/4] dt-bindings: add bus number property
Date: Wed, 6 Oct 2021 11:29:03 +0200	[thread overview]
Message-ID: <CAF9_jYT7_9Oz-HFSy5z7uiieoHtujUD_En9MTi68PxGb7gxphw@mail.gmail.com> (raw)
In-Reply-To: <YVx9IMk7cJSCK79/@piout.net>

On Tue, Oct 5, 2021 at 6:28 PM Alexandre Belloni
<alexandre.belloni@bootlin.com> wrote:
>
> On 05/10/2021 18:22:12+0200, Arnd Bergmann wrote:
> > On Tue, Oct 5, 2021 at 4:37 PM Paweł Anikiel <pan@semihalf.com> wrote:
> > >
> > > On SoCFPGA systems, it's desireable to have fixed numbering for
> > > i2c busses, while being able to enable/disable them (e.g. have i2c1
> > > be mapped to /dev/i2c-1, even though i2c0 is disabled). This can also
> > > be achieved using devicetree aliases (see i2c_add_adapter). However,
> > > having the driver be self-contained without relying on aliases is more
> > > robust.
> > >
> > > Signed-off-by: Paweł Anikiel <pan@semihalf.com>
> >
> > I don't see how adding a nonstandard property in one of the i2c bus
> > drivers helps at all. How do you expect this to work when there are
> > multiple i2c controllers in the system using different drivers? What
> > should happen if both an alias and the busno property are set?
> >
>
> What happens when two nodes have the same busno property because e.g.
> one is in a dtsi and the other one is in a dts?
>

If busno is set, the alias is ignored (the code that checks aliases
is never reached). If two nodes have the same busno property, we get
a WARN in drivers/i2c/i2c-core-base.c:1637, and only on of them
gets attached.

What is a better way of doing this then? Is adding aliases to the
devicetree like this okay?

aliases {
...
i2c0 = &i2c0;
i2c1 = &i2c1;
};

WARNING: multiple messages have this Message-ID (diff)
From: "Paweł Anikiel" <pan@semihalf.com>
To: Alexandre Belloni <alexandre.belloni@bootlin.com>
Cc: Arnd Bergmann <arnd@arndb.de>,
	jarkko.nikula@linux.intel.com,
	 Andy Shevchenko <andriy.shevchenko@linux.intel.com>,
	 Mika Westerberg <mika.westerberg@linux.intel.com>,
	Rob Herring <robh+dt@kernel.org>,
	 Philipp Zabel <p.zabel@pengutronix.de>,
	Olof Johansson <olof@lixom.net>, SoC Team <soc@kernel.org>,
	 Dinh Nguyen <dinguyen@kernel.org>,
	Pratyush Yadav <p.yadav@ti.com>,
	 Tudor Ambarus <Tudor.Ambarus@microchip.com>,
	Linux I2C <linux-i2c@vger.kernel.org>,
	 Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	Sebastian Reichel <sre@kernel.org>,
	 "Leizhen (ThunderTown)" <thunder.leizhen@huawei.com>,
	Jonathan Cameron <Jonathan.Cameron@huawei.com>,
	 DTML <devicetree@vger.kernel.org>,
	 Linux ARM <linux-arm-kernel@lists.infradead.org>,
	Konrad Adamczyk <ka@semihalf.com>,
	 Tomasz Nowicki <tn@semihalf.com>,
	Jacek Majkowski <jam@semihalf.com>,
	Alexandru Stan <amstan@google.com>
Subject: Re: [PATCH v2 2/4] dt-bindings: add bus number property
Date: Wed, 6 Oct 2021 11:29:03 +0200	[thread overview]
Message-ID: <CAF9_jYT7_9Oz-HFSy5z7uiieoHtujUD_En9MTi68PxGb7gxphw@mail.gmail.com> (raw)
Message-ID: <20211006092903.A-w9OTOPZGWXPAJIqh-5D8g9oKE98CQ5F_LqTxvtFXQ@z> (raw)
In-Reply-To: <YVx9IMk7cJSCK79/@piout.net>

On Tue, Oct 5, 2021 at 6:28 PM Alexandre Belloni
<alexandre.belloni@bootlin.com> wrote:
>
> On 05/10/2021 18:22:12+0200, Arnd Bergmann wrote:
> > On Tue, Oct 5, 2021 at 4:37 PM Paweł Anikiel <pan@semihalf.com> wrote:
> > >
> > > On SoCFPGA systems, it's desireable to have fixed numbering for
> > > i2c busses, while being able to enable/disable them (e.g. have i2c1
> > > be mapped to /dev/i2c-1, even though i2c0 is disabled). This can also
> > > be achieved using devicetree aliases (see i2c_add_adapter). However,
> > > having the driver be self-contained without relying on aliases is more
> > > robust.
> > >
> > > Signed-off-by: Paweł Anikiel <pan@semihalf.com>
> >
> > I don't see how adding a nonstandard property in one of the i2c bus
> > drivers helps at all. How do you expect this to work when there are
> > multiple i2c controllers in the system using different drivers? What
> > should happen if both an alias and the busno property are set?
> >
>
> What happens when two nodes have the same busno property because e.g.
> one is in a dtsi and the other one is in a dts?
>

If busno is set, the alias is ignored (the code that checks aliases
is never reached). If two nodes have the same busno property, we get
a WARN in drivers/i2c/i2c-core-base.c:1637, and only on of them
gets attached.

What is a better way of doing this then? Is adding aliases to the
devicetree like this okay?

aliases {
...
i2c0 = &i2c0;
i2c1 = &i2c1;
};

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

  parent reply	other threads:[~2021-10-06  8:29 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-10-05 14:37 [PATCH v2 0/4] Add support for the Mercury+ AA1 module Paweł Anikiel
2021-10-05 14:37 ` Paweł Anikiel
2021-10-05 14:37 ` [PATCH v2 1/4] i2c: check bus number property in DesignWare I2C Controller Paweł Anikiel
2021-10-05 14:37   ` Paweł Anikiel
2021-10-05 16:19   ` Andy Shevchenko
2021-10-05 16:19     ` Andy Shevchenko
2021-10-05 14:37 ` [PATCH v2 2/4] dt-bindings: add bus number property Paweł Anikiel
2021-10-14 16:46   ` Rob Herring
2021-10-14 16:46     ` Rob Herring
2021-10-05 14:37 ` Paweł Anikiel
2021-10-05 14:37   ` Paweł Anikiel
2021-10-05 16:22   ` Arnd Bergmann
2021-10-05 16:22     ` Arnd Bergmann
2021-10-05 16:28     ` Alexandre Belloni
2021-10-05 16:28       ` Alexandre Belloni
2021-10-06  9:21       ` Paweł Anikiel
2021-10-06  9:41         ` Arnd Bergmann
2021-10-06  9:41           ` Arnd Bergmann
2021-10-06  9:29       ` Paweł Anikiel [this message]
2021-10-06  9:29         ` Paweł Anikiel
2021-10-05 14:37 ` [PATCH v2 3/4] reset: socfpga: add empty driver allowing consumers to probe Paweł Anikiel
2021-10-05 14:37   ` Paweł Anikiel
2021-10-05 14:37 ` [PATCH v2 4/4] dts: socfpga: Add Mercury+ AA1 devicetree Paweł Anikiel
2021-10-05 14:37   ` Paweł Anikiel

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=CAF9_jYT7_9Oz-HFSy5z7uiieoHtujUD_En9MTi68PxGb7gxphw@mail.gmail.com \
    --to=pan@semihalf.com \
    --cc=Jonathan.Cameron@huawei.com \
    --cc=Tudor.Ambarus@microchip.com \
    --cc=alexandre.belloni@bootlin.com \
    --cc=amstan@google.com \
    --cc=andriy.shevchenko@linux.intel.com \
    --cc=arnd@arndb.de \
    --cc=devicetree@vger.kernel.org \
    --cc=dinguyen@kernel.org \
    --cc=jam@semihalf.com \
    --cc=jarkko.nikula@linux.intel.com \
    --cc=ka@semihalf.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-i2c@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mika.westerberg@linux.intel.com \
    --cc=olof@lixom.net \
    --cc=p.yadav@ti.com \
    --cc=p.zabel@pengutronix.de \
    --cc=robh+dt@kernel.org \
    --cc=soc@kernel.org \
    --cc=sre@kernel.org \
    --cc=thunder.leizhen@huawei.com \
    --cc=tn@semihalf.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.