[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: Problem with DMA registers with module driver




> From: owner-dev-etrax@xxxxxxx.com 
> [mailto:owner-dev-etrax@xxxxxxx.com] On Behalf Of Arne Bockholdt
> Sent: den 4 februari 2004 14:39
> To: dev-etrax
> Subject: Problem with DMA registers with module driver
> 
> 
> Hallo,
> 
> I've run into a problem with reading and writing of the 
> registers for the
> external DMA of the Etrax MCM CPU. I've written a driver that uses the
> external DMA channel 0 / internal DMA 4 to communicate with an FPGA.
> Everything is fine until I complied my driver as module and 
> loaded it with
> insmod into the kernel, the data of the registers of the DMA 
> controller is
> corrupted now and the DMA controller doesn't work as 
> expected, the same
> driver linked staticly to the kernel works without any 
> problem. My other
> drivers are working as module without problems.

One thing you need to keep in mind is that when you load a driver as a
module the text, data and bss is allocated as paged memory from kernel
segment d. This means that virt_to_phys() won't work on buffers declared
as variables in your module. Allocate the buffers using kmalloc()
instead.

--
Lars Viklund
Expert Software Engineer
Software Platforms
Axis Communications AB