All of lore.kernel.org
 help / color / mirror / Atom feed
From: Krzysztof Kozlowski <krzk@kernel.org>
To: Jonas Jelonek <jelonek.jonas@gmail.com>, linux-i2c@vger.kernel.org
Cc: Chris Packham <chris.packham@alliedtelesis.co.nz>,
	Markus Stockhausen <markus.stockhausen@gmx.de>
Subject: Re: [PATCH 3/3] dt-bindings: i2c: realtek,rtl9301-i2c: extend for RTL9310 support
Date: Wed, 2 Jul 2025 09:49:30 +0200	[thread overview]
Message-ID: <07cd4e2c-0419-4877-9a2a-d66f8dbe4279@kernel.org> (raw)
In-Reply-To: <3b357cd4-017e-43d9-a662-4f26fb9b8d68@gmail.com>

On 02/07/2025 09:34, Jonas Jelonek wrote:
> Hi Krzysztof,
> 
> thanks for taking the time to deal with this.
> 
> On 02.07.2025 08:11, Krzysztof Kozlowski wrote:
>> On 01/07/2025 16:31, Jonas Jelonek wrote:
>>> For the purpose:
>>> RTL9310 changed the register layout compared to RTL9300. Activating
>>> the SCL line is done by setting bit 12 for master 1 and bit 13 for master 2
>>> in a global register which is located before the master-specific registers.
>>> Thus, the driver needs to know which master (1 or 2) it is currently doing
>>> something for. That is what this property is intended to be used, naming
>>> to-be-discussed.
>> There is no global register space here and no syscon, so I don't
>> understand how can you access it, especially when they are located
>> BEFORE your address space.
> 
> Probably this explanation is still missing some background and 'global'
> was misleading here. The I2C controllers are part of Realtek switchcore.
> This is defined as a syscon in DTS and the I2C controller has to be
> defined as a child-node of it. (see 
> https://elixir.bootlin.com/linux/v6.15.1/source/arch/mips/boot/dts/realtek/rtl930x.dtsi#L45-L72)
> The driver takes its regmap from this syscon node as the I2C registers
> are within that switchcore address space.
> 
> Address layout in RTL9310 is (addresses relative to parent syscon node):
> 0x1004 - 0x100b    I2C 'global' registers
> 0x100c - 0x1023    I2C master 1 registers
> 0x1024 - 0x103b    I2C master 2 registers
> 
> The driver has to access both the registers for the master that it is
> configuring AND the 'global' ones (for SCL + SDA activation).
> 
> For upstream RTL9300 it's similar with the difference of having SCL
> selection in the master-specific registers and the register layout
> having the order:
> - I2C master 1 registers
> - I2C 'global' register
> - I2C master 2 registers

I think I will keep bookmark this talk because this is perfect example
of writing bindings rule: they supposed to be complete.

If people sent complete bindings, they would see that you are now in
tricky spot and this maybe has to be redone to standard approach - I2C
is not a child of syscon block, but separate device. When it is a
separate device we solve it (plenty of examples) with phandle to syscon
with offset or value argument.

But no! Some incomplete hardware description was sent, stuffing
everything into syscon and claiming that everything is child of syscon,
and now you are stuck with this:

system controller
        |
        |
   i2c-controller-for-multiple-SDA
           |
           |
       i2c-controllers-for-each-SDA

This is not only just confusing but maybe even not correct.

I understand that either i2c controller can take any SCL line. If so,
that could be a pinctrl, but again this is child of that device, so
pinctrl to parent would be odd.

Vendor (not generic) property seems the only solution, but then this
should not be part of the existing binding or you should clearly narrow
this per variant. It was made very clear that rtl9301-family has only
one SCL per controller and you cannot choose.

> 
>> Best regards,
>> Krzysztof
> 
> Just an idea to discuss regarding the DT compatibles:
> I was proposed out of this conversation to use something like
> 'i2c-otto-mango' ('otto' being the codename for their platform,
> 'mango' being the codename for the RTL9310 series). Based on, that
> technically(!) it doesn't make sense to distinguish between the
> variants of the series.

I don't understand what does it refer to, but anyway, soc compatibles
are the only preferred way.


Best regards,
Krzysztof

  reply	other threads:[~2025-07-02  7:49 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-07-01  9:17 [PATCH 0/3] i2c: rework and extend RTL9300 I2C driver Jonas Jelonek
2025-07-01  9:17 ` [PATCH 1/3] i2c: rework RTL9300 I2C controller driver Jonas Jelonek
2025-07-02  0:36   ` Chris Packham
2025-07-01  9:17 ` [PATCH 2/3] i2c: add RTL9310 support to " Jonas Jelonek
2025-07-01 20:14   ` AW: " markus.stockhausen
2025-07-01  9:17 ` [PATCH 3/3] dt-bindings: i2c: realtek,rtl9301-i2c: extend for RTL9310 support Jonas Jelonek
2025-07-01 11:33   ` Krzysztof Kozlowski
2025-07-01 12:34     ` Jonas Jelonek
2025-07-01 13:17       ` Krzysztof Kozlowski
2025-07-01 14:31         ` Jonas Jelonek
2025-07-02  6:11           ` Krzysztof Kozlowski
2025-07-02  7:34             ` Jonas Jelonek
2025-07-02  7:49               ` Krzysztof Kozlowski [this message]
2025-07-02  9:24                 ` Jonas Jelonek
2025-07-01 11:35   ` Krzysztof Kozlowski
2025-07-01 12:34     ` Jonas Jelonek

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=07cd4e2c-0419-4877-9a2a-d66f8dbe4279@kernel.org \
    --to=krzk@kernel.org \
    --cc=chris.packham@alliedtelesis.co.nz \
    --cc=jelonek.jonas@gmail.com \
    --cc=linux-i2c@vger.kernel.org \
    --cc=markus.stockhausen@gmx.de \
    /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.