Re: [PATCH] musb: add double buffer flag

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, Jan 21, 2011 at 2:43 PM, Felipe Balbi <balbi@xxxxxx> wrote:
> On Fri, Jan 21, 2011 at 02:37:58PM +0800, Bob Liu wrote:
>> On Fri, Jan 21, 2011 at 2:25 PM, Felipe Balbi <balbi@xxxxxx> wrote:
>> > Hi,
>> >
>> > On Fri, Jan 21, 2011 at 01:39:20PM +0800, Bob Liu wrote:
>> >> diff --git a/drivers/usb/musb/musb_host.c b/drivers/usb/musb/musb_host.c
>> >> index 4d5bcb4..7a9ab45 100644
>> >> --- a/drivers/usb/musb/musb_host.c
>> >> +++ b/drivers/usb/musb/musb_host.c
>> >> @@ -609,7 +609,7 @@ musb_rx_reinit(struct musb *musb, struct musb_qh *qh, struct musb_hw_ep *ep)
>> >> Â Â Â /* Set RXMAXP with the FIFO size of the endpoint
>> >> Â Â Â Â* to disable double buffer mode.
>> >> Â Â Â Â*/
>> >> - Â Â if (musb->hwvers < MUSB_HWVERS_2000)
>> >> + Â Â if (musb->double_buffer_not_ok)
>> >> Â Â Â Â Â Â Â musb_writew(ep->regs, MUSB_RXMAXP, ep->max_packet_sz_rx);
>> >> Â Â Â else
>> >> Â Â Â Â Â Â Â musb_writew(ep->regs, MUSB_RXMAXP,
>> >
>> > you're only changing RX path, does double buffering work on TX path ?
>> > This patch seems incomplete for host side. My original version was
>> > changing both RX and TX.
>> >
>>
>> Oh, ÂI just replaced origin positions where have "MUSB_HWVERS_2000".
>> But I agree with changing TX path also.
>
> here's updated original patch, please test and reply with a tested-by or
> acked-by or signed-off-by flag:
>

Thank you! I will test it soon.

> commit 149e557050b1e1731704dda68b606f306ae8ace2
> Author: Felipe Balbi <balbi@xxxxxx>
> Date: Â Fri Jan 21 13:39:20 2011 +0800
>
> Â Âusb: musb: disable double buffering when it's broken
>
> Â ÂWe know that blackfin doesn't support double
> Â Âbuffering feature as of today. So we add a
> Â Âflag set by musb_platform_init() to forcefully
> Â Âdisable that feature.
>
> Â ÂSuch flag is created and marked as deprecated
> Â Âto force us to find a solution for the missing
> Â Âdouble buffering support on blackfin.
>
> Â ÂSigned-off-by: Felipe Balbi <balbi@xxxxxx>
>
> diff --git a/drivers/usb/musb/blackfin.c b/drivers/usb/musb/blackfin.c
> index eeba228..9d49d1c 100644
> --- a/drivers/usb/musb/blackfin.c
> +++ b/drivers/usb/musb/blackfin.c
> @@ -404,6 +404,7 @@ static int bfin_musb_init(struct musb *musb)
> Â Â Â Â Â Â Â Âmusb->xceiv->set_power = bfin_musb_set_power;
>
> Â Â Â Âmusb->isr = blackfin_interrupt;
> + Â Â Â musb->double_buffer_not_ok = true;
>
> Â Â Â Âreturn 0;
> Â}
> diff --git a/drivers/usb/musb/musb_core.h b/drivers/usb/musb/musb_core.h
> index d0c236f..d74a811 100644
> --- a/drivers/usb/musb/musb_core.h
> +++ b/drivers/usb/musb/musb_core.h
> @@ -488,6 +488,18 @@ struct musb {
>    Âunsigned        Âset_address:1;
>    Âunsigned        Âtest_mode:1;
>    Âunsigned        Âsoftconnect:1;
> + Â Â Â /*
> + Â Â Â Â* FIXME: Remove this flag.
> + Â Â Â Â*
> + Â Â Â Â* This is only added to allow Blackfin to work
> + Â Â Â Â* with current driver. For some unknown reason
> + Â Â Â Â* Blackfin doesn't work with double buffering
> + Â Â Â Â* and that's enabled by default.
> + Â Â Â Â*
> + Â Â Â Â* We added this flag to forcefully disable double
> + Â Â Â Â* buffering until we get it working.
> + Â Â Â Â*/
> +    unsigned        Âdouble_buffer_not_ok:1 __deprecated;
>
> Â Â Â Âu8 Â Â Â Â Â Â Â Â Â Â Âaddress;
> Â Â Â Âu8 Â Â Â Â Â Â Â Â Â Â Âtest_mode_nr;
> diff --git a/drivers/usb/musb/musb_gadget.c b/drivers/usb/musb/musb_gadget.c
> index ed58c6c..bee8106 100644
> --- a/drivers/usb/musb/musb_gadget.c
> +++ b/drivers/usb/musb/musb_gadget.c
> @@ -989,7 +989,10 @@ static int musb_gadget_enable(struct usb_ep *ep,
> Â Â Â Â Â Â Â Â/* Set TXMAXP with the FIFO size of the endpoint
> Â Â Â Â Â Â Â Â * to disable double buffering mode.
> Â Â Â Â Â Â Â Â */
> - Â Â Â Â Â Â Â musb_writew(regs, MUSB_TXMAXP, musb_ep->packet_sz | (musb_ep->hb_mult << 11));
> + Â Â Â Â Â Â Â if (musb->double_buffer_not_ok)
> + Â Â Â Â Â Â Â Â Â Â Â musb_writew(regs, MUSB_TXMAXP, hw_ep->max_packet_sz_tx);
> + Â Â Â Â Â Â Â else
> + Â Â Â Â Â Â Â Â Â Â Â musb_writew(regs, MUSB_TXMAXP, musb_ep->packet_sz | (musb_ep->hb_mult << 11));
>
> Â Â Â Â Â Â Â Âcsr = MUSB_TXCSR_MODE | MUSB_TXCSR_CLRDATATOG;
> Â Â Â Â Â Â Â Âif (musb_readw(regs, MUSB_TXCSR)
> @@ -1025,7 +1028,10 @@ static int musb_gadget_enable(struct usb_ep *ep,
> Â Â Â Â Â Â Â Â/* Set RXMAXP with the FIFO size of the endpoint
> Â Â Â Â Â Â Â Â * to disable double buffering mode.
> Â Â Â Â Â Â Â Â */
> - Â Â Â Â Â Â Â musb_writew(regs, MUSB_RXMAXP, musb_ep->packet_sz | (musb_ep->hb_mult << 11));
> + Â Â Â Â Â Â Â if (musb->double_buffer_not_ok)
> + Â Â Â Â Â Â Â Â Â Â Â musb_writew(regs, MUSB_RXMAXP, hw_ep->max_packet_sz_tx);
> + Â Â Â Â Â Â Â else
> + Â Â Â Â Â Â Â Â Â Â Â musb_writew(regs, MUSB_RXMAXP, musb_ep->packet_sz | (musb_ep->hb_mult << 11));
>
> Â Â Â Â Â Â Â Â/* force shared fifo to OUT-only mode */
> Â Â Â Â Â Â Â Âif (hw_ep->is_shared_fifo) {
> diff --git a/drivers/usb/musb/musb_host.c b/drivers/usb/musb/musb_host.c
> index 4d5bcb4..0f523d7 100644
> --- a/drivers/usb/musb/musb_host.c
> +++ b/drivers/usb/musb/musb_host.c
> @@ -609,7 +609,7 @@ musb_rx_reinit(struct musb *musb, struct musb_qh *qh, struct musb_hw_ep *ep)
> Â Â Â Â/* Set RXMAXP with the FIFO size of the endpoint
> Â Â Â Â * to disable double buffer mode.
> Â Â Â Â */
> - Â Â Â if (musb->hwvers < MUSB_HWVERS_2000)
> + Â Â Â if (musb->double_buffer_not_ok)
> Â Â Â Â Â Â Â Âmusb_writew(ep->regs, MUSB_RXMAXP, ep->max_packet_sz_rx);
> Â Â Â Âelse
> Â Â Â Â Â Â Â Âmusb_writew(ep->regs, MUSB_RXMAXP,
> @@ -784,14 +784,13 @@ static void musb_ep_program(struct musb *musb, u8 epnum,
> Â Â Â Â Â Â Â Â/* protocol/endpoint/interval/NAKlimit */
> Â Â Â Â Â Â Â Âif (epnum) {
> Â Â Â Â Â Â Â Â Â Â Â Âmusb_writeb(epio, MUSB_TXTYPE, qh->type_reg);
> - Â Â Â Â Â Â Â Â Â Â Â if (can_bulk_split(musb, qh->type))
> + Â Â Â Â Â Â Â Â Â Â Â if (musb->double_buffer_not_ok)

But I can't understand why change can_bulk_split() to double_buffer_not_ok.
In my opinion, there are two different thing.

> Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Âmusb_writew(epio, MUSB_TXMAXP,
> - Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â packet_sz
> - Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â | ((hw_ep->max_packet_sz_tx /
> - Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â packet_sz) - 1) << 11);
> + Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â hw_ep->max_packet_sz_tx);
> Â Â Â Â Â Â Â Â Â Â Â Âelse
> Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Âmusb_writew(epio, MUSB_TXMAXP,
> - Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â packet_sz);
> + Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â qh->maxpacket |
> + Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â ((qh->hb_mult - 1) << 11));
> Â Â Â Â Â Â Â Â Â Â Â Âmusb_writeb(epio, MUSB_TXINTERVAL, qh->intv_reg);
> Â Â Â Â Â Â Â Â} else {
> Â Â Â Â Â Â Â Â Â Â Â Âmusb_writeb(epio, MUSB_NAKLIMIT0, qh->intv_reg);
>

-- 
Regards,
--Bob
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux