Hi, I'm trying to compile kernel 2.6.32 to run on PPC440Epx processor. However, I am having a hard time getting the GPIO driver to load at boot up. The following code shows that the driver is supposed to be loaded at run time during arch_initcall time. However, I put a debug statement pr_err() and verified that it never did get invoked. Anybody has any idea? Is arch_initcall() only allowed to be called once in the entire kernel?
Code:
176static int __init ppc4xx_add_gpiochips(void)
177{
178 struct device_node *np;
179
180 for_each_compatible_node(np, NULL, "ibm,ppc4xx-gpio") {
181 int ret;
182 struct ppc4xx_gpio_chip *ppc4xx_gc;
183 struct of_mm_gpio_chip *mm_gc;
184 struct of_gpio_chip *of_gc;
185 struct gpio_chip *gc;
186
187 ppc4xx_gc = kzalloc(sizeof(*ppc4xx_gc), GFP_KERNEL);
188 if (!ppc4xx_gc) {
189 ret = -ENOMEM;
190 goto err;
191 }
192
193 spin_lock_init(&ppc4xx_gc->lock);
194
195 mm_gc = &ppc4xx_gc->mm_gc;
196 of_gc = &mm_gc->of_gc;
197 gc = &of_gc->gc;
198
199 of_gc->gpio_cells = 2;
200 gc->ngpio = 32;
201 gc->direction_input = ppc4xx_gpio_dir_in;
202 gc->direction_output = ppc4xx_gpio_dir_out;
203 gc->get = ppc4xx_gpio_get;
204 gc->set = ppc4xx_gpio_set;
205
206 ret = of_mm_gpiochip_add(np, mm_gc);
207 if (ret)
208 goto err;
209 continue;
210err:
211 pr_err("%s: registration failed with status %d\n",
212 np->full_name, ret);
213 kfree(ppc4xx_gc);
214 /* try others anyway */
215 }
216 pr_err ("Hello world");
217 return 0;
218}
219arch_initcall(ppc4xx_add_gpiochips);