Re: [RFC] sdhci: 8 bit bus width changes

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

 



Hi Philip,

I'd like to take this patch.  One comment, though: 

On Fri, Oct 01, 2010 at 03:45:50PM -0700, Philip Rakity wrote:
> diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c
> index 73a94fe..ec103c3 100644
> --- a/drivers/mmc/host/sdhci.c
> +++ b/drivers/mmc/host/sdhci.c
> @@ -1182,17 +1182,31 @@ static void sdhci_set_ios(struct mmc_host *mmc, struct mmc_ios *ios)
>  	else
>  		sdhci_set_power(host, ios->vdd);
>  
> -	ctrl = sdhci_readb(host, SDHCI_HOST_CONTROL);
>  
> -	if (ios->bus_width == MMC_BUS_WIDTH_8)
> -		ctrl |= SDHCI_CTRL_8BITBUS;
> -	else
> -		ctrl &= ~SDHCI_CTRL_8BITBUS;
> +	/*
> +	 * use platform_8_bit_width if not v3 controller
> +	 * or if special hw/board specific processing is needed
> +	 */
> +	if (host->ops->platform_8bit_width)
> +		host->ops->platform_8bit_width(host, ios->bus_width);
> +	else {
> +		ctrl = sdhci_readb(host, SDHCI_HOST_CONTROL);
> +		if (ios->bus_width == MMC_BUS_WIDTH_8) {
> +			ctrl &= ~SDHCI_CTRL_4BITBUS;
> +			if (host->version >= SDHCI_SPEC_300)
> +				ctrl |= SDHCI_CTRL_8BITBUS;
> +		} else {
> +			if (host->version >= SDHCI_SPEC_300)
> +				ctrl &= ~SDHCI_CTRL_8BITBUS;
> +			if (ios->bus_width == MMC_BUS_WIDTH_4)
> +				ctrl |= SDHCI_CTRL_4BITBUS;
> +			else
> +				ctrl &= ~SDHCI_CTRL_4BITBUS;
> +		}
> +		sdhci_writeb(host, ctrl, SDHCI_HOST_CONTROL);
> +	}
>  
> -	if (ios->bus_width == MMC_BUS_WIDTH_4)
> -		ctrl |= SDHCI_CTRL_4BITBUS;
> -	else
> -		ctrl &= ~SDHCI_CTRL_4BITBUS;
> +	ctrl = sdhci_readb(host, SDHCI_HOST_CONTROL);

I don't see why we should re-read ctrl here, since we've already written
it back to the device at this point, and we don't use it anywhere below
this line.

Thanks,

-- 
Chris Ball   <cjb@xxxxxxxxxx>   <http://printf.net/>
One Laptop Per Child
--
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