Re: [PATCH/RFC v2 2/3] mmc: sh_mobile_sdhi: Add tuning support

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

 



Hi Simon

> > > +static int sh_mobile_sdhi_select_tuning(struct tmio_mmc_host *host, bool *tap)
> > > +{
> > > +	unsigned long tap_num, i;
> > > +	int ok_count;
> > > +
> > > +	/* Clear SCC_RVSREQ */
> > > +	sd_scc_write32(host, SH_MOBILE_SDHI_SCC_RVSREQ, 0);
> > > +
> > > +	/* Select SCC */
> > > +	tap_num = (sd_scc_read32(host, SH_MOBILE_SDHI_SCC_DTCNTL) >>
> > > +		   SH_MOBILE_SDHI_SCC_DTCNTL_TAPNUM_SHIFT) &
> > > +		SH_MOBILE_SDHI_SCC_DTCNTL_TAPNUM_MASK;
> > > +
> > > +	/*
> > > +	 * Select clock where three consecutive bock reads succeeded.
> > > +	 *
> > > +	 * There may be multiple occurrences of three successive reads
> > > +	 * and selecting any of them is correct. Here the first one is
> > > +	 * selected.
> > > +	 */
> > > +	ok_count = 0;
> > > +	for (i = 0; i < 2 * tap_num; i++) {
> > > +		if (tap[i])
> > > +			ok_count++;
> > > +		else
> > > +			ok_count = 0;
> > > +		if (ok_count == 3)
> > > +			break;
> > > +	}
> > 
> > As I pointed on [1/3] patch, having "tap_array_size" on this function,
> > and check tap_num <-> tap_array_size is nice idea IMO.
> 
> We could also provide the array parameter and
> not read tap_num using sd_scc_read32() here at all.
> Which do you feel is best?

Not sure, but getting array_size as parameter is very normal for me.
This sd_scc_read32() is using SH_MOBILE_xxx (Renesas specific register).
So, we can use it as sanitary check ?
I don't care about it, its up to you :)
--
To unsubscribe from this list: send the line "unsubscribe linux-mmc" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



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

  Powered by Linux