Using DMA interrupt on MPC8313
I'm trying to write a driver that would make use of the DMA on the MPC8313. I'm attempting to register the interrupt with request_irq but it is not passing. Is there something that I need to do before I call request_irq, maybe in the dts or somewhere else?
Ron
Quoted 3 lines · Ron Madrid
I'm trying to write a driver that would make use of the DMA on the MPC8313. I'm attempting to register the interrupt with
request_irqbut it is not passing. Is there something that I need to do before I callrequest_irq, maybe in the dts or somewhere else?
any reason you aren't using the dmaengine driver?
- k
Well in that case wouldn't I need to use the fsldma driver? Or is dmaengine a generic dma driver?
Ron
Quoted 14 lines · --- Kumar Gala
Quoted 5 lines · Ron Madrid
I'm trying to write a driver that would make use of the DMA on the MPC8313. I'm attempting to
register the interrupt withrequest_irqbut it is not passing. Is there something that I need to
do before I callrequest_irq, maybe in the dts or somewhere else?any reason you aren't using the dmaengine driver?
- k
The dmaengine provides a generic set of APIs w/a FSL dma backend. It might be the case that your need of dma doesnt fit into the current set of APIs.
- k
Quoted 19 lines · Ron Madrid
Well in that case wouldn't I need to use the fsldma driver? Or is dmaengine a generic dma driver?
Ron
Quoted 14 lines · --- Kumar Gala
Quoted 5 lines · Ron Madrid
I'm trying to write a driver that would make use of the DMA on the MPC8313. I'm attempting to
register the interrupt withrequest_irqbut it is not passing. Is there something that I need to
do before I callrequest_irq, maybe in the dts or somewhere else?any reason you aren't using the dmaengine driver?
- k
So after I've built the kernel to include the dmaengine and fsldma drivers, my driver is allowed to register its ISR via request_irq. However, if these drivers are not installed then request_irq fails in my driver. So it seems that there is some other initialization happening before request_irq is being called in fsldma and subsequently my driver. Does anyone know what this is?
Ron
Quoted 30 lines · --- Kumar Gala
The dmaengine provides a generic set of APIs w/a FSL dma backend. It might be the case that your need of dma doesnt fit into the current set of APIs.
- k
Quoted 20 lines · Ron Madrid
Well in that case wouldn't I need to use the fsldma driver? Or is dmaengine a generic dma driver?
Ron
Quoted 14 lines · --- Kumar Gala
Quoted 5 lines · Ron Madrid
I'm trying to write a driver that would make use of the DMA on the MPC8313. I'm attempting to
register the interrupt withrequest_irqbut it is not passing. Is there something that I need to
do before I callrequest_irq, maybe in the dts or somewhere else?any reason you aren't using the dmaengine driver?
- k
That's a bit odd. How is your driver getting the IRQ its requesting? Are you using the same .dts in both cases?
- k
Quoted 38 lines · Ron Madrid
So after I've built the kernel to include the dmaengine and fsldma drivers, my driver is allowed to register its ISR via
request_irq. However, if these drivers are not installed thenrequest_irqfails in my driver. So it seems that there is some other initialization happening beforerequest_irqis being called in fsldma and subsequently my driver. Does anyone know what this is?Ron
Quoted 30 lines · --- Kumar Gala
The dmaengine provides a generic set of APIs w/a FSL dma backend. It might be the case that your need of dma doesnt fit into the current set of APIs.
- k
Quoted 20 lines · Ron Madrid
Well in that case wouldn't I need to use the fsldma driver? Or is dmaengine a generic dma driver?
Ron
Quoted 14 lines · --- Kumar Gala
Quoted 5 lines · Ron Madrid
I'm trying to write a driver that would make use of the DMA on the MPC8313. I'm attempting to
register the interrupt withrequest_irqbut it is not passing. Is there something that I need to
do before I callrequest_irq, maybe in the dts or somewhere else?any reason you aren't using the dmaengine driver?
- k
I don't know why request_irq is succeeding when the fsldma and dmaengine drivers are installed. I'm using the same dts in both cases.
Ron
Quoted 51 lines · --- Kumar Gala
That's a bit odd. How is your driver getting the IRQ its requesting? Are you using the same .dts in both cases?
- k
Quoted 42 lines · Ron Madrid
So after I've built the kernel to include the dmaengine and fsldma drivers, my driver is allowed
to register its ISR viarequest_irq. However, if these drivers are not installed thenrequest_irq
fails in my driver. So it seems that there is some other initialization happening beforerequest_irqis being called in fsldma and subsequently my driver. Does anyone know what this is?Ron
Quoted 30 lines · --- Kumar Gala
The dmaengine provides a generic set of APIs w/a FSL dma backend. It might be the case that your need of dma doesnt fit into the current set of APIs.
- k
Quoted 20 lines · Ron Madrid
Well in that case wouldn't I need to use the fsldma driver? Or is dmaengine a generic dma driver?
Ron
Quoted 14 lines · --- Kumar Gala
Quoted 5 lines · Ron Madrid
I'm trying to write a driver that would make use of the DMA on the MPC8313. I'm attempting to
register the interrupt withrequest_irqbut it is not passing. Is there something that I need to
do before I callrequest_irq, maybe in the dts or somewhere else?any reason you aren't using the dmaengine driver?
- k
Quoted 1 line · Ron Madrid
I don't know why
request_irqis succeeding when the fsldma and dmaengine drivers are installed. I'm using the same dts in both cases.
At this point, my only suggestion is to debug the request_irq() call and see what exactly fails.
So are you implying that the request_irq function should work without any other initialization function before it?
Ron
Quoted 8 lines · --- Timur Tabi
Quoted 1 line · Ron Madrid
I don't know why
request_irqis succeeding when the fsldma and dmaengine drivers areinstalled.
Quoted 1 line
I'm using the same dts in both cases.
At this point, my only suggestion is to debug the
request_irq()call and see what exactly fails.
Quoted 2 lines · Ron Madrid
So are you implying that the
request_irqfunction should work without any other initialization function before it?
No, I'm saying that you'll get a more accurate assessment of why it fails if you see where it returns an error code.
What does your code actually look like. In your driver how are you getting the IRQ value that you pass to request_irq?
- k
Quoted 57 lines · Ron Madrid
I don't know why
request_irqis succeeding when the fsldma and dmaengine drivers are installed. I'm using the same dts in both cases.Ron
Quoted 51 lines · --- Kumar Gala
That's a bit odd. How is your driver getting the IRQ its requesting? Are you using the same .dts in both cases?
- k
Quoted 42 lines · Ron Madrid
So after I've built the kernel to include the dmaengine and fsldma drivers, my driver is allowed
to register its ISR viarequest_irq. However, if these drivers are not installed thenrequest_irq
fails in my driver. So it seems that there is some other initialization happening beforerequest_irqis being called in fsldma and subsequently my driver. Does anyone know what this is?Ron
Quoted 30 lines · --- Kumar Gala
The dmaengine provides a generic set of APIs w/a FSL dma backend. It might be the case that your need of dma doesnt fit into the current set of APIs.
- k
Quoted 20 lines · Ron Madrid
Well in that case wouldn't I need to use the fsldma driver? Or is dmaengine a generic dma driver?
Ron
Quoted 14 lines · --- Kumar Gala
Quoted 5 lines · Ron Madrid
I'm trying to write a driver that would make use of the DMA on the MPC8313. I'm attempting to
register the interrupt withrequest_irqbut it is not passing. Is there something that I need to
do before I callrequest_irq, maybe in the dts or somewhere else?any reason you aren't using the dmaengine driver?
- k
Here's my code. There are a few other things that happen but they are inconsequential to this problem. I'm sure that the request_irq call is right, especially since it works if the fsldma drivers are builtin to the kernel. Also, the irq number 71 comes from the reference manual for them MPC8313. It is the internal interrupt for the DMA. I'll do some more testing in a little while to try to determine the cause of the error in request_irq.
int result = 0;
unsigned int firstminor = 0;
dev_t dev;
printk(KERN_ALERT "Hello World Driver! Hi Ron2!\n");
result |= alloc_chrdev_region(&dev, firstminor, 1, kModuleName);
if(result < 0){
printk("simpc: alloc_chrdev_region failed %u\n", result);
return result;
}
mpc_major = MAJOR(dev);
mpc_minor = MINOR(dev);
printk(KERN_ALERT kModuleName " MAJOR NUM = %d\n",mpc_major);
pdx.devno = MKDEV(mpc_major, mpc_minor);
cdev_init(&pdx.cdev, &mpc_fops);
pdx.cdev.owner = THIS_MODULE;
pdx.cdev.ops = &mpc_fops;
result = cdev_add(&pdx.cdev, pdx.devno, 1);
if(result)
printk(KERN_ALERT kModuleName "-init_module: Error %d adding pdx.cdev", result);
printk(KERN_ALERT kModuleName "-SIMPC_open: Entering\n");
pdx.irq = 71;
printk(KERN_ALERT kModuleName "-SIMPC_open: IRQ = %d\n", pdx.irq);
if (pdx.irq == 0){
printk(kModuleName "-SIMPC_open: WARNING-cannot get IRQ\n");
return 0;
}
if (request_irq(pdx.irq, SIMPC_isr, IRQF_SHARED, kModuleName, &pdx)){
printk(kModuleName "-SIMPC_open: ERROR-Interrupt Request failed.\n"
" pdx.irq = %d, SIMPC_isr = 0x%x\n",
pdx.irq, (int)SIMPC_isr);
pdx.irq = 0;
}
else
printk(kModuleName "-SIMPC_open: found IRQ %d\n", pdx.irq);Quoted 71 lines · --- Kumar Gala
What does your code actually look like. In your driver how are you getting the IRQ value that you pass to
request_irq?- k
Quoted 62 lines · Ron Madrid
I don't know why
request_irqis succeeding when the fsldma and dmaengine drivers are installed.
I'm using the same dts in both cases.Ron
Quoted 55 lines · --- Kumar Gala
That's a bit odd. How is your driver getting the IRQ its requesting? Are you using the same .dts in both cases?
- k
Quoted 46 lines · Ron Madrid
So after I've built the kernel to include the dmaengine and fsldma drivers, my driver is allowed
to register its ISR viarequest_irq. However, if these drivers are not installed thenrequest_irq
fails in my driver. So it seems that there is some other initialization happening beforerequest_irqis being called in fsldma and subsequently my driver. Does anyone know what this is?Ron
Quoted 34 lines · --- Kumar Gala
The dmaengine provides a generic set of APIs w/a FSL dma backend. It
might be the case that your need of dma doesnt fit into the current set of APIs.- k
Quoted 23 lines · Ron Madrid
Well in that case wouldn't I need to use the fsldma driver? Or is dmaengine a generic dma driver?
Ron
Quoted 17 lines · --- Kumar Gala
Quoted 8 lines · Ron Madrid
I'm trying to write a driver that would make use of the DMA on the
MPC8313. I'm attempting to
register the interrupt withrequest_irqbut it is not passing. Is
there something that I need to
do before I callrequest_irq, maybe in the dts or somewhere else?any reason you aren't using the dmaengine driver?
- k
Quoted 5 lines · Ron Madrid
Here's my code. There are a few other things that happen but they are inconsequential to this problem. I'm sure that the
request_irqcall is right, especially since it works if the fsldma drivers are builtin to the kernel. Also, the irq number 71 comes from the reference manual for them MPC8313. It is the internal interrupt for the DMA. I'll do some more testing in a little while to try to determine the cause of the error inrequest_irq.
You cannot pass hardware IRQ numbers directly to request_irq() -- it has no idea which IRQ controller you're referring to (even if there happens to be only one on your board).
You should get the IRQ from the device tree, using irq_of_parse_and_map() on the device node for the DMA channel (see the mpc8377mds device tree for an example DMA node).
-Scott
I don't see a "dma" node in the mpc8377mds.dts (2.6.25). I found one in mpc8610_hpcd.dts and modeled it after that.
dma@82a8 {
#address-cells = <1>;
#size-cells = <1>;
compatible = "fsl,elo-dma";
cell-index = <0>;
reg = <0x82a8 0x4>; /* DMA general status register */
ranges = <0x0 0x8100 0x200>;
dma-channel@0 {
compatible = "fsl,elo-dma-channel";
cell-index = <0>;
reg = <0x0 0x80>;
interrupt-parent = <&ipic>;
interrupts = <71 0x8>;
};
dma-channel@1 {
compatible = "fsl,elo-dma-channel";
cell-index = <1>;
reg = <0x80 0x80>;
interrupt-parent = <&ipic>;
interrupts = <71 0x8>;
};
dma-channel@2 {
compatible = "fsl,elo-dma-channel";
cell-index = <2>;
reg = <0x100 0x80>;
interrupt-parent = <&ipic>;
interrupts = <71 0x8>;
};
dma-channel@3 {
compatible = "fsl,elo-dma-channel";
cell-index = <3>;
reg = <0x180 0x80>;
interrupt-parent = <&ipic>;
interrupts = <71 0x8>;
};
};Quoted 19 lines · --- Scott Wood
Quoted 3 lines · Ron Madrid
Here's my code. There are a few other things that happen but they are inconsequential to this problem. I'm sure that the
request_irqcall is right, especially since it works if the fsldma drivers are builtin to the kernel. Also, the irq number 71 comes from the reference manualfor
Quoted 1 line
them MPC8313. It is the internal interrupt for the DMA. I'll do some more testing in a
little
Quoted 1 line
while to try to determine the cause of the error in
request_irq.You cannot pass hardware IRQ numbers directly to
request_irq()-- it has no idea which IRQ controller you're referring to (even if there happens to be only one on your board).You should get the IRQ from the device tree, using
irq_of_parse_and_map()on the device node for the DMA channel (see the mpc8377mds device tree for an example DMA node).-Scott
Quoted 2 lines · Ron Madrid
I don't see a "dma" node in the
mpc8377mds.dts(2.6.25). I found one inmpc8610_hpcd.dtsand modeled it after that.
The DMA hardware on the 8610 is not the same as the DMA hardware on 83xx chips.
You should copy the DMA data from another 83xx DTS.
Signature · 2 lines
Timur Tabi Linux kernel developer at Freescale
Quoted 2 lines · Ron Madrid
I don't see a "dma" node in the
mpc8377mds.dts(2.6.25). I found one inmpc8610_hpcd.dtsand modeled it after that.
Try head-of-tree.
Quoted 7 lines
dma@82a8 {
#address-cells = <1>;
#size-cells = <1>;
compatible = "fsl,elo-dma";
cell-index = <0>;
reg = <0x82a8 0x4>; /* DMA general status register */
ranges = <0x0 0x8100 0x200>;Should also put the interrupts in the dma node itself, so that the driver can register it once and use the shared status register (but don't remove it from the individual channels).
-Scott
Thank you for the help (again). I've got my driver registering the isr on it's own now. In the end the problem was the dts and also not using irq_of_parse_and_map.
Ron
Quoted 20 lines · --- Scott Wood
Quoted 2 lines · Ron Madrid
I don't see a "dma" node in the
mpc8377mds.dts(2.6.25). I found one inmpc8610_hpcd.dtsand modeled it after that.Try head-of-tree.
Quoted 7 lines
dma@82a8 { #address-cells = <1>; #size-cells = <1>; compatible = "fsl,elo-dma"; cell-index = <0>; reg = <0x82a8 0x4>; /* DMA general status register */ ranges = <0x0 0x8100 0x200>;Should also put the interrupts in the dma node itself, so that the driver can register it once and use the shared status register (but don't remove it from the individual channels).
-Scott
I use this in 8313erdb.dts, but can not find DMA info in /proc/interrupts.why?
dma@8030 {
#address-cells = <1>;
#size-cells = <1>;
compatible = "fsl,elo-dma";
cell-index = <0>;
reg = <8030 2d0>; /* DMA general status register */
ranges = <0 8100 200>;
dma-channel@0 {
compatible = "fsl,elo-dma-channel";
cell-index = <0>;
reg = <0 80>;
interrupt-parent = <700>;
interrupts = <47 8>;
};
dma-channel@1 {
compatible = "fsl,elo-dma-channel";
cell-index = <1>;
reg = <80 80>;
interrupt-parent = <700>;
interrupts = <47 8>;
};
dma-channel@2 {
compatible = "fsl,elo-dma-channel";
cell-index = <2>;
reg = <100 80>;
interrupt-parent = <700>;
interrupts = <47 8>;
};
dma-channel@3 {
compatible = "fsl,elo-dma-channel";
cell-index = <3>;
reg = <180 80>;
interrupt-parent = <700>;
interrupts = <47 8>;
};
}_______________________________________________
Linuxppc-dev mailing list
[email protected]
https://ozlabs.org/mailman/listinfo/linuxppc-dev
Signature · 2 lines
View this message in context: http://www.nabble.com/Using-DMA-interrupt-on-MPC8313-tp17808164p18084260.html Sent from the linuxppc-dev mailing list archive at Nabble.com.
Quoted 3 lines · jumpingProgrammer
I use this in
8313erdb.dts, but can not find DMA info in/proc/interrupts.why?
Is the driver enabled, and did it call request_irq?
-Scott