I'm configuring a GPIO as an input for an interrupt for a network device driver. It works fine the first time around as I bring the interface up. But if I 'reboot' the board, the next time I bring the interface up a seg fault occurs. I'm using an IMX35 running a version of Linux 2.6.31.
Unhandled fault: imprecise external abort (0xc06) at 0x00000000
Internal error: : c06 [#1] PREEMPT
PC is at mxc_request_iomux+0x2c/0x154
It looks to be a read of 0x00 if I understand the above, but I am new at Linux device drivers. Here is how I am configuring the driver.
mxc_request_iomux(MX35_PIN_HCKR, MUX_CONFIG_ALT5);
mxc_iomux_set_input(MUX_IN_GPIO1_IN_6, INPUT_CTL_PATH1);
pad_setting = PAD_CTL_DRV_3_3V | PAD_CTL_HYS_CMOS | PAD_CTL_PKE_NONE | PAD_CTL_100K_PD | PAD_CTL_ODE_CMOS |
PAD_CTL_DRV_NORMAL | PAD_CTL_SRE_SLOW;
mxc_iomux_set_pad(MX35_PIN_HCKR, pad_setting);
I also have
gpio_request(IOMUX_TO_GPIO(MX35_PIN_HCKR), NULL);
gpio_direction_input(IOMUX_TO_GPIO(MX35_PIN_HCKR));
but not sure if the above two lines are really needed.
I have
gpio_free(IOMUX_TO_GPIO(MX35_PIN_HCKR));
mxc_free_iomux(MX35_PIN_HCKR, MUX_CONFIG_ALT5);
when the interface is brought down. Whether I bring the interface down or not, the seg fault still occurs. The only way to bring the interface up without a seg fault is to totally power off the board. I've looked into mxc_request_iomux() but I can't see anywhere within that would cause a seg fault.
It seems like something needs to be unconfigured prior to rebooting since a power off fixes it, but I can't seem to find out what.
Any ideas on what to do?
Thanks,
Jason