Regulator probe

From: Andy Shevchenko
Date: Thu Sep 01 2016 - 10:53:54 EST


Hi!

I have found an issue which I have no idea how to solve properly.
Let's look at the details.

The platform I'm working on (Intel Edison) has the following devices:

Pin control (registered in platform code)
GPIO (PCI device)
SDHCI (PCI device)
WiFi card (SDIO connected to SDHCI)
Regulator for WiFi card (registered in platform code, enumerated via SFI
notifier)

In the kernel configuration
CONFIG_PINCTRL_MERRIFIELD=y
CONFIG_GPIO_MERRIFIELD=y
CONFIG_SDHCI_PCI=y
CONFIG_REGULATOR=y

(All intermediate dependencies also built-in)

Platform has setting
regulator_has_full_constraints();

During the boot I got the following:

#1

[ÂÂÂÂ0.286099] callingÂÂintel_mid_platform_init+0x0/0x36 @ 1
[ÂÂÂÂ0.290348] Using generic wifi platform data
[ÂÂÂÂ0.291055] initcall intel_mid_platform_init+0x0/0x36 returned 0
after 3906 usecs
[ÂÂÂÂ0.291411] callingÂÂmrfld_pinctrl_init+0x0/0x21 @ 1
[ÂÂÂÂ0.292556] initcall mrfld_pinctrl_init+0x0/0x21 returned 0 after 976
usecs

Regulator for WiFi and pin control are registered.


#2

[ÂÂÂÂ0.555321] callingÂÂmrfld_pinctrl_init+0x0/0x14 @ 1
[ÂÂÂÂ0.563920] initcall mrfld_pinctrl_init+0x0/0x14 returned 0 after
7812 usecs

Pin control is initialized.


#3

[ÂÂÂÂ0.572562] callingÂÂregulator_fixed_voltage_init+0x0/0x14 @ 1
[ÂÂÂÂ0.
573366] bcm43xx-vmmc-regulator: Failed to request enable GPIO96: -517
[ÂÂ
ÂÂ0.573708] reg-fixed-voltage reg-fixed-voltage.0.auto: Failed to
register regulator: -517
[ÂÂÂÂ0.574376] initcall
regulator_fixed_voltage_init+0x0/0x14 returned 0 after 1953 usecs

Obviously GPIO device isn't probed yet.


#4

[ÂÂÂ12.322718] callingÂÂmrfld_gpio_driver_init+0x0/0x1b @ 1
[ÂÂÂ12.349569] initcall mrfld_gpio_driver_init+0x0/0x1b returned 0 after
11716 usecs

GPIO driver is initialized.


# 5

[ÂÂÂ20.843973] callingÂÂsdhci_drv_init+0x0/0x20 @ 1
[ÂÂÂ20.843976] sdhci: Secure Digital Host Controller Interface driver
[ÂÂÂ20.843978] sdhci: Copyright(c) Pierre Ossman
[ÂÂÂ20.843989] initcall sdhci_drv_init+0x0/0x20 returned 0 after 5 usecs
[ÂÂÂ20.843999] callingÂÂsdhci_driver_init+0x0/0x1b @ 1

[ÂÂÂ20.881460] sdhci-pci 0000:00:01.3: SDHCI controller found
[8086:1190] (rev 1)
[ÂÂÂ20.881471] sdhci-pci 0000:00:01.3: found 1 slot(s)
[ÂÂÂ20.888242] sdhci-pci 0000:00:01.3: No vmmc regulator found

^^^^^ PROBLEM!

Regulator is present, though it's in a waiting list.

[ÂÂÂ20.888272] sdhci-pci 0000:00:01.3: No vqmmc regulator found


#6

[ÂÂÂ21.520126] callingÂÂdeferred_probe_initcall+0x0/0x70 @ 1
[ÂÂÂ21.521460] bcm43xx-vmmc-regulator: at 2000 mV
[ÂÂÂ21.524831] reg-fixed-voltage reg-fixed-voltage.0.auto: bcm43xx-vmmc-
regulator supplying 2000000uV
[ÂÂÂ21.524902] initcall deferred_probe_initcall+0x0/0x70 returned 0
after 4646 usecs

^^^^^ Too late

[ÂÂÂ27.479039] callingÂÂregulator_init_complete+0x0/0x30 @ 1
[ÂÂÂ27.479048] bcm43xx-vmmc-regulator: disabling


So, my understanding that inÂ_regulator_get() we have to try probe
deferred regulators once again. But I have no idea how to fix this
properly.

P.S. Of course everything works in case of CONFIG_SDHCI=m, but it's
looks like not a (proper?) solution.

--
Andy Shevchenko <andriy.shevchenko@xxxxxxxxxxxxxxx>
Intel Finland Oy