Re: [PATCH 2/2] mmc: esdhc: get voltage from dts file

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

 



On 07/22/2013 09:38:33 PM, Zhang Haijun-B42677 wrote:
> -----Original Message-----
> From: Wood Scott-B07421
> Sent: Tuesday, July 23, 2013 1:41 AM
> To: Zhang Haijun-B42677
> Cc: linux-mmc@xxxxxxxxxxxxxxx; linuxppc-dev@xxxxxxxxxxxxxxxx;
> cbouatmailru@xxxxxxxxx; cjb@xxxxxxxxxx; Fleming Andy-AFLEMING; Zhang
> Haijun-B42677; Zhang Haijun-B42677
> Subject: Re: [PATCH 2/2] mmc: esdhc: get voltage from dts file
>
> On 07/22/2013 02:53:56 AM, Haijun Zhang wrote:
> > Add voltage-range support in esdhc of T4, So we can choose to read
> > voltages from dts file as one optional.
> > If we can get a valid voltage-range from device node, we use this
> > voltage as the final voltage support. Else we still read from capacity
> > or from other provider.
> >
> > Signed-off-by: Haijun Zhang <haijun.zhang@xxxxxxxxxxxxx>
> > Signed-off-by: Anton Vorontsov <cbouatmailru@xxxxxxxxx>
> > ---
> >  drivers/mmc/host/sdhci-of-esdhc.c | 31
> > +++++++++++++++++++++++++++++++
> >  drivers/mmc/host/sdhci.c          |  3 +++
> >  include/linux/mmc/sdhci.h         |  1 +
> >  3 files changed, 35 insertions(+)
> >
> > diff --git a/drivers/mmc/host/sdhci-of-esdhc.c
> > b/drivers/mmc/host/sdhci-of-esdhc.c
> > index 15039e2..8b4b27a 100644
> > --- a/drivers/mmc/host/sdhci-of-esdhc.c
> > +++ b/drivers/mmc/host/sdhci-of-esdhc.c
> > @@ -262,6 +262,35 @@ static int esdhc_pltfm_bus_width(struct
> > sdhci_host *host, int width)
> >  	return 0;
> >  }
> >
> > +static void esdhc_get_voltage(struct sdhci_host *host,
> > +			struct platform_device *pdev)
> > +{
> > +	const u32 *voltage_ranges;
> > +	int num_ranges, i;
> > +	struct device_node *np;
> > +	np = pdev->dev.of_node;
> > +
> > +	voltage_ranges = of_get_property(np, "voltage-ranges",
> > &num_ranges);
> > +	num_ranges = num_ranges / sizeof(*voltage_ranges) / 2;
> > +	if (!voltage_ranges || !num_ranges) {
> > +		dev_info(&pdev->dev, "OF: voltage-ranges
> > unspecified\n");
> > +		return;
> > +	}
> > +
> > +	for (i = 0; i < num_ranges; i++) {
> > +		const int j = i * 2;
> > +		u32 mask;
> > +		mask =
> > mmc_vddrange_to_ocrmask(be32_to_cpu(voltage_ranges[j]),
> > +				be32_to_cpu(voltage_ranges[j + 1]));
> > +		if (!mask) {
> > +			dev_info(&pdev->dev,
> > +				"OF: false voltage-ranges specified\n");
> > +			return;
> > +		}
> > +		host->ocr_mask |= mask;
> > +	}
> > +}
>
> Don't duplicate this code.  Move it somewhere common and share it.
[Haijun Wrote:] So, move it drivers/mmc/host/sdhci-pltfm.c and share it as
Sdhc_get_voltage()....?

I'll let the MMC maintainer say what the appropriate place would be... Don't capitalize the function name, though. :-)

-Scott
--
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