linux-rockchip.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] usb: dwc2: host: Fix ahbcfg for rk3066
@ 2015-10-20 23:33 Douglas Anderson
       [not found] ` <1445384033-17050-1-git-send-email-dianders-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org>
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Douglas Anderson @ 2015-10-20 23:33 UTC (permalink / raw)
  To: John Youn, balbi
  Cc: Wu Liang Feng, Yunzhi Li, Heiko Stübner, linux-rockchip,
	Julius Werner, Douglas Anderson, johnyoun, gregkh, linux-usb,
	linux-kernel

The comment for ahbcfg for rk3066 parameters (also used for rk3288)
claimed that ahbcfg was INCR16, but it wasn't.  Since the bits weren't
shifted properly, the 0x7 ended up being masked and we ended up
programming 0x3 for the HBstLen.  Let's set it to INCR16 properly.

As per Wu Liang Feng at Rockchip this may increase transmission
efficiency.  I did blackbox tests with writing 0s to a USB-based SD
reader (forcefully capping CPU Freq to try to measure efficiency):
  cd /sys/devices/system/cpu/cpu0/cpufreq
  echo userspace > scaling_governor
  echo 126000 > scaling_setspeed
  for i in $(seq 10); do
    dd if=/dev/zero of=/dev/sdb bs=1M count=750
  done

With the above tests I found that speeds went from ~15MB/s to ~18MB/s.
Note that most other tests I did (including reading from the same USB
reader) didn't show any difference in performance.

Signed-off-by: Douglas Anderson <dianders@chromium.org>
---
 drivers/usb/dwc2/platform.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/usb/dwc2/platform.c b/drivers/usb/dwc2/platform.c
index 5859b0f..e61d773 100644
--- a/drivers/usb/dwc2/platform.c
+++ b/drivers/usb/dwc2/platform.c
@@ -108,7 +108,8 @@ static const struct dwc2_core_params params_rk3066 = {
 	.host_ls_low_power_phy_clk	= -1,
 	.ts_dline			= -1,
 	.reload_ctl			= -1,
-	.ahbcfg				= 0x7, /* INCR16 */
+	.ahbcfg				= GAHBCFG_HBSTLEN_INCR16 <<
+					  GAHBCFG_HBSTLEN_SHIFT,
 	.uframe_sched			= -1,
 	.external_id_pin_ctl		= -1,
 	.hibernation			= -1,
-- 
2.6.0.rc2.230.g3dd15c0

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] usb: dwc2: host: Fix ahbcfg for rk3066
       [not found] ` <1445384033-17050-1-git-send-email-dianders-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org>
@ 2015-10-24 13:08   ` Heiko Stübner
  0 siblings, 0 replies; 4+ messages in thread
From: Heiko Stübner @ 2015-10-24 13:08 UTC (permalink / raw)
  To: Douglas Anderson
  Cc: johnyoun-HKixBCOQz3hWk0Htik3J/w,
	gregkh-hQyY1W1yCW8ekmWlsbkhG0B+6BGkLq7r,
	linux-usb-u79uwXL29TY76Z2rM5mHXA,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA, balbi-l0cyMroinI0, John Youn,
	linux-rockchip-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r, Yunzhi Li,
	Julius Werner, Wu Liang Feng

Am Dienstag, 20. Oktober 2015, 16:33:53 schrieb Douglas Anderson:
> The comment for ahbcfg for rk3066 parameters (also used for rk3288)
> claimed that ahbcfg was INCR16, but it wasn't.  Since the bits weren't
> shifted properly, the 0x7 ended up being masked and we ended up
> programming 0x3 for the HBstLen.  Let's set it to INCR16 properly.
> 
> As per Wu Liang Feng at Rockchip this may increase transmission
> efficiency.  I did blackbox tests with writing 0s to a USB-based SD
> reader (forcefully capping CPU Freq to try to measure efficiency):
>   cd /sys/devices/system/cpu/cpu0/cpufreq
>   echo userspace > scaling_governor
>   echo 126000 > scaling_setspeed
>   for i in $(seq 10); do
>     dd if=/dev/zero of=/dev/sdb bs=1M count=750
>   done
> 
> With the above tests I found that speeds went from ~15MB/s to ~18MB/s.
> Note that most other tests I did (including reading from the same USB
> reader) didn't show any difference in performance.
> 
> Signed-off-by: Douglas Anderson <dianders-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org>

I gave this a spin on a rk3288-firefly, runs fine and doesn't have any 
negative effects, so

Tested-by: Heiko Stuebner <heiko-4mtYJXux2i+zQB+pC5nmwQ@public.gmane.org>

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] usb: dwc2: host: Fix ahbcfg for rk3066
  2015-10-20 23:33 [PATCH] usb: dwc2: host: Fix ahbcfg for rk3066 Douglas Anderson
       [not found] ` <1445384033-17050-1-git-send-email-dianders-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org>
@ 2015-10-26 22:57 ` John Youn
  2015-10-30  8:08 ` Liangfeng Wu
  2 siblings, 0 replies; 4+ messages in thread
From: John Youn @ 2015-10-26 22:57 UTC (permalink / raw)
  To: Douglas Anderson, John Youn, balbi-l0cyMroinI0@public.gmane.org
  Cc: Wu Liang Feng, Yunzhi Li, Heiko Stübner,
	linux-rockchip-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org,
	Julius Werner,
	gregkh-hQyY1W1yCW8ekmWlsbkhG0B+6BGkLq7r@public.gmane.org,
	linux-usb-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org

On 10/20/2015 4:35 PM, Douglas Anderson wrote:
> The comment for ahbcfg for rk3066 parameters (also used for rk3288)
> claimed that ahbcfg was INCR16, but it wasn't.  Since the bits weren't
> shifted properly, the 0x7 ended up being masked and we ended up
> programming 0x3 for the HBstLen.  Let's set it to INCR16 properly.
> 
> As per Wu Liang Feng at Rockchip this may increase transmission
> efficiency.  I did blackbox tests with writing 0s to a USB-based SD
> reader (forcefully capping CPU Freq to try to measure efficiency):
>   cd /sys/devices/system/cpu/cpu0/cpufreq
>   echo userspace > scaling_governor
>   echo 126000 > scaling_setspeed
>   for i in $(seq 10); do
>     dd if=/dev/zero of=/dev/sdb bs=1M count=750
>   done
> 
> With the above tests I found that speeds went from ~15MB/s to ~18MB/s.
> Note that most other tests I did (including reading from the same USB
> reader) didn't show any difference in performance.
> 
> Signed-off-by: Douglas Anderson <dianders-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org>
> ---
>  drivers/usb/dwc2/platform.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/usb/dwc2/platform.c b/drivers/usb/dwc2/platform.c
> index 5859b0f..e61d773 100644
> --- a/drivers/usb/dwc2/platform.c
> +++ b/drivers/usb/dwc2/platform.c
> @@ -108,7 +108,8 @@ static const struct dwc2_core_params params_rk3066 = {
>  	.host_ls_low_power_phy_clk	= -1,
>  	.ts_dline			= -1,
>  	.reload_ctl			= -1,
> -	.ahbcfg				= 0x7, /* INCR16 */
> +	.ahbcfg				= GAHBCFG_HBSTLEN_INCR16 <<
> +					  GAHBCFG_HBSTLEN_SHIFT,
>  	.uframe_sched			= -1,
>  	.external_id_pin_ctl		= -1,
>  	.hibernation			= -1,
> 


Acked-by: John Youn <johnyoun-HKixBCOQz3hWk0Htik3J/w@public.gmane.org>


John

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

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] usb: dwc2: host: Fix ahbcfg for rk3066
  2015-10-20 23:33 [PATCH] usb: dwc2: host: Fix ahbcfg for rk3066 Douglas Anderson
       [not found] ` <1445384033-17050-1-git-send-email-dianders-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org>
  2015-10-26 22:57 ` John Youn
@ 2015-10-30  8:08 ` Liangfeng Wu
  2 siblings, 0 replies; 4+ messages in thread
From: Liangfeng Wu @ 2015-10-30  8:08 UTC (permalink / raw)
  To: Douglas Anderson, John Youn, balbi
  Cc: Yunzhi Li, Heiko Stübner, linux-rockchip, Julius Werner,
	johnyoun, gregkh, linux-usb, linux-kernel

On 10/21/2015 07:33 AM, Douglas Anderson wrote:
> The comment for ahbcfg for rk3066 parameters (also used for rk3288)
> claimed that ahbcfg was INCR16, but it wasn't.  Since the bits weren't
> shifted properly, the 0x7 ended up being masked and we ended up
> programming 0x3 for the HBstLen.  Let's set it to INCR16 properly.
>
> As per Wu Liang Feng at Rockchip this may increase transmission
> efficiency.  I did blackbox tests with writing 0s to a USB-based SD
> reader (forcefully capping CPU Freq to try to measure efficiency):
>    cd /sys/devices/system/cpu/cpu0/cpufreq
>    echo userspace > scaling_governor
>    echo 126000 > scaling_setspeed
>    for i in $(seq 10); do
>      dd if=/dev/zero of=/dev/sdb bs=1M count=750
>    done
>
> With the above tests I found that speeds went from ~15MB/s to ~18MB/s.
> Note that most other tests I did (including reading from the same USB
> reader) didn't show any difference in performance.
>
> Signed-off-by: Douglas Anderson <dianders@chromium.org>
> ---
>   drivers/usb/dwc2/platform.c | 3 ++-
>   1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/usb/dwc2/platform.c b/drivers/usb/dwc2/platform.c
> index 5859b0f..e61d773 100644
> --- a/drivers/usb/dwc2/platform.c
> +++ b/drivers/usb/dwc2/platform.c
> @@ -108,7 +108,8 @@ static const struct dwc2_core_params params_rk3066 = {
>   	.host_ls_low_power_phy_clk	= -1,
>   	.ts_dline			= -1,
>   	.reload_ctl			= -1,
> -	.ahbcfg				= 0x7, /* INCR16 */
> +	.ahbcfg				= GAHBCFG_HBSTLEN_INCR16 <<
> +					  GAHBCFG_HBSTLEN_SHIFT,
>   	.uframe_sched			= -1,
>   	.external_id_pin_ctl		= -1,
>   	.hibernation			= -1,

Reviewed-by:  Liangfeng Wu <wulf@rock-chips.com>

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2015-10-30  8:08 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-10-20 23:33 [PATCH] usb: dwc2: host: Fix ahbcfg for rk3066 Douglas Anderson
     [not found] ` <1445384033-17050-1-git-send-email-dianders-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org>
2015-10-24 13:08   ` Heiko Stübner
2015-10-26 22:57 ` John Youn
2015-10-30  8:08 ` Liangfeng Wu

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).