All of lore.kernel.org
 help / color / mirror / Atom feed
From: Mathias Nyman <mathias.nyman-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>
To: Daniel Thompson
	<daniel.thompson-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>,
	chunfeng yun
	<chunfeng.yun-NuS5LvNUpcJWk0Htik3J/w@public.gmane.org>
Cc: Mathias Nyman
	<mathias.nyman-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>,
	Rob Herring <robh+dt-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>,
	Mark Rutland <mark.rutland-5wv7dgnIgG8@public.gmane.org>,
	Matthias Brugger
	<matthias.bgg-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>,
	Felipe Balbi <balbi-l0cyMroinI0@public.gmane.org>,
	Sascha Hauer <s.hauer-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>,
	devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org,
	Roger Quadros <rogerq-l0cyMroinI0@public.gmane.org>,
	linux-usb-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	linux-mediatek-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org,
	John Crispin <blogic-p3rKhJxN3npAfugRpC6u6w@public.gmane.org>,
	Daniel Kurtz <djkurtz-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org>,
	Sergei Shtylyov
	<sergei.shtylyov-M4DtvfQ/ZS1MRgGoP+s0PdBPR1lH4CV8@public.gmane.org>,
	Kishon Vijay Abraham I <kishon-l0cyMroinI0@public.gmane.org>,
	Pawel Moll <pawel.moll-5wv7dgnIgG8@public.gmane.org>,
	Ian Campbell
	<ijc+devicetree-KcIKpvwj1kUDXYZnReoRVg@public.gmane.org>,
	Kumar Gala <galak-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org>,
	Greg Kroah-Hartman
	<gregkh-hQyY1W1yCW8ekmWlsbkhG0B+6BGkLq7r@public.gmane.org>
Subject: Re: [PATCH v9 4/5] xhci: mediatek: support MTK xHCI host controller
Date: Thu, 08 Oct 2015 16:05:00 +0300	[thread overview]
Message-ID: <561669FC.3030600@linux.intel.com> (raw)
In-Reply-To: <5616616D.3080205-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>

On 08.10.2015 15:28, Daniel Thompson wrote:
> On 08/10/15 13:05, chunfeng yun wrote:
>> Hi,
>> On Thu, 2015-10-01 at 12:44 +0100, Daniel Thompson wrote:
>>> On 29/09/15 04:01, Chunfeng Yun wrote:
>>>> There some vendor quirks for MTK xhci host controller:
>>>> 1. It defines some extra SW scheduling parameters for HW
>>>>     to minimize the scheduling effort for synchronous and
>>>>     interrupt endpoints. The parameters are put into reseved
>>>>     DWs of slot context and endpoint context.
>>>> 2. Its IMODI unit for Interrupter Moderation register is
>>>>     8 times as much as that defined in xHCI spec.
>>>> 3. Its TDS in  Normal TRB defines a number of packets that
>>>>     remains to be transferred for a TD after processing all
>>>>     Max packets in all previous TRBs.
>>>>
>>>> Signed-off-by: Chunfeng Yun <chunfeng.yun-NuS5LvNUpcJWk0Htik3J/w@public.gmane.org>
>>>
>>> I've done some basic soak tests, both with a directly attached USB3 HDD
>>> and, given the extra code to manage isochronous xfer, also with a hub,
>>> disc and two audio interfaces.
>>>
>>> Tested-by: Daniel Thompson <daniel.thompson-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
>>>
>>>
>>>> diff --git a/drivers/usb/host/xhci-ring.c b/drivers/usb/host/xhci-ring.c
>>>> index 57f40a1..243f696 100644
>>>> --- a/drivers/usb/host/xhci-ring.c
>>>> +++ b/drivers/usb/host/xhci-ring.c
>>>> @@ -68,6 +68,7 @@
>>>>    #include <linux/slab.h>
>>>>    #include "xhci.h"
>>>>    #include "xhci-trace.h"
>>>> +#include "xhci-mtk.h"
>>>>
>>>>    /*
>>>>     * Returns zero if the TRB isn't in this segment, otherwise it returns the DMA
>>>> @@ -3044,18 +3045,27 @@ static u32 xhci_td_remainder(struct xhci_hcd *xhci, int transferred,
>>>>                      struct urb *urb, unsigned int num_trbs_left)
>>>>    {
>>>>        u32 maxp, total_packet_count;
>>>> +    u32 skip_current_trb = 0;
>>>
>>> A bit of a nitpick but why do we need skip_current_trb? Testing
>>> (xhci->quirks & XHCI_MTK_HOST) twice would make what the code does, and
>>> why, more obvious.
>>>
>> I am not sure which way it is better, so add variable of
>> skip_current_trb to reduce test times.
>
> I can't imagine either approach impacts performance. However introducing skip_current_trb makes the flow of the branches harder to follow.
>
> The first branch was a version check and can remain so; we only need to do something special with the quirks because the MTK controller is 0.97 but with a few bits added:
>
>      /* MTK xHCI is mostly 0.97 but contains some features from 1.0 */
>      if (xhci->hci_version < 0x100 && !(xhci->quirks & XHCI_MTK_HOST))
>          return ...
>
> Setting trb_buff_len to zero is accommodating a quirk and this is clearer when we have:
>
>      /* for MTK xHCI, TD size doesn't include this TRB */
>      if (xhci->quirks & XHCI_MTK_HOST)
>          trb_buff_len = 0;

Both will work, but I'd prefer this solution as well.

-Mathias

--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

WARNING: multiple messages have this Message-ID (diff)
From: mathias.nyman@linux.intel.com (Mathias Nyman)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH v9 4/5] xhci: mediatek: support MTK xHCI host controller
Date: Thu, 08 Oct 2015 16:05:00 +0300	[thread overview]
Message-ID: <561669FC.3030600@linux.intel.com> (raw)
In-Reply-To: <5616616D.3080205@linaro.org>

On 08.10.2015 15:28, Daniel Thompson wrote:
> On 08/10/15 13:05, chunfeng yun wrote:
>> Hi,
>> On Thu, 2015-10-01 at 12:44 +0100, Daniel Thompson wrote:
>>> On 29/09/15 04:01, Chunfeng Yun wrote:
>>>> There some vendor quirks for MTK xhci host controller:
>>>> 1. It defines some extra SW scheduling parameters for HW
>>>>     to minimize the scheduling effort for synchronous and
>>>>     interrupt endpoints. The parameters are put into reseved
>>>>     DWs of slot context and endpoint context.
>>>> 2. Its IMODI unit for Interrupter Moderation register is
>>>>     8 times as much as that defined in xHCI spec.
>>>> 3. Its TDS in  Normal TRB defines a number of packets that
>>>>     remains to be transferred for a TD after processing all
>>>>     Max packets in all previous TRBs.
>>>>
>>>> Signed-off-by: Chunfeng Yun <chunfeng.yun@mediatek.com>
>>>
>>> I've done some basic soak tests, both with a directly attached USB3 HDD
>>> and, given the extra code to manage isochronous xfer, also with a hub,
>>> disc and two audio interfaces.
>>>
>>> Tested-by: Daniel Thompson <daniel.thompson@linaro.org>
>>>
>>>
>>>> diff --git a/drivers/usb/host/xhci-ring.c b/drivers/usb/host/xhci-ring.c
>>>> index 57f40a1..243f696 100644
>>>> --- a/drivers/usb/host/xhci-ring.c
>>>> +++ b/drivers/usb/host/xhci-ring.c
>>>> @@ -68,6 +68,7 @@
>>>>    #include <linux/slab.h>
>>>>    #include "xhci.h"
>>>>    #include "xhci-trace.h"
>>>> +#include "xhci-mtk.h"
>>>>
>>>>    /*
>>>>     * Returns zero if the TRB isn't in this segment, otherwise it returns the DMA
>>>> @@ -3044,18 +3045,27 @@ static u32 xhci_td_remainder(struct xhci_hcd *xhci, int transferred,
>>>>                      struct urb *urb, unsigned int num_trbs_left)
>>>>    {
>>>>        u32 maxp, total_packet_count;
>>>> +    u32 skip_current_trb = 0;
>>>
>>> A bit of a nitpick but why do we need skip_current_trb? Testing
>>> (xhci->quirks & XHCI_MTK_HOST) twice would make what the code does, and
>>> why, more obvious.
>>>
>> I am not sure which way it is better, so add variable of
>> skip_current_trb to reduce test times.
>
> I can't imagine either approach impacts performance. However introducing skip_current_trb makes the flow of the branches harder to follow.
>
> The first branch was a version check and can remain so; we only need to do something special with the quirks because the MTK controller is 0.97 but with a few bits added:
>
>      /* MTK xHCI is mostly 0.97 but contains some features from 1.0 */
>      if (xhci->hci_version < 0x100 && !(xhci->quirks & XHCI_MTK_HOST))
>          return ...
>
> Setting trb_buff_len to zero is accommodating a quirk and this is clearer when we have:
>
>      /* for MTK xHCI, TD size doesn't include this TRB */
>      if (xhci->quirks & XHCI_MTK_HOST)
>          trb_buff_len = 0;

Both will work, but I'd prefer this solution as well.

-Mathias

WARNING: multiple messages have this Message-ID (diff)
From: Mathias Nyman <mathias.nyman@linux.intel.com>
To: Daniel Thompson <daniel.thompson@linaro.org>,
	chunfeng yun <chunfeng.yun@mediatek.com>
Cc: Mathias Nyman <mathias.nyman@intel.com>,
	Rob Herring <robh+dt@kernel.org>,
	Mark Rutland <mark.rutland@arm.com>,
	Matthias Brugger <matthias.bgg@gmail.com>,
	Felipe Balbi <balbi@ti.com>,
	Sascha Hauer <s.hauer@pengutronix.de>,
	devicetree@vger.kernel.org, linux-kernel@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org,
	Roger Quadros <rogerq@ti.com>,
	linux-usb@vger.kernel.org, linux-mediatek@lists.infradead.org,
	John Crispin <blogic@openwrt.org>,
	Daniel Kurtz <djkurtz@chromium.org>,
	Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>,
	Kishon Vijay Abraham I <kishon@ti.com>,
	Pawel Moll <pawel.moll@arm.com>,
	Ian Campbell <ijc+devicetree@hellion.org.uk>,
	Kumar Gala <galak@codeaurora.org>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Subject: Re: [PATCH v9 4/5] xhci: mediatek: support MTK xHCI host controller
Date: Thu, 08 Oct 2015 16:05:00 +0300	[thread overview]
Message-ID: <561669FC.3030600@linux.intel.com> (raw)
In-Reply-To: <5616616D.3080205@linaro.org>

On 08.10.2015 15:28, Daniel Thompson wrote:
> On 08/10/15 13:05, chunfeng yun wrote:
>> Hi,
>> On Thu, 2015-10-01 at 12:44 +0100, Daniel Thompson wrote:
>>> On 29/09/15 04:01, Chunfeng Yun wrote:
>>>> There some vendor quirks for MTK xhci host controller:
>>>> 1. It defines some extra SW scheduling parameters for HW
>>>>     to minimize the scheduling effort for synchronous and
>>>>     interrupt endpoints. The parameters are put into reseved
>>>>     DWs of slot context and endpoint context.
>>>> 2. Its IMODI unit for Interrupter Moderation register is
>>>>     8 times as much as that defined in xHCI spec.
>>>> 3. Its TDS in  Normal TRB defines a number of packets that
>>>>     remains to be transferred for a TD after processing all
>>>>     Max packets in all previous TRBs.
>>>>
>>>> Signed-off-by: Chunfeng Yun <chunfeng.yun@mediatek.com>
>>>
>>> I've done some basic soak tests, both with a directly attached USB3 HDD
>>> and, given the extra code to manage isochronous xfer, also with a hub,
>>> disc and two audio interfaces.
>>>
>>> Tested-by: Daniel Thompson <daniel.thompson@linaro.org>
>>>
>>>
>>>> diff --git a/drivers/usb/host/xhci-ring.c b/drivers/usb/host/xhci-ring.c
>>>> index 57f40a1..243f696 100644
>>>> --- a/drivers/usb/host/xhci-ring.c
>>>> +++ b/drivers/usb/host/xhci-ring.c
>>>> @@ -68,6 +68,7 @@
>>>>    #include <linux/slab.h>
>>>>    #include "xhci.h"
>>>>    #include "xhci-trace.h"
>>>> +#include "xhci-mtk.h"
>>>>
>>>>    /*
>>>>     * Returns zero if the TRB isn't in this segment, otherwise it returns the DMA
>>>> @@ -3044,18 +3045,27 @@ static u32 xhci_td_remainder(struct xhci_hcd *xhci, int transferred,
>>>>                      struct urb *urb, unsigned int num_trbs_left)
>>>>    {
>>>>        u32 maxp, total_packet_count;
>>>> +    u32 skip_current_trb = 0;
>>>
>>> A bit of a nitpick but why do we need skip_current_trb? Testing
>>> (xhci->quirks & XHCI_MTK_HOST) twice would make what the code does, and
>>> why, more obvious.
>>>
>> I am not sure which way it is better, so add variable of
>> skip_current_trb to reduce test times.
>
> I can't imagine either approach impacts performance. However introducing skip_current_trb makes the flow of the branches harder to follow.
>
> The first branch was a version check and can remain so; we only need to do something special with the quirks because the MTK controller is 0.97 but with a few bits added:
>
>      /* MTK xHCI is mostly 0.97 but contains some features from 1.0 */
>      if (xhci->hci_version < 0x100 && !(xhci->quirks & XHCI_MTK_HOST))
>          return ...
>
> Setting trb_buff_len to zero is accommodating a quirk and this is clearer when we have:
>
>      /* for MTK xHCI, TD size doesn't include this TRB */
>      if (xhci->quirks & XHCI_MTK_HOST)
>          trb_buff_len = 0;

Both will work, but I'd prefer this solution as well.

-Mathias


  parent reply	other threads:[~2015-10-08 13:05 UTC|newest]

Thread overview: 65+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-09-29  3:01 [PATCH v9 0/5] Mediatek xHCI support Chunfeng Yun
2015-09-29  3:01 ` Chunfeng Yun
2015-09-29  3:01 ` Chunfeng Yun
     [not found] ` <1443495698-32233-1-git-send-email-chunfeng.yun-NuS5LvNUpcJWk0Htik3J/w@public.gmane.org>
2015-09-29  3:01   ` [PATCH v9 1/5] dt-bindings: Add usb3.0 phy binding for MT65xx SoCs Chunfeng Yun
2015-09-29  3:01     ` Chunfeng Yun
2015-09-29  3:01     ` Chunfeng Yun
     [not found]     ` <1443495698-32233-2-git-send-email-chunfeng.yun-NuS5LvNUpcJWk0Htik3J/w@public.gmane.org>
2015-09-29 14:43       ` Sergei Shtylyov
2015-09-29 14:43         ` Sergei Shtylyov
2015-09-29 14:43         ` Sergei Shtylyov
     [not found]         ` <560AA37E.2090106-M4DtvfQ/ZS1MRgGoP+s0PdBPR1lH4CV8@public.gmane.org>
2015-10-08 11:27           ` chunfeng yun
2015-10-08 11:27             ` chunfeng yun
2015-10-08 11:27             ` chunfeng yun
2015-09-29  3:01   ` [PATCH v9 5/5] arm64: dts: mediatek: add xHCI & usb phy for mt8173 Chunfeng Yun
2015-09-29  3:01     ` Chunfeng Yun
2015-09-29  3:01     ` Chunfeng Yun
2015-09-29  3:01 ` [PATCH v9 2/5] dt-bindings: Add a binding for Mediatek xHCI host controller Chunfeng Yun
2015-09-29  3:01   ` Chunfeng Yun
2015-09-29  3:01   ` Chunfeng Yun
     [not found]   ` <1443495698-32233-3-git-send-email-chunfeng.yun-NuS5LvNUpcJWk0Htik3J/w@public.gmane.org>
2015-09-29 14:49     ` Sergei Shtylyov
2015-09-29 14:49       ` Sergei Shtylyov
2015-09-29 14:49       ` Sergei Shtylyov
2015-10-08 11:37       ` chunfeng yun
2015-10-08 11:37         ` chunfeng yun
2015-10-08 11:37         ` chunfeng yun
2015-09-29  3:01 ` [PATCH v9 3/5] phy: add usb3.0 phy driver for mt65xx SoCs Chunfeng Yun
2015-09-29  3:01   ` Chunfeng Yun
2015-09-29  3:01   ` Chunfeng Yun
     [not found]   ` <1443495698-32233-4-git-send-email-chunfeng.yun-NuS5LvNUpcJWk0Htik3J/w@public.gmane.org>
2015-10-06 14:20     ` Kishon Vijay Abraham I
2015-10-06 14:20       ` Kishon Vijay Abraham I
2015-10-06 14:20       ` Kishon Vijay Abraham I
2015-10-08 11:45       ` chunfeng yun
2015-10-08 11:45         ` chunfeng yun
2015-10-08 11:45         ` chunfeng yun
2015-09-29  3:01 ` [PATCH v9 4/5] xhci: mediatek: support MTK xHCI host controller Chunfeng Yun
2015-09-29  3:01   ` Chunfeng Yun
2015-09-29  3:01   ` Chunfeng Yun
     [not found]   ` <1443495698-32233-5-git-send-email-chunfeng.yun-NuS5LvNUpcJWk0Htik3J/w@public.gmane.org>
2015-10-01 11:44     ` Daniel Thompson
2015-10-01 11:44       ` Daniel Thompson
2015-10-01 11:44       ` Daniel Thompson
2015-10-08 12:05       ` chunfeng yun
2015-10-08 12:05         ` chunfeng yun
2015-10-08 12:05         ` chunfeng yun
2015-10-08 12:28         ` Daniel Thompson
2015-10-08 12:28           ` Daniel Thompson
     [not found]           ` <5616616D.3080205-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
2015-10-08 13:05             ` Mathias Nyman [this message]
2015-10-08 13:05               ` Mathias Nyman
2015-10-08 13:05               ` Mathias Nyman
2015-10-08 14:42               ` chunfeng yun
2015-10-08 14:42                 ` chunfeng yun
2015-10-08 14:42                 ` chunfeng yun
2015-10-08 14:38             ` chunfeng yun
2015-10-08 14:38               ` chunfeng yun
2015-10-08 14:38               ` chunfeng yun
2015-10-15 14:46   ` Mathias Nyman
2015-10-15 14:46     ` Mathias Nyman
     [not found]     ` <561FBC40.7020100-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>
2015-10-18  1:25       ` chunfeng yun
2015-10-18  1:25         ` chunfeng yun
2015-10-18  1:25         ` chunfeng yun
2015-10-19 11:25         ` Mathias Nyman
2015-10-19 11:25           ` Mathias Nyman
     [not found]           ` <5624D33D.5090807-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
2015-10-20  6:29             ` chunfeng yun
2015-10-20  6:29               ` chunfeng yun
2015-10-20  6:29               ` chunfeng yun
2015-10-20  8:25               ` Mathias Nyman
2015-10-20  8:25                 ` Mathias Nyman

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=561669FC.3030600@linux.intel.com \
    --to=mathias.nyman-vuqaysv1563yd54fqh9/ca@public.gmane.org \
    --cc=balbi-l0cyMroinI0@public.gmane.org \
    --cc=blogic-p3rKhJxN3npAfugRpC6u6w@public.gmane.org \
    --cc=chunfeng.yun-NuS5LvNUpcJWk0Htik3J/w@public.gmane.org \
    --cc=daniel.thompson-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org \
    --cc=devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=djkurtz-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org \
    --cc=galak-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org \
    --cc=gregkh-hQyY1W1yCW8ekmWlsbkhG0B+6BGkLq7r@public.gmane.org \
    --cc=ijc+devicetree-KcIKpvwj1kUDXYZnReoRVg@public.gmane.org \
    --cc=kishon-l0cyMroinI0@public.gmane.org \
    --cc=linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org \
    --cc=linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=linux-mediatek-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org \
    --cc=linux-usb-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=mark.rutland-5wv7dgnIgG8@public.gmane.org \
    --cc=mathias.nyman-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org \
    --cc=matthias.bgg-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
    --cc=pawel.moll-5wv7dgnIgG8@public.gmane.org \
    --cc=robh+dt-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org \
    --cc=rogerq-l0cyMroinI0@public.gmane.org \
    --cc=s.hauer-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org \
    --cc=sergei.shtylyov-M4DtvfQ/ZS1MRgGoP+s0PdBPR1lH4CV8@public.gmane.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.