Skip to contentSkip to conversation

USB: chipidea: patchset for performance improvement

PATCH New Peter Chen 4 participants 20 messages Mar 19, 2015 – Mar 26, 2015

Subsystems (4)
lore
Share & tools
lore

Peter Chen

author
#0 lore raw

cover USB: chipidea: patchset for performance improvement

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(-)
Signature · 1 line
1.9.1
author
#1 lore raw

PATCH 1/12 Doc: usb: ci-hdrc-imx: add gadget-itc-setting for binding doc

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

---
 Documentation/devicetree/bindings/usb/ci-hdrc-imx.txt | 3 +++
 1 file changed, 3 insertions(+)
Documentation/devicetree/bindings/usb/ci-hdrc-imx.txt +3 -0
index 38a5480..c21171e 100644
@@ -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 */
 };
Signature · 1 line
1.9.1
author
#2 lore raw

PATCH 2/12 usb: chipidea: set ITC to 0 for device mode

In reply to Peter Chen

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.

---
 drivers/usb/chipidea/core.c  | 19 +++++++++++++++++++
 include/linux/usb/chipidea.h |  2 ++
 2 files changed, 21 insertions(+)
drivers/usb/chipidea/core.c +19 -0
index 74fea4f..8af9cbf 100644
@@ -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;
 }
 
include/linux/usb/chipidea.h +2 -0
index ab94f78..e69d829 100644
@@ -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 */
Signature · 1 line
1.9.1
author
#3 lore raw

PATCH 3/12 usb: chipidea: define stream mode disable for both roles

In reply to Peter Chen

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

---
 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(-)
drivers/usb/chipidea/core.c +1 -1
index 8af9cbf..4d79392 100644
@@ -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) {
drivers/usb/chipidea/host.c +3 -3
index 21fe1a3..b262c1c 100644
@@ -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:
include/linux/usb/chipidea.h +4 -1
index e69d829..d3906a4 100644
@@ -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
Signature · 1 line
1.9.1
author
#4 lore raw

PATCH 4/12 usb: chipidea: imx: add stream mode enable for device mode at imx6sl/imx6sx

In reply to Peter Chen

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.

---
 drivers/usb/chipidea/ci_hdrc_imx.c | 14 +++++++++-----
 1 file changed, 9 insertions(+), 5 deletions(-)
drivers/usb/chipidea/ci_hdrc_imx.c +9 -5
index 389f0e0..5373984 100644
@@ -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 =
Signature · 1 line
1.9.1
author
#5 lore raw

PATCH 5/12 usb: chipidea: introduce ci_platform_config

In reply to Peter Chen

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

---
 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(-)
drivers/usb/chipidea/ci.h +2 -0
index aeec5f0..888606b 100644
@@ -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 */
drivers/usb/chipidea/core.c +40 -17

81 lines not on this page · raw message

drivers/usb/chipidea/host.c +1 -5
index b262c1c..c4f76b7 100644
@@ -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;
 
Signature · 1 line
1.9.1
#6 lore raw

PATCH 5/12 usb: chipidea: introduce ci_platform_config

Quoted 87 lines · Peter Chen

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

---
 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(-)
drivers/usb/chipidea/ci.h +2 -0
index aeec5f0..888606b 100644
@@ -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 */
drivers/usb/chipidea/core.c +38 -10
index 4d79392..f713e32 100644
@@ -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);

drivers/usb/chipidea/core.c int hw_device_reset(struct ci_hdrc *ci) · line 472

Quoted 10 lines
drivers/usb/chipidea/core.c +0 -7
 	/* 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.

Quoted 36 lines
drivers/usb/chipidea/core.c +2 -0
 	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;
 }
 
drivers/usb/chipidea/host.c +1 -5
index b262c1c..c4f76b7 100644
@@ -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;
 
Signature · 6 lines
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
Signature · 4 lines
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 |
author
#7 lore raw

PATCH 5/12 usb: chipidea: introduce ci_platform_config

Quoted 91 lines · Michael Grzeschik
Quoted 90 lines · Peter Chen

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

---
 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(-)
drivers/usb/chipidea/ci.h +2 -0
index aeec5f0..888606b 100644
@@ -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 */
drivers/usb/chipidea/core.c +38 -10
index 4d79392..f713e32 100644
@@ -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);
 
Quoted 12 lines

drivers/usb/chipidea/core.c int hw_device_reset(struct ci_hdrc *ci) · line 472

Quoted 7 lines
drivers/usb/chipidea/core.c +0 -7
-	/*
-	 * 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

Quoted 42 lines
Quoted 36 lines
drivers/usb/chipidea/core.c +2 -0
 	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;
 }
 
drivers/usb/chipidea/host.c +1 -5
index b262c1c..c4f76b7 100644
@@ -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;
 
Signature · 6 lines
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
Signature · 4 lines
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 |
Signature · 2 lines
Best Regards,
Peter Chen
author
#8 lore raw

PATCH 6/12 Doc: usb: ci-hdrc-imx: add ahb-burst-config for binding doc

In reply to Peter Chen

It is used to change ahb burst configuration for platforms.

---
 Documentation/devicetree/bindings/usb/ci-hdrc-imx.txt | 3 +++
 1 file changed, 3 insertions(+)
Documentation/devicetree/bindings/usb/ci-hdrc-imx.txt +3 -0
index c21171e..a548502 100644
@@ -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 */
 };
Signature · 1 line
1.9.1
author
#9 lore raw

PATCH 7/12 ARM: imx6: set ahb-burst-config as 0 for USB

In reply to Peter Chen

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

---
 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(+)
arch/arm/boot/dts/imx6qdl.dtsi +4 -0
index d6c69ec..2430cc9 100644
@@ -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";
 			};
 
arch/arm/boot/dts/imx6sl.dtsi +3 -0
index 36ab8e0..9f283cc 100644
@@ -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";
 			};
 
arch/arm/boot/dts/imx6sx.dtsi +3 -0
index 7a24fee..0cdfa01 100644
@@ -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";
 			};
 
Signature · 1 line
1.9.1
author
#10 lore raw

PATCH 8/12 usb: chipidea: add ahb burst configuration

In reply to Peter Chen

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

---
 drivers/usb/chipidea/bits.h  |  3 +++
 drivers/usb/chipidea/core.c  | 18 ++++++++++++++++++
 include/linux/usb/chipidea.h |  2 ++
 3 files changed, 23 insertions(+)
drivers/usb/chipidea/bits.h +3 -0
index 3cb9bda..3af6213 100644
@@ -25,6 +25,9 @@
 #define VERSION		      (0xF << 25)
 #define CIVERSION	      (0x7 << 29)
 
+/* SBUSCFG */
+#define AHBBRST_MASK  0x7
+
 /* HCCPARAMS */
 #define HCCPARAMS_LEN         BIT(17)
 
drivers/usb/chipidea/core.c +18 -0
index f713e32..c0e6bb1 100644
@@ -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;
 }
 
include/linux/usb/chipidea.h +2 -0
index d3906a4..4d7ceb3 100644
@@ -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 */
Signature · 1 line
1.9.1
author
#11 lore raw

PATCH 9/12 usb: chipidea: usbmisc_imx: add unburst setting for imx6

In reply to Peter Chen

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.

---
 drivers/usb/chipidea/usbmisc_imx.c | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)
drivers/usb/chipidea/usbmisc_imx.c +10 -2
index 8af070f..6a6e73c 100644
@@ -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;
Signature · 1 line
1.9.1
author
#12 lore raw

PATCH 10/12 Doc: usb: ci-hdrc-imx: add tx(rx)-burst-config-dword for binding doc

In reply to Peter Chen

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

---
 Documentation/devicetree/bindings/usb/ci-hdrc-imx.txt | 6 ++++++
 1 file changed, 6 insertions(+)
Documentation/devicetree/bindings/usb/ci-hdrc-imx.txt +6 -0
index a548502..892bac8 100644
@@ -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>;
 };
Signature · 1 line
1.9.1
author
#13 lore raw

PATCH 11/12 ARM: imx6: change default burst size for USB

In reply to Peter Chen

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.

---
 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(+)
arch/arm/boot/dts/imx6qdl.dtsi +8 -0
index 2430cc9..4446218 100644
@@ -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";
 			};
 
arch/arm/boot/dts/imx6sl.dtsi +6 -0
index 9f283cc..9117c4c 100644
@@ -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";
 			};
 
arch/arm/boot/dts/imx6sx.dtsi +6 -0
index 0cdfa01..464cc3a 100644
@@ -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";
 			};
 
Signature · 1 line
1.9.1
author
#14 lore raw

PATCH 12/12 usb: chipidea: add burst size configuration interface

In reply to Peter Chen

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

---
 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(+)
drivers/usb/chipidea/bits.h +4 -0
index 3af6213..466ce89 100644
@@ -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)
drivers/usb/chipidea/ci.h +1 -0
index 888606b..232156b 100644
@@ -50,6 +50,7 @@ enum ci_hw_regs {
 	OP_USBINTR,
 	OP_DEVICEADDR,
 	OP_ENDPTLISTADDR,
+	OP_BURSTSIZE,
 	OP_PORTSC,
 	OP_DEVLC,
 	OP_OTGSC,
drivers/usb/chipidea/core.c +39 -0
index c0e6bb1..beb4236 100644
@@ -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;
 }
 
include/linux/usb/chipidea.h +2 -0
index 4d7ceb3..b5f0d7b 100644
@@ -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 */
Signature · 1 line
1.9.1
#15 lore raw

cover USB: chipidea: patchset for performance improvement

In reply to Peter Chen
Quoted 32 lines · Peter Chen

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

Quoted 4 lines

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.

author
#16 lore raw

cover USB: chipidea: patchset for performance improvement

Quoted 33 lines · Jean-Christophe PLAGNIOL-VILLARD
Quoted 32 lines · Peter Chen

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

Quoted 9 lines
Quoted 4 lines

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?

Signature · 2 lines
Best Regards,
Peter Chen
#17 lore raw

cover USB: chipidea: patchset for performance improvement

In reply to Peter Chen

Hello Peter,

Quoted 32 lines · Peter Chen

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

Quoted 5 lines

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

Quoted 36 lines

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(-)
Signature · 7 lines
1.9.1


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel at lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
author
#18 lore raw

cover USB: chipidea: patchset for performance improvement

Quoted 111 lines · victorascroft at gmail.com

Hello Peter,

Quoted 32 lines · Peter Chen

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

Quoted 5 lines

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.

Quoted 7 lines

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

Quoted 1 line
Quoted 1 line

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.

Quoted 40 lines

- Sanchayan

Quoted 36 lines

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(-)
Signature · 7 lines
1.9.1


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel at lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
Signature · 2 lines
Best Regards,
Peter Chen
#19 lore raw

cover USB: chipidea: patchset for performance improvement

Hello Peter,

Quoted 125 lines · Peter Chen
Quoted 111 lines · victorascroft at gmail.com

Hello Peter,

Quoted 32 lines · Peter Chen

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

Quoted 5 lines

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.

Quoted 7 lines

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

Quoted 6 lines
Quoted 1 line
Quoted 1 line

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.

Quoted 46 lines
Quoted 41 lines

- Sanchayan

Quoted 36 lines

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(-)
Signature · 7 lines
1.9.1


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel at lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
Signature · 2 lines
Best Regards,
Peter Chen