From: Min Guo <min.guo@mediatek.com>
To: Bin Liu <b-liu@ti.com>
Cc: Rob Herring <robh+dt@kernel.org>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
Mark Rutland <mark.rutland@arm.com>,
Matthias Brugger <matthias.bgg@gmail.com>,
Alan Stern <stern@rowland.harvard.edu>,
chunfeng.yun@mediatek.com, linux-usb@vger.kernel.org,
devicetree@vger.kernel.org, linux-kernel@vger.kernel.org,
linux-arm-kernel@lists.infradead.org,
linux-mediatek@lists.infradead.org,
Yonglong Wu <yonglong.wu@mediatek.com>
Subject: Re: [PATCH 4/4] usb: musb: Add support for MediaTek musb controller
Date: Fri, 11 Jan 2019 09:18:10 +0800 [thread overview]
Message-ID: <1547169490.4433.147.camel@mhfsdcap03> (raw)
In-Reply-To: <20190110141840.GA18026@uda0271908>
Hi Bin,
On Thu, 2019-01-10 at 08:18 -0600, Bin Liu wrote:
> Hi Min,
>
> Please briefly summarize the controller differences in the commit log,
> such as
>
> - WIC interrupt registers;
> - data toggle bit;
> - no dedicated DMA interrupt line;
>
> so that we can quickly understand the core driver is modified
> accordingly to handle the differences.
Okay, tkanks.
> On Thu, Jan 10, 2019 at 03:24:22PM +0800, Min Guo wrote:
> > Hi Bin,
>
> [snip]
>
> > > > > > + musb_writeb(mbase, MUSB_INTRUSB,
> > > > > > + musb_readb(mbase, MUSB_INTRUSB));
> > > > >
> > > > > For this clearing register bit operation, please create platform hooks
> > > > > musb_clearb() and musb_clearw() in struct musb_platform_ops instead,
> > > > > then follow how musb_readb() pointer is assigned in
> > > > > musb_init_controller() to use the W1C version for mtk platform.
> > > >
> > > > I have tried implementing musb_readb(), musb_readw() interface with
> > > > interrupt status W1C function in struct musb_platform_ops. But this
> > > > interface will require a global variable to hold MAC basic address for
> > > > judgment, and then special handling of the interrupt state. A global
> > > > variable will make the driver work with only a single instance, so it
> > > > can't work on some MTK platforms which have two instances.
> > >
> > > I didn't mean to modify musb_read*(), but
> > >
> > > > How about creating musb_clearb/w() as following:
> > > > void (*clearb)(void __iomem *addr, unsigned offset, u8 data);
> > > > void (*clearw)(void __iomem *addr, unsigned offset, u16 data);
> > >
> > > this is what I was asking for, similar to what musb_readb/w() is
> > > implemented.
> >
> > I will prepare a patch for musb_clearb/w().
>
> This doesn't have to be a separate patch.
Okay.
> > > > > > + musb_writew(mbase, MUSB_INTRRX,
> > > > > > + musb_readw(mbase, MUSB_INTRRX));
> > > > > > + musb_writew(mbase, MUSB_INTRTX,
> > > > > > + musb_readw(mbase, MUSB_INTRTX));
> > > > > > + }
>
> [snip]
>
> > > > > > + /* MediaTek controller has private toggle register */
> > > > >
> > > > > only one toggle register for all endpoints? how does it handle
> > > > > difference toggle values for different endpoints?
> > > >
> > > > MediaTek controller has separate registers to describe TX/RX toggle.
> > >
> > > Is it one register per endpoint?
> >
> > MUSB_RXTOG/MUSB_TXTOG is common register, each bit reflects the toggle
> > state of an endpoint. bit[0] not used,bit[1~8] corresponds to ep[1~8]
> >
> > > >
> > > > > > + if (musb->ops->quirks & MUSB_MTK_QUIRKS) {
> > > > > > + u16 toggle;
> > > > > > + u8 epnum = qh->hw_ep->epnum;
> > > > > > +
> > > > > > + if (is_in)
> > > > > > + toggle = musb_readl(musb->mregs, MUSB_RXTOG);
> > >
> > > this line seems telling there is just *one* register for all endpoints.
> >
> > Yes, all endpoint share this register, endpoint and bit are one-to-one
> > correspondence.
>
> Okay, thanks. Sorry I missed the bit operation in the code below.
>
> >
> > > > >
> > > > > should use musb_readw() instead? MUSB_RXTOG seems to be 16bit.
> > > >
> > > > Ok
> > > >
> > > > > > + else
> > > > > > + toggle = musb_readl(musb->mregs, MUSB_TXTOG);
> > > > > > +
> > > > > > + csr = toggle & (1 << epnum);
>
> Regards,
> -Bin.
next prev parent reply other threads:[~2019-01-11 1:18 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-12-27 7:34 [PATCH 0/4] Add MediaTek MUSB Controller Driver min.guo
2018-12-27 7:34 ` [PATCH 1/4] dt-bindings: usb: musb: Add support for MediaTek musb controller min.guo
2019-01-03 22:14 ` Rob Herring
2019-01-04 3:00 ` Min Guo
2019-01-04 16:10 ` Rob Herring
2019-01-07 7:31 ` Min Guo
2019-01-08 14:05 ` Rob Herring
[not found] ` <1545896066-897-2-git-send-email-min.guo-NuS5LvNUpcJWk0Htik3J/w@public.gmane.org>
2019-01-07 20:40 ` Bin Liu
2019-01-08 1:30 ` Min Guo
2018-12-27 7:34 ` [PATCH 2/4] arm: dts: mt2701: Add usb2 device nodes min.guo
2018-12-27 7:34 ` [PATCH 3/4] usb: musb: Move musbhsdma macro definition to musb_dma.h min.guo
2018-12-27 7:34 ` [PATCH 4/4] usb: musb: Add support for MediaTek musb controller min.guo
2019-01-08 15:44 ` Bin Liu
2019-01-09 12:31 ` Min Guo
2019-01-09 14:01 ` Bin Liu
2019-01-10 7:24 ` Min Guo
2019-01-10 14:18 ` Bin Liu
2019-01-11 1:18 ` Min Guo [this message]
2019-01-11 5:24 ` Min Guo
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=1547169490.4433.147.camel@mhfsdcap03 \
--to=min.guo@mediatek.com \
--cc=b-liu@ti.com \
--cc=chunfeng.yun@mediatek.com \
--cc=devicetree@vger.kernel.org \
--cc=gregkh@linuxfoundation.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mediatek@lists.infradead.org \
--cc=linux-usb@vger.kernel.org \
--cc=mark.rutland@arm.com \
--cc=matthias.bgg@gmail.com \
--cc=robh+dt@kernel.org \
--cc=stern@rowland.harvard.edu \
--cc=yonglong.wu@mediatek.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).