Interrupt from VBUSVALID on i.mx28

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Interrupt from VBUSVALID on i.mx28

Jump to solution
1,221 Views
asmushansen
Contributor II

I'm running a vanilla linux kernel(4.1.13) on the i.mx28 and i would like to add battery backup to my system. When i disconnect the 5V supply, the PMU is using the battery to supply the processor.

When i reconnect the 5V nothing happens. I would like to enable the VBUSVALID interrupt, such that i can start the DC DC converter from the IRQ routine, and log the event. I have written a kernel module which should handle this.

In the PMU application node section 3.1.2.3 the process of enabling the interrupt is described. I do this in the initialization of the kernel module, and when i try to generate my interrupt, either by reconnecting the 5V supply or generating a software interrupt by writing a 1 to the HW_ICOLL_INTERRUPT6[SOFTIRQ] i get the following message on my debugger: unexpected IRQ trap at vector 00.

After this linux halts and restarts.

I suspect that i have overlooked something in the setup of the interrupt.

Labels (1)
Tags (2)
0 Kudos
1 Solution
833 Views
lategoodbye
Senior Contributor I

Hi Asmus,

i can't recommend to use the MX28_EVK_Linux_Reference_Manual in your case because it referes to the ancient Kernel 2.6.35. Since this version there has been a lot of changes like introduction of device trees.

Sometime ago i also started implementing a kernel driver for the mxs power subsystem. Unfortunately i haven't finished it yet. Maybe it helps you.

According to your problem please look at https://github.com/lategoodbye/linux-mxs-power/blob/dcdc-clk/drivers/power/mxs_power.c . The interrupt itself is defined in the device tree linux-mxs-power/imx28.dtsi at dcdc-clk · lategoodbye/linux-mxs-power · GitHub

But beware i didn't test the VBUSVALID detection.

In case of Linux mainline specific question i strongly recommend to post them on linux-arm-kernel mailing list. I would be happy if you share the final results.

Regards Stefan

View solution in original post

0 Kudos
4 Replies
833 Views
art
NXP Employee
NXP Employee

Regarding the PMU hardware, everything looks OK. Most likely, you didn't configure the interrupt handler routine/vector correctly. For more information, please refer to the Chapter 3 "Machine Specific Layer (MSL)", especially, to the Section 3.1 "Interrupts", of the attached document.


Have a great day,
Artur

0 Kudos
833 Views
asmushansen
Contributor II

In the Linux reference manual i'm told to use the irq_set_chip function before the request_irq function. However, i do not know shich parameters to set the irq_chip function to.

Do you have any suggestions where i can see that?

0 Kudos
834 Views
lategoodbye
Senior Contributor I

Hi Asmus,

i can't recommend to use the MX28_EVK_Linux_Reference_Manual in your case because it referes to the ancient Kernel 2.6.35. Since this version there has been a lot of changes like introduction of device trees.

Sometime ago i also started implementing a kernel driver for the mxs power subsystem. Unfortunately i haven't finished it yet. Maybe it helps you.

According to your problem please look at https://github.com/lategoodbye/linux-mxs-power/blob/dcdc-clk/drivers/power/mxs_power.c . The interrupt itself is defined in the device tree linux-mxs-power/imx28.dtsi at dcdc-clk · lategoodbye/linux-mxs-power · GitHub

But beware i didn't test the VBUSVALID detection.

In case of Linux mainline specific question i strongly recommend to post them on linux-arm-kernel mailing list. I would be happy if you share the final results.

Regards Stefan

0 Kudos
833 Views
asmushansen
Contributor II

I resolved the problem last week by using the irq_of_parse_and_map() function to retreive the interrupt from the device tree and getting the corresponding virtual interrupt number.

I just took a look at your code and our device trees are a match. The way you requests interrupts is a bit different, but i think it will work just fine. If you do have any problems requesting interrupts, maybe try the above function.

And please note that when i started this thread i had no idea what the device tree was, so do not take anything i say as gospel :smileywink:

0 Kudos