From: Scott Wood <scottwood@freescale.com>
Cc: linux-mmc@vger.kernel.org, linuxppc-dev@lists.ozlabs.org,
cbouatmailru@gmail.com, cjb@laptop.org, AFLEMING@freescale.com,
Haijun Zhang <Haijun.Zhang@freescale.com>,
Haijun Zhang <haijun.zhang@freescale.com>
Subject: Re: [PATCH 2/2] mmc: esdhc: get voltage from dts file
Date: Mon, 22 Jul 2013 12:40:47 -0500 [thread overview]
Message-ID: <1374514847.15592.7@snotra> (raw)
In-Reply-To: <1374479636-9254-2-git-send-email-Haijun.Zhang@freescale.com> (from Haijun.Zhang@freescale.com on Mon Jul 22 02:53:56 2013)
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@freescale.com>
> Signed-off-by: Anton Vorontsov <cbouatmailru@gmail.com>
> ---
> 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.
Why did you remove the range index from the error string, and why did
you change it from dev_err to dev_info?
-Scott
WARNING: multiple messages have this Message-ID (diff)
From: Scott Wood <scottwood@freescale.com>
To: Haijun Zhang <Haijun.Zhang@freescale.com>
Cc: linux-mmc@vger.kernel.org, AFLEMING@freescale.com,
cbouatmailru@gmail.com, cjb@laptop.org,
linuxppc-dev@lists.ozlabs.org,
Haijun Zhang <haijun.zhang@freescale.com>
Subject: Re: [PATCH 2/2] mmc: esdhc: get voltage from dts file
Date: Mon, 22 Jul 2013 12:40:47 -0500 [thread overview]
Message-ID: <1374514847.15592.7@snotra> (raw)
In-Reply-To: <1374479636-9254-2-git-send-email-Haijun.Zhang@freescale.com> (from Haijun.Zhang@freescale.com on Mon Jul 22 02:53:56 2013)
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.
>=20
> Signed-off-by: Haijun Zhang <haijun.zhang@freescale.com>
> Signed-off-by: Anton Vorontsov <cbouatmailru@gmail.com>
> ---
> drivers/mmc/host/sdhci-of-esdhc.c | 31 =20
> +++++++++++++++++++++++++++++++
> drivers/mmc/host/sdhci.c | 3 +++
> include/linux/mmc/sdhci.h | 1 +
> 3 files changed, 35 insertions(+)
>=20
> diff --git a/drivers/mmc/host/sdhci-of-esdhc.c =20
> 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 =20
> sdhci_host *host, int width)
> return 0;
> }
>=20
> +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 =3D pdev->dev.of_node;
> +
> + voltage_ranges =3D of_get_property(np, "voltage-ranges", =20
> &num_ranges);
> + num_ranges =3D num_ranges / sizeof(*voltage_ranges) / 2;
> + if (!voltage_ranges || !num_ranges) {
> + dev_info(&pdev->dev, "OF: voltage-ranges =20
> unspecified\n");
> + return;
> + }
> +
> + for (i =3D 0; i < num_ranges; i++) {
> + const int j =3D i * 2;
> + u32 mask;
> + mask =3D =20
> 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 |=3D mask;
> + }
> +}
Don't duplicate this code. Move it somewhere common and share it.
Why did you remove the range index from the error string, and why did =20
you change it from dev_err to dev_info?
-Scott=
next prev parent reply other threads:[~2013-07-22 17:41 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-07-22 7:53 [PATCH 1/2] Powerpc: Add voltage ranges support for T4 Haijun Zhang
2013-07-22 7:53 ` Haijun Zhang
2013-07-22 7:53 ` [PATCH 2/2] mmc: esdhc: get voltage from dts file Haijun Zhang
2013-07-22 7:53 ` Haijun Zhang
2013-07-22 17:40 ` Scott Wood [this message]
2013-07-22 17:40 ` Scott Wood
2013-07-23 2:38 ` Zhang Haijun-B42677
2013-07-23 2:38 ` Zhang Haijun-B42677
2013-07-23 2:41 ` Scott Wood
2013-07-23 2:41 ` Scott Wood
2013-07-23 3:41 ` Zhang Haijun-B42677
2013-07-23 3:41 ` Zhang Haijun-B42677
2013-07-26 19:06 ` Anton Vorontsov
2013-07-26 19:06 ` Anton Vorontsov
2013-07-22 9:47 ` [PATCH 1/2] Powerpc: Add voltage ranges support for T4 Wrobel Heinz-R39252
2013-07-22 9:47 ` Wrobel Heinz-R39252
2013-07-22 14:39 ` Kumar Gala
2013-07-22 14:39 ` Kumar Gala
2013-07-23 2:05 ` Zhang Haijun-B42677
2013-07-23 2:05 ` Zhang Haijun-B42677
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=1374514847.15592.7@snotra \
--to=scottwood@freescale.com \
--cc=AFLEMING@freescale.com \
--cc=Haijun.Zhang@freescale.com \
--cc=cbouatmailru@gmail.com \
--cc=cjb@laptop.org \
--cc=linux-mmc@vger.kernel.org \
--cc=linuxppc-dev@lists.ozlabs.org \
/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.