Skip to contentSkip to conversation

usb: dwc2: host: Fix ahbcfg for rk3066

PATCH In review Douglas Anderson 4 participants 4 messages Oct 20, 2015 – Oct 30, 2015

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 usb: dwc2: host: Fix ahbcfg for rk3066

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.

---
 drivers/usb/dwc2/platform.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/usb/dwc2/platform.c +2 -1
index 5859b0f..e61d773 100644
@@ -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,
Signature · 1 line
2.6.0.rc2.230.g3dd15c0
maintainer Tested-by on v1 1/1
#1 lore raw

Am Dienstag, 20. Oktober 2015, 16:33:53 schrieb Douglas Anderson:

Quoted 12 lines

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

Quoted 8 lines
    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.

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

Acked-by on v1 1/1
#2 lore raw
In reply to Douglas Anderson
Quoted 30 lines · 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.

---
 drivers/usb/dwc2/platform.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/usb/dwc2/platform.c +0 -0
index 5859b0f..e61d773 100644

drivers/usb/dwc2/platform.c static const struct dwc2_core_params params_rk3066 = { · line 115

Quoted 9 lines
drivers/usb/dwc2/platform.c +2 -1
@@ -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,

John

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html

Reviewed-by on v1 1/1
#3 lore raw
In reply to Douglas Anderson
Quoted 29 lines · 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.

---
  drivers/usb/dwc2/platform.c | 3 ++-
  1 file changed, 2 insertions(+), 1 deletion(-)
drivers/usb/dwc2/platform.c +0 -0
index 5859b0f..e61d773 100644

drivers/usb/dwc2/platform.c static const struct dwc2_core_params params_rk3066 = { · line 115

Quoted 9 lines
drivers/usb/dwc2/platform.c +2 -1
@@ -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,