> On 2 Sep 2017, at 2:37 pm, Artturi Alm <artturi....@gmail.com> wrote:
> 
> Hi,
> 
> i've been slowly looking at bringing dma for some of the lesser sunxis,
> and have reached the point where i'm unsure what to do next beyond
> testing the functionality w/spreading SoC-specific hacks "for testing"..
> 
> now even if i will manage to shove it partly under _bus_dma_tag, it will
> not be usable w/o a hack/special-casing either, so that lead to looking
> at implementing ofw_dmac, which i can't finish because i can't decide on
> it's interface, i mean there's too many completely new pieces to me in
> the puzzle after all, o and the naming; ofw_dma or ofw_dmac? can't pick.

there are two reasons to try and implement this behind the bus_dma api.

firstly, if the device using the dmac is present on multiple types of buses and 
therefore needs the abstraction layer. if the device is only available on the 
same chip as the dmac then this matters less.

secondly, implementing the bus_dma api makes drivers more readable and 
maintainable.

> 
> DT-binding properties for the generic dma-controller did seem simple,
> and in my case the Allwinner A10 DMA Controller follows those, but w/o
> knowing better continuing would likely be waste of my time:)
> 
> currently i have something like this in sys/dev/ofw/ofw_dmac.h:
> 
> struct dma_controller {
>       int      dc_node;
>               /*
>                * Pointer to struct x_bus_space_tag, containing
>                * another _cookie to struct x_softc of our parent.
>                */
>       void    *dc_cookie;
> 
>               /* claim/disown channel|w/e controller specific */
>       void    (*dc_claim)(void *. uint32_t *, int);
>                       /* dc_cookie, &cells[1], disown:0|claim:1 */
> 
>       LIST_ENTRY(dma_controller) dc_list;
>       uint32_t dc_phandle;
>       uint32_t dc_cells;
> 
> #ifdef notyet
>       uint32_t dc_channels;
>       uint32_t dc_requests;
> #endif
> };
> 
> void  dmac_register(struct dma_controller *);
> /*
> * does return the number of entries in the "dmas" property,
> * and the bus_dma_tag_t for client to use.
> */
> int   dmac_register_client(int, bus_dma_tag_t *);
> 
> void  dmac_claim(int, const char *);
> void  dmac_claim_idx(int, int);
> 
> void  dmac_disown(int, const char *);
> void  dmac_disown_idx(int, int);
> 
> 
> for clients that'd be quite simple to use to get more specific
> bus_dma_tag than given in fdt_attach_args, so ie. in drivers
> used across different dma controllers, im hoping above might
> work w/clients calling _register_client unconditionally? or?
> 
> any input more than welcome:)
> -Artturi
> 

Reply via email to