[Patch v5 08/13] ARM: imx6q: add config-on-boot gpios
From: Richard Zhao <hidden>
Date: 2012-06-19 23:41:11
Also in:
linux-devicetree
Fabio Estevam [off-list ref] wrote:
On Wed, Jun 13, 2012 at 9:34 AM, Richard Zhao [off-list ref] wrote:quoted
+static void __init imx6q_config_on_boot(void) +{ + ? ? ? struct device_node *np; + ? ? ? struct property *pp; + ? ? ? int cnt, len, i; + ? ? ? int gpio; + + ? ? ? np = of_find_node_by_path("/config-on-boot"); + ? ? ? if (!np) + ? ? ? ? ? ? ? return; + ? ? ? cnt = of_gpio_named_count(np, "output-gpios"); + ? ? ? pp = of_find_property(np, "output-gpio-values", &len); + ? ? ? if (!pp || cnt != len / sizeof(u32)) { + ? ? ? ? ? ? ? pr_err("Invalid config-on-boot gpios!\n"); + ? ? ? ? ? ? ? of_node_put(np); + ? ? ? ? ? ? ? return; + ? ? ? } + ? ? ? for (i = 0; i < cnt; i++) { + ? ? ? ? ? ? ? gpio = of_get_named_gpio(np, "output-gpios", i); + ? ? ? ? ? ? ? if (gpio_is_valid(gpio)) + ? ? ? ? ? ? ? ? ? ? ? gpio_request_one(gpio, GPIOF_OUT_INIT_HIGH, + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? "config-on-boot"); + ? ? ? } + + ? ? ? of_node_put(np); +}Couldn't this function be made generic and put outside of mach-imx6q.c so that other platforms could use it? I need the same for mxs.
Yes, it is common. But it must be called after populate devices. Rob didn't agree the way yet. -- Sent from my Android phone with K-9 Mail. Please excuse my brevity.