From: Balaji T K <balajitk@ti.com>
To: Mark Rutland <mark.rutland@arm.com>
Cc: "linux-omap@vger.kernel.org" <linux-omap@vger.kernel.org>,
"bcousson@baylibre.com" <bcousson@baylibre.com>,
"devicetree@vger.kernel.org" <devicetree@vger.kernel.org>,
"linux-mmc@vger.kernel.org" <linux-mmc@vger.kernel.org>,
"cjb@laptop.org" <cjb@laptop.org>,
"broonie@kernel.org" <broonie@kernel.org>,
"tony@atomide.com" <tony@atomide.com>
Subject: Re: [PATCH v7 3/7] regulator: add pbias regulator support
Date: Tue, 7 Jan 2014 15:39:29 +0530 [thread overview]
Message-ID: <52CBD259.90804@ti.com> (raw)
In-Reply-To: <20140106181647.GJ24664@e106331-lin.cambridge.arm.com>
On Monday 06 January 2014 11:46 PM, Mark Rutland wrote:
> On Fri, Dec 20, 2013 at 05:35:51PM +0000, Balaji T K wrote:
>> pbias register controls internal power supply to sd card i/o pads
>> in most OMAPs (OMAP2-5, DRA7).
>> Control bits for selecting voltage level and
>> enabling/disabling are in the same PBIAS register.
>>
>> Signed-off-by: Balaji T K <balajitk@ti.com>
>> ---
>> .../bindings/regulator/pbias-regulator.txt | 16 ++
>> drivers/regulator/Kconfig | 9 +
>> drivers/regulator/Makefile | 1 +
>> drivers/regulator/pbias-regulator.c | 261 ++++++++++++++++++++
>> 4 files changed, 287 insertions(+), 0 deletions(-)
>> create mode 100644 Documentation/devicetree/bindings/regulator/pbias-regulator.txt
>> create mode 100644 drivers/regulator/pbias-regulator.c
>>
>> diff --git a/Documentation/devicetree/bindings/regulator/pbias-regulator.txt b/Documentation/devicetree/bindings/regulator/pbias-regulator.txt
>> new file mode 100644
>> index 0000000..359d3f9
>> --- /dev/null
>> +++ b/Documentation/devicetree/bindings/regulator/pbias-regulator.txt
>> @@ -0,0 +1,16 @@
>> +PBIAS internal regulator for SD card dual voltage i/o pads on OMAP SoCs.
>> +
>> +Required properties:
>> +- compatible:
>> + - "ti,pbias-omap" for OMAP2, OMAP3, OMAP4, OMAP5, DRA7
>> +
>> +Optional properties:
>> +- Any optional property defined in bindings/regulator/regulator.txt
>> +
>> +Example:
>> +
>> + pbias_regulator: pbias_regulator {
>> + regulator-name = "pbias_mmc_omap4";
>> + regulator-min-microvolt = <1800000>;
>> + regulator-max-microvolt = <3000000>;
>> + };
>
> This doesn't look like a full example. I don't see the required
> compatible string.
>
Thanks for pointing, I missed it, will add to example.
> [...]
>
>> +static struct of_regulator_match pbias_matches[] = {
>> + { .name = "pbias_mmc_omap2430", .driver_data = (void *)&pbias_mmc_omap2430},
>> + { .name = "pbias_sim_omap3", .driver_data = (void *)&pbias_sim_omap3},
>> + { .name = "pbias_mmc_omap4", .driver_data = (void *)&pbias_mmc_omap4},
>> + { .name = "pbias_mmc_omap5", .driver_data = (void *)&pbias_mmc_omap5},
>> +};
>
> These weren't documented.
Ok, will add it
>
> [...]
>
>> +static int pbias_regulator_probe(struct platform_device *pdev)
>> +{
>> + struct device_node *np = pdev->dev.of_node;
>> + struct device_node *dev_node;
>> + struct pbias_regulator_data *drvdata;
>> + struct resource *res;
>> + struct regulator_config cfg = { };
>> + struct regmap *syscon;
>> + const struct pbias_reg_info *info;
>> + int ret = 0;
>> + int count, idx, data_idx = 0;
>> +
>> + count = of_regulator_match(&pdev->dev, np, pbias_matches,
>> + PBIAS_NUM_REGS);
>> + if (count < 0)
>> + return count;
>> +
>> + drvdata = devm_kzalloc(&pdev->dev, sizeof(struct pbias_regulator_data)
>> + * count, GFP_KERNEL);
>> + if (drvdata == NULL) {
>> + dev_err(&pdev->dev, "Failed to allocate device data\n");
>> + return -ENOMEM;
>> + }
>> +
>> + dev_node = of_get_parent(np);
>> + if (!dev_node)
>> + return -ENODEV;
>> +
>> + syscon = syscon_node_to_regmap(dev_node);
>
> If we're relying on a particular parent node, that _must_ be described
> in the binding.
Ok
>
>> + of_node_put(dev_node);
>> + if (IS_ERR(syscon))
>> + return PTR_ERR(syscon);
>> +
>> + cfg.dev = &pdev->dev;
>> +
>> + for (idx = 0; idx < PBIAS_NUM_REGS, data_idx < count; idx++) {
>> + if (!pbias_matches[idx].init_data ||
>> + !pbias_matches[idx].of_node)
>> + continue;
>> +
>> + info = pbias_matches[idx].driver_data;
>> + if (!info)
>> + return -ENODEV;
>> +
>> + res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
>
> A reg entry was not mentioned in the binding.
Ok, will add it
>
> Why is this inside the loop? It's grabbing the reg from the parent, not
> each of the children it's walking over.
>
The reg property is same for each children and is needed for each regulator.
It is for the case where a single register can control 2
regulators as in OMAP3 (mmc and sim). In other SoCs, only one regulator
of "ti,pbias-omap" compatible exists in the pbias register.
> Thanks,
> Mark.
>
next prev parent reply other threads:[~2014-01-07 10:09 UTC|newest]
Thread overview: 71+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-12-20 17:35 [PATCH v7 0/7] mmc: omap_hsmmc: pbias dt and cleanup Balaji T K
2013-12-20 17:35 ` [PATCH v7 1/7] mmc: omap_hsmmc: use devm_regulator API Balaji T K
2013-12-20 18:38 ` Tony Lindgren
2013-12-20 17:35 ` [PATCH v7 2/7] mmc: omap_hsmmc: handle vcc and vcc_aux independently Balaji T K
2013-12-20 18:40 ` Tony Lindgren
2013-12-20 17:35 ` [PATCH v7 3/7] regulator: add pbias regulator support Balaji T K
2013-12-20 23:39 ` Tony Lindgren
2013-12-24 16:11 ` Balaji T K
2014-01-06 18:16 ` Mark Rutland
2014-01-07 10:09 ` Balaji T K [this message]
2013-12-20 17:35 ` [PATCH v7 4/7] mmc: omap_hsmmc: adapt hsmmc to use pbias regulator Balaji T K
2013-12-20 18:15 ` Michael Trimarchi
2013-12-23 13:42 ` Balaji T K
2013-12-20 17:35 ` [PATCH v7 5/7] ARM: dts: add pbias dt node Balaji T K
2013-12-21 0:32 ` Tony Lindgren
2014-01-06 18:19 ` Mark Rutland
2014-01-07 10:18 ` Balaji T K
2014-01-07 10:57 ` Mark Rutland
2014-01-07 12:23 ` Balaji T K
2014-01-08 14:51 ` Balaji T K
2014-01-10 11:32 ` Mark Rutland
2014-01-10 17:00 ` Balaji T K
2013-12-20 17:35 ` [PATCH v7 6/7] ARM: OMAP: enable SYSCON and REGULATOR_PBIAS in omap2plus_defconfig Balaji T K
2013-12-21 0:33 ` Tony Lindgren
2013-12-20 17:35 ` [PATCH v7 7/7] mmc: omap_hsmmc: remove pbias workaround Balaji T K
2013-12-21 0:33 ` Tony Lindgren
2014-01-09 14:50 ` [PATCH v8 0/7] mmc: omap_hsmmc: pbias dt and cleanup Balaji T K
2014-01-09 14:50 ` [PATCH v8 1/7] mmc: omap_hsmmc: use devm_regulator API Balaji T K
2014-01-09 15:18 ` Felipe Balbi
2014-01-10 15:55 ` Balaji T K
2014-01-10 15:58 ` Felipe Balbi
2014-01-09 14:50 ` [PATCH v8 2/7] mmc: omap_hsmmc: handle vcc and vcc_aux independently Balaji T K
2014-01-09 14:50 ` [PATCH v8 3/7] regulator: add pbias regulator support Balaji T K
2014-01-09 17:27 ` Mark Brown
2014-01-09 14:50 ` [PATCH v8 4/7] mmc: omap_hsmmc: adapt hsmmc to use pbias regulator Balaji T K
2014-01-09 14:51 ` [PATCH v8 5/7] ARM: dts: add pbias dt node Balaji T K
2014-01-09 14:51 ` [PATCH v8 6/7] ARM: OMAP: enable SYSCON and REGULATOR_PBIAS in omap2plus_defconfig Balaji T K
2014-01-09 14:51 ` [PATCH v8 7/7] mmc: omap_hsmmc: remove pbias workaround Balaji T K
2014-01-10 17:30 ` [PATCH v9 0/7] mmc: omap_hsmmc: pbias dt and cleanup Balaji T K
2014-01-10 17:30 ` [PATCH v9 1/7] mmc: omap_hsmmc: use devm_regulator API Balaji T K
2014-01-10 17:30 ` [PATCH v9 2/7] mmc: omap_hsmmc: handle vcc and vcc_aux independently Balaji T K
2014-01-10 17:30 ` [PATCH v9 3/7] regulator: add pbias regulator support Balaji T K
2014-01-10 17:30 ` [PATCH v9 4/7] mmc: omap_hsmmc: adapt hsmmc to use pbias regulator Balaji T K
2014-01-10 18:21 ` Michael Trimarchi
2014-01-13 13:29 ` Balaji T K
2014-01-10 17:30 ` [PATCH v9 5/7] ARM: dts: add pbias dt node Balaji T K
2014-01-10 17:30 ` [PATCH v9 6/7] ARM: OMAP: enable SYSCON and REGULATOR_PBIAS in omap2plus_defconfig Balaji T K
2014-01-10 17:30 ` [PATCH v9 7/7] mmc: omap_hsmmc: remove pbias workaround Balaji T K
2014-01-13 15:36 ` [PATCH v10 0/7] mmc: omap_hsmmc: pbias dt and cleanup Balaji T K
2014-01-13 15:36 ` [PATCH v10 1/7] mmc: omap_hsmmc: use devm_regulator API Balaji T K
2014-01-13 15:36 ` [PATCH v10 2/7] mmc: omap_hsmmc: handle vcc and vcc_aux independently Balaji T K
2014-01-13 15:36 ` [PATCH v10 3/7] regulator: add pbias regulator support Balaji T K
2014-01-13 15:36 ` [PATCH v10 4/7] mmc: omap_hsmmc: adapt hsmmc to use pbias regulator Balaji T K
2014-01-13 15:36 ` [PATCH v10 5/7] ARM: dts: add pbias dt node Balaji T K
2014-01-15 15:09 ` Balaji T K
2014-01-13 15:36 ` [PATCH v10 6/7] ARM: OMAP: enable SYSCON and REGULATOR_PBIAS in omap2plus_defconfig Balaji T K
2014-01-13 15:36 ` [PATCH v10 7/7] mmc: omap_hsmmc: remove pbias workaround Balaji T K
2014-02-04 8:32 ` [PATCH v10 0/7] mmc: omap_hsmmc: pbias dt and cleanup Balaji T K
2014-02-19 14:56 ` [PATCH RESEND " Balaji T K
2014-02-19 14:56 ` [PATCH RESEND v11 1/7] mmc: omap_hsmmc: use devm_regulator API Balaji T K
2014-02-19 14:56 ` [PATCH RESEND v11 2/7] mmc: omap_hsmmc: handle vcc and vcc_aux independently Balaji T K
2014-02-19 14:56 ` [PATCH RESEND v11 3/7] regulator: add pbias regulator support Balaji T K
2014-02-19 14:56 ` [PATCH RESEND v11 4/7] mmc: omap_hsmmc: adapt hsmmc to use pbias regulator Balaji T K
2014-02-19 14:56 ` [PATCH RESEND v11 5/7] ARM: dts: add pbias dt node Balaji T K
2014-02-19 14:56 ` [PATCH RESEND v11 6/7] ARM: OMAP: enable SYSCON and REGULATOR_PBIAS in omap2plus_defconfig Balaji T K
2014-02-26 17:01 ` Tony Lindgren
2014-03-03 14:33 ` Balaji T K
2014-02-19 14:56 ` [PATCH RESEND v11 7/7] mmc: omap_hsmmc: remove pbias workaround Balaji T K
2014-02-26 8:51 ` [PATCH RESEND v10 0/7] mmc: omap_hsmmc: pbias dt and cleanup Stefan Roese
2014-02-26 14:04 ` Florian Vaussard
2014-02-26 14:43 ` Balaji T K
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=52CBD259.90804@ti.com \
--to=balajitk@ti.com \
--cc=bcousson@baylibre.com \
--cc=broonie@kernel.org \
--cc=cjb@laptop.org \
--cc=devicetree@vger.kernel.org \
--cc=linux-mmc@vger.kernel.org \
--cc=linux-omap@vger.kernel.org \
--cc=mark.rutland@arm.com \
--cc=tony@atomide.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.