RE: [PATCH v4 4/5] scsi: ufs-exynos: add UFS host support for Exynos SoCs

From: Alim Akhtar
Date: Thu Apr 02 2020 - 11:08:27 EST


Hi Avri

> -----Original Message-----
> From: Avri Altman <Avri.Altman@xxxxxxx>
> Sent: 28 March 2020 16:58
> To: Alim Akhtar <alim.akhtar@xxxxxxxxxxx>; robh+dt@xxxxxxxxxx;
> devicetree@xxxxxxxxxxxxxxx; linux-scsi@xxxxxxxxxxxxxxx
> Cc: krzk@xxxxxxxxxx; martin.petersen@xxxxxxxxxx; kwmad.kim@xxxxxxxxxxx;
> stanley.chu@xxxxxxxxxxxx; cang@xxxxxxxxxxxxxx; linux-samsung-
> soc@xxxxxxxxxxxxxxx; linux-arm-kernel@xxxxxxxxxxxxxxxxxxx; linux-
> kernel@xxxxxxxxxxxxxxx
> Subject: RE: [PATCH v4 4/5] scsi: ufs-exynos: add UFS host support for Exynos
> SoCs
>
> Hi,
>
> > +
> > +long exynos_ufs_calc_time_cntr(struct exynos_ufs *ufs, long period) {
> > + const int precise = 10;
> > + long pclk_rate = ufs->pclk_rate;
> > + long clk_period, fraction;
> > +
> > + clk_period = UNIPRO_PCLK_PERIOD(ufs);
> > + fraction = ((NSEC_PER_SEC % pclk_rate) * precise) / pclk_rate;
> > +
> > + return (period * precise) / ((clk_period * precise) +
> > +fraction); }
> This helper essentially calculates a factor f, and returns period x f.
> Why not do that regardless of period?
>
The period can be different for different timing attributes, so this helper function takes the period and returns the timer counter value based on the pclk_rate.

> > +extern long exynos_ufs_calc_time_cntr(struct exynos_ufs *, long);
> Why this factor needed to be exported?
Yes, not needed, will correct this in next version, which I am planning to post soon.
Thanks for your time and review, let me know if you have more inputs.