Re: [PATCH v11 2/2] rtc: Add NXP PCF85053 driver support
From: Potin Lai
Date: Thu Dec 03 2026 - 07:36:58 EST
On Sat, Oct 24, 2026 at 7:04 PM Lakshay Piplani <lakshay.piplani@xxxxxxx> wrote:
> + if (pcf85053->is_primary) {
> + bool claim_write_access;
> + unsigned int ctrl;
> +
> + claim_write_access = no_fwnode ||
> + device_property_read_bool(dev, "nxp,write-access");
> +
> + err = regmap_read(pcf85053->regmap, PCF85053_REG_CTRL, &ctrl);
> + if (err)
> + return err;
> +
> + if (claim_write_access) {
> + if (!(ctrl & PCF85053_BIT_TWO)) {
> + err = regmap_update_bits(pcf85053->regmap, PCF85053_REG_CTRL,
> + PCF85053_BIT_TWO, PCF85053_BIT_TWO);
> + if (err)
> + return err;
> + }
> + dev_dbg(dev, "Ownership set: TWO=1 (primary writes)\n");
> + } else {
> + /* Relinquish ownership (TWO=0) so the secondary may write. */
> + if (ctrl & PCF85053_BIT_TWO) {
> + err = regmap_update_bits(pcf85053->regmap, PCF85053_REG_CTRL,
> + PCF85053_BIT_TWO, 0);
> + if (err)
> + return err;
> + }
> + dev_dbg(dev, "Default ownership set: TWO=0 (secondary writes)\n");
> + }
> + }
> +
Hi Lakshay,
Thanks for the v11 patch.
With the current implementation, write ownership (TWO) is set
statically at probe time (and defaults to TWO = 1 when there is no DT
node), which prevents the secondary bus from updating the RTC time.
In our use case, both the primary bus (e.g. BMC) and the secondary bus
(e.g. host) may need to update the RTC time. Would you consider
following the approach used in drivers/rtc/rtc-nct3018y.c?
Specifically:
- Leave write ownership to the secondary bus (TWO = 0) by default.
- When the primary bus needs to update the time in set_time(),
temporarily claim ownership (TWO = 1), write the time registers, and
restore it back to TWO = 0 once the update is finished.
This way, the secondary bus can update the RTC time by default, and
the primary bus can still update it whenever needed without
permanently blocking the secondary bus.
Thanks for your consideration.
Best regards,
Potin Lai