Clean up kernel recipes and bump to the current GIT HEAD.
[openpandora.oe.git] / recipes / linux / omap3-pandora-kernel / dvb-fix-dma.diff
1 Hi,
2 I post this patch that fixes a kernel crash that happens when using a dvb
3 usb stick on a mips platform and I think even on other platforms on which
4 the dma access in not cache-coherent.
5
6 The problem's origin is that, inside the method usb_bulk_urb_init of file
7 drivers/media/dvb/dvb-usb/usb-urb.c, stream->urb_list[i]->transfer_buffer
8 points to a memory area that has been allocated to be dma-coherent but
9 stream->urb_list[i]->transfer_flags doesn't include the
10 URB_NO_TRANSFER_DMA_MAP flag and stream->urb_list[i]->transfer_dma is not
11 set.
12 When later on the stream->urb_list[i]->transfer_buffer pointer is used
13 inside function usb_hcd_submit_urb of file drivers/usb/core/hcd.c since the
14 flag URB_NO_TRANSFER_DMA_MAP is not set the urb->transfer_buffer pointer is
15 passed to the dma_map_single function that since the address is dma-coherent
16 returns a wrong tranfer_dma address that later on leads to the kernel crash.
17
18 The problem is solved by setting the URB_NO_TRANSFER_DMA_MAP flag and the
19 stream->urb_list[i]->transfer_dma address.
20
21 Perhaps to be more safe the URB_NO_TRANSFER_DMA_MAP flag can be set only
22 if stream->urb_list[i]->transfer_dma != 0.
23
24 I don't know if half of the fault can be of the dma_map_single function that
25 should anyway returns a valid address both for a not dma-coherent and a
26 dma-coherent address.
27
28 Just to be clear:
29 I've done this patch to solve my problem and I tested it only on a mips 
30 platform
31 but I think it should not cause any problems on other platforms.
32 I posted it here to help someone else that can have my same problem and to 
33 point it out
34 to the mantainer of this part of code.
35 You can use it at your own risk and I'm not resposible in any way for any 
36 problem or
37 damage that it can cause.
38 I'm available to discuss about it
39
40 Bye
41
42 Michele Scorcia
43
44 --------------------
45
46
47
48
49 --- /tmp/usb-urb.c      2008-10-08 09:53:23.000000000 +0200
50 +++ git/drivers/media/dvb/dvb-usb/usb-urb.c     2008-10-08 09:54:16.000000000 +0200
51 @@ -152,7 +152,8 @@
52                                 stream->props.u.bulk.buffersize,
53                                 usb_urb_complete, stream);
54  
55 -               stream->urb_list[i]->transfer_flags = 0;
56 +               stream->urb_list[i]->transfer_flags = URB_NO_TRANSFER_DMA_MAP;
57 +               stream->urb_list[i]->transfer_dma = stream->dma_addr[i];        
58                 stream->urbs_initialized++;
59         }
60         return 0;