LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software > Linux - Kernel
User Name
Password
Linux - Kernel This forum is for all discussion relating to the Linux kernel.

Notices

Reply
 
LinkBack Search this Thread
Old 07-09-2010, 11:41 PM   #1
max21226
LQ Newbie
 
Registered: Jul 2010
Posts: 3

Rep: Reputation: 0
ppc4xx gpio driver not loading using arch_initcall


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);
 
Old 07-14-2010, 06:09 PM   #2
archieval
Member
 
Registered: Apr 2007
Location: Philippines
Distribution: Kubuntu, Ubuntu, CentOS
Posts: 289

Rep: Reputation: 41
What file is this in the 2.6.32 kernel?
 
Old 08-23-2010, 04:48 PM   #3
Peatmoss
Member
 
Registered: Nov 2007
Location: Vancouver
Distribution: Ubuntu 7.10
Posts: 43

Rep: Reputation: 15
Try This

Hi,

I found this article very useful for my problem. I think it would solve yours too:

http://www.embedded-bits.co.uk/?tag=i2c_add_driver

Regards,

Peat
 
Old 08-31-2010, 11:04 AM   #4
max21226
LQ Newbie
 
Registered: Jul 2010
Posts: 3

Original Poster
Rep: Reputation: 0
It must be some kind of user error. It magically works now. Thanks everybody for the response anyway.
 
  


Reply

Tags
gpio


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Behaviour of arch_initcall macro LPo Linux - Kernel 1 07-09-2010 11:28 PM
Using GPIO (from kernel GPIO support) in MY application DannyGilbert Linux - Kernel 2 03-16-2009 07:52 AM
arch_initcall time ? kamou Programming 0 03-12-2009 04:00 AM
Changing device loading order and driver loading before X enygma Red Hat 2 10-18-2008 12:38 AM
GPIO driver for Intel 6300ESB I/O Controller lartip Linux - Software 0 03-13-2007 05:02 PM


All times are GMT -5. The time now is 10:22 PM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: @linuxquestions
Open Source Consulting | Domain Registration