Patchwork [4/4] ARM i.MX 3ds debugboard: register a dummy regulator for the smsc911x device

login
register
mail settings
Submitter Sascha Hauer
Date March 3, 2012, 11:40 a.m.
Message ID <1330774804-7310-5-git-send-email-s.hauer@pengutronix.de>
Download mbox | patch
Permalink /patch/144421/
State New
Headers show

Comments

Sascha Hauer - March 3, 2012, 11:40 a.m.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
 arch/arm/plat-mxc/3ds_debugboard.c |    9 +++++++++
 1 files changed, 9 insertions(+), 0 deletions(-)
Mark Brown - March 3, 2012, 4:37 p.m.
On Sat, Mar 03, 2012 at 12:40:04PM +0100, Sascha Hauer wrote:
> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
> ---
>  arch/arm/plat-mxc/3ds_debugboard.c |    9 +++++++++
>  1 files changed, 9 insertions(+), 0 deletions(-)

applied, though with at least this board you clearly do have a sensible
regulator setup already and are just adding in a few extra regulators to
fill out things which for some reason aren't supplied by the PMIC.  It's
quite surprising that things like what look like the I/O reference
voltage are supplied elsewhere.
Sascha Hauer - March 3, 2012, 6:14 p.m.
On Sat, Mar 03, 2012 at 04:37:34PM +0000, Mark Brown wrote:
> On Sat, Mar 03, 2012 at 12:40:04PM +0100, Sascha Hauer wrote:
> > Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
> > ---
> >  arch/arm/plat-mxc/3ds_debugboard.c |    9 +++++++++
> >  1 files changed, 9 insertions(+), 0 deletions(-)
> 
> applied, though with at least this board you clearly do have a sensible
> regulator setup already and are just adding in a few extra regulators to
> fill out things which for some reason aren't supplied by the PMIC.  It's
> quite surprising that things like what look like the I/O reference
> voltage are supplied elsewhere.

This debug board is used with four different baseboards and one of them
indeed has regulator support in mainline. The regulator for the smsc911x
though is not software controllable on any of these boards. In the end
it's a debug board, energy efficiency might not be really important in
such a case.

Sascha
Fabio Estevam - March 26, 2012, 6:09 p.m.
Hi Sascha,

On Sat, Mar 3, 2012 at 8:40 AM, Sascha Hauer <s.hauer@pengutronix.de> wrote:
> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>

...
>        /* Register Lan device on the debugboard */
> +       regulator_register_fixed(0, dummy_supplies, ARRAY_SIZE(dummy_supplies));

I am using linux-next, which has this patch applied and I am getting:

smsc911x smsc911x.0: Failed to get supply 'vdd33a': -517
smsc911x smsc911x.0: (unregistered net_device): couldn't get regulators -517
platform smsc911x.0: Driver smsc911x requests probe deferral

Does this work for you on pcm037?

If I select CONFIG_REGULATOR_DUMMY then the the smsc driver is probed
correctly, but if I understand correctly your suggestion was to not
select CONFIG_REGULATOR_DUMMY, right?
Sascha Hauer - March 26, 2012, 6:19 p.m.
On Mon, Mar 26, 2012 at 03:09:34PM -0300, Fabio Estevam wrote:
> Hi Sascha,
> 
> On Sat, Mar 3, 2012 at 8:40 AM, Sascha Hauer <s.hauer@pengutronix.de> wrote:
> > Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
> 
> ...
> >        /* Register Lan device on the debugboard */
> > +       regulator_register_fixed(0, dummy_supplies, ARRAY_SIZE(dummy_supplies));
> 
> I am using linux-next, which has this patch applied and I am getting:
> 
> smsc911x smsc911x.0: Failed to get supply 'vdd33a': -517
> smsc911x smsc911x.0: (unregistered net_device): couldn't get regulators -517
> platform smsc911x.0: Driver smsc911x requests probe deferral
> 
> Does this work for you on pcm037?

At least it did work when I sent the patches, but -EPROBE_DEFER did not
exist at that time. Do you have the fixed regulator enabled in your
config?

> 
> If I select CONFIG_REGULATOR_DUMMY then the the smsc driver is probed
> correctly, but if I understand correctly your suggestion was to not
> select CONFIG_REGULATOR_DUMMY, right?

Right.

Sascha
Fabio Estevam - March 26, 2012, 6:25 p.m.
On Mon, Mar 26, 2012 at 3:19 PM, Sascha Hauer <s.hauer@pengutronix.de> wrote:

> At least it did work when I sent the patches, but -EPROBE_DEFER did not
> exist at that time. Do you have the fixed regulator enabled in your
> config?

Yes, I do. I am using imx_v6_v7_defconfig, which has fixed regulator
enabled by default.
Mark Brown - March 28, 2012, 10:57 a.m.
On Mon, Mar 26, 2012 at 08:19:12PM +0200, Sascha Hauer wrote:

> At least it did work when I sent the patches, but -EPROBE_DEFER did not
> exist at that time. Do you have the fixed regulator enabled in your
> config?

FWIW all the -EPROBE_DEFER change does is change the error code returned
when we can't find a supply, if we're hitting that case we'd have failed
without it too.

Patch

diff --git a/arch/arm/plat-mxc/3ds_debugboard.c b/arch/arm/plat-mxc/3ds_debugboard.c
index f0ba072..d1e31fa 100644
--- a/arch/arm/plat-mxc/3ds_debugboard.c
+++ b/arch/arm/plat-mxc/3ds_debugboard.c
@@ -16,6 +16,8 @@ 
 #include <linux/platform_device.h>
 #include <linux/gpio.h>
 #include <linux/smsc911x.h>
+#include <linux/regulator/machine.h>
+#include <linux/regulator/fixed.h>
 
 #include <mach/hardware.h>
 
@@ -148,6 +150,11 @@  static struct irq_chip expio_irq_chip = {
 	.irq_unmask = expio_unmask_irq,
 };
 
+static struct regulator_consumer_supply dummy_supplies[] = {
+	REGULATOR_SUPPLY("vdd33a", "smsc911x"),
+	REGULATOR_SUPPLY("vddvario", "smsc911x"),
+};
+
 int __init mxc_expio_init(u32 base, u32 p_irq)
 {
 	int i;
@@ -188,6 +195,8 @@  int __init mxc_expio_init(u32 base, u32 p_irq)
 	irq_set_chained_handler(p_irq, mxc_expio_irq_handler);
 
 	/* Register Lan device on the debugboard */
+	regulator_register_fixed(0, dummy_supplies, ARRAY_SIZE(dummy_supplies));
+
 	smsc911x_resources[0].start = LAN9217_BASE_ADDR(base);
 	smsc911x_resources[0].end = LAN9217_BASE_ADDR(base) + 0x100 - 1;
 	platform_device_register(&smsc_lan9217_device);