From: Haijun Zhang <Haijun.Zhang@freescale.com>
To: <linux-mmc@vger.kernel.org>, <linuxppc-dev@lists.ozlabs.org>
Cc: X.Xie@freescale.com, cbouatmailru@gmail.com,
scottwood@freescale.com, cjb@laptop.org,
Haijun Zhang <haijun.zhang@freescale.com>
Subject: [PATCH V3] mmc:of_spi: Update the code of getting voltage-ranges
Date: Mon, 12 Aug 2013 09:39:05 +0800 [thread overview]
Message-ID: <1376271546-25085-3-git-send-email-Haijun.Zhang@freescale.com> (raw)
In-Reply-To: <1376271546-25085-1-git-send-email-Haijun.Zhang@freescale.com>
Using function mmc_of_parse_voltage() to get voltage-ranges.
Signed-off-by: Haijun Zhang <haijun.zhang@freescale.com>
---
changes for V3:
- changes the type of ocr_mask and function mmc_of_parse_voltage
drivers/mmc/host/of_mmc_spi.c | 23 +++--------------------
1 file changed, 3 insertions(+), 20 deletions(-)
diff --git a/drivers/mmc/host/of_mmc_spi.c b/drivers/mmc/host/of_mmc_spi.c
index d720b5e..fd1928d 100644
--- a/drivers/mmc/host/of_mmc_spi.c
+++ b/drivers/mmc/host/of_mmc_spi.c
@@ -90,8 +90,7 @@ struct mmc_spi_platform_data *mmc_spi_get_pdata(struct spi_device *spi)
struct device *dev = &spi->dev;
struct device_node *np = dev->of_node;
struct of_mmc_spi *oms;
- const u32 *voltage_ranges;
- int num_ranges;
+ u32 ocr_mask;
int i;
int ret = -EINVAL;
@@ -102,26 +101,10 @@ struct mmc_spi_platform_data *mmc_spi_get_pdata(struct spi_device *spi)
if (!oms)
return NULL;
- voltage_ranges = of_get_property(np, "voltage-ranges", &num_ranges);
- num_ranges = num_ranges / sizeof(*voltage_ranges) / 2;
- if (!voltage_ranges || !num_ranges) {
- dev_err(dev, "OF: voltage-ranges unspecified\n");
+ if (mmc_of_parse_voltage(np, &ocr_mask))
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
next prev parent reply other threads:[~2013-08-12 2:33 UTC|newest]
Thread overview: 12+ 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 ` [PATCH 3/3 V3] mmc:esdhc: add support to get " Haijun Zhang
2013-08-23 1:46 ` Anton Vorontsov
2013-08-12 1:39 ` Haijun Zhang [this message]
2013-08-23 1:45 ` [PATCH V3] mmc:of_spi: Update the code of getting voltage-ranges Anton Vorontsov
2013-08-25 4:19 ` Chris Ball
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-23 1:48 ` Anton Vorontsov
2013-08-23 2:01 ` Zhang Haijun
2013-08-23 5:08 ` Zhang Haijun
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=1376271546-25085-3-git-send-email-Haijun.Zhang@freescale.com \
--to=haijun.zhang@freescale.com \
--cc=X.Xie@freescale.com \
--cc=cbouatmailru@gmail.com \
--cc=cjb@laptop.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).