From: Zhang Haijun <b42677@freescale.com>
To: Haijun Zhang <Haijun.Zhang@freescale.com>
Cc: linux-mmc@vger.kernel.org, linuxppc-dev@lists.ozlabs.org,
cbouatmailru@gmail.com, cjb@laptop.org, scottwood@freescale.com,
X.Xie@freescale.com, galak@kernel.crashing.org
Subject: Re: [PATCH 1/3 V4] mmc:core: parse voltage from device-tree
Date: Tue, 20 Aug 2013 09:10:20 +0800 [thread overview]
Message-ID: <5212C1FC.7070300@freescale.com> (raw)
In-Reply-To: <1376271546-25085-1-git-send-email-Haijun.Zhang@freescale.com>
Hi, Anton and all
I had update this patchset.
Is there any change need?
If so let me know.
Thanks.
On 08/12/2013 09:39 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 available voltage mask.
>
> Signed-off-by: Haijun Zhang <haijun.zhang@freescale.com>
> ---
> changes for V4:
> - Add new parameter mask to return voltages.
> changes for V3:
> - Correct the type of return value.
>
> drivers/mmc/core/core.c | 44 ++++++++++++++++++++++++++++++++++++++++++++
> include/linux/mmc/core.h | 2 ++
> 2 files changed, 46 insertions(+)
>
> diff --git a/drivers/mmc/core/core.c b/drivers/mmc/core/core.c
> index 49a5bca..b9b9fb6 100644
> --- a/drivers/mmc/core/core.c
> +++ b/drivers/mmc/core/core.c
> @@ -27,6 +27,7 @@
> #include <linux/fault-inject.h>
> #include <linux/random.h>
> #include <linux/slab.h>
> +#include <linux/of.h>
>
> #include <linux/mmc/card.h>
> #include <linux/mmc/host.h>
> @@ -1196,6 +1197,49 @@ u32 mmc_vddrange_to_ocrmask(int vdd_min, int vdd_max)
> }
> EXPORT_SYMBOL(mmc_vddrange_to_ocrmask);
>
> +#ifdef CONFIG_OF
> +
> +/**
> + * mmc_of_parse_voltage - return mask of supported voltages
> + * @np: The device node need to be parsed.
> + * @mask: mask of voltages available for MMC/SD/SDIO
> + *
> + * 1. Return zero on success.
> + * 2. Return negative errno: voltage-range is invalid.
> + */
> +int mmc_of_parse_voltage(struct device_node *np, u32 *mask)
> +{
> + const u32 *voltage_ranges;
> + int num_ranges, i;
> +
> + voltage_ranges = of_get_property(np, "voltage-ranges", &num_ranges);
> + num_ranges = num_ranges / sizeof(*voltage_ranges) / 2;
> + if (!voltage_ranges || !num_ranges) {
> + pr_info("%s: voltage-ranges unspecified\n", np->full_name);
> + return -EINVAL;
> + }
> +
> + for (i = 0; i < num_ranges; i++) {
> + const int j = i * 2;
> + u32 ocr_mask;
> +
> + ocr_mask = mmc_vddrange_to_ocrmask(
> + be32_to_cpu(voltage_ranges[j]),
> + be32_to_cpu(voltage_ranges[j + 1]));
> + if (!ocr_mask) {
> + pr_err("%s: voltage-range #%d is invalid\n",
> + np->full_name, i);
> + return -EINVAL;
> + }
> + *mask |= ocr_mask;
> + }
> +
> + return 0;
> +}
> +EXPORT_SYMBOL(mmc_of_parse_voltage);
> +
> +#endif /* CONFIG_OF */
> +
> #ifdef CONFIG_REGULATOR
>
> /**
> diff --git a/include/linux/mmc/core.h b/include/linux/mmc/core.h
> index 443243b..da51bec 100644
> --- a/include/linux/mmc/core.h
> +++ b/include/linux/mmc/core.h
> @@ -208,6 +208,8 @@ static inline void mmc_claim_host(struct mmc_host *host)
> __mmc_claim_host(host, NULL);
> }
>
> +struct device_node;
> extern u32 mmc_vddrange_to_ocrmask(int vdd_min, int vdd_max);
> +extern int mmc_of_parse_voltage(struct device_node *np, u32 *mask);
>
> #endif /* LINUX_MMC_CORE_H */
WARNING: multiple messages have this Message-ID (diff)
From: Zhang Haijun <b42677@freescale.com>
To: Haijun Zhang <Haijun.Zhang@freescale.com>
Cc: linux-mmc@vger.kernel.org, cbouatmailru@gmail.com,
scottwood@freescale.com, cjb@laptop.org,
linuxppc-dev@lists.ozlabs.org, X.Xie@freescale.com
Subject: Re: [PATCH 1/3 V4] mmc:core: parse voltage from device-tree
Date: Tue, 20 Aug 2013 09:10:20 +0800 [thread overview]
Message-ID: <5212C1FC.7070300@freescale.com> (raw)
In-Reply-To: <1376271546-25085-1-git-send-email-Haijun.Zhang@freescale.com>
Hi, Anton and all
I had update this patchset.
Is there any change need?
If so let me know.
Thanks.
On 08/12/2013 09:39 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 available voltage mask.
>
> Signed-off-by: Haijun Zhang <haijun.zhang@freescale.com>
> ---
> changes for V4:
> - Add new parameter mask to return voltages.
> changes for V3:
> - Correct the type of return value.
>
> drivers/mmc/core/core.c | 44 ++++++++++++++++++++++++++++++++++++++++++++
> include/linux/mmc/core.h | 2 ++
> 2 files changed, 46 insertions(+)
>
> diff --git a/drivers/mmc/core/core.c b/drivers/mmc/core/core.c
> index 49a5bca..b9b9fb6 100644
> --- a/drivers/mmc/core/core.c
> +++ b/drivers/mmc/core/core.c
> @@ -27,6 +27,7 @@
> #include <linux/fault-inject.h>
> #include <linux/random.h>
> #include <linux/slab.h>
> +#include <linux/of.h>
>
> #include <linux/mmc/card.h>
> #include <linux/mmc/host.h>
> @@ -1196,6 +1197,49 @@ u32 mmc_vddrange_to_ocrmask(int vdd_min, int vdd_max)
> }
> EXPORT_SYMBOL(mmc_vddrange_to_ocrmask);
>
> +#ifdef CONFIG_OF
> +
> +/**
> + * mmc_of_parse_voltage - return mask of supported voltages
> + * @np: The device node need to be parsed.
> + * @mask: mask of voltages available for MMC/SD/SDIO
> + *
> + * 1. Return zero on success.
> + * 2. Return negative errno: voltage-range is invalid.
> + */
> +int mmc_of_parse_voltage(struct device_node *np, u32 *mask)
> +{
> + const u32 *voltage_ranges;
> + int num_ranges, i;
> +
> + voltage_ranges = of_get_property(np, "voltage-ranges", &num_ranges);
> + num_ranges = num_ranges / sizeof(*voltage_ranges) / 2;
> + if (!voltage_ranges || !num_ranges) {
> + pr_info("%s: voltage-ranges unspecified\n", np->full_name);
> + return -EINVAL;
> + }
> +
> + for (i = 0; i < num_ranges; i++) {
> + const int j = i * 2;
> + u32 ocr_mask;
> +
> + ocr_mask = mmc_vddrange_to_ocrmask(
> + be32_to_cpu(voltage_ranges[j]),
> + be32_to_cpu(voltage_ranges[j + 1]));
> + if (!ocr_mask) {
> + pr_err("%s: voltage-range #%d is invalid\n",
> + np->full_name, i);
> + return -EINVAL;
> + }
> + *mask |= ocr_mask;
> + }
> +
> + return 0;
> +}
> +EXPORT_SYMBOL(mmc_of_parse_voltage);
> +
> +#endif /* CONFIG_OF */
> +
> #ifdef CONFIG_REGULATOR
>
> /**
> diff --git a/include/linux/mmc/core.h b/include/linux/mmc/core.h
> index 443243b..da51bec 100644
> --- a/include/linux/mmc/core.h
> +++ b/include/linux/mmc/core.h
> @@ -208,6 +208,8 @@ static inline void mmc_claim_host(struct mmc_host *host)
> __mmc_claim_host(host, NULL);
> }
>
> +struct device_node;
> extern u32 mmc_vddrange_to_ocrmask(int vdd_min, int vdd_max);
> +extern int mmc_of_parse_voltage(struct device_node *np, u32 *mask);
>
> #endif /* LINUX_MMC_CORE_H */
next prev parent reply other threads:[~2013-08-20 1:10 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-08-12 1:39 [PATCH 1/3 V4] mmc:core: parse voltage from device-tree Haijun Zhang
2013-08-12 1:39 ` Haijun Zhang
2013-08-12 1:39 ` [PATCH 3/3 V3] mmc:esdhc: add support to get " Haijun Zhang
2013-08-12 1:39 ` Haijun Zhang
2013-08-23 1:46 ` Anton Vorontsov
2013-08-23 1:46 ` Anton Vorontsov
2013-08-12 1:39 ` [PATCH V3] mmc:of_spi: Update the code of getting voltage-ranges Haijun Zhang
2013-08-12 1:39 ` Haijun Zhang
2013-08-23 1:45 ` Anton Vorontsov
2013-08-23 1:45 ` Anton Vorontsov
2013-08-25 4:19 ` Chris Ball
2013-08-25 4:19 ` Chris Ball
2013-08-26 1:05 ` Zhang Haijun
2013-08-26 1:05 ` Zhang Haijun
2013-08-12 1:39 ` [PATCH 2/3 V3] mmc:sdhc: get voltage from sdhc host Haijun Zhang
2013-08-12 1:39 ` Haijun Zhang
2013-08-23 1:48 ` Anton Vorontsov
2013-08-23 1:48 ` Anton Vorontsov
2013-08-23 2:01 ` Zhang Haijun
2013-08-23 2:01 ` Zhang Haijun
2013-08-23 5:08 ` Zhang Haijun
2013-08-23 5:08 ` Zhang Haijun
2013-08-20 1:10 ` Zhang Haijun [this message]
2013-08-20 1:10 ` [PATCH 1/3 V4] mmc:core: parse voltage from device-tree Zhang Haijun
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=5212C1FC.7070300@freescale.com \
--to=b42677@freescale.com \
--cc=Haijun.Zhang@freescale.com \
--cc=X.Xie@freescale.com \
--cc=cbouatmailru@gmail.com \
--cc=cjb@laptop.org \
--cc=galak@kernel.crashing.org \
--cc=linux-mmc@vger.kernel.org \
--cc=linuxppc-dev@lists.ozlabs.org \
--cc=scottwood@freescale.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.