Subject: Re: DMA interrupt is not generating in MPC8641D

From: Timur Tabi <[email-masked]>
Date: Wed, 14 Nov 2007 11:12:53 -0600

sivaji wrote:
> Hai,
> 
> We have designed a MPC8641D based AMC card. As part of our customer
> requirement for a PCIe messaging driver for communicating between the
> MPC8641D AMC card as the PCIe target and the MPC8548E AMC card as the Host.
> 
> We are using the DMA for transferring data between the boards thru' PCIe.
> The DMA Interrupt on the target end is not getting registered and hence we
> face the issue (ie) No interrupt is generated after DMA transfer completion.
> 
> As per datasheet(Rev. 1, 05/2007) page no:445 interrupt number for
> DMAchannel 1 is 4. We are using linux kernel version :2.6.23-rc3. According
> to file (include/asm-powerpc/irq.h) line no:636 the interrupt number for DMA
> in linux is 20(decimal). When using this interrupt number 20 we are not able
> to registerd the DMA interrupts.

Since you're using 2.6.23, the IRQ for all devices is specified in the device 
tree, not some header file.  However, the device tree for the 8641 does not 
specify any DMA nodes, so you need to add that.  Here are the nodes for the 8610 
that I'm going to add:

                 dma@21300 {
                         #address-cells = <1>;
                         #size-cells = <1>;
                         compatible = "fsl,mpc8610-dma", "fsl,mpc8540-dma";
                         device-id = <0>;
                         reg = <21300 4>; /* DMA general status register */
                         ranges = <0 21100 200>;

                         dma-channel@0 {
				compatible = "fsl,mpc8610-dma-channel",
					"fsl,mpc8540-dma-channel";
				device-id = <0>;
				reg = <0 80>;
				interrupt-parent = <&mpic>;
				interrupts = <14 2>;
                         };
                         dma-channel@1 {
				compatible = "fsl,mpc8610-dma-channel",
					"fsl,mpc8540-dma-channel";
				device-id = <1>;
				reg = <80 80>;
				interrupt-parent = <&mpic>;
				interrupts = <15 2>;
                         };
                         dma-channel@2 {
				compatible = "fsl,mpc8610-dma-channel",
					"fsl,mpc8540-dma-channel";
				device-id = <2>;
				reg = <100 80>;
				interrupt-parent = <&mpic>;
				interrupts = <16 2>;
                         };
                         dma-channel@3 {
				compatible = "fsl,mpc8610-dma-channel",
					"fsl,mpc8540-dma-channel";
				device-id = <3>;
				reg = <180 80>;
				interrupt-parent = <&mpic>;
				interrupts = <17 2>;
                         };
                 };

                 dma@c300 {
                         #address-cells = <1>;
                         #size-cells = <1>;
                         compatible = "fsl,mpc8610-dma", "fsl,mpc8540-dma";
                         device-id = <1>;
                         reg = <c300 4>; /* DMA general status register */
                         ranges = <0 c100 200>;

                         dma-channel@0 {
				compatible = "fsl,mpc8610-dma-channel",
					"fsl,mpc8540-dma-channel";
				device-id = <0>;
				reg = <0 80>;
				interrupt-parent = <&mpic>;
				interrupts = <3c 2>;
                         };
                         dma-channel@1 {
				compatible = "fsl,mpc8610-dma-channel",
					"fsl,mpc8540-dma-channel";
				device-id = <1>;
				reg = <80 80>;
				interrupt-parent = <&mpic>;
				interrupts = <3d 2>;
                         };
                         dma-channel@2 {
				compatible = "fsl,mpc8610-dma-channel",
					"fsl,mpc8540-dma-channel";
				device-id = <2>;
				reg = <100 80>;
				interrupt-parent = <&mpic>;
				interrupts = <3e 2>;
                         };
                         dma-channel@3 {
				compatible = "fsl,mpc8610-dma-channel",
					"fsl,mpc8540-dma-channel";
				device-id = <3>;
				reg = <180 80>;
				interrupt-parent = <&mpic>;
				interrupts = <3f 2>;
                         };
                 };

	};

Please note that there is no support in the kernel for generic PowerPC DMA 
transfers, so in addition to adding these nodes, you would also need to write 
all the code to do the DMA transfers.

-- 
Timur Tabi
Linux kernel developer at Freescale