Re: How to (get a struct device* to) map a DMA buffer for McBSP?

2010-11-28 Thread Scott Ellis
I had exactly the same problem. It looks like the struct omap_mcbsp array was
intended to be accessible

>From include/plat/mcbsp.h
extern struct omap_mcbsp **mcbsp_ptr;

I couldn't get access to mcbsp_ptr in an out of tree module. So I added this

arch/arm/plat-omap/include/plat/mcbsp.h
+struct omap_mcbsp* omap_mcbsp_get_mcbsp_ptr(u8 id);

arch/arm/plat-omap/mcbsp.c
+struct omap_mcbsp* omap_mcbsp_get_mcbsp_ptr(u8 id)
+{
+   if (!omap_mcbsp_check_valid_id(id))
+   return NULL;
+
+   return id_to_mcbsp_ptr(id);
+}
+EXPORT_SYMBOL(omap_mcbsp_get_mcbsp_ptr);
+

This was to could get access to .phys_base and .dma_rx_sync for my own DMA ops.

Is there a better way?


--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


How to (get a struct device* to) map a DMA buffer for McBSP?

2010-11-24 Thread Michael Poole
I am trying to write a device driver to stream data via a McBSP
module.  Most of it is a pretty thin layer, thanks to all the
framework in plat-omap/mcbsp.c and .../mcbsp.h.  However, I am getting
stuck on the read() and write() implementation -- in particular,
retrieving the device pointer for the DMA mapping functions.

To pick dma_map_single(dev, ptr, size, dir) as an example, the ARM
implementation of dma_map_single() looks like it requires dev != NULL.
 struct omap_mcbsp's "dev" field would be the natural thing to pass,
but the mcbsp_ptr array is not an exported symbol, and there is no
function declared in mcbsp.h that will expose either the omap_mcbsp
struct or the device struct inside it.

Is there a good way to get the right struct device* for the McBSP
module that this device driver is using?  Would a patch be accepted to
add a function that would return the struct device * given the McBSP
id (and if so, should it use EXPORT_SYMBOL() or EXPORT_SYMBOL_GPL())?

Michael Poole
--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html