Re: [PATCH] mmc: omap_hsmmc: fix max value of clkd

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, Sep 21, 2012 at 10:28:00PM +0530, S, Venkatraman wrote:
> On Fri, Sep 21, 2012 at 8:51 PM, Balaji T K <balajitk@xxxxxx> wrote:
> > clock divisor can take a max value of 1023
> > update code as per TRM so that card init can be handled with
> > higher IP clock frequencies from which clock to the card is
> > derived.
> >
> This is difficult to read without some punctuation / capitalization.
> 
> > Signed-off-by: Balaji T K <balajitk@xxxxxx>
> > ---
> >  drivers/mmc/host/omap_hsmmc.c |    5 +++--
> >  1 files changed, 3 insertions(+), 2 deletions(-)
> >
> > diff --git a/drivers/mmc/host/omap_hsmmc.c b/drivers/mmc/host/omap_hsmmc.c
> > index d9af5f1..073b9ff 100644
> > --- a/drivers/mmc/host/omap_hsmmc.c
> > +++ b/drivers/mmc/host/omap_hsmmc.c
> > @@ -75,6 +75,7 @@
> >  #define ICE                    0x1
> >  #define ICS                    0x2
> >  #define CEN                    (1 << 2)
> > +#define CLKD_MAX               0x3FF
> 
> It'd be nice to have a comment on what 3FF stands for and it's
> relation to clock in MHz.
> 
> >  #define CLKD_MASK              0x0000FFC0
> >  #define CLKD_SHIFT             6
> >  #define DTO_MASK               0x000F0000
> > @@ -478,8 +479,8 @@ static u16 calc_divisor(struct omap_hsmmc_host *host, struct mmc_ios *ios)
> >
> >         if (ios->clock) {
> >                 dsor = DIV_ROUND_UP(clk_get_rate(host->fclk), ios->clock);
> > -               if (dsor > 250)
> > -                       dsor = 250;
> > +               if (dsor > CLKD_MAX)
> > +                       dsor = CLKD_MAX;
> 
> Can these two lines be written in one line as
> "dsor &= CLKD_MAX; " ?

maybe:

dsor = DIV_ROUND_UP(clk_get_rate(host->fclk), ios->clock);
dsor = clamp_t(u16, dsor, 0, CLKD_MAX);

-- 
balbi

Attachment: signature.asc
Description: Digital signature


[Index of Archives]     [Linux USB Devel]     [Linux Media]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux