initr_status_led,
#endif
/* PPC has a udelay(20) here dating from 2002. Why? */
-#if defined(CONFIG_GPIO_HOG)
- gpio_hog_probe_all,
-#endif
#ifdef CONFIG_BOARD_LATE_INIT
board_late_init,
#endif
}
}
- if (CONFIG_IS_ENABLED(GPIO_HOG))
- gpio_hog_probe_all();
-
#if CONFIG_IS_ENABLED(BOARD_INIT)
spl_board_init();
#endif
GPIO hog (CONFIG_GPIO_HOG)
--------
-All the GPIO hog are initialized in gpio_hog_probe_all() function called in
-board_r.c just before board_late_init() but you can also acces directly to
-the gpio with gpio_hog_lookup_name().
-
+All the GPIO hog are initialized using DM_FLAG_PROBE_AFTER_BIND DM flag
+after bind().
Example, for the device tree:
return 0;
}
-int gpio_hog_probe_all(void)
-{
- struct udevice *dev;
- int ret;
- int retval = 0;
-
- for (uclass_first_device(UCLASS_NOP, &dev);
- dev;
- uclass_find_next_device(&dev)) {
- if (dev->driver == DM_DRIVER_GET(gpio_hog)) {
- ret = device_probe(dev);
- if (ret) {
- printf("Failed to probe device %s err: %d\n",
- dev->name, ret);
- retval = ret;
- }
- }
- }
-
- return retval;
-}
-
int gpio_hog_lookup_name(const char *name, struct gpio_desc **desc)
{
struct udevice *dev;
*desc = NULL;
- gpio_hog_probe_all();
if (!uclass_get_device_by_name(UCLASS_NOP, name, &dev)) {
struct gpio_hog_priv *priv = dev_get_priv(dev);
&child);
if (ret)
return ret;
+
+ /*
+ * Make sure gpio-hogs are probed after bind
+ * since hogs can be essential to the hardware
+ * system.
+ */
+ dev_or_flags(child, DM_FLAG_PROBE_AFTER_BIND);
}
}
}
+
return 0;
}
*/
int gpio_hog_lookup_name(const char *name, struct gpio_desc **desc);
-/**
- * gpio_hog_probe_all() - probe all gpio devices with
- * gpio-hog subnodes.
- *
- * @return: Returns return value from device_probe()
- */
-int gpio_hog_probe_all(void);
-
/**
* gpio_lookup_name - Look up a GPIO name and return its details
*