Message ID | 1588657871-14747-4-git-send-email-alain.volmat@st.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | stm32-f7: Addition of SMBus Alert / Host-notify features | expand |
On Tue, May 05, 2020 at 07:51:10AM +0200, Alain Volmat wrote: > Add a new binding of the i2c-stm32f7 driver to enable the handling > of the SMBUS-Alert > > Signed-off-by: Alain Volmat <alain.volmat@st.com> > --- > Documentation/devicetree/bindings/i2c/st,stm32-i2c.yaml | 4 ++++ > 1 file changed, 4 insertions(+) > > diff --git a/Documentation/devicetree/bindings/i2c/st,stm32-i2c.yaml b/Documentation/devicetree/bindings/i2c/st,stm32-i2c.yaml > index b50a2f420b36..04c0882c3661 100644 > --- a/Documentation/devicetree/bindings/i2c/st,stm32-i2c.yaml > +++ b/Documentation/devicetree/bindings/i2c/st,stm32-i2c.yaml > @@ -36,6 +36,10 @@ allOf: > minItems: 3 > maxItems: 3 > > + st,smbus-alert: > + description: Enable the SMBus Alert feature > + $ref: /schemas/types.yaml#/definitions/flag > + We already have smbus_alert interrupt. Can't you just check for this in the slave nodes and enable if found? > - if: > properties: > compatible: > -- > 2.17.1 >
Hello Rob, On Wed, May 13, 2020 at 02:19:32AM +0000, Rob Herring wrote: > On Tue, May 05, 2020 at 07:51:10AM +0200, Alain Volmat wrote: > > Add a new binding of the i2c-stm32f7 driver to enable the handling > > of the SMBUS-Alert > > > > Signed-off-by: Alain Volmat <alain.volmat@st.com> > > --- > > Documentation/devicetree/bindings/i2c/st,stm32-i2c.yaml | 4 ++++ > > 1 file changed, 4 insertions(+) > > > > diff --git a/Documentation/devicetree/bindings/i2c/st,stm32-i2c.yaml b/Documentation/devicetree/bindings/i2c/st,stm32-i2c.yaml > > index b50a2f420b36..04c0882c3661 100644 > > --- a/Documentation/devicetree/bindings/i2c/st,stm32-i2c.yaml > > +++ b/Documentation/devicetree/bindings/i2c/st,stm32-i2c.yaml > > @@ -36,6 +36,10 @@ allOf: > > minItems: 3 > > maxItems: 3 > > > > + st,smbus-alert: > > + description: Enable the SMBus Alert feature > > + $ref: /schemas/types.yaml#/definitions/flag > > + > > We already have smbus_alert interrupt. Can't you just check for this in > the slave nodes and enable if found? My understanding reading the code (smbalert_probe within i2c-smbus.c, of_i2c_setup_smbus_alert called when registering an adapter within i2c-core-smbus.c) is that smbus_alert refers to an interrupt on the adapter side. That is an interrupt that would be triggered when the adapter is receiving an smbus_alert message. In our case (stm32f7), we do not have specific interrupt for that purpose. The interrupt triggered when an SMBUS Alert is received (by the adapter) is the same interrupt as for other reasons and we check within the irq handler within stm32f7 the reason before calling i2c_handle_smbus_alert if the status register indicated an SMBUS Alert. So my understanding is that we cannot rely on the mechanism of naming an interrupt smbus_alert. Did I misunderstood something ? > > > - if: > > properties: > > compatible: > > -- > > 2.17.1 > >
Gentle Reminder, as I wrote in my previous responce, smbus_alert interrupt refers to an host and not a client. And since we do not have a dedicated irq for smbus_alert, I propose to add this st, binding to enable the smbus_alert mechanism. On Wed, May 13, 2020 at 07:42:31AM +0200, Alain Volmat wrote: > Hello Rob, > > On Wed, May 13, 2020 at 02:19:32AM +0000, Rob Herring wrote: > > On Tue, May 05, 2020 at 07:51:10AM +0200, Alain Volmat wrote: > > > Add a new binding of the i2c-stm32f7 driver to enable the handling > > > of the SMBUS-Alert > > > > > > Signed-off-by: Alain Volmat <alain.volmat@st.com> > > > --- > > > Documentation/devicetree/bindings/i2c/st,stm32-i2c.yaml | 4 ++++ > > > 1 file changed, 4 insertions(+) > > > > > > diff --git a/Documentation/devicetree/bindings/i2c/st,stm32-i2c.yaml b/Documentation/devicetree/bindings/i2c/st,stm32-i2c.yaml > > > index b50a2f420b36..04c0882c3661 100644 > > > --- a/Documentation/devicetree/bindings/i2c/st,stm32-i2c.yaml > > > +++ b/Documentation/devicetree/bindings/i2c/st,stm32-i2c.yaml > > > @@ -36,6 +36,10 @@ allOf: > > > minItems: 3 > > > maxItems: 3 > > > > > > + st,smbus-alert: > > > + description: Enable the SMBus Alert feature > > > + $ref: /schemas/types.yaml#/definitions/flag > > > + > > > > We already have smbus_alert interrupt. Can't you just check for this in > > the slave nodes and enable if found? > > My understanding reading the code (smbalert_probe within i2c-smbus.c, of_i2c_setup_smbus_alert called when > registering an adapter within i2c-core-smbus.c) is that smbus_alert refers to an interrupt on the > adapter side. That is an interrupt that would be triggered when the adapter is receiving an smbus_alert > message. > In our case (stm32f7), we do not have specific interrupt for that purpose. The interrupt triggered when > an SMBUS Alert is received (by the adapter) is the same interrupt as for other reasons and we check > within the irq handler within stm32f7 the reason before calling i2c_handle_smbus_alert if the status > register indicated an SMBUS Alert. > So my understanding is that we cannot rely on the mechanism of naming an interrupt smbus_alert. > Did I misunderstood something ? > > > > > > - if: > > > properties: > > > compatible: > > > -- > > > 2.17.1 > > >
> > > + st,smbus-alert: > > > + description: Enable the SMBus Alert feature > > > + $ref: /schemas/types.yaml#/definitions/flag > > > + > > > > We already have smbus_alert interrupt. Can't you just check for this in > > the slave nodes and enable if found? > > My understanding reading the code (smbalert_probe within i2c-smbus.c, of_i2c_setup_smbus_alert called when > registering an adapter within i2c-core-smbus.c) is that smbus_alert refers to an interrupt on the > adapter side. That is an interrupt that would be triggered when the adapter is receiving an smbus_alert > message. > In our case (stm32f7), we do not have specific interrupt for that purpose. The interrupt triggered when > an SMBUS Alert is received (by the adapter) is the same interrupt as for other reasons and we check > within the irq handler within stm32f7 the reason before calling i2c_handle_smbus_alert if the status > register indicated an SMBUS Alert. > So my understanding is that we cannot rely on the mechanism of naming an interrupt smbus_alert. > Did I misunderstood something ? I just wonder what is bad about specifying the same interrupt twice in the interrupt properties? You could then check in probe if "smbus_alert" is populated and if it matches the main irq.
On Sat, May 23, 2020 at 10:36:01AM +0000, wsa@kernel.org wrote: > > > > > + st,smbus-alert: > > > > + description: Enable the SMBus Alert feature > > > > + $ref: /schemas/types.yaml#/definitions/flag > > > > + > > > > > > We already have smbus_alert interrupt. Can't you just check for this in > > > the slave nodes and enable if found? > > > > My understanding reading the code (smbalert_probe within i2c-smbus.c, of_i2c_setup_smbus_alert called when > > registering an adapter within i2c-core-smbus.c) is that smbus_alert refers to an interrupt on the > > adapter side. That is an interrupt that would be triggered when the adapter is receiving an smbus_alert > > message. > > In our case (stm32f7), we do not have specific interrupt for that purpose. The interrupt triggered when > > an SMBUS Alert is received (by the adapter) is the same interrupt as for other reasons and we check > > within the irq handler within stm32f7 the reason before calling i2c_handle_smbus_alert if the status > > register indicated an SMBUS Alert. > > So my understanding is that we cannot rely on the mechanism of naming an interrupt smbus_alert. > > Did I misunderstood something ? > > I just wonder what is bad about specifying the same interrupt twice in > the interrupt properties? You could then check in probe if "smbus_alert" > is populated and if it matches the main irq. > Here's my understanding of the current implementation. During the adapter registration, the function of_i2c_setup_smbus_alert is called and if a interrupt is named "smbus_alert" in the adapter node, a new device "smbus_alert" will be created. This will leads to smbalert_probe to be called, and a request_irq will be done with the irq value read from the adapter node. This means that we will have both our handle (the handler of the main irq of the stm32 i2c driver) and the smbus_alert handler on the same irq. Leading to smbus_alert being called everytime there is a irq (most of the time not smbus_alert related) coming from the stm32_i2c. (since this is our main irq). So to me this approach can't work. I'd understand if the smbus_alert property was on the client node in the same way as it is done for host-notify however that's not the case. This is why I was proposing to have our own st,smbus-alert property to decide to enable or not the smbus_alert. In our case, we cannot rely on the mechanism done by of_i2c_setup_smbus_alert since for us, smbus_alert irq is just one case of all the other stm32 i2c irq. (this is the same irq, and we check after by reading the interrupt status register).
diff --git a/Documentation/devicetree/bindings/i2c/st,stm32-i2c.yaml b/Documentation/devicetree/bindings/i2c/st,stm32-i2c.yaml index b50a2f420b36..04c0882c3661 100644 --- a/Documentation/devicetree/bindings/i2c/st,stm32-i2c.yaml +++ b/Documentation/devicetree/bindings/i2c/st,stm32-i2c.yaml @@ -36,6 +36,10 @@ allOf: minItems: 3 maxItems: 3 + st,smbus-alert: + description: Enable the SMBus Alert feature + $ref: /schemas/types.yaml#/definitions/flag + - if: properties: compatible:
Add a new binding of the i2c-stm32f7 driver to enable the handling of the SMBUS-Alert Signed-off-by: Alain Volmat <alain.volmat@st.com> --- Documentation/devicetree/bindings/i2c/st,stm32-i2c.yaml | 4 ++++ 1 file changed, 4 insertions(+)