This patch is needlessly intrusive and complex. I don't think
you even need to change many current interfaces ... instead:
- Define one new channel macros, along the lines of
#define EDMA_CHANNEL(ctlr,chn) (((ctlr)<<10)|(chan))
Those values would be passed in IORESOURCE_DMA resources,
returned by edma_alloc_channel(), and accepted by all the
current interfaces accepting an EDMA channel. Of course
EDMA_CHANNEL_ANY would still work, but it could look at
more controllers than just the first one.
That's probably a bad name, since there'd need to be an
interface to extract "real" channels from logical ones,
to use when filling out parameter ram slot data.
- Slot allocation would need some change, because it would
need to be coupled to a controller (and thus its channels).
This should be the only driver-visible change.
I suspect it would suffice if edma_slot_alloc() grew one
parameter for the controller, and there were a new call
to extract the controller from the logical channel ID.
Those three calls for logical EDMA channel IDs should work
for slot IDs too: one to build IDs from a controller and
slot number, and two extracting those numbers from the ID.
Difference being that "raw" channel numbers are max 63,
while "raw' slot numbers can be bigger (I've seen 511).
- Rather than converting static state to arrays, first
collect all that state into a "struct edma" or somesuch,
and have an array of those. Use platform_device.id to
say which instance is being configured, and configure
each instance normally in probe().
On Monday 06 April 2009, Sudhakar Rajashekhara wrote:
> --- a/arch/arm/mach-davinci/include/mach/edma.h
> +++ b/arch/arm/mach-davinci/include/mach/edma.h
> @@ -175,39 +175,44 @@ enum sync_dimension {
> #define EDMA_SLOT_ANY -1 /* for edma_alloc_slot() */
>
> /* alloc/free DMA channels and their dedicated parameter RAM slots */
> -int edma_alloc_channel(int channel,
> +int edma_alloc_channel(unsigned cc_inst, int channel,
> void (*callback)(unsigned channel, u16 ch_status, void *data),
> void *data, enum dma_event_q);
> -void edma_free_channel(unsigned channel);
> +void edma_free_channel(unsigned cc_inst, unsigned channel);
>
> /* alloc/free parameter RAM slots */
> -int edma_alloc_slot(int slot);
> -void edma_free_slot(unsigned slot);
> +int edma_alloc_slot(unsigned cc_inst, int slot);
> +void edma_free_slot(unsigned cc_inst, unsigned slot);
Other than edma_alloc_slot(), none of these should need to change.
> /* calls that operate on part of a parameter RAM slot */
> -void edma_set_src(unsigned slot, dma_addr_t src_port,
> +void edma_set_src(unsigned cc_inst, unsigned slot, dma_addr_t src_port,
> enum address_mode mode, enum fifo_width);
> -void edma_set_dest(unsigned slot, dma_addr_t dest_port,
> +void edma_set_dest(unsigned cc_inst, unsigned slot, dma_addr_t dest_port,
> enum address_mode mode, enum fifo_width);
> -void edma_get_position(unsigned slot, dma_addr_t *src, dma_addr_t *dst);
> -void edma_set_src_index(unsigned slot, s16 src_bidx, s16 src_cidx);
> -void edma_set_dest_index(unsigned slot, s16 dest_bidx, s16 dest_cidx);
> -void edma_set_transfer_params(unsigned slot, u16 acnt, u16 bcnt, u16 ccnt,
> - u16 bcnt_rld, enum sync_dimension sync_mode);
> -void edma_link(unsigned from, unsigned to);
> -void edma_unlink(unsigned from);
> +void edma_get_position(unsigned cc_inst, unsigned slot, dma_addr_t *src,
> + dma_addr_t *dst);
> +void edma_set_src_index(unsigned cc_inst, unsigned slot, s16 src_bidx,
> + s16 src_cidx);
> +void edma_set_dest_index(unsigned cc_inst, unsigned slot, s16 dest_bidx,
> + s16 dest_cidx);
> +void edma_set_transfer_params(unsigned cc_inst, unsigned slot, u16 acnt,
> + u16 bcnt, u16 ccnt, u16 bcnt_rld, enum sync_dimension sync_mode);
> +void edma_link(unsigned cc_inst, unsigned from, unsigned to);
> +void edma_unlink(unsigned cc_inst, unsigned from);
>
> /* calls that operate on an entire parameter RAM slot */
> -void edma_write_slot(unsigned slot, const struct edmacc_param *params);
> -void edma_read_slot(unsigned slot, struct edmacc_param *params);
> +void edma_write_slot(unsigned cc_inst, unsigned slot,
> + const struct edmacc_param *params);
> +void edma_read_slot(unsigned cc_inst, unsigned slot,
> + struct edmacc_param *params);
>
> /* channel control operations */
> -int edma_start(unsigned channel);
> -void edma_stop(unsigned channel);
> -void edma_clean_channel(unsigned channel);
> -void edma_clear_event(unsigned channel);
> -void edma_pause(unsigned channel);
> -void edma_resume(unsigned channel);
> +int edma_start(unsigned cc_inst, unsigned channel);
> +void edma_stop(unsigned cc_inst, unsigned channel);
> +void edma_clean_channel(unsigned cc_inst, unsigned channel);
> +void edma_clear_event(unsigned cc_inst, unsigned channel);
> +void edma_pause(unsigned cc_inst, unsigned channel);
> +void edma_resume(unsigned cc_inst, unsigned channel);
_______________________________________________
Davinci-linux-open-source mailing list
[email protected]
http://linux.davincidsp.com/mailman/listinfo/davinci-linux-open-source