Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 8f28472a authored by Linus Torvalds's avatar Linus Torvalds
Browse files
Pull USB updates from Greg KH:
 "Here is the big USB patchset for 4.12-rc1.

  Lots of good stuff here, after many many many attempts, the kernel
  finally has a working typeC interface, many thanks to Heikki and
  Guenter and others who have taken the time to get this merged. It
  wasn't an easy path for them at all.

  There's also a staging driver that uses this new api, which is why
  it's coming in through this tree.

  Along with that, there's the usual huge number of changes for gadget
  drivers, xhci, and other stuff. Johan also finally refactored pretty
  much every driver that was looking at USB endpoints to do it in a
  common way, which will help prevent any "badly-formed" devices from
  causing problems in drivers. That too wasn't a simple task.

  All of these have been in linux-next for a while with no reported
  issues"

* tag 'usb-4.12-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb: (263 commits)
  staging: typec: Fairchild FUSB302 Type-c chip driver
  staging: typec: Type-C Port Controller Interface driver (tcpci)
  staging: typec: USB Type-C Port Manager (tcpm)
  usb: host: xhci: remove #ifdef around PM functions
  usb: musb: don't mark of_dev_auxdata as initdata
  usb: misc: legousbtower: Fix buffers on stack
  USB: Revert "cdc-wdm: fix "out-of-sync" due to missing notifications"
  usb: Make sure usb/phy/of gets built-in
  USB: storage: e-mail update in drivers/usb/storage/unusual_devs.h
  usb: host: xhci: print correct command ring address
  usb: host: xhci: delete sp_dma_buffers for scratchpad
  usb: host: xhci: using correct specification chapter reference for DCBAAP
  xhci: switch to pci_alloc_irq_vectors
  usb: host: xhci-plat: set resume_quirk() for R-Car controllers
  usb: host: xhci-plat: add resume_quirk()
  usb: host: xhci-plat: enable clk in resume timing
  usb: host: plat: Enable xHCI plat runtime PM
  USB: serial: ftdi_sio: add device ID for Microsemi/Arrow SF2PLUS Dev Kit
  USB: serial: constify static arrays
  usb: fix some references for /proc/bus/usb
  ...
parents 4ac4d584 c034a43e
Loading
Loading
Loading
Loading
+276 −0
Original line number Diff line number Diff line
USB Type-C port devices (eg. /sys/class/typec/port0/)

What:		/sys/class/typec/<port>/data_role
Date:		April 2017
Contact:	Heikki Krogerus <heikki.krogerus@linux.intel.com>
Description:
		The supported USB data roles. This attribute can be used for
		requesting data role swapping on the port. Swapping is supported
		as synchronous operation, so write(2) to the attribute will not
		return until the operation has finished. The attribute is
		notified about role changes so that poll(2) on the attribute
		wakes up. Change on the role will also generate uevent
		KOBJ_CHANGE on the port. The current role is show in brackets,
		for example "[host] device" when DRP port is in host mode.

		Valid values: host, device

What:		/sys/class/typec/<port>/power_role
Date:		April 2017
Contact:	Heikki Krogerus <heikki.krogerus@linux.intel.com>
Description:
		The supported power roles. This attribute can be used to request
		power role swap on the port when the port supports USB Power
		Delivery. Swapping is supported as synchronous operation, so
		write(2) to the attribute will not return until the operation
		has finished. The attribute is notified about role changes so
		that poll(2) on the attribute wakes up. Change on the role will
		also generate uevent KOBJ_CHANGE. The current role is show in
		brackets, for example "[source] sink" when in source mode.

		Valid values: source, sink

What:		/sys/class/typec/<port>/vconn_source
Date:		April 2017
Contact:	Heikki Krogerus <heikki.krogerus@linux.intel.com>
Description:
		Shows is the port VCONN Source. This attribute can be used to
		request VCONN swap to change the VCONN Source during connection
		when both the port and the partner support USB Power Delivery.
		Swapping is supported as synchronous operation, so write(2) to
		the attribute will not return until the operation has finished.
		The attribute is notified about VCONN source changes so that
		poll(2) on the attribute wakes up. Change on VCONN source also
		generates uevent KOBJ_CHANGE.

		Valid values:
		- "no" when the port is not the VCONN Source
		- "yes" when the port is the VCONN Source

What:		/sys/class/typec/<port>/power_operation_mode
Date:		April 2017
Contact:	Heikki Krogerus <heikki.krogerus@linux.intel.com>
Description:
		Shows the current power operational mode the port is in. The
		power operation mode means current level for VBUS. In case USB
		Power Delivery communication is used for negotiating the levels,
		power operation mode should show "usb_power_delivery".

		Valid values:
		- default
		- 1.5A
		- 3.0A
		- usb_power_delivery

What:		/sys/class/typec/<port>/preferred_role
Date:		April 2017
Contact:	Heikki Krogerus <heikki.krogerus@linux.intel.com>
Description:
		The user space can notify the driver about the preferred role.
		It should be handled as enabling of Try.SRC or Try.SNK, as
		defined in USB Type-C specification, in the port drivers. By
		default the preferred role should come from the platform.

		Valid values: source, sink, none (to remove preference)

What:		/sys/class/typec/<port>/supported_accessory_modes
Date:		April 2017
Contact:	Heikki Krogerus <heikki.krogerus@linux.intel.com>
Description:
		Space separated list of accessory modes, defined in the USB
		Type-C specification, the port supports.

What:		/sys/class/typec/<port>/usb_power_delivery_revision
Date:		April 2017
Contact:	Heikki Krogerus <heikki.krogerus@linux.intel.com>
Description:
		Revision number of the supported USB Power Delivery
		specification, or 0 when USB Power Delivery is not supported.

What:		/sys/class/typec/<port>/usb_typec_revision
Date:		April 2017
Contact:	Heikki Krogerus <heikki.krogerus@linux.intel.com>
Description:
		Revision number of the supported USB Type-C specification.


USB Type-C partner devices (eg. /sys/class/typec/port0-partner/)

What:		/sys/class/typec/<port>-partner/accessory_mode
Date:		April 2017
Contact:	Heikki Krogerus <heikki.krogerus@linux.intel.com>
Description:
		Shows the Accessory Mode name when the partner is an Accessory.
		The Accessory Modes are defined in USB Type-C Specification.

What:		/sys/class/typec/<port>-partner/supports_usb_power_delivery
Date:		April 2017
Contact:	Heikki Krogerus <heikki.krogerus@linux.intel.com>
Description:
		Shows if the partner supports USB Power Delivery communication:
		Valid values: yes, no

What:		/sys/class/typec/<port>-partner>/identity/
Date:		April 2017
Contact:	Heikki Krogerus <heikki.krogerus@linux.intel.com>
Description:
		This directory appears only if the port device driver is capable
		of showing the result of Discover Identity USB power delivery
		command. That will not always be possible even when USB power
		delivery is supported, for example when USB power delivery
		communication for the port is mostly handled in firmware. If the
		directory exists, it will have an attribute file for every VDO
		in Discover Identity command result.

What:		/sys/class/typec/<port>-partner/identity/id_header
Date:		April 2017
Contact:	Heikki Krogerus <heikki.krogerus@linux.intel.com>
Description:
		ID Header VDO part of Discover Identity command result. The
		value will show 0 until Discover Identity command result becomes
		available. The value can be polled.

What:		/sys/class/typec/<port>-partner/identity/cert_stat
Date:		April 2017
Contact:	Heikki Krogerus <heikki.krogerus@linux.intel.com>
Description:
		Cert Stat VDO part of Discover Identity command result. The
		value will show 0 until Discover Identity command result becomes
		available. The value can be polled.

What:		/sys/class/typec/<port>-partner/identity/product
Date:		April 2017
Contact:	Heikki Krogerus <heikki.krogerus@linux.intel.com>
Description:
		Product VDO part of Discover Identity command result. The value
		will show 0 until Discover Identity command result becomes
		available. The value can be polled.


USB Type-C cable devices (eg. /sys/class/typec/port0-cable/)

Note: Electronically Marked Cables will have a device also for one cable plug
(eg. /sys/class/typec/port0-plug0). If the cable is active and has also SOP
Double Prime controller (USB Power Deliver specification ch. 2.4) it will have
second device also for the other plug. Both plugs may have alternate modes as
described in USB Type-C and USB Power Delivery specifications.

What:		/sys/class/typec/<port>-cable/type
Date:		April 2017
Contact:	Heikki Krogerus <heikki.krogerus@linux.intel.com>
Description:
		Shows if the cable is active.
		Valid values: active, passive

What:		/sys/class/typec/<port>-cable/plug_type
Date:		April 2017
Contact:	Heikki Krogerus <heikki.krogerus@linux.intel.com>
Description:
		Shows type of the plug on the cable:
		- type-a - Standard A
		- type-b - Standard B
		- type-c
		- captive

What:		/sys/class/typec/<port>-cable/identity/
Date:		April 2017
Contact:	Heikki Krogerus <heikki.krogerus@linux.intel.com>
Description:
		This directory appears only if the port device driver is capable
		of showing the result of Discover Identity USB power delivery
		command. That will not always be possible even when USB power
		delivery is supported. If the directory exists, it will have an
		attribute for every VDO returned by Discover Identity command.

What:		/sys/class/typec/<port>-cable/identity/id_header
Date:		April 2017
Contact:	Heikki Krogerus <heikki.krogerus@linux.intel.com>
Description:
		ID Header VDO part of Discover Identity command result. The
		value will show 0 until Discover Identity command result becomes
		available. The value can be polled.

What:		/sys/class/typec/<port>-cable/identity/cert_stat
Date:		April 2017
Contact:	Heikki Krogerus <heikki.krogerus@linux.intel.com>
Description:
		Cert Stat VDO part of Discover Identity command result. The
		value will show 0 until Discover Identity command result becomes
		available. The value can be polled.

What:		/sys/class/typec/<port>-cable/identity/product
Date:		April 2017
Contact:	Heikki Krogerus <heikki.krogerus@linux.intel.com>
Description:
		Product VDO part of Discover Identity command result. The value
		will show 0 until Discover Identity command result becomes
		available. The value can be polled.


Alternate Mode devices.

The alternate modes will have Standard or Vendor ID (SVID) assigned by USB-IF.
The ports, partners and cable plugs can have alternate modes. A supported SVID
will consist of a set of modes. Every SVID a port/partner/plug supports will
have a device created for it, and every supported mode for a supported SVID will
have its own directory under that device. Below <dev> refers to the device for
the alternate mode.

What:		/sys/class/typec/<port|partner|cable>/<dev>/svid
Date:		April 2017
Contact:	Heikki Krogerus <heikki.krogerus@linux.intel.com>
Description:
		The SVID (Standard or Vendor ID) assigned by USB-IF for this
		alternate mode.

What:		/sys/class/typec/<port|partner|cable>/<dev>/mode<index>/
Date:		April 2017
Contact:	Heikki Krogerus <heikki.krogerus@linux.intel.com>
Description:
		Every supported mode will have its own directory. The name of
		a mode will be "mode<index>" (for example mode1), where <index>
		is the actual index to the mode VDO returned by Discover Modes
		USB power delivery command.

What:		/sys/class/typec/<port|partner|cable>/<dev>/mode<index>/description
Date:		April 2017
Contact:	Heikki Krogerus <heikki.krogerus@linux.intel.com>
Description:
		Shows description of the mode. The description is optional for
		the drivers, just like with the Billboard Devices.

What:		/sys/class/typec/<port|partner|cable>/<dev>/mode<index>/vdo
Date:		April 2017
Contact:	Heikki Krogerus <heikki.krogerus@linux.intel.com>
Description:
		Shows the VDO in hexadecimal returned by Discover Modes command
		for this mode.

What:		/sys/class/typec/<port|partner|cable>/<dev>/mode<index>/active
Date:		April 2017
Contact:	Heikki Krogerus <heikki.krogerus@linux.intel.com>
Description:
		Shows if the mode is active or not. The attribute can be used
		for entering/exiting the mode with partners and cable plugs, and
		with the port alternate modes it can be used for disabling
		support for specific alternate modes. Entering/exiting modes is
		supported as synchronous operation so write(2) to the attribute
		does not return until the enter/exit mode operation has
		finished. The attribute is notified when the mode is
		entered/exited so poll(2) on the attribute wakes up.
		Entering/exiting a mode will also generate uevent KOBJ_CHANGE.

		Valid values: yes, no

What:		/sys/class/typec/<port>/<dev>/mode<index>/supported_roles
Date:		April 2017
Contact:	Heikki Krogerus <heikki.krogerus@linux.intel.com>
Description:
		Space separated list of the supported roles.

		This attribute is available for the devices describing the
		alternate modes a port supports, and it will not be exposed with
		the devices presenting the alternate modes the partners or cable
		plugs support.

		Valid values: source, sink
+9 −0
Original line number Diff line number Diff line
What:		/sys/bus/platform/devices/ci_hdrc.0/role
Date:		Mar 2017
Contact:	Peter Chen <peter.chen@nxp.com>
Description:
		It returns string "gadget" or "host" when read it, it indicates
		current controller role.

		It will do role switch when write "gadget" or "host" to it.
		Only controller at dual-role configuration supports writing.
+15 −0
Original line number Diff line number Diff line
What:		/sys/devices/platform/<renesas_usb3's name>/role
Date:		March 2017
KernelVersion:	4.13
Contact:	Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
Description:
		This file can be read and write.
		The file can show/change the drd mode of usb.

		Write the following string to change the mode:
		 "host" - switching mode from peripheral to host.
		 "peripheral" - switching mode from host to peripheral.

		Read the file, then it shows the following strings:
		 "host" - The mode is host now.
		 "peripheral" - The mode is peripheral now.
+80 −13
Original line number Diff line number Diff line
@@ -6,12 +6,11 @@ This binding describes a usb3.0 phy for mt65xx platforms of Medaitek SoC.
Required properties (controller (parent) node):
 - compatible	: should be one of
		  "mediatek,mt2701-u3phy"
		  "mediatek,mt2712-u3phy"
		  "mediatek,mt8173-u3phy"
 - reg		: offset and length of register for phy, exclude port's
		  register.
 - clocks	: a list of phandle + clock-specifier pairs, one for each
		  entry in clock-names
 - clock-names	: must contain
 - clocks	: (deprecated, use port's clocks instead) a list of phandle +
		  clock-specifier pairs, one for each entry in clock-names
 - clock-names	: (deprecated, use port's one instead) must contain
		  "u3phya_ref": for reference clock of usb3.0 analog phy.

Required nodes	: a sub-node is required for each port the controller
@@ -19,8 +18,19 @@ Required nodes : a sub-node is required for each port the controller
		  'reg' property is used inside these nodes to describe
		  the controller's topology.

Optional properties (controller (parent) node):
 - reg		: offset and length of register shared by multiple ports,
		  exclude port's private register. It is needed on mt2701
		  and mt8173, but not on mt2712.

Required properties (port (child) node):
- reg		: address and length of the register set for the port.
- clocks	: a list of phandle + clock-specifier pairs, one for each
		  entry in clock-names
- clock-names	: must contain
		  "ref": 48M reference clock for HighSpeed analog phy; and 26M
			reference clock for SuperSpeed analog phy, sometimes is
			24M, 25M or 27M, depended on platform.
- #phy-cells	: should be 1 (See second example)
		  cell after port phandle is phy type from:
			- PHY_TYPE_USB2
@@ -31,21 +41,31 @@ Example:
u3phy: usb-phy@11290000 {
	compatible = "mediatek,mt8173-u3phy";
	reg = <0 0x11290000 0 0x800>;
	clocks = <&apmixedsys CLK_APMIXED_REF2USB_TX>;
	clock-names = "u3phya_ref";
	#address-cells = <2>;
	#size-cells = <2>;
	ranges;
	status = "okay";

	phy_port0: port@11290800 {
		reg = <0 0x11290800 0 0x800>;
	u2port0: usb-phy@11290800 {
		reg = <0 0x11290800 0 0x100>;
		clocks = <&apmixedsys CLK_APMIXED_REF2USB_TX>;
		clock-names = "ref";
		#phy-cells = <1>;
		status = "okay";
	};

	u3port0: usb-phy@11290900 {
		reg = <0 0x11290800 0 0x700>;
		clocks = <&clk26m>;
		clock-names = "ref";
		#phy-cells = <1>;
		status = "okay";
	};

	phy_port1: port@11291000 {
		reg = <0 0x11291000 0 0x800>;
	u2port1: usb-phy@11291000 {
		reg = <0 0x11291000 0 0x100>;
		clocks = <&apmixedsys CLK_APMIXED_REF2USB_TX>;
		clock-names = "ref";
		#phy-cells = <1>;
		status = "okay";
	};
@@ -64,7 +84,54 @@ Example:

usb30: usb@11270000 {
	...
	phys = <&phy_port0 PHY_TYPE_USB3>;
	phy-names = "usb3-0";
	phys = <&u2port0 PHY_TYPE_USB2>, <&u3port0 PHY_TYPE_USB3>;
	phy-names = "usb2-0", "usb3-0";
	...
};


Layout differences of banks between mt8173/mt2701 and mt2712
-------------------------------------------------------------
mt8173 and mt2701:
port        offset    bank
shared      0x0000    SPLLC
            0x0100    FMREG
u2 port0    0x0800    U2PHY_COM
u3 port0    0x0900    U3PHYD
            0x0a00    U3PHYD_BANK2
            0x0b00    U3PHYA
            0x0c00    U3PHYA_DA
u2 port1    0x1000    U2PHY_COM
u3 port1    0x1100    U3PHYD
            0x1200    U3PHYD_BANK2
            0x1300    U3PHYA
            0x1400    U3PHYA_DA
u2 port2    0x1800    U2PHY_COM
            ...

mt2712:
port        offset    bank
u2 port0    0x0000    MISC
            0x0100    FMREG
            0x0300    U2PHY_COM
u3 port0    0x0700    SPLLC
            0x0800    CHIP
            0x0900    U3PHYD
            0x0a00    U3PHYD_BANK2
            0x0b00    U3PHYA
            0x0c00    U3PHYA_DA
u2 port1    0x1000    MISC
            0x1100    FMREG
            0x1300    U2PHY_COM
u3 port1    0x1700    SPLLC
            0x1800    CHIP
            0x1900    U3PHYD
            0x1a00    U3PHYD_BANK2
            0x1b00    U3PHYA
            0x1c00    U3PHYA_DA
u2 port2    0x2000    MISC
            ...

    SPLLC shared by u3 ports and FMREG shared by u2 ports on
mt8173/mt2701 are put back into each port; a new bank MISC for
u2 ports and CHIP for u3 ports are added on mt2712.
+6 −0
Original line number Diff line number Diff line
@@ -2,6 +2,7 @@ ROCKCHIP USB2.0 PHY WITH INNO IP BLOCK

Required properties (phy (parent) node):
 - compatible : should be one of the listed compatibles:
	* "rockchip,rk3328-usb2phy"
	* "rockchip,rk3366-usb2phy"
	* "rockchip,rk3399-usb2phy"
 - reg : the address offset of grf for usb-phy configuration.
@@ -11,6 +12,11 @@ Required properties (phy (parent) node):
Optional properties:
 - clocks : phandle + phy specifier pair, for the input clock of phy.
 - clock-names : input clock name of phy, must be "phyclk".
 - assigned-clocks : phandle of usb 480m clock.
 - assigned-clock-parents : parent of usb 480m clock, select between
		 usb-phy output 480m and xin24m.
		 Refer to clk/clock-bindings.txt for generic clock
		 consumer properties.

Required nodes : a sub-node is required for each port the phy provides.
		 The sub-node name is used to identify host or otg port,
Loading