Re: [PATCH] Jazzsonic driver updates

From: Finn Thain
Date: Wed Jun 15 2005 - 09:05:36 EST




On Wed, 15 Jun 2005, Ralf Baechle wrote:

> On Sun, Jun 12, 2005 at 04:05:30PM +1000, Finn Thain wrote:
>
> > > Oh funny. vdma_alloc() was created 10 years ago as an internal API
> > > for the Jazz machines. Didn't realize m68k had cloned it :-) If
> > > anything it seems this should be converted to the modern DMA API.
> >
> > I've just started merging my Mac sonic work into 2.6.12-rc6. m68k
> > doesn't yet implement the modern DMA API, but it is easy to fake it
> > for a while for macsonic.c.

Roman Zippel has since posted an implementation of that API for m68k, BTW.
So I'll use that for macsonic, and possibly the driver core as well if I
can figure out how to do this with jazzsonic.

> > So I don't mind converting macsonic, jazzsonic and the shared sonic
> > driver core to the new API.
> >
> > But, I knowing nothing about the Jazz DMA controller. I need some help
> > from the MIPS people:
>
> It's a while since I last touched that machine, so remember this is from
> 10 year old memory ...
>
> The Jazz DMA hardware is an MMU that translates virtual DMA to physical
> addresses. It's virtual DMA address space is 16MB in size, it's page
> size is 4kB. That's a set of capabilities that nicely translates into
> the DMA API.

I gather that someone has already put this hardware under the control of
the generic DMA API?

> > Would I be right to say that vdma_{alloc,free}() can be changed to
> > dma_{,un}map_single? The other Jazz specific routine that sonic uses
> > is vdma_log2phys, and I don't know if that has a better alternative.
>
> The use of that call should simply be eleminated entirely. DMA API
> functions such as dma_alloc_coherent or dma_map_single will return a
> dma_handle which along with the virtual address returned is everything
> ever needed to program a DMA engine.

The sonic chip stores packets inside a "receive resource area" at a
physical address that depends on the packets it previously stored there.

So the chip determines that address and the driver has to convert it from
a physical to a virtual address with KSEG1ADDR(vdma_log2phys(x)), in order
to memcpy the received packet.

>From what code I've looked at, and from what you've told me, I'm guessing
that bus_to_virt() won't cut it here (?)

-f


>
> Ralf
>
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/