Add function to support get voltage from device-tree.
If there are voltage-range specified in device-tree node, this function
will parse it and return the avail voltage mask.
Signed-off-by: Haijun Zhang <redacted>
---
changes for v2:
- Update the parameters of function
drivers/mmc/core/core.c | 46 ++++++++++++++++++++++++++++++++++++++++++++++
include/linux/mmc/core.h | 1 +
2 files changed, 47 insertions(+)
Add suppport to get voltage from device-tree node for esdhc host,
if voltage-ranges was specified in device-tree node we can get
ocr_mask instead of read from host capacity register. If not voltages
still can be get from host capacity register.
Signed-off-by: Haijun Zhang <redacted>
---
changes for v2:
- Update the parameters of function
drivers/mmc/host/sdhci-of-esdhc.c | 1 +
1 file changed, 1 insertion(+)
@@ -316,6 +316,7 @@ static int sdhci_esdhc_probe(struct platform_device *pdev)/* call to generic mmc_of_parse to support additional capabilities */mmc_of_parse(host->mmc);+host->ocr_mask=mmc_of_parse_voltage(np);ret=sdhci_add_host(host);if(ret)
Add function to support get voltage from device-tree.
If there are voltage-range specified in device-tree node, this function
will parse it and return the avail voltage mask.
Signed-off-by: Haijun Zhang <redacted>
---
changes for v2:
- Update the parameters of function
drivers/mmc/core/core.c | 46 ++++++++++++++++++++++++++++++++++++++++++++++
include/linux/mmc/core.h | 1 +
2 files changed, 47 insertions(+)
'< 0' check for an unsigned type? :) I'd write just !ocr_mask...
But other than that the patch looks good to me...
Reviewed-by: Anton Vorontsov <redacted>
Thanks!
goto err_ocr;
- }
-
- 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) {
- ret = -EINVAL;
- dev_err(dev, "OF: voltage-range #%d is invalid\n", i);
- goto err_ocr;
- }
- oms->pdata.ocr_mask |= mask;
- }
+ oms->pdata.ocr_mask |= ocr_mask;
for (i = 0; i < ARRAY_SIZE(oms->gpios); i++) {
enum of_gpio_flags gpio_flags;
--
1.8.0
From: Anton Vorontsov <hidden> Date: 2013-08-09 00:20:20
On Wed, Jul 31, 2013 at 02:25:25PM +0800, Haijun Zhang wrote:
quoted hunk
Add function to support get voltage from device-tree.
If there are voltage-range specified in device-tree node, this function
will parse it and return the avail voltage mask.
Signed-off-by: Haijun Zhang <redacted>
---
changes for v2:
- Update the parameters of function
drivers/mmc/core/core.c | 46 ++++++++++++++++++++++++++++++++++++++++++++++
include/linux/mmc/core.h | 1 +
2 files changed, 47 insertions(+)
@@ -1196,6 +1197,51 @@ u32 mmc_vddrange_to_ocrmask(int vdd_min, int vdd_max)}EXPORT_SYMBOL(mmc_vddrange_to_ocrmask);+#ifdef CONFIG_OF++/*
This is not kernel-doc formatted comment for the function.. it should
start with /**...
+ * mmc_of_parse_voltage - return mask of supported voltages
+ * @np: The device node need to be parsed.
+ *
+ * 1. Return zero: voltage-ranges unspecified in device-tree.
+ * 2. Return negative errno: voltage-range is invalid.
This doesn't seem right... the function returns the unsigned mask... You
can change the prototype of this func to something like this:
int mmc_of_parse_voltage(struct device_node *np, u32 *mask);
So the function will fill the mask and return 0 on success, and will
return negtive errno on errors.
+ * 3. Return ocr_mask: a mask of voltages that parse from device-tree
+ * node can be provided to MMC/SD/SDIO devices.
+ */
+
On Wed, Jul 31, 2013 at 02:25:25PM +0800, Haijun Zhang wrote:
quoted
Add function to support get voltage from device-tree.
If there are voltage-range specified in device-tree node, this function
will parse it and return the avail voltage mask.
Signed-off-by: Haijun Zhang <redacted>
---
changes for v2:
- Update the parameters of function
drivers/mmc/core/core.c | 46 ++++++++++++++++++++++++++++++++++++++++++++++
include/linux/mmc/core.h | 1 +
2 files changed, 47 insertions(+)
@@ -1196,6 +1197,51 @@ u32 mmc_vddrange_to_ocrmask(int vdd_min, int vdd_max)}EXPORT_SYMBOL(mmc_vddrange_to_ocrmask);+#ifdef CONFIG_OF++/*
This is not kernel-doc formatted comment for the function.. it should
start with /**...
quoted
+ * mmc_of_parse_voltage - return mask of supported voltages
+ * @np: The device node need to be parsed.
+ *
+ * 1. Return zero: voltage-ranges unspecified in device-tree.
+ * 2. Return negative errno: voltage-range is invalid.
This doesn't seem right... the function returns the unsigned mask... You
can change the prototype of this func to something like this:
int mmc_of_parse_voltage(struct device_node *np, u32 *mask);
So the function will fill the mask and return 0 on success, and will
return negtive errno on errors.
Thanks, Anton.
I'll correct the return prototype of the function.
In case voltage unspecified in device node is not an error in my
platform. So i hope to reserve the zero as unspecified case and give an
prompt, an available value in case success, negative errno in case
error. It's easy to figure out the root cause.
quoted
+ * 3. Return ocr_mask: a mask of voltages that parse from device-tree
+ * node can be provided to MMC/SD/SDIO devices.
+ */
+
From: Kumar Gala <hidden> Date: 2013-08-09 14:48:28
On Jul 31, 2013, at 1:25 AM, Haijun Zhang wrote:
Add function to support get voltage from device-tree.
If there are voltage-range specified in device-tree node, this =
function
will parse it and return the avail voltage mask.
=20
Signed-off-by: Haijun Zhang <redacted>
---
changes for v2:
- Update the parameters of function
=20
drivers/mmc/core/core.c | 46 =
Add function to support get voltage from device-tree.
If there are voltage-range specified in device-tree node, this function
will parse it and return the avail voltage mask.
Signed-off-by: Haijun Zhang <redacted>
---
changes for v2:
- Update the parameters of function
drivers/mmc/core/core.c | 46 ++++++++++++++++++++++++++++++++++++++++++++++
include/linux/mmc/core.h | 1 +
2 files changed, 47 insertions(+)
There should be a device tree binding spec update to go with this patch series.
- k
Hi, kumar
I'll update this tree binding spec after the patch set is accept by Anton.
--
Thanks & Regards
Haijun
From: Scott Wood <hidden> Date: 2013-08-12 16:11:49
On Mon, 2013-08-12 at 10:46 +0800, Zhang Haijun wrote:
On 08/09/2013 10:48 PM, Kumar Gala wrote:
quoted
On Jul 31, 2013, at 1:25 AM, Haijun Zhang wrote:
quoted
Add function to support get voltage from device-tree.
If there are voltage-range specified in device-tree node, this function
will parse it and return the avail voltage mask.
Signed-off-by: Haijun Zhang <redacted>
---
changes for v2:
- Update the parameters of function
drivers/mmc/core/core.c | 46 ++++++++++++++++++++++++++++++++++++++++++++++
include/linux/mmc/core.h | 1 +
2 files changed, 47 insertions(+)
There should be a device tree binding spec update to go with this patch series.
- k
Hi, kumar
I'll update this tree binding spec after the patch set is accept by
Anton.
Bindings should come first (or at least, at the same time).
-Scott