mbox series

[0/2] rtc: pch-rtc: add Intel Series PCH built-in read-only RTC

Message ID 20210810154436.125678-1-i.mikhaylov@yadro.com
Headers show
Series rtc: pch-rtc: add Intel Series PCH built-in read-only RTC | expand

Message

Ivan Mikhaylov Aug. 10, 2021, 3:44 p.m. UTC
Add RTC driver with dt binding tree document. Also this driver adds one sysfs
attribute for host power control which I think is odd for RTC driver.
Need I cut it off and use I2C_SLAVE_FORCE? I2C_SLAVE_FORCE is not good
way too from my point of view. Is there any better approach?

Ivan Mikhaylov (2):
  rtc: pch-rtc: add RTC driver for Intel Series PCH
  dt-bindings: rtc: provide RTC PCH device tree binding doc

 .../bindings/rtc/intel,pch-rtc.yaml           |  39 +++++
 drivers/rtc/Kconfig                           |  10 ++
 drivers/rtc/Makefile                          |   1 +
 drivers/rtc/rtc-pch.c                         | 148 ++++++++++++++++++
 4 files changed, 198 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/rtc/intel,pch-rtc.yaml
 create mode 100644 drivers/rtc/rtc-pch.c

Comments

Paul Fertser Aug. 14, 2021, 10:42 p.m. UTC | #1
On Tue, Aug 10, 2021 at 06:44:34PM +0300, Ivan Mikhaylov wrote:
> Add RTC driver with dt binding tree document. Also this driver adds one sysfs
> attribute for host power control which I think is odd for RTC driver.
> Need I cut it off and use I2C_SLAVE_FORCE? I2C_SLAVE_FORCE is not good
> way too from my point of view. Is there any better approach?

Reading the C620 datasheet I see this interface also allows other
commands (wake up, watchdog feeding, reboot etc.) and reading statuses
(e.g Intruder Detect, POWER_OK_BAD).

I think if there's any plan to use anything other but RTC via this
interface then the driver should be registered as an MFD.
Alexandre Belloni Aug. 14, 2021, 11:22 p.m. UTC | #2
On 15/08/2021 01:42:15+0300, Paul Fertser wrote:
> On Tue, Aug 10, 2021 at 06:44:34PM +0300, Ivan Mikhaylov wrote:
> > Add RTC driver with dt binding tree document. Also this driver adds one sysfs
> > attribute for host power control which I think is odd for RTC driver.
> > Need I cut it off and use I2C_SLAVE_FORCE? I2C_SLAVE_FORCE is not good
> > way too from my point of view. Is there any better approach?
> 
> Reading the C620 datasheet I see this interface also allows other
> commands (wake up, watchdog feeding, reboot etc.) and reading statuses
> (e.g Intruder Detect, POWER_OK_BAD).
> 
> I think if there's any plan to use anything other but RTC via this
> interface then the driver should be registered as an MFD.
> 

This is not the current thinking, if everything is integrated, then
there is no issue registering a watchdog from the RTC driver. I'll let
you check with Lee...

However, I'm not sure what is the correct interface for poweroff/reboot
control.
Milton Miller II Aug. 17, 2021, 6:04 p.m. UTC | #3
On Aug 16, 2021, Alexandre Belloni wrote:
>On 15/08/2021 01:42:15+0300, Paul Fertser wrote:
>> On Tue, Aug 10, 2021 at 06:44:34PM +0300, Ivan Mikhaylov wrote:
>> > Add RTC driver with dt binding tree document. Also this driver
>adds one sysfs
>> > attribute for host power control which I think is odd for RTC
>driver.
>> > Need I cut it off and use I2C_SLAVE_FORCE? I2C_SLAVE_FORCE is not
>good
>> > way too from my point of view. Is there any better approach?
>> 
>> Reading the C620 datasheet I see this interface also allows other
>> commands (wake up, watchdog feeding, reboot etc.) and reading
>statuses
>> (e.g Intruder Detect, POWER_OK_BAD).
>> 
>> I think if there's any plan to use anything other but RTC via this
>> interface then the driver should be registered as an MFD.
>> 
>
>This is not the current thinking, if everything is integrated, then
>there is no issue registering a watchdog from the RTC driver. I'll
>let
>you check with Lee...

I think the current statement is "if they are truly disjoint 
hardware controls" then an MFD might suffice, but if they require 
software cordination the new auxillary bus seems to be desired.

>>However, I'm not sure what is the correct interface for
>poweroff/reboot
>control.

While there is a gpio interface to a simple regulator switch,
the project to date has been asserting direct or indirect 
gpios etc to control the host.   If these are events to 
trigger a change in state and not a direct state change
that some controller trys to follow, maybe a message delivery 
model?   (this is not to reboot or cycle the bmc).

milton
Alexandre Belloni Aug. 17, 2021, 8:05 p.m. UTC | #4
On 17/08/2021 18:04:09+0000, Milton Miller II wrote:
> 
> On Aug 16, 2021, Alexandre Belloni wrote:
> >On 15/08/2021 01:42:15+0300, Paul Fertser wrote:
> >> On Tue, Aug 10, 2021 at 06:44:34PM +0300, Ivan Mikhaylov wrote:
> >> > Add RTC driver with dt binding tree document. Also this driver
> >adds one sysfs
> >> > attribute for host power control which I think is odd for RTC
> >driver.
> >> > Need I cut it off and use I2C_SLAVE_FORCE? I2C_SLAVE_FORCE is not
> >good
> >> > way too from my point of view. Is there any better approach?
> >> 
> >> Reading the C620 datasheet I see this interface also allows other
> >> commands (wake up, watchdog feeding, reboot etc.) and reading
> >statuses
> >> (e.g Intruder Detect, POWER_OK_BAD).
> >> 
> >> I think if there's any plan to use anything other but RTC via this
> >> interface then the driver should be registered as an MFD.
> >> 
> >
> >This is not the current thinking, if everything is integrated, then
> >there is no issue registering a watchdog from the RTC driver. I'll
> >let
> >you check with Lee...
> 
> I think the current statement is "if they are truly disjoint 
> hardware controls" then an MFD might suffice, but if they require 
> software cordination the new auxillary bus seems to be desired.
> 

Honestly, the auxiliary bus doesn't provide anything that you can't do
by registering a device in multiple subsystem from a single driver.
(Lee Jones, Mark Brown and I did complain at the time that this was yet
another back channel for misuses).

> >>However, I'm not sure what is the correct interface for
> >poweroff/reboot
> >control.
> 
> While there is a gpio interface to a simple regulator switch,
> the project to date has been asserting direct or indirect 
> gpios etc to control the host.   If these are events to 
> trigger a change in state and not a direct state change
> that some controller trys to follow, maybe a message delivery 
> model?   (this is not to reboot or cycle the bmc).
> 
> milton
Ivan Mikhaylov Aug. 30, 2021, 11:56 a.m. UTC | #5
On Tue, 2021-08-17 at 22:05 +0200, Alexandre Belloni wrote:
> On 17/08/2021 18:04:09+0000, Milton Miller II wrote:
> > 
> > On Aug 16, 2021, Alexandre Belloni wrote:
> > > On 15/08/2021 01:42:15+0300, Paul Fertser wrote:
> > > > On Tue, Aug 10, 2021 at 06:44:34PM +0300, Ivan Mikhaylov wrote:
> > > > > Add RTC driver with dt binding tree document. Also this driver
> > > adds one sysfs
> > > > > attribute for host power control which I think is odd for RTC
> > > driver.
> > > > > Need I cut it off and use I2C_SLAVE_FORCE? I2C_SLAVE_FORCE is not
> > > good
> > > > > way too from my point of view. Is there any better approach?
> > > > 
> > > > Reading the C620 datasheet I see this interface also allows other
> > > > commands (wake up, watchdog feeding, reboot etc.) and reading
> > > statuses
> > > > (e.g Intruder Detect, POWER_OK_BAD).
> > > > 
> > > > I think if there's any plan to use anything other but RTC via this
> > > > interface then the driver should be registered as an MFD.
> > > > 
> > > 
> > > This is not the current thinking, if everything is integrated, then
> > > there is no issue registering a watchdog from the RTC driver. I'll
> > > let
> > > you check with Lee...
> > 
> > I think the current statement is "if they are truly disjoint 
> > hardware controls" then an MFD might suffice, but if they require 
> > software cordination the new auxillary bus seems to be desired.
> > 
> 
> Honestly, the auxiliary bus doesn't provide anything that you can't do
> by registering a device in multiple subsystem from a single driver.
> (Lee Jones, Mark Brown and I did complain at the time that this was yet
> another back channel for misuses).
> 
> > > > However, I'm not sure what is the correct interface for
> > > poweroff/reboot
> > > control.
> > 
> > While there is a gpio interface to a simple regulator switch,
> > the project to date has been asserting direct or indirect 
> > gpios etc to control the host.   If these are events to 
> > trigger a change in state and not a direct state change
> > that some controller trys to follow, maybe a message delivery 
> > model?   (this is not to reboot or cycle the bmc).
> > 
> > milton
> 

Alexandre, gentle reminder about this one series. I can get rid off from sysfs
attribute and put it like RO rtc without any additional things for now as
starter.

Thanks.
Ivan Mikhaylov Sept. 14, 2021, 11:52 p.m. UTC | #6
On Mon, 2021-08-30 at 14:56 +0300, Ivan Mikhaylov wrote:
> On Tue, 2021-08-17 at 22:05 +0200, Alexandre Belloni wrote:
> > On 17/08/2021 18:04:09+0000, Milton Miller II wrote:
> > > 
> > > On Aug 16, 2021, Alexandre Belloni wrote:
> > > > On 15/08/2021 01:42:15+0300, Paul Fertser wrote:
> > > > > On Tue, Aug 10, 2021 at 06:44:34PM +0300, Ivan Mikhaylov wrote:
> > > > > > Add RTC driver with dt binding tree document. Also this driver
> > > > adds one sysfs
> > > > > > attribute for host power control which I think is odd for RTC
> > > > driver.
> > > > > > Need I cut it off and use I2C_SLAVE_FORCE? I2C_SLAVE_FORCE is not
> > > > good
> > > > > > way too from my point of view. Is there any better approach?
> > > > > 
> > > > > Reading the C620 datasheet I see this interface also allows other
> > > > > commands (wake up, watchdog feeding, reboot etc.) and reading
> > > > statuses
> > > > > (e.g Intruder Detect, POWER_OK_BAD).
> > > > > 
> > > > > I think if there's any plan to use anything other but RTC via this
> > > > > interface then the driver should be registered as an MFD.
> > > > > 
> > > > 
> > > > This is not the current thinking, if everything is integrated, then
> > > > there is no issue registering a watchdog from the RTC driver. I'll
> > > > let
> > > > you check with Lee...
> > > 
> > > I think the current statement is "if they are truly disjoint 
> > > hardware controls" then an MFD might suffice, but if they require 
> > > software cordination the new auxillary bus seems to be desired.
> > > 
> > 
> > Honestly, the auxiliary bus doesn't provide anything that you can't do
> > by registering a device in multiple subsystem from a single driver.
> > (Lee Jones, Mark Brown and I did complain at the time that this was yet
> > another back channel for misuses).
> > 
> > > > > However, I'm not sure what is the correct interface for
> > > > poweroff/reboot
> > > > control.
> > > 
> > > While there is a gpio interface to a simple regulator switch,
> > > the project to date has been asserting direct or indirect 
> > > gpios etc to control the host.   If these are events to 
> > > trigger a change in state and not a direct state change
> > > that some controller trys to follow, maybe a message delivery 
> > > model?   (this is not to reboot or cycle the bmc).
> > > 
> > > milton
> > 
> 
> Alexandre, gentle reminder about this one series. I can get rid off from sysfs
> attribute and put it like RO rtc without any additional things for now as
> starter.
> 
> Thanks.
> 

ping

Thanks.