All of lore.kernel.org
 help / color / mirror / Atom feed
From: Frank Li <Frank.li@nxp.com>
To: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Cc: Conor Dooley <conor@kernel.org>,
	Conor Dooley <conor.dooley@microchip.com>,
	robh@kernel.org, alexandre.belloni@bootlin.com,
	conor.culhane@silvaco.com, gregkh@linuxfoundation.org,
	imx@lists.linux.dev, jirislaby@kernel.org, joe@perches.com,
	linux-i3c@lists.infradead.org, linux-kernel@vger.kernel.org,
	linux-serial@vger.kernel.org, miquel.raynal@bootlin.com,
	zbigniew.lukwinski@linux.intel.com, devicetree@vger.kernel.org,
	krzysztof.kozlowski+dt@linaro.org
Subject: Re: [PATCH v2 2/7] dt-bindings: i3c: svc: add compatible string i3c: silvaco,i3c-target-v1
Date: Wed, 17 Jan 2024 13:06:15 -0500	[thread overview]
Message-ID: <ZagXF6vMHVxvZX+6@lizhi-Precision-Tower-5810> (raw)
In-Reply-To: <e57d7f34-3abe-4860-8986-0cb7070819a4@linaro.org>

On Wed, Jan 17, 2024 at 06:15:51PM +0100, Krzysztof Kozlowski wrote:
> On 17/01/2024 17:19, Frank Li wrote:
> >>
> >> Not really, because compatible describes hardware and it is the same
> >> hardware here. We do not have two different compatibles for GPIOs being
> >> input or output.  Or two different compatibles for serial engines (ones
> >> providing UART, SPI or I2C).
> > 
> > GPIO and UART is simple. Actuall SPI and I2C have two mode, slave and
> 
> I talked about serial engines which can be multiple: UART, SPI and I2C.
> 
> > master. Many SPI/I2C is dual mode controller. Just seldom use slave mode
> > at linux side. So you just see master mode SPI/I2C controller in dt-binding
> > and dts file. So few people upstream slave part to linux kernel community.
> > They have the exact same problems if support slave mode.
> > 
> > PCI is typical example: 
> > EP mode:  Documentation/devicetree/bindings/pci/qcom,pcie-ep.yaml
> > RC mode:  Documentation/devicetree/bindings/pci/qcom,pcie.yaml
> > 
> > Which is the same hardware for two difference compatible string.
> 
> That's the only case, I recall.

As my knowledge, yes. 

> 
> >>
> >>>
> >>> I can write git commit message like:
> >>>
> >>> dt-bindings: i3c: svc: add compatible string nxp,imx93-svc-i3c-target
> >>>
> >>> silvaco i3c controller is dual mode controller, which can work as master
> >>> and target mode. All clock, reg, irq are the same for both mode. Add
> >>> compatible string "nxp,imx93-svc-i3c-target" to let silivaco i3c
> >>> controller work as target mode.
> >>>
> >>> Of course, alternate method to added a property "mode" to distingiush
> >>> master and target mode. but old "silvaco,i3c-master-v1" will actually work
> >>> as dual mode support. Driver structure will become complex.
> >>
> >> Please send full DTS of user for this, which works for 100%, so we can
> >> see how it differs from controller mode. If your code snippet from other
> >> thread is correct, then it would suggest "mode" property or lack of
> >> children. Maybe lack of children is not enough, if user-space could
> >> control I3C bus.
> > 
> > According to current implment, only need change imx93.dtsi's @i3c1's 
> > compatible string to "silvaco,i3c-target-v1". I attached imx93 dts node for
> > your reference.
> > 
> > 	i3c1: i3c-master@44330000 {                        
> >                                 compatible = "silvaco,i3c-master-v1"; 
> > 					     ^^^^ only need change here!
> 
> Nope, don't change compatibles of existing nodes. Unreadable and
> unmanageable code.

It is just show minimize difference.

Normally, it should be.

	i3c1: i3c-master@44330000 {
		...
		compatible = "silvaco,i3c-master-v1";
		...
		status = disabled;
	}
	
	i3c1-target: i3c-target@44330000 {
		...
		compatible = "silvaco,i3c-target-v1";
		...
		status = disabled;
	}

in board dts

@i3c1{
	status = "okay";
}

Or
@i3c1-target{
	status = "okay";
}
> 
> >    
> >                                 reg = <0x44330000 0x10000>;                
> >                                 interrupts = <GIC_SPI 12 IRQ_TYPE_LEVEL_HIGH>;
> >                                 #address-cells = <3>;                      
> >                                 #size-cells = <0>;                         
> >                                 clocks = <&clk IMX93_CLK_BUS_AON>,         
> >                                          <&clk IMX93_CLK_I3C1_GATE>,       
> >                                          <&clk IMX93_CLK_I3C1_SLOW>;       
> >                                 clock-names = "pclk", "fast_clk", "slow_clk";
> >                                 dmas = <&edma1 6 0 1>, <&edma1 5 0 0>;     
> >                                 dma-names = "rx", "tx";                    
> >                                 status = "disabled";                       
> >                         }; 
> 
> That's not a patch for existing file. I did not claim you cannot write
> such DTS. I claimed you don't have such DTS for upstream...

Yes, it need finialize this topic before handle dts upstream.

> 
> > 
> > For master mode:
> > Unlike i2c. Genenally I3C can auto probe children node like USB can auto
> > detect attached devices. So I3C master can work without children nodes.
> > Such as auto load i3c sensor driver according to i3c standard vendor id and
> > production id.
> 
> Then presence of children cannot be used.
> 
> > 
> > For target mode: using configfs to controller I3C.
> > 
> > mkdir /sys/kernel/config/i3c_target/functions/tty/t
> > echo 0x011b > /sys/kernel/config/i3c_target/functions/tty/t/vendor_id
> > echo 0x1000 > /sys/kernel/config/i3c_target/functions/tty/t/part_id
> > echo 0x6 > /sys/kernel/config/i3c_target/functions/tty/t/bcr
> > 
> > ln -s /sys/kernel/config/i3c_target/functions/tty/t /sys/kernel/config/i3c_target/controllers/44330000.i3c-master/
> > 
> > Then you echo test >/dev/ttySI3C0.
> > 
> > Unlike USB, user can switch host and gadget mode dymatically. Suppose I3C
> > only work on one of master or slave mode only, which is static.
> 
> I don't understand this. So it can switch dynamically or not?

I3C Protocal allow do that. But no one really do that. 

> 
> > 
> > Although it is one hardware, I think it is exculsive multi function device.
> 
> Just like serial engines. Do you see there replacing compatibles? No.
> 
> > 
> > Summary: basice two option to distingiush controller and target mode.
> > 1. by "compatible" string
> > 2. by "mode"
> > 
> > I think 1 is relatively simple and easy to understand.
> 
> Eh, if you only saw my comments on people replacing compatibles...
> Anyway, I stated my reasons, so to reiterate: NAK.

I know it.  Needn't emphase it every time.

Is using "mode" ('controller' and 'target') proptery okay?

Frank

> 
> Best regards,
> Krzysztof
> 

WARNING: multiple messages have this Message-ID (diff)
From: Frank Li <Frank.li@nxp.com>
To: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Cc: Conor Dooley <conor@kernel.org>,
	Conor Dooley <conor.dooley@microchip.com>,
	robh@kernel.org, alexandre.belloni@bootlin.com,
	conor.culhane@silvaco.com, gregkh@linuxfoundation.org,
	imx@lists.linux.dev, jirislaby@kernel.org, joe@perches.com,
	linux-i3c@lists.infradead.org, linux-kernel@vger.kernel.org,
	linux-serial@vger.kernel.org, miquel.raynal@bootlin.com,
	zbigniew.lukwinski@linux.intel.com, devicetree@vger.kernel.org,
	krzysztof.kozlowski+dt@linaro.org
Subject: Re: [PATCH v2 2/7] dt-bindings: i3c: svc: add compatible string i3c: silvaco,i3c-target-v1
Date: Wed, 17 Jan 2024 13:06:15 -0500	[thread overview]
Message-ID: <ZagXF6vMHVxvZX+6@lizhi-Precision-Tower-5810> (raw)
In-Reply-To: <e57d7f34-3abe-4860-8986-0cb7070819a4@linaro.org>

On Wed, Jan 17, 2024 at 06:15:51PM +0100, Krzysztof Kozlowski wrote:
> On 17/01/2024 17:19, Frank Li wrote:
> >>
> >> Not really, because compatible describes hardware and it is the same
> >> hardware here. We do not have two different compatibles for GPIOs being
> >> input or output.  Or two different compatibles for serial engines (ones
> >> providing UART, SPI or I2C).
> > 
> > GPIO and UART is simple. Actuall SPI and I2C have two mode, slave and
> 
> I talked about serial engines which can be multiple: UART, SPI and I2C.
> 
> > master. Many SPI/I2C is dual mode controller. Just seldom use slave mode
> > at linux side. So you just see master mode SPI/I2C controller in dt-binding
> > and dts file. So few people upstream slave part to linux kernel community.
> > They have the exact same problems if support slave mode.
> > 
> > PCI is typical example: 
> > EP mode:  Documentation/devicetree/bindings/pci/qcom,pcie-ep.yaml
> > RC mode:  Documentation/devicetree/bindings/pci/qcom,pcie.yaml
> > 
> > Which is the same hardware for two difference compatible string.
> 
> That's the only case, I recall.

As my knowledge, yes. 

> 
> >>
> >>>
> >>> I can write git commit message like:
> >>>
> >>> dt-bindings: i3c: svc: add compatible string nxp,imx93-svc-i3c-target
> >>>
> >>> silvaco i3c controller is dual mode controller, which can work as master
> >>> and target mode. All clock, reg, irq are the same for both mode. Add
> >>> compatible string "nxp,imx93-svc-i3c-target" to let silivaco i3c
> >>> controller work as target mode.
> >>>
> >>> Of course, alternate method to added a property "mode" to distingiush
> >>> master and target mode. but old "silvaco,i3c-master-v1" will actually work
> >>> as dual mode support. Driver structure will become complex.
> >>
> >> Please send full DTS of user for this, which works for 100%, so we can
> >> see how it differs from controller mode. If your code snippet from other
> >> thread is correct, then it would suggest "mode" property or lack of
> >> children. Maybe lack of children is not enough, if user-space could
> >> control I3C bus.
> > 
> > According to current implment, only need change imx93.dtsi's @i3c1's 
> > compatible string to "silvaco,i3c-target-v1". I attached imx93 dts node for
> > your reference.
> > 
> > 	i3c1: i3c-master@44330000 {                        
> >                                 compatible = "silvaco,i3c-master-v1"; 
> > 					     ^^^^ only need change here!
> 
> Nope, don't change compatibles of existing nodes. Unreadable and
> unmanageable code.

It is just show minimize difference.

Normally, it should be.

	i3c1: i3c-master@44330000 {
		...
		compatible = "silvaco,i3c-master-v1";
		...
		status = disabled;
	}
	
	i3c1-target: i3c-target@44330000 {
		...
		compatible = "silvaco,i3c-target-v1";
		...
		status = disabled;
	}

in board dts

@i3c1{
	status = "okay";
}

Or
@i3c1-target{
	status = "okay";
}
> 
> >    
> >                                 reg = <0x44330000 0x10000>;                
> >                                 interrupts = <GIC_SPI 12 IRQ_TYPE_LEVEL_HIGH>;
> >                                 #address-cells = <3>;                      
> >                                 #size-cells = <0>;                         
> >                                 clocks = <&clk IMX93_CLK_BUS_AON>,         
> >                                          <&clk IMX93_CLK_I3C1_GATE>,       
> >                                          <&clk IMX93_CLK_I3C1_SLOW>;       
> >                                 clock-names = "pclk", "fast_clk", "slow_clk";
> >                                 dmas = <&edma1 6 0 1>, <&edma1 5 0 0>;     
> >                                 dma-names = "rx", "tx";                    
> >                                 status = "disabled";                       
> >                         }; 
> 
> That's not a patch for existing file. I did not claim you cannot write
> such DTS. I claimed you don't have such DTS for upstream...

Yes, it need finialize this topic before handle dts upstream.

> 
> > 
> > For master mode:
> > Unlike i2c. Genenally I3C can auto probe children node like USB can auto
> > detect attached devices. So I3C master can work without children nodes.
> > Such as auto load i3c sensor driver according to i3c standard vendor id and
> > production id.
> 
> Then presence of children cannot be used.
> 
> > 
> > For target mode: using configfs to controller I3C.
> > 
> > mkdir /sys/kernel/config/i3c_target/functions/tty/t
> > echo 0x011b > /sys/kernel/config/i3c_target/functions/tty/t/vendor_id
> > echo 0x1000 > /sys/kernel/config/i3c_target/functions/tty/t/part_id
> > echo 0x6 > /sys/kernel/config/i3c_target/functions/tty/t/bcr
> > 
> > ln -s /sys/kernel/config/i3c_target/functions/tty/t /sys/kernel/config/i3c_target/controllers/44330000.i3c-master/
> > 
> > Then you echo test >/dev/ttySI3C0.
> > 
> > Unlike USB, user can switch host and gadget mode dymatically. Suppose I3C
> > only work on one of master or slave mode only, which is static.
> 
> I don't understand this. So it can switch dynamically or not?

I3C Protocal allow do that. But no one really do that. 

> 
> > 
> > Although it is one hardware, I think it is exculsive multi function device.
> 
> Just like serial engines. Do you see there replacing compatibles? No.
> 
> > 
> > Summary: basice two option to distingiush controller and target mode.
> > 1. by "compatible" string
> > 2. by "mode"
> > 
> > I think 1 is relatively simple and easy to understand.
> 
> Eh, if you only saw my comments on people replacing compatibles...
> Anyway, I stated my reasons, so to reiterate: NAK.

I know it.  Needn't emphase it every time.

Is using "mode" ('controller' and 'target') proptery okay?

Frank

> 
> Best regards,
> Krzysztof
> 

-- 
linux-i3c mailing list
linux-i3c@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-i3c

  reply	other threads:[~2024-01-17 18:06 UTC|newest]

Thread overview: 76+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-01-10 17:52 [PATCH v2 0/7] I3C target mode support Frank Li
2024-01-10 17:52 ` Frank Li
2024-01-10 17:52 ` [PATCH v2 1/7] i3c: add " Frank Li
2024-01-10 17:52   ` Frank Li
2024-01-10 17:52 ` [PATCH v2 2/7] dt-bindings: i3c: svc: add compatible string i3c: silvaco,i3c-target-v1 Frank Li
2024-01-10 17:52   ` Frank Li
2024-01-12  7:38   ` Krzysztof Kozlowski
2024-01-12  7:38     ` Krzysztof Kozlowski
2024-01-12 15:31     ` Frank Li
2024-01-12 15:31       ` Frank Li
2024-01-12 15:50       ` Krzysztof Kozlowski
2024-01-12 15:50         ` Krzysztof Kozlowski
2024-01-12 16:00         ` Krzysztof Kozlowski
2024-01-12 16:00           ` Krzysztof Kozlowski
2024-01-12 16:06         ` Frank Li
2024-01-12 16:06           ` Frank Li
2024-01-15 19:44           ` Frank Li
2024-01-15 19:44             ` Frank Li
2024-01-15 20:38             ` Krzysztof Kozlowski
2024-01-15 20:38               ` Krzysztof Kozlowski
2024-01-16  2:29               ` Frank Li
2024-01-16  2:29                 ` Frank Li
2024-01-16  7:24                 ` Krzysztof Kozlowski
2024-01-16  7:24                   ` Krzysztof Kozlowski
2024-01-16  9:30                   ` Conor Dooley
2024-01-16  9:30                     ` Conor Dooley
2024-01-16  9:33                     ` Krzysztof Kozlowski
2024-01-16  9:33                       ` Krzysztof Kozlowski
2024-01-16  9:48                       ` Conor Dooley
2024-01-16  9:48                         ` Conor Dooley
2024-01-16 17:35                         ` Frank Li
2024-01-16 17:35                           ` Frank Li
2024-01-16 18:23                           ` Conor Dooley
2024-01-16 18:23                             ` Conor Dooley
2024-01-16 19:13                             ` Frank Li
2024-01-16 19:13                               ` Frank Li
2024-01-16 20:30                               ` Krzysztof Kozlowski
2024-01-16 20:30                                 ` Krzysztof Kozlowski
2024-01-16 20:44                                 ` Frank Li
2024-01-16 20:44                                   ` Frank Li
2024-01-16 20:56                                   ` Krzysztof Kozlowski
2024-01-16 20:56                                     ` Krzysztof Kozlowski
2024-01-16 21:01                                     ` Krzysztof Kozlowski
2024-01-16 21:01                                       ` Krzysztof Kozlowski
2024-01-16 22:25                                       ` Frank Li
2024-01-16 22:25                                         ` Frank Li
2024-01-17  6:50                                         ` Krzysztof Kozlowski
2024-01-17  6:50                                           ` Krzysztof Kozlowski
2024-01-17 16:19                                           ` Frank Li
2024-01-17 16:19                                             ` Frank Li
2024-01-17 17:15                                             ` Krzysztof Kozlowski
2024-01-17 17:15                                               ` Krzysztof Kozlowski
2024-01-17 18:06                                               ` Frank Li [this message]
2024-01-17 18:06                                                 ` Frank Li
2024-01-19 17:13                                                 ` Frank Li
2024-01-19 17:13                                                   ` Frank Li
2024-01-16 21:31                                     ` Frank Li
2024-01-16 21:31                                       ` Frank Li
2024-01-17  6:45                                       ` Krzysztof Kozlowski
2024-01-17  6:45                                         ` Krzysztof Kozlowski
2024-01-10 17:52 ` [PATCH v2 3/7] Documentation: i3c: Add I3C target mode controller and function Frank Li
2024-01-10 17:52   ` Frank Li
2024-01-11 23:45   ` kernel test robot
2024-01-11 23:45     ` kernel test robot
2024-01-10 17:52 ` [PATCH v2 4/7] i3c: target: add svc target controller support Frank Li
2024-01-10 17:52   ` Frank Li
2024-01-11 10:01   ` kernel test robot
2024-01-11 10:01     ` kernel test robot
2024-01-11 13:49   ` kernel test robot
2024-01-11 13:49     ` kernel test robot
2024-01-10 17:52 ` [PATCH v2 5/7] i3c: target: func: add tty driver Frank Li
2024-01-10 17:52   ` Frank Li
2024-01-10 17:52 ` [PATCH v2 6/7] i3c: add API i3c_dev_gettstatus_format1() to get target device status Frank Li
2024-01-10 17:52   ` Frank Li
2024-01-10 17:52 ` [PATCH v2 7/7] tty: i3c: add TTY over I3C master support Frank Li
2024-01-10 17:52   ` Frank Li

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=ZagXF6vMHVxvZX+6@lizhi-Precision-Tower-5810 \
    --to=frank.li@nxp.com \
    --cc=alexandre.belloni@bootlin.com \
    --cc=conor.culhane@silvaco.com \
    --cc=conor.dooley@microchip.com \
    --cc=conor@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=imx@lists.linux.dev \
    --cc=jirislaby@kernel.org \
    --cc=joe@perches.com \
    --cc=krzysztof.kozlowski+dt@linaro.org \
    --cc=krzysztof.kozlowski@linaro.org \
    --cc=linux-i3c@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-serial@vger.kernel.org \
    --cc=miquel.raynal@bootlin.com \
    --cc=robh@kernel.org \
    --cc=zbigniew.lukwinski@linux.intel.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.