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 :)



[Index of Archives]     [Linux Samsung SOC]     [Linux Wireless]     [Linux Kernel]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Samba]     [Device Mapper]

  Powered by Linux