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]

 



On Mon, May 23, 2016 at 12:57:41AM +0000, Kuninori Morimoto wrote:
> 
> Hi Simon
> 
> > From: Ai Kyuse <ai.kyuse.uw@xxxxxxxxxxx>
> > 
> > Add tuning support for use with SDR104 mode
> > This includes adding support for the sampling clock controller (SCC).
> > 
> > Signed-off-by: Ai Kyuse <ai.kyuse.uw@xxxxxxxxxxx>
> > Signed-off-by: Simon Horman <horms+renesas@xxxxxxxxxxxx>
> > ---
> (snip)
> > +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?
--
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