linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 00/12] USB: chipidea: patchset for performance improvement
@ 2015-03-19  1:19 Peter Chen
  2015-03-19  1:19 ` [PATCH 01/12] Doc: usb: ci-hdrc-imx: add gadget-itc-setting for binding doc Peter Chen
                   ` (13 more replies)
  0 siblings, 14 replies; 20+ messages in thread
From: Peter Chen @ 2015-03-19  1:19 UTC (permalink / raw)
  To: linux-arm-kernel

Hi all,

In this patch set, I add some interfaces for tuning the performance
of chipidea usb driver. With this set, the USB performance can be improved
at some user cases with suitable parameters. The main changes:

- Interface to tune interrupt threshold control, and set
'Immediate' for default value
- The glue layer can disable stream mode according to USB role
- Interface to tune AHB burst configuration at SBUSCFG
- Interface to tune tx/rx burst size
- i.mx changes for achieving better performance, it can reduce
  the latecy between bus and USB FIFO, and reduce the overrun
  and underrun occurrences, it is useful for the system bus is busy.
  we see great improvement for ISO transfer, eg, high resolution
  USB camera when the bus is busy.

Below are some test results at imx6sx sdb board
(set ehci_hcd.park=3 at bootargs), the tests are done
at v4.0 kernel, no other bus loading during the tests,
so we have not seen performance change for some use cases.

USB Mass Storage (Host mode)
With Patch Set		Without Patch Set
R: 26.9 MB/s		27 MB/s
W: 25.2 MB/s		24.5 MB/s

1G USB Ethernet Card
With Patch Set		Without Patch Set
TX: 186 Mb/s		185 Mb/s
RX: 219 Mb/s		216 Mb/s

g_ncm (Device Mode)
With Patch Set		Without Patch Set
TX: 166MB/s		163MB/s
RX: 230MB/s		184MB/s

Peter Chen (12):
  Doc: usb: ci-hdrc-imx: add gadget-itc-setting for binding doc
  usb: chipidea: set ITC to 0 for device mode
  usb: chipidea: define stream mode disable for both roles
  usb: chipidea: imx: add stream mode enable for device mode at
    imx6sl/imx6sx
  usb: chipidea: introduce ci_platform_config
  Doc: usb: ci-hdrc-imx: add ahb-burst-config for binding doc
  ARM: imx6: set ahb-burst-config as 0 for USB
  usb: chipidea: add ahb burst configuration
  usb: chipidea: usbmisc_imx: add unburst setting for imx6
  Doc: usb: ci-hdrc-imx: add tx(rx)-burst-config-dword for binding doc
  ARM: imx6: change default burst size for USB
  usb: chipidea: add burst size configuration interface

 .../devicetree/bindings/usb/ci-hdrc-imx.txt        |  12 +++
 arch/arm/boot/dts/imx6qdl.dtsi                     |  12 +++
 arch/arm/boot/dts/imx6sl.dtsi                      |   9 ++
 arch/arm/boot/dts/imx6sx.dtsi                      |   9 ++
 drivers/usb/chipidea/bits.h                        |   7 ++
 drivers/usb/chipidea/ci.h                          |   3 +
 drivers/usb/chipidea/ci_hdrc_imx.c                 |  14 ++-
 drivers/usb/chipidea/core.c                        | 119 +++++++++++++++++++--
 drivers/usb/chipidea/host.c                        |   6 +-
 drivers/usb/chipidea/usbmisc_imx.c                 |  12 ++-
 include/linux/usb/chipidea.h                       |  11 +-
 11 files changed, 191 insertions(+), 23 deletions(-)

-- 
1.9.1

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

* [PATCH 01/12] Doc: usb: ci-hdrc-imx: add gadget-itc-setting for binding doc
  2015-03-19  1:19 [PATCH 00/12] USB: chipidea: patchset for performance improvement Peter Chen
@ 2015-03-19  1:19 ` Peter Chen
  2015-03-19  1:19 ` [PATCH 02/12] usb: chipidea: set ITC to 0 for device mode Peter Chen
                   ` (12 subsequent siblings)
  13 siblings, 0 replies; 20+ messages in thread
From: Peter Chen @ 2015-03-19  1:19 UTC (permalink / raw)
  To: linux-arm-kernel

It is used to configure the ITC (in register USBCMD) value
for gadget mode.

Signed-off-by: Peter Chen <peter.chen@freescale.com>
---
 Documentation/devicetree/bindings/usb/ci-hdrc-imx.txt | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/Documentation/devicetree/bindings/usb/ci-hdrc-imx.txt b/Documentation/devicetree/bindings/usb/ci-hdrc-imx.txt
index 38a5480..c21171e 100644
--- a/Documentation/devicetree/bindings/usb/ci-hdrc-imx.txt
+++ b/Documentation/devicetree/bindings/usb/ci-hdrc-imx.txt
@@ -20,6 +20,8 @@ Optional properties:
 - external-vbus-divider: enables off-chip resistor divider for Vbus
 - maximum-speed: limit the maximum connection speed to "full-speed".
 - tpl-support: TPL (Targeted Peripheral List) feature for targeted hosts
+- gadget-itc-setting: the ITC setting for gadget, the required value
+  should be aligned with ITC bits at register USBCMD.
 
 Examples:
 usb at 02184000 { /* USB OTG */
@@ -32,4 +34,5 @@ usb at 02184000 { /* USB OTG */
 	external-vbus-divider;
 	maximum-speed = "full-speed";
 	tpl-support;
+	gadget-itc-setting = <0x4>; /* 4 micro-frames */
 };
-- 
1.9.1

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

* [PATCH 02/12] usb: chipidea: set ITC to 0 for device mode
  2015-03-19  1:19 [PATCH 00/12] USB: chipidea: patchset for performance improvement Peter Chen
  2015-03-19  1:19 ` [PATCH 01/12] Doc: usb: ci-hdrc-imx: add gadget-itc-setting for binding doc Peter Chen
@ 2015-03-19  1:19 ` Peter Chen
  2015-03-19  1:19 ` [PATCH 03/12] usb: chipidea: define stream mode disable for both roles Peter Chen
                   ` (11 subsequent siblings)
  13 siblings, 0 replies; 20+ messages in thread
From: Peter Chen @ 2015-03-19  1:19 UTC (permalink / raw)
  To: linux-arm-kernel

ITC (Interrupt Threshold Control) is used to set the maximum rate at which
the host/device controller will issue interrupts. The default value is 8 (1ms)
for it. EHCI core will modify it to 1, but device mode keeps it as default
value.

In some use cases like Android ADB, it only has one usb request for each
direction, and maximum payload data is only 4KB, so the speed is 4MB/s
at most, it needs controller to trigger interrupt as fast as possible
to increase the speed. The USB performance will be better if the interrupt
can be triggered faster.

Reduce ITC value is benefit for USB performance, and the interrupt number
is increased at the same time, it may increase cpu utilization too.
Most of use case cares about performance, but some may care about
cpu utilization, so, we leave a platform interface for user.
We set ITC as 0 (immediate) as default value.

Signed-off-by: Peter Chen <peter.chen@freescale.com>
---
 drivers/usb/chipidea/core.c  | 19 +++++++++++++++++++
 include/linux/usb/chipidea.h |  2 ++
 2 files changed, 21 insertions(+)

diff --git a/drivers/usb/chipidea/core.c b/drivers/usb/chipidea/core.c
index 74fea4f..8af9cbf 100644
--- a/drivers/usb/chipidea/core.c
+++ b/drivers/usb/chipidea/core.c
@@ -463,6 +463,13 @@ int hw_device_reset(struct ci_hdrc *ci)
 	/* HW >= 2.3 */
 	hw_write(ci, OP_USBMODE, USBMODE_SLOM, USBMODE_SLOM);
 
+	/*
+	 * Set interrupt interval for device mode
+	 * host set ITC according to ehci-hcd module parameter log2_irq_thresh
+	 */
+	hw_write(ci, OP_USBCMD, 0xff0000,
+		ci->platdata->gadget_itc_setting << 16);
+
 	if (hw_read(ci, OP_USBMODE, USBMODE_CM) != USBMODE_CM_DC) {
 		pr_err("cannot enter in %s device mode", ci_role(ci)->name);
 		pr_err("lpm = %i", ci->hw_bank.lpm);
@@ -560,6 +567,8 @@ static irqreturn_t ci_irq(int irq, void *data)
 static int ci_get_platdata(struct device *dev,
 		struct ci_hdrc_platform_data *platdata)
 {
+	int ret;
+
 	if (!platdata->phy_mode)
 		platdata->phy_mode = of_usb_get_phy_mode(dev->of_node);
 
@@ -591,6 +600,16 @@ static int ci_get_platdata(struct device *dev,
 	if (of_usb_get_maximum_speed(dev->of_node) == USB_SPEED_FULL)
 		platdata->flags |= CI_HDRC_FORCE_FULLSPEED;
 
+	if (of_find_property(dev->of_node, "gadget-itc-setting", NULL)) {
+		ret = of_property_read_u32(dev->of_node, "gadget-itc-setting",
+			&platdata->gadget_itc_setting);
+		if (ret) {
+			dev_err(dev,
+				"failed to get gadget-itc-setting value\n");
+			return ret;
+		}
+	}
+
 	return 0;
 }
 
diff --git a/include/linux/usb/chipidea.h b/include/linux/usb/chipidea.h
index ab94f78..e69d829 100644
--- a/include/linux/usb/chipidea.h
+++ b/include/linux/usb/chipidea.h
@@ -35,6 +35,8 @@ struct ci_hdrc_platform_data {
 	void	(*notify_event) (struct ci_hdrc *ci, unsigned event);
 	struct regulator	*reg_vbus;
 	bool			tpl_support;
+	/* interrupt threshold value for gadget */
+	u32			gadget_itc_setting;
 };
 
 /* Default offset of capability registers */
-- 
1.9.1

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

* [PATCH 03/12] usb: chipidea: define stream mode disable for both roles
  2015-03-19  1:19 [PATCH 00/12] USB: chipidea: patchset for performance improvement Peter Chen
  2015-03-19  1:19 ` [PATCH 01/12] Doc: usb: ci-hdrc-imx: add gadget-itc-setting for binding doc Peter Chen
  2015-03-19  1:19 ` [PATCH 02/12] usb: chipidea: set ITC to 0 for device mode Peter Chen
@ 2015-03-19  1:19 ` Peter Chen
  2015-03-19  1:19 ` [PATCH 04/12] usb: chipidea: imx: add stream mode enable for device mode at imx6sl/imx6sx Peter Chen
                   ` (10 subsequent siblings)
  13 siblings, 0 replies; 20+ messages in thread
From: Peter Chen @ 2015-03-19  1:19 UTC (permalink / raw)
  To: linux-arm-kernel

The chipidea IP has different limitations for host and device mode,
see below errata, we may need to enable SDIS(Stream Disable Mode)
at host mode. But we don't want it at device mode at some situations.

TAR 9000378958
Title: Non-Double Word Aligned Buffer Address Sometimes Causes Host to Hang on OUT Retry
Impacted Configuration: Host mode, all transfer types
Description:
The host core operating in streaming mode may under run while sending the data packet of an OUT transaction. This under run can occur if there are unexpected system delays in fetching the remaining packet data from memory. The host forces a bad CRC on the packet, the device detects the error and discards the packet. The host then retries a Bulk, Interrupt, or Control transfer if an under run occurs according to the USB specification.
During simulations, it was found that the host does not issue the retry of the failed bulk OUT. It does not issue any other transactions except SOF packets that have incorrect frame numbers.
The second failure mode occurs if the under run occurs on an ISO OUT transaction and the next ISO transaction is a zero byte packet. The host does not issue any transactions (including SOFs). The device detects a Suspend condition, reverts to full speed, and waits for resume signaling.
A third failure mode occurs when the host under runs on an ISO OUT and the next ISO in the schedule is an ISO OUT with two max packets of 1024 bytes each.
The host should issue MDATA for the first OUT followed by DATA1 for the second. However, it drops the MDATA transaction, and issues the DATA1 transaction.
The system impact of this bug is the same regardless of the failure mode observed. The host core hangs, the ehci_ctrl state machine waits for the protocol engine to send the completion status for the corrupted transaction, which never occurs. No indication is sent to the host controller driver, no register bits change and no interrupts occur. Eventually the requesting application times out.
Detailed internal behavior:
The EHCI control state machine (ehci_ctrl) in the DMA block is responsible for parsing the schedules and initiating all transactions. The ehci_ctrl state machine passes the transaction details to the protocol block by writing the transaction information in to the TxFIFO. It then asserts the pe_hst_run_pkt signal to inform the host protocol state machine (pe_hst_state) that there is a packet in the TxFIFO.
A tag of 0x0 indicates a start of packet with the data providing the following information:

35:32 Tag
31:30 Reserved
29:23 Endpoint (lowest 4 bits)
22:16 Address
15:10 Reserved
9:8 Endpoint speed
7:6 Endpoint type
5:6 Data Toggle
3:0 PID
The pe_hst_state reads the packet information and constructs the packet and issues it to the PHY interface.
The ehci_ctrl state machine writes the start transaction information in to the TxFIFO as 0x03002910c for the OUT packet that had the under run error. However, it writes 0xC3002910C for the retry of the Out transaction, which is incorrect.
The pe_hst_state enters a bus timeout state after sending the bad CRC for the packet that under ran. It then purges any data that was back filled in to the TxFIFO for the packet that under ran. The pe_hst_state machine stops purging the TxFIFO when it is empty or if it reads a location that has a tag of 0x0, indicating a start of packet command.
The pe_hst_state reads 0xC3002910C and discards it as it does not decode to a start of packet command. It continues to purge the OUT data that has been pre-buffered for the OUT retry . The pe_hst_state detects the hst_packet_run signal and attempts to read the PID and address information from the TxFIFO. This location has packet data and so does not decode to a valid PID and so falls through to the PE_HST_SOF_LOAD state where the frame_num_counter is updated. The frame_num_counter is updated with the data in the TxFIFO. In this case, the data is incorrect as the ehci_ctrl state machine did not initiate the load. The hst_pe_state machine detects the SOF request signal and sends an SOF with the bad frame number. Meanwhile, the ehci_ctrl state machine waits indefinitely in the run_pkt state waiting for the completion status from pe_hst_state machine, which will never happen.
The ISO failure case is similar except that there is no retry for ISO. The ehci_ctrl state machine moves to the next transfer in the periodic schedule. If the under run occurs on the last entry of the periodic list then it moves to the Async schedule.
In the case of ISO OUT simulations, the next ISO is a zero byte OUT and again the start of packet command gets corrupted. The TxFIFO is empty when the hst_pe_state attempts to read the Address and PID information as the transaction is a zero byte packet. This results in the hst_pe_state machine staying in the GET_PID state, which means that it does not issue any transactions (including SOFs). The device detects a Suspend condition and reverts to full speed mode and waits for a Resume or Reset signal.
The EHCI specification allows a Non-DoubleWord (32 bits) offset to be used as a current offset for Buffer Pointer Page 0 of the qTD. In Non-DoubleWord aligned cases, the core reads the packet data from the AHB memory, performs the alignment operation before writing it in to the TxFIFO as a 32 bit data word. An End Of Packet tag (EOP) is written to the TxFIFO after all the packet data has been written in to the TxFIFO. The alignment function is reset to Idle by the EOP tag. The corruption of the start of packet command arises because the packet buffer for the OUT transaction that under ran is not aligned to a DoubleWord, and hence no EOP tag is written to the TxFIFO. The alignment function is still active when the start packet information is written in to the TxFIFO for the retry of the bulk packet or for the next transaction in the case of an under run on an ISO. This results in the corruption of the start tag and the transaction information.
Click for waveform showing the command 0x 0000300291 being written in to the TX FIFO for the Out that under ran.
Click for waveform showing the command 0xC3002910C written to the TxFIFO instead of 0x 0000300291
Versions affected: Versions 2.10a and previous versions
How discovered: Customer simulation
Workaround:
1- The EHCI specification allows a non-DoubleWord offset to be used as a current offset for Buffer Pointer Page 0 of the qTD. However, if a DoubleWord offset is used then this issue does not arise.
2- Use non streaming mode to eliminate under runs.
Resolution:
The fix involves changes to the traffic state machine in the vusb_hs_dma_traf block. The ehci_ctrl state machine updates the context information by encoding the transaction results on the hst_op_context_update signals at the end of a transaction. The signal hst_op_context_update is added to the traffic state machine, and the tx_fifo_under_ran_r signal is generated if the transaction results in an under run error. Click for waveform
The traffic state machine then traverses to the do_eop states if the tx_fifo_under_ran error is asserted. Thus an EOP tag is written in to the TxFIFO as shown in this waveform .
The EOP tag resets the align state machine to the Idle state ensuring that the next command written by the echi_ctrl state machine does not get corrupted.
File(s) modified:
RTL code fixed: ?..
Method of reproducing: This failure cannot be reproduced in the current test bench.
Date Found: March 2010
Date Fixed: June 2010
Update information:
Added the RTL code fix

Signed-off-by: Peter Chen <peter.chen@freescale.com>
---
 drivers/usb/chipidea/core.c  | 2 +-
 drivers/usb/chipidea/host.c  | 6 +++---
 include/linux/usb/chipidea.h | 5 ++++-
 3 files changed, 8 insertions(+), 5 deletions(-)

diff --git a/drivers/usb/chipidea/core.c b/drivers/usb/chipidea/core.c
index 8af9cbf..4d79392 100644
--- a/drivers/usb/chipidea/core.c
+++ b/drivers/usb/chipidea/core.c
@@ -447,7 +447,7 @@ int hw_device_reset(struct ci_hdrc *ci)
 		ci->platdata->notify_event(ci,
 			CI_HDRC_CONTROLLER_RESET_EVENT);
 
-	if (ci->platdata->flags & CI_HDRC_DISABLE_STREAMING)
+	if (ci->platdata->flags & CI_HDRC_DISABLE_DEVICE_STREAMING)
 		hw_write(ci, OP_USBMODE, USBMODE_CI_SDIS, USBMODE_CI_SDIS);
 
 	if (ci->platdata->flags & CI_HDRC_FORCE_FULLSPEED) {
diff --git a/drivers/usb/chipidea/host.c b/drivers/usb/chipidea/host.c
index 21fe1a3..b262c1c 100644
--- a/drivers/usb/chipidea/host.c
+++ b/drivers/usb/chipidea/host.c
@@ -141,12 +141,12 @@ static int host_start(struct ci_hdrc *ci)
 		}
 	}
 
-	if (ci->platdata->flags & CI_HDRC_DISABLE_STREAMING)
-		hw_write(ci, OP_USBMODE, USBMODE_CI_SDIS, USBMODE_CI_SDIS);
-
 	if (ci->platdata->flags & CI_HDRC_FORCE_FULLSPEED)
 		hw_write(ci, OP_PORTSC, PORTSC_PFSC, PORTSC_PFSC);
 
+	if (ci->platdata->flags & CI_HDRC_DISABLE_HOST_STREAMING)
+		hw_write(ci, OP_USBMODE, USBMODE_CI_SDIS, USBMODE_CI_SDIS);
+
 	return ret;
 
 disable_reg:
diff --git a/include/linux/usb/chipidea.h b/include/linux/usb/chipidea.h
index e69d829..d3906a4 100644
--- a/include/linux/usb/chipidea.h
+++ b/include/linux/usb/chipidea.h
@@ -20,7 +20,6 @@ struct ci_hdrc_platform_data {
 	unsigned long	 flags;
 #define CI_HDRC_REGS_SHARED		BIT(0)
 #define CI_HDRC_SUPPORTS_RUNTIME_PM	BIT(2)
-#define CI_HDRC_DISABLE_STREAMING	BIT(3)
 	/*
 	 * Only set it when DCCPARAMS.DC==1 and DCCPARAMS.HC==1,
 	 * but otg is not supported (no register otgsc).
@@ -29,6 +28,10 @@ struct ci_hdrc_platform_data {
 #define CI_HDRC_IMX28_WRITE_FIX		BIT(5)
 #define CI_HDRC_FORCE_FULLSPEED		BIT(6)
 #define CI_HDRC_TURN_VBUS_EARLY_ON	BIT(7)
+#define CI_HDRC_DISABLE_DEVICE_STREAMING	BIT(8)
+#define CI_HDRC_DISABLE_HOST_STREAMING		BIT(9)
+#define CI_HDRC_DISABLE_STREAMING (CI_HDRC_DISABLE_DEVICE_STREAMING |	\
+		CI_HDRC_DISABLE_HOST_STREAMING)
 	enum usb_dr_mode	dr_mode;
 #define CI_HDRC_CONTROLLER_RESET_EVENT		0
 #define CI_HDRC_CONTROLLER_STOPPED_EVENT	1
-- 
1.9.1

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

* [PATCH 04/12] usb: chipidea: imx: add stream mode enable for device mode at imx6sl/imx6sx
  2015-03-19  1:19 [PATCH 00/12] USB: chipidea: patchset for performance improvement Peter Chen
                   ` (2 preceding siblings ...)
  2015-03-19  1:19 ` [PATCH 03/12] usb: chipidea: define stream mode disable for both roles Peter Chen
@ 2015-03-19  1:19 ` Peter Chen
  2015-03-19  1:19 ` [PATCH 05/12] usb: chipidea: introduce ci_platform_config Peter Chen
                   ` (9 subsequent siblings)
  13 siblings, 0 replies; 20+ messages in thread
From: Peter Chen @ 2015-03-19  1:19 UTC (permalink / raw)
  To: linux-arm-kernel

Stream mode enable is known for better performance, this stream mode
enable patch has been passed with stress tests at device mode for
imx6sl and imx6sx, and no issue is found.

Signed-off-by: Peter Chen <peter.chen@freescale.com>
---
 drivers/usb/chipidea/ci_hdrc_imx.c | 14 +++++++++-----
 1 file changed, 9 insertions(+), 5 deletions(-)

diff --git a/drivers/usb/chipidea/ci_hdrc_imx.c b/drivers/usb/chipidea/ci_hdrc_imx.c
index 389f0e0..5373984 100644
--- a/drivers/usb/chipidea/ci_hdrc_imx.c
+++ b/drivers/usb/chipidea/ci_hdrc_imx.c
@@ -29,26 +29,31 @@ struct ci_hdrc_imx_platform_flag {
 };
 
 static const struct ci_hdrc_imx_platform_flag imx27_usb_data = {
+		CI_HDRC_DISABLE_STREAMING,
 };
 
 static const struct ci_hdrc_imx_platform_flag imx28_usb_data = {
 	.flags = CI_HDRC_IMX28_WRITE_FIX |
-		CI_HDRC_TURN_VBUS_EARLY_ON,
+		CI_HDRC_TURN_VBUS_EARLY_ON |
+		CI_HDRC_DISABLE_STREAMING,
 };
 
 static const struct ci_hdrc_imx_platform_flag imx6q_usb_data = {
 	.flags = CI_HDRC_SUPPORTS_RUNTIME_PM |
-		CI_HDRC_TURN_VBUS_EARLY_ON,
+		CI_HDRC_TURN_VBUS_EARLY_ON |
+		CI_HDRC_DISABLE_STREAMING,
 };
 
 static const struct ci_hdrc_imx_platform_flag imx6sl_usb_data = {
 	.flags = CI_HDRC_SUPPORTS_RUNTIME_PM |
-		CI_HDRC_TURN_VBUS_EARLY_ON,
+		CI_HDRC_TURN_VBUS_EARLY_ON |
+		CI_HDRC_DISABLE_HOST_STREAMING,
 };
 
 static const struct ci_hdrc_imx_platform_flag imx6sx_usb_data = {
 	.flags = CI_HDRC_SUPPORTS_RUNTIME_PM |
-		CI_HDRC_TURN_VBUS_EARLY_ON,
+		CI_HDRC_TURN_VBUS_EARLY_ON |
+		CI_HDRC_DISABLE_HOST_STREAMING,
 };
 
 static const struct of_device_id ci_hdrc_imx_dt_ids[] = {
@@ -126,7 +131,6 @@ static int ci_hdrc_imx_probe(struct platform_device *pdev)
 	struct ci_hdrc_platform_data pdata = {
 		.name		= dev_name(&pdev->dev),
 		.capoffset	= DEF_CAPOFFSET,
-		.flags		= CI_HDRC_DISABLE_STREAMING,
 	};
 	int ret;
 	const struct of_device_id *of_id =
-- 
1.9.1

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

* [PATCH 05/12] usb: chipidea: introduce ci_platform_config
  2015-03-19  1:19 [PATCH 00/12] USB: chipidea: patchset for performance improvement Peter Chen
                   ` (3 preceding siblings ...)
  2015-03-19  1:19 ` [PATCH 04/12] usb: chipidea: imx: add stream mode enable for device mode at imx6sl/imx6sx Peter Chen
@ 2015-03-19  1:19 ` Peter Chen
  2015-03-19 10:19   ` Michael Grzeschik
  2015-03-19  1:19 ` [PATCH 06/12] Doc: usb: ci-hdrc-imx: add ahb-burst-config for binding doc Peter Chen
                   ` (8 subsequent siblings)
  13 siblings, 1 reply; 20+ messages in thread
From: Peter Chen @ 2015-03-19  1:19 UTC (permalink / raw)
  To: linux-arm-kernel

It is used to configure controller parameters according to
platform data, like speed, interrupt threshold, stream mode, etc.

Signed-off-by: Peter Chen <peter.chen@freescale.com>
---
 drivers/usb/chipidea/ci.h   |  2 ++
 drivers/usb/chipidea/core.c | 57 +++++++++++++++++++++++++++++++--------------
 drivers/usb/chipidea/host.c |  6 +----
 3 files changed, 43 insertions(+), 22 deletions(-)

diff --git a/drivers/usb/chipidea/ci.h b/drivers/usb/chipidea/ci.h
index aeec5f0..888606b 100644
--- a/drivers/usb/chipidea/ci.h
+++ b/drivers/usb/chipidea/ci.h
@@ -426,4 +426,6 @@ u8 hw_port_test_get(struct ci_hdrc *ci);
 int hw_wait_reg(struct ci_hdrc *ci, enum ci_hw_regs reg, u32 mask,
 				u32 value, unsigned int timeout_ms);
 
+void ci_platform_config(struct ci_hdrc *ci, int usb_mode);
+
 #endif	/* __DRIVERS_USB_CHIPIDEA_CI_H */
diff --git a/drivers/usb/chipidea/core.c b/drivers/usb/chipidea/core.c
index 4d79392..f713e32 100644
--- a/drivers/usb/chipidea/core.c
+++ b/drivers/usb/chipidea/core.c
@@ -403,6 +403,44 @@ static int ci_usb_phy_init(struct ci_hdrc *ci)
 	return ret;
 }
 
+
+/**
+ * ci_platform_config: do controller configure
+ * @ci: the controller
+ * @usb_mode: the usb mode
+ *
+ */
+void ci_platform_config(struct ci_hdrc *ci, int usb_mode)
+{
+	if (usb_mode == USBMODE_CM_DC) {
+		if (ci->platdata->flags & CI_HDRC_DISABLE_DEVICE_STREAMING)
+			hw_write(ci, OP_USBMODE, USBMODE_CI_SDIS,
+					USBMODE_CI_SDIS);
+
+		/*
+		 * Set interrupt interval for device mode
+		 * host set ITC according to ehci-hcd module
+		 * parameter log2_irq_thresh
+		 */
+		hw_write(ci, OP_USBCMD, 0xff0000,
+			ci->platdata->gadget_itc_setting << 16);
+	} else if (usb_mode == USBMODE_CM_HC) {
+		if (ci->platdata->flags & CI_HDRC_DISABLE_HOST_STREAMING)
+			hw_write(ci, OP_USBMODE, USBMODE_CI_SDIS,
+					USBMODE_CI_SDIS);
+	} else {
+		dev_warn(ci->dev, "USB mode in still not set\n");
+	}
+
+	if (ci->platdata->flags & CI_HDRC_FORCE_FULLSPEED) {
+		if (ci->hw_bank.lpm)
+			hw_write(ci, OP_DEVLC, DEVLC_PFSC, DEVLC_PFSC);
+		else
+			hw_write(ci, OP_PORTSC, PORTSC_PFSC, PORTSC_PFSC);
+	}
+
+}
+
 /**
  * hw_controller_reset: do controller reset
  * @ci: the controller
@@ -447,35 +485,20 @@ int hw_device_reset(struct ci_hdrc *ci)
 		ci->platdata->notify_event(ci,
 			CI_HDRC_CONTROLLER_RESET_EVENT);
 
-	if (ci->platdata->flags & CI_HDRC_DISABLE_DEVICE_STREAMING)
-		hw_write(ci, OP_USBMODE, USBMODE_CI_SDIS, USBMODE_CI_SDIS);
-
-	if (ci->platdata->flags & CI_HDRC_FORCE_FULLSPEED) {
-		if (ci->hw_bank.lpm)
-			hw_write(ci, OP_DEVLC, DEVLC_PFSC, DEVLC_PFSC);
-		else
-			hw_write(ci, OP_PORTSC, PORTSC_PFSC, PORTSC_PFSC);
-	}
-
 	/* USBMODE should be configured step by step */
 	hw_write(ci, OP_USBMODE, USBMODE_CM, USBMODE_CM_IDLE);
 	hw_write(ci, OP_USBMODE, USBMODE_CM, USBMODE_CM_DC);
 	/* HW >= 2.3 */
 	hw_write(ci, OP_USBMODE, USBMODE_SLOM, USBMODE_SLOM);
 
-	/*
-	 * Set interrupt interval for device mode
-	 * host set ITC according to ehci-hcd module parameter log2_irq_thresh
-	 */
-	hw_write(ci, OP_USBCMD, 0xff0000,
-		ci->platdata->gadget_itc_setting << 16);
-
 	if (hw_read(ci, OP_USBMODE, USBMODE_CM) != USBMODE_CM_DC) {
 		pr_err("cannot enter in %s device mode", ci_role(ci)->name);
 		pr_err("lpm = %i", ci->hw_bank.lpm);
 		return -ENODEV;
 	}
 
+	ci_platform_config(ci, USBMODE_CM_DC);
+
 	return 0;
 }
 
diff --git a/drivers/usb/chipidea/host.c b/drivers/usb/chipidea/host.c
index b262c1c..c4f76b7 100644
--- a/drivers/usb/chipidea/host.c
+++ b/drivers/usb/chipidea/host.c
@@ -141,11 +141,7 @@ static int host_start(struct ci_hdrc *ci)
 		}
 	}
 
-	if (ci->platdata->flags & CI_HDRC_FORCE_FULLSPEED)
-		hw_write(ci, OP_PORTSC, PORTSC_PFSC, PORTSC_PFSC);
-
-	if (ci->platdata->flags & CI_HDRC_DISABLE_HOST_STREAMING)
-		hw_write(ci, OP_USBMODE, USBMODE_CI_SDIS, USBMODE_CI_SDIS);
+	ci_platform_config(ci, USBMODE_CM_HC);
 
 	return ret;
 
-- 
1.9.1

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

* [PATCH 06/12] Doc: usb: ci-hdrc-imx: add ahb-burst-config for binding doc
  2015-03-19  1:19 [PATCH 00/12] USB: chipidea: patchset for performance improvement Peter Chen
                   ` (4 preceding siblings ...)
  2015-03-19  1:19 ` [PATCH 05/12] usb: chipidea: introduce ci_platform_config Peter Chen
@ 2015-03-19  1:19 ` Peter Chen
  2015-03-19  1:19 ` [PATCH 07/12] ARM: imx6: set ahb-burst-config as 0 for USB Peter Chen
                   ` (7 subsequent siblings)
  13 siblings, 0 replies; 20+ messages in thread
From: Peter Chen @ 2015-03-19  1:19 UTC (permalink / raw)
  To: linux-arm-kernel

It is used to change ahb burst configuration for platforms.

Signed-off-by: Peter Chen <peter.chen@freescale.com>
---
 Documentation/devicetree/bindings/usb/ci-hdrc-imx.txt | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/Documentation/devicetree/bindings/usb/ci-hdrc-imx.txt b/Documentation/devicetree/bindings/usb/ci-hdrc-imx.txt
index c21171e..a548502 100644
--- a/Documentation/devicetree/bindings/usb/ci-hdrc-imx.txt
+++ b/Documentation/devicetree/bindings/usb/ci-hdrc-imx.txt
@@ -22,6 +22,8 @@ Optional properties:
 - tpl-support: TPL (Targeted Peripheral List) feature for targeted hosts
 - gadget-itc-setting: the ITC setting for gadget, the required value
   should be aligned with ITC bits at register USBCMD.
+- ahb-burst-config: it is vendor dependent, the required value should be
+  aligned with AHBBRST at SBUSCFG, the range is from 0x0 to 0x7.
 
 Examples:
 usb at 02184000 { /* USB OTG */
@@ -35,4 +37,5 @@ usb at 02184000 { /* USB OTG */
 	maximum-speed = "full-speed";
 	tpl-support;
 	gadget-itc-setting = <0x4>; /* 4 micro-frames */
+	ahb-burst-config = <0x0>; /* Incremental burst of unspecified length */
 };
-- 
1.9.1

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

* [PATCH 07/12] ARM: imx6: set ahb-burst-config as 0 for USB
  2015-03-19  1:19 [PATCH 00/12] USB: chipidea: patchset for performance improvement Peter Chen
                   ` (5 preceding siblings ...)
  2015-03-19  1:19 ` [PATCH 06/12] Doc: usb: ci-hdrc-imx: add ahb-burst-config for binding doc Peter Chen
@ 2015-03-19  1:19 ` Peter Chen
  2015-03-19  1:19 ` [PATCH 08/12] usb: chipidea: add ahb burst configuration Peter Chen
                   ` (6 subsequent siblings)
  13 siblings, 0 replies; 20+ messages in thread
From: Peter Chen @ 2015-03-19  1:19 UTC (permalink / raw)
  To: linux-arm-kernel

After setting ahb burst configuration as 0, we can increase tx/rx
burst size, it will improve the USB performance

Signed-off-by: Peter Chen <peter.chen@freescale.com>
---
 arch/arm/boot/dts/imx6qdl.dtsi | 4 ++++
 arch/arm/boot/dts/imx6sl.dtsi  | 3 +++
 arch/arm/boot/dts/imx6sx.dtsi  | 3 +++
 3 files changed, 10 insertions(+)

diff --git a/arch/arm/boot/dts/imx6qdl.dtsi b/arch/arm/boot/dts/imx6qdl.dtsi
index d6c69ec..2430cc9 100644
--- a/arch/arm/boot/dts/imx6qdl.dtsi
+++ b/arch/arm/boot/dts/imx6qdl.dtsi
@@ -835,6 +835,7 @@
 				clocks = <&clks IMX6QDL_CLK_USBOH3>;
 				fsl,usbphy = <&usbphy1>;
 				fsl,usbmisc = <&usbmisc 0>;
+				ahb-burst-config = <0x0>;
 				status = "disabled";
 			};
 
@@ -845,6 +846,7 @@
 				clocks = <&clks IMX6QDL_CLK_USBOH3>;
 				fsl,usbphy = <&usbphy2>;
 				fsl,usbmisc = <&usbmisc 1>;
+				ahb-burst-config = <0x0>;
 				status = "disabled";
 			};
 
@@ -854,6 +856,7 @@
 				interrupts = <0 41 IRQ_TYPE_LEVEL_HIGH>;
 				clocks = <&clks IMX6QDL_CLK_USBOH3>;
 				fsl,usbmisc = <&usbmisc 2>;
+				ahb-burst-config = <0x0>;
 				status = "disabled";
 			};
 
@@ -863,6 +866,7 @@
 				interrupts = <0 42 IRQ_TYPE_LEVEL_HIGH>;
 				clocks = <&clks IMX6QDL_CLK_USBOH3>;
 				fsl,usbmisc = <&usbmisc 3>;
+				ahb-burst-config = <0x0>;
 				status = "disabled";
 			};
 
diff --git a/arch/arm/boot/dts/imx6sl.dtsi b/arch/arm/boot/dts/imx6sl.dtsi
index 36ab8e0..9f283cc 100644
--- a/arch/arm/boot/dts/imx6sl.dtsi
+++ b/arch/arm/boot/dts/imx6sl.dtsi
@@ -680,6 +680,7 @@
 				clocks = <&clks IMX6SL_CLK_USBOH3>;
 				fsl,usbphy = <&usbphy1>;
 				fsl,usbmisc = <&usbmisc 0>;
+				ahb-burst-config = <0x0>;
 				status = "disabled";
 			};
 
@@ -690,6 +691,7 @@
 				clocks = <&clks IMX6SL_CLK_USBOH3>;
 				fsl,usbphy = <&usbphy2>;
 				fsl,usbmisc = <&usbmisc 1>;
+				ahb-burst-config = <0x0>;
 				status = "disabled";
 			};
 
@@ -699,6 +701,7 @@
 				interrupts = <0 40 IRQ_TYPE_LEVEL_HIGH>;
 				clocks = <&clks IMX6SL_CLK_USBOH3>;
 				fsl,usbmisc = <&usbmisc 2>;
+				ahb-burst-config = <0x0>;
 				status = "disabled";
 			};
 
diff --git a/arch/arm/boot/dts/imx6sx.dtsi b/arch/arm/boot/dts/imx6sx.dtsi
index 7a24fee..0cdfa01 100644
--- a/arch/arm/boot/dts/imx6sx.dtsi
+++ b/arch/arm/boot/dts/imx6sx.dtsi
@@ -742,6 +742,7 @@
 				fsl,usbphy = <&usbphy1>;
 				fsl,usbmisc = <&usbmisc 0>;
 				fsl,anatop = <&anatop>;
+				ahb-burst-config = <0x0>;
 				status = "disabled";
 			};
 
@@ -752,6 +753,7 @@
 				clocks = <&clks IMX6SX_CLK_USBOH3>;
 				fsl,usbphy = <&usbphy2>;
 				fsl,usbmisc = <&usbmisc 1>;
+				ahb-burst-config = <0x0>;
 				status = "disabled";
 			};
 
@@ -763,6 +765,7 @@
 				fsl,usbmisc = <&usbmisc 2>;
 				phy_type = "hsic";
 				fsl,anatop = <&anatop>;
+				ahb-burst-config = <0x0>;
 				status = "disabled";
 			};
 
-- 
1.9.1

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

* [PATCH 08/12] usb: chipidea: add ahb burst configuration
  2015-03-19  1:19 [PATCH 00/12] USB: chipidea: patchset for performance improvement Peter Chen
                   ` (6 preceding siblings ...)
  2015-03-19  1:19 ` [PATCH 07/12] ARM: imx6: set ahb-burst-config as 0 for USB Peter Chen
@ 2015-03-19  1:19 ` Peter Chen
  2015-03-19  1:19 ` [PATCH 09/12] usb: chipidea: usbmisc_imx: add unburst setting for imx6 Peter Chen
                   ` (5 subsequent siblings)
  13 siblings, 0 replies; 20+ messages in thread
From: Peter Chen @ 2015-03-19  1:19 UTC (permalink / raw)
  To: linux-arm-kernel

The users can change it through dts or platform data if they
want to change the default value.

Signed-off-by: Peter Chen <peter.chen@freescale.com>
---
 drivers/usb/chipidea/bits.h  |  3 +++
 drivers/usb/chipidea/core.c  | 18 ++++++++++++++++++
 include/linux/usb/chipidea.h |  2 ++
 3 files changed, 23 insertions(+)

diff --git a/drivers/usb/chipidea/bits.h b/drivers/usb/chipidea/bits.h
index 3cb9bda..3af6213 100644
--- a/drivers/usb/chipidea/bits.h
+++ b/drivers/usb/chipidea/bits.h
@@ -25,6 +25,9 @@
 #define VERSION		      (0xF << 25)
 #define CIVERSION	      (0x7 << 29)
 
+/* SBUSCFG */
+#define AHBBRST_MASK  0x7
+
 /* HCCPARAMS */
 #define HCCPARAMS_LEN         BIT(17)
 
diff --git a/drivers/usb/chipidea/core.c b/drivers/usb/chipidea/core.c
index f713e32..c0e6bb1 100644
--- a/drivers/usb/chipidea/core.c
+++ b/drivers/usb/chipidea/core.c
@@ -412,6 +412,8 @@ static int ci_usb_phy_init(struct ci_hdrc *ci)
  */
 void ci_platform_config(struct ci_hdrc *ci, int usb_mode)
 {
+	bool override_needed;
+
 	if (usb_mode == USBMODE_CM_DC) {
 		if (ci->platdata->flags & CI_HDRC_DISABLE_DEVICE_STREAMING)
 			hw_write(ci, OP_USBMODE, USBMODE_CI_SDIS,
@@ -439,6 +441,12 @@ void ci_platform_config(struct ci_hdrc *ci, int usb_mode)
 			hw_write(ci, OP_PORTSC, PORTSC_PFSC, PORTSC_PFSC);
 	}
 
+	/* Override AHB burst configuration if needed */
+	override_needed = hw_read_id_reg(ci, ID_SBUSCFG, AHBBRST_MASK) !=
+		(ci->platdata->ahbburst_config & AHBBRST_MASK);
+	if (override_needed)
+		hw_write_id_reg(ci, ID_SBUSCFG, AHBBRST_MASK,
+			ci->platdata->ahbburst_config);
 }
 
 /**
@@ -633,6 +641,16 @@ static int ci_get_platdata(struct device *dev,
 		}
 	}
 
+	if (of_find_property(dev->of_node, "ahb-burst-config", NULL)) {
+		ret = of_property_read_u32(dev->of_node, "ahb-burst-config",
+			&platdata->ahbburst_config);
+		if (ret) {
+			dev_err(dev,
+				"failed to get ahb-burst-config value\n");
+			return ret;
+		}
+	}
+
 	return 0;
 }
 
diff --git a/include/linux/usb/chipidea.h b/include/linux/usb/chipidea.h
index d3906a4..4d7ceb3 100644
--- a/include/linux/usb/chipidea.h
+++ b/include/linux/usb/chipidea.h
@@ -32,6 +32,7 @@ struct ci_hdrc_platform_data {
 #define CI_HDRC_DISABLE_HOST_STREAMING		BIT(9)
 #define CI_HDRC_DISABLE_STREAMING (CI_HDRC_DISABLE_DEVICE_STREAMING |	\
 		CI_HDRC_DISABLE_HOST_STREAMING)
+#define CI_HDRC_OVERRIDE_AHB_BURST		BIT(10)
 	enum usb_dr_mode	dr_mode;
 #define CI_HDRC_CONTROLLER_RESET_EVENT		0
 #define CI_HDRC_CONTROLLER_STOPPED_EVENT	1
@@ -40,6 +41,7 @@ struct ci_hdrc_platform_data {
 	bool			tpl_support;
 	/* interrupt threshold value for gadget */
 	u32			gadget_itc_setting;
+	u32			ahbburst_config;
 };
 
 /* Default offset of capability registers */
-- 
1.9.1

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

* [PATCH 09/12] usb: chipidea: usbmisc_imx: add unburst setting for imx6
  2015-03-19  1:19 [PATCH 00/12] USB: chipidea: patchset for performance improvement Peter Chen
                   ` (7 preceding siblings ...)
  2015-03-19  1:19 ` [PATCH 08/12] usb: chipidea: add ahb burst configuration Peter Chen
@ 2015-03-19  1:19 ` Peter Chen
  2015-03-19  1:19 ` [PATCH 10/12] Doc: usb: ci-hdrc-imx: add tx(rx)-burst-config-dword for binding doc Peter Chen
                   ` (4 subsequent siblings)
  13 siblings, 0 replies; 20+ messages in thread
From: Peter Chen @ 2015-03-19  1:19 UTC (permalink / raw)
  To: linux-arm-kernel

With this setting and AHBBRST at SBUSCFG as "Incremental burst of
unspecified length", each unburst size can be taken as one single transfer.
It is benefit for unburst size transfer.

Signed-off-by: Peter Chen <peter.chen@freescale.com>
---
 drivers/usb/chipidea/usbmisc_imx.c | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/drivers/usb/chipidea/usbmisc_imx.c b/drivers/usb/chipidea/usbmisc_imx.c
index 8af070f..6a6e73c 100644
--- a/drivers/usb/chipidea/usbmisc_imx.c
+++ b/drivers/usb/chipidea/usbmisc_imx.c
@@ -54,6 +54,7 @@
 #define MX53_USB_PHYCTRL1_PLLDIV_MASK	0x3
 #define MX53_USB_PLL_DIV_24_MHZ		0x01
 
+#define MX6_BM_UNBURST_SETTING		BIT(1)
 #define MX6_BM_OVER_CUR_DIS		BIT(7)
 #define MX6_BM_WAKEUP_ENABLE		BIT(10)
 #define MX6_BM_ID_WAKEUP		BIT(16)
@@ -255,14 +256,21 @@ static int usbmisc_imx6q_init(struct imx_usbmisc_data *data)
 	if (data->index > 3)
 		return -EINVAL;
 
+	spin_lock_irqsave(&usbmisc->lock, flags);
+
 	if (data->disable_oc) {
-		spin_lock_irqsave(&usbmisc->lock, flags);
 		reg = readl(usbmisc->base + data->index * 4);
 		writel(reg | MX6_BM_OVER_CUR_DIS,
 			usbmisc->base + data->index * 4);
-		spin_unlock_irqrestore(&usbmisc->lock, flags);
 	}
 
+	/* SoC unburst setting */
+	reg = readl(usbmisc->base + data->index * 4);
+	writel(reg | MX6_BM_UNBURST_SETTING,
+			usbmisc->base + data->index * 4);
+
+	spin_unlock_irqrestore(&usbmisc->lock, flags);
+
 	usbmisc_imx6q_set_wakeup(data, false);
 
 	return 0;
-- 
1.9.1

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

* [PATCH 10/12] Doc: usb: ci-hdrc-imx: add tx(rx)-burst-config-dword for binding doc
  2015-03-19  1:19 [PATCH 00/12] USB: chipidea: patchset for performance improvement Peter Chen
                   ` (8 preceding siblings ...)
  2015-03-19  1:19 ` [PATCH 09/12] usb: chipidea: usbmisc_imx: add unburst setting for imx6 Peter Chen
@ 2015-03-19  1:19 ` Peter Chen
  2015-03-19  1:19 ` [PATCH 11/12] ARM: imx6: change default burst size for USB Peter Chen
                   ` (3 subsequent siblings)
  13 siblings, 0 replies; 20+ messages in thread
From: Peter Chen @ 2015-03-19  1:19 UTC (permalink / raw)
  To: linux-arm-kernel

It is used to override the default setting for burst size, changing
burst size takes effect only when the SBUSCFG.AHBBRST = 0.

Signed-off-by: Peter Chen <peter.chen@freescale.com>
---
 Documentation/devicetree/bindings/usb/ci-hdrc-imx.txt | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/Documentation/devicetree/bindings/usb/ci-hdrc-imx.txt b/Documentation/devicetree/bindings/usb/ci-hdrc-imx.txt
index a548502..892bac8 100644
--- a/Documentation/devicetree/bindings/usb/ci-hdrc-imx.txt
+++ b/Documentation/devicetree/bindings/usb/ci-hdrc-imx.txt
@@ -24,6 +24,10 @@ Optional properties:
   should be aligned with ITC bits at register USBCMD.
 - ahb-burst-config: it is vendor dependent, the required value should be
   aligned with AHBBRST at SBUSCFG, the range is from 0x0 to 0x7.
+- tx-burst-size-dword: it is vendor dependent, the tx burst size in dword
+  (4 bytes)
+- rx-burst-size-dword: it is vendor dependent, the rx burst size in dword
+  (4 bytes)
 
 Examples:
 usb at 02184000 { /* USB OTG */
@@ -38,4 +42,6 @@ usb at 02184000 { /* USB OTG */
 	tpl-support;
 	gadget-itc-setting = <0x4>; /* 4 micro-frames */
 	ahb-burst-config = <0x0>; /* Incremental burst of unspecified length */
+	tx-burst-size-dword = <0x10>;
+	rx-burst-size-dword = <0x10>;
 };
-- 
1.9.1

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

* [PATCH 11/12] ARM: imx6: change default burst size for USB
  2015-03-19  1:19 [PATCH 00/12] USB: chipidea: patchset for performance improvement Peter Chen
                   ` (9 preceding siblings ...)
  2015-03-19  1:19 ` [PATCH 10/12] Doc: usb: ci-hdrc-imx: add tx(rx)-burst-config-dword for binding doc Peter Chen
@ 2015-03-19  1:19 ` Peter Chen
  2015-03-19  1:19 ` [PATCH 12/12] usb: chipidea: add burst size configuration interface Peter Chen
                   ` (2 subsequent siblings)
  13 siblings, 0 replies; 20+ messages in thread
From: Peter Chen @ 2015-03-19  1:19 UTC (permalink / raw)
  To: linux-arm-kernel

It can improve the USB performance when choosing larger
burst size at some systems (bus size is larger), there is
no side effect if this burst size is larger than bus size.

Signed-off-by: Peter Chen <peter.chen@freescale.com>
---
 arch/arm/boot/dts/imx6qdl.dtsi | 8 ++++++++
 arch/arm/boot/dts/imx6sl.dtsi  | 6 ++++++
 arch/arm/boot/dts/imx6sx.dtsi  | 6 ++++++
 3 files changed, 20 insertions(+)

diff --git a/arch/arm/boot/dts/imx6qdl.dtsi b/arch/arm/boot/dts/imx6qdl.dtsi
index 2430cc9..4446218 100644
--- a/arch/arm/boot/dts/imx6qdl.dtsi
+++ b/arch/arm/boot/dts/imx6qdl.dtsi
@@ -836,6 +836,8 @@
 				fsl,usbphy = <&usbphy1>;
 				fsl,usbmisc = <&usbmisc 0>;
 				ahb-burst-config = <0x0>;
+				tx-burst-size-dword = <0x10>;
+				rx-burst-size-dword = <0x10>;
 				status = "disabled";
 			};
 
@@ -847,6 +849,8 @@
 				fsl,usbphy = <&usbphy2>;
 				fsl,usbmisc = <&usbmisc 1>;
 				ahb-burst-config = <0x0>;
+				tx-burst-size-dword = <0x10>;
+				rx-burst-size-dword = <0x10>;
 				status = "disabled";
 			};
 
@@ -857,6 +861,8 @@
 				clocks = <&clks IMX6QDL_CLK_USBOH3>;
 				fsl,usbmisc = <&usbmisc 2>;
 				ahb-burst-config = <0x0>;
+				tx-burst-size-dword = <0x10>;
+				rx-burst-size-dword = <0x10>;
 				status = "disabled";
 			};
 
@@ -867,6 +873,8 @@
 				clocks = <&clks IMX6QDL_CLK_USBOH3>;
 				fsl,usbmisc = <&usbmisc 3>;
 				ahb-burst-config = <0x0>;
+				tx-burst-size-dword = <0x10>;
+				rx-burst-size-dword = <0x10>;
 				status = "disabled";
 			};
 
diff --git a/arch/arm/boot/dts/imx6sl.dtsi b/arch/arm/boot/dts/imx6sl.dtsi
index 9f283cc..9117c4c 100644
--- a/arch/arm/boot/dts/imx6sl.dtsi
+++ b/arch/arm/boot/dts/imx6sl.dtsi
@@ -681,6 +681,8 @@
 				fsl,usbphy = <&usbphy1>;
 				fsl,usbmisc = <&usbmisc 0>;
 				ahb-burst-config = <0x0>;
+				tx-burst-size-dword = <0x10>;
+				rx-burst-size-dword = <0x10>;
 				status = "disabled";
 			};
 
@@ -692,6 +694,8 @@
 				fsl,usbphy = <&usbphy2>;
 				fsl,usbmisc = <&usbmisc 1>;
 				ahb-burst-config = <0x0>;
+				tx-burst-size-dword = <0x10>;
+				rx-burst-size-dword = <0x10>;
 				status = "disabled";
 			};
 
@@ -702,6 +706,8 @@
 				clocks = <&clks IMX6SL_CLK_USBOH3>;
 				fsl,usbmisc = <&usbmisc 2>;
 				ahb-burst-config = <0x0>;
+				tx-burst-size-dword = <0x10>;
+				rx-burst-size-dword = <0x10>;
 				status = "disabled";
 			};
 
diff --git a/arch/arm/boot/dts/imx6sx.dtsi b/arch/arm/boot/dts/imx6sx.dtsi
index 0cdfa01..464cc3a 100644
--- a/arch/arm/boot/dts/imx6sx.dtsi
+++ b/arch/arm/boot/dts/imx6sx.dtsi
@@ -743,6 +743,8 @@
 				fsl,usbmisc = <&usbmisc 0>;
 				fsl,anatop = <&anatop>;
 				ahb-burst-config = <0x0>;
+				tx-burst-size-dword = <0x10>;
+				rx-burst-size-dword = <0x10>;
 				status = "disabled";
 			};
 
@@ -754,6 +756,8 @@
 				fsl,usbphy = <&usbphy2>;
 				fsl,usbmisc = <&usbmisc 1>;
 				ahb-burst-config = <0x0>;
+				tx-burst-size-dword = <0x10>;
+				rx-burst-size-dword = <0x10>;
 				status = "disabled";
 			};
 
@@ -766,6 +770,8 @@
 				phy_type = "hsic";
 				fsl,anatop = <&anatop>;
 				ahb-burst-config = <0x0>;
+				tx-burst-size-dword = <0x10>;
+				rx-burst-size-dword = <0x10>;
 				status = "disabled";
 			};
 
-- 
1.9.1

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

* [PATCH 12/12] usb: chipidea: add burst size configuration interface
  2015-03-19  1:19 [PATCH 00/12] USB: chipidea: patchset for performance improvement Peter Chen
                   ` (10 preceding siblings ...)
  2015-03-19  1:19 ` [PATCH 11/12] ARM: imx6: change default burst size for USB Peter Chen
@ 2015-03-19  1:19 ` Peter Chen
  2015-03-19 10:36 ` [PATCH 00/12] USB: chipidea: patchset for performance improvement Jean-Christophe PLAGNIOL-VILLARD
  2015-03-24 10:32 ` victorascroft at gmail.com
  13 siblings, 0 replies; 20+ messages in thread
From: Peter Chen @ 2015-03-19  1:19 UTC (permalink / raw)
  To: linux-arm-kernel

The user can adjust it through dts or other platform interfaces.

Signed-off-by: Peter Chen <peter.chen@freescale.com>
---
 drivers/usb/chipidea/bits.h  |  4 ++++
 drivers/usb/chipidea/ci.h    |  1 +
 drivers/usb/chipidea/core.c  | 39 +++++++++++++++++++++++++++++++++++++++
 include/linux/usb/chipidea.h |  2 ++
 4 files changed, 46 insertions(+)

diff --git a/drivers/usb/chipidea/bits.h b/drivers/usb/chipidea/bits.h
index 3af6213..466ce89 100644
--- a/drivers/usb/chipidea/bits.h
+++ b/drivers/usb/chipidea/bits.h
@@ -56,6 +56,10 @@
 #define DEVICEADDR_USBADRA    BIT(24)
 #define DEVICEADDR_USBADR     (0x7FUL << 25)
 
+/* BURSTSIZE */
+#define RX_BURST_MASK		0xff
+#define TX_BURST_MASK		0xff00
+
 /* PORTSC */
 #define PORTSC_CCS            BIT(0)
 #define PORTSC_CSC            BIT(1)
diff --git a/drivers/usb/chipidea/ci.h b/drivers/usb/chipidea/ci.h
index 888606b..232156b 100644
--- a/drivers/usb/chipidea/ci.h
+++ b/drivers/usb/chipidea/ci.h
@@ -50,6 +50,7 @@ enum ci_hw_regs {
 	OP_USBINTR,
 	OP_DEVICEADDR,
 	OP_ENDPTLISTADDR,
+	OP_BURSTSIZE,
 	OP_PORTSC,
 	OP_DEVLC,
 	OP_OTGSC,
diff --git a/drivers/usb/chipidea/core.c b/drivers/usb/chipidea/core.c
index c0e6bb1..beb4236 100644
--- a/drivers/usb/chipidea/core.c
+++ b/drivers/usb/chipidea/core.c
@@ -84,6 +84,7 @@ static const u8 ci_regs_nolpm[] = {
 	[OP_USBINTR]		= 0x08U,
 	[OP_DEVICEADDR]		= 0x14U,
 	[OP_ENDPTLISTADDR]	= 0x18U,
+	[OP_BURSTSIZE]		= 0x20U,
 	[OP_PORTSC]		= 0x44U,
 	[OP_DEVLC]		= 0x84U,
 	[OP_OTGSC]		= 0x64U,
@@ -106,6 +107,7 @@ static const u8 ci_regs_lpm[] = {
 	[OP_USBINTR]		= 0x08U,
 	[OP_DEVICEADDR]		= 0x14U,
 	[OP_ENDPTLISTADDR]	= 0x18U,
+	[OP_BURSTSIZE]		= 0x20U,
 	[OP_PORTSC]		= 0x44U,
 	[OP_DEVLC]		= 0x84U,
 	[OP_OTGSC]		= 0xC4U,
@@ -412,6 +414,7 @@ static int ci_usb_phy_init(struct ci_hdrc *ci)
  */
 void ci_platform_config(struct ci_hdrc *ci, int usb_mode)
 {
+	u32 ahb_burst_config;
 	bool override_needed;
 
 	if (usb_mode == USBMODE_CM_DC) {
@@ -447,6 +450,22 @@ void ci_platform_config(struct ci_hdrc *ci, int usb_mode)
 	if (override_needed)
 		hw_write_id_reg(ci, ID_SBUSCFG, AHBBRST_MASK,
 			ci->platdata->ahbburst_config);
+
+	ahb_burst_config = hw_read_id_reg(ci, ID_SBUSCFG, AHBBRST_MASK);
+
+	/* Override tx burst size if needed */
+	override_needed = hw_read(ci, OP_BURSTSIZE, RX_BURST_MASK) !=
+			(ci->platdata->rx_burst_size & RX_BURST_MASK);
+	if (!ahb_burst_config && override_needed)
+		hw_write(ci, OP_BURSTSIZE, RX_BURST_MASK,
+			ci->platdata->rx_burst_size);
+
+	/* Override tx burst size if needed */
+	override_needed = ((hw_read(ci, OP_BURSTSIZE, TX_BURST_MASK) >>
+			__ffs(TX_BURST_MASK)) != ci->platdata->tx_burst_size);
+	if (!ahb_burst_config && override_needed)
+		hw_write(ci, OP_BURSTSIZE, TX_BURST_MASK,
+			ci->platdata->tx_burst_size << __ffs(TX_BURST_MASK));
 }
 
 /**
@@ -651,6 +670,26 @@ static int ci_get_platdata(struct device *dev,
 		}
 	}
 
+	if (of_find_property(dev->of_node, "tx-burst-size-dword", NULL)) {
+		ret = of_property_read_u32(dev->of_node, "tx-burst-size-dword",
+			&platdata->tx_burst_size);
+		if (ret) {
+			dev_err(dev,
+				"failed to get tx-burst-size-dword value\n");
+			return ret;
+		}
+	}
+
+	if (of_find_property(dev->of_node, "rx-burst-size-dword", NULL)) {
+		ret = of_property_read_u32(dev->of_node, "rx-burst-size-dword",
+			&platdata->rx_burst_size);
+		if (ret) {
+			dev_err(dev,
+				"failed to get rx-burst-size-dword value\n");
+			return ret;
+		}
+	}
+
 	return 0;
 }
 
diff --git a/include/linux/usb/chipidea.h b/include/linux/usb/chipidea.h
index 4d7ceb3..b5f0d7b 100644
--- a/include/linux/usb/chipidea.h
+++ b/include/linux/usb/chipidea.h
@@ -42,6 +42,8 @@ struct ci_hdrc_platform_data {
 	/* interrupt threshold value for gadget */
 	u32			gadget_itc_setting;
 	u32			ahbburst_config;
+	u32			tx_burst_size;
+	u32			rx_burst_size;
 };
 
 /* Default offset of capability registers */
-- 
1.9.1

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

* [PATCH 05/12] usb: chipidea: introduce ci_platform_config
  2015-03-19  1:19 ` [PATCH 05/12] usb: chipidea: introduce ci_platform_config Peter Chen
@ 2015-03-19 10:19   ` Michael Grzeschik
  2015-03-20  2:36     ` Peter Chen
  0 siblings, 1 reply; 20+ messages in thread
From: Michael Grzeschik @ 2015-03-19 10:19 UTC (permalink / raw)
  To: linux-arm-kernel

On Thu, Mar 19, 2015 at 09:19:16AM +0800, Peter Chen wrote:
> It is used to configure controller parameters according to
> platform data, like speed, interrupt threshold, stream mode, etc.
> 
> Signed-off-by: Peter Chen <peter.chen@freescale.com>
> ---
>  drivers/usb/chipidea/ci.h   |  2 ++
>  drivers/usb/chipidea/core.c | 57 +++++++++++++++++++++++++++++++--------------
>  drivers/usb/chipidea/host.c |  6 +----
>  3 files changed, 43 insertions(+), 22 deletions(-)
> 
> diff --git a/drivers/usb/chipidea/ci.h b/drivers/usb/chipidea/ci.h
> index aeec5f0..888606b 100644
> --- a/drivers/usb/chipidea/ci.h
> +++ b/drivers/usb/chipidea/ci.h
> @@ -426,4 +426,6 @@ u8 hw_port_test_get(struct ci_hdrc *ci);
>  int hw_wait_reg(struct ci_hdrc *ci, enum ci_hw_regs reg, u32 mask,
>  				u32 value, unsigned int timeout_ms);
>  
> +void ci_platform_config(struct ci_hdrc *ci, int usb_mode);
> +
>  #endif	/* __DRIVERS_USB_CHIPIDEA_CI_H */
> diff --git a/drivers/usb/chipidea/core.c b/drivers/usb/chipidea/core.c
> index 4d79392..f713e32 100644
> --- a/drivers/usb/chipidea/core.c
> +++ b/drivers/usb/chipidea/core.c
> @@ -403,6 +403,44 @@ static int ci_usb_phy_init(struct ci_hdrc *ci)
>  	return ret;
>  }
>  
> +
> +/**
> + * ci_platform_config: do controller configure
> + * @ci: the controller
> + * @usb_mode: the usb mode
> + *
> + */
> +void ci_platform_config(struct ci_hdrc *ci, int usb_mode)
> +{
> +	if (usb_mode == USBMODE_CM_DC) {
> +		if (ci->platdata->flags & CI_HDRC_DISABLE_DEVICE_STREAMING)
> +			hw_write(ci, OP_USBMODE, USBMODE_CI_SDIS,
> +					USBMODE_CI_SDIS);
> +
> +		/*
> +		 * Set interrupt interval for device mode
> +		 * host set ITC according to ehci-hcd module
> +		 * parameter log2_irq_thresh
> +		 */
> +		hw_write(ci, OP_USBCMD, 0xff0000,
> +			ci->platdata->gadget_itc_setting << 16);
> +	} else if (usb_mode == USBMODE_CM_HC) {
> +		if (ci->platdata->flags & CI_HDRC_DISABLE_HOST_STREAMING)
> +			hw_write(ci, OP_USBMODE, USBMODE_CI_SDIS,
> +					USBMODE_CI_SDIS);
> +	} else {
> +		dev_warn(ci->dev, "USB mode in still not set\n");
> +	}
> +
> +	if (ci->platdata->flags & CI_HDRC_FORCE_FULLSPEED) {
> +		if (ci->hw_bank.lpm)
> +			hw_write(ci, OP_DEVLC, DEVLC_PFSC, DEVLC_PFSC);
> +		else
> +			hw_write(ci, OP_PORTSC, PORTSC_PFSC, PORTSC_PFSC);
> +	}
> +
> +}
> +
>  /**
>   * hw_controller_reset: do controller reset
>   * @ci: the controller
> @@ -447,35 +485,20 @@ int hw_device_reset(struct ci_hdrc *ci)
>  		ci->platdata->notify_event(ci,
>  			CI_HDRC_CONTROLLER_RESET_EVENT);
>  
> -	if (ci->platdata->flags & CI_HDRC_DISABLE_DEVICE_STREAMING)
> -		hw_write(ci, OP_USBMODE, USBMODE_CI_SDIS, USBMODE_CI_SDIS);
> -
> -	if (ci->platdata->flags & CI_HDRC_FORCE_FULLSPEED) {
> -		if (ci->hw_bank.lpm)
> -			hw_write(ci, OP_DEVLC, DEVLC_PFSC, DEVLC_PFSC);
> -		else
> -			hw_write(ci, OP_PORTSC, PORTSC_PFSC, PORTSC_PFSC);
> -	}
> -
>  	/* USBMODE should be configured step by step */
>  	hw_write(ci, OP_USBMODE, USBMODE_CM, USBMODE_CM_IDLE);
>  	hw_write(ci, OP_USBMODE, USBMODE_CM, USBMODE_CM_DC);
>  	/* HW >= 2.3 */
>  	hw_write(ci, OP_USBMODE, USBMODE_SLOM, USBMODE_SLOM);
>  
> -	/*
> -	 * Set interrupt interval for device mode
> -	 * host set ITC according to ehci-hcd module parameter log2_irq_thresh
> -	 */
> -	hw_write(ci, OP_USBCMD, 0xff0000,
> -		ci->platdata->gadget_itc_setting << 16);
> -

This codepath was added by patch 02 "usb: chipidea: set ITC to 0 for
device mode". You should add it after this one, so this code gets added
directly to its final position.

>  	if (hw_read(ci, OP_USBMODE, USBMODE_CM) != USBMODE_CM_DC) {
>  		pr_err("cannot enter in %s device mode", ci_role(ci)->name);
>  		pr_err("lpm = %i", ci->hw_bank.lpm);
>  		return -ENODEV;
>  	}
>  
> +	ci_platform_config(ci, USBMODE_CM_DC);
> +
>  	return 0;
>  }
>  
> diff --git a/drivers/usb/chipidea/host.c b/drivers/usb/chipidea/host.c
> index b262c1c..c4f76b7 100644
> --- a/drivers/usb/chipidea/host.c
> +++ b/drivers/usb/chipidea/host.c
> @@ -141,11 +141,7 @@ static int host_start(struct ci_hdrc *ci)
>  		}
>  	}
>  
> -	if (ci->platdata->flags & CI_HDRC_FORCE_FULLSPEED)
> -		hw_write(ci, OP_PORTSC, PORTSC_PFSC, PORTSC_PFSC);
> -
> -	if (ci->platdata->flags & CI_HDRC_DISABLE_HOST_STREAMING)
> -		hw_write(ci, OP_USBMODE, USBMODE_CI_SDIS, USBMODE_CI_SDIS);
> +	ci_platform_config(ci, USBMODE_CM_HC);
>  
>  	return ret;
>  
> -- 
> 1.9.1
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-usb" in
> the body of a message to majordomo at vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> 

-- 
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

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

* [PATCH 00/12] USB: chipidea: patchset for performance improvement
  2015-03-19  1:19 [PATCH 00/12] USB: chipidea: patchset for performance improvement Peter Chen
                   ` (11 preceding siblings ...)
  2015-03-19  1:19 ` [PATCH 12/12] usb: chipidea: add burst size configuration interface Peter Chen
@ 2015-03-19 10:36 ` Jean-Christophe PLAGNIOL-VILLARD
  2015-03-20  2:33   ` Peter Chen
  2015-03-24 10:32 ` victorascroft at gmail.com
  13 siblings, 1 reply; 20+ messages in thread
From: Jean-Christophe PLAGNIOL-VILLARD @ 2015-03-19 10:36 UTC (permalink / raw)
  To: linux-arm-kernel

On 09:19 Thu 19 Mar     , Peter Chen wrote:
> Hi all,
> 
> In this patch set, I add some interfaces for tuning the performance
> of chipidea usb driver. With this set, the USB performance can be improved
> at some user cases with suitable parameters. The main changes:
> 
> - Interface to tune interrupt threshold control, and set
> 'Immediate' for default value
> - The glue layer can disable stream mode according to USB role
> - Interface to tune AHB burst configuration at SBUSCFG
> - Interface to tune tx/rx burst size
> - i.mx changes for achieving better performance, it can reduce
>   the latecy between bus and USB FIFO, and reduce the overrun
>   and underrun occurrences, it is useful for the system bus is busy.
>   we see great improvement for ISO transfer, eg, high resolution
>   USB camera when the bus is busy.
> 
> Below are some test results at imx6sx sdb board
> (set ehci_hcd.park=3 at bootargs), the tests are done
> at v4.0 kernel, no other bus loading during the tests,
> so we have not seen performance change for some use cases.
> 
> USB Mass Storage (Host mode)
> With Patch Set		Without Patch Set
> R: 26.9 MB/s		27 MB/s
> W: 25.2 MB/s		24.5 MB/s
> 
> 1G USB Ethernet Card
> With Patch Set		Without Patch Set
> TX: 186 Mb/s		185 Mb/s
> RX: 219 Mb/s		216 Mb/s
> 
> g_ncm (Device Mode)
> With Patch Set		Without Patch Set
> TX: 166MB/s		163MB/s
> RX: 230MB/s		184MB/s

The improve is not drag sticks except for gcm RX

The most interesting path will be on full system loaded

can you test it and provide data?

Best Regards,
J.

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

* [PATCH 00/12] USB: chipidea: patchset for performance improvement
  2015-03-19 10:36 ` [PATCH 00/12] USB: chipidea: patchset for performance improvement Jean-Christophe PLAGNIOL-VILLARD
@ 2015-03-20  2:33   ` Peter Chen
  0 siblings, 0 replies; 20+ messages in thread
From: Peter Chen @ 2015-03-20  2:33 UTC (permalink / raw)
  To: linux-arm-kernel

On Thu, Mar 19, 2015 at 11:36:29AM +0100, Jean-Christophe PLAGNIOL-VILLARD wrote:
> On 09:19 Thu 19 Mar     , Peter Chen wrote:
> > Hi all,
> > 
> > In this patch set, I add some interfaces for tuning the performance
> > of chipidea usb driver. With this set, the USB performance can be improved
> > at some user cases with suitable parameters. The main changes:
> > 
> > - Interface to tune interrupt threshold control, and set
> > 'Immediate' for default value
> > - The glue layer can disable stream mode according to USB role
> > - Interface to tune AHB burst configuration at SBUSCFG
> > - Interface to tune tx/rx burst size
> > - i.mx changes for achieving better performance, it can reduce
> >   the latecy between bus and USB FIFO, and reduce the overrun
> >   and underrun occurrences, it is useful for the system bus is busy.
> >   we see great improvement for ISO transfer, eg, high resolution
> >   USB camera when the bus is busy.
> > 
> > Below are some test results at imx6sx sdb board
> > (set ehci_hcd.park=3 at bootargs), the tests are done
> > at v4.0 kernel, no other bus loading during the tests,
> > so we have not seen performance change for some use cases.
> > 
> > USB Mass Storage (Host mode)
> > With Patch Set		Without Patch Set
> > R: 26.9 MB/s		27 MB/s
> > W: 25.2 MB/s		24.5 MB/s
> > 
> > 1G USB Ethernet Card
> > With Patch Set		Without Patch Set
> > TX: 186 Mb/s		185 Mb/s
> > RX: 219 Mb/s		216 Mb/s
> > 
> > g_ncm (Device Mode)
> > With Patch Set		Without Patch Set
> > TX: 166MB/s		163MB/s
> > RX: 230MB/s		184MB/s
> 
> The improve is not drag sticks except for gcm RX
> 
> The most interesting path will be on full system loaded
> 

Yeah, I can have a try. But we have no GPU driver and related
apps on it, I am not sure if I can create starve bus situation.
Any high bus loading tools suggest?

-- 

Best Regards,
Peter Chen

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

* [PATCH 05/12] usb: chipidea: introduce ci_platform_config
  2015-03-19 10:19   ` Michael Grzeschik
@ 2015-03-20  2:36     ` Peter Chen
  0 siblings, 0 replies; 20+ messages in thread
From: Peter Chen @ 2015-03-20  2:36 UTC (permalink / raw)
  To: linux-arm-kernel

On Thu, Mar 19, 2015 at 11:19:29AM +0100, Michael Grzeschik wrote:
> On Thu, Mar 19, 2015 at 09:19:16AM +0800, Peter Chen wrote:
> > It is used to configure controller parameters according to
> > platform data, like speed, interrupt threshold, stream mode, etc.
> > 
> > Signed-off-by: Peter Chen <peter.chen@freescale.com>
> > ---
> >  drivers/usb/chipidea/ci.h   |  2 ++
> >  drivers/usb/chipidea/core.c | 57 +++++++++++++++++++++++++++++++--------------
> >  drivers/usb/chipidea/host.c |  6 +----
> >  3 files changed, 43 insertions(+), 22 deletions(-)
> > 
> > diff --git a/drivers/usb/chipidea/ci.h b/drivers/usb/chipidea/ci.h
> > index aeec5f0..888606b 100644
> > --- a/drivers/usb/chipidea/ci.h
> > +++ b/drivers/usb/chipidea/ci.h
> > @@ -426,4 +426,6 @@ u8 hw_port_test_get(struct ci_hdrc *ci);
> >  int hw_wait_reg(struct ci_hdrc *ci, enum ci_hw_regs reg, u32 mask,
> >  				u32 value, unsigned int timeout_ms);
> >  
> > +void ci_platform_config(struct ci_hdrc *ci, int usb_mode);
> > +
> >  #endif	/* __DRIVERS_USB_CHIPIDEA_CI_H */
> > diff --git a/drivers/usb/chipidea/core.c b/drivers/usb/chipidea/core.c
> > index 4d79392..f713e32 100644
> > --- a/drivers/usb/chipidea/core.c
> > +++ b/drivers/usb/chipidea/core.c
> > @@ -403,6 +403,44 @@ static int ci_usb_phy_init(struct ci_hdrc *ci)
> >  	return ret;
> >  }
> >  
> > +
> > +/**
> > + * ci_platform_config: do controller configure
> > + * @ci: the controller
> > + * @usb_mode: the usb mode
> > + *
> > + */
> > +void ci_platform_config(struct ci_hdrc *ci, int usb_mode)
> > +{
> > +	if (usb_mode == USBMODE_CM_DC) {
> > +		if (ci->platdata->flags & CI_HDRC_DISABLE_DEVICE_STREAMING)
> > +			hw_write(ci, OP_USBMODE, USBMODE_CI_SDIS,
> > +					USBMODE_CI_SDIS);
> > +
> > +		/*
> > +		 * Set interrupt interval for device mode
> > +		 * host set ITC according to ehci-hcd module
> > +		 * parameter log2_irq_thresh
> > +		 */
> > +		hw_write(ci, OP_USBCMD, 0xff0000,
> > +			ci->platdata->gadget_itc_setting << 16);
> > +	} else if (usb_mode == USBMODE_CM_HC) {
> > +		if (ci->platdata->flags & CI_HDRC_DISABLE_HOST_STREAMING)
> > +			hw_write(ci, OP_USBMODE, USBMODE_CI_SDIS,
> > +					USBMODE_CI_SDIS);
> > +	} else {
> > +		dev_warn(ci->dev, "USB mode in still not set\n");
> > +	}
> > +
> > +	if (ci->platdata->flags & CI_HDRC_FORCE_FULLSPEED) {
> > +		if (ci->hw_bank.lpm)
> > +			hw_write(ci, OP_DEVLC, DEVLC_PFSC, DEVLC_PFSC);
> > +		else
> > +			hw_write(ci, OP_PORTSC, PORTSC_PFSC, PORTSC_PFSC);
> > +	}
> > +
> > +}
> > +
> >  /**
> >   * hw_controller_reset: do controller reset
> >   * @ci: the controller
> > @@ -447,35 +485,20 @@ int hw_device_reset(struct ci_hdrc *ci)
> >  		ci->platdata->notify_event(ci,
> >  			CI_HDRC_CONTROLLER_RESET_EVENT);
> >  
> > -	if (ci->platdata->flags & CI_HDRC_DISABLE_DEVICE_STREAMING)
> > -		hw_write(ci, OP_USBMODE, USBMODE_CI_SDIS, USBMODE_CI_SDIS);
> > -
> > -	if (ci->platdata->flags & CI_HDRC_FORCE_FULLSPEED) {
> > -		if (ci->hw_bank.lpm)
> > -			hw_write(ci, OP_DEVLC, DEVLC_PFSC, DEVLC_PFSC);
> > -		else
> > -			hw_write(ci, OP_PORTSC, PORTSC_PFSC, PORTSC_PFSC);
> > -	}
> > -
> >  	/* USBMODE should be configured step by step */
> >  	hw_write(ci, OP_USBMODE, USBMODE_CM, USBMODE_CM_IDLE);
> >  	hw_write(ci, OP_USBMODE, USBMODE_CM, USBMODE_CM_DC);
> >  	/* HW >= 2.3 */
> >  	hw_write(ci, OP_USBMODE, USBMODE_SLOM, USBMODE_SLOM);
> >  
> > -	/*
> > -	 * Set interrupt interval for device mode
> > -	 * host set ITC according to ehci-hcd module parameter log2_irq_thresh
> > -	 */
> > -	hw_write(ci, OP_USBCMD, 0xff0000,
> > -		ci->platdata->gadget_itc_setting << 16);
> > -
> 
> This codepath was added by patch 02 "usb: chipidea: set ITC to 0 for
> device mode". You should add it after this one, so this code gets added
> directly to its final position.
> 

Thanks, I will add ITC tuning as the first user for ci_platform_config

Peter
> >  	if (hw_read(ci, OP_USBMODE, USBMODE_CM) != USBMODE_CM_DC) {
> >  		pr_err("cannot enter in %s device mode", ci_role(ci)->name);
> >  		pr_err("lpm = %i", ci->hw_bank.lpm);
> >  		return -ENODEV;
> >  	}
> >  
> > +	ci_platform_config(ci, USBMODE_CM_DC);
> > +
> >  	return 0;
> >  }
> >  
> > diff --git a/drivers/usb/chipidea/host.c b/drivers/usb/chipidea/host.c
> > index b262c1c..c4f76b7 100644
> > --- a/drivers/usb/chipidea/host.c
> > +++ b/drivers/usb/chipidea/host.c
> > @@ -141,11 +141,7 @@ static int host_start(struct ci_hdrc *ci)
> >  		}
> >  	}
> >  
> > -	if (ci->platdata->flags & CI_HDRC_FORCE_FULLSPEED)
> > -		hw_write(ci, OP_PORTSC, PORTSC_PFSC, PORTSC_PFSC);
> > -
> > -	if (ci->platdata->flags & CI_HDRC_DISABLE_HOST_STREAMING)
> > -		hw_write(ci, OP_USBMODE, USBMODE_CI_SDIS, USBMODE_CI_SDIS);
> > +	ci_platform_config(ci, USBMODE_CM_HC);
> >  
> >  	return ret;
> >  
> > -- 
> > 1.9.1
> > 
> > --
> > To unsubscribe from this list: send the line "unsubscribe linux-usb" in
> > the body of a message to majordomo at vger.kernel.org
> > More majordomo info at  http://vger.kernel.org/majordomo-info.html
> > 
> 
> -- 
> Pengutronix e.K.                           |                             |
> Industrial Linux Solutions                 | http://www.pengutronix.de/  |
> Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
> Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

-- 

Best Regards,
Peter Chen

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

* [PATCH 00/12] USB: chipidea: patchset for performance improvement
  2015-03-19  1:19 [PATCH 00/12] USB: chipidea: patchset for performance improvement Peter Chen
                   ` (12 preceding siblings ...)
  2015-03-19 10:36 ` [PATCH 00/12] USB: chipidea: patchset for performance improvement Jean-Christophe PLAGNIOL-VILLARD
@ 2015-03-24 10:32 ` victorascroft at gmail.com
  2015-03-24 12:21   ` Peter Chen
  13 siblings, 1 reply; 20+ messages in thread
From: victorascroft at gmail.com @ 2015-03-24 10:32 UTC (permalink / raw)
  To: linux-arm-kernel

Hello Peter, 

On 15-03-19 09:19:11, Peter Chen wrote:
> Hi all,
> 
> In this patch set, I add some interfaces for tuning the performance
> of chipidea usb driver. With this set, the USB performance can be improved
> at some user cases with suitable parameters. The main changes:
> 
> - Interface to tune interrupt threshold control, and set
> 'Immediate' for default value
> - The glue layer can disable stream mode according to USB role
> - Interface to tune AHB burst configuration at SBUSCFG
> - Interface to tune tx/rx burst size
> - i.mx changes for achieving better performance, it can reduce
>   the latecy between bus and USB FIFO, and reduce the overrun
>   and underrun occurrences, it is useful for the system bus is busy.
>   we see great improvement for ISO transfer, eg, high resolution
>   USB camera when the bus is busy.
> 
> Below are some test results at imx6sx sdb board
> (set ehci_hcd.park=3 at bootargs), the tests are done
> at v4.0 kernel, no other bus loading during the tests,
> so we have not seen performance change for some use cases.
> 
> USB Mass Storage (Host mode)
> With Patch Set		Without Patch Set
> R: 26.9 MB/s		27 MB/s
> W: 25.2 MB/s		24.5 MB/s
> 
> 1G USB Ethernet Card
> With Patch Set		Without Patch Set
> TX: 186 Mb/s		185 Mb/s
> RX: 219 Mb/s		216 Mb/s
> 
> g_ncm (Device Mode)
> With Patch Set		Without Patch Set
> TX: 166MB/s		163MB/s
> RX: 230MB/s		184MB/s
> 

I tested these patches on a Colibri Vybrid VF61. Have not applied the 
7th and 11th patch, but, the changes these patches introduce, I added 
them to our device tree node. These would be  the addition of 
ahb-burst-config = <0x0> and tx-burst-size-dword = <0x10> and 
rx-burst-size-dword = <0x10> to the usb node in vfxxx.dtsi file for both 
the peripheral and host usb nodes.

I used hdparm and dd for the tests. Some of the readings are below.

With this patchset applied

Reads
hdparm -t --direct /dev/sda

/dev/sda:
 Timing O_DIRECT disk reads:  36 MB in  3.05 seconds =  11.80 MB/sec

Writes
root at colibri-vf:~# time dd if=/dev/zero bs=128k count=4096
of=/media/sda1/tmpfile
4096+0 records in
4096+0 records out

real    1m11.671s
user    0m0.010s
sys     0m10.130s

USB Client - RNDIS

root at colibri-vf:~# iperf -c 192.168.1.1
------------------------------------------------------------
Client connecting to 192.168.1.1, TCP port 5001
TCP window size: 43.8 KByte (default)
------------------------------------------------------------
[  3] local 192.168.1.2 port 41317 connected with 192.168.1.1 port 5001
[ ID] Interval       Transfer     Bandwidth
[  3]  0.0-10.0 sec   105 MBytes  88.2 Mbits/sec

Without this patchset applied

Reads
hdparm -t --direct /dev/sda

/dev/sda:
 Timing O_DIRECT disk reads:  78 MB in  3.06 seconds =  25.50 MB/sec

Writes
root at colibri-vf:~# time dd if=/dev/zero bs=128k count=4096
of=/media/sda1/tmpfil
4096+0 records in
4096+0 records out

real    0m43.807s
user    0m0.050s
sys     0m9.960s

USB Client - RNDIS

root at colibri-vf:~# iperf -c 192.168.1.1
------------------------------------------------------------
Client connecting to 192.168.1.1, TCP port 5001
TCP window size: 43.8 KByte (default)
------------------------------------------------------------
[  3] local 192.168.1.2 port 49857 connected with 192.168.1.1 port 5001
[ ID] Interval       Transfer     Bandwidth
[  3]  0.0-10.0 sec   138 MBytes   116 Mbits/sec


Perhaps I am missing something? I have the ehci_hcd.park=3 set.

root at colibri-vf:~# cat /proc/cmdline
ehci_hcd.park=3 ubi.mtd=ubi root=ubi0:rootfs rootfstype=ubifs
ubi.fm_autoconvert=1 mtdparts=vf610_nfc:128k(vf-bcb)ro,1408k(
u-boot)ro,512k(u-boot-env),-(ubi) fec_mac= consoleblank=0 console=tty1
console=ttyLP0,115200n8 mem=256M

Is there any other parameter or variable I need to set?

- Sanchayan

> Peter Chen (12):
>   Doc: usb: ci-hdrc-imx: add gadget-itc-setting for binding doc
>   usb: chipidea: set ITC to 0 for device mode
>   usb: chipidea: define stream mode disable for both roles
>   usb: chipidea: imx: add stream mode enable for device mode at
>     imx6sl/imx6sx
>   usb: chipidea: introduce ci_platform_config
>   Doc: usb: ci-hdrc-imx: add ahb-burst-config for binding doc
>   ARM: imx6: set ahb-burst-config as 0 for USB
>   usb: chipidea: add ahb burst configuration
>   usb: chipidea: usbmisc_imx: add unburst setting for imx6
>   Doc: usb: ci-hdrc-imx: add tx(rx)-burst-config-dword for binding doc
>   ARM: imx6: change default burst size for USB
>   usb: chipidea: add burst size configuration interface
> 
>  .../devicetree/bindings/usb/ci-hdrc-imx.txt        |  12 +++
>  arch/arm/boot/dts/imx6qdl.dtsi                     |  12 +++
>  arch/arm/boot/dts/imx6sl.dtsi                      |   9 ++
>  arch/arm/boot/dts/imx6sx.dtsi                      |   9 ++
>  drivers/usb/chipidea/bits.h                        |   7 ++
>  drivers/usb/chipidea/ci.h                          |   3 +
>  drivers/usb/chipidea/ci_hdrc_imx.c                 |  14 ++-
>  drivers/usb/chipidea/core.c                        | 119 +++++++++++++++++++--
>  drivers/usb/chipidea/host.c                        |   6 +-
>  drivers/usb/chipidea/usbmisc_imx.c                 |  12 ++-
>  include/linux/usb/chipidea.h                       |  11 +-
>  11 files changed, 191 insertions(+), 23 deletions(-)
> 
> -- 
> 1.9.1
> 
> 
> _______________________________________________
> linux-arm-kernel mailing list
> linux-arm-kernel at lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* [PATCH 00/12] USB: chipidea: patchset for performance improvement
  2015-03-24 10:32 ` victorascroft at gmail.com
@ 2015-03-24 12:21   ` Peter Chen
  2015-03-26  8:34     ` victorascroft at gmail.com
  0 siblings, 1 reply; 20+ messages in thread
From: Peter Chen @ 2015-03-24 12:21 UTC (permalink / raw)
  To: linux-arm-kernel

On Tue, Mar 24, 2015 at 04:02:53PM +0530, victorascroft at gmail.com wrote:
> Hello Peter, 
> 
> On 15-03-19 09:19:11, Peter Chen wrote:
> > Hi all,
> > 
> > In this patch set, I add some interfaces for tuning the performance
> > of chipidea usb driver. With this set, the USB performance can be improved
> > at some user cases with suitable parameters. The main changes:
> > 
> > - Interface to tune interrupt threshold control, and set
> > 'Immediate' for default value
> > - The glue layer can disable stream mode according to USB role
> > - Interface to tune AHB burst configuration at SBUSCFG
> > - Interface to tune tx/rx burst size
> > - i.mx changes for achieving better performance, it can reduce
> >   the latecy between bus and USB FIFO, and reduce the overrun
> >   and underrun occurrences, it is useful for the system bus is busy.
> >   we see great improvement for ISO transfer, eg, high resolution
> >   USB camera when the bus is busy.
> > 
> > Below are some test results at imx6sx sdb board
> > (set ehci_hcd.park=3 at bootargs), the tests are done
> > at v4.0 kernel, no other bus loading during the tests,
> > so we have not seen performance change for some use cases.
> > 
> > USB Mass Storage (Host mode)
> > With Patch Set		Without Patch Set
> > R: 26.9 MB/s		27 MB/s
> > W: 25.2 MB/s		24.5 MB/s
> > 
> > 1G USB Ethernet Card
> > With Patch Set		Without Patch Set
> > TX: 186 Mb/s		185 Mb/s
> > RX: 219 Mb/s		216 Mb/s
> > 
> > g_ncm (Device Mode)
> > With Patch Set		Without Patch Set
> > TX: 166MB/s		163MB/s
> > RX: 230MB/s		184MB/s
> > 
> 
> I tested these patches on a Colibri Vybrid VF61. Have not applied the 
> 7th and 11th patch, but, the changes these patches introduce, I added 
> them to our device tree node. These would be  the addition of 
> ahb-burst-config = <0x0> and tx-burst-size-dword = <0x10> and 
> rx-burst-size-dword = <0x10> to the usb node in vfxxx.dtsi file for both 
> the peripheral and host usb nodes.
> 
> I used hdparm and dd for the tests. Some of the readings are below.
> 
> With this patchset applied
> 
> Reads
> hdparm -t --direct /dev/sda
> 
> /dev/sda:
>  Timing O_DIRECT disk reads:  36 MB in  3.05 seconds =  11.80 MB/sec
> 
> Writes
> root at colibri-vf:~# time dd if=/dev/zero bs=128k count=4096
> of=/media/sda1/tmpfile
> 4096+0 records in
> 4096+0 records out
> 
> real    1m11.671s
> user    0m0.010s
> sys     0m10.130s
> 
> USB Client - RNDIS
> 
> root at colibri-vf:~# iperf -c 192.168.1.1
> ------------------------------------------------------------
> Client connecting to 192.168.1.1, TCP port 5001
> TCP window size: 43.8 KByte (default)
> ------------------------------------------------------------
> [  3] local 192.168.1.2 port 41317 connected with 192.168.1.1 port 5001
> [ ID] Interval       Transfer     Bandwidth
> [  3]  0.0-10.0 sec   105 MBytes  88.2 Mbits/sec
> 
> Without this patchset applied
> 
> Reads
> hdparm -t --direct /dev/sda
> 
> /dev/sda:
>  Timing O_DIRECT disk reads:  78 MB in  3.06 seconds =  25.50 MB/sec
> 
> Writes
> root at colibri-vf:~# time dd if=/dev/zero bs=128k count=4096
> of=/media/sda1/tmpfil
> 4096+0 records in
> 4096+0 records out
> 
> real    0m43.807s
> user    0m0.050s
> sys     0m9.960s
> 
> USB Client - RNDIS
> 
> root at colibri-vf:~# iperf -c 192.168.1.1
> ------------------------------------------------------------
> Client connecting to 192.168.1.1, TCP port 5001
> TCP window size: 43.8 KByte (default)
> ------------------------------------------------------------
> [  3] local 192.168.1.2 port 49857 connected with 192.168.1.1 port 5001
> [ ID] Interval       Transfer     Bandwidth
> [  3]  0.0-10.0 sec   138 MBytes   116 Mbits/sec
> 
> 
> Perhaps I am missing something? I have the ehci_hcd.park=3 set.
> 
> root at colibri-vf:~# cat /proc/cmdline
> ehci_hcd.park=3 ubi.mtd=ubi root=ubi0:rootfs rootfstype=ubifs
> ubi.fm_autoconvert=1 mtdparts=vf610_nfc:128k(vf-bcb)ro,1408k(
> u-boot)ro,512k(u-boot-env),-(ubi) fec_mac= consoleblank=0 console=tty1
> console=ttyLP0,115200n8 mem=256M
> 
> Is there any other parameter or variable I need to set?

Hi Sanchayan,

The dts setting is specific for i.mx6 (maybe i.mx5 is applicate),
and it needs below patch to co-work with it, it is an i.mx
controller specific improvement (not in core).
> >   usb: chipidea: usbmisc_imx: add unburst setting for imx6

Other chipidea SoCs may have optimized parameters than default ones, it
needs to check with IC guys.

Enable stream mode should improve tx performance, you can have a try.

> 
> - Sanchayan
> 
> > Peter Chen (12):
> >   Doc: usb: ci-hdrc-imx: add gadget-itc-setting for binding doc
> >   usb: chipidea: set ITC to 0 for device mode
> >   usb: chipidea: define stream mode disable for both roles
> >   usb: chipidea: imx: add stream mode enable for device mode at
> >     imx6sl/imx6sx
> >   usb: chipidea: introduce ci_platform_config
> >   Doc: usb: ci-hdrc-imx: add ahb-burst-config for binding doc
> >   ARM: imx6: set ahb-burst-config as 0 for USB
> >   usb: chipidea: add ahb burst configuration
> >   usb: chipidea: usbmisc_imx: add unburst setting for imx6
> >   Doc: usb: ci-hdrc-imx: add tx(rx)-burst-config-dword for binding doc
> >   ARM: imx6: change default burst size for USB
> >   usb: chipidea: add burst size configuration interface
> > 
> >  .../devicetree/bindings/usb/ci-hdrc-imx.txt        |  12 +++
> >  arch/arm/boot/dts/imx6qdl.dtsi                     |  12 +++
> >  arch/arm/boot/dts/imx6sl.dtsi                      |   9 ++
> >  arch/arm/boot/dts/imx6sx.dtsi                      |   9 ++
> >  drivers/usb/chipidea/bits.h                        |   7 ++
> >  drivers/usb/chipidea/ci.h                          |   3 +
> >  drivers/usb/chipidea/ci_hdrc_imx.c                 |  14 ++-
> >  drivers/usb/chipidea/core.c                        | 119 +++++++++++++++++++--
> >  drivers/usb/chipidea/host.c                        |   6 +-
> >  drivers/usb/chipidea/usbmisc_imx.c                 |  12 ++-
> >  include/linux/usb/chipidea.h                       |  11 +-
> >  11 files changed, 191 insertions(+), 23 deletions(-)
> > 
> > -- 
> > 1.9.1
> > 
> > 
> > _______________________________________________
> > linux-arm-kernel mailing list
> > linux-arm-kernel at lists.infradead.org
> > http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
> 

-- 

Best Regards,
Peter Chen

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

* [PATCH 00/12] USB: chipidea: patchset for performance improvement
  2015-03-24 12:21   ` Peter Chen
@ 2015-03-26  8:34     ` victorascroft at gmail.com
  0 siblings, 0 replies; 20+ messages in thread
From: victorascroft at gmail.com @ 2015-03-26  8:34 UTC (permalink / raw)
  To: linux-arm-kernel

Hello Peter,

On 15-03-24 20:21:47, Peter Chen wrote:
> On Tue, Mar 24, 2015 at 04:02:53PM +0530, victorascroft at gmail.com wrote:
> > Hello Peter, 
> > 
> > On 15-03-19 09:19:11, Peter Chen wrote:
> > > Hi all,
> > > 
> > > In this patch set, I add some interfaces for tuning the performance
> > > of chipidea usb driver. With this set, the USB performance can be improved
> > > at some user cases with suitable parameters. The main changes:
> > > 
> > > - Interface to tune interrupt threshold control, and set
> > > 'Immediate' for default value
> > > - The glue layer can disable stream mode according to USB role
> > > - Interface to tune AHB burst configuration at SBUSCFG
> > > - Interface to tune tx/rx burst size
> > > - i.mx changes for achieving better performance, it can reduce
> > >   the latecy between bus and USB FIFO, and reduce the overrun
> > >   and underrun occurrences, it is useful for the system bus is busy.
> > >   we see great improvement for ISO transfer, eg, high resolution
> > >   USB camera when the bus is busy.
> > > 
> > > Below are some test results at imx6sx sdb board
> > > (set ehci_hcd.park=3 at bootargs), the tests are done
> > > at v4.0 kernel, no other bus loading during the tests,
> > > so we have not seen performance change for some use cases.
> > > 
> > > USB Mass Storage (Host mode)
> > > With Patch Set		Without Patch Set
> > > R: 26.9 MB/s		27 MB/s
> > > W: 25.2 MB/s		24.5 MB/s
> > > 
> > > 1G USB Ethernet Card
> > > With Patch Set		Without Patch Set
> > > TX: 186 Mb/s		185 Mb/s
> > > RX: 219 Mb/s		216 Mb/s
> > > 
> > > g_ncm (Device Mode)
> > > With Patch Set		Without Patch Set
> > > TX: 166MB/s		163MB/s
> > > RX: 230MB/s		184MB/s
> > > 
> > 
> > I tested these patches on a Colibri Vybrid VF61. Have not applied the 
> > 7th and 11th patch, but, the changes these patches introduce, I added 
> > them to our device tree node. These would be  the addition of 
> > ahb-burst-config = <0x0> and tx-burst-size-dword = <0x10> and 
> > rx-burst-size-dword = <0x10> to the usb node in vfxxx.dtsi file for both 
> > the peripheral and host usb nodes.
> > 
> > I used hdparm and dd for the tests. Some of the readings are below.
> > 
> > With this patchset applied
> > 
> > Reads
> > hdparm -t --direct /dev/sda
> > 
> > /dev/sda:
> >  Timing O_DIRECT disk reads:  36 MB in  3.05 seconds =  11.80 MB/sec
> > 
> > Writes
> > root at colibri-vf:~# time dd if=/dev/zero bs=128k count=4096
> > of=/media/sda1/tmpfile
> > 4096+0 records in
> > 4096+0 records out
> > 
> > real    1m11.671s
> > user    0m0.010s
> > sys     0m10.130s
> > 
> > USB Client - RNDIS
> > 
> > root at colibri-vf:~# iperf -c 192.168.1.1
> > ------------------------------------------------------------
> > Client connecting to 192.168.1.1, TCP port 5001
> > TCP window size: 43.8 KByte (default)
> > ------------------------------------------------------------
> > [  3] local 192.168.1.2 port 41317 connected with 192.168.1.1 port 5001
> > [ ID] Interval       Transfer     Bandwidth
> > [  3]  0.0-10.0 sec   105 MBytes  88.2 Mbits/sec
> > 
> > Without this patchset applied
> > 
> > Reads
> > hdparm -t --direct /dev/sda
> > 
> > /dev/sda:
> >  Timing O_DIRECT disk reads:  78 MB in  3.06 seconds =  25.50 MB/sec
> > 
> > Writes
> > root at colibri-vf:~# time dd if=/dev/zero bs=128k count=4096
> > of=/media/sda1/tmpfil
> > 4096+0 records in
> > 4096+0 records out
> > 
> > real    0m43.807s
> > user    0m0.050s
> > sys     0m9.960s
> > 
> > USB Client - RNDIS
> > 
> > root at colibri-vf:~# iperf -c 192.168.1.1
> > ------------------------------------------------------------
> > Client connecting to 192.168.1.1, TCP port 5001
> > TCP window size: 43.8 KByte (default)
> > ------------------------------------------------------------
> > [  3] local 192.168.1.2 port 49857 connected with 192.168.1.1 port 5001
> > [ ID] Interval       Transfer     Bandwidth
> > [  3]  0.0-10.0 sec   138 MBytes   116 Mbits/sec
> > 
> > 
> > Perhaps I am missing something? I have the ehci_hcd.park=3 set.
> > 
> > root at colibri-vf:~# cat /proc/cmdline
> > ehci_hcd.park=3 ubi.mtd=ubi root=ubi0:rootfs rootfstype=ubifs
> > ubi.fm_autoconvert=1 mtdparts=vf610_nfc:128k(vf-bcb)ro,1408k(
> > u-boot)ro,512k(u-boot-env),-(ubi) fec_mac= consoleblank=0 console=tty1
> > console=ttyLP0,115200n8 mem=256M
> > 
> > Is there any other parameter or variable I need to set?
> 
> Hi Sanchayan,
> 
> The dts setting is specific for i.mx6 (maybe i.mx5 is applicate),
> and it needs below patch to co-work with it, it is an i.mx
> controller specific improvement (not in core).
> > >   usb: chipidea: usbmisc_imx: add unburst setting for imx6
> 
> Other chipidea SoCs may have optimized parameters than default ones, it
> needs to check with IC guys.
> 
> Enable stream mode should improve tx performance, you can have a try.

I will give this a try in a while and check, if that helps.

Thanks.

- Sanchayan.

> 
> > 
> > - Sanchayan
> > 
> > > Peter Chen (12):
> > >   Doc: usb: ci-hdrc-imx: add gadget-itc-setting for binding doc
> > >   usb: chipidea: set ITC to 0 for device mode
> > >   usb: chipidea: define stream mode disable for both roles
> > >   usb: chipidea: imx: add stream mode enable for device mode at
> > >     imx6sl/imx6sx
> > >   usb: chipidea: introduce ci_platform_config
> > >   Doc: usb: ci-hdrc-imx: add ahb-burst-config for binding doc
> > >   ARM: imx6: set ahb-burst-config as 0 for USB
> > >   usb: chipidea: add ahb burst configuration
> > >   usb: chipidea: usbmisc_imx: add unburst setting for imx6
> > >   Doc: usb: ci-hdrc-imx: add tx(rx)-burst-config-dword for binding doc
> > >   ARM: imx6: change default burst size for USB
> > >   usb: chipidea: add burst size configuration interface
> > > 
> > >  .../devicetree/bindings/usb/ci-hdrc-imx.txt        |  12 +++
> > >  arch/arm/boot/dts/imx6qdl.dtsi                     |  12 +++
> > >  arch/arm/boot/dts/imx6sl.dtsi                      |   9 ++
> > >  arch/arm/boot/dts/imx6sx.dtsi                      |   9 ++
> > >  drivers/usb/chipidea/bits.h                        |   7 ++
> > >  drivers/usb/chipidea/ci.h                          |   3 +
> > >  drivers/usb/chipidea/ci_hdrc_imx.c                 |  14 ++-
> > >  drivers/usb/chipidea/core.c                        | 119 +++++++++++++++++++--
> > >  drivers/usb/chipidea/host.c                        |   6 +-
> > >  drivers/usb/chipidea/usbmisc_imx.c                 |  12 ++-
> > >  include/linux/usb/chipidea.h                       |  11 +-
> > >  11 files changed, 191 insertions(+), 23 deletions(-)
> > > 
> > > -- 
> > > 1.9.1
> > > 
> > > 
> > > _______________________________________________
> > > linux-arm-kernel mailing list
> > > linux-arm-kernel at lists.infradead.org
> > > http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
> > 
> 
> -- 
> 
> Best Regards,
> Peter Chen

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

end of thread, other threads:[~2015-03-26  8:34 UTC | newest]

Thread overview: 20+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-03-19  1:19 [PATCH 00/12] USB: chipidea: patchset for performance improvement Peter Chen
2015-03-19  1:19 ` [PATCH 01/12] Doc: usb: ci-hdrc-imx: add gadget-itc-setting for binding doc Peter Chen
2015-03-19  1:19 ` [PATCH 02/12] usb: chipidea: set ITC to 0 for device mode Peter Chen
2015-03-19  1:19 ` [PATCH 03/12] usb: chipidea: define stream mode disable for both roles Peter Chen
2015-03-19  1:19 ` [PATCH 04/12] usb: chipidea: imx: add stream mode enable for device mode at imx6sl/imx6sx Peter Chen
2015-03-19  1:19 ` [PATCH 05/12] usb: chipidea: introduce ci_platform_config Peter Chen
2015-03-19 10:19   ` Michael Grzeschik
2015-03-20  2:36     ` Peter Chen
2015-03-19  1:19 ` [PATCH 06/12] Doc: usb: ci-hdrc-imx: add ahb-burst-config for binding doc Peter Chen
2015-03-19  1:19 ` [PATCH 07/12] ARM: imx6: set ahb-burst-config as 0 for USB Peter Chen
2015-03-19  1:19 ` [PATCH 08/12] usb: chipidea: add ahb burst configuration Peter Chen
2015-03-19  1:19 ` [PATCH 09/12] usb: chipidea: usbmisc_imx: add unburst setting for imx6 Peter Chen
2015-03-19  1:19 ` [PATCH 10/12] Doc: usb: ci-hdrc-imx: add tx(rx)-burst-config-dword for binding doc Peter Chen
2015-03-19  1:19 ` [PATCH 11/12] ARM: imx6: change default burst size for USB Peter Chen
2015-03-19  1:19 ` [PATCH 12/12] usb: chipidea: add burst size configuration interface Peter Chen
2015-03-19 10:36 ` [PATCH 00/12] USB: chipidea: patchset for performance improvement Jean-Christophe PLAGNIOL-VILLARD
2015-03-20  2:33   ` Peter Chen
2015-03-24 10:32 ` victorascroft at gmail.com
2015-03-24 12:21   ` Peter Chen
2015-03-26  8:34     ` victorascroft at gmail.com

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