This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Linux/AM5718: USB1 and PCIe configuration

Part Number: AM5718

Tool/software: Linux

Hi,

It is possible to use the usb1 controller using USB2PHY1 and at the same time using PCIe using USB3_PHY from the usb1 subsystem ?

How to modify OCP2SCP3 and OCP2SCP1 settings in the device tree ?

i.e: remove usb3_phy1 and enable pcie2_phy ?

Best regards,

Romain

  • Hi, Romain,

    Yes, it is possible. Please refer to Chapter 24.2, the PCIe controller, of the device TRM. Because PCIe port 1 is shared among PCIe_SS1, PCIe_SS2 and USB3.0, when PCIe_SS2 is enabled, each PCIe SS should have only 1 lane configured. The guideline is PCIe2_phy needs to move from under PCIe_SS1 to under PCIe_SS2 in the current device tree. The usb3.0 node should not be defined in the device tree either. There may be other changes needed which you may want to tweak and test.

    Rex
  • Hi Rex,

    Ok it's possible.

    We are able to use the two PCIe interfaces if the usb1 is keep disabled in the devicetree.

    But as soon as the usb1 is enabled, we have an abort [1] from xhci_hub_status_data().

    We removed usb3_phy1 from OCP2SCP1 and added pcie2_phy.

    For usb1, we removed usb3_phy1 and changed the usb speed to high-speed.

    		/* OCP2SCP3 */
    		ocp2scp@4a090000 {
    			compatible = "ti,omap-ocp2scp";
    			#address-cells = <1>;
    			#size-cells = <1>;
    			ranges;
    			reg = <0x4a090000 0x20>;
    			ti,hwmods = "ocp2scp3";
    			sata_phy: phy@4A096000 {
    				compatible = "ti,phy-pipe3-sata";
    				reg = <0x4A096000 0x80>, /* phy_rx */
    				      <0x4A096400 0x64>, /* phy_tx */
    				      <0x4A096800 0x40>; /* pll_ctrl */
    				reg-names = "phy_rx", "phy_tx", "pll_ctrl";
    				syscon-phy-power = <&scm_conf 0x374>;
    				clocks = <&sys_clkin1>, <&sata_ref_clk>;
    				clock-names = "sysclk", "refclk";
    				syscon-pllreset = <&scm_conf 0x3fc>;
    				#phy-cells = <0>;
    			};
    
    			pcie1_phy: pciephy@4a094000 {
    				compatible = "ti,phy-pipe3-pcie";
    				reg = <0x4a094000 0x80>, /* phy_rx */
    				      <0x4a094400 0x64>; /* phy_tx */
    				reg-names = "phy_rx", "phy_tx";
    				syscon-phy-power = <&scm_conf_pcie 0x1c>;
    				syscon-pcs = <&scm_conf_pcie 0x10>;
    				clocks = <&dpll_pcie_ref_ck>,
    					 <&dpll_pcie_ref_m2ldo_ck>,
    					 <&optfclk_pciephy1_32khz>,
    					 <&optfclk_pciephy1_clk>,
    					 <&optfclk_pciephy1_div_clk>,
    					 <&optfclk_pciephy_div>,
    					 <&sys_clkin1>;
    				clock-names = "dpll_ref", "dpll_ref_m2",
    					      "wkupclk", "refclk",
    					      "div-clk", "phy-div", "sysclk";
    				#phy-cells = <0>;
    			};
    
    		};

    		/* OCP2SCP1 */
    		ocp2scp@4a080000 {
    			compatible = "ti,omap-ocp2scp";
    			#address-cells = <1>;
    			#size-cells = <1>;
    			ranges;
    			reg = <0x4a080000 0x20>;
    			ti,hwmods = "ocp2scp1";
    
    			usb2_phy1: phy@4a084000 {
    				compatible = "ti,dra7x-usb2", "ti,omap-usb2";
    				reg = <0x4a084000 0x400>;
    				syscon-phy-power = <&scm_conf 0x300>;
    				clocks = <&usb_phy1_always_on_clk32k>,
    					 <&usb_otg_ss1_refclk960m>;
    				clock-names =	"wkupclk",
    						"refclk";
    				#phy-cells = <0>;
    			};
    
    			usb2_phy2: phy@4a085000 {
    				compatible = "ti,dra7x-usb2-phy2",
    					     "ti,omap-usb2";
    				reg = <0x4a085000 0x400>;
    				status = "disabled";
    				syscon-phy-power = <&scm_conf 0xe74>;
    				clocks = <&usb_phy2_always_on_clk32k>,
    					 <&usb_otg_ss2_refclk960m>;
    				clock-names =	"wkupclk",
    						"refclk";
    				#phy-cells = <0>;
    			};
    
    			/* usb3_phy1 removed and replaced by pcie2_phy */
    
    			pcie2_phy: pciephy@4a084400 {
    				compatible = "ti,phy-pipe3-pcie";
    				reg = <0x4a084400 0x80>, /* phy_rx */
    				      <0x4a084800 0x64>; /* phy_tx */
    				reg-names = "phy_rx", "phy_tx";
    				syscon-phy-power = <&scm_conf_pcie 0x20>;
    				syscon-pcs = <&scm_conf_pcie 0x10>;
    				clocks = <&dpll_pcie_ref_ck>,
    					 <&dpll_pcie_ref_m2ldo_ck>,
    					 <&optfclk_pciephy2_32khz>,
    					 <&optfclk_pciephy2_clk>,
    					 <&optfclk_pciephy2_div_clk>,
    					 <&optfclk_pciephy_div>,
    					 <&sys_clkin1>;
    				clock-names = "dpll_ref", "dpll_ref_m2",
    					      "wkupclk", "refclk",
    					      "div-clk", "phy-div", "sysclk";
    				#phy-cells = <0>;
    			};
    		};
    
    		omap_dwc3_1: omap_dwc3_1@48880000 {
    			compatible = "ti,dwc3";
    			ti,hwmods = "usb_otg_ss1";
    			reg = <0x48880000 0x10000>;
    			interrupts = <GIC_SPI 72 IRQ_TYPE_LEVEL_HIGH>;
    			#address-cells = <1>;
    			#size-cells = <1>;
    			utmi-mode = <2>;
    			ranges;
    			usb1: usb@48890000 {
    				status = "disabled";
    				compatible = "snps,dwc3";
    				reg = <0x48890000 0x17000>;
    				interrupts = <GIC_SPI 71 IRQ_TYPE_LEVEL_HIGH>,
    					     <GIC_SPI 71 IRQ_TYPE_LEVEL_HIGH>,
    					     <GIC_SPI 72 IRQ_TYPE_LEVEL_HIGH>;
    				interrupt-names = "peripheral",
    						  "host",
    						  "otg";
    				phys = <&usb2_phy1>; /* usb3_phy1 removed */
    				phy-names = "usb2-phy"; /* usb3-phy removed */
    				tx-fifo-resize;
    				maximum-speed = "high-speed"; /* super-speed changed to high-speed */
    				dr_mode = "otg";
    				snps,dis_u2_susphy_quirk; /* dis_u3_susphy_quirk removed */
    			};
    		};
    		axi@1 {
    			compatible = "simple-bus";
    			#size-cells = <1>;
    			#address-cells = <1>;
    			ranges = <0x51800000 0x51800000 0x3000
    				  0x0	     0x30000000 0x10000000>;
    			status = "okay";
    			pcie2_rc: pcie@51800000 {
    				compatible = "ti,dra7-pcie";
    				reg = <0x51800000 0x2000>, <0x51802000 0x14c>, <0x1000 0x2000>;
    				reg-names = "rc_dbics", "ti_conf", "config";
    				interrupts = <0 355 0x4>, <0 356 0x4>;
    				#address-cells = <3>;
    				#size-cells = <2>;
    				device_type = "pci";
    				ranges = <0x81000000 0 0          0x03000 0 0x00010000
    					  0x82000000 0 0x30013000 0x13000 0 0xffed000>;
    				#interrupt-cells = <1>;
    				num-lanes = <1>;
    				linux,pci-domain = <1>;
    				ti,hwmods = "pcie2";
    				phys = <&pcie2_phy>;
    				phy-names = "pcie-phy0";
    				interrupt-map-mask = <0 0 0 7>;
    				interrupt-map = <0 0 0 1 &pcie2_intc 1>,
    						<0 0 0 2 &pcie2_intc 2>,
    						<0 0 0 3 &pcie2_intc 3>,
    						<0 0 0 4 &pcie2_intc 4>;
    				status = "disabled";		
    				pcie2_intc: interrupt-controller {
    					interrupt-controller;
    					#address-cells = <0>;
    					#interrupt-cells = <1>;
    				};
    			};
    		};

    Finally, we have the abort [1] when we enable usb1 in host mode in the custom_board.dts:

    /* triger: Unhandled fault: asynchronous external abort (0x1211) at 0x00000000 */
    &usb1 {
    	status = "okay";
    	dr_mode = "host";
    };

    Do you see any config problem ?

    Best regards,

    Romain

    [1] Unhandled fault: asynchronous external abort (0x1211) at 0x00000000

  • Hi,

    Here is the dmesg about usb devices:

    [    3.175660] ehci_hcd: USB 2.0 'Enhanced' Host Controller (EHCI) Driver
    [    3.182219] ehci-pci: EHCI PCI platform driver
    [    3.186731] ehci-omap: OMAP-EHCI Host Controller driver
    [    3.200132] ohci_hcd: USB 1.1 'Open' Host Controller (OHCI) Driver
    [    3.206356] ohci-pci: OHCI PCI platform driver
    [    3.211146] xhci-hcd xhci-hcd.0.auto: xHCI Host Controller
    [    3.216678] xhci-hcd xhci-hcd.0.auto: new USB bus registered, assigned bus number 1
    [    3.224780] xhci-hcd xhci-hcd.0.auto: hcc params 0x0220f04c hci version 0x100 quirks 0x00210810
    [    3.233543] xhci-hcd xhci-hcd.0.auto: irq 420, io mem 0x48890000
    [    3.239693] usb usb1: New USB device found, idVendor=1d6b, idProduct=0002
    [    3.246519] usb usb1: New USB device strings: Mfr=3, Product=2, SerialNumber=1
    [    3.253778] usb usb1: Product: xHCI Host Controller
    [    3.258672] usb usb1: Manufacturer: Linux 4.4.57-ga5602579fd xhci-hcd
    [    3.265144] usb usb1: SerialNumber: xhci-hcd.0.auto
    [    3.270423] hub 1-0:1.0: USB hub found
    [    3.278593] hub 1-0:1.0: 1 port detected
    [    3.291510] xhci-hcd xhci-hcd.0.auto: xHCI Host Controller
    [    3.297035] xhci-hcd xhci-hcd.0.auto: new USB bus registered, assigned bus number 2
    [    3.313620] usb usb2: New USB device found, idVendor=1d6b, idProduct=0003
    [    3.320436] usb usb2: New USB device strings: Mfr=3, Product=2, SerialNumber=1
    [    3.327695] usb usb2: Product: xHCI Host Controller
    [    3.332598] usb usb2: Manufacturer: Linux 4.4.57-ga5602579fd xhci-hcd
    [    3.339062] usb usb2: SerialNumber: xhci-hcd.0.auto
    [    3.344313] hub 2-0:1.0: USB hub found
    [    3.352476] hub 2-0:1.0: 1 port detected
    [    3.365498] usbcore: registered new interface driver usb-storage
    [    3.414923] ------------[ cut here ]------------
    [    3.414939] WARNING: CPU: 0 PID: 10 at ../drivers/bus/omap_l3_noc.c:147 l3_interrupt_handler+0x25c/0x368()
    [    3.415461] ---[ end trace 38b515f79fd44176 ]---
    [    3.450846] Unhandled fault: asynchronous external abort (0x1211) at 0x00000000
    

    Why usb2 is enabled ? it is explicitly disabled in the device tree.

    Best regards,

    Romain 

  • Hi, Romain,

    Just want to let you know that I have an USB expert looking at this, and it may take a while before he posts his finding.

    Rex
  • Romain,

    The 'external abort' happens when the usb super-speed phy driver is not loaded, it seems somewhere in the USB drivers try to access the phy module but it is not clocked. I have reported this issue to the development team. I will update in here when I get response.

  • Hi,

    Do you have any news ?

    As far I can see, the dwc3 Linux driver really use phy2 and phy3 unconditionally.
    I'm not convinced about the possibility to use the usb1 controller without the phy USB3.
  • Hi,

    Here is the DWC3 hardware revision controller used by the AM5718: 0x5533202A
    I noticed it's affected by a hardware bug (limitation) where Port Disable command doesn't work.
    What does it mean exactly ? Where I can find a good documentation for all "quirk" and optional properties ?

    The DWC3_GHWPARAMS3 contains the value 0x1042008C which means that SuperSpeed is supported by the DWC3 controller.
    How can avoid xHCI layer to see an USB3 port ?

    Best regards,
    Romain
  • Romain,

    Our development team did initial investigation and found more effort is required to understand the problem to find a solution, so now the issue report is on the backlog, hopefully the issue will be solved in the next Processor SDK release.

    I believe configuring USB1 to not use USB3_PHY is possible. On AM571x IDK evm USB1 is high-speed only. The USB3_PHY is not used for USB1. So this is a working example.

    AM572x IDK evm configures USB1 to super-speed, USB3_PHY is used by USB1. If modify DTS to remove USB3_PHY from USB1, the issue your reported happens. This is a failure example.

    Both AM571x IDK and AM572x IDK use the same USB drivers, the only difference I can see is AM571x IDK doesn't bring out the USB1 super-speed signal lines. I think we need to understand if this hw design is required, or sw change only is sufficient.

    To answer your questions above, the DWC3 driver does have phy2 and phy3 nodes, but they can take a dummy phy instance, so the physical phy3 can be absence in DTS.

    I don't think the issue is related to the advisory i896 you mentioned, not to mention its sw workaround is already implemented in Processor SDK 4.0 kernel.

    I have checked with the kernel community mailing list, disabling USB3 port in xHCI layer breaks the spec, it is not a recommended path to go.

  • Hi Bin,

    Thanks for your reply.

    When you said "AM571x IDK doesn't bring out the USB1 super-speed signal lines", you mean that the bug appear just because the wire USB_RXN0, USB_RXP0 and USB_TXN0, USB_TXP0 are connected to something ?
    Do you think it would be possible to add some DWC3 quirk ?

    Please, can you notify me if any patches for this issue are included in the SDK.

    Best regards,
    Romain
  • Romain,

    Romain Naour said:
    When you said "AM571x IDK doesn't bring out the USB1 super-speed signal lines", you mean that the bug appear just because the wire USB_RXN0, USB_RXP0 and USB_TXN0, USB_TXP0 are connected to something ?

    No, I am not sure if if the issue is related to those signals. That is just the hw difference I see.

    Romain Naour said:
    Do you think it would be possible to add some DWC3 quirk ?

    Until we know the root cause, I am not sure what quirk we can implemement.

    Romain Naour said:
    Please, can you notify me if any patches for this issue are included in the SDK.

    Definitely I will.

  • Hello Bin,

    We found another issue related on the DWC3 usb port.

    Since we can't use usb1 for now, we switched to the usb2 port.
    We enabled it successfully but the port crash with one of our usb key.

    We are able to reproduce the issue on our custom board but also on the AM5718 IDK board.

    The usb key involved is an EMTEC 64Go USB3.0 [1] partitioned with an ext4 filesystem. (msdos as partition table).

    # mount /dev/sda1 /mnt/
    EXT4-fs (sda1): mounted filesystem with ordered data mode. Opts: (null)
    # cd /mnt/
    # ls
    [~ nothing during 5-10 sec]
    usb usb1-port1: Cannot enable. Maybe the USB cable is bad?
    usb usb1-port1: Cannot enable. Maybe the USB cable is bad?
    usb usb1-port1: Cannot enable. Maybe the USB cable is bad?
    usb usb1-port1: Cannot enable. Maybe the USB cable is bad?
    usb 1-1: USB disconnect, device number 2
    blk_update_request: I/O error, dev sda, sector 4258048
    blk_update_request: I/O error, dev sda, sector 76040
    blk_update_request: I/O error, dev sda, sector 25430016
    Buffer I/O error on dev sda1, logical block 3178496, lost sync page write
    blk_update_request: I/O error, dev sda, sector 4258288
    EXT4-fs warning (device sda1): htree_dirblock_to_tree:958: inode #2: lblock 0: comm ls: error -5 reading directory block
    blk_update_request: I/O error, dev sda, sector 4258528
    blk_update_request: I/O error, dev sda, sector 4258768
    blk_update_request: I/O error, dev sda, sector 4259008
    blk_update_request: I/O error, dev sda, sector 4259248
    blk_update_request: I/O error, dev sda, sector 4259488
    blk_update_request: I/O error, dev sda, sector 4259728
    JBD2: Error -5 detected when updating journal superblock for sda1-8.
    Aborting journal on device sda1-8.
    Buffer I/O error on dev sda1, logical block 3178496, lost sync page write
    JBD2: Error -5 detected when updating journal superblock for sda1-8.
    usb usb1-port1: Cannot enable. Maybe the USB cable is bad?
    usb usb1-port1: Cannot enable. Maybe the USB cable is bad?
    usb usb1-port1: unable to enumerate USB device

    After the last message, the usb key is not anymore detected by the system.

    This is weird since the log "Cannot enable. Maybe the USB cable is bad?" comme from hub_port_reset() function (drivers/usb/core/hub.c).
    As the comment above the function sais: This function "handle port reset and port warm(BH) reset (for USB3 protocol ports)".

    We can see on the dmesg log two USB hub. The first one is an USB2.0 hub but the second is an USB3.0 hub.

    xhci-hcd xhci-hcd.0.auto: xHCI Host Controller
    xhci-hcd xhci-hcd.0.auto: new USB bus registered, assigned bus number 1
    xhci-hcd xhci-hcd.0.auto: hcc params 0x0220f04c hci version 0x100 quirks 0x00210010
    xhci-hcd xhci-hcd.0.auto: irq 486, io mem 0x488d0000
    usb usb1: New USB device found, idVendor=1d6b, idProduct=0002
    usb usb1: New USB device strings: Mfr=3, Product=2, SerialNumber=1
    usb usb1: Product: xHCI Host Controller
    usb usb1: Manufacturer: Linux 4.4.57+ xhci-hcd
    usb usb1: SerialNumber: xhci-hcd.0.auto
    hub 1-0:1.0: USB hub found
    hub 1-0:1.0: 1 port detected

    xhci-hcd xhci-hcd.0.auto: xHCI Host Controller
    xhci-hcd xhci-hcd.0.auto: new USB bus registered, assigned bus number 2
    usb usb2: We don't know the algorithms for LPM for this host, disabling LPM.
    usb usb2: New USB device found, idVendor=1d6b, idProduct=0003
    usb usb2: New USB device strings: Mfr=3, Product=2, SerialNumber=1
    usb usb2: Product: xHCI Host Controller
    usb usb2: Manufacturer: Linux 4.4.57+ xhci-hcd
    usb usb2: SerialNumber: xhci-hcd.0.auto
    hub 2-0:1.0: USB hub found
    hub 2-0:1.0: 1 port detected

    So the USB3.0 hub is still present in the system even if the usb2 doesn't have the USB3.0 phy.

    Do you have an idea ?
    It's true that you can argue that our usb key is broken but the kernel usb/DWC3 stack should handle this error correctly.

    [1] www.emtec-international.com/.../c410-color-mix

    Best regards,
    Romain
  • Romain,

    Romain Naour said:
    The usb key involved is an EMTEC 64Go USB3.0 [1]

    It seems the device is not available in US market, I can only find USB2.0 C410 thumb drives here.

    Romain Naour said:
    usb usb1-port1: unable to enumerate USB device

    After the last message, the usb key is not anymore detected by the system.

    Do you mean the usb key is no longer detected if you unplug it and re-plug it back again? Can the usb port enumerate any other USB device at this point? If not, there is a problem. But if the USB port can still detect new attachment, this is not an issue.

    Romain Naour said:
    This is weird since the log "Cannot enable. Maybe the USB cable is bad?" comme from hub_port_reset() function (drivers/usb/core/hub.c).
    As the comment above the function sais: This function "handle port reset and port warm(BH) reset (for USB3 protocol ports)".

    This comment is confusion, it actually means "handle port reset (for all USB protocols - including USB2.0 and USB3.0), and port warm reset (for USB3.0)".

    Romain Naour said:
    So the USB3.0 hub is still present in the system even if the usb2 doesn't have the USB3.0 phy.

    Correct, in Linux driver architecture, the PHY is independent to controllers. xHCI defines each controller to have a USB2.0 logical port and a USB3.x logical port, so both USB buses (or virtual hubs) will present.

    Romain Naour said:
    It's true that you can argue that our usb key is broken but the kernel usb/DWC3 stack should handle this error correctly.

    If the USB port can still detect any new device attach, there is no issue here. Otherwise if the USB port is no longer detecting any new attach, the port is locked up, this is a problem.

    If you are looking for a sw workaround to the failure with EMTEC usb key, please try to add "usbcore.autosuspend=-1" in U-Boot bootargs parameter, it is not guaranteed this will solve the issue though.

  • Hi Bin,

    The usb key is not detected anymore even after unplug and re-plug. The USB port is no longer detecting any new attach.
    Adding "usbcore.autosuspend=-1" in the bootargs doesn't fix/workaround the issue.

    This is not a blocker issue for us, we can use the usb port with other usb device. But I wanted to let you know about this issue.

    Our main issue is still to be able to use the USB1 (usb2_ph1).

    Thanks for the quick feedback.

    Romain
  • Romain,

    Can you please try to use "usbcore.old_scheme_first=1" parameter instead for this USB2 port issue?
  • Hi Bin,

    No luck, the usb port is still stuck.
    The parameter is present in the kernel command line (verified with cat /proc/cmdline)

    Romain
  • Romain,

    Thanks for testing.

    I will let you know as soon as I have the kernel patches for the USB3 phy problem.
  • Romain,

    For the USB2.0 with EMTEC usb key issue, I am wondering if it is just the USB port got disabled or locked up.

    Can you please run the following command to unbind and re-bind the xhci driver after the issue happened to see if the USB port comes back to work?

    root@am57xx-evm:~# cd /sys/bus/platform/drivers/xhci-hcd/

    root@am57xx-evm:xhci-hcd# echo xhci-hcd.1.auto > unbind

    root@am57xx-evm:xhci-hcd# echo xhci-hcd.1.auto > bind

    If the USB port doesn't recover, does warm reset using "reboot" command to restart Linux make the USB port work or you have to power cycle the board?

  • Hi Bin,

    Here is the result of unbind and re-bind the xhci driver.

    /sys/bus/platform/drivers/xhci-hcd# echo "xhci-hcd.0.auto" > unbind
    xhci-hcd xhci-hcd.0.auto: remove, state 4
    usb usb2: USB disconnect, device number 1
    xhci-hcd xhci-hcd.0.auto: USB bus 2 deregistered
    xhci-hcd xhci-hcd.0.auto: remove, state 4
    usb usb1: USB disconnect, device number 1
    xhci-hcd xhci-hcd.0.auto: USB bus 1 deregistered

    /sys/bus/platform/drivers/xhci-hcd# echo xhci-hcd.0.auto bind
    xhci-hcd xhci-hcd.0.auto: xHCI Host Controller
    xhci-hcd xhci-hcd.0.auto: new USB bus registered, assigned bus number 1
    xhci-hcd xhci-hcd.0.auto: hcc params 0x0220f04c hci version 0x100 quirks 0x00210010
    xhci-hcd xhci-hcd.0.auto: irq 484, io mem 0x488d0000
    usb usb1: New USB device found, idVendor=1d6b, idProduct=0002
    usb usb1: New USB device strings: Mfr=3, Product=2, SerialNumber=1
    usb usb1: Product: xHCI Host Controller
    usb usb1: Manufacturer: Linux 4.4.57+ xhci-hcd
    usb usb1: SerialNumber: xhci-hcd.0.auto
    hub 1-0:1.0: USB hub found
    hub 1-0:1.0: 1 port detected
    xhci-hcd xhci-hcd.0.auto: xHCI Host Controller
    xhci-hcd xhci-hcd.0.auto: new USB bus registered, assigned bus number 2
    usb usb2: We don't know the algorithms for LPM for this host, disabling LPM.
    usb usb2: New USB device found, idVendor=1d6b, idProduct=0003
    usb usb2: New USB device strings: Mfr=3, Product=2, SerialNumber=1
    usb usb2: Product: xHCI Host Controller
    usb usb2: Manufacturer: Linux 4.4.57+ xhci-hcd
    usb usb2: SerialNumber: xhci-hcd.0.auto
    hub 2-0:1.0: USB hub found
    hub 2-0:1.0: 1 port detected

    So, the port seems to recover correctly.
    Obviously the same problem occur if we try to mount and list the filesystem content.

    Best regards,
    Romain
  • Romain,

    The log shows the xHCI is loaded again, have you tried to attach a thumb drive to see it enumerates? I want to see if the port is unlocked after reloaded the xHCI driver.

    Thanks for testing it.
  • Hello Bin, Romain has been called in another project so I'm taking the hold of his work on the USB.

    I tried attaching a thumb drive after reloading the driver, here's the logs :


    # === Plug usb :
    
     usb 1-1: new high-speed USB device nud
     usb 1-1: New USB device found, idVendor=13fe, idProduct=5500
     usb 1-1: New USB device strings: Mfr=1, Product=2, SerialNumber=3
     usb 1-1: Product: USB DISK 3.0
     usb 1-1: Manufacturer:
     usb 1-1: SerialNumber: 070A6BF92517CB42
     usb-storage 1-1:1.0: USB Mass Storage device detected
     scsi host3: usb-storage 1-1:1.0
     scsi 3:0:0:0: Direct-Access              USB DISK 3.0     PMAP PQ: 0 ANSI: 6
     sd 3:0:0:0: [sda] 121012224 512-byte logical blocks: (62.0 GB/57.7 GiB)
     sd 3:0:0:0: [sda] Write Protect is off
     sd 3:0:0:0: [sda] No Caching mode page found
     sd 3:0:0:0: [sda] Assuming drive cache: write through
      sda: sda1
     sd 3:0:0:0: [sda] Attached SCSI removable disk
    
    # === Mounting USB
    
    /sys/bus/platform/drivers/xhci-hcd# mount /dev/sda1 /mnt
     EXT4-fs (sda1): recovery complete
     EXT4-fs (sda1): mounted filesystem with ordered data mode. Opts: (null)
    
    /sys/bus/platform/drivers/xhci-hcd# ls /mnt/
     usb usb1-port1: Cannot enable. Maybe the USB cable is bad?
     usb usb1-port1: Cannot enable. Maybe the USB cable is bad?
     usb usb1-port1: Cannot enable. Maybe the USB cable is bad?
     usb usb1-port1: Cannot enable. Maybe the USB cable is bad?
     usb 1-1: USB disconnect, device number 4
     blk_update_request: 11 callbacks suppressed
     blk_update_request: I/O error, dev sda, sector 10512
     blk_update_request: I/O error, dev sda, sector 75912
     blk_update_request: I/O error, dev sda, sector 25430016
     Buffer I/O error on dev sda1, logical block 3178496, lost sync page write
     blk_update_request: I/O error, dev sda, sector 10752
     EXT4-fs warning (device sda1): htree_dirblock_to_tree:958: inode #2: lblock 0: comm ls: ek
     blk_update_request: I/O error, dev sda, sector 10992
     blk_update_request: I/O error, dev sda, sector 11232
     blk_update_request: I/O error, dev sda, sector 11472
     blk_update_request: I/O error, dev sda, sector 11712
     blk_update_request: I/O error, dev sda, sector 11952
     blk_update_request: I/O error, dev sda, sector 12192
     JBD2: Error -5 detected when updating journal superblock for sda1-8.
     Aborting journal on device sda1-8.
     Buffer I/O error on dev sda1, logicale
     JBD2: Error -5 detected when updating journal superblock for sda1-8.
     usb usb1-port1: Cannot enable. Maybe the USB cable is bad?
     usb usb1-port1: Cannot enable. Maybe the USB cable is bad?
     usb usb1-port1: Cannot enable. Maybe the USB cable is bad?
     usb usb1-port1: Cannot enable. Maybe the USB cable is bad?
     usb usb1-port1: unable to enumerate USB device
    
    /sys/bus/platform/drivers/xhci-hcd# ls /dev/sd*
    ls: /dev/sd*: No such file or directory
    
    # === Reload the xHCI driver
    
    /sys/bus/platform/drivers/xhci-hcd# echo "xhci-hcd.0.auto" > unbind
     xhci-hcd xhci-hcd.0.auto: remove, state 4
     usb usb2: USB disconnect, device number 1
     xhci-hcd xhci-hcd.0.auto: USB bus 2 deregistered
     xhci-hcd xhci-hcd.0.auto: remove, state 4
     usb usb1: USB disconnect, device number 1
     xhci-hcd xhci-hcd.0.auto: USB bus 1 deregistered
    
    /sys/bus/platform/drivers/xhci-hcd# echo "xhci-hcd.0.auto" > bind
     xhci-hcd xhci-hcd.0.auto: xHCI Host Controller
     xhci-hcd xhci-hcd.0.auto: new USB bus registered, assigned bus number 1
     xhci-hcd xhci-hcd.0.auto: hcc params 0x0220f04c hci version 0x100 quirks 0x00210010
     xhci-hcd xhci-hcd.0.auto: irq 486, io mem 0x488d0000
     usb usb1: New USB device found, idVendor=1d6b, idProduct=0002
     usb usb1: New USB device strings: Mfr=3, Product=2, SerialNumber=1
     usb usb1: Product: xHCI Host Controller
     usb usb1: Manufacturer: Linux 4.4.57+ xhci-hcd
     usb usb1: SerialNumber: xhci-hcd.0.auto
     hub 1-0:1.0: USB hub found
     hub 1-0:1.0: 1 port detected
     xhci-hcd xhci-hcd.0.auto: xHCI Host Controller
     xhci-hcd xhci-hcd.0.auto: new USB bus registered, assigned bus number 2
     usb usb2: We don't know the algorithms for LPM for this host, disabling LPM.
     usb usb2: New USB device found, idVendor=1d6b, idProduct=0003
     usb usb2: New USB device strings: Mfr=3, Product=2, SerialNumber=1
     usb usb2: Product: xHCI Host Controller
     usb usb2: Manufacturer: Linux 4.4.57+ xhci-hcd
     usb usb2: SerialNumber: xhci-hcd.0.auto
     hub 2-0:1.0: USB hub found
     hub 2-0:1.0: 1 port detected
     usb 1-1: new high-speed USB device nud
     usb 1-1: New USB device found, idVendor=13fe, idProduct=5500
     usb 1-1: New USB device strings: Mfr=1, Product=2, SerialNumber=3
     usb 1-1: Product: USB DISK 3.0
     usb 1-1: Manufacturer:
     usb 1-1: SerialNumber: 070A6BF92517CB42
     usb-storage 1-1:1.0: USB Mass Storage device detected
     scsi host4: usb-storage 1-1:1.0
     scsi 4:0:0:0: Direct-Access              USB DISK 3.0     PMAP PQ: 0 ANSI: 6
     sd 4:0:0:0: [sdb] 121012224 512-byte logical blocks: (62.0 GB/57.7 GiB)
     sd 4:0:0:0: [sdb] Write Protect is off
     sd 4:0:0:0: [sdb] No Caching mode page found
     sd 4:0:0:0: [sdb] Assuming drive cache: write through
      sdb: sdb1
     sd 4:0:0:0: [sdb] Attached SCSI removable disk
    
    /sys/bus/platform/drivers/xhci-hcd# ls /dev/sd*
    /dev/sdb   /dev/sdb1
    
    # === Unplug USB
    
     usb 1-1: USB disconnect, device number 3
    
    # === Plug another USB
    
     usb 1-1: new high-speed USB device number 7 using xhci-hcd
     usb 1-1: New USB device found, idVendor=abcd, idProduct=1234
     usb 1-1: New USB device strings: Mfr=1, Product=2, SerialNumber=3
     usb 1-1: Product: UDisk
     usb 1-1: Manufacturer: General
     usb 1-1: SerialNumber: ÐЉ
     usb-storage 1-1:1.0: USB Mass Storage device detected
     scsi host9: usb-storage 1-1:1.0
     scsi 9:0:0:0: Direct-Access     General  UDisk            5.00 PQ: 0 ANSI: 2
     sd 9:0:0:0: [sdb] 3934208 512-byte logical blocks: (2.01 GB/1.88 GiB)
     sd 9:0:0:0: [sdb] Write Protect is off
     sd 9:0:0:0: [sdb] No Caching mode page found
     sd 9:0:0:0: [sdb] Assuming drive cache: write through
      sdb: sdb1
     sd 9:0:0:0: [sdb] Attached SCSI removable disk
    
    /sys/bus/platform/drivers/xhci-hcd# mount /dev/sdb1 /mnt/
     EXT4-fs (sdb1): mounted filesystem with ordered data mode. Opts: (null)
    
    /sys/bus/platform/drivers/xhci-hcd# ls /mnt/
    dummyfile
    


    So in fact it seems that the usb key has been recognized right after binding back the driver. I then tried another usb stick with an ext4 filesystem, the mounting/reading/writing went successfully.

    Of course, by trying to mount back the EMTEC usb key, the problem still occurs.

  • Kamel,

    Thanks for testing. It appears the USB port is recovered after re-bind the xhci driver. I will try to locate a RMTEC usb drive to understand how the port is disabled. I understand this is low priority for your project.

    Back the the original issue, is the USB1 port designed as host-only mode in your project? You don't use USB1 as a device port, right.
  • Hi Ben,

    Yes in fact it would be nice if the kernel recovered from that error, but we're more concerned about the USB1 & PCIe configuration problem.

    Yes the USB1 port is designed as host-only mode. In the device tree, we're declaring it as being host :

    /* triger: Unhandled fault: asynchronous external abort (0x1211) at 0x00000000 */
    &usb1 {
    	status = "okay";
    	dr_mode = "host";
    };

  • Kamel,

    I don't think there is way to automatically recover a disabled xhci host port. We could only figure out what causes the port get disabled and if possible to avoid it.

    For the original issue, while our dev is still working on a proper solution, here is a temporary workaround which probably could let your project move forward.

    In your DTS file remove the USB3.0 phy from USB1 node as you did before. Here is mine:

    diff --git a/arch/arm/boot/dts/dra7.dtsi b/arch/arm/boot/dts/dra7.dtsi
    index 226b64610f40..fb23416e5e57 100644
    --- a/arch/arm/boot/dts/dra7.dtsi
    +++ b/arch/arm/boot/dts/dra7.dtsi
    @@ -1719,10 +1719,10 @@
                                    interrupt-names = "peripheral",
                                                      "host",
                                                      "otg";
    -                               phys = <&usb2_phy1>, <&usb3_phy1>;
    -                               phy-names = "usb2-phy", "usb3-phy";
    -                               maximum-speed = "super-speed";
    -                               dr_mode = "otg";
    +                               phys = <&usb2_phy1>;
    +                               phy-names = "usb2-phy";
    +                               maximum-speed = "high-speed";
    +                               dr_mode = "host";
                                    snps,dis_u3_susphy_quirk;
                                    snps,dis_u2_susphy_quirk;
                                    snps,devctrl_halt_quirk;
    

    Then disable USB3 in xhci driver using the following patch.

    diff --git a/drivers/usb/host/xhci.c b/drivers/usb/host/xhci.c
    index 0452040c0cc8..b6f80c54ae8f 100644
    --- a/drivers/usb/host/xhci.c
    +++ b/drivers/usb/host/xhci.c
    @@ -4965,7 +4965,7 @@ int xhci_gen_setup(struct usb_hcd *hcd, xhci_get_quirks_t get_quirks)
             * generic hardware linkage
             */
            .irq =                  xhci_irq,
    -       .flags =                HCD_MEMORY | HCD_USB3 | HCD_SHARED,
    +       .flags =                HCD_MEMORY | HCD_USB2 | HCD_SHARED,
     
            /*
             * basic lifecycle operations
    

    After kernel booted, run the following command to switch the USB3.0 PHY from USB to PCIe.

    # devmem2 0x4a003c3c w 0xc

    During kernel booting you will see kernel warning dump for "drivers/usb/core/port.c:319 link_peers". This warning can be ignored, USB2.0 port should work now. Please let me know if you have any issue with this workaround.

  • Hello Bin,

    Bin Liu said:

    I don't think there is way to automatically recover a disabled xhci host port. We could only figure out what causes the port get disabled and if possible to avoid it.

    Ah right, that would be even better in that case !

    Bin Liu said:

    For the original issue, while our dev is still working on a proper solution, here is a temporary workaround which probably could let your project move forward.

    In your DTS file remove the USB3.0 phy from USB1 node as you did before. Here is mine:

    diff --git a/arch/arm/boot/dts/dra7.dtsi b/arch/arm/boot/dts/dra7.dtsi
    index 226b64610f40..fb23416e5e57 100644
    --- a/arch/arm/boot/dts/dra7.dtsi
    +++ b/arch/arm/boot/dts/dra7.dtsi
    @@ -1719,10 +1719,10 @@
                                    interrupt-names = "peripheral",
                                                      "host",
                                                      "otg";
    -                               phys = <&usb2_phy1>, <&usb3_phy1>;
    -                               phy-names = "usb2-phy", "usb3-phy";
    -                               maximum-speed = "super-speed";
    -                               dr_mode = "otg";
    +                               phys = <&usb2_phy1>;
    +                               phy-names = "usb2-phy";
    +                               maximum-speed = "high-speed";
    +                               dr_mode = "host";
                                    snps,dis_u3_susphy_quirk;
                                    snps,dis_u2_susphy_quirk;
                                    snps,devctrl_halt_quirk;
    

    Then disable USB3 in xhci driver using the following patch.

    diff --git a/drivers/usb/host/xhci.c b/drivers/usb/host/xhci.c
    index 0452040c0cc8..b6f80c54ae8f 100644
    --- a/drivers/usb/host/xhci.c
    +++ b/drivers/usb/host/xhci.c
    @@ -4965,7 +4965,7 @@ int xhci_gen_setup(struct usb_hcd *hcd, xhci_get_quirks_t get_quirks)
             * generic hardware linkage
             */
            .irq =                  xhci_irq,
    -       .flags =                HCD_MEMORY | HCD_USB3 | HCD_SHARED,
    +       .flags =                HCD_MEMORY | HCD_USB2 | HCD_SHARED,
     
            /*
             * basic lifecycle operations
    

    After kernel booted, run the following command to switch the USB3.0 PHY from USB to PCIe.

    # devmem2 0x4a003c3c w 0xc

    During kernel booting you will see kernel warning dump for "drivers/usb/core/port.c:319 link_peers". This warning can be ignored, USB2.0 port should work now. Please let me know if you have any issue with this workaround.

    Here are the results about the workaround :

    • The boot goes well, however i don't see any warning about link_peers.
    • If i try the devmem2 command, the whole board crashes. By looking at the register at address 0x4a003c3c (CTRL_CORE_PCIE_CONTROL), it looks like we're trying to set the pins to USB 1 SuperSpeed mode. We specifically did set this register to 0 (PCIESS1 and PCIESS2 mode) to allow our ethernet link to work properly.
    • However, when plugging an USB stick, it is recognized and works perfectly ! :)
    • When booting with the usb key inserted, the kernel displays the following error messages :
    usb 1-1: device descriptor read/64, error -110                                                                                       
    usb 2-1: new high-speed USB device number 4 using xhci-hcd                                                                           
    xhci-hcd xhci-hcd.0.auto: Timeout while waiting for setup device command                                                             
    xhci-hcd xhci-hcd.0.auto: Timeout while waiting for setup device command                                                             
    usb 2-1: device not accepting address 4, error -62                                                                                   
    usb 1-1: new high-speed USB device number 4 using xhci-hcd                                                                           
    xhci-hcd xhci-hcd.0.auto: Timeout while waiting for setup device command                                                             
    xhci-hcd xhci-hcd.0.auto: Timeout while waiting for setup device command                                                             
    usb 1-1: device not accepting address 4, error -62                                                                                   
    usb 2-1: new high-speed USB device number 5 using xhci-hcd                                                                           
    xhci-hcd xhci-hcd.0.auto: Timeout while waiting for setup device command                                                             
    xhci-hcd xhci-hcd.0.auto: Timeout while waiting for setup device command                                                             
    usb 2-1: device not accepting address 5, error -62                                                                                   
    usb usb2-port1: unable to enumerate USB device                                                                                       
    usb 1-1: new high-speed USB device number 5 using xhci-hcd                                                                           
    xhci-hcd xhci-hcd.0.auto: Timeout while waiting for setup device command                                                             
    xhci-hcd xhci-hcd.0.auto: Timeout while waiting for setup device command                                                             
    usb 1-1: device not accepting address 5, error -62                                                                                   
    usb usb1-port1: unable to enumerate USB device
      • If i unplug the usb key, the following message is printed :
    xhci-hcd xhci-hcd.0.auto: port 0 resume PLC timeout
      • And if i plug back the usb key :
    usb 1-1: new high-speed USB device number 6 using xhci-hcd
    usb 1-1: New USB device found, idVendor=abcd, idProduct=1234
    usb 1-1: New USB device strings: Mfr=1, Product=2, SerialNumber=3
    usb 1-1: Product: UDisk           
    usb 1-1: Manufacturer: General 
    usb 1-1: SerialNumber: Љ
    usb-storage 1-1:1.0: USB Mass Storage device detected
    scsi host0: usb-storage 1-1:1.0
    scsi 0:0:0:0: Direct-Access     General  UDisk            5.00 PQ: 0 
    ANSI: 2
    sd 0:0:0:0: [sda] 3934208 512-byte logical blocks: (2.01 GB/1.88 GiB)
    sd 0:0:0:0: [sda] Write Protect is off
    sd 0:0:0:0: [sda] No Caching mode page found
    sd 0:0:0:0: [sda] Assuming drive cache: write through
     sda: sda1
    sd 0:0:0:0: [sda] Attached SCSI removable disk
      • The usb key can then be mounted/unmounted with success

    So finaly, the patch on the xhci driver suffices to support usb, however we're still forced to unplug/replug the usb stick to make it work.

    Do you have any idea about making the usb recognized on start-up ?

    Many thanks to you and your dev team for your help !

  • Kamel,

    Kamel Hacene14 said:
    By looking at the register at address 0x4a003c3c (CTRL_CORE_PCIE_CONTROL), it looks like we're trying to set the pins to USB 1 SuperSpeed mode.

    By default the USB super-speed phy is connected to USB1, this command switch the phy to PCIe.

    Kamel Hacene14 said:
    • When booting with the usb key inserted, the kernel displays the following error messages :
    usb 1-1: device descriptor read/64, error -110   

    I see a slightly different behavior on AM571x-IDK evm, the error code is -71 and the enumeration will pass eventually, I don't have to unplug then plug back the device. But anyway, unfortunately I don't have a way to make the usb device recognized properly on start-up, we are working on a proper solution for this issue.

  • Hello,

    Bin Liu said:

    Kamel,

    Kamel Hacene14
    By looking at the register at address 0x4a003c3c (CTRL_CORE_PCIE_CONTROL), it looks like we're trying to set the pins to USB 1 SuperSpeed mode.

    By default the USB super-speed phy is connected to USB1, this command switch the phy to PCIe.

    That's strange, I'm currently using this documentation.  CTRL_CORE_PCIE_CONTROL seems to be in USB1 SuperSpeed mode by default (0x8), but we would want it to be set to 0x0 instead (we're using two PCIE slaves). We're setting this value directly in u-boot.

    Bin Liu said:
    Kamel Hacene14
    • When booting with the usb key inserted, the kernel displays the following error messages :
    usb 1-1: device descriptor read/64, error -110   

    I see a slightly different behavior on AM571x-IDK evm, the error code is -71 and the enumeration will pass eventually, I don't have to unplug then plug back the device. But anyway, unfortunately I don't have a way to make the usb device recognized properly on start-up, we are working on a proper solution for this issue.

    Oh ok, i will have a bit time to investigate on our unplug/plug issue next week.

    When trying to unbind and bind the driver, i get another error that looks a bit more like yours : drivers/usb/core/port.c:238 0xc0450bc0()