RE: [RFC PATCH 4/4] mmc: renesas_sdhi: Add support for RZ/V2H(P) SoC

Biju Das
2024-06-06T09:54:54Z

> -----Original Message-----
> From: Lad, Prabhakar <prabhakar.csengg@gmail.com>
> Sent: Thursday, June 6, 2024 10:50 AM
> To: Biju Das <biju.das.jz@bp.renesas.com>
> Cc: Geert Uytterhoeven <geert+renesas@glider.be>; Ulf Hansson <ulf.hansson@linaro.org>; Rob Herring
> <robh@kernel.org>; Krzysztof Kozlowski <krzk+dt@kernel.org>; Conor Dooley <conor+dt@kernel.org>;
> Wolfram Sang <wsa+renesas@sang-engineering.com>; Liam Girdwood <lgirdwood@gmail.com>; Mark Brown
> <broonie@kernel.org>; Magnus Damm <magnus.damm@gmail.com>; linux-mmc@vger.kernel.org;
> devicetree@vger.kernel.org; linux-kernel@vger.kernel.org; linux-renesas-soc@vger.kernel.org;
> Fabrizio Castro <fabrizio.castro.jz@renesas.com>; Prabhakar Mahadev Lad <prabhakar.mahadev-
> lad.rj@bp.renesas.com>
> Subject: Re: [RFC PATCH 4/4] mmc: renesas_sdhi: Add support for RZ/V2H(P) SoC
>
> Hi Biju,
>
> On Thu, Jun 6, 2024 at 10:43 AM Biju Das <biju.das.jz@bp.renesas.com> wrote:
> >
> > Hi Prabhakar,
> >
> >
> > > -----Original Message-----
> > > From: Lad, Prabhakar <prabhakar.csengg@gmail.com>
> > > Sent: Thursday, June 6, 2024 10:38 AM
> > > Subject: Re: [RFC PATCH 4/4] mmc: renesas_sdhi: Add support for
> > > RZ/V2H(P) SoC
> > >
> > > Hi Biju,
> > >
> > > Thank you for the review.
> > >
> > > On Thu, Jun 6, 2024 at 10:32 AM Biju Das <biju.das.jz@bp.renesas.com> wrote:
> > > >
> > > > Hi Prabhakar,
> > > >
> <snip>
> > > > >
> > > > > +static void renesas_sdhi_sd_status_pwen(struct tmio_mmc_host
> > > > > +*host, bool on) {
> > > > > + u32 sd_status;
> > > > > +
> > > > > + sd_ctrl_read32_rep(host, CTL_SD_STATUS, &sd_status, 1);
> > > > > + if (on)
> > > > > + sd_status |= SD_STATUS_PWEN;
> > > > > + else
> > > > > + sd_status &= ~SD_STATUS_PWEN;
> > > > > +
> > > > > + sd_ctrl_write32(host, CTL_SD_STATUS, sd_status); }
> > > > > +
> > > >
> > > > May be use regulator_set_voltage() to set this??
> > > >
> > > This is the PWEN bit which is not modelled as a regulator, we cannot
> > > use regulator_set_voltage() to set this bit.
> >
> > So, there may be a race between regulator driver and this bit??
> >
> No, there won't be any race between the regulator driver and this bit as the regulator driver only
> controls the IOVS bit and not the PWEN bit.

I guess, since it is rmw operation, there is a chance that this will overwritten in a race condition.
But mmc driver is manages the calls in serial fashion, so there won't be any races.

Cheers,
Biju