From: Felipe Balbi <balbi@ti.com>
To: "Gupta, Ajay Kumar" <ajay.gupta@ti.com>
Cc: Sergei Shtylyov <sshtylyov@mvista.com>,
"linux-usb@vger.kernel.org" <linux-usb@vger.kernel.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
"Pasupathy, Visuvanadan" <vichu@ti.com>,
"Balbi, Felipe" <balbi@ti.com>
Subject: Re: RFC: usb: musb: Changes proposed for adding CPPI4.1 DMA
Date: Thu, 2 Feb 2012 11:09:25 +0200 [thread overview]
Message-ID: <20120202090923.GC9948@legolas.emea.dhcp.ti.com> (raw)
In-Reply-To: <47CEF8C4B26E8C44B22B028A650E0EA9317D9346@DBDE01.ent.ti.com>
[-- Attachment #1: Type: text/plain, Size: 4045 bytes --]
On Thu, Feb 02, 2012 at 04:57:16AM +0000, Gupta, Ajay Kumar wrote:
> Hi,
> > On 31-01-2012 8:41, Gupta, Ajay Kumar wrote:
> >
> > >>> As a next step to dma-engine based cppi4.1 driver implementation
> > >>> this RFC has the overview of changes in the musb driver.
> > >>> RFC on CPPI slave driver changes will follow next.
> >
> > >>> Overview of changes in the musb driver
> > >>> ======================================
> >
> > >>> 1)Add a dma-engine.c file in the drivers/usb/musb folder
> > >>> 2)This file will host the current musb dma APIs and translates them
> > to
> > >>> dmaengine APIs.
> > >>> 3)This will help to keep the changes in drivers/usb/musb/musb* files
> > >>> minimal and also to retain compatibility other DMA (Mentor etc.)
> > >>> drivers which are yet to be moved to drivers/dma
> > >>> 4)drivers/usb/musb/dma-engine.c, will wrap the dmaengine APIs to
> > >>> make existing musb APIs compatible.
> > >>> 5)drivers/usb/musb/dma-engine.c file will implement the filter
> > >>> functions and also implement .dma_controller_create (allocates
> > >>> & provides "dma_controller" object) and .dma_controller_delete
> > >>> 6)CPPI4.1 DMA specific queue and buffer management will be internal
> > >>> to slave CPPI DMA driver implementation.
> >
> > >> You mean drivers/dma/ driver?
> >
> > > yes.
> >
> > >> I think you are forgotting that CPPI 4.1 MUSB
> > >> has some registers controlling DMA/interrupts beside those of CPPI
> > 4.1
> > >> controller and MUSB core itself. How do they fit in your scheme?
> >
> > > We have been discussing on how to handle these in slave driver and
> >
> > These certainly cannot be handled in the slave driver because the
> > registers are different for every controller implementation and, the
> > main thing, they don't belong to CPPI 4.1 as such.
>
> Felipe suggested to use device tree for differences in register maps
> among different platforms.
>
> I do see issues in reading wrapper interrupt status register and then
> calling musb_interrupt() [defined inside musb_core.c] from slave driver.
I have been thinking about that lately. In the end of the day, I want to
remove direct dependencies between musb_core and glue. So what I was
thinking about goes like so:
Glue layer basically has to prepare musb->int_usb, musb->int_tx and
musb->int_rx for musb. Maybe handle some glue specific stuff and so on,
but the IRQ line still belongs to MUSB.
So the idea would be to add something like:
musb_platform_read_intrusb()
musb_platform_read_intrtx()
musb_platform_read_intrrx()
those would default to basic:
musb_readb(musb->mregs, MUSB_INTRUSB);
musb_readw(musb->mregs, MUSB_INTRTX);
musb_readw(musb->mregs, MUSB_INTRRX);
if platform ops aren't passed. So, it would look something like:
diff --git a/drivers/usb/musb/musb_core.c b/drivers/usb/musb/musb_core.c
index 72a424d..ba0bcc2 100644
--- a/drivers/usb/musb/musb_core.c
+++ b/drivers/usb/musb/musb_core.c
@@ -1488,9 +1488,9 @@ static irqreturn_t generic_interrupt(int irq, void *__hci)
spin_lock_irqsave(&musb->lock, flags);
- musb->int_usb = musb_readb(musb->mregs, MUSB_INTRUSB);
- musb->int_tx = musb_readw(musb->mregs, MUSB_INTRTX);
- musb->int_rx = musb_readw(musb->mregs, MUSB_INTRRX);
+ musb->int_usb = musb_platform_read_intusb(musb->controller);
+ musb->int_tx = musb_platform_read_inttx(musb->controller);
+ musb->int_rx = musb_platform_read_intrx(musb->controller);
if (musb->int_usb || musb->int_tx || musb->int_rx)
retval = musb_interrupt(musb);
those would make sure to prepare the cached IRQ status registers for
MUSB core.
Keep in mind that this is only necessary because on
DaVinci/OMAP-L13x/AM35x devices you guys have decided to make the
wrapper read the IRQ status register from MUSB address space. And
because those are clear-on-read, we're screwed.
Oh well, this is the best I could come up with. Any problems you guys
see ?
--
balbi
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]
next prev parent reply other threads:[~2012-02-02 9:09 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-01-25 15:22 RFC: usb: musb: Changes proposed for adding CPPI4.1 DMA Gupta, Ajay Kumar
2012-01-26 9:02 ` Felipe Balbi
2012-01-27 15:01 ` Gupta, Ajay Kumar
2012-01-27 16:09 ` Sergei Shtylyov
2012-01-31 4:41 ` Gupta, Ajay Kumar
2012-01-31 11:27 ` Sergei Shtylyov
2012-02-02 4:57 ` Gupta, Ajay Kumar
2012-02-02 9:09 ` Felipe Balbi [this message]
2012-02-02 11:12 ` Sergei Shtylyov
2012-02-02 11:49 ` Felipe Balbi
2012-02-02 12:02 ` Sergei Shtylyov
2012-02-02 12:15 ` Felipe Balbi
2012-02-02 11:05 ` Sergei Shtylyov
2012-02-03 8:42 ` Gupta, Ajay Kumar
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20120202090923.GC9948@legolas.emea.dhcp.ti.com \
--to=balbi@ti.com \
--cc=ajay.gupta@ti.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-usb@vger.kernel.org \
--cc=sshtylyov@mvista.com \
--cc=vichu@ti.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).